Data packet processing method and device, equipment and medium

By setting up the path table entry set in the switch and processing unit, the problem that the switch data processing stability depends on the server and the processing efficiency is solved, efficient large-scale table entry aging is achieved, and the stability and efficiency of data packet processing is improved.

CN119697139APending Publication Date: 2025-03-25TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311237030.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-22
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

In the prior art, the stability of switch data processing depends on the server, and the processing efficiency is low, and when performing table entry aging processing on the switch side, it is difficult to meet the efficient and large number of table entry aging needs.

Method used

Through the switch combined with the processing unit, the processing of data packet and table entry aging tasks is realized. The first path table entry set is stored in the switch for recording processed packet table entries and aging timing information; the second path table entry set is stored in the processing unit for recording processed packet table entries and the latest hit time information.

Benefits of technology

It improves the stability and processing efficiency of data packet processing, and can meet the needs of efficient and large-scale table entries aging.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119697139A_ABST
    Figure CN119697139A_ABST
Patent Text Reader

Abstract

The invention discloses a data packet processing method and device, equipment and a medium. A switch receives a to-be-processed first data packet; a first path table item set is stored in the switch; the switch matches the first data packet through the first path table item set, and forwards the first data packet to a processing unit if a target table item matched with the first data packet does not exist in the first path table item set; a second path table item set is stored in the processing unit; and the processing unit carries out matching on the first data packet through the second path table item set, if a target table item matched with the first data packet exists in the second path table item set, the target table item is added to the first path table item set, and the switch carries out forwarding processing on the first data packet. According to the embodiment of the invention, the stability and the processing efficiency of data packet processing can be improved, and the efficient and massive table item aging requirements can be met. The method can be widely applied to various scenes such as cloud technology, big data, artificial intelligence, intelligent traffic and auxiliary driving.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and in particular to a method, device, equipment and medium for processing a data packet. Background Art

[0002] At present, with the development of information technology, the acquisition and transmission of business data are increasingly used in various applications. Among them, a switch is a data processing unit that can be used to transmit data packets in the network and realize multi-terminal device communication. It is often integrated and deployed in various electronic devices. In the switch, the information of the data packet is often stored through related table entries to facilitate the subsequent rapid processing of the data packet. However, in actual applications, network topology changes, routing information changes, service termination or device restart may occur, and the information in the table entry may become outdated or invalid, and aging processing is required.

[0003] In the related art, the server is generally used to perform table entry aging processing on the switch, and the switch matches and forwards data packets according to the table entries on the server side. However, this implementation method will cause the stability of switch data processing to rely on the server, and the processing efficiency is low; if the table entry aging processing task is performed on the switch side, the concurrency of the table entry aging task is limited, and it is difficult to meet the requirements of efficient and large-scale table entry aging.

[0004] In summary, the technical problems existing in the relevant technologies need to be improved. Summary of the invention

[0005] The embodiments of the present application provide a method, apparatus, device and medium for processing data packets, which can improve the stability and efficiency of data packet processing and meet the requirements of efficient and large-scale table entry aging.

[0006] An aspect of an embodiment of the present application provides a method for processing a data packet, including:

[0007] The switch receives a first data packet to be processed; the switch stores a first path table entry set, the first path table entry set being used to record table entries of each processed second data packet and aging timing information corresponding to the table entries;

[0008] The switch matches the first data packet through the first path table item set, and if there is no target table item matching the first data packet in the first path table item set, forwards the first data packet to the processing unit; the processing unit stores a second path table item set, and the second path table item set is used to record the table items of each processed second data packet and the latest hit time information corresponding to the table items;

[0009] The processing unit matches the first data packet through the second path table entry set. If there is a target table entry matching the first data packet in the second path table entry set, the target table entry is added to the first path table entry set, and the switch forwards the first data packet.

[0010] On the other hand, an embodiment of the present application provides a data packet processing device, including:

[0011] The switch is used to receive a first data packet to be processed; a first path table entry set is stored in the switch, and the first path table entry set is used to record the table entries of each processed second data packet and the aging timing information corresponding to the table entries;

[0012] The switch is used to match the first data packet through the first path table item set, and if there is no target table item matching the first data packet in the first path table item set, forward the first data packet to the processing unit; the processing unit stores a second path table item set, and the second path table item set is used to record the table items of each processed second data packet and the latest hit time information corresponding to the table items;

[0013] The processing unit is used to match the first data packet through the second path table entry set. If there is a target table entry matching the first data packet in the second path table entry set, the target table entry is added to the first path table entry set, and the switch forwards the first data packet.

[0014] Optionally, in the data packet processing device in the embodiment of the present application, the switch is also used to parse the first data packet to obtain the media access control address in the first data packet; detect whether the media access control address belongs to the destination address corresponding to the switch; if the media access control address does not belong to the destination address corresponding to the switch, discard the first data packet.

[0015] Optionally, in the data packet processing device in the embodiment of the present application, the switch is also used to parse and process the first data packet to obtain header information in the first data packet; and match the first data packet in the first path table entry set according to the header information.

[0016] Optionally, in the data packet processing device in the embodiment of the present application, if there is a target table entry matching the first data packet in the first path table entry set, the switch is also used to process the first data packet through the target table entry and update the aging timing information corresponding to the target table entry; and forward the processed first data packet to the target device through the designated port according to the media access control address.

[0017] Optionally, in the data packet processing device in the embodiment of the present application, the processing unit is further configured to process the first data packet through the target table entry, and forward the processed first data packet to the switch;

[0018] The switch is also used to forward the processed first data packet to the target device through a designated port according to the media access control address.

[0019] Optionally, in the data packet processing device in the embodiment of the present application, if there is no target table entry matching the first data packet in the second path table entry set, the processing unit is further used to detect whether there is remaining space in the second path table entry set;

[0020] If there is remaining space in the second path table entry set, the processing unit is further used to create a new target table entry corresponding to the first data packet, add the target table entry to the second path table entry set and the first path table entry set, and enable the switch to forward the first data packet.

[0021] Optionally, in the data packet processing device in the embodiment of the present application, the processing unit is further used to add the target table entry to the second path table entry set, and update the most recent hit time information corresponding to the target table entry to the current time;

[0022] The processing unit is further used to send the target entry to the switch, and the switch is further used to add the target entry to the first path entry set and update the aging timing information corresponding to the target entry to a preset aging time threshold.

[0023] Optionally, in the data packet processing device in the embodiment of the present application, if there is no remaining space in the second path table entry set, the processing unit is further used to determine a first table entry from the second path table entry set; the first table entry is the earliest table entry corresponding to the most recent hit time information;

[0024] The processing unit is further configured to create a target table entry corresponding to the first data packet, replace the first table entry in the second path table entry set with the target table entry, and update the most recent hit time information corresponding to the target table entry to the current time;

[0025] The processing unit is further used to send the first table entry and the target table entry to the switch, and the switch is further used to detect whether the first table entry exists in the first path table entry set;

[0026] If the first table entry exists in the first path table entry set, the switch is further used to replace the first table entry in the first path table entry set with the target table entry, and update the aging timing information corresponding to the target table entry to a preset aging time threshold; or, if the first table entry does not exist in the first path table entry set, the switch is further used to add the target table entry to the first path table entry set, and update the aging timing information corresponding to the target table entry to a preset aging time threshold.

[0027] Optionally, in the data packet processing device in the embodiment of the present application, the switch is further used to detect whether there is a second table entry in the first path table entry set; the aging timing information corresponding to the second table entry is zero;

[0028] If the second table entry exists in the first path table entry set, the switch is further configured to delete the second table entry in the first path table entry set to obtain an updated first path table entry set.

[0029] Optionally, in the data packet processing device in the embodiment of the present application, the processing unit is further used to obtain table entry aging event information from the switch; the table entry aging event information includes the second table entry deleted from the first path table entry set and the time node when the second table entry is deleted;

[0030] The processing unit is further configured to update the most recent hit time information corresponding to the second entry in the second path entry set according to the time node and a preset aging time threshold.

[0031] Optionally, in the data packet processing device in the embodiment of the present application, the processing unit is further used to query the first time when the aging event information of the entry was last obtained;

[0032] The processing unit is further used to determine a time interval between the first time and the current time;

[0033] If the time interval is equal to a preset synchronization period, the processing unit is further configured to send a synchronization instruction to the switch to obtain entry aging event information of the switch after the first time.

[0034] On the other hand, an embodiment of the present application provides an electronic device, including a processor and a memory;

[0035] The memory is used to store computer programs;

[0036] The processor executes the computer program to implement the above method.

