Data processing system, method, device, medium and product of programmable switch

By processing data packets inside the P4 data plane and using inlet and exit processing modules to realize multi-user rule processing, the high cost and complexity problems in the combination of P4 programmable switches and DPUs are solved, and the system development and maintenance are simplified, and the system development and maintenance are improved. The flexibility and scalability of the system are achieved.

CN118784604BActive Publication Date: 2024-11-22WUHAN BOYIXUN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411261592.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-10
Publication Date
2024-11-22
Estimated Expiration
2044-09-10

AI Technical Summary

Technical Problem

The existing P4 programmable switch combined with DPU is costly and complex, increasing the difficulty of system development and maintenance.

Method used

Using the method of processing data packets inside the P4 data plane, the inlet processing module and the exit processing module are used to determine the packet type and add loopback to the header to realize the processing of multi-user rules, avoiding the dependence on the dedicated DPU. .

Benefits of technology

It reduces the cost of system development and maintenance, simplifies system integration and configuration, and improves system flexibility and scalability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118784604B_ABST
    Figure CN118784604B_ABST
Patent Text Reader

Abstract

The embodiments of the present application relate to the field of computer technology, and disclose a data processing system, method, device, medium and product of a programmable switch. The system includes an inlet processing module and an outlet processing module; the inlet processing module is used to determine the type of a data packet; the type of the data packet includes an original data packet and a loopback data packet; if the type of the data packet is an original data packet, a copy operation is performed on the original data packet to obtain a copied data packet; a loopback header is added to the copied data packet to obtain a target data packet; the outlet processing module is used to implement the processing of multiple user rules according to the target data packet and the loopback data packet. It can at least be used to solve the technical problem that the cost of the solution of the related technology is high and is not conducive to the development and maintenance of the system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data processing system, method, device, medium and product of a programmable switch. Background Art

[0002] The P4 programmable switch is a highly customizable and flexible network device that can implement customized packet processing and forwarding logic by programming and configuring it using the P4 language.

[0003] It can be understood that the P4 programmable switch is able to provide services to multiple users, handle network requests from different users, and ensure that each user can obtain the required network services.

[0004] In the related technologies, the technical solution of combining P4 programmable switches and DPU is basically adopted to process network requests from different users and ensure that each user can obtain the required network services. Among them, DPU, the full name of which is DataPlane Unit in English, is a special hardware used to process network data packets. The method flow of the related technology is roughly as follows:

[0005] 1) The P4 data plane forwards the data packets received by the programmable switch to the DPU;

[0006] 2) The DPU matches multiple user rules based on the data packet. If a data packet matches multiple user rules at the same time, the DPU may duplicate the data packet to generate a customized response for each user, ensuring that each user receives a data packet that meets its rules.

[0007] 3) After the DPU completes rule matching and any necessary replication, it forwards the processed data packet to the P4 data plane;

[0008] 4) The P4 data plane receives data packets from the DPU and completes data packet forwarding based on the data packets from the DPU.

[0009] However, the inventors have at least discovered that the related technical solutions are relatively costly due to the reliance on a dedicated hardware device, the DPU; moreover, the technical solution of combining a P4 programmable switch with a DPU increases the complexity of the system, which is not conducive to the development and maintenance of the system. Summary of the invention

[0010] One purpose of the present application is to provide a data processing system, method, device, medium and product for a programmable switch, at least to solve the technical problem that the solutions in the related technologies are high in cost and not conducive to the development and maintenance of the system.

[0011] To achieve the above objectives, some embodiments of the present application provide the following aspects:

[0012] In the first aspect, some embodiments of the present application also provide a data processing system for a programmable switch, the system comprising an ingress processing module and an egress processing module; the ingress processing module is used to determine the type of a data packet; the type of the data packet comprises an original data packet and a loopback data packet; if the type of the data packet is an original data packet, a copy operation is performed on the original data packet to obtain a copied data packet; a loopback header is added to the copied data packet to obtain a target data packet; the egress processing module is used to implement processing of multiple user rules based on the target data packet and the loopback data packet.

[0013] In a second aspect, some embodiments of the present application also provide a data processing method for a programmable switch, which is applied to the system as described above, and the method includes: determining the type of a data packet; the type of the data packet includes an original data packet and a loopback data packet; if the type of the data packet is an original data packet, performing a copy operation on the original data packet to obtain a copied data packet; adding a loopback header to the copied data packet to obtain a target data packet; and implementing processing of multiple user rules based on the target data packet and the loopback data packet.

[0014] In a third aspect, some embodiments of the present application further provide an electronic device, comprising: one or more processors; and a memory storing computer program instructions, wherein the computer program instructions, when executed, cause the processor to perform the steps of the method described above.

[0015] In a fourth aspect, some embodiments of the present application further provide a computer-readable medium having computer program instructions stored thereon, wherein the computer program instructions can be executed by a processor to implement the method as described above.

[0016] In a fifth aspect, some embodiments of the present application further provide a computer program product, comprising a computer program / instruction, which implements the steps of the method described above when executed by a processor.

[0017] Compared with the related art, in the scheme provided by the embodiment of the present application, the data processing system based on the programmable switch includes an inlet processing module and an outlet processing module; the inlet processing module is used to determine the type of the data packet; the type of the data packet includes an original data packet and a loopback data packet; if the type of the data packet is an original data packet, a copy operation is performed on the original data packet to obtain a copy data packet; a loopback header is added to the copy data packet to obtain a target data packet; the outlet processing module is used to implement the processing of multiple user rules according to the target data packet and the loopback data packet. In the system provided by the embodiment of the present application, by introducing a mechanism for performing a copy operation on the original data packet and adding a loopback header in a multi-user environment, it does not rely on a dedicated data processing unit DPU, but processes the data packet completely within the P4 data plane, so that the technical problem of high cost in the scheme of the related art can be solved; and because the scheme provided by the embodiment of the present application is relatively simple in design, easy to implement, and does not require complex system integration or configuration, it also helps to reduce the cost of software development and maintenance, and is conducive to reducing the difficulty of development and maintenance of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0019] Figure 1 This is an exemplary module diagram of a data processing system of a programmable switch provided according to some embodiments of the present application;

[0020] Figure 2 An exemplary flow chart of the ingress parsing module in a data processing system of a programmable switch provided according to some embodiments of the present application;

[0021] Figure 3 An exemplary schematic diagram of a state machine of an ingress parsing module in a data processing system of a programmable switch provided according to some embodiments of the present application;

[0022] Figure 4 This is an exemplary schematic diagram of the inlet control module in a data processing system of a programmable switch provided according to some embodiments of the present application;

[0023] Figure 5 An exemplary flow chart of the pre-matching control unit in a data processing system of a programmable switch provided according to some embodiments of the present application;

[0024] Figure 6An exemplary flow chart of adding user rules in a data processing system of a programmable switch provided according to some embodiments of the present application;

[0025] Figure 7 An exemplary flow chart of deleting user rules in a data processing system of a programmable switch provided according to some embodiments of the present application;

[0026] Figure 8 An exemplary flow chart of the ingress de-parsing module in a data processing system of a programmable switch provided according to some embodiments of the present application;

[0027] Fig. 9 This is an exemplary flow chart of the egress parsing module in a data processing system of a programmable switch provided according to some embodiments of the present application;

[0028] Fig.10 This is an exemplary schematic diagram of a state machine of the egress parsing module in a data processing system of a programmable switch provided according to some embodiments of the present application;

[0029] Fig.11 An exemplary flow chart of the egress control module and the egress reverse parsing module in a data processing system of a programmable switch provided according to some embodiments of the present application;

