Patent ID: 8867395

Claim:
A method, executed by a network processor, for accelerating data packet parsing, the method comprising: loading, by a parser, executed by one or more processing units in the network processor, operating in a normal operation mode, at least one rule from a rules repository in a first working cycle, the rules repository comprising a plurality of rules and each rule in the plurality of rules comprising a set of fields encoded in the rule identifying characteristics of the rule, wherein the plurality of rules of the rules repository comprise rules of at least a first rule type and a second rule type, a rule type of each rule being indicated in a rule type (RT) field in the set of fields encoded in the rule identifying the characteristics of the rule, wherein each rule of the first rule type is executed by the parser in normal operation mode, and wherein each rule of the second rule type is executed by the parser in normal operation mode when the rule is executed for the first time after the rule has been loaded to one or more registers of one or more processing units executing instructions of the parser and is executed in repeat operation mode when the rule is executed in an m th repeat, m being an integer larger 1; executing, by the parser operating in the normal operation mode, an instruction of the at least one loaded rule on a data packet in a second working cycle by the parser, wherein the parser thereby analyzes the data packet and generates an analysis result; dynamically switching, by the parser, from the normal operation mode to a repeat operation mode, the switching being executed in dependence on analysis result; and responsive to the parser switching to repeat operation mode, reapplying, by the parser in the repeat operation mode, the instruction on the data packet in each of one or more repeats in one or more subsequent working cycles, and wherein the parser dynamically determines a number of the one or more repeats from a repeat count (RC) field in a set of fields encoded in the at least one first rule identifying characteristics of the at least one first rule.