[0037] On the other hand, an embodiment of the present application provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is executed by a processor to implement the above method.

[0038] The embodiment of the present application also discloses a computer program product, including a computer program, which implements the above method when executed by a processor.

[0039] The embodiments of the present application at least include the following beneficial effects: The present application provides a data packet processing method, device, equipment and medium, which realizes the processing of data packet and table item aging tasks by combining a switch with a processing unit, wherein a first path table item set is stored in the switch, and the first path table item set is used to record the table items of each processed second data packet and the aging timing information corresponding to the table items; a second path table item set is stored in the processing unit, and the second path table item set is used to record the table items of each processed second data packet and the latest hit time information corresponding to the table items. The switch side can use the first path table item set to efficiently process part of the table item aging tasks, and when the switch receives the first data packet to be processed, the first data packet can be quickly matched through the local first path table item set, which is conducive to improving the processing efficiency of the data packet; the processing unit side can use the second path table item set to process a large number of table item aging tasks, if there is no target table item matching the first data packet in the first path table item set, the first data packet is forwarded to the processing unit for matching, and if there is a target table item matching the first data packet in the second path table item set, the target table item can be quickly added to the first path table item set, so that the switch forwards the first data packet. The technical solution in the present application can improve the stability and efficiency of data packet processing, and can meet the needs of efficient and large-scale table entry aging. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 A schematic diagram of an implementation environment of a method for processing a data packet provided in an embodiment of the present application;

[0041] Figure 2 A flowchart of a method for processing a data packet provided in an embodiment of the present application;

[0042] Figure 3 A schematic diagram of the composition of a first path table entry set provided in an embodiment of the present application;

[0043] Figure 4 A flowchart of the steps of a method for processing a data packet based on a first path table entry set provided in an embodiment of the present application;

[0044] Figure 5 A flowchart of the steps of a method for processing a data packet based on a second path table entry set provided in an embodiment of the present application;

[0045] Figure 6 A flowchart of another method for processing a data packet based on a second path table entry set provided in an embodiment of the present application;

[0046] Figure 7 A flowchart of another method for processing a data packet provided in an embodiment of the application;

[0047] Figure 8 A schematic diagram of the structure of a data packet processing device provided in an embodiment of the present application;

[0048] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0049] Fig.10 A schematic diagram of the structure of another electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0050] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application. They are only examples of devices and methods consistent with some aspects of the embodiments of the present application as detailed in the attached claims.

[0051] It is understood that the terms "first", "second", etc. used in this application can be used to describe various concepts in this article, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another concept. For example, without departing from the scope of the embodiment of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein can be interpreted as "at the time of" or "when" or "in response to determination".

[0052] The terms "at least one", "multiple", "each", "any", etc. used in this application, at least one includes one, two or more, multiple includes two or more, each refers to each of the corresponding multiple, and any refers to any one of the multiple.

[0053] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0054] Before describing the embodiments of the present application in detail, some nouns and terms involved in the embodiments of the present application are first described. The nouns and terms involved in the embodiments of the present application are subject to the following explanations.

[0055] In short, a database can be seen as an electronic filing cabinet - a place where electronic files are stored, and objects can add, query, update, delete, and other operations on the data in the files. A database is a collection of data that is stored together in a certain way, can be shared with multiple objects, has as little redundancy as possible, and is independent of the application.

[0056] The state table entry aging function refers to the system's regular inspection of state table entries. When a state table entry has not been accessed or used for a period of time, the system will mark it as obsolete or invalid, and then delete or clear it from the state table. The purpose of this function is to free up resources, reduce the size of the state table, and improve system performance and efficiency. Through the state table entry aging function, the system can automatically clean up invalid state table entries, avoid the state table from being too large, and reduce memory usage and search time.

[0057] Key value storage is a non-relational database model that uses simple key-value pairs to organize, index, and store data. It has the characteristics of high performance, flexibility, and scalability.

[0058] At present, with the development of information technology, the acquisition and transmission of business data are increasingly used in various applications. For example, in map navigation applications, it is necessary to frequently obtain road status information from various channels on the Internet and process the status information in order to update the navigation display information in the map and provide people with reliable and efficient travel guidance functions. In these applications, data transmission and processing are very extensive. Among them, the switch is a data processing unit that can be used to transmit data packets in the network and realize multi-terminal device communication. It is often integrated and deployed in various electronic devices. In the switch, the information of the data packet is often stored through related table entries to facilitate the subsequent rapid processing of the data packet. However, in actual applications, network topology changes, routing information changes, service termination or device restart may occur, and the information in the table entry may become outdated or invalid, and aging processing is required.

[0059] In related technologies, common state table entry aging technology solutions include the following:

[0060] Based on the SDN (Software Defined Network) solution, the SDN controller is responsible for managing the table items in the network, including the formulation of aging policies and the deletion of table items. The switch is responsible for quickly matching and forwarding data packets. This solution matches and forwards data packets through switches, which can improve the flexibility and maintainability of the system, but it needs to rely on the stability and reliability of the SDN controller.

[0061] Server-based solution: This solution handles data packet forwarding and state table entry aging in the processor. Although it can handle complex logic, the forwarding performance is low.

[0062] Switch-based solution: This solution places the storage of state table entries and the processing of data packets on the switch. Although the forwarding performance of the storage table entries is high, it can only support a small concurrency scale.

[0063] Therefore, in the related art, a server is used to perform table entry aging processing on the switch, and the switch matches and forwards data packets based on the table entries on the server side, which causes the stability of the switch data processing to rely on the server and the processing efficiency to be low; and the solution of performing table entry aging processing on the switch side limits the concurrency of table entry aging tasks, making it difficult to meet the needs of efficient and large-scale table entry aging.

[0064] For example, in a payment scenario, if the forwarding and processing of the business data generated during the transaction are performed on the switch side, when the consumer initiates a payment request, the payment data packet corresponding to the payment request is sent to the switch; after receiving the payment data packet, the switch matches the payment data packet, processes it, and then forwards it to the corresponding account. Receiving and forwarding payment data packets directly through the switch can achieve fast forwarding of data packets. However, during the discount season, when consumers frequently and massively issue consumption requests, the switch may not be able to process highly concurrent data in a short period of time due to insufficient storage capacity, making it difficult to meet the requirements of efficient and large-scale table aging.

[0065] In view of this, a method, device, equipment and medium for processing a data packet are provided in an embodiment of the present application. The processing of data packet and table item aging tasks is realized by combining a switch with a processing unit. The switch in the embodiment of the present application is used to realize the hardware side solution, and the processing unit is used to realize the software side solution. The software and hardware work together to realize efficient, accurate and stable table item aging processing. Specifically, a first path table item set is stored in the switch, and the first path table item set is used to record the table items of each processed second data packet and the aging timing information corresponding to the table items; a second path table item set is stored in the processing unit, and the second path table item set is used to record the table items of each processed second data packet and the most recent hit time information corresponding to the table items. The switch side can use the first path table item set to efficiently process part of the table item aging tasks. When the switch receives the first data packet to be processed, it can quickly match the first data packet through the local first path table item set, which can achieve rapid matching of data packets and table items, and is conducive to improving the processing efficiency of data packets; the processing unit side can use the second path table item set to process a large number of table item aging tasks. If there is no target table item matching the first data packet in the first path table item set, the first data packet is forwarded to the processing unit for matching. If there is a target table item matching the first data packet in the second path table item set, the target table item can be quickly added to the first path table item set, so that the switch forwards the first data packet. The technical solution in this application can improve the stability and processing efficiency of data packet processing, and can meet the requirements of efficient and large-scale table item aging.

[0066] The data packet processing method provided in the embodiments of the present application mainly involves various application scenarios such as cloud technology, artificial intelligence, smart transportation, and assisted driving. It can be understood by those skilled in the art that the data packet processing method provided in the embodiments of the present application can be executed in various application scenarios:

[0067] For example, in some embodiments, the data packet processing method in the present application can be applied to the reception and display of video interactive data (such as barrage data / information) in the live broadcast field. For example, during the live broadcast process, the anchor side terminal will receive the barrage information sent by each viewer and display it in the corresponding area of ​​the live broadcast interface. In this application scenario, the data packet processing method provided in the embodiment of the present application can be used to quickly match and process the barrage data packets sent by the viewers, and forward them to the corresponding anchor side to realize the forwarding and display of the barrage data.