[0030] Fig.12 This is an exemplary structural diagram of an electronic device provided according to some embodiments of the present application. Specific embodiments

[0031] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0032] First embodiment

[0033] The first embodiment of the present application relates to a data processing system of a programmable switch. Figure 1 As shown, the system may include an inlet processing module and an outlet processing module:

[0034] Specifically, in some embodiments, the ingress processing module is used to determine the type of a data packet; the type of the data packet includes an original data packet and a loopback data packet; if the type of the data packet is an original data packet, a copy operation is performed on the original data packet to obtain a copy data packet; a loopback header is added to the copy data packet to obtain a target data packet;

[0035] The egress processing module is used to implement processing of multiple user rules according to the target data packet and the loopback data packet.

[0036] Exemplarily, the programmable switch may be, but is not limited to, a P4 programmable switch, and the ingress processing module may include an ingress parsing module; the ingress parsing module may specifically be an ingress parser. Figure 2 As shown, the inlet parsing module can parse the header information of the data packet entering the switch to determine the type of the data packet. Specifically, if the receiving port corresponding to the data packet is a loopback port, the type of the corresponding data packet is a loopback data packet, and the loopback header of the loopback data packet is parsed, and the Ethernet header, IP header, etc. of the loopback data packet are parsed in turn, and then input into the inlet control module; if the receiving port corresponding to the data packet is a non-loopback port, the type of the corresponding data packet is an original data packet, and the Ethernet header, IP header, etc. of the original data packet are parsed, and then input into the inlet control module. In other words, the original data packet refers to the data packet that accesses the switch from the non-loopback port, and the data packet is generally received from outside the network and has not been processed by the switch. The loopback data packet refers to the data packet that accesses the switch from the loopback port.

[0037] Exemplarily, the loopback header is a self-defined header structure. After adding the loopback header to the duplicate data packet to obtain the target data packet, rule processing of multiple users can be implemented according to the target data packet and the loopback data packet.

[0038] Optionally, in some embodiments, the ingress processing module is specifically configured to, when the type of the data packet is an original data packet, perform a copy operation on the original data packet to obtain a copy data packet if the original data packet hits multiple user rules at the same time; and determine the number of user rules that the original data packet hits at the same time, and according to the number of user rules that the original data packet hits at the same time, add a loopback header with a preset number of layers before the Ethernet header of the copy data packet to obtain a target data packet. The preset number of layers of the loopback header is related to the number of user rules that the original data packet hits at the same time.

[0039] Optionally, in some embodiments, the ingress processing module is specifically configured to perform N replication operations on the original data packet and add (N-1) layers of loopback headers to the replicated data packet when the number of user rules that the original data packet hits simultaneously is N; wherein N is an integer greater than or equal to 2. For example, if the original data packet hits 2 user rules, the original data packet is replicated 2 times, and 1 layer of loopback header is added to the obtained replicated data packet; if the original data packet hits 3 user rules, the original data packet is replicated 3 times, and 2 layers of loopback headers are added to the obtained replicated data packet; and so on.

[0040] In some application instances, the ingress processing module is specifically used to, when the type of the data packet is an original data packet, if the original data packet hits multiple user rules at the same time, perform a copy operation on the original data packet to obtain a first copy data packet; add a loopback header before the Ethernet header of the first copy data packet to obtain a first target data packet, and re-input the first target data packet into the switch; the ingress parsing module performs parsing according to the first target data packet to determine the type of the first target data packet, and when the type of the first target data packet is a loopback data packet, if the first target data packet still hits multiple user rules at the same time, perform a copy operation on the first target data packet to obtain a second copy data packet, and continue to add a loopback header to the header of the second copy data packet to obtain a second target data packet... and so on.

[0041] Exemplarily, the ingress processing module can specifically perform a copy operation on the data packet in the switch by using Mirror() extern. When using Mirror() extern, a Mirror SessionID (SID) must be provided so as to associate the data packet with, for example, a Mirror Session Table in Tofino Traffic Manager through the SID. The Mirror Session Table usually contains information about the relevant mirror session.

[0042] It is understandable that in the related art, since the technical solution of combining P4 programmable switches and DPU is basically adopted, not only hardware investment based on DPU is required; but also the technical solution of combining P4 programmable switches and DPU increases the complexity of the system and requires more complex design, integration and maintenance work. The use of DPU may require additional hardware investment, and at the same time, the development and maintenance of systems based on P4 and DPU involve higher software costs.

[0043] It is not difficult to find that in the embodiment of the present application, the data processing system based on the programmable switch includes an inlet processing module and an outlet processing module; the inlet processing module is used to determine the type of the data packet; the type of the data packet includes an original data packet and a loopback data packet; if the type of the data packet is an original data packet, a copy operation is performed on the original data packet to obtain a copy data packet; a loopback header is added to the copy data packet to obtain a target data packet; the outlet processing module is used to implement the processing of multiple user rules according to the target data packet and the loopback data packet. In the system provided by the embodiment of the present application, a mechanism for performing a copy operation on the original data packet and adding a loopback header in a multi-user environment is introduced, which does not rely on a dedicated data processing unit DPU, but processes the data packet completely within the P4 data plane, so that the technical problem of high cost in the solution of the related technology can be solved; and because the solution provided by the embodiment of the present application is relatively simple in design, easy to implement, and does not require complex system integration or configuration, it also helps to reduce the cost of software development and maintenance, and is conducive to reducing the difficulty of development and maintenance of the system.

[0044] Second embodiment

[0045] The second embodiment of the present application relates to a data processing system of a programmable switch. The second embodiment is an improvement on the first embodiment, and the specific improvement is: in the second embodiment of the present application, a specific structure field of the loopback header and the use of each structure field are provided.

[0046] Specifically, in some embodiments, the loopback header may include a first field for representing the type of the data packet, a second field for representing a user mask, and a third field for representing an innermost loopback header identifier.

[0047] For example, see Table 1 for an example of a format definition of a loopback header:

[0048] Table 1 Example of loopback header format definition

[0049]

[0050] Among them, the field with the field name of pkt_type is the first field used to characterize the type of the data packet. The first field can be an 8-bit bit field. In this way, for example, the egress parsing module in the egress processing module can identify whether the type of the data packet is an original data packet or a loopback data packet through the first field used to characterize the type of the data packet. Exemplarily, 0x1 can be used to represent an original data packet; 0x2 can be used to represent a loopback data packet.

[0051] Among them, the field named user_mask is a second field for representing a user mask. The second field can be an 8-bit bit field. The second field is used to indicate a set of user rules that the data packet can hit. That is, the user range that the data packet can hit can be determined through the second field.

[0052] Referring to Table 2, an example of a bit field of the user mask to identify different users or user combinations is provided:

[0053] Table 2 Examples of bit fields of the user mask used to identify different users or user combinations

[0054]

[0055] Specifically, each user or user combination is represented by a specific bit pattern. In this example, an 8-bit bit field is used, where each bit corresponds to a user. Each user is assigned a unique bit to identify it. 0x1 means only user 1 is hit, 0x2: means only user 2 is hit; 0x3: means both user 1 and user 2 are hit; 0x4: means only user 3 is hit; 0x5: means both user 1 and user 3 are hit; 0x6: means both user 2 and user 3 are hit; 0x7: means user 1, user 2, and user 3 are all hit.

