Patent ID: 8793358

Claim:
A method for processing a data packet, the method comprising: when processing the data packet with each of a plurality of pipelined packet processing units included within a packet processing circuit of a network device, generating one or more events with one or more of the plurality of pipelined packet processing units of the packet processing circuit, each of the plurality of pipelined packet processing units representing a different functional stage in a packet processing pipeline performed by the packet processing circuit; determining, with the one or more of the plurality of pipelined packet processing units, whether to associate one or more of a trap and a sampling class with the data packet based on the generated events, wherein the trap indicates that the packet is to require special handling by a special handling unit external to the packet processing engine of the network device, and wherein the sampling class indicates that the packet is to be copied by the network device to form a duplicate packet; setting, with the one or more of the plurality of pipelined packet processing units, one or more bits of a vector that is passed internally between each of the plurality of pipelined packet processing units of the packet processing circuit to associate the packet with the determined trap or sampling class in response to the events and to defer handling of the events at the different functional stares of the packet processing pipeline until each of the plurality of pipelined packet processing units have processed the packet to determine a nexthop to which to send the packet; and after processing the packet with each of the plurality of packet processing units to determine the next hop to which to send the packet, processing the packet with the packet processing circuit in accordance with the set one or more bits of the vector to handle the one or more events generated by any one of the plurality of pipelined packet processing units.