Data processing method and device
By using mapping rules in programmable network devices to quickly match table entry processing rules, the problem of low communication efficiency between programmable network devices and network controllers is solved, and lower network latency and resource utilization efficiency are achieved.
Patent Information
- Application Number
- CN202410311595.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-14
- Publication Date
- 2025-09-16
AI Technical Summary
The communication efficiency between programmable network devices and network controllers is low, causing data flow to backlog at the devices and increasing network latency.
The index of the data stream is determined through mapping rules, and the table processing rules are quickly matched. If no match is found, it is forwarded to the server for processing, utilizing the processing power of network devices and servers to reduce latency.
It reduces the latency of network devices, fully utilizes the processing capabilities of network devices and servers, and reduces signaling overhead and resource waste.
Smart Images

Figure CN120658686A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data processing method and device. Background Art
[0002] A network function (NF) is a device that processes packets in the data plane of a computer network. It improves network performance and security, and can be used in applications such as firewalls and load balancers. NFs are located at the critical path of packet transmission and processing, and their efficiency directly impacts the end-to-end performance of the network and applications, such as throughput and latency. Traditional NFs consist of standalone hardware devices and software running on servers.
[0003] In recent years, programmable network devices have gradually emerged, and implementing network elements on these devices has great potential. Compared with hardware devices, programmable network devices provide a programming model for implementing network elements, which has the advantages of agile development and rapid iteration. Compared with server-side software, programmable network devices have the advantages of rate limiting and low latency.
[0004] Network elements deployed on programmable network devices are usually updated by network controllers. When a programmable network device encounters a data flow that it cannot process, it needs to forward the message of the data flow to the network controller. The network controller determines the processing rules based on the message and then sends the processing rules to the programmable network device. After installing the processing rules, the programmable network device can process the corresponding data flow.
[0005] However, the communication efficiency between programmable network devices and network controllers is far lower than the receiving rate of data streams. During the period of waiting for processing rules, data streams will be backlogged at the programmable network devices, resulting in increased network delay. Summary of the Invention
[0006] Embodiments of the present application provide a data processing method, apparatus, computer-readable storage medium, and computer program product, which can reduce network delay of network devices.
[0007] In a first aspect, an embodiment of the present application provides a method for data processing, the execution subject of the method may be a network device or a chip applied to a network device (an example of a first device), and the following description is made using the execution subject being a network device as an example. The method includes: receiving first data, the first data including a first flow identifier, the first flow identifier indicating the data flow to which the first data belongs; determining a first index corresponding to the first flow identifier according to a mapping rule; determining a first table entry from a table entry set according to the first index, the first table entry being the table entry corresponding to the first index; when the flow identifier field in the first table entry matches the first flow identifier, processing the first table entry according to the first data, and processing the first data according to the first table entry; or, when the flow identifier field in the first table entry does not match the first flow identifier, sending the first data to a second device.
[0008] The network device is, for example, a switch or a smart network card, and the second device is, for example, a server. The processing speed of the switch or smart network card is usually greater than the processing speed of the server, and the switch or smart network card should be used to process the data flow as much as possible. In this embodiment, the network device determines the first index corresponding to the first flow identifier through the mapping rule, and then determines whether there is a corresponding processing rule based on the first index, that is, the first table entry. Since there is only one result output by the mapping rule, the network device will only perform a match once. Compared with the method of traversing the processing rules, this embodiment can quickly determine whether there is a processing rule that matches the first flow identifier, thereby reducing the delay of the network device. In addition, if there is no processing rule corresponding to the first flow identifier, the server processes the data flow corresponding to the first flow identifier, and the network device no longer processes the data flow corresponding to the first flow identifier. In this way, the delay of the server sending the processing rule to the network device is eliminated, and the processing capacity of the server can be fully utilized.
[0009] In an optional implementation of the first aspect, the flow identification field in the first table entry matches the first flow identification, including: the flow identification field of the first table entry is empty, or the flow identification in the flow identification field of the first table entry is the first flow identification; the flow identification field in the first table entry does not match the first flow identification, including: the flow identification in the flow identification field of the first table entry is the second flow identification.
[0010] If the flow identifier field of the first table entry is empty, it means that the first table entry has not been occupied (that is, the data flow corresponding to the first flow identifier is a new flow), and the network device can use the processing rules in the first table entry to process the first data. This situation can be considered a match. If the flow identifier field of the first table entry is the first flow identifier, it means that the first table entry has been occupied by the first flow identifier, and the network device can also use the processing rules in the first table entry to process the first data. This situation can be considered a match. If the flow identifier field of the first table entry is the second flow identifier, it means that the first table entry has been occupied by the second flow identifier, and the second flow identifier is a flow identifier different from the first flow identifier. The network device can no longer use the processing rules in the first table entry to process the first data, and can forward the first data to the server, and the server will process the first data. This situation can be considered a mismatch.
[0011] In an optional implementation of the first aspect, any entry in the entry set includes a status field, and the status fields of any two entries in the entry set are different.
[0012] In some cases, it is necessary to find a status field (e.g., address) for each new flow that is not used by other flows. However, the flow identifier matching method based on mapping rules cannot traverse all states and cannot determine whether the status field of the current entry is used by other flows. In this embodiment, each entry in the entry set is preset, which ensures that the status fields of any two entries are different. Therefore, the flow identifier matching method based on mapping rules can find a status field for each new flow that is not used by other flows.
[0013] In an optional embodiment of the first aspect, the flow identifier field in the first table entry does not match the first flow identifier, the flow identifier in the flow identifier field of the first table entry is the second flow identifier, and the data flow corresponding to the second flow identifier arrives at the first device before the data flow corresponding to the first flow identifier. The method also includes: receiving indication information from the second device, the indication information indicating the exchange of the data flow corresponding to the first flow identifier and the data flow corresponding to the second flow identifier, wherein the data volume of the data flow corresponding to the first flow identifier is greater than the data volume of the data flow corresponding to the second flow identifier; sending the status of the data flow corresponding to the second flow identifier and the data flow corresponding to the second flow identifier to the second device according to the indication information; receiving the status of the data flow corresponding to the first flow identifier and the data flow corresponding to the first flow identifier from the second device, the data flow corresponding to the first flow identifier including the first data; updating the first table entry according to the status of the data flow corresponding to the first flow identifier and the data flow corresponding to the first flow identifier.
[0014] In the event of a mismatch, the network device may forward the data stream corresponding to the first flow identifier to the server, where the data stream includes the first data. Optionally, the data stream may also include more data including the first flow identifier. When the network device starts forwarding the data stream corresponding to the first flow identifier, it is not certain which data stream has a larger data volume between the data stream corresponding to the first flow identifier and the data stream corresponding to the second flow identifier. This may cause the data stream with a larger data volume to be forwarded to the server, while the data stream with a smaller data volume is processed by the network device, thereby wasting the high-quality resources (higher data processing speed) of the network device. In this embodiment, the server determines the data volume of the data streams corresponding to the two flow identifiers mapped to the same index. If the data volume of the data stream corresponding to the first flow identifier is greater than the data volume of the data stream corresponding to the second flow identifier, the network device is instructed to exchange the data streams corresponding to the two flow identifiers, so that the data stream with a larger data volume (the data stream corresponding to the first flow identifier) is processed by the network device, and the data stream with a smaller data volume (the data stream corresponding to the second flow identifier) is processed by the server, thereby making full use of the high-quality resources of the network device and reducing network delay.
[0015] In an optional implementation of the first aspect, before receiving the data flow corresponding to the first flow identifier and the status of the data flow corresponding to the first flow identifier from the second device, the method further includes: suspending use of the first table entry according to the indication information.
[0016] Receiving the data and data flow status corresponding to the first flow identifier takes a certain amount of time. Before the reception is complete, the network device suspends the use of the first table entry. In this way, the data flow with a smaller amount of data (the data flow corresponding to the second flow identifier) will be forwarded to the server for processing. Therefore, this embodiment can complete data flow exchange as quickly as possible.
[0017] In an optional implementation of the first aspect, before receiving the indication information from the second device, the method further includes: determining the data volume of the data flow corresponding to the second flow identifier; and writing the data volume of the data flow corresponding to the second flow identifier into the first data.
[0018] By carrying the data amount through the first data, the data amount of the data flow corresponding to the second flow identifier is notified to the server without designing dedicated signaling, thereby reducing the signaling overhead of data amount notification.
[0019] In an optional implementation of the first aspect, after the first table entry starts to be updated, the method further includes: receiving second data from a device other than the second device, the second data including the first flow identifier; sending the second data to the second device; receiving the second data from the second device; and updating the first table entry based on the second data.
[0020] It takes a certain amount of time to update the first table entry. Before the first table entry starts to be updated, there may be some data corresponding to the first flow identifier on the link between the network device and the server. Compared with the second data, the reception time of these data is earlier and needs to be processed first. Therefore, this embodiment forwards the newly received data containing the first flow identifier (such as the second data) during the update of the first table entry to the server, and the server forwards it to the network device, so that the data corresponding to the first flow identifier can be processed sequentially according to the reception time.
[0021] In an optional implementation of the first aspect, the method further includes: writing the number of the second data in the second data; recording the latest number of the data corresponding to the first flow identifier; and determining that the update of the first table entry is completed when the number of the data containing the first flow identifier received from the second device is the same as the latest number.
[0022] When the number of the data containing the first flow identifier received from the second device is the same as the latest number, it indicates that all current data containing the first flow identifier has been processed by the network device and the need to process the data in the order of receipt time no longer exists. If the network device receives the data stream corresponding to the first flow identifier again, it can directly process it locally without forwarding it to the server. Therefore, when the number of the data containing the first flow identifier received from the second device is the same as the latest number, the network device can determine that the update of the first table entry is complete.
[0023] In an optional embodiment of the first aspect, the method also includes: receiving third data from a device other than the second device, the third data including a first flow identifier; determining a first index corresponding to the first flow identifier according to a mapping rule; determining a first table entry from a table entry set according to the first index; determining that a flow identifier field in the first table entry matches the first flow identifier; and processing the first table entry according to the third data.
[0024] After the update of the first table entry is completed, the flow identification field in the first table entry is changed to the first flow identification. When the network device receives the third data, it can determine the first table entry that matches it based on the first flow identification in the third data, so that it can use a faster processing speed to locally process a data flow with a large amount of data, that is, the data flow corresponding to the first flow identification, thereby reducing network delay.
[0025] In an optional embodiment of the first aspect, the method also includes: receiving fourth data from a device other than the second device, the fourth data including a second flow identifier; determining a first index corresponding to the second flow identifier according to a mapping rule; determining a first table entry from a table entry set according to the first index; determining that a flow identifier field in the first table entry matches the second flow identifier; and sending the fourth data to the second device.
[0026] After the first table entry is updated, the flow identifier field in the first table entry is changed to the first flow identifier. When the network device receives the fourth data, it determines that the first table entry does not match the second flow identifier based on the second flow identifier in the fourth data. The network device can forward the fourth data to the server, and the server with weaker processing capabilities will process the data flow with a smaller data volume (i.e., the data flow corresponding to the second flow identifier), so that resources can be fully utilized.
[0027] In a second aspect, an embodiment of the present application provides a method for data processing, wherein the execution subject of the method may be a server or a chip applied to the server (an example of a second device), and the following description is based on the example of the execution subject being a server. The method includes: determining the data volume of a data flow corresponding to a first flow identifier and the data volume of a data flow corresponding to a second flow identifier, wherein the data flow corresponding to the first flow identifier is processed by the second device, and the data flow corresponding to the second flow identifier is processed by the first device; if the data volume of the data flow corresponding to the first flow identifier is greater than the data volume of the data flow corresponding to the second flow identifier, sending an indication message to the first device, the indication message instructing to exchange the data flow corresponding to the first flow identifier and the data flow corresponding to the second flow identifier.
[0028] In the case of a mismatch, the network device can forward the data stream corresponding to the first flow identifier to the server. However, when the network device starts forwarding the data stream corresponding to the first flow identifier, it is not sure which data stream has a larger data volume between the data stream corresponding to the first flow identifier and the data stream corresponding to the second flow identifier. This may cause the data stream with a larger data volume to be forwarded to the server, while the data stream with a smaller data volume is processed by the network device, thereby causing the high-quality resources of the network device (higher data processing speed) to be wasted. In this embodiment, the server determines the data volume of the data streams corresponding to the two flow identifiers mapped to the same index. If the data volume of the data stream corresponding to the first flow identifier is greater than the data volume of the data stream corresponding to the second flow identifier, the network device is instructed to exchange the data streams corresponding to the two flow identifiers, so that the data stream with a larger data volume (the data stream corresponding to the first flow identifier) is processed by the network device, and the data stream with a smaller data volume (the data stream corresponding to the second flow identifier) is processed by the server, thereby making full use of the high-quality resources of the network device and reducing network delay.
[0029] In an optional embodiment of the second aspect, the method also includes: sending the data flow corresponding to the first flow identifier and the status of the data flow corresponding to the first flow identifier to the first device; receiving the data flow corresponding to the second flow identifier and the status of the data flow corresponding to the second flow identifier from the first device; updating the second table entry according to the data flow corresponding to the second flow identifier and the status of the data flow corresponding to the second flow identifier, the second table entry being the table entry matched by the first flow identifier before sending the indication information.
[0030] The network device may update the first table entry based on the data flow corresponding to the first flow identifier and the status of the data flow corresponding to the first flow identifier, and update the flow identifier field in the first table entry to the flow identifier of the data flow with a larger data volume (e.g., the first flow identifier). Subsequently, the network device may locally process the data flow with a larger data volume. The server may also update the second table entry based on the data flow corresponding to the second flow identifier and the status of the data flow corresponding to the second flow identifier, and update the flow identifier field in the second table entry to the flow identifier of the data flow with a smaller data volume (e.g., the second flow identifier). Subsequently, the server may locally process the data flow with a smaller data volume.
[0031] In an optional implementation of the second aspect, the method further includes: receiving second data from the first device, the second data including the first flow identifier and the number of the second data; and sending the second data to the first device.
[0032] It takes a certain amount of time to update the first table entry. Before the first table entry starts to be updated, there may be some data corresponding to the first flow identifier on the link between the network device and the server. Compared with the second data, the reception time of these data is earlier and needs to be processed first. Therefore, this embodiment forwards the newly received data containing the first flow identifier (such as the second data) during the update of the first table entry to the server, and the server forwards it to the network device, so that the data corresponding to the first flow identifier can be processed sequentially according to the reception time.
[0033] In an optional embodiment of the second aspect, before determining the data volume of the data flow corresponding to the first flow identifier and the data volume of the data flow corresponding to the second flow identifier, the method also includes: receiving first data from the first device, the first data including the first flow identifier, and the first data including the data volume of the data flow corresponding to the second flow identifier.
[0034] By carrying the data amount through the first data, the data amount of the data flow corresponding to the second flow identifier is notified to the server without designing dedicated signaling, thereby reducing the signaling overhead of data amount notification.
[0035] In an optional implementation of the second aspect, the method further includes: receiving fourth data from the first device, the fourth data including the second flow identifier; and processing the fourth data according to the second flow identifier.
[0036] After the first table entry is updated, the flow identifier field in the first table entry is changed to the first flow identifier. When the network device receives the fourth data, it determines that the first table entry does not match the second flow identifier based on the second flow identifier in the fourth data. The network device can forward the fourth data to the server, and the server with weaker processing capabilities will process the data flow with a smaller data volume (i.e., the data flow corresponding to the second flow identifier), so that resources can be fully utilized.
[0037] In a third aspect, embodiments of the present application provide a data processing device. The device may include a processing unit and a transceiver unit, configured to perform any of the methods described in the first aspect and its optional embodiments, wherein the transceiver unit is a sending unit when performing the sending step and a receiving unit when performing the receiving step.
[0038] In a fourth aspect, embodiments of the present application provide another data processing device. The device may include a processing unit and a transceiver unit, configured to perform any of the methods described in the second aspect and its optional embodiments, wherein the transceiver unit is a sending unit when performing the sending step and a receiving unit when performing the receiving step.
[0039] In a fifth aspect, embodiments of the present application provide a data processing apparatus, which may be a network device or a chip applied to a network device. The apparatus may include a processor configured to execute any of the methods in the first aspect and its optional embodiments.
[0040] Optionally, when the device is a network device, the processor is, for example, a system on chip (SoC) or a central processor unit (CPU); when the device is a chip, the processor is, for example, a core, which may include at least one execution unit, such as an arithmetic and logic unit (ALU).
[0041] Optionally, the device may further include a transceiver. When the device is a network device, the transceiver may be a transceiver circuit, an antenna, etc.; when the device is a chip, the transceiver may be an input / output interface, a pin, a circuit, etc.
[0042] Optionally, the apparatus may further include a memory configured to store a computer program or instructions, and the processor executes the computer program or instructions stored in the memory, causing the apparatus to perform any of the methods in the first aspect and its optional embodiments. When the apparatus is a network device, the memory may be a read-only memory, a random access memory, or the like; when the apparatus is a chip, the memory may be a register, a cache, or the like.
[0043] In a sixth aspect, embodiments of the present application provide a data processing device, which may be a server or a chip used in a server. The device may include a processor configured to execute any of the methods in the second aspect and its optional embodiments.
[0044] Optionally, when the device is a server, the processor is, for example, a CPU, an application specific integrated circuit (ASIC) or a field programmable gate array (FPGA); when the device is a chip, the processor is, for example, a core, which may include at least one execution unit, such as an ALU.
[0045] Optionally, the device may further include a transceiver. When the device is a server, the transceiver may be a transceiver circuit, an antenna, etc.; when the device is a chip, the transceiver may be an input / output interface, a pin, a circuit, etc.
[0046] Optionally, the device may further include a memory for storing a computer program or instructions, and the processor executes the computer program or instructions stored in the memory, so that the device performs any of the methods in the second aspect and its optional embodiments. When the device is a server, the memory may be a read-only memory, a random access memory, or the like; when the device is a chip, the memory may be a register, a cache, or the like.
[0047] In the seventh aspect, an embodiment of the present application provides a data processing system, which includes: the device described in the third aspect and the device described in the fourth aspect, or the device described in the fifth aspect and the device described in the sixth aspect.
[0048] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which, when executed on a data processing device, enables the device to execute: any one of the methods in the first aspect and its optional embodiments, or any one of the methods in the second aspect and its optional embodiments.
[0049] In the ninth aspect, an embodiment of the present application provides a computer program product, which includes: computer program code or computer program instructions, which, when the computer program code or computer program instructions are executed by a data processing device, enable the device to execute: any one of the methods in the first aspect and its optional embodiments, or any one of the methods in the second aspect and its optional embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 is a schematic diagram of a cloud network data center applicable to an embodiment of the present application;
[0051] Figure 2 is a schematic diagram of a programmable network device applicable to an embodiment of the present application;
[0052] Figure 3 is a schematic diagram of a data processing method provided in an embodiment of the present application;
[0053] Figure 4 yes Figure 3 A schematic diagram of an application scenario of the illustrated method;
[0054] Figure 5 yes Figure 3 A schematic diagram of another application scenario of the method shown;
[0055] Figure 6 is a schematic diagram of another data processing method provided in an embodiment of the present application;
[0056] Figure 7 yes Figure 6 A schematic diagram of an application scenario of the illustrated method;
[0057] Figure 8 yes Figure 6 A schematic diagram of another application scenario of the method shown;
[0058] Figure 9 is a structural diagram of a data processing device provided in an embodiment of the present application;
[0059] Figure 10 It is a structural diagram of another data processing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0060] The technical solution in this application will be described below with reference to the accompanying drawings.
[0061] In traditional information technology (IT) architectures, networks are essentially physical network devices, readily accessible. Network communication between servers is achieved through Ethernet cables or fiber optic connections, and most traffic control and access control policies are implemented on routers and switches. In the cloud computing era, networks encompass not only traditional physical hardware but also a large number of virtualized network devices and software applications running on ordinary servers.
[0062] In cloud computing networks (hereafter referred to as "cloud networks"), resource virtualization and automated allocation provide users with elastically scalable and flexibly configurable computing and storage resources, enabling the rapid and easy deployment of business systems. Essentially, cloud networks abstract the underlying physical network devices in data centers, enabling secondary segmentation, integration, and flexible management of network resources at the software level to quickly and flexibly meet the network usage requirements of various business scenarios.
[0063] Cloud networking has evolved to date. On the one hand, the virtualization capabilities of network hardware have been developed to support the comprehensive virtualization of data center infrastructure. These capabilities include standardized and rapid networking, on-demand expansion of network resource capacity, flexible deployment of network security management and control policies, support for metering and billing, and full-stack monitoring. On the other hand, the vigorous development of public clouds has also spawned cloud network products and services for enterprise tenants. These products and services simulate common network equipment or functions at the computer room level and are provided to cloud users in the form of software products and services.
[0064] Cloud networks have the characteristics of a large number of users and high transmission traffic, which place high demands on data processing. Figure 1 It is a schematic diagram of a cloud network data center applicable to an embodiment of the present application.
[0065] like Figure 1 As shown, the data center 100 can use a two-layer flat network architecture, for example, a spine-leaf network architecture, which includes 110-1 and 110-2 (collectively referred to as switches 110) as spine switches, and 120-1, 120-2, 120-3 and 120-4 (collectively referred to as switches 120) as leaf switches. Above the leaf switches can be a three-layer network, and below the leaf switches can be an independent two-layer broadcast domain. The number of downlink ports on the spine switches can determine the number of leaf switches, and the number of uplink ports on the leaf switches can determine the number of spine switches. The spine-leaf network has the advantages of high reliability, high performance and scalability. Each switch 120 can be used to connect one or more computing devices. As Figure 1 As shown, switch 120-1 is connected to server cluster 130-1, switch 120-2 is connected to server cluster 130-2, switch 120-3 is connected to server cluster 130-3, and switch 120-4 is connected to server cluster 130-4. Server cluster 130-1, server cluster 130-2, server cluster 130-3 and server cluster 130-4 can be collectively referred to as server cluster 130.
[0066] The server cluster 130 can be a server cabinet, and one or more access switches 120 can be deployed on each server cabinet. Each server in the server cabinet can be directly connected to the switch in the cabinet, enabling interconnection between the servers and the access switches within the cabinet. Optionally, the switch 120 can be located at the top of the server cabinet, and is therefore also called a top-of-rack switch (TOR). Alternatively, the switch 120 can be located in the middle or bottom of the server cabinet.
[0067] It should be understood that the server cabinet is an example and not a limitation of the server cluster 130. The server cluster 130 may also be other forms of servers, such as tower servers, blade servers, and rack servers. In addition, the server cluster 130 may also be a virtual server, such as a virtual machine (VM) or a container (Docker).
[0068] exist Figure 1 In the network architecture shown, the switches 120 and 110 are fully cross-connected. Communication between any two switches 120 can be achieved through a single switch 110. A single switch failure in any layer will not affect the entire network architecture. Therefore, this network architecture has high reliability. It should be understood that Figure 1 The Spine-Leaf network structure shown in the figure is an example and not a limitation. The embodiments of the present application can also be used in traditional three-layer network architecture or other network architectures.
[0069] In recent years, programmable network devices (such as programmable switches) have gradually emerged, and implementing network elements on such devices has great potential. Compared with hardware devices, programmable network devices provide a programming model for implementing network elements, which has the advantages of agile development and rapid iteration. Compared with server-side software, programmable network devices have the advantages of rate-limiting processing and low latency.
[0070] Figure 2 is a schematic diagram of a programmable network device applicable to an embodiment of the present application.
[0071] As shown in the figure, the programmable network device 200 can adopt a programmable protocol-independent switch architecture (PISA), which mainly includes an inlet pipeline 210, a shared memory 220, and an outlet pipeline 230. Among them, the inlet pipeline 210 and the outlet pipeline 230 have the same structure. Each pipeline starts with a programmable parser, followed by a match-action unit (MAU), and then a programmable inverse parser. In the inlet pipeline 210, the message may be forwarded, copied, discarded, or trigger flow control. The outlet pipeline 230 can further modify the message and send it to the corresponding egress port. Through programming, new network protocols or new network functions can be flexibly added to the programmable network device 200.
[0072] The ingress pipeline 210 includes a programmable parser 211 , a MAU 212 , and a programmable deparser 213 .
[0073] Users can customize the functions of the parser 211 through programming to parse the message into a customized data structure. For example, the programmable parser 211 uses a syntax analyzer to parse the message and convert it into a data structure that can be processed by the data plane processor of the programmable network device 200.
[0074] MAU 212 can load several entries, each of which includes a matching field (such as Figure 2 M in ) and an action field (as Figure 2 (As shown in A in Figure 1), the match field describes a flow, and the action field describes the processing logic for that flow. Each message belongs to a different flow. When MAU 212 receives a message, it performs a match lookup based on the match field and executes the corresponding action based on the action field. Both the match field and the action field can be defined programmatically. For example, the logic in MAU 212 can be written in a domain-specific language (DSL), enabling customized message processing and enabling the implementation of various network elements.
[0075] The programmable deparser 213 is used to reassemble the processed header and the original message into a new message. The programmable deparser 213 can also be defined through programming.
[0076] The shared memory 220 is a high-speed storage pool for buffering messages. The programmable network device 200 implements the exchange of messages from the inlet to the outlet through the read and write operations on the shared memory 220 .
[0077] Egress pipeline 230 includes a programmable parser 231, MAU 312, and programmable inverse parser 313. The functionality of each component can also be customized through programming. The detailed functional descriptions of each unit in egress pipeline 230 can be found in the functional descriptions of each unit in ingress pipeline 210 and are not repeated here. It should be noted that ingress pipeline 210 and egress pipeline 230 can provide the same functionality and accommodate more processing logic.
[0078] The programmable network device 200 can be a switch, a smart network card, or a chip in a switch or a smart network card. When the programmable network device 200 is a chip, it can be implemented in a variety of ways, including but not limited to FPGA, ASIC, network processor (NP) and their combination. It should be understood that Figure 2 Only one example of a network device with programmable functions is shown; other programmable network devices currently available or to be developed in the future may also be applicable to the embodiments of the present application.
[0079] Current programmable network devices have a shortcoming: MAU table entries can only be loaded through the network controller. The network controller is not on the critical path for packet processing, so the MAU cannot be updated during packet processing. One type of network element needs to implement "dynamic state" processing, that is, to create the processing state of each flow in real time based on the observed flow. For example, a traffic statistics network element needs to implement "creating a counter for each newly appeared flow" and count it, and a network address translation network element needs to implement "assigning an address to each newly appeared flow" and perform address translation. When the MAU encounters this situation, it needs to forward the message to the network controller. The network controller determines the processing rule for handling the "dynamic state" based on the message and then sends this processing rule to the programmable network device. After the programmable network device installs this processing rule, it can implement "dynamic state" processing.
[0080] However, the communication efficiency between programmable network devices and network controllers is far lower than the receiving rate of data streams. During the period of waiting for processing rules, data streams will be backlogged at the programmable network devices, resulting in increased network delay.
[0081] The data processing method provided by the embodiment of the present application is described below. The method can be executed by a network device (such as a programmable network device 200), such as Figure 3 As shown, the method 300 includes:
[0082] S310: Receive first data, where the first data includes a first flow identifier.
[0083] The network device may receive the first data from a switch, or may receive the first data from a user device or a server. The various embodiments of the present application do not limit the sending end of the first data.
[0084] The first data may be a message or other types of data. The various embodiments of the present application do not limit the specific form of the first data.
[0085] The first data includes a first stream identifier, which indicates a data stream to which the first data belongs. A data stream refers to a set formed by at least one data.
[0086] After receiving the first data, the network device may parse the first data through a programmable parser to obtain a first flow identifier from the first data. Optionally, the network device may parse the first data into a custom data structure.
[0087] After determining the first flow identifier, the network device may perform the following steps.
[0088] S320: Determine a first index corresponding to the first flow identifier according to a mapping rule.
[0089] The above mapping rule may be a many-to-one mapping rule, that is, multiple flow identifiers may be mapped to the same index. Optionally, the mapping rule is a hash function.
[0090] S330: Determine a first entry from the entry set according to the first index.
[0091] The entry set includes at least one entry, each entry includes an index field, and the network device can query the index field of each entry through the MAU to determine the entry with the first index, that is, the first entry.
[0092] S340: Determine whether the flow identifier field in the first entry matches the first flow identifier.
[0093] Each entry in the entry set further includes a flow identifier field. After determining the first entry, the MAU may read the content of the flow identifier field of the first entry to determine whether the content matches the first flow identifier.
[0094] Optionally, the flow identifier field in the first table entry matches the first flow identifier, including: the flow identifier field in the first table entry is empty, or the flow identifier in the flow identifier field in the first table entry is the first flow identifier.
[0095] Optionally, the flow identifier field in the first table entry does not match the first flow identifier, including: the flow identifier in the flow identifier field of the first table entry is the second flow identifier.
[0096] If the flow identifier field of the first table entry is empty, it means that the first table entry has not been occupied (that is, the data flow corresponding to the first flow identifier is a new flow), and the network device can use the processing rules in the first table entry to process the first data. This situation can be regarded as a match, and the MAU can return "empty". If the flow identifier field of the first table entry is the first flow identifier, it means that the first table entry has been occupied by the first flow identifier, and the network device can also use the processing rules in the first table entry to process the first data. This situation can be regarded as a match, and the MAU can return "hit". If the flow identifier field of the first table entry is the second flow identifier, it means that the first table entry has been occupied by the second flow identifier (that is, the data flow corresponding to the second flow identifier arrives at the network device before the data flow corresponding to the first flow identifier). The second flow identifier is a flow identifier different from the first flow identifier. The network device can no longer use the processing rules in the first table entry to process the first data, and can forward the first data to the server for processing by the server. This situation can be regarded as a mismatch, and the MAU can return "conflict".
[0097] After determining the matching result, the network device can perform corresponding steps based on the matching result.
[0098] S350: When the flow identifier field in the first entry matches the first flow identifier, process the first entry according to the first data, and process the first data according to the first entry.
[0099] For example, the MAU function is to "create and count a counter for each newly emerged flow." When the result of the MAU querying the first table entry is "empty," the MAU may write the first flow identifier and a value of 1 into the first table entry, indicating that the first table entry is occupied by the first flow identifier and the count result is 1. Furthermore, the MAU may process the first data according to the processing rule (e.g., packet forwarding rule) in the first table entry.
[0100] For another example, the MAU function is to "create and count a counter for each newly emerged flow." When the MAU queries the first table entry and the result is a "hit," the MAU can write the value N+1 into the first table entry, indicating that the count result is N+1, where N is the value of the counter in the first table entry before the write operation. Furthermore, the MAU can process the first data according to the processing rule in the first table entry (e.g., the packet forwarding rule).
[0101] S360: When the flow identifier field in the first entry does not match the first flow identifier, send the first data to the server.
[0102] The MAU can map the first data to a table entry based on a hash function. Due to the probability of hash collisions in hash functions, data belonging to different data streams may be mapped to the same table entry, resulting in a mismatch. Due to the probability of hash collisions in hash functions, an MAU that performs matching operations based on mapping rules such as hash functions can also be called a probabilistic MAU.
[0103] For example, the function of MAU is to "create and count a counter for each newly appearing flow". When the result of MAU querying the first table entry is "conflict", it means that the first table entry has been occupied by other flow identifiers. The network device can send the first data to the server, and the server processes the first data.
[0104] In method 300, the network device determines the first index corresponding to the first flow identifier through the mapping rule, and then determines whether there is a corresponding processing rule based on the first index, that is, the first table entry. Since the mapping rule outputs only one result, the network device will only perform a match once. Compared with the method of traversing the processing rules, this embodiment can quickly determine whether there is a processing rule that matches the first flow identifier, thereby reducing the delay of the network device. In addition, if there is no processing rule corresponding to the first flow identifier, the server will process the data flow corresponding to the first flow identifier, and the network device will no longer process the data flow corresponding to the first flow identifier. In this way, the delay of the server sending the processing rule to the network device is eliminated, and the processing capacity of the server can be fully utilized.
[0105] An example of an application scenario of method 300 is as follows Figure 4 shown.
[0106] The data processing device in this application scenario includes a network device and a server, wherein the network device and the server can be integrated or separately configured. The network device and the server can communicate via a wired connection or a wireless connection. The wired connection can be an optical fiber, a cable, or a bus, and the wireless connection can be a cellular network connection, wireless fidelity (WiFi), Bluetooth, or Star Flash. The embodiments of the present application do not limit the connection method between the network device and the server.
[0107] The network device includes a probabilistic MAU, which stores a state table. The state table includes multiple entries, each of which includes an index field, a flow ID field, a state field, and a flag field. Each entry may also include more or fewer fields, which is not limited in the embodiments of the present application. After initialization, each field of the entry is empty.
[0108] Optionally, the state field in the table entry is a counter that can realize the data flow counting function. When the network device is working, assuming that flow 1 arrives at the network device first, the network device can parse the first message of flow 1 through the programmable parser, and parse out the identifier (identifier, ID) of flow 1, such as ID1. The programmable parser passes ID1 to the probabilistic MAU, and the probabilistic MAU processes ID1 through a hash function to obtain index 1. Then, the probabilistic MAU searches for the table entry corresponding to index 1 in the state table. Since the various fields of the table entry are empty after initialization, the flow identification field in the table entry corresponding to index 1 is empty, and the probabilistic MAU can return an "empty" result. Based on the "empty" result, the network device can write in the table entry corresponding to index 1.<ID1,1> , indicating that flow 1 occupies the entry corresponding to index 1, and the count of flow 1 is 1.
[0109] When the second message of flow 1 arrives at the network device, the network device can parse the second message of flow 1 through the programmable parser and parse out ID1. The programmable parser passes ID1 to the probabilistic MAU, which processes ID1 through a hash function to obtain index 1. Subsequently, the probabilistic MAU searches for the entry corresponding to index 1 in the state table. The flow identification field in the entry corresponding to the current index 1 has been written to ID1, and the probabilistic MAU can return a "hit" result. Based on the "hit" result, the network device can write<ID1,2> , indicating that flow 1 occupies the entry corresponding to index 1, and the count of flow 1 is 2.
[0110] Assume that the first message of flow 2 arrives at the network device after the second message of flow 1. The network device can parse the first message of flow 2 through a programmable parser and parse out ID2. The programmable parser passes ID2 to the probabilistic MAU, which processes ID2 through a hash function. If a hash conflict occurs, the probabilistic MAU may output index 1. Subsequently, the probabilistic MAU searches the state table for the entry corresponding to index 1. The flow identification field in the entry corresponding to index 1 is already written to ID1. ID1 is different from ID2, and the probabilistic MAU can return a "conflict" result. Based on this "conflict" result, the network device can determine not to process the first message of flow 2 and forward it to the server for processing. The server can count and process the messages of flow 2 through software NF.
[0111] In the example described above, the probabilistic MAU maps packets to a table entry. Therefore, the probabilistic MAU does not support table entry traversal. However, some data processing scenarios may require table entry traversal, which the probabilistic MAU struggles with.
[0112] For example, in a network address translation (NAT) scenario, an address that is not used by other flows needs to be found for each new flow. Therefore, it is necessary to traverse the table entries, determine the addresses of all current flows, and then assign an address that is not used by other flows to the new flow.
[0113] To implement the above functionality on a probabilistic MAU, optionally, when the network device or MAU is initialized, a controller (located on the server) simulates several new flows arriving at the network device and calculates the initial state of each simulated new flow. The controller then writes this initial state into an entry in the state table.
[0114] For example, the state field in the table is an address field that can realize the NAT function. Assume that a NAT network element is configured with an external network address of 11.22.33.44 during initialization. Then the results of each table entry after initialization in the state table are as follows: Figure 5 The state fields of any two entries in the state table have different values, and the flow identifier field of each entry in the state table is empty. Figure 5 The status table in is an example rather than a limitation, and each table entry may also include more or fewer fields.
[0115] When the network device is working, assuming that flow 1 arrives at the network device first, the network device can parse the first message of flow 1 through the programmable parser and parse out the identifier of flow 1, such as ID1. The programmable parser passes ID1 to the probabilistic MAU, and the probabilistic MAU processes ID1 through a hash function to obtain index 1. Subsequently, the probabilistic MAU searches for the table entry corresponding to index 1 in the state table. Since the flow identifier field in the table entry corresponding to index 1 is empty, the probabilistic MAU can return an "empty" result. Based on this "empty" result, the network device can write <id1>, indicating that flow 1 occupies the table entry corresponding to index 1. The network device can convert the address of the first packet of flow 1 to 10000 based on the status field in the table entry corresponding to index 1.
[0116] Assuming that the first message of flow 2 arrives at the network device after the first message of flow 1, the network device can parse the first message of flow 2 through the programmable parser and parse out ID2. The programmable parser passes ID2 to the probabilistic MAU, which processes ID2 through a hash function. If there is no hash conflict at present, the probabilistic MAU may output index 2. Subsequently, the probabilistic MAU searches for the table entry corresponding to index 2 in the state table. Since the flow identification field in the table entry corresponding to index 2 is empty, the probabilistic MAU can return an "empty" result. Based on this "empty" result, the network device can write <id2>, indicating that flow 2 occupies the table entry corresponding to index 2. The network device can convert the address of the first packet of flow 2 to 10001 based on the status field in the table entry corresponding to index 2.
[0117] It can be seen that in this embodiment, each entry in the entry set is preset, which can ensure that the status fields of any two entries are different, thereby realizing some data processing functions that require traversal operations in the probabilistic MAU.
[0118] As mentioned above, in a "conflict" scenario, the network device can forward the data flow corresponding to the "conflicting" flow identifier to the server. For example, Figure 4 In the example shown, the network device forwards flow 2 to the server. However, when the network device starts forwarding flow 2, it is not sure which data flow, flow 2 or flow 1, has a larger data volume. This may cause the data flow with a larger data volume to be forwarded to the server, while the data flow with a smaller data volume is processed by the network device, thereby wasting the high-quality resources of the network device (higher data processing speed).
[0119] Optionally, when the flow identifier field in the first table entry does not match the first flow identifier, and the flow identifier in the flow identifier field of the first table entry is the second flow identifier, as shown in FIG. Figure 6 As shown, the method 300 further includes:
[0120] S370: The server determines the data volume of the data flow corresponding to the first flow identifier and the data volume of the data flow corresponding to the second flow identifier.
[0121] The data flow corresponding to the first flow identifier is processed by the server, and the data flow corresponding to the second flow identifier is processed by the network device.
[0122] For example, the flow corresponding to the second flow identifier occupies the first table entry, the network device can count the traffic (i.e., data volume) of the flow corresponding to the second flow identifier, and the network device can periodically or non-periodically send the traffic corresponding to the second flow identifier to the server.
[0123] Optionally, the network device can write the traffic corresponding to the second flow identifier into the first data (data containing the first flow identifier), and inform the server of the traffic corresponding to the second flow identifier through the first data. In this way, there is no need to design dedicated signaling, thereby reducing signaling overhead.
[0124] After receiving the traffic corresponding to the second flow identifier, the server can determine the traffic corresponding to each flow identifier processed by the server, and run a traffic detection algorithm to process the traffic corresponding to the second flow identifier and the traffic corresponding to each flow identifier processed by the server, to determine the traffic of the data flows corresponding to multiple flow identifiers mapped to the same index. The detection algorithm is, for example, a heavy hitter detection algorithm. If the traffic corresponding to the first flow identifier is greater than the traffic corresponding to the second flow identifier, the server can perform the following steps.
[0125] S371: The server sends instruction information to the network device, where the instruction information instructs the network device to exchange the data flow corresponding to the first flow identifier and the data flow corresponding to the second flow identifier.
[0126] Correspondingly, the network device receives the indication information from the server.
[0127] Optionally, the network device may suspend use of the first entry according to the indication information.
[0128] Receiving the data and data flow status corresponding to the first flow identifier takes a certain amount of time. Before the reception is complete, the network device suspends the use of the first table entry, for example, by setting the flag bit of the first table entry to "invalid". In this way, the data flow corresponding to the second flow identifier will no longer be "hit". The data flow corresponding to the second flow identifier (i.e., the data flow with a smaller data volume) will be forwarded to the server for processing. Therefore, this embodiment can complete data flow exchange as quickly as possible.
[0129] S372: The network device sends the data flow and data flow status corresponding to the second flow identifier to the server according to the instruction information.
[0130] Correspondingly, the server receives the data flow and data flow status corresponding to the second flow identifier from the network device.
[0131] The data flow corresponding to the second flow identifier is, for example, the data flow received by the network device after receiving the indication information. The data flow state corresponding to the second flow identifier is the data flow state recorded when the indication information is received, such as the traffic corresponding to the second flow identifier.
[0132] S373: The server sends the data flow and data flow status corresponding to the first flow identifier to the network device.
[0133] Correspondingly, the network device receives the data flow and data flow status corresponding to the first flow identifier from the server.
[0134] The data flow corresponding to the first flow identifier is, for example, the data flow received by the server after sending the indication information. The data flow state corresponding to the first flow identifier is the data flow state recorded when sending the indication information, such as the traffic corresponding to the first flow identifier.
[0135] S372 and S373 can be executed simultaneously or sequentially. The embodiments of the present application do not limit the execution sequence of S372 and S373.
[0136] S374: The server updates a second entry according to the data flow corresponding to the second flow identifier and the state of the data flow corresponding to the second flow identifier. The second entry is the entry matched by the first flow identifier before the server sends the indication information.
[0137] The server can also update the second table entry based on the data flow corresponding to the second flow identifier and the status of the data flow corresponding to the second flow identifier, update the flow identifier field in the second table entry to the second flow identifier, and fill the status of the data flow corresponding to the second flow identifier into the status field of the second table entry. The server can then process the data flow with a smaller amount of data (the data flow corresponding to the second flow identifier) locally.
[0138] S375: The network device updates the first table entry according to the data flow corresponding to the first flow identifier and the state of the data flow corresponding to the first flow identifier.
[0139] For example, the network device can fill the first flow identifier into the flow identifier field of the first table entry, and fill the status of the data flow corresponding to the first flow identifier into the status field of the first table entry. Subsequently, the network device can locally process the data flow with a large amount of data (the data flow corresponding to the first flow identifier).
[0140] S374 and S375 can be executed simultaneously or one after another. The embodiments of the present application do not limit the execution sequence of S374 and S375.
[0141] Optionally, after the first entry starts to be updated, method 300 further includes:
[0142] receiving second data from a device other than the server, the second data including the first stream identifier;
[0143] sending second data to the server;
[0144] receiving second data from the server;
[0145] The first table entry is updated according to the second data.
[0146] It takes a certain amount of time to update the first table entry. Before the first table entry starts to be updated, there may be some data corresponding to the first flow identifier on the link between the network device and the server. Compared with the second data, the reception time of these data is earlier and needs to be processed first. Therefore, this embodiment forwards the newly received data containing the first flow identifier (such as the second data) during the update of the first table entry to the server, and the server forwards it to the network device, so that the data corresponding to the first flow identifier can be processed sequentially according to the reception time.
[0147] Optionally, the method 300 further includes:
[0148] Writing the second data number into the second data;
[0149] Record the latest number of the data corresponding to the first stream identifier;
[0150] When the number of the data including the first flow identifier received from the server is the same as the latest number, it is determined that the updating of the first entry is completed.
[0151] When the number of the data containing the first flow identifier received from the server is the same as the latest number, it indicates that all data containing the first flow identifier has been processed by the network device. The need to process the data in the order of receipt no longer exists. If the network device receives the data flow corresponding to the first flow identifier again, it can directly process it locally without forwarding it to the server. Therefore, when the number of the data containing the first flow identifier received from the server is the same as the latest number, the network device can determine that the first table entry update is complete, that is, the data flow exchange is complete.
[0152] Optionally, after the data flow exchange is completed, the network device can cancel the pause state of the first table entry, for example, set the flag bit of the first table entry to "effective", so that the data flow corresponding to the subsequent first flow identifier (that is, the data flow with a larger data volume) will have a "hit", and the data flow corresponding to the subsequent second flow identifier (that is, the data flow with a smaller data volume) will have a "conflict". The network device can forward the data flow with a smaller data volume to the server, use local high-quality resources to process the data flow with a larger data volume, and reduce network delay.
[0153] Optionally, the method 300 further includes:
[0154] receiving third data from a device other than the server, the third data including the first stream identifier;
[0155] Determine a first index corresponding to the first flow identifier according to a mapping rule;
[0156] Determine a first entry from the set of entries according to the first index;
[0157] Determining that the flow identifier field in the first table entry matches the first flow identifier;
[0158] The first table entry is processed according to the third data.
[0159] After the update of the first table entry is completed, the flow identification field in the first table entry is changed to the first flow identification. When the network device receives the third data, it can determine the first table entry that matches it based on the first flow identification in the third data, so that it can use a faster processing speed to locally process a data flow with a large amount of data, that is, the data flow corresponding to the first flow identification, thereby reducing network delay.
[0160] Optionally, the method 300 further includes:
[0161] receiving fourth data from a device other than the server, the fourth data including the second stream identifier;
[0162] Determine a first index corresponding to the second flow identifier according to the mapping rule;
[0163] Determine a first entry from the set of entries according to the first index;
[0164] Determining that the flow identifier field in the first table entry matches the second flow identifier;
[0165] The fourth data is sent to the server.
[0166] After the first table entry is updated, the flow identifier field in the first table entry is changed to the first flow identifier. When the network device receives the fourth data, it determines that the first table entry does not match the second flow identifier based on the second flow identifier in the fourth data. The network device can forward the fourth data to the server, and the server with weaker processing capabilities will process the data flow with a smaller data volume (i.e., the data flow corresponding to the second flow identifier), so that resources can be fully utilized.
[0167] Another example of application scenario of method 300 is as follows: Figure 7 shown.
[0168] The network device includes a probabilistic MAU, which stores a state table. The state table includes multiple entries, each of which includes an index field, a flow ID field, a state field, and a flag field. Each entry may also include more or fewer fields, which is not limited in the embodiments of the present application. After initialization, each field of the entry is empty.
[0169] Optionally, the state field in the table entry is a counter that can realize the data flow counting function. When the network device is working, assuming that flow 1 arrives at the network device first, the network device can parse the first message of flow 1 through the programmable parser, and parse out the identifier (identifier, ID) of flow 1, such as ID1. The programmable parser passes ID1 to the probabilistic MAU, and the probabilistic MAU processes ID1 through a hash function to obtain index 1. Then, the probabilistic MAU searches for the table entry corresponding to index 1 in the state table. Since the various fields of the table entry are empty after initialization, the flow identification field in the table entry corresponding to index 1 is empty, and the probabilistic MAU can return an "empty" result. Based on the "empty" result, the network device can write in the table entry corresponding to index 1.<ID1,1> , indicating that flow 1 occupies the entry corresponding to index 1, and the count of flow 1 is 1.
[0170] Assume that the first packet of flow 2 arrives at the network device after the first packet of flow 1. The network device can use a programmable parser to parse the first packet of flow 2 and extract ID 2. The programmable parser passes ID 2 to the probabilistic MAU, which processes ID 2 using a hash function. If a hash collision occurs, the probabilistic MAU may output index 1. The probabilistic MAU then searches the state table for the entry corresponding to index 1. The flow identification field of the entry corresponding to index 1 is already written to ID 1. Since ID 1 and ID 2 are different, the probabilistic MAU may return a "conflict" result. Based on this "conflict" result, the network device can decide not to process the first packet of flow 2 and forward it to the server for processing. The server can count the packets of flow 2 using software NF.
[0171] Optionally, the network device may write the state of flow 1 into the first message of flow 2. For example, the first message of flow 2 includes an Ethernet header, an Internet Protocol (IP) header, and an IP payload. The network device may insert a local protocol header (i.e., a header of the protocol used by the network device) into the message, as shown in Table 1.
[0172] Table 1
[0173] Ethernet header The first part of this agreement IP header IP payload
[0174] In Table 1, the protocol header may include the identifier ID1 of stream 1 and the status of stream 1 (e.g., the number of messages in the current stream 1). The protocol header may also include more content. This embodiment does not limit the position of the protocol header in the message or the specific content of the protocol header.
[0175] The network device may insert the protocol header into each message of flow 2 or into some messages of flow 2 to save the overhead of processing resources and communication resources.
[0176] Over time, the number of packets in Flow 1 and Flow 2 increases. After the server obtains the traffic of Flow 1 from the packets of Flow 2, it can run a heavy hitter detection algorithm through the flow update module to detect the traffic of Flow 1 and Flow 2 to determine which flow has a larger traffic volume. The server can run the heavy hitter detection algorithm periodically or aperiodically. It should be noted that the flow update module can detect not only Flow 1 and Flow 2, but also more flows, and determine the traffic volume of multiple flows mapped to the same table entry.
[0177] Assuming that the server currently determines that the traffic of flow 2 is greater than the traffic of flow 1, the server can trigger a flow switching process, wherein the flow with a larger traffic volume can be called a large flow, and the flow with a smaller traffic volume can be called a small flow.
[0178] The flow update module can send an instruction to the network device to swap flows 1 and 2. After receiving this instruction, the network device sets the flag bit of entry 1 (the entry corresponding to index 1) to "invalid" through the probabilistic MAU and sends the status of flow 1 in entry 1 to the flow update module. At the same time, all subsequent messages that hit the "invalid" entry are sent to the flow update module.
[0179] The flow update module receives the state and message of flow 1 and stores them in the software NF, which processes the state and message of flow 1.
[0180] The flow update module sends the status and message of flow 2 to the probabilistic MAU. The probabilistic MAU receives and processes the status and message of flow 2. For example, it updates the flow identification field of table item 1 to ID2, and writes the status of flow 2 (such as the number of messages) into the status field of table item 1. After the probabilistic MAU receives the message of flow 2, it performs mapping and matching according to the normal process and updates the status field of table item 1.
[0181] During the update of table entry 1, the probabilistic MAU can set the flag field of table entry 1 to "update." After this, if the probabilistic MAU receives a message for stream 2 from a device other than the server, it numbers each received message for stream 2, writes the number to each message for stream 2, and records the latest number in table entry 1. The numbered messages are forwarded to the stream update module.
[0182] After receiving the message of flow 2, the flow update module forwards the message of flow 2 to the probabilistic MAU.
[0183] The probabilistic MAU reads the ID from each packet in flow 2 and compares it with the latest ID in entry 1. If the two numbers don't match, it indicates that unprocessed packets remain on the link between the server and the network device, and the probabilistic MAU continues to update entry 1. If the two numbers match, it indicates that all packets in flow 2 have been processed, and the probabilistic MAU concludes the update process and sets the flag in entry 1 to "valid." At this point, the flow identifier field in entry 1 is ID2.
[0184] Subsequent processing such as Figure 8 As shown in the figure, when the message of flow 2 arrives at the network device, the network device can parse the message of flow 2 through the programmable parser and parse out ID2. The programmable parser passes ID2 to the probabilistic MAU, which processes ID2 through a hash function to obtain index 1. Subsequently, the probabilistic MAU searches for the entry corresponding to index 1 in the state table. The flow identification field in the entry corresponding to the current index 1 has been written to ID2, and the probabilistic MAU can return a "hit" result. Based on the "hit" result, the network device can write<ID1,N> , indicating that flow 2 occupies the entry corresponding to index 1, and the count of flow 2 is N.
[0185] When a packet from flow 1 arrives at the network device, the device parses it using a programmable parser, extracting ID 1. The programmable parser passes ID 1 to the probabilistic MAU, which processes ID 1 using a hash function to obtain index 1. The MAU then searches the state table for the entry corresponding to index 1. Since the flow identifier field in the entry corresponding to index 1 is already written to ID 2, the MAU returns a "conflict." Based on this "conflict," the network device decides not to process the packet from flow 1 and forwards it to the server. The server then counts the packets from flow 1 using software NF.
[0186] It should be noted that if the subsequent server finds that the traffic of flow 1 is greater than the traffic of flow 2, the server can trigger the flow switching process again, handing over flow 1 to the network device for processing, and processing flow 2 locally. In this way, large flows are always processed by network devices with stronger processing capabilities, and small flows are always processed by servers with weaker processing capabilities, thereby making full use of the high-quality resources of network devices and reducing network latency.
[0187] The above describes in detail the method examples provided by the embodiments of the present application. It is understandable that, in order to implement the above functions, the corresponding device includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily appreciate that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in a hardware or computer software driven hardware manner depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0188] Figure 9 1 is a structural diagram of a data processing device 900 provided in an embodiment of the present application, wherein the device 900 includes a processing unit 910 and a communication unit 920. The communication unit 920 performs a receiving step or an input step under the control of the processing unit 910.
[0189] When the device 800 is used to implement the function of a network device, the communication unit 920 is used to: receive first data, the first data includes a first flow identifier, and the first flow identifier indicates the data flow to which the first data belongs; the processing unit 910 is used to: determine a first index corresponding to the first flow identifier according to a mapping rule; determine a first table entry from a table entry set according to the first index, the first table entry being the table entry corresponding to the first index; when the flow identifier field in the first table entry matches the first flow identifier, process the first table entry according to the first data, and process the first data according to the first table entry; or, when the flow identifier field in the first table entry does not match the first flow identifier, send the first data to the second device through the communication unit 920.
[0190] Optionally, the flow identification field in the first table entry matches the first flow identification, including: the flow identification field of the first table entry is empty, or the flow identification in the flow identification field of the first table entry is the first flow identification; the flow identification field in the first table entry does not match the first flow identification, including: the flow identification in the flow identification field of the first table entry is the second flow identification.
[0191] Optionally, any entry in the entry set includes a status field, and the status fields of any two entries in the entry set are different.
[0192] Optionally, the flow identifier field in the first table entry does not match the first flow identifier, the flow identifier in the flow identifier field of the first table entry is the second flow identifier, and the data flow corresponding to the second flow identifier arrives at the first device before the data flow corresponding to the first flow identifier. The communication unit 920 is also used to: receive indication information from the second device, the indication information indicating the exchange of the data flow corresponding to the first flow identifier and the data flow corresponding to the second flow identifier, wherein the data volume of the data flow corresponding to the first flow identifier is greater than the data volume of the data flow corresponding to the second flow identifier; send the status of the data flow corresponding to the second flow identifier and the data flow corresponding to the second flow identifier to the second device according to the indication information; receive the status of the data flow corresponding to the first flow identifier and the data flow corresponding to the first flow identifier from the second device, and the data flow corresponding to the first flow identifier includes the first data; the processing unit 910 is also used to: update the first table entry according to the status of the data flow corresponding to the first flow identifier and the data flow corresponding to the first flow identifier.
[0193] Optionally, before receiving the data flow corresponding to the first flow identifier and the state of the data flow corresponding to the first flow identifier from the second device, the processing unit 910 is further configured to: suspend use of the first table entry according to the indication information.
[0194] Optionally, before receiving the indication information from the second device, the processing unit 910 is further configured to: determine the data volume of the data flow corresponding to the second flow identifier; and write the data volume of the data flow corresponding to the second flow identifier into the first data.
[0195] Optionally, after the first table entry starts to be updated, the communication unit 920 is also used to: receive second data from a device other than the second device, the second data including the first flow identifier; send the second data to the second device; receive the second data from the second device; the processing unit 910 is also used to: update the first table entry according to the second data.
[0196] Optionally, the processing unit 910 is also used to: write the number of the second data in the second data; record the latest number of the data corresponding to the first flow identifier; when the number of the data containing the first flow identifier received from the second device is the same as the latest number, determine that the update of the first table entry is completed.
[0197] Optionally, the communication unit 920 is also used to: receive third data from a device other than the second device, the third data including a first flow identifier; the processing unit 910 is also used to: determine a first index corresponding to the first flow identifier according to a mapping rule; determine a first table entry from the table entry set according to the first index; determine that the flow identifier field in the first table entry matches the first flow identifier; and process the first table entry according to the third data.
[0198] Optionally, the communication unit 920 is also used to: receive fourth data from a device other than the second device, the fourth data including a second flow identifier; the processing unit 910 is also used to: determine a first index corresponding to the second flow identifier according to a mapping rule; determine a first table entry from the table entry set according to the first index; determine that the flow identifier field in the first table entry matches the second flow identifier; and send the fourth data to the second device through the communication unit 920.
[0199] When the device 900 is used to implement the function of the server, the processing unit 910 is used to: determine the data volume of the data flow corresponding to the first flow identifier and the data volume of the data flow corresponding to the second flow identifier, wherein the data flow corresponding to the first flow identifier is processed by the second device, and the data flow corresponding to the second flow identifier is processed by the first device; if the data volume of the data flow corresponding to the first flow identifier is greater than the data volume of the data flow corresponding to the second flow identifier, send indication information to the first device through the communication unit 920, and the indication information indicates the exchange of the data flow corresponding to the first flow identifier and the data flow corresponding to the second flow identifier.
[0200] Optionally, the communication unit 920 is also used to: send the data flow corresponding to the first flow identifier and the status of the data flow corresponding to the first flow identifier to the first device; receive the data flow corresponding to the second flow identifier and the status of the data flow corresponding to the second flow identifier from the first device; update the second table entry according to the data flow corresponding to the second flow identifier and the status of the data flow corresponding to the second flow identifier, the second table entry being the table entry matched by the first flow identifier before sending the indication information.
[0201] Optionally, the communication unit 920 is further configured to: receive second data from the first device, where the second data includes a first flow identifier and a number of the second data; and send the second data to the first device.
[0202] Optionally, before determining the data volume of the data flow corresponding to the first flow identifier and the data volume of the data flow corresponding to the second flow identifier, the communication unit 920 is also used to: receive first data from the first device, the first data includes the first flow identifier, and the first data includes the data volume of the data flow corresponding to the second flow identifier.
[0203] Optionally, the communication unit 920 is further configured to: receive fourth data from the first device, where the fourth data includes a second flow identifier; and the processing unit 910 is further configured to: process the fourth data according to the second flow identifier.
[0204] Those skilled in the art can clearly understand that the specific working process of the device 900 and the technical effects produced by the execution steps can be referred to the description in the aforementioned corresponding method embodiment. For the sake of brevity, they will not be repeated here.
[0205] Device 900 may be a network device, a server, or a chip. Processing unit 910 may be implemented in hardware or software. When implemented in hardware, processing unit 910 may be a logic circuit, an integrated circuit, or the like. When implemented in software, processing unit 910 may be a general-purpose processor implemented by reading software code stored in a storage unit. The storage unit may be integrated into processing unit 910 or located independently of processing unit 910.
[0206] Figure 10 This is a schematic diagram of the structure of another data processing device provided by an embodiment of the present application. For ease of explanation, Figure 10 Only the main components of the data processing device are shown. Figure 10 As shown, device 1000 includes a processor 1010, a memory 1020, and an input / output device 1030. Processor 1010 is primarily used to process data streams, control the entire device 1000, execute software programs, and process data from software programs, for example, to support device 1000 in performing the actions described in the above method embodiments. Memory 1020 is primarily used to store software programs and data. Input / output device 1030, such as a network card or antenna, is primarily used to receive and output data. Processor 1010, memory 1020, and input / output device 1030 may be connected via a bus.
[0207] The processor 1010 and memory 1020 can serve one or more boards. In other words, each board can have its own memory and processor. Alternatively, multiple boards can share the same memory and processor. In addition, each board can also have necessary circuits.
[0208] Those skilled in the art will understand that for ease of explanation, Figure 10 Only one memory and one processor are shown. In an actual network device or server, there may be multiple processors and multiple memories. The memory may also be referred to as a storage medium or a storage device, etc., which is not limited in this application.
[0209] It is understood that the processor in each embodiment of the present application can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method embodiment can be completed by an integrated logic circuit of the hardware in the processor or an instruction in the form of software. The above-mentioned processor can be a central processor unit (CPU), a system on chip (SoC), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), a microcontroller unit (MCU), a programmable logic device (PLD) or other logic devices, such as discrete gates, transistor logic devices or discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present application can be implemented or executed.
[0210] It is understood that the memory in each embodiment of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus RAM (DR RAM). It should be noted that the memory in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0211] During implementation, each step of the above method can be completed by an integrated logic circuit of hardware in a processor or by instructions in the form of software. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor. The software module can be located in a storage medium mature in the art, such as a random access register, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory and completes the steps of the above method in conjunction with its hardware. To avoid repetition, it will not be described in detail here.
[0212] The present application also provides a computer-readable medium having a computer program stored thereon, which implements the functions of any of the above method embodiments when executed by a computer.
[0213] The present application also provides a computer program product, which implements the functions of any of the above method embodiments when executed by a computer.
[0214] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless or microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a high-density digital video disc (DVD)), or a semiconductor medium (eg, a solid state disk (SSD)).
[0215] It should be understood that the "embodiment" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, the various embodiments in the entire specification do not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in the various embodiments of the present application, the terminal device and / or the network device can perform some or all of the steps in the various embodiments. These steps or operations are merely examples, and the embodiments of the present application can also perform other operations or variations of various operations. In addition, the various steps can be performed in a different order than presented in the various embodiments, and it is possible that not all operations in the embodiments of the present application need to be performed. Moreover, the size of the sequence number of each process mentioned above does not mean the order of execution. The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0216] It should also be understood that in this application, "when", "if" and "if" all mean that the executing subject will take corresponding measures under certain objective circumstances, and do not limit the time. It does not require the executing subject to make judgments when implementing it, nor does it mean that there are other limitations.
[0217] Additionally, the terms "system" and "network" are often used interchangeably. The term "and / or" is simply a description of an association between related objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, or B exists alone.
[0218] It should be understood that in the various embodiments of the present application, "B corresponding to A" means that B is associated with A and B can be determined based on A. However, it should also be understood that determining B based on A does not mean determining B based solely on A; B can also be determined based on A and / or other information.
[0219] The above contents are optional embodiments of the technical solution of this application and are not intended to limit the scope of protection of this application. Any modifications, equivalent replacements, improvements, etc. made within the principles of this application should be included in the scope of protection of this application.
Claims
1. A data processing method, characterized in that: Applied to a first device, the method includes: receiving first data, where the first data includes a first stream identifier, and the first stream identifier indicates a data stream to which the first data belongs; Determine a first index corresponding to the first flow identifier according to a mapping rule; Determine a first entry from the entry set according to the first index, where the first entry is the entry corresponding to the first index; When the flow identifier field in the first table entry matches the first flow identifier, processing the first table entry according to the first data, and processing the first data according to the first table entry; or When the flow identifier field in the first table entry does not match the first flow identifier, the first data is sent to the second device.
2. The method according to claim 1, characterized in that The flow identifier field in the first table entry matches the first flow identifier, including: The flow identifier field of the first table entry is empty, or the flow identifier in the flow identifier field of the first table entry is the first flow identifier; The flow identifier field in the first table entry does not match the first flow identifier, including: The flow identifier in the flow identifier field of the first table entry is a second flow identifier.
3. The method according to claim 1 or 2, characterized in that Any entry in the set of entries includes a status field, and the status fields of any two entries in the set of entries are different.
4. The method according to any one of claims 1 to 3, characterized in that The flow identifier field in the first table entry does not match the first flow identifier, the flow identifier in the flow identifier field of the first table entry is a second flow identifier, and a data flow corresponding to the second flow identifier arrives at the first device before a data flow corresponding to the first flow identifier. The method further includes: receiving indication information from the second device, the indication information instructing to swap the data flow corresponding to the first flow identifier and the data flow corresponding to the second flow identifier, wherein a data volume of the data flow corresponding to the first flow identifier is greater than a data volume of the data flow corresponding to the second flow identifier; sending, to the second device according to the indication information, the data flow corresponding to the second flow identifier and the status of the data flow corresponding to the second flow identifier; receiving, from the second device, a data flow corresponding to the first flow identifier and a state of the data flow corresponding to the first flow identifier, wherein the data flow corresponding to the first flow identifier includes the first data; The first table entry is updated according to the data flow corresponding to the first flow identifier and the status of the data flow corresponding to the first flow identifier.
5. The method according to claim 4, characterized in that Before receiving, from the second device, the data flow corresponding to the first flow identifier and the state of the data flow corresponding to the first flow identifier, the method further includes: The first entry is suspended according to the instruction information.
6. The method according to claim 4 or 5, characterized in that Before receiving the indication information from the second device, the method further includes: determining a data volume of the data flow corresponding to the second flow identifier; The data amount of the data flow corresponding to the second flow identifier is written into the first data.
7. The method according to any one of claims 4 to 6, characterized in that After the first entry starts to be updated, the method further includes: receiving second data from a device other than the second device, the second data including the first flow identifier; sending the second data to the second device; receiving the second data from the second device; Update the first table entry according to the second data.
8. The method according to claim 7, characterized in that The method further comprises: Writing the serial number of the second data into the second data; Record the latest number of the data corresponding to the first stream identifier; When the number of the data including the first flow identifier received from the second device is the same as the latest number, it is determined that the updating of the first table entry is completed.
9. The method according to claim 8, characterized in that The method further comprises: receiving third data from a device other than the second device, the third data including the first flow identifier; Determine the first index corresponding to the first flow identifier according to the mapping rule; Determine the first entry from the set of entries according to the first index; Determining that the flow identifier field in the first table entry matches the first flow identifier; The first table entry is processed according to the third data.
10. The method according to claim 8, characterized in that The method further comprises: receiving fourth data from a device other than the second device, the fourth data including the second flow identifier; Determine the first index corresponding to the second flow identifier according to the mapping rule; Determine the first entry from the set of entries according to the first index; Determining that the flow identifier field in the first table entry matches the second flow identifier; The fourth data is sent to the second device.
11. A data processing method, characterized in that: Applied to the second device, the method includes: Determining a data volume of a data flow corresponding to a first flow identifier and a data volume of a data flow corresponding to a second flow identifier, wherein the data flow corresponding to the first flow identifier is processed by the second device, and the data flow corresponding to the second flow identifier is processed by the first device; If the data volume of the data flow corresponding to the first flow identifier is greater than the data volume of the data flow corresponding to the second flow identifier, indication information is sent to the first device, where the indication information instructs the data flow corresponding to the first flow identifier and the data flow corresponding to the second flow identifier to be exchanged.
12. The method according to claim 11, characterized in that The method further comprises: Sending the data flow corresponding to the first flow identifier and the state of the data flow corresponding to the first flow identifier to the first device; receiving, from the first device, a data flow corresponding to the second flow identifier and a state of the data flow corresponding to the second flow identifier; A second table entry is updated according to the data flow corresponding to the second flow identifier and the state of the data flow corresponding to the second flow identifier, where the second table entry is the table entry matched by the first flow identifier before the indication information is sent.
13. The method according to claim 12, characterized in that The method further comprises: receiving second data from the first device, where the second data includes the first stream identifier and a number of the second data; The second data is sent to the first device.
14. The method according to any one of claims 11 to 13, characterized in that Before determining the data volume of the data flow corresponding to the first flow identifier and the data volume of the data flow corresponding to the second flow identifier, the method further includes: First data is received from the first device, where the first data includes the first flow identifier and the data volume of the data flow corresponding to the second flow identifier.
15. The method according to any one of claims 11 to 14, characterized in that The method further comprises: receiving fourth data from the first device, the fourth data including the second flow identifier; The fourth data is processed according to the second stream identifier.
16. A data processing device, characterized in that: include: A processor and an interface circuit, wherein the interface circuit is used to receive signals from other devices and transmit them to the processor or send signals from the processor to other devices, and the processor is used to implement the method according to any one of claims 1 to 15 through a logic circuit or executing code instructions.
17. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program or instructions, and when the computer program or instructions are executed by a data processing device, the method according to any one of claims 1 to 15 is implemented.