[0056] It can be understood that since the second field in the loopback header is used to indicate which user rules the loopback data packet can hit during the loopback process, when the switch receives a data packet with a loopback header, the ingress parsing module can determine which users the data packet should be processed by based on the user mask in the loopback header. For example, when the original data packet hits the rules of user 1 and user 3 at the same time, it means that the original data packet needs to be processed by user 1 and user 3. In order to meet the needs of multi-user processing, a copy operation is performed on the original data packet, and after obtaining the copied data packet, a layer of loopback header is added before the Ethernet header of the copied data packet to obtain the target data packet. For the target data packet, the user mask in its loopback header can be set to 0x4, and the binary representation of 0x4 is 0100, where the third bit is set to 1, indicating user 3. This means that it can be ensured that the target data packet continues to hit the rules of user 3 during loopback.

[0057] For another example, when the user mask corresponding to the original data packet needs to be set to 0x7, it indicates that the original data packet is expected to hit the rules of user 1, user 2, and user 3. In this example, 0x7 is an 8-bit hexadecimal number, and its binary representation is 0111. In this representation method, all the lowest three bits are set to 1. Each bit represents a user, 1 indicates a user that is expected to hit, and 0 indicates a user that is not expected to hit. In the case of 0x7, all three lowest bits are set to 1, which is usually used to indicate that all possible users are expected to hit, which corresponds to user 1, user 2, and user 3 in this example.

[0058] In the embodiment of the present application, by using the user mask in the loopback header, the user combination can be flexibly defined and modified; by setting the bit field and bit operation, the access rights of different users can be conveniently managed and controlled. If more users are needed, the bits of the user mask can be expanded to support more user identifiers. In other words, the user mask in the loopback header controls which user rules the data packet should match during the loopback process, thereby achieving more refined user rule matching.

[0059] Among them, the field with the field name bottom is the third field used to characterize the innermost loopback header identifier. This field can be an 8-bit bit field. The third field is used to indicate whether the ingress parsing module has parsed the innermost loopback header of the loopback data packet. That is to say, through the third field, the ingress parsing module can identify when the parsing of all loopback headers of the loopback data packet is completed. When the ingress parsing module parses the innermost loopback header of the loopback data packet, the ingress parsing module starts to parse the Ethernet header again.

[0060] In some examples, the following can be used: 0x1 indicates that the current parsing is of the innermost loopback header of the loopback data packet, indicating that the parsing of all loopback headers has been completed; 0x0 indicates that the current parsing is not of the innermost loopback header of the loopback data packet, and the entry parsing module needs to continue parsing deeper loopback headers.

[0061] In the embodiment of the present application, the ingress parsing module can decide whether to continue parsing the loopback header or turn to parsing the Ethernet header according to the value of the third field. This mechanism can ensure that the data packet can be correctly identified and processed when passing through multiple layers of loopback processing, and improve the accuracy and efficiency of the ingress parsing module in processing loopback data packets until reaching the innermost layer. By using the third field, the decision-making process of the ingress parsing module can be simplified, and it can be quickly determined whether it is necessary to continue parsing the loopback header, which can reduce unnecessary parsing operations, thereby improving the performance of data packet processing.

[0062] It should be noted that the second embodiment of the present application may also be an improvement based on the first embodiment.

[0063] It should be noted that, for ease of understanding, in some embodiments of the present application, a multi-user environment specifically supporting three users is taken as an example for description.

[0064] It is not difficult to find that in the embodiment of the present application, a specific structure field of the loopback header and the purpose of each structure field are provided. By designing the loopback header in this way, it can be ensured that the data packet can be properly processed according to different user rules, so that the target data packet only matches specific user rules, and the purpose of matching the rules of multiple users based on the data packet is achieved.

[0065] Third embodiment

[0066] The third embodiment of the present application relates to a data processing system of a programmable switch. The third embodiment is an improvement on the first embodiment, and the specific improvement is that: in the third embodiment of the present application, the state machine of the ingress parsing module includes information for characterizing the parsing state of the loopback data packet.

[0067] Specifically, in the embodiment of the present application, a piece of information for characterizing the parsing state of the loopback data packet is added to the state machine of the existing ingress parsing module, that is, a new piece of information is added specifically for the identification and parsing result of the corresponding loopback data packet.

[0068] For example, Figure 3 As shown, it is an exemplary schematic diagram of a state machine of an entry parsing module provided in an embodiment of the present application. Wherein, parse_loopback is the name of the newly added information used to characterize the parsing state of the loopback data packet, indicating that the state machine is now able to process the loopback data packet. In the parse_loopback state, the state machine will perform parsing operations, such as identifying the loopback header, extracting loopback information, updating the internal state, etc. During the parsing process, the state machine may switch between different states according to the content and parsing results of the data packet, including switching from the parse_loopback state to other states. In summary, in the embodiment of the present application, by adding the parse_loopback state, the state machine of the entry parsing module is able to process loopback data packets.

[0069] Continue to see Figure 3 As shown, the embodiment of the present application exemplarily illustrates the process of the state machine of the ingress parsing module. After the process starts, it includes the process of processing the original data packet based on the non-loopback interface and the process of processing the loopback data packet based on the loopback interface.

[0070] In the process of processing the original data packet based on the non-loopback interface, parse_ethernet means parsing the Ethernet header to extract the source address and destination address of the Ethernet frame. parse_ipv4 means parsing the IPv4 header, which is performed after parsing the Ethernet header to extract the source IP address, destination IP address and other fields of the IP data packet.

[0071] In the processing flow of loopback data packets based on the loopback port, parse_loopback means parsing the loopback header to process the loopback data packet. loopback_header.bottom equals 0, which means that the bottom field at the loopback header is equal to 0, which means that the current parsing is not the innermost loopback header of the loopback data packet, and the entry parsing module needs to continue to parse the deeper loopback header. loopback_header.bottom equals 1, which means that the current parsing is the innermost loopback header of the loopback data packet, and the parsing of all loopback headers has been completed, and the Ethernet header can be further parsed.

[0072] It should be noted that the third embodiment of the present application may also be an improvement based on the second embodiment.

[0073] It is not difficult to find that in the embodiment of the present application, by adding information used to characterize the parsing status of the loopback data packet in the state machine of the ingress parsing module, it is convenient to parse the innermost loopback header of the loopback data packet.

[0074] Fourth embodiment

[0075] The fourth embodiment of the present application relates to a data processing system of a programmable switch. The fourth embodiment is an improvement on the first embodiment, and the specific improvement is: in the fourth embodiment of the present application, the inlet processing module further includes an inlet control module.

[0076] Specifically, in some embodiments, the ingress control module is connected to the ingress parsing module. Exemplarily, the ingress control module may be an ingress controller.

[0077] Optionally, in some embodiments, Figure 4As shown, the entry control module may further include a pre-match control unit (Pre-Match Controller), a match control unit (Match Controller), a post-match control unit (Post-Match Controller) and an action control unit (Action Controller). The pre-match control unit, the match control unit, the post-match control unit and the action control unit are described in detail below.

[0078] After the target data packet is re-input into the switch, the target data packet first needs to be processed by the pre-matching control unit in the ingress control module.

[0079] Optionally, in some embodiments, the pre-matching control unit is used to update the user mask of the metadata according to the data packet. The metadata is a data structure used to store temporary information during data packet processing. Relevant personnel can define the metadata of the pre-matching control unit and set the fields according to actual needs. The definition of metadata can be seen in Table 3:

[0080] Table 3 Metadata definition examples

[0081]

[0082] in:

[0083] user_mask represents a user mask, and the user mask is used to identify user rules that the data packet can match.

[0084] bottom represents the innermost loopback header identifier, which is used to indicate whether the innermost loopback header of the data packet has been parsed.

[0085] rule_id represents the rule ID, which is used to store the unique identifier of the matched rule. By setting this field, you can use it to index a specific rule or quickly find a rule.