[0068] Exemplarily, in some embodiments, the data packet processing method in the present application can be applied to the data display scenario of the vehicle-mounted terminal in the automotive field. As the functions of the vehicle-mounted terminal become more and more powerful, the content displayed by the vehicle-mounted terminal is also becoming more and more abundant. Specifically, the vehicle-mounted terminal can display vehicle parameter information such as fuel level and tire pressure, and can also display road condition information such as outdoor temperature and road congestion, and can also display entertainment information such as videos and pictures. Based on the above-mentioned multiple types of display information, it can be seen that the vehicle-mounted terminal will receive display data from multiple parties. In this application scenario, the data packet processing method provided in the embodiment of the present application can be used to quickly match and process the display data packet and then forward it to the vehicle-mounted terminal, so that the vehicle-mounted terminal can quickly and stably display the data.

[0069] Exemplarily, in some embodiments, the data packet processing method in the present application can be applied to a high-performance network scenario mainly for cloud computing, and a high-performance, large-scale state gateway forwarding service is provided by the method. The scenario generally includes a high-performance programmable switch, as well as other commercial switches and server devices. The programmable switch is used to carry the state table entry aging function, the commercial switch is used to form a typical topology, and the server device is used for business services and applications. Among them, the device that executes the core algorithm is a switch device with a programmable function, which runs the logic of the state gateway and can modify the processing flow of the data packet, the encapsulation format of the data packet header, etc. according to the developer's definition. The switch device will record the corresponding session according to the received data packet, so that when receiving the return packet in the opposite direction, the corresponding session table item can be directly queried to perform data packet processing. However, if the session time is not managed, a large number of expired sessions will be stored in the memory, occupying memory space and reducing the size of concurrently supported objects. Therefore, in this application scenario, the data packet processing method provided in the embodiment of the present application can be used to quickly match and process the display data packet and then forward it, and age the state table item to improve the stability and processing efficiency of data packet processing.

[0070] It is understandable that the above application scenarios are only exemplary and do not limit the actual application of the data packet processing method in the embodiment of the present application. Those skilled in the art can understand that in different application scenarios, the data packet processing method provided in the embodiment of the present application can be used to perform specified tasks.

[0071] It should be noted that in each specific implementation of the present application, when it comes to the need to perform relevant processing based on the object's information, the object's behavioral data, the object's historical data, and the object's location information and other data related to the object's identity or characteristics, the object's permission or consent will be obtained first, and the collection, use and processing of these data will comply with relevant laws, regulations and standards. In addition, when the embodiment of the present application needs to obtain sensitive information of the object, the object's separate permission or separate consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the object's separate permission or separate consent, the necessary object-related data for the normal operation of the embodiment of the present application will be obtained.

[0072] The specific implementation of the embodiment of the present application is described in detail below in conjunction with the accompanying drawings. First, a method for processing a data packet provided in the embodiment of the present application is described in conjunction with the accompanying drawings.

[0073] Please refer to Figure 1 , Figure 1 The schematic diagram of the implementation environment of a data packet processing method provided in the embodiment of the present application is shown. In the implementation environment, the main hardware and software entities involved include a terminal device 101 and a backend server 102. The switch and processing unit in the embodiment of the present application can be set at Figure 1 For example, in some embodiments, the switch and the processing unit may be provided in the terminal device or in the background server; in some embodiments, the switch may be provided in the terminal device, and the processing unit may be provided in the background server, and this application does not limit this.

[0074] The data packet processing method provided in the embodiment of the present application can be executed solely on the terminal device side, can also be executed solely on the background server side, or can be executed based on data interaction between the terminal device and the background server.

[0075] Exemplarily, taking the data packet processing method provided in the embodiment of the present application as an example, which is executed based on the data interaction between the terminal device and the background server, the switch can be set in the terminal device, and the processing unit can be set in the background server. The terminal device can receive the first data packet to be processed, and then match the first data packet through the first path table item set. If there is no target table item matching the first data packet in the first path table item set, the first data packet is forwarded to the background server; the background server can match the first data packet through the second path table item set. If there is a target table item matching the first data packet in the second path table item set, the target table item is added to the first path table item set, and the terminal device forwards the first data packet and sends it to the corresponding recipient.

[0076] Among them, the terminal devices of the above embodiments may include mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, aircraft, etc., but are not limited to these.

[0077] The backend server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.

[0078] In addition, the backend server can also be a node server in the blockchain network.

[0079] A communication connection can be established between the terminal device and the backend server through a wireless network or a wired network. The wireless network or wired network uses standard communication technology and / or protocols. The network can be set to the Internet or any other network, such as but not limited to a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a private network or any combination of a virtual private network. Moreover, the above-mentioned software and hardware entities can use the same communication connection mode or different communication connection modes, and this application does not make specific restrictions on this.

[0080] Of course, it is understandable that Figure 1 The implementation environment in the embodiment of the present application is only some optional application scenarios of the data packet processing method provided in the embodiment of the present application, and the actual application is not fixed. Figure 1 The method provided in the embodiment of the present application can be applied to various technical fields, such as cloud technology, artificial intelligence, smart transportation, assisted driving, etc., and the present application does not make any specific limitation on this.

[0081] Below, in combination with the above description of the implementation environment, a method for processing a data packet provided in an embodiment of the present application is introduced and explained in detail.

[0082] like Figure 2 As shown, in an embodiment of the present application, a method for processing a data packet is provided, and the method for processing a data packet can be applied to Figure 1 In the terminal device or backend server shown. Figure 2 , the method for processing a data packet provided in the embodiment of the present application may include S100 to S300:

[0083] S100, the switch receives a first data packet to be processed; the switch stores a first path table entry set, the first path table entry set being used to record table entries of each processed second data packet and aging timing information corresponding to the table entry;

[0084] In the embodiment of the present application, the switch can be set Figure 1 In the terminal device or background server shown, but not limited to this. It can be understood that the switch in the embodiment of the present application may have the characteristics of a state gateway and run the logic of a state gateway. Specifically, the switch can process the data in the first data packet according to the developer's definition. The switch can also record the corresponding session table entry (i.e., the first path table entry set) for the received first data packet; when receiving a return packet in the opposite direction or receiving a data packet from the same sender again, directly query the session table entry to quickly perform data packet processing and forwarding. The switch can also perform some table entry aging tasks to improve the efficiency of data packet processing through table entry aging.

[0085] It is understandable that the switch receives a first data packet to be processed and forwarded, wherein the first data packet in the embodiment of the present application includes the information of the sending end, the receiving end information and the specific business data. After receiving the first data packet, the switch parses the first data packet and then matches it with the first path table item set stored in the switch to quickly process and forward the first data packet. Exemplarily, for a live video broadcast scenario, the first data packet may be a data packet with bullet screen information, viewer information and anchor information.

[0086] In some embodiments, reference Figure 3 As shown, a first path table item set is stored in the switch. After receiving the first data packet, the switch matches the data packet through the first table item set and forwards the first data packet according to the matching result. It can be understood that the first path table item set includes a plurality of table items, and the plurality of table items are used to represent the information corresponding to the data packets that the switch has recently received. The embodiment of the present application matches the first data packet through the information recorded in each table item. Exemplarily, the information of the first data packet can be recorded in the form of a key-value pair to facilitate matching processing of the first data packet. Figure 3 As shown, the key value is used to store the five-tuple information of each data packet, where the five-tuple information can obtain the path information of the data packet for matching processing; the value information part is used to store the mapped information in each data packet, which can be related business information, to facilitate the processing of the first data packet. The data packets are stored in the table entries in the form of key-value pairs to achieve fast matching.

[0087] It is understandable that if the switch stores too many entries, it will affect the matching processing speed and also affect the system performance. In this regard, the embodiment of the present application preferentially performs aging processing on the first path table item set in the switch through an aging scheme of timely deletion, deletes the table items in the first path table item set that have not been forwarded for a long time, and only stores the table item information that has been forwarded recently in the switch. In order to implement the aging processing of the first path table item set, the embodiment of the present application establishes aging timing information in each table item in the first path table item set to record the time, and performs aging processing on the first path table item set according to the time. The time recorded in the aging timing information can be counted down. When the time countdown in the aging timing information is zero, it indicates that the table item has not been forwarded for a long time, and the table item is deleted. Of course, in some embodiments, the time recorded in the aging timing information can also be recorded in a positive timing manner. When the time in the aging timing information is greater than or equal to the preset aging time threshold, it indicates that the table item has not been forwarded for a long time, and the table item is deleted.

[0088] In the embodiment of the present application, the first path table item set is processed by an aging scheme of timely deletion, which optimizes the number of items in the first path table item set to a certain extent, and can improve the matching efficiency. It should be noted that the present application does not limit the recording method of data in each table item. The embodiment of the present application uses a switch as a hardware solution to implement the processing of some data packets and table item aging tasks, thereby improving the forwarding and processing efficiency of data packets.

