IP Library Granted Patent US 12695698
Granted Patent B2
US 12695698 · App. 18/471,725 · Granted Jul 28, 2026

Packet processing method and network device

Inventors: Shihan Xiao (Beijing, CN); Bo Wu (Shenzhen, CN); Haibo Wang (Beijing, CN); Xiaofei Xu (Beijing, CN)
Assignee: HUAWEI TECHNOLOGIES CO., LTD.
H04L45/745G06N3/08H04L49/55
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12695698
App. No.
18/471,725
Granted
Jul 28, 2026
Kind
B2
Abstract

In a packet processing method, a network device obtains a first packet. The network device determines a first index value based on address information of the first packet and a neural network model. The network device determines, from an action information table based on the first index value, action information corresponding to the first packet, where the action information table includes at least one entry, and each entry corresponds to an index value and a piece of action information. The network device processes the first packet based on the action information corresponding to the first packet.

Claims (72)

1 . A method, comprising:

obtaining, by a network device, a first packet comprising address information;

identifying, by the network device based on the address information and a neural network model, a first index value;

identifying, by the network device from an action information table based on the first index value, first action information corresponding to the first packet, wherein the action information table comprises a first entry corresponding to the first index value and a piece of the first action information;

identifying, by the network device based on the address information and a lookup trie structure, a second index value, wherein the lookup trie structure comprises a second entry that is in a packet rule information table and that cannot be fitted using the neural network model;

identifying, by the network device from the first index value and the second index value, a first target index value;

further identifying, by the network device from the action information table based on the first target index value, the first action information; and

processing, by the network device based on the first action information, the first packet.

2 . The method of claim 1 , further comprising obtaining, by the network device, the neural network model by performing model training based on the packet rule information table.

3 . The method of claim 1 , wherein the packet rule information table comprises a third entry corresponding to a third index value and a piece of second action information, and wherein the action information table indicates the second action information corresponding to the third entry.

4 . The method of claim 1 , wherein a third entry in the packet rule information table corresponds to a fourth entry in the action information table, wherein the third entry and the fourth entry comprises one or more entries, wherein one or more third index values corresponding to the third entry is the same as one or more fourth index values corresponding to the fourth entry, and wherein the one or more fourth index values comprises the first index value.

5 . The method of claim 1 , wherein identifying, the first index value comprises:

identifying, by the network device based on the address information and the neural network model, a third index value corresponding to a third entry in the packet rule information table; and

further identifying, by the network device from a mapping table based on the third index value, the first index value corresponding to a fourth entry in the action information table, wherein the fourth entry corresponds to the third entry, and wherein the mapping table comprises a fourth index value of a fifth entry that is in the action information table and that corresponds to each entry in the packet rule information table.

6 . The method of claim 1 , wherein identifying the first target index value comprises:

identifying, by the network device, a first mask length corresponding to the first index value and a second mask length corresponding to the second index value;

selecting, by the network device, the first index value as the first target index value when the first mask length is longer than the second mask length; and

selecting, by the network device, the second index value as the first target index value when the first mask length is shorter than the second mask length.

7 . The method of claim 1 , wherein identifying the first target index value comprises:

identifying, by the network device, that the first index value corresponds to a third entry in an error correction table and that the second index value corresponds to a fourth entry in the error correction table, wherein the error correction table comprises a fifth entry corresponding to a third index value and a first priority, wherein fifth entries in the error correction table are in a one-to-one correspondence with sixth entries in the packet rule information table in order of index values, wherein each of the sixth entries corresponds to a second priority, and wherein the first priority is the same as the second priority of a corresponding entry in the packet rule information table;

identifying, by the network device based on the error correction table, a third priority corresponding to the fifth entry and a fourth priority corresponding to the fourth entry;

selecting, by the network device, the first index value as the first target index value when the third priority is higher than the fourth priority; and

selecting, by the network device, the third index value as the first target index value when the third priority is lower than the fourth priority.

8 . The method of claim 1 , further comprising:

identifying, by the network device from an error correction table, first prefixes and first masks corresponding to a third entry, wherein the error correction table comprises a fourth entry corresponding to the second index value and has corresponding address information, wherein the corresponding address information comprises a second prefix and a second mask, and wherein the third entry comprises a fifth entry that is in the error correction table and that corresponds to the first index value and a sixth entry that is in the error correction table and that corresponds to a fourth index value in a preset threshold range of the first index value;

identifying, by the network device, that a third prefix corresponding to a seventh entry of the third entry matches a destination address of the first packet, wherein a third mask corresponding to the sixth seventh entry is a longest mask in the first masks;

identifying, by the network device, a fifth index value corresponding to the seventh entry; and

further identifying, from the action information table based on the fifth index value, the first action information.

9 . The method of claim 1 , further comprising:

identifying, by the network device from an error correction table, first prefixes and first masks corresponding to a third entry, wherein the error correction table comprises a fourth entry corresponding to the second index value and has corresponding address information, wherein the corresponding address information comprises a second prefix and a second mask, and wherein the third entry comprise a fifth entry that is in the error correction table and that corresponds to the first index value and a sixth entry that is in the error correction table and that corresponds to a fourth index value in a preset threshold range of the first index value;