[0086] mirror_sid represents the mirroring session ID, which is used to store the mirroring session ID associated with the data packet. By setting this field, the data packet remains associated with the original session during the loopback or replication process.

[0087] loopback_user_mask indicates the user mask of the loopback header. This needs to be distinguished from the user mask in the metadata. The user mask of the loopback header is used to indicate which users' actions have not been executed when there are multiple users actually hit.

[0088] In the above examples, the number of bits of different types of fields are 8 bits, 8 bits, 32 bits, 10 bits and 8 bits respectively. The above are only examples and the embodiments of the present application do not make specific limitations on this.

[0089] Optionally, in some embodiments, the matching control unit is used to perform a second update according to the first metadata to obtain second metadata; wherein the second update is used to indicate an update of a user mask and a rule ID of the first metadata.

[0090] Specifically, the matching control unit is another stage that follows the pre-matching control unit. As mentioned above, after the data packet is processed by the pre-matching control unit, the metadata is updated for the first time. At this time, the value of the user mask in the first metadata has been updated to the value of the user mask in the outermost loopback header, that is, the value of the user mask expected to be hit, and the matching control unit will further perform a second update on the first metadata. Specifically, the value of the user mask of the first metadata is updated to the value of the user mask of the actual hit, and the rule ID of the first metadata is updated to the rule ID of the user that is actually hit.

[0091] Optionally, in some embodiments, the post-matching control unit is used to perform a third update according to the second metadata to obtain third metadata; wherein the third update is used to indicate an update to a user mask of a loopback header of the second metadata.

[0092] Specifically, after the processing by the matching control unit, it is possible to determine which users the data packet actually hits based on the second metadata. Although the data packet may match multiple user rules, in one processing process, the data packet can only execute one user-defined action. Therefore, the post-matching control unit can determine which user's action the data packet should currently execute, and update the user mask of the loopback header of the second metadata so that the data packet can continue to execute the actions of other users after being looped back. In this way, multiple processing of the data packet can be achieved until all relevant user actions are executed. Simply put, in an embodiment of the present application, by updating the user mask of the loopback header of the third metadata by the post-matching control unit, it can be ensured that the data packet can continue to execute the actions of the remaining users when it is processed next time.

[0093] Furthermore, after the above operations are completed, the target data packet will enter the action control unit. The action control unit is used to process the target data packet according to the third metadata.

[0094] It should be noted that the fourth embodiment of the present application may also be an improvement based on the second embodiment and / or the third embodiment.

[0095] It is not difficult to find that in the embodiment of the present application, the entry processing module also includes an entry control module; the entry control module includes a pre-matching control unit, a matching control unit, a post-matching control unit and an action control unit; the pre-matching control unit is used to perform a first update on the metadata according to the loopback header of the data packet to obtain the first metadata; wherein the first update is used to indicate the update of the user mask and the innermost loopback header identifier of the metadata; the matching control unit is used to perform a second update according to the first metadata to obtain the second metadata; wherein the second update is used to indicate the update of the user mask and the rule ID of the first metadata; the post-matching control unit is used to perform a third update according to the second metadata to obtain the third metadata; wherein the third update is used to indicate the update of the user mask of the loopback header of the second metadata; the action control unit is used to process the target data packet according to the third metadata. Through the above processing of the entry control module, the conditions for the entry processing module to process different types of data packets and how to perform a copy operation on the original data packet and add a loopback header in a multi-user environment are provided.

[0096] Fifth embodiment

[0097] The fifth embodiment of the present application relates to a data processing system of a programmable switch. The fifth embodiment is an improvement on the fourth embodiment, and the specific improvement is: in the fifth embodiment of the present application, a specific implementation scheme for the pre-matching control unit is provided.

[0098] Specifically, in some embodiments, the pre-matching control unit includes a checking subunit and a first updating subunit;

[0099] The checking subunit is used to check whether the data packet contains the outermost loopback header;

[0100] The first update subunit is used to update the value of the user mask in the metadata to the value of the user mask in the outermost loopback header when the data packet contains the outermost loopback header, and update the innermost loopback header identification field of the metadata to a first value to obtain the first metadata; when the data packet does not contain the outermost loopback header, update the value of the user mask in the metadata to a default value, and update the innermost loopback header identification field of the metadata to a second value to obtain the first metadata.

[0101] Exemplary, combined Figure 5 As shown, the processing flow based on the pre-matching control unit may include the following steps:

[0102] Checking whether the data packet contains an outermost loopback header;

[0103] If the data packet contains the outermost loopback header, the value of the user mask in the metadata is updated to the value of the user mask in the outermost loopback header, so that the value of the user mask in the metadata is set to the expected hit user mask; and the innermost loopback header identification field (bottom) of the metadata is set to the first value. For example, the first value can be 0x0; 0x0 indicates that the current is not the innermost loopback header of the data packet.

[0104] If the data packet does not contain the outermost loopback header, the value of the user mask of the metadata is updated to the default value, and the innermost loopback header identification field (bottom) of the metadata is set to the second value, such as 0x1; 0x1 means that the innermost loopback header of the data packet is currently parsed and no further loopback processing is required. For example, the default value may be 0x7; 0x7 means that all users or user groups are applicable by default.

[0105] It should be noted that if the data packet has only one loopback header, it means that this loopback header is both the innermost and outermost header. In this case, the pre-matching control unit can directly update the metadata according to the information of this loopback header. However, the value of the innermost loopback header identification field (bottom) of the metadata cannot be 0x0 because it is the only layer.

[0106] It should be noted that the fifth embodiment of the present application may also be an improvement based on any one or more embodiments of the first to third embodiments.

[0107] It is not difficult to find that in the embodiment of the present application, a process is disclosed on how the pre-matching control unit updates the metadata according to the loopback header of the data packet in the environment of P4 language programming. Specifically, the pre-matching control unit updates the user mask of the metadata according to the loopback header of the data packet. If the data packet contains the outermost loopback header, the value of the user mask in the metadata will be updated to the value of the user mask in the outermost loopback header, and the innermost loopback header identification field of the metadata will be updated to the first value; if the data packet does not contain the outermost loopback header, the value of the user mask in the metadata will be set to the default value, and the innermost loopback header identification field of the metadata will be updated to the second value.

[0108] Sixth embodiment

[0109] The sixth embodiment of the present application relates to a data processing system of a programmable switch. The sixth embodiment is an improvement on the fourth embodiment, and the specific improvement is: in the sixth embodiment of the present application, a specific implementation scheme for the matching control unit is provided.

[0110] Specifically, in some embodiments, the matching control unit includes a determination subunit, a calculation subunit, and a second update subunit;

[0111] The determining subunit is configured to perform field matching between the first metadata and a matching table to determine whether a value of the user mask of the first metadata matches the matching table;

[0112] The calculation subunit is configured to perform a logical AND operation on the value of the user mask of the first metadata and the value of the user mask in the matching table to obtain the value of the user mask that actually hits when the value of the user mask of the first metadata hits the matching table;

[0113] The second updating subunit is used to update the value of the user mask of the first metadata to the value of the actual hit user mask, and update the rule ID of the first metadata to the rule ID of the actual hit according to the value of the actual hit user mask to obtain second metadata.