[0089] S200, the switch matches the first data packet through the first path table item set, and if there is no target table item matching the first data packet in the first path table item set, the switch forwards the first data packet to the processing unit; the processing unit stores a second path table item set, and the second path table item set is used to record the table items of each processed second data packet and the latest hit time information corresponding to the table items;

[0090] In an embodiment of the present application, the switch matches the received first data packet through the first path table item set. Specifically, by parsing the first data packet, the receiving end and sending end information of the first data packet are obtained; then, by searching whether the table items of the first path table item set contain table item records with the same receiving end and the same sending end as the first data packet, if the same table item records exist in the first path table item set, then the first path table item set contains a target table item that matches the first data packet. The first data packet is quickly forwarded through the target table item. On the contrary, if the table item records with the same sending end and the same receiving end cannot be found in the first path table item set, then the first path table item set does not contain a target table item that matches the first data packet. This situation may be because there is no information transmission between the sending end and the receiving end involved in the first data packet before the current moment; it may also be because the time for the information transmission between the sending end and the receiving end involved in the first data packet to occur is greater than the preset aging time threshold, that is, the table item record in the switch has been deleted.

[0091] It is understandable that, in order to record all the table item information, the embodiment of the present application uses a processing unit as a software solution, and the processing unit here can be a processor component, which is used to store a large amount of data packet information that has been forwarded and processed by the switch, that is, the second path table item set is stored in the processing unit. The second path table item set is used to record the table items of each processed second data packet. In some possible implementations, each table item in the second path table item set can also record the path information of the data packet in the form of a key-value pair. In the embodiment of the present application, the second path table item set can be set to store a large amount of table item data, and the target table item is matched to the first path table item set and the second path table item set as much as possible to improve the success rate of matching. However, after a long period of operation and processing, when the second path table item set is fully stored, it is necessary to perform aging processing on the second path table item set, that is, to delete the table item with the earliest forwarding time (i.e., the most recent hit time), release the storage space, and alleviate the problem that the latest table item cannot be stored.

[0092] In the embodiment of the present application, the second path table item set is aged by an aging scheme of deleting when full or overflowing. Specifically, the embodiment of the present application ages the second path table item set by the most recent hit time information, and the most recent hit time information corresponds to each entry in the second path table item set. If the second path table item set is full, the second path table item set can be deleted according to the most recent hit time information; specifically, the entry whose most recent hit time information is the earliest time is deleted from the second path table item set to complete the aging process of the second path table item set. In the embodiment of the present application, the second path table item set can be used to implement the forwarding process of a large number of data packets, which is beneficial to improving the matching success rate.

[0093] It should be noted that the embodiment of the present application performs fast matching and processing of data packets through the first path table item set in the switch, and performs fine matching and processing of data packets through the second path table item set of the processing unit. Therefore, the first path table item set in the embodiment of the present application can be regarded as a fast path table item set, and the second path table item set in the embodiment of the present application can be regarded as a slow path table item set. In order to achieve fast matching, the read and write access speed of the first path table item set can be set higher than that of the second path table item set; in order to match as successfully as possible, the storage capacity of the second path table item set can be set greater than the storage capacity of the first path table item set. Of course, the embodiment of the present application does not limit the relationship between the parameters such as the read and write access speed, storage capacity, etc. corresponding to the first path table item set and the second path table item set.

[0094] S300, the processing unit matches the first data packet through the second path table entry set. If there is a target table entry matching the first data packet in the second path table entry set, the target table entry is added to the first path table entry set, and the switch forwards the first data packet.

[0095] In the embodiment of the present application, if the first data packet is not matched in the first path table entry set, the first data packet is sent to the processing unit, and the first data packet is matched and processed by the second path table entry set in the processing unit. The processing unit in the embodiment of the present application can be set at Figure 1 The terminal device or background server shown. It can be understood that each table item in the second path table item set contains path information. Therefore, the first data packet is matched by parsing the sending end and receiving end information in the first data packet. By finding out whether the table items in the second path table item set contain table item records with the same receiving end and the same sending end as the first data packet, if the same table item records exist in the second path table item set, then there is a target table item that matches the first data packet in the second path table item set. And the target table item found in the second path table item set is added to the first path table item set, and the first data packet is forwarded through the switch. At the same time, the target table item is added to the first path table item set, so that when the data packet of the same path appears next time, it is quickly matched and forwarded through the first path table item set in the switch, and there is no need to match through the second path table item set on the processing unit side, thereby improving the processing efficiency of the data packet.

[0096] It should be noted that in the embodiment of the present application, when adding a target entry in the first path entry set, the corresponding aging timing information needs to be updated for subsequent entry aging processing. It can be seen that the embodiment of the present application realizes the processing of data packet and entry aging tasks by combining a switch with a processing unit, which can improve the stability and processing efficiency of data packet processing and meet the requirements of efficient and large-scale entry aging.

[0097] It can be understood that the embodiment of the present application realizes the processing of data packet and table item aging tasks by combining the switch with the processing unit, which can effectively improve the efficiency of state table item aging synchronization and reduce the overhead of collaboration between software and hardware. In the embodiment of the present application, the switch on the hardware side can quickly process data packets, while the processing unit on the software side can process more complex logic. Through the collaboration of software and hardware, the respective advantages can be combined to improve the overall performance. In the embodiment of the present application, the hardware can quickly match and forward data packets, while the software can perform aging processing of table items in the background. This can avoid frequent table item updates by the hardware and improve efficiency. The embodiment of the present application can save storage resources and make room for new table items by regularly deleting table items that are no longer used (aging processing of table items). The embodiment of the present application can better handle a large number of table items and improve the scalability of the system through the collaboration of software and hardware. The embodiment of the present application can better handle a large number of table items through the collaboration of software and hardware when hardware resources are insufficient, so as to improve the stability of the system; at the same time, the state of the table items can be better detected and managed to improve the maintainability of the system.

[0098] In some embodiments, after the above embodiment S100, receiving the first data packet to be processed, may include but is not limited to S110-S130:

[0099] S110, parsing the first data packet to obtain a media access control address in the first data packet;

[0100] S120, detecting whether the media access control address belongs to the destination address corresponding to the switch;

[0101] S130: If the media access control address does not belong to the destination address corresponding to the switch, discard the first data packet.

[0102] In some possible implementations, after receiving the first data packet, the switch needs to authenticate the security performance of the first data packet to determine whether the first data packet is a receivable security data packet. Specifically, the embodiment of the present application can determine the security performance of the first data packet by the media access control address to improve the correctness of packet sending. In some possible implementations, the first data packet is parsed and processed to obtain the media access control address (i.e., MAC address) in the first data packet; and it is detected whether the media access control address belongs to the destination address corresponding to the switch. If it belongs to the destination address, subsequent processing is performed; if it does not belong to the destination address, the first data packet is discarded. The embodiment of the present application determines the address of the first data packet to clarify that the first data packet is a security data packet, thereby improving the security performance of data packet forwarding and processing.

[0103] In some embodiments, the above embodiment S200, matching the first data packet through the first path table entry set, may include but is not limited to S210-S220:

[0104] S210, parsing the first data packet to obtain header information in the first data packet;

[0105] S220 . Match the first data packet in the first path table entry set according to the header information.

[0106] In some possible implementations, the first data packet is matched through the first path table item set. The key value of each table item in the first path table item set stores a five-tuple of the table item, and the five-tuple is used to characterize the path information of the relevant data packet. The first data packet contains header information, and the header information also includes relevant data characterizing the path information. Therefore, the switch parses and processes the first data packet to obtain the header information of the first data packet. It should be noted that, exemplarily, the header information may include source IP, destination IP, source port, destination port, and protocol. The embodiment of the present application searches in the first path table item set through the header information. If the key value information of a table item is the same as the header information, the table item is the matching target table item. It can be understood that, similarly, the embodiment of the present application also matches the data packet in the second path table item set in this way. The embodiment of the present application matches the first data packet through the header information to quickly complete the forwarding processing of the data packet.

[0107] In some embodiments, reference Figure 4 The data packet processing method provided in the embodiment of the present application may also include but is not limited to S400-S500:

[0108] S400: If a target entry matching the first data packet exists in the first path entry set, the switch processes the first data packet through the target entry and updates aging timing information corresponding to the target entry;

[0109] S500: The switch forwards the processed first data packet to the target device through the designated port according to the media access control address.

