IXP1200 Network Processor Family ATM OC-3/12/Ethernet IP Router Example Design
50 Application Note

Modified on: 3/20/02,

port_counter_inc() Algorithm
#if (IN_ENABLE_FLAGS & COUNTERS_ENABLE_MASK)
addr = IN_PORT_COUNTERS_BASE + 16 * (IN_PORT_BASE + in_port_index) +
IN_EXCEPTION_INDEX
*addr += 1
#endif
#if (IN_ENABLE_FLAGS & COUNT_PORT_EXCEPTIONS)
IN_TOTAL_DISCARDS += 1
#endif
Example
#define COUNT_PORT_EVENTS (1 << 11) // normal port activity
#define COUNT_PORT_EXCEPTIONS (1 << 12) // per-port exceptions

The 16 per-port counters are named by various include files, as summarized by the string table that

counters_print() uses to prin t the per-port counters:

char *port_counter_strings [] = {
"PORT_FULLQ",//0x00 port.uc
"PORT_RXERROR", //0x01 port.uc
"PORT_RXFAIL",//0x02 port.uc
"port counter 3",
"PORT_RXCANCEL",//0x04 port.uc
"PORT_SHDBE_SOP",//0x05 port.uc
"PORT_SHDBE_NOT_SOP", //0x06 port.uc
"port counter 7",
"IP_BAD_TOTAL_LENGTH", //0x08 ip.uc
"IP_BAD_TTL", //0x09 ip.uc
"IP_BAD_CHECKSUM", //0x0a ip.uc
"IP_NO_ROUTE", //0x0b ip.uc
"IP_INVALID_ADDRESS", //0x0c ip.uc
"MAC_INVALID_ADDRESS", //0x0d ether.uc
"IP_DBCAST_ADDRESS", //0x0e ip.uc
"PORT_DISABLED", //0x0f ip.uc
#define PORT_EXCEPTION EXCEPTION_COUNTERS, TOTAL_DISCARDS, ATM_PORT3,
COUNT_PORT_EXCEPTIONS
port_counter_inc(port_idx, ATM_PORT0, PORT_FULLQ, PORT_EXCEPTION)
IN_TOTAL_DISCARDS Address of global discard counter.
IN_MAX_PORT_NUMBER
Highest valid port number -- from a per-port counters point of view.
If the sum of IN_PORT_BASE and in_port_index exceeds
IN_MAX_PORT_NUMBER, then the port number is truncated to
IN_MAX_PORT_NUMBER. This allows limiting the scratchpad
RAM dedicated to counters while still allowing event counting on
very high numbered ports (e.g., logical ports used by the
StrongARM core)
IN_ENABLE_FLAGS
Counter increment flag. Must match the
COUNTERS_ENABLE_MASK bit. If set to
COUNT_PORT_EXCEPTIONS, the global counter at
IN_TOTAL_DISCARDS will be incremented in addition to the per-
port counter.
Parameter Description