[0114] Exemplary, combined Figure 5As shown, the determination subunit can perform field matching between the data packet and the table items in the matching table MatchTable. When the data packet hits the table items in the matching table MatchTable, the value of the user mask of the first metadata and the value of the user mask of the table items in the matching table MatchTable perform a logical AND operation to obtain the value of the user mask that actually hits. Then, the user mask of the first metadata is updated to the user mask that actually hits, and according to the user mask that actually hits, the rule ID of the first metadata is updated to the rule ID that actually hits. Wherein, the matching table MatchTable is a data structure containing multiple table items, each of which defines a specific matching condition and a corresponding action. When the field of the data packet matches the key of a table item in the matching table MatchTable, it is considered that the data packet hits the table item. When the data packet hits the table item in the matching table MatchTable, the value of the user mask of the first metadata and the value of the user mask of the table item in the matching table MatchTable perform a logical AND operation. Through the logical AND operation, it can be determined whether the data packet completely meets all the conditions defined in the table item. If the value of the user mask of the data packet completely matches the value of the user mask of the entry in the matching table MatchTable, the second updating subunit performs a corresponding updating operation.

[0115] Exemplarily, when the data packet hits the entry of the match table Match Table, the value of the user mask user_mask of the first metadata is logically ANDed with the value of the user mask user_mask of the entry in the match table to obtain the value of the user mask that actually hits, that is, the user or user group that the data packet should actually match. For example, if the value of the user mask user_mask of the first metadata is 0x7 (indicating all users), and the value of the user mask user_mask of the entry in the match table is 0x5 (indicating user 1 and user 3), the result of the logical AND operation is 0x5, which is the value of the user mask that actually hits. After determining the value of the user mask that actually hits, the second update subunit will also update the rule ID rule_id of the first metadata to the rule ID specified by the entry in the match table MatchTable, that is, update the rule ID of the first metadata to the rule ID that actually hits.

[0116] For ease of understanding, the embodiment of the present application also provides a specific application example. Here, taking the processing of a data packet with a destination IP address of 192.168.1.1 and updating the user mask and rule ID of the first metadata as an example, the processing flow of the matching control unit is described:

[0117] As shown in Table 4, it is assumed that the matching table Match Table of the matching control unit includes the following table items:

[0118] Table 4 Example of entries included in the Match Table of the Match Control Unit

[0119]

[0120] Example 1: Assume that the type of the data packet is an original data packet, the destination IP address of the original data packet is 192.168.1.1, and the destination IP address matches entry 1 in the match table Match Table. The value of the user mask of the first metadata is 0x7. In binary, 0x7 represents 0111, which indicates that the original data packet is expected to hit user 1, user 2, and user 3. Entry 1 of the match table Match Table has a user mask of 0x5. In binary, 0x5 represents 0101, which indicates that the rule of this entry is only associated with user 1 and user 3. In order to determine the value of the user mask that is actually hit, a logical AND operation is performed based on the value of the user mask of the first metadata and the value of the user mask of entry 1, that is, 0x7 AND 0x5, and the result is 0x5 (binary 0101). According to the result of the logical AND operation, the value of the user mask of the first metadata is updated to 0x5, which reflects that the original data packet actually only hits the rules of user 1 and user 3. Since the rule ID of table item 1 is 0x1, the rule ID of the first metadata is updated to 0x1, so that the corresponding steps can be performed later according to 0x1. It can be seen that the accuracy of the processing of the original data packet can be ensured through this process, even if the original data packet may be related to multiple users, it will only be processed based on the actual hit rule.

[0121] Example 2: Assume that the type of the data packet is a loopback data packet, the destination IP address of the loopback data packet is 192.168.1.2, and the destination IP address matches the table entry 2 in the match table Match Table. The value of the user mask of the first metadata is 0x2. In binary, 0x2 represents 0010, which indicates that the loopback data packet expects to hit user 2. Table entry 2 of the match table Match Table has a user mask 0x2. In binary, 0x2 represents 0010, which indicates that the rule of the table entry is only associated with user 2. In order to determine the value of the user mask that is actually hit, a logical AND operation is performed based on the value of the user mask of the first metadata and the value of the user mask of table entry 1, that is, 0x2 AND 0x2, and the result is 0x2 (binary 0010). According to the result of the logical AND operation, the value of the user mask of the first metadata may not be updated (because the values ​​of the user mask before and after the update are the same, both 0x2). Since the rule ID of table entry 2 is 0x2, the rule ID of the first metadata is updated to 0x2, so that the corresponding steps can be performed according to 0x2 later. It can be seen that the accuracy of processing the loopback data packet can be ensured through this process. Even if the loopback data packet may be related to multiple users, it will ultimately be processed only based on the rules that are actually hit.

[0122] It should be noted that the sixth embodiment of the present application may also be an improvement based on any one or more of the first to third embodiments and the fifth embodiment.

[0123] It is not difficult to find that in the embodiment of the present application, a specific implementation scheme for the matching control unit is provided, which discloses a data processing process of updating metadata through the collaborative work of the pre-matching control unit and the matching control unit in the data packet processing flow of the P4 language programming environment.

[0124] Seventh embodiment

[0125] The seventh embodiment of the present application relates to a data processing system of a programmable switch. The seventh embodiment is an improvement on the fourth embodiment, and the specific improvement is: in the seventh embodiment of the present application, a specific implementation scheme for the post-matching control unit is provided.

[0126] Specifically, in some embodiments, the post-matching control unit includes a comparison subunit, a judgment subunit, and a third update subunit;

[0127] The comparison subunit is used to perform field matching between the second metadata and the post-matching table to determine whether the value of the user mask of the second metadata hits the post-matching table;

[0128] The judging subunit is configured to judge, when the value of the user mask of the second metadata hits the post-matching table, whether the hit result belongs to a single user rule or multiple user rules;

[0129] The third updating subunit is used to update the value of the user mask in the second metadata according to the post-matching table to obtain the third metadata when the hit result belongs to a single user rule; and to update the value of the user mask in the second metadata and the user mask of the loopback header of the second metadata according to the post-matching table to obtain the third metadata when the hit result belongs to multiple user rules.

[0130] The post-matching table is a matching table maintained by the post-matching control unit, and the table entries of the post-matching table are static built-in table entries, which do not need to be maintained by the P4 control plane.

[0131] For ease of understanding, a post-match table Post-Match Table is provided as shown in Table 5 for exemplary explanation:

[0132] Table 5 Post-Match Table Example

[0133]

[0134] Specifically, combined with Figure 5 As shown, table items 1, 2, and 3 correspond to the case where the data packet hits a single user rule. Specifically, when the value of the user mask user_mask in the second metadata of the data packet matches the Key of table items 1, 2, and 3, it is considered that a single user rule is hit. At this time, the value of the user mask user_mask in the second metadata is updated to the value of the action_user_mask of the table item in the post-match table Post-Match Table to obtain the third metadata. At this time, there is no need to perform a copy operation on the data packet, which also means that there is no need to perform a loopback operation on the data packet later.

[0135] Specifically, combined with Figure 5As shown, table items 4 and 5 correspond to the situation where the data packet hits multiple user rules. When the value of the user mask user_mask in the second metadata of the data packet matches the Key of table items 4 and 5, it is considered that multiple user rules are hit at the same time. At this time, the value of the user mask user_mask in the second metadata is updated to the value of the action_user_mask of the table item, and the value of the user mask loopback_user_mask of the loopback header of the second metadata is updated to the value of the loopback_user_mask of the table item in the post-match table Post-Match Table to obtain the third metadata. In this way, by updating the value of the user mask loopback_user_mask of the loopback header of the second metadata. In this way, the ingress processing module can encapsulate the loopback header of the copied data packet according to the value of loopback_user_mask in the third metadata, obtain the target data packet, and copy or loop back based on the target data packet, so as to execute the actions of other users in subsequent processing.