[0110] In some possible implementations, if there is a target table entry matching the first data packet in the first path table entry set, the first data packet can be forwarded through the target table entry. In some possible implementations, the first data packet is processed according to the target table entry information. For example, the header information of the data packet can be modified, a new checksum can be calculated, and the like can be processed. At the same time, the switch determines the forwarding port of the first data packet according to the media access control address, and forwards the processed first data packet through the forwarding port. It can be understood that the embodiment of the present application needs to simultaneously update the aging timing information of the target table entry matching the first data packet to record the forwarding work of this data packet, so as to alleviate the problem of the table entry being mistakenly deleted because it has not been used for a long time. For example, if the aging timing information uses a countdown system to record the time, the aging timing information is updated to a preset aging time threshold; if the aging timing information uses a positive system to record the time, the aging timing information is updated to zero, and the time is recorded from zero.

[0111] In some embodiments, the above embodiment S300 enables the switch to forward the first data packet, which may include but is not limited to S310-S320:

[0112] S310, the processing unit processes the first data packet through the target table entry, and forwards the processed first data packet to the switch;

[0113] S320: The switch forwards the processed first data packet to the target device through the designated port according to the media access control address.

[0114] In the embodiment of the present application, when the matching of the first data packet is achieved on the processing unit side, the first data packet can be processed in the processing unit, and then the processed first data packet can be sent to the switch for forwarding. In some application scenarios, such as video interaction scenarios, both parties of data interaction have high requirements for short-time and high-frequency data transmission. For such scenarios, the storage space of the switch can be set to a smaller storage space to store a small amount of table item information to quickly match the first data packet. The switch with a small storage space has a weak processing capability for large-scale data packets. At this time, the first data packet can be processed by the processing unit to improve the performance of the system. It can be understood that in this scenario, the storage space of the processing unit is larger than the storage space of the switch. Therefore, the table items stored in the switch also exist in the processing unit; that is, the target table items are also stored in the processing unit. The processing unit can directly process the first data packet through the target table item and forward the processed first data packet to the switch. The switch performs the matching task, and the processing unit performs the processing task, which can realize fast data packet processing tasks and improve system performance.

[0115] In some embodiments, reference Figure 5 The data packet processing method provided in the embodiment of the present application may also include but is not limited to S600-S700:

[0116] S600: If there is no target entry matching the first data packet in the second path entry set, the processing unit detects whether there is any remaining space in the second path entry set;

[0117] S700: If there is remaining space in the second path entry set, the processing unit creates a target entry corresponding to the first data packet, adds the target entry to the second path entry set and the first path entry set, and enables the switch to forward the first data packet.

[0118] In some possible implementations, if no table entry matching the first data packet is found in the first path table entry set, then a match is performed in the second path table entry set. If no table entry matching the first data packet is found in the second path table entry set, then a new table entry needs to be created. It is understandable that the second path table entry set in the embodiment of the present application does not adopt an aging scheme of preferentially deleting table entries at regular intervals, and therefore, the second path table entry set may be full.

[0119] In the embodiment of the present application, when establishing a new table entry, it is first determined whether there is remaining space in the second path table entry set. If there is remaining space in the second path table entry set, the processing unit establishes a target table entry for the first data packet, and stores the key-value pair of the target table entry in the first path table entry set and the second path table entry set, so as to facilitate the rapid matching and forwarding processing of the same data packet in the future. In some possible application scenarios, such as shopping scenarios, during the discount promotion period, a large number of payment accounts will make payment requests in a short period of time. At this time, the switch will receive a large number of data packet forwarding requests, and the table entries in the switch have not reached the aging time, and the switch will also have the problem of full overflow. In view of this situation, when establishing a new target table entry in the first path table entry set, the embodiment of the present application can also first determine whether there is remaining space in the first path table entry set. If there is remaining space in the first path table entry set, the target table entry can be directly established in the first path table entry set. The embodiment of the present application facilitates the rapid forwarding processing of subsequent data packets and improves the forwarding efficiency of data packets through the establishment of target table entries.

[0120] In some embodiments, the above embodiment S700, adding the target entry to the second path entry set and the first path entry set, may include but is not limited to S710-S720:

[0121] S710, the processing unit adds the target entry to the second path entry set, and updates the most recent hit time information corresponding to the target entry to the current time;

[0122] S720: The processing unit sends the target entry to the switch. The switch adds the target entry to the first path entry set and updates the aging timing information corresponding to the target entry to a preset aging time threshold.

[0123] In some possible implementations, when adding the target table item to the first path table item set and the second path table item set, in addition to adding the path data of the first data packet, the embodiment of the present application also needs to update the time information of the target table item; that is, the aging timing information needs to be updated in the first path table item set, and the hit time information needs to be updated in the second path table item set. It can be understood that for the first path table item set, since the first path table item set adopts an aging scheme of timely deletion, the aging timing information can be updated to a preset aging time threshold or recorded as zero, and the time is recorded in a countdown manner or a forward timing manner. For the second path table item set, since the second path table item set adopts an aging scheme of full overflow, the hit time information can be updated to the current time. When the second path table item set needs to be deleted after full overflow, the deletion operation is performed according to the order of the hit time. The embodiment of the present application accurately records the time information of the first path table item set and the second path table item set by updating the time information of the target table item, which is convenient for subsequent accurate aging processing and improves the accuracy of aging processing.

[0124] In some embodiments, reference Figure 6 The data packet processing method provided in the embodiment of the present application may also include but is not limited to S610-S640:

[0125] S610: If there is no remaining space in the second path entry set, the processing unit determines a first entry from the second path entry set; the first entry is an entry with the earliest corresponding most recent hit time information;

[0126] S620, the processing unit creates a target table entry corresponding to the first data packet, replaces the first table entry in the second path table entry set with the target table entry, and updates the most recent hit time information corresponding to the target table entry to the current time;

[0127] S630: The processing unit sends the first table entry and the target table entry to the switch, and the switch detects whether the first table entry exists in the first path table entry set;

[0128] S640. If the first entry exists in the first path entry set, the switch replaces the first entry in the first path entry set with the target entry, and updates the aging timing information corresponding to the target entry to a preset aging time threshold; or, if the first entry does not exist in the first path entry set, the switch adds the target entry to the first path entry set, and updates the aging timing information corresponding to the target entry to a preset aging time threshold.

[0129] In an embodiment of the present application, if the second path table item set needs to establish a new target table item, but through judgment, there is no remaining space in the second path table item set, it is necessary to perform a table item deletion operation on the second path table item set to leave space to store the target table item of the newly created path. It can be understood that the longer the table item is from the last forwarding time (i.e., the time corresponding to the hit time information), the less frequently it is called, and the lower the possibility of being called again. In this regard, the embodiment of the present application preferentially deletes the earliest table item corresponding to the hit time information in the second path table item set, and records the table item as the first table item. After deleting the first table item, a new target table item is established and stored in the first table item position, that is, the first table item is replaced by the target table item, and the time information of the new first table item is updated to complete the task of establishing the target table item in the second target table item set.

[0130] In the embodiment of the present application, for the target table item establishment task of the first path table item set, after the switch receives the target table item from the processing unit, first, it checks whether the first table item exists in the first path table item set. It should be noted that for some application scenarios, if the storage space of the first path table item set and the second path table item set is not much different, and at the same time, the aging time threshold of the first path table item set is set relatively large, at this time, the table items in the first path table item set may be the same as the table items in the second path table item set, and it is checked whether the first table item exists in the first path table item set. When the first table item exists in the first path table item set, the target table item replaces the first table item, and the uniformity of the table item information in the first path table item set and the second path table item set is maintained. If the first table item in the first path table item set is not replaced at this time, the first table item is stored in the first path table item set for a long time, which virtually increases the storage of the first path table item set, which is not conducive to improving the matching efficiency. On the contrary, if the first table item does not exist in the first path table item set, the switch adds the target table item to the first path table item set. After the target entry is established in the first path entry set, the time information corresponding to the target entry is updated to facilitate subsequent aging processing.

[0131] Exemplarily, the target table entry creation operation in the embodiment of the present application can be implemented through a linked list. Specifically, if no matching target table entry is found in the first path table entry set, the processing unit needs to create a new table entry. In the linked list L[S] of the first path table entry set (where S represents the total size of the table entries that can be stored, L[S] is an ordered linked list, the L[0] table entry has the oldest last hit time, and the L[S-1] table entry has the latest last hit time), there is no free linked list space, then the table entry creation operation of the second path table entry set and the first path table entry set is performed according to the following steps:

[0132] S6101, delete the entry of L[0] from the linked list;

[0133] S6102, create the latest entry t;

