Broadcom switch tag

Switch tag structure

The Broadcom switch tag is 4 octets long.

The first octet of the tag has the format:
+----------------------------------------------------------+
| OPcode[7:5] | OPcode-dependent[4:0]                      |
+----------------------------------------------------------+

The OPcode field has a value that is one of:

  • 0b000, if the tag is an egress tag, for a packet going from the switch to the management port;
  • 0b001, if the tag is an ingress tag, for a packet going from the management port to the switch.

Other values are reserved.

The format for an egress tag is:

+----------------------------------------------------------+
| OPcode[7:5] | Traffic class[4:2] | Tag enforcement[1:0]  |
+----------------------------------------------------------+
| Time stamp[7] | Unused[6:0]                              |
+----------------------------------------------------------+
| Reserved[7:1]                         |Destination map[0]|
+----------------------------------------------------------+
| Destination map[7:0]                                     |
+----------------------------------------------------------+

The traffic class (TC) field values map to 802.1p/CoS traffic classes.

The tag enforcement (TE) field has a value that is one of:

  • 0b00, if there is no enforcement;
  • 0b01, if there is untag enforcement (VLAN untagged packets are checked against VLAN entries);
  • 0b10, if there is header enforcement.

0b11 is a reserved value.

The TS bit indicates whether the packets should be timestamped or not by the switch. That tells the network stack whether to expect PTP packets to follow.

The destination map is a bit mask of ports to send a packet to; it can be either one or multiple ports (e.g: broadcast/multicast), and the possible values are 0 through 0x1ff (total of 9 ports). The switch takes care of copying the packet to multiple ports if specified.

The format for an ingress tag is:

+----------------------------------------------------------+
| OPcode[7:5] | Reserved[4:0]                              |
+----------------------------------------------------------+
| Classification ID[7:0]                                   |
+----------------------------------------------------------+
| Reason code[7:0]                                         |
+----------------------------------------------------------+
| Traffic class[7:5]  | Source port number[4:0]            |
+----------------------------------------------------------+

The classification ID is a number from 0 to 255. Broadcom switches feature a Compact Field Processor (CFP) which is a TCAM capable of parsing layer 2, 3 and 4 packets and perform an action which can be: redirect the packet to a certain queue/port (bypassing traditional switching decisions), police the packet (e.g.: rate limit it), etc. The TCAM has 256 entries, so when the packet hits a particular entry due to a match, it can eventually get copied to the management port and the classification ID will reflect which TCAM entry index was hit.

The reason code is set when the packets are sent to the management port; its value is one of:
  • 0: mirroring: the CPU is a capturing device.
  • 1: MAC SA learning.
  • 2: Switching: CPU is the intended destination port for the packet.
  • 3: Protocol termination: 802.1 protocol that needs to be terminated by the CPU, e.g 802.1x/RADIUS.
  • 4: Protocol snooping: the CPU needs to look at the packets: IGMP/MLD, RARP/ARP/DHCP etc.
  • 5: Exception processing flooding.

Values of 6 and 7 are reserved.

The traffic class (TC) field values map to 802.1p/CoS traffic classes.