[0136] Specifically, when the data packet hits multiple user rules, the entry in the post-match table Post-Match Table indicates multi_user_hit, indicating that loopback processing is required. In this case, the value of mirror_sid in the third metadata can be set as a target value, for example, the target value can be 0x1b. Exemplarily, the target value is pre-configured in Tofino Traffic Manager, and the target value is used to point to a specific processing flow or port.

[0137] In some application examples, port 68 of the Tofino P4 switch is the default loopback port. The P4 control plane can add the following table entry to the Mirror Session Table of the Tofino Traffic Manager, as shown in Table 6:

[0138] Table 6 Examples of entries that can be added to the P4 control plane

[0139]

[0140] Specifically, the above means that when the mirror_sid field in the data packet matches the key 0x1b in the table entry, a mirror operation needs to be performed, and a duplicate data packet is obtained after the mirror operation. The egress port numbered 68 is sent based on the duplicate data packet.

[0141] It should be noted that the sixth embodiment of the present application may also be an improvement based on any one or more of the first to third embodiments, the fifth embodiment, and the sixth embodiment.

[0142] It is not difficult to find that in the embodiment of the present application, a specific implementation scheme for the post-matching control unit is provided. Through the post-matching control unit, the situation where the data packet hits a single user rule and multiple user rules can be flexibly handled, and the data packet can be correctly processed and looped back according to the hit rule.

[0143] Eighth embodiment

[0144] The eighth embodiment of the present application relates to a data processing system of a programmable switch. The eighth embodiment is an improvement based on the fourth embodiment, and the specific improvement is: in the eighth embodiment of the present application, a specific implementation scheme for the action control unit is provided.

[0145] Optionally, in some embodiments, the matching table is associated with an action table in the action control unit; wherein the action table is used to indicate an action that should be executed when the data packet hits the matching table.

[0146] Specifically, like the Match Table, the Action Table of the action control unit is also maintained by the P4 control plane. The Match Table is associated with the Action Table through the rule ID. When the Match Table is as shown in Table 4, the Action Table should be as shown in Table 7:

[0147] Table 7 Action Table Example

[0148]

[0149] In practical applications, the rule ID rule_id and the user mask user_mask in the third metadata are used as keys to match the entries in the action table Action Table. Once the match is successful, the data packet is processed according to the Action Data in the action table ActionTable.

[0150] It should be noted that the P4 control plane is responsible for maintaining the table entries of the ingress processing module, wherein the table entries of the ingress processing module include a match table Match Table and an action table Action Table. The following three examples are provided to illustrate the maintenance of the match table Match Table and the action table Action Table by the P4 control plane:

[0151] Example 1: Assume that user 1 defines a rule that requires all packets with a destination IP address of 192.168.1.1 to be forwarded to port 1 of the switch. The P4 control plane uses the destination IP address 192.168.1.1 as the Key to query the Match Table. If the query result is empty, it means that there is no entry associated with the destination IP address in the Match Table. The P4 control plane then adds a new entry: Key=192.168.1.1, user_mask=0x1, rule_id=0x1. This means that the Key is set to 192.168.1.1, the user_mask is set to 0x1 (indicating user 1), and the rule_id is set to 0x1. Synchronously with the update of the Match Table, the P4 control plane adds a new entry to the action table ActionTable of the action control unit: rule_id=0x1, user_mask=0x1, dst_port=0x1. The rule_id of this entry is set to 0x1, which corresponds to the new entry in the Match Table. The user_mask is also set to 0x1, indicating that this action rule applies to user 1. The dst_port is set to 0x1, which specifies the port number to which the packet should be forwarded. The rule_id in the Match Table is associated with the rule_id in the Action Table, ensuring that when a packet matches a rule in the MatchTable, the corresponding action in the Action Table can be executed.

[0152] Example 2: Assume that user 3 defines a rule that requires that all packets with a destination IP address of 192.168.1.1 should be forwarded to port 3 of the switch. The P4 control plane uses the destination IP address 192.168.1.1 as the key to query the match table Match Table. If the query result is not empty, it means that an entry matching the destination IP address 192.168.1.1 is found in the match table Match Table. Assume that the user mask of the metadata is 0x1, and the user mask set by user 3 is 0x4. The logical AND operation between the user mask 0x1 of the metadata and the user mask 0x4 set by user 3 is 0x5. Therefore, the user_mask of the entry is modified to 0x5, indicating that this rule is now associated with user 1 and user 3. At the same time, the P4 control plane adds a new entry in the Action Table of the Action Controller: rule_id=1, user_mask=0x4, dst_port=3, indicating that the rule_id of this entry is set to 0x1, and the user_mask is set to 0x4, indicating that this action rule is set by user 3. dst_port is the destination port, which is set to 3, which is consistent with the rule set by user 3.

[0153] Example 3: Assume that user 2 defines a rule that requires that all packets with a destination IP address of 192.168.1.2 should be forwarded to port 2 of the switch. The P4 control plane uses the destination IP address 192.168.1.2 as the key to query the match table. If the query result is empty, it means that there is no entry associated with the destination IP address in the Match Table. The P4 control plane then adds a new entry: Key=192.168.1.2, user_mask=0x2, rule_id=2, which means that the key is set to 192.168.1.2, the user_mask is set to 0x2, indicating that this action rule applies to user 2, and the rule_id is set to 0x1. In synchronization with the update of the Match Table, the P4 control plane adds a new entry in the Action Table of the action control unit: rule_id=2, user_mask=0x2, dst_port=2, indicating that the rule_id of this entry is set to 2, corresponding to the new entry in the Match Table. The user_mask is also set to 0x2, indicating that this action rule applies to user 2. The dst_port is set to 0x2, specifying the port number 2 to which the data packet should be forwarded.

[0154] For example, see Figure 6As shown in FIG. 1 , it is an exemplary flow chart for adding user rules. According to the exemplary flow chart, when a user adds a new network rule, the system can correctly update the match table Match Table and the action table Action Table.

[0155] Specifically, if an entry with the same key already exists in the Match Table, the system updates the user mask of the entry instead of creating a new one. This avoids duplicate rules and ensures that the user mask correctly reflects all relevant users. Whenever the Match Table is updated, the Action Table also needs to be updated accordingly to ensure that the actions are correctly associated with the rules. In this way, the user mask can be updated through a logical OR operation to ensure that new users are added to the rules without affecting the matching of existing users.

[0156] For example, see Figure 7 As shown in FIG. 1 , it is an exemplary flow chart for deleting user rules. According to the exemplary flow chart, when a user deletes a network rule, the system can correctly update the match table Match Table and the action table ActionTable.

[0157] Specifically, the user mask is negated and then logically ANDed with the user mask of the existing entry. This is a way to check whether the user mask is completely matched. If the result is 0, it means that no user needs to match the rule, so the entry in the match table can be safely deleted. After that, the corresponding entry in the action table needs to be deleted synchronously to ensure that the action is correctly disassociated from the rule.

[0158] It should be noted that the seventh embodiment of the present application may also be an improvement based on any one or more of the first to third embodiments and the fifth to seventh embodiments.

[0159] It is not difficult to find that in the embodiment of the present application, a specific implementation scheme for the action control unit is provided. Through the implementation scheme, the P4 control plane can dynamically maintain the match table Match Table and the action table ActionTable. It can be seen that a method for multi-user sharing of table space is proposed here, allowing multiple users to share the table space, which can effectively improve the use efficiency of the table space and increase the number of user rules that can be stored.

[0160] Ninth embodiment