[0134] S6103, set the next pointer of the L[S-1] entry to point to entry t, set the next pointer of entry t to point to null, and update the linked list head pointer Head to point to entry L[1].

[0135] S6104. Delete the L[0] entry from the second path entry set.

[0136] In some embodiments, the updating steps of the first path entry set may include but are not limited to S810-S820:

[0137] S810, the switch detects whether there is a second entry in the first path entry set; the aging timing information corresponding to the second entry is zero;

[0138] S820: If the second entry exists in the first path entry set, the switch deletes the second entry in the first path entry set to obtain an updated first path entry set.

[0139] In some possible implementations, the first path table item set in the embodiment of the present application preferentially adopts an aging scheme of timely deletion, which reduces the number of items in the first path table item set to a certain extent and improves matching efficiency. When performing the aging operation, it is necessary to detect the time information of each item in the first path table item set, and according to the timing method of the aging timing information, delete the item (i.e., the second item) corresponding to the aging timing information being zero or the value in the aging timing information being greater than the preset aging time threshold. That is, find the second item in the first path table item set, delete the second item, and obtain the updated first path table item set.

[0140] It is understandable that in some possible implementations, the time information corresponding to the entries in the first path table entry set all complies with the above-mentioned aging strategy, but the storage space of the first path table entry set is full or the remaining storage space is very small. At this time, several entries with a long last forwarding time can be deleted according to the time information corresponding to the aging timing information in each entry to alleviate the problem of the first path table entry set being full.

[0141] In some embodiments, the updating steps of the second path entry set may include but are not limited to S830-S840:

[0142] S830, the processing unit obtains entry aging event information from the switch; the entry aging event information includes the second entry deleted from the first path entry set and the time node when the second entry is deleted;

[0143] S840: The processing unit updates the most recent hit time information corresponding to the second entry in the second path entry set according to the time node and a preset aging time threshold.

[0144] In some possible implementations, the second path table item set of the embodiment of the present application is aged through hit time information. When a new entry is created in the second path table item set, the hit time information corresponding to the entry is the latest forwarding time of the data packet. For a data packet that is successfully matched only through the first path table item set, the data packet is forwarded, but the time information corresponding to the path in the second path table item set may not be updated based on the forwarding of the data packet.

[0145] It is understandable that if the path is not deleted due to timeout in the first path table entry, then the data packet will most likely still be forwarded. When the data packet forwarding event corresponding to the path occurs again within the preset aging time threshold, the matching and forwarding operations of the data packet can be completed through the first understanding table entry set. When the path is not deleted due to timeout in the first path table entry, the time information of the table entry in the second path table entry set is not the latest forwarding time. At this time, it is necessary to update the table entry time information in the second path table entry set. Otherwise, if the forwarding processing of the data packet is not generated subsequently, the most recent hit time information of the table entry in the second path table entry set is wrong, and the wrong time information is early, so the table entry is easily deleted by mistake, affecting the matching efficiency of the second path table entry set. In the embodiment of the present application, when the first path table entry set performs a table entry deletion operation, it is necessary to record the time node of the table entry being deleted to update the hit time information of the table entry in the second path table entry set. Specifically, the processing unit obtains the table item aging event information from the switch, including information of several table items deleted from the first path table item set, namely, the second table item. The processing unit can determine the time when the second table item performs the last forwarding operation, namely, the most recent hit time information, based on the time node when the second table item is deleted and the preset aging time threshold, and update the most recent hit time information corresponding to the second table item in the second path table item set based on the hit time information. The above steps realize the aging synchronization of the first path table item set and the second path table item set, thereby improving the accuracy of the aging task.

[0146] In some possible implementations, the aging synchronization of the first path entry set and the second path entry set may be implemented by an entry aging synchronization module. The operation logic of the specific process is as follows:

[0147] S8301. The entry aging synchronization module periodically collects entry aging events synchronized from fast path entries, that is, the time point A at which the entry ages (that is, the time point at which it is deleted).

[0148] S8302: Calculate the time of the most recent hit refresh of the corresponding entry (ie, the time corresponding to the hit time information) Hit=AT according to the maximum aging time T of the entry (ie, the preset aging time threshold) and the time A when the aging event is reported.

[0149] S8303, the processing unit side updates the latest hit time corresponding to the entry, that is:

[0150] a) Find the corresponding entry L[i] in the slow path list;

[0151] b) Update L[i].last_hit_time=Hit.

[0152] In some embodiments, in the above embodiment S830, the processing unit obtains the entry aging event information from the switch, which may include but is not limited to S831-S833:

[0153] S831, the processing unit queries the first time when the table entry aging event information was obtained last time;

[0154] S832, the processing unit determines the time interval between the first time and the current time;

[0155] S833: If the time interval is equal to the preset synchronization period, the processing unit sends a synchronization instruction to the switch to obtain the entry aging event information of the switch after the first time.

[0156] The embodiment of the present application can periodically perform aging synchronization operations on the first path table item set and the second path table item set to periodically update the path time information in the second path characterization set to improve the aging accuracy. Those skilled in the art can adjust the specific value of the preset synchronization period according to actual needs. Specifically, when the forwarding frequency of the data packet is high, a smaller synchronization period can be set to improve the effect of aging synchronization; when the forwarding frequency of the data packet is low, a larger synchronization period can be set to improve system performance.

[0157] In the embodiment of the present application, during the data packet processing, if any abnormality occurs (e.g., data packet error, search failure, insufficient resources, etc.), the switch needs to set a corresponding processing mechanism, which may include discarding data packets, triggering alarms, and the like.

[0158] Reference Figure 7 , the data packet processing method proposed in this application is described below through a specific embodiment to better understand the content of this solution.

[0159] The data packet processing method of the embodiment of the present application can be divided into three situations:

[0160] Scenario 1: Table entry creation process (slow path table has direct free space), the corresponding process is as follows:

[0161] S911, a new data packet enters through the switch port;

[0162] S912, first match and detect the fast path table entry to see if there is a match. If there is a match, forward it directly from the outbound port of the switch and refresh the aging time of the corresponding matching table entry; if there is no match, forward it to the CPU (i.e., the processing unit) to pass the slow path check;

[0163] S913. The CPU detects whether the slow path table entry matches the received data packet. If there is no match, a new table entry is created and synchronized to the fast path table entry. After the table entry is created, the CPU delivers the data packet to the switch ASIC for forwarding.

[0164] Scenario 2: Table entry creation process (no direct free space in the slow path table), the corresponding process is as follows:

[0165] S921, a data packet enters through the switch port;

[0166] S922: After matching the fast path table entry, if no match is found, the data packet is forwarded to the CPU slow path detection;

[0167] S923. The CPU detects whether the slow path table entry matches the received data packet. If there is no match, a new table entry is created. At this time, there is no free table space in the linked list of the slow path. The entry with the oldest last hit time in the linked list is selected for replacement, and the entry is synchronously unloaded to the fast path. After the table entry is created, the CPU delivers the data packet to the switch ASIC for forwarding.

[0168] Scenario 3: Slow path entry aging synchronization process:

[0169] S931, an entry aging synchronization module, periodically collecting entry aging events synchronized from fast path entries;

[0170] S932: According to the synchronization cycle of the aging synchronization module and the time when the aging event is reported, the time when the corresponding entry is most recently hit and refreshed is inferred, and updated to the time corresponding to the entry.

[0171] The present application provides a data packet processing method, which realizes the processing of data packet and table item aging tasks by combining a switch with a processing unit, wherein a first path table item set is stored in the switch, and the first path table item set is used to record the table items of each processed second data packet and the aging timing information corresponding to the table items; a second path table item set is stored in the processing unit, and the second path table item set is used to record the table items of each processed second data packet and the latest hit time information corresponding to the table items. The switch side can use the first path table item set to efficiently process part of the table item aging tasks. When the switch receives the first data packet to be processed, the first data packet can be quickly matched through the local first path table item set, which is conducive to improving the processing efficiency of the data packet; the processing unit side can use the second path table item set to process a large number of table item aging tasks. If there is no target table item matching the first data packet in the first path table item set, the first data packet is forwarded to the processing unit for matching. If there is a target table item matching the first data packet in the second path table item set, the target table item can be quickly added to the first path table item set, so that the switch forwards the first data packet. The technical solution in the present application can improve the stability and efficiency of data packet processing, and can meet the needs of efficient and large-scale table entry aging.

[0172] Reference Figure 8 , the embodiment of the present application also discloses a data packet processing device, the device comprising a switch 810 and a processing unit 820; the switch is used to receive a first data packet to be processed; a first path table entry set is stored in the switch, and the first path table entry set is used to record the table entries of each processed second data packet and the aging timing information corresponding to the table entry;

