Patent ID: 11882039
Assignee: ZHEJIANG LAB
Field: Digital communication (Electrical engineering)
Classification: CPC H | IPC H

Claim 4:
5. A non-transitory computer-readable storage medium storing a program, when the program is executed by a processor, a UDF-based traffic offloading method is implemented, wherein the method comprises:
in response to receiving a target packet for target traffic in a network, performing P4 language programming description on a protocol packet format of the target packet and parsing, matching and offloading rules of the target packet, to obtain a P4 program; and performing description for a corresponding flow table on the parsing, matching and offloading rules of the target packet;
compiling and mapping the P4 program by UDF-oriented compilation and mapping method, to obtain a UDF rule, and sending the UDF rule to an ASIC chip, further comprising:
performing front-end compilation for the P4 program to generate a front-end compilation result in JSON format;
performing UDF-oriented back-end compilation for the P4 program to obtain a back-end compilation result, wherein performing UDF-oriented back-end compilation for the P4 program to obtain the back-end compilation result, comprising: extracting a key field, an offset field, a length field, a mask field and a value field of the target packet from the front-end compilation result and the corresponding flow table to obtain the back-end compilation result;
mapping fields corresponding to the UDF rule in the back-end compilation result to generate the corresponding UDF rule;
sending the UDF rule to the ASIC chip that supports UDF;
in the ASIC chip, matching a traffic offloading rule according to the UDF rule, and executing a traffic offloading action according to the traffic offloading rule, wherein the traffic offloading action comprises offloading the target packet to a corresponding processing node or discarding the target packet, further comprising:
retrieving a table entry corresponding to the target packet in a UDF rule table in the ASIC chip;
determining an identification field of the target packet according to the table entry corresponding to the target packet, and performing matching according to the UDF rule of the table entry corresponding to the target packet to determine the corresponding traffic offloading rule, the step 3.2 comprising:
determining an offloading identification field of the target packet according to the offset field and the length field in the UDF rule of the table entry corresponding to the target packet;
extracting the offloading identification field, and performing “AND” calculation on the offloading identification field and the mask field in the UDF rule of the table entry corresponding to the target packet, to obtain a valid matching value;
matching the valid matching value with the value field in the UDF rule of the table entry corresponding to the target packet, and in response to determining that the valid matching value is equal to the value field in the UDF rule of the table entry corresponding to the target packet, determining the traffic offloading rule of the target packet, wherein the traffic offloading rule comprises: ID, the key field, the offset field and the length field of the table entry corresponding to the target packet;
determining the traffic offloading action from an action table according to the traffic offloading rule;
executing the traffic offloading action, wherein the traffic offloading action comprises offloading the target packet to a corresponding processing node or discarding the target packet.