[0161] The ninth embodiment of the present application relates to a data processing system of a programmable switch. The ninth embodiment is an improvement based on the fourth embodiment, and the specific improvement is: in the ninth embodiment of the present application, a specific implementation scheme for the inlet anti-parsing module is provided.

[0162] Optionally, in some embodiments, the entry de-parsing module is used to perform a copy operation on the original data packet when the type of the data packet is an original data packet, and encapsulate the loopback header of the copied data packet according to the third metadata to obtain the target data packet.

[0163] Specifically, see Figure 8 As shown, the inlet processing module may further include an inlet de-analysis module. The inlet de-analysis module is connected to the inlet control module.

[0164] Exemplarily, the entry de-parsing module can use Mirror() extern to perform a copy operation on the original data packet to obtain the copied data packet, and encapsulate the loopback header of the copied data packet according to the user mask of the loopback header in the third metadata to add a loopback header to the copied data packet.

[0165] For example, the values ​​of the relevant fields are as follows:

[0166] pkt_type is equal to 0x2;

[0167] user_mask is equal to metadata loopback_user_mask;

[0168] bottom is equal to the metadata bottom.

[0169] Wherein, pkt_type equal to 0x2 indicates that a loopback header is added to the copied data packet, and the obtained target data packet is a loopback data packet. user_mask equals the third metadata loopback_user_mask, indicating which user actions the loopback data packet should continue to execute; bottom equals the metadata bottom, used to indicate the level of the loopback data packet.

[0170] Optionally, in some embodiments, the ingress de-parsing module is further configured to add a bridge header before the Ethernet header of the original data packet when the data packet is an original data packet. The definition of the bridge header is shown in Table 8:

[0171] Table 8 Definition example of the bridge header

[0172]

[0173] The bridge header defines a pkt_type field with a value of 0x1, which facilitates the egress parsing module to distinguish between loopback data packets and original data packets.

[0174] It should be noted that the ninth embodiment of the present application may also be an improvement based on any one or more of the first to third embodiments and the fifth to eighth embodiments.

[0175] It is not difficult to find that in the embodiment of the present application, a specific implementation scheme for the entry de-parsing module is provided. When the type of the data packet is an original data packet, the entry de-parsing module performs a copy operation on the original data packet, and encapsulates the loopback header of the copied data packet according to the third metadata to obtain the target data packet. In the embodiment of the present application, a method for on-demand copying according to the type of data packet is proposed, and the data packet is copied only when necessary, which can minimize the performance overhead caused by the copy operation.

[0176] Tenth embodiment

[0177] The tenth embodiment of the present application relates to a data processing system of a programmable switch. The tenth embodiment is an improvement on the first embodiment, and the specific improvement is: in the tenth embodiment of the present application, a specific implementation scheme for the egress processing module is provided.

[0178] Specifically, in some embodiments, in combination Figure 1 As shown, the export processing module may include an export parsing module, an export control module and an export reverse parsing module.

[0179] Specifically, see Fig. 9 As shown, the egress parsing module is connected to the ingress de-parsing module, and is used to distinguish the loopback data packet from the target data packet (original data packet) according to the pkt_type field. Fig.10 , which is an exemplary schematic diagram of a state machine based on the export parsing module.

[0180] Among them, the export parsing module mainly determines the type of data packet through parse_pkt_type; when pkt_type is equal to 0x1, it means that the current data packet belongs to the original data packet. After the bridge header is parsed by parse_bridge, the Ethernet header is parsed according to parse_ethernet, and then the IPv4 header is parsed by parse_ipv4; when pkt_type is equal to 0x2, it means that the current data packet belongs to a loopback data packet, and the loopback header of the loopback data packet is parsed by parse_loopback. If loopback_header.bottom is equal to 0, it means that the current layer is not the innermost layer, and the loopback data packet needs to be parsed; if loopback_header.bottom is equal to 1, the Ethernet header is parsed according to parse_ethernet, and then the IPv4 header is parsed by parse_ipv4.

[0181] Among them, combined Fig.11 As shown, it should be noted that the control logic of the export control module in the embodiment of the present application is roughly the same as that of the original export control module, and the export control module will not be described in detail here.

[0182] Optionally, in some embodiments, the egress reverse parsing module is used to sequentially send a loopback header, an Ethernet header, an IP header, etc. It is worth noting that the data packets sent by the egress reverse parsing module are of two types: original data packets and loopback data packets. Among them, only the loopback header of the loopback data packet is legal and can be sent normally. Since the loopback header of the original data packet is illegal, it will not actually be sent out.

[0183] It should be noted that the tenth embodiment of the present application may also be an improvement based on any one or more embodiments from the first embodiment to the ninth embodiment.

[0184] It is not difficult to find that in the embodiment of the present application, a specific implementation scheme of the export processing module is provided.

[0185] It is worth mentioning that all modules involved in this embodiment are logic modules. In practical applications, a logic unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. In addition, in order to highlight the innovative part of this application, this embodiment does not introduce units that are not closely related to solving the technical problems proposed by this application, but this does not mean that there are no other units in this embodiment.

[0186] Eleventh Embodiment

[0187] The second embodiment of the present application relates to a data processing method for a programmable switch. The method is applied to the system as described in any one or more of the first to tenth embodiments, and the method includes:

[0188] Step S101, determining the type of a data packet; the type of the data packet includes an original data packet and a loopback data packet; if the type of the data packet is an original data packet, performing a copy operation on the original data packet to obtain a copy data packet; adding a loopback header to the copy data packet to obtain a target data packet;

[0189] Step S102, implementing the processing of multiple user rules according to the target data packet and the loopback data packet

[0190] It is not difficult to find that this embodiment is a method embodiment corresponding to the first embodiment, and this embodiment can be implemented in conjunction with the first embodiment. The relevant technical details mentioned in the first embodiment are still valid in this embodiment, and in order to reduce repetition, they are not repeated here. Accordingly, the relevant technical details mentioned in this embodiment can also be applied in the first embodiment.

[0191] The step division of the above methods is only for the purpose of clear description. When implemented, they can be combined into one step or some steps can be split and decomposed into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this patent; adding insignificant modifications to the algorithm or process or introducing insignificant designs without changing the core design of the algorithm and process are all within the scope of protection of this patent.

[0192] In addition, some embodiments of the present application also provide an electronic device. The electronic device may be a digital computer in various forms, such as a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, etc. The electronic device may also be a mobile device in various forms, such as a personal digital processing, a cellular phone, a smart phone, a wearable device, and other similar computing devices.

[0193] The electronic device includes: one or more processors; and a memory storing computer program instructions, wherein when the computer program instructions are executed, the processor executes the steps of the method provided in any one or more of the above embodiments. Fig.12 An exemplary structural diagram of the electronic device is disclosed. Fig.12As shown, the electronic device includes: one or more processors 1101, a memory 1102, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses and can be installed on a common motherboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some other embodiments, if necessary, multiple processors and / or multiple buses can be used with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Among them, the components shown in this article, their connections and relationships, and their functions are only examples, and are not intended to limit the implementation of the present application described and / or required herein.

[0194] The electronic device may further include: an input device 1103 and an output device 1104. The processor 1101, the memory 1102, the input device 1103 and the output device 1104 may be connected via a bus or other means. Fig.12 The example of connecting through bus is taken in the following.

[0195] The input device 1103 can receive input digital or character information, and generate key signal input related to the user settings and function control of the electronic device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator rod, one or more mouse buttons, a trackball, a joystick and other input devices. The output device 1104 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display and a plasma display. In some embodiments, the display device may be a touch screen.