[0173] The switch is used to match the first data packet through the first path table item set, and if there is no target table item matching the first data packet in the first path table item set, the first data packet is forwarded to the processing unit; the processing unit stores a second path table item set, and the second path table item set is used to record the table items of each processed second data packet and the latest hit time information corresponding to the table items;

[0174] The processing unit is used to match the first data packet through the second path table entry set. If there is a target table entry matching the first data packet in the second path table entry set, the target table entry is added to the first path table entry set, and the switch forwards the first data packet.

[0175] In the embodiment of the present application, after receiving the first data packet to be processed, the switch matches the first data packet through the first path table item set stored in the switch, and if there is no target table item matching the first data packet in the first path table item set, the first data packet is forwarded to the processing unit; the processing unit is used to match the first data packet through the stored second path table item set, and if there is a target table item matching the first data packet in the second path table item set, the target table item is added to the first path table item set, and the switch forwards the first data packet. The technical solution in the present application can improve the stability and processing efficiency of data packet processing, and can meet the requirements of efficient and large-scale table item aging.

[0176] Optionally, in the data packet processing device in the embodiment of the present application, the switch is also used to parse the first data packet to obtain the media access control address in the first data packet; detect whether the media access control address belongs to the destination address corresponding to the switch; if the media access control address does not belong to the destination address corresponding to the switch, discard the first data packet.

[0177] Optionally, in the data packet processing device in the embodiment of the present application, the switch is also used to parse and process the first data packet to obtain header information in the first data packet; and match the first data packet in the first path table entry set according to the header information.

[0178] Optionally, in the data packet processing device in the embodiment of the present application, if there is a target table entry matching the first data packet in the first path table entry set, the switch is also used to process the first data packet through the target table entry and update the aging timing information corresponding to the target table entry; according to the media access control address, the processed first data packet is forwarded to the target device through the designated port.

[0179] Optionally, in the data packet processing device in the embodiment of the present application, the processing unit is further configured to process the first data packet through the target table entry, and forward the processed first data packet to the switch;

[0180] The switch is further configured to forward the processed first data packet to a target device through a designated port according to a media access control address.

[0181] Optionally, in the data packet processing device in the embodiment of the present application, if there is no target table entry matching the first data packet in the second path table entry set, the processing unit is further used to detect whether there is remaining space in the second path table entry set;

[0182] If there is remaining space in the second path entry set, the processing unit is further configured to create a target entry corresponding to the first data packet, add the target entry to the second path entry set and the first path entry set, and enable the switch to forward the first data packet.

[0183] Optionally, in the data packet processing device in the embodiment of the present application, the processing unit is further configured to add the target entry to the second path entry set, and update the most recent hit time information corresponding to the target entry to the current time;

[0184] The processing unit is further used to send the target table entry to the switch, and the switch is further used to add the target table entry to the first path table entry set and update the aging timing information corresponding to the target table entry to a preset aging time threshold.

[0185] Optionally, in the data packet processing device in the embodiment of the present application, if there is no remaining space in the second path table entry set, the processing unit is further used to determine a first table entry from the second path table entry set; the first table entry is the table entry with the earliest corresponding most recent hit time information;

[0186] The processing unit is also used to create a target table entry corresponding to the first data packet, replace the first table entry in the second path table entry set with the target table entry, and update the most recent hit time information corresponding to the target table entry to the current time;

[0187] The processing unit is further used to send the first table entry and the target table entry to the switch, and the switch is further used to detect whether the first table entry exists in the first path table entry set;

[0188] If the first table entry exists in the first path table entry set, the switch is also used to replace the first table entry in the first path table entry set with the target table entry, and update the aging timing information corresponding to the target table entry to the preset aging time threshold; or, if the first table entry does not exist in the first path table entry set, the switch is also used to add the target table entry to the first path table entry set, and update the aging timing information corresponding to the target table entry to the preset aging time threshold.

[0189] Optionally, in the data packet processing device in the embodiment of the present application, the switch is further configured to detect whether a second entry exists in the first path entry set; the aging timing information corresponding to the second entry is zero;

[0190] If the second entry exists in the first path entry set, the switch is further configured to delete the second entry in the first path entry set to obtain an updated first path entry set.

[0191] Optionally, in the data packet processing device in the embodiment of the present application, the processing unit is further used to obtain table item aging event information from the switch; the table item aging event information includes the second table item deleted from the first path table item set and the time node when the second table item is deleted;

[0192] The processing unit is further configured to update the most recent hit time information corresponding to the second entry in the second path entry set according to the time node and a preset aging time threshold.

[0193] Optionally, in the data packet processing device in the embodiment of the present application, the processing unit is further configured to query the first time when the table entry aging event information was last obtained;

[0194] The processing unit is also used to determine the time interval between the first time and the current time;

[0195] If the time interval is equal to the preset synchronization period, the processing unit is further configured to send a synchronization instruction to the switch to obtain entry aging event information of the switch after the first time.

[0196] It is understandable that if Figure 2 The contents of the data packet processing method embodiment shown in the figure are applicable to the data packet processing device embodiment. The functions specifically implemented by the data packet processing device embodiment are similar to those of the embodiment shown in the figure. Figure 2 The processing method of the data packet shown in the embodiment is the same as that of the embodiment of the invention, and the beneficial effects achieved are the same as those of the embodiment of the invention. Figure 2 The beneficial effects achieved by the embodiment of the method for processing data packets shown are also the same.

[0197] The present application also discloses an electronic device, including:

[0198] at least one processor;

[0199] at least one memory for storing at least one program;

[0200] When at least one program is executed by at least one processor, the at least one processor implements Figure 2 An embodiment of a method for processing a data packet is shown.

[0201] The electronic device in the embodiment of the present application may integrate the switch and the processing unit in the above-mentioned data packet processing method embodiment. It can be understood that, if Figure 2 The contents of the data packet processing method embodiment shown in the figure are applicable to the electronic device embodiment, and the functions specifically implemented by the electronic device embodiment are similar to those in the figure. Figure 2 The processing method of the data packet shown in the embodiment is the same as that of the embodiment of the invention, and the beneficial effects achieved are the same as those of the embodiment of the invention. Figure 2 The beneficial effects achieved by the embodiment of the method for processing data packets shown are also the same.

[0202] The electronic device for executing the above-mentioned data packet processing method provided in the embodiment of the present application may be a terminal. Fig. 9 , Fig. 9This is a partial structural block diagram of a terminal provided in an embodiment of the present application. The terminal includes: a radio frequency (RF) circuit 1010, a memory 1020, an input unit 1030, a display unit 1040, a sensor 1050, an audio circuit 1060, a wireless fidelity (WiFi) module 1070, a processor 1080, and a power supply 1090. Those skilled in the art can understand that Fig.10 The terminal structure shown in the figure does not constitute a limitation on the mobile phone, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0203] The RF circuit can be used to receive and send signals during information transmission or calls. In particular, after receiving the downlink information from the base station, it is sent to the processor for processing; in addition, the designed uplink data is sent to the base station.

[0204] The memory can be used to store software programs and modules. The processor executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory.

[0205] The input unit can be used to receive input digital or character information and generate key signal input related to the setting and function control of the mobile phone. Specifically, the input unit can include a touch panel 1031 and other input devices 1032.

[0206] The display unit 1040 may be used to display input information or provided information and various menus of the mobile phone. The display unit 1040 may include a display panel 1041 .

[0207] The audio circuit 1060 , the speaker 1061 , and the microphone 1062 may provide an audio interface.

[0208] In this embodiment, the processor included in the terminal can execute the data packet processing method of the previous embodiment.

[0209] The electronic device for executing the above-mentioned data packet processing method provided in the embodiment of the present application may also be a server, referring to Fig.10 , Fig.10Partial structural block diagram of the server provided in the embodiment of the present application, the server 1100 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (abbreviated as CPU, i.e. Central Processing Units), 1122 (for example, one or more processors) and memory 1132, one or more storage media 1130 (for example, one or more mass storage devices) storing application programs 1142 or data 1144. Among them, the memory 1132 and the storage medium 1130 can be short-term storage or permanent storage. The program stored in the storage medium 1130 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the server 1100. Furthermore, the central processing unit 1122 can be configured to communicate with the storage medium 1130 to execute a series of instruction operations in the storage medium 1130 on the server 1100.