identifying that a third prefix corresponding to a seventh entry in the third entry matches a destination address of the first packet, wherein a third mask corresponding to the seventh entry is a longest mask in the first masks;

identifying, by the network device, a fifth index value corresponding to the seventh entry;

identifying, by the network device based on the address information and the lookup trie structure, a sixth index value, wherein the lookup trie structure corresponds to an eighth entry that is in the packet rule information table and that cannot be fitted using the neural network model;

identifying, by the network device from the fifth index value and the sixth index value, the first target index value; and

further identifying, by the network device from the action information table based on the first target index value, the first action information.

10 . The method of claim 8 , wherein fifth entries in the error correction table are in a one-to-one correspondence with sixth entries in the packet rule information table in order of index values, wherein second address information corresponding to the fifth entries correspond to corresponding entries in the packet rule information table, wherein the packet rule information table comprises an eighth entry corresponding to a seventh index value and a piece of second action information, and corresponding third address information, and wherein the action information table indicates third action information corresponding to the eighth entry.

11 . The method of claim 1 , wherein the first action information comprises port information, and wherein the method further comprises:

identifying, by the network device based on the port information, a next-hop routing node of the first packet; and

forwarding, by the network device to the next-hop routing node, the first packet.

12 . The method of claim 1 , wherein before identifying the first index value, the method further comprises:

identifying, by the network device, a neural network structure; and

performing, by the network device based on the packet rule information table and the neural network structure, training to obtain the neural network model, wherein the packet rule information table comprises a third entry, corresponding to the second index value and a piece of second action information, and wherein the action information table indicates the second action information.

13 . The method of claim 1 , further comprising:

identifying, by the network device, a third entry that is in the packet rule information table and that cannot be fitted using the neural network model, wherein the packet rule information table comprises a fourth entry corresponding to a third index value and a piece of second action information, and wherein the action information table indicates the second action information; and

representing, by the network device based on a lookup trie algorithm, the third entry to obtain the lookup trie structure.

14 . A network device comprising:

a memory configured to store program instructions; and

one or more processors coupled to the memory and configured to execute the program instructions to cause the network device to:

obtain a first packet comprising address information;

identify, based on the address information and a neural network model, a first index value;

identify, from an action information table based on the first index value, first action information corresponding to the first packet, wherein the action information table comprises a first entry corresponding to the first index value and a piece of second action information;

identify, based on the address information and a lookup trie structure, a second index value, wherein the lookup trie structure comprises a second entry that is in a packet rule information table and that cannot be fitted using the neural network model;

identify, from the first index value and the second index value, a first target index value;

further identify, from the action information table based on the first target index value, the first action information; and

process, based on the first action information, the first packet.

15 . The network device of claim 14 , wherein the one or more processors is further configured to execute the program instructions to cause the network device to obtain, by performing model training based on the packet rule information table, the neural network model.

16 . The network device of claim 14 , wherein the packet rule information table comprises a third entry corresponding to a third index value and a piece of second action information, and wherein the action information table indicates the second action information corresponding to the third entry.

17 . The network device of claim 14 , wherein a third entry in the packet rule information table corresponds to a fourth entry in the action information table, wherein the third entry and the fourth entry comprises one or more entries, wherein one or more third index values corresponding to the third entry are the same as one or more fourth index values corresponding to the fourth entry, and wherein the one or more fourth index values comprise the first index value.

18 . A computer program product comprising computer executable instructions stored on a non-transitory computer-readable storage medium and that, when executed by one or more processors, cause a network device to:

obtain a first packet comprising address information;

identify, based on the address information and a neural network model, a first index value;

identify, from an action information table based on the first index value, first action information corresponding to the first packet, wherein the action information table comprises a first entry corresponding to the first index value and a piece of the first action information;

identify, based on the address information and a lookup trie structure, a second index value, wherein the lookup trie structure comprises a second entry that is in a packet rule information table and that cannot be fitted using the neural network model;

identify, from the first index value and the second index value, a first target index value;

further identify, from the action information table based on the first target index value, the first action information; and

process, based on the first action information, the first packet.

19 . The computer program product of claim 18 , wherein the computer executable instructions, when executed by the one or more processors, further cause the network device to:

identify a neural network structure; and

perform, by the network device based on the packet rule information table and the neural network structure, training to obtain the neural network model, wherein the packet rule information table comprises a third entry, corresponding to the second index value and a piece of second action information, and wherein the action information table indicates the second action information.

20 . The computer program product of claim 18 , wherein the computer executable instructions, when executed by the one or more processors, further cause the network device to:

identify a third entry that is in the packet rule information table and that cannot be fitted using the neural network model, wherein the packet rule information table comprises a fourth entry corresponding to a third index value and a piece of second action information, and wherein the action information table indicates the second action information; and

represent, by the network device based on a lookup trie algorithm, the third entry to obtain the lookup trie structure.