[0196] To provide interaction with a user, the electronic device may be a computer. The computer has: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball), through which the user can provide input to the computer. Other types of devices may also be used to provide interaction with a user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0197] In the embodiments of the present application, a computer program / instruction is stored on a computer-readable medium, and when the computer program / instruction is executed by a processor, the steps of the method provided by any one or more of the above embodiments are implemented. The computer-readable medium may be included in the electronic device described in the above embodiments; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more computer-readable instructions.

[0198] The memory 1102 can be used as a non-transient computer-readable storage medium, which can be used to store non-transient software programs, non-transient computer executable programs and modules. The processor 1101 executes various functional applications and data processing of the server by running the non-transient software programs, instructions and modules stored in the memory 1102, so as to implement the program instructions / modules corresponding to the method provided by any one or more embodiments in the embodiments of the present application.

[0199] The memory 1102 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 1102 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 1102 may optionally include a memory remotely arranged relative to the processor 1101, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0200] It should be noted that the computer-readable medium described in this application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this application, a computer-readable medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device.

[0201] Computer readable media include permanent and non-permanent, removable and non-removable media, and can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, modules of programs or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device.

[0202] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0203] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. For example, an application specific integrated circuit (ASIC), a general-purpose computer or any other similar hardware device may be used to implement the embodiments. In some embodiments, the software program of the present application may be executed by a processor to implement the above steps or functions. Similarly, the software program of the present application (including related data structures) may be stored in a computer-readable recording medium, such as a RAM memory, a magnetic or optical drive or a floppy disk and the like. In addition, some steps or functions of the present application may be implemented by hardware, for example, as a circuit that cooperates with a processor to perform various steps or functions.

[0204] The computer program product provided in the embodiment of the present application includes one or more computer programs / instructions, which, when executed by the processor, generate in whole or in part the process or function described in the embodiment of the present application. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a server, or a data center to another website site, a computer, a server, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.

[0205] The flow chart or block diagram in the accompanying drawings shows the possible architecture, function and operation of the equipment, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated system for hardware that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0206] The scope of the present application is defined by the appended claims rather than the above description, and it is intended that all changes that fall within the meaning and scope of the equivalent elements of the claims are included in the present application. Any figure mark in the claims should not be regarded as limiting the claims involved. In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the device claim may also be implemented by one unit or device through software or hardware. The words "first", "second", etc. are only used to distinguish the description, and do not indicate any particular order, nor can they be understood as indicating or implying relative importance.

[0207] The above is only a specific embodiment of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily mention changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims, and the above embodiments should be regarded as exemplary and non-restrictive.

Claims

1. A data processing system for a programmable switch, characterized in that: The system includes an inlet processing module and an outlet processing module; The ingress processing module is used to determine the type of the data packet; the type of the data packet includes an original data packet and a loopback data packet; if the type of the data packet is an original data packet, a copy operation is performed on the original data packet to obtain a copy data packet; Adding a loopback header to the duplicate data packet to obtain a target data packet; The loopback header includes: a first field for representing the type of the data packet, a second field for representing the user mask, and a third field for representing the innermost loopback header identifier; The egress processing module is used to implement the processing of multiple user rules according to the target data packet and the loopback data packet; The entry processing module also includes an entry control module; the entry control module includes a pre-matching control unit, a matching control unit, a post-matching control unit and an action control unit; The pre-matching control unit is used to perform a first update on the metadata according to the loopback header of the data packet to obtain first metadata; wherein the first update is used to indicate that a user mask and an innermost loopback header identifier of the metadata are updated; The matching control unit is used to perform a second update according to the first metadata to obtain second metadata; wherein the second update is used to indicate an update of a user mask and a rule ID of the first metadata; The post-matching control unit is used to perform a third update according to the second metadata to obtain third metadata; wherein the third update is used to indicate that a user mask of a loopback header of the second metadata is updated; The action control unit is used to process the target data packet according to the third metadata.

2. The system according to claim 1, characterized in that The adding of a loopback header to the copied data packet to obtain a target data packet is specifically: adding a preset number of layers of loopback headers to the copied data packet to obtain a target data packet; wherein the preset number of layers of the loopback header is related to the number of user rules simultaneously hit by the original data packet.

3. The system according to claim 1, characterized in that The ingress processing module includes an ingress parsing module; the ingress parsing module is used to parse the data packet; wherein, the state machine of the ingress parsing module includes information for characterizing the parsing state of the loopback data packet.

4. The system according to claim 1, characterized in that The pre-matching control unit includes a checking subunit and a first updating subunit; The checking subunit is used to check whether the data packet contains the outermost loopback header; The first update subunit is used to update the value of the user mask in the metadata to the value of the user mask in the outermost loopback header when the data packet contains the outermost loopback header, and update the innermost loopback header identification field of the metadata to a first value to obtain the first metadata; when the data packet does not contain the outermost loopback header, update the value of the user mask in the metadata to a default value, and update the innermost loopback header identification field of the metadata to a second value to obtain the first metadata.

5. The system according to claim 1, characterized in that The matching control unit includes a determination subunit, a calculation subunit and a second update subunit; The determining subunit is configured to perform field matching between the first metadata and a matching table to determine whether a value of the user mask of the first metadata matches the matching table; The calculation subunit is configured to perform a logical AND operation on the value of the user mask of the first metadata and the value of the user mask in the matching table to obtain the value of the user mask that actually hits when the value of the user mask of the first metadata hits the matching table; The second updating subunit is used to update the value of the user mask of the first metadata to the value of the actual hit user mask, and update the rule ID of the first metadata to the rule ID of the actual hit according to the value of the actual hit user mask to obtain second metadata.

6. The system according to claim 1, characterized in that The post-matching control unit includes a comparison subunit, a judgment subunit and a third updating subunit; The comparison subunit is used to perform field matching between the second metadata and the post-matching table to determine whether the value of the user mask of the second metadata hits the post-matching table; The judging subunit is configured to judge, when the value of the user mask of the second metadata hits the post-matching table, whether the hit result belongs to a single user rule or multiple user rules; The third updating subunit is used to update the value of the user mask in the second metadata according to the post-matching table to obtain the third metadata when the hit result belongs to a single user rule; and to update the value of the user mask in the second metadata and the user mask of the loopback header of the second metadata according to the post-matching table to obtain the third metadata when the hit result belongs to multiple user rules.

7. The system according to claim 1, characterized in that The inlet processing module also includes an inlet anti-parsing module; The ingress de-parsing module is used to perform a copy operation on the original data packet when the type of the data packet is an original data packet, and encapsulate the loopback header of the copied data packet according to the third metadata to obtain a target data packet.

8. The system according to claim 7, characterized in that The ingress de-parsing module is further configured to add a bridge header before the Ethernet header of the original data packet when the data packet is an original data packet.

9. The system according to claim 5, characterized in that The matching table is associated with an action table in the action control unit; wherein the action table is used to indicate an action to be executed when the data packet hits the matching table.

10. A data processing method for a programmable switch, characterized in that: The method is applied to the system according to any one of claims 1 to 9, and the method comprises: Determine the type of the data packet; the type of the data packet includes an original data packet and a loopback data packet; if the type of the data packet is an original data packet, perform a copy operation on the original data packet to obtain a copy data packet; add a loopback header to the copy data packet to obtain a target data packet; Processing of multiple user rules is implemented according to the target data packet and the loopback data packet.

11. An electronic device, characterized in that: The electronic device comprises: one or more processors; and A memory storing computer program instructions which, when executed, cause the processor to perform the steps of the method of claim 10.

12. A computer readable medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed by a processor, the steps of the method according to claim 10 are implemented.

13. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the method according to claim 10 are implemented.