[0210] The server may also include one or more power supplies 1126, one or more wired or wireless network interfaces 1150, one or more input and output interfaces 1158, and / or one or more operating systems 1141, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0211] The processor in the server can be used to execute the above data packet processing method.

[0212] The present application also discloses a computer-readable storage medium in which a program executable by a processor is stored. When the program executable by the processor is executed by the processor, it is used to implement the following Figure 2 An embodiment of a method for processing a data packet is shown.

[0213] Understandably, Figure 2 The contents of the data packet processing method embodiment shown in the figure are applicable to the computer-readable storage medium embodiment, and the functions specifically implemented by the computer-readable storage medium embodiment are similar to those of the embodiment shown in the figure. Figure 2 The processing method of the data packet shown in the embodiment is the same as that of Figure 2 The beneficial effects achieved by the embodiment of the method for processing data packets shown are also the same.

[0214] The embodiment of the present application further discloses a computer program product or a computer program, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in the above-mentioned computer-readable storage medium; Fig.10The processor of the electronic device shown can read the computer instruction from the above-mentioned computer readable storage medium, and the processor executes the computer instruction so that the computer device executes Figure 2 An embodiment of a method for processing a data packet is shown.

[0215] Understandably, Figure 2 The contents of the data packet processing method embodiment shown in the figure are applicable to the computer program product or computer program embodiment, and the functions specifically implemented by the computer program product or computer program embodiment are the same as those in the embodiment of the present invention. Figure 2 The processing method of the data packet shown in the embodiment is the same as that of Figure 2 The beneficial effects achieved by the embodiment of the method for processing data packets shown are also the same.

[0216] In some selectable embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the application is provided by way of example, for the purpose of providing a more comprehensive understanding of technology. The disclosed method is not limited to the operation and logic flow presented herein. Selectable embodiments are expected, wherein the order of various operations is changed and the sub-operation of a part described as a larger operation is performed independently.

[0217] In addition, although the present application is described in the context of functional modules, it should be understood that, unless otherwise specified, one or more of the functions and / or features can be integrated into a single physical device and / or software module, or one or more functions and / or features can be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the present application. More specifically, in view of the properties, functions, and internal relationships of the various functional modules in the device disclosed herein, the actual implementation of the module will be understood within the conventional techniques of the engineer. Therefore, those skilled in the art can implement the present application set forth in the claims without excessive experimentation using ordinary techniques. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present application, which is determined by the full scope of the attached claims and their equivalents.

[0218] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.

[0219] The logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable instructions for implementing logical functions, and may be embodied in any computer-readable storage medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, apparatus, or device and execute instructions), or in conjunction with such instruction execution system, apparatus, or device. For purposes of this specification, a "computer-readable storage medium" may be any device that can contain, store, communicate, propagate, or transmit a program for use by an instruction execution system, apparatus, or device, or in conjunction with such instruction execution system, apparatus, or device.

[0220] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0221] In the above description of this specification, the description with reference to the terms "one embodiment / example", "another embodiment / example" or "certain embodiments / examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0222] Although the embodiments of the present application have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present application, and that the scope of the present application is defined by the claims and their equivalents.

[0223] The above is a specific description of the preferred implementation of the present application, but the present application is not limited to the embodiments. Technical personnel familiar with the field can make various equivalent modifications or substitutions without violating the spirit of the present application. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present application.

Claims

1. A method for processing a data packet, characterized in that: The method comprises: The switch receives a first data packet to be processed; the switch stores a first path table entry set, the first path table entry set being used to record table entries of each processed second data packet and aging timing information corresponding to the table entries; The switch matches the first data packet through the first path table item set, and if there is no target table item matching the first data packet in the first path table item set, forwards the first data packet to the processing unit; the processing unit stores a second path table item set, and the second path table item set is used to record the table items of each processed second data packet and the latest hit time information corresponding to the table items; The processing unit matches the first data packet through the second path table entry set. If there is a target table entry matching the first data packet in the second path table entry set, the target table entry is added to the first path table entry set, and the switch forwards the first data packet.

2. The method for processing a data packet according to claim 1, characterized in that: After receiving the first data packet to be processed, the method further includes: Parsing the first data packet to obtain a media access control address in the first data packet; Detecting whether the media access control address belongs to the destination address corresponding to the switch; If the media access control address does not belong to the destination address corresponding to the switch, the first data packet is discarded.

3. The method for processing a data packet according to claim 1, characterized in that: The matching the first data packet by using the first path table entry set includes: Parsing the first data packet to obtain header information in the first data packet; The first data packet is matched in the first path table entry set according to the header information.

4. The method for processing a data packet according to claim 2, characterized in that: The method further comprises: If the first path entry set contains a target entry that matches the first data packet, the switch processes the first data packet through the target entry and updates aging timing information corresponding to the target entry; The switch forwards the processed first data packet to the target device through a designated port according to the media access control address.

5. The method for processing a data packet according to claim 2, characterized in that: The step of causing the switch to forward the first data packet includes: The processing unit processes the first data packet through the target table entry, and forwards the processed first data packet to the switch; The switch forwards the processed first data packet to the target device through a designated port according to the media access control address.

6. The method for processing a data packet according to any one of claims 1 to 5, characterized in that: The method further comprises: If there is no target table entry matching the first data packet in the second path table entry set, the processing unit detects whether there is remaining space in the second path table entry set; If there is remaining space in the second path entry set, the processing unit creates a target entry corresponding to the first data packet, adds the target entry to the second path entry set and the first path entry set, and enables the switch to forward the first data packet.

7. The method for processing a data packet according to claim 6, characterized in that: The adding the target entry to the second path entry set and the first path entry set includes: The processing unit adds the target entry to the second path entry set, and updates the most recent hit time information corresponding to the target entry to the current time; The processing unit sends the target entry to the switch, and the switch adds the target entry to the first path entry set and updates the aging timing information corresponding to the target entry to a preset aging time threshold.

8. The method for processing a data packet according to claim 6, characterized in that: The method further comprises: If there is no remaining space in the second path table entry set, the processing unit determines a first table entry from the second path table entry set; the first table entry is the table entry with the earliest corresponding most recent hit time information; The processing unit creates a new target table entry corresponding to the first data packet, replaces the first table entry in the second path table entry set with the target table entry, and updates the most recent hit time information corresponding to the target table entry to the current time; The processing unit sends the first table entry and the target table entry to the switch, and the switch detects whether the first table entry exists in the first path table entry set; If the first entry exists in the first path entry set, the switch replaces the first entry in the first path entry set with the target entry, and updates the aging timing information corresponding to the target entry to a preset aging time threshold; or, if the first entry does not exist in the first path entry set, the switch adds the target entry to the first path entry set, and updates the aging timing information corresponding to the target entry to a preset aging time threshold.

9. The method for processing a data packet according to claim 1, characterized in that: The first path table entry set is also updated by the following steps: The switch detects whether a second entry exists in the first path entry set; the aging timing information corresponding to the second entry is zero; If the second entry exists in the first path entry set, the switch deletes the second entry in the first path entry set to obtain an updated first path entry set.

10. The method for processing a data packet according to claim 9, characterized in that: The second path table entry set is also updated by the following steps: The processing unit obtains entry aging event information from the switch; the entry aging event information includes the second entry deleted from the first path entry set and the time node when the second entry is deleted; The processing unit updates the most recent hit time information corresponding to the second entry in the second path entry set according to the time node and a preset aging time threshold.

11. The method for processing a data packet according to claim 10, characterized in that: The processing unit obtains entry aging event information from the switch, including: The processing unit queries the first time when the aging event information of the entry was obtained last time; The processing unit determines a time interval between the first time and the current time; If the time interval is equal to a preset synchronization period, the processing unit sends a synchronization instruction to the switch to obtain entry aging event information of the switch after the first time.

12. A data packet processing device, characterized in that: The device comprises a switch and a processing unit; The switch is used to receive a first data packet to be processed; a first path table entry set is stored in the switch, and the first path table entry set is used to record the table entries of each processed second data packet and the aging timing information corresponding to the table entries; The switch is used to match the first data packet through the first path table item set, and if there is no target table item matching the first data packet in the first path table item set, forward the first data packet to the processing unit; the processing unit stores a second path table item set, and the second path table item set is used to record the table items of each processed second data packet and the latest hit time information corresponding to the table items; The processing unit is used to match the first data packet through the second path table entry set. If there is a target table entry matching the first data packet in the second path table entry set, the target table entry is added to the first path table entry set, and the switch forwards the first data packet.

13. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the method for processing a data packet according to any one of claims 1 to 11 is implemented.

14. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for processing a data packet according to any one of claims 1 to 11 is implemented.