Network device with programmable action processing
By using matching action circuits to share architecture registers with the instruction processor in network equipment, directly executing and processing programmable actions, the problems of insufficient flexibility and low execution efficiency in the prior art are solved, and efficient action processing and performance improvement are achieved .
Patent Information
- Application Number
- CN202410633265.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-05-22
- Filing Date
- 2024-05-21
- Publication Date
- 2024-11-22
AI Technical Summary
There is insufficient flexibility in matching action processing in existing network devices, making it difficult to achieve efficient programmable action execution, and frequently interact with the memory during the action execution, resulting in a large die area and a long execution time.
The matching action circuit is used to share the architecture register with the instruction processor, and programmable actions are directly executed by writing execution information, and update status information is read after completion, reducing storage and loading operations, and improving the execution efficiency of the processor.
It realizes efficient programmable action execution, reduces action execution time and die area, and improves processor flexibility and performance.
Smart Images

Figure CN119011387A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates generally to network devices, and more particularly to methods and systems for match action processing in network devices. Background Art
[0002] Match-action processing is a common building block used in network devices. Match-action operations typically attempt to match packet attributes to a set of rules and, upon finding a match, select an action to apply to the packet. Actions can include dropping the packet, allowing the packet to proceed, forwarding the packet to a specified port, mirroring the packet, modifying the packet, and a variety of other actions. Summary of the invention
[0003] Embodiments of the present invention described herein provide a network device, which includes one or more ports, a matching action circuit and an action processor. One or more ports are used to exchange packets between the network device and the network. The matching action circuit is used to match at least some of the packets with one or more rules to set the corresponding actions to be performed, and at least one of the actions includes a programmable action. The instruction processor performs the programmable action by running a user programmable software code. The instruction processor includes an architecture register, one or more of which can be accessed by the matching action circuit, and the matching action circuit is used to write information for performing the programmable action into the architecture register.
[0004] In some embodiments, the match action circuit is used to instruct the instruction processor to perform a programmable action using information written to the architectural register. In an example embodiment, the match action circuit is used to write to the architectural register a value indicating at least a starting address of user programmable software code that performs the programmable action.
[0005] In some embodiments, the programmable action is a stateful action that depends on state information stored in a memory, and the match action circuit is used to retrieve the state information from the memory and write the retrieved state information to the architectural register. In some embodiments, after completing the stateful action, the match action circuit is used to read the updated state information from the architectural register and save the updated state information in the memory.
[0006] In a disclosed embodiment, a match action circuit is used to perform one or more actions that are not programmable. In an embodiment, a match action circuit is used to distinguish between programmable actions and non-programmable actions and to trigger an instruction processor to perform the programmable actions.
[0007] In some embodiments, the instruction processor includes an execution pipeline that runs user programmable software code, and the match action circuit is used to trigger the execution pipeline after writing the state information to the architectural register. In an example embodiment, the execution pipeline supports arithmetic logic unit (ALU) operations and flow control operations, but does not support memory load and store operations. In another embodiment, the execution pipeline supports memory load and store operations.
[0008] In an embodiment, the instruction processor comprises one or more reduced instruction set computer (RISC) cores. In an embodiment, the instruction processor comprises internal memory and is configured to run user programmable code entirely from the internal memory. In another embodiment, the instruction processor is configured to run user programmable code from external memory using an instruction cache, the instruction cache being configured to cache instructions of the user programmable code.
[0009] According to embodiments described herein, a method is also provided, including: exchanging packets between a network device and a network. Using a match action circuit in the network device, matching at least some of the packets with one or more rules to set corresponding actions to be performed. At least one of the actions includes a programmable action. The programmable action is performed by running a user programmable software code on an instruction processor in the network device, including writing information for performing the programmable action to one or more architectural registers of the instruction processor accessible to the match action circuit through the match action circuit. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] The present invention will be more fully understood from the following detailed description of embodiments in conjunction with the accompanying drawings, in which:
[0011] Figure 1 is a block diagram schematically illustrating a network device using programmable action processing according to an embodiment of the present invention; and
[0012] Figure 2 and Figure 3 FIG. 4 is a flow chart schematically showing a method for matching action processing according to an embodiment of the present invention. DETAILED DESCRIPTION
[0013] Overview
[0014] Embodiments of the invention described herein provide improved methods and apparatus for match action processing.The disclosed techniques can be used in various types of network devices, for example, in network adapters and network switches.
[0015] In some embodiments, the network device includes one or more ports, a matching action circuit and an instruction processor. The port is used to send packets to the network and receive packets from the network. The matching action circuit matches at least some packets in the packet with one or more rules to set corresponding actions. The instruction processor (hereinafter referred to as "processor") is configured to perform one or more specified actions by executing user programmable software code.
[0016] In this context, actions whose execution involves the execution of software code by the processor are referred to herein as "programmable actions". Actions whose execution does not involve the execution of any software code by the processor are referred to herein as "non-programmable actions". The ability to specify at least some actions using programmable software is a powerful tool that provides a high degree of flexibility.
[0017] In some embodiments, all possible actions that can be specified by the match action rules are programmable actions, i.e., have corresponding software code specified for their execution in the processor. In other embodiments, one or more actions are non-programmable actions that are executed without involving the processor. In an embodiment, the match action circuit also serves as a front end to distinguish between programmable actions and non-programmable actions, execute non-programmable actions internally, and forward programmable actions to the processor for execution.
[0018] In some embodiments, the micro-architecture of the processor is made very efficient by sharing one or more of its architectural registers with the matching action circuit. In these embodiments, the matching action circuit provides information for performing programmable actions to the processor by writing information directly to the shared architectural registers. The information may include, for example, the starting address of the software code for performing the action, parameters for performing the action, etc. The matching action circuit may also read the result of the programmable action from the shared architectural registers of the processor.
[0019] By sharing architectural registers with matching action circuits, the processor can perform actions without having to load data from memory, and can return results without having to store data in memory. As such, in some embodiments, the processor includes execution units, such as an arithmetic logic unit (ALU) and a branch unit, but does not include a load or store unit. The sharing of architectural registers significantly simplifies the architecture of the processor and thus reduces the die area. Transferring information through shared registers also reduces action execution time.
[0020] In some embodiments, one or more of the programmable actions are stateful actions. In this context, the term "stateful action" refers to an action that depends on state information stored in a memory. The term "stateless action" refers to an action that does not depend on any stored state information. State information is also referred to as "context."
[0021] In an embodiment, the match action circuit also serves as a front end to call the processor to perform stateful actions and provide the required information to the processor. In this embodiment, the match action circuit retrieves the current state information from the memory and provides the state information to the processor via the shared architectural register. After the action has been completed, the match action circuit reads the updated state information from the shared architectural register and stores the updated state information to the memory.
[0022] In an example embodiment, all stateful actions are provided to the processor for execution, and all stateless actions are performed external to the processor, for example by matching action circuits. However, in general, some stateful actions may be performed external to the processor, and some stateless actions may be performed by the processor. In other words, stateful actions need not be programmable actions, and stateless actions need not be non-programmable actions.
[0023] Various implementation examples are described herein, including network devices and associated methods that employ the disclosed techniques.
[0024] System Description
[0025] Figure 1 Schematically illustrates a block diagram of a network device 20 using programmable action processing according to one embodiment of the present invention. The network device 20 may include, for example, a network adapter (e.g., an Ethernet NIC or an InfiniBand HCA, including an "intelligent NIC", also referred to as a "data processing unit - DPU"), a switch, a router, a network attached storage controller, a graphics processing unit (GPU) with networking capabilities, or any other suitable network device.
[0026] The network device 20 includes one or more ports 24 for sending packets to and receiving packets from a network 28. The network device 20 and the network 28 may operate according to any suitable network protocol, such as Ethernet or InfiniBand. TM (IB).
[0027] The network device 20 further includes a match action circuit 32 and an instruction processor 36. The match action circuit 32 and the processor 36 together form a packet processing pipeline that receives packets, matches the packets to one or more rules, and applies the actions specified in the rules. Such a packet processing pipeline can be used for ingress processing (processing incoming packets received by the network device 20) or for egress processing (processing outgoing packets sent by the network device 20).
[0028] Some actions may be applied to the matched packets. These actions may include, for example, dropping the packet, allowing the packet to proceed, forwarding the packet to a specified port 24, modifying the packet, or sending a copy of the packet for analysis. Other actions are associated with the matched packets but do not directly affect the packets. An example of such an action is to increment a counter for the connection (e.g., packet flow) to which the packet belongs.
[0029] The match action circuit 32 includes a match action table 40 and an optional front end processor 44. The function of the front end processor 44 will be further described below. The table 40 matches the packet to one or more rules. A given rule is typically specified on one or more packet attributes (e.g., header fields of the packet and / or metadata associated with the packet) and specifies an action to be performed.
[0030] In some embodiments, one or more actions specified by the rules of table 40 are performed by processor 36. These actions are referred to herein as "programmable actions." For each type of programmable action, processor 36 maintains corresponding user-programmable software code 64 that performs the action.
[0031] Additionally or alternatively, one or more actions specified by the rules of Table 40 are "stateful actions," i.e., actions that depend on state information stored in memory. A typical example of a stateful action is incrementing a counter associated with a connection (e.g., a packet flow) to which the matched packet belongs. In this example, the state information of the connection includes a current counter value, and performing the action involves retrieving the current counter value from memory, incrementing the counter value, and writing the updated counter value to memory. The counter may count packets, credits, bandwidth quotas, or any other suitable quantity.
[0032] Other types of stateful actions include connection tracking (CT) and metering. CT aims to identify malicious attacks (e.g., denial of service attacks) on network devices by examining some state information of the connection. Packets suspected of being hostile can be quickly dropped. Metering is a technique for limiting the bandwidth of a connection or a group of connections by tracking the cumulative bandwidth of the connection or a group of connections. When the bandwidth quota is exceeded, appropriate action can be taken, such as dropping packets.
[0033] In various embodiments, the memory storing the state information may be internal to the network device 20, external to the network device 20, or a combination of both. Figure 1 In the example of , network device 20 is coupled to external memory 68 that stores state information. In this example, the state information includes connection states 72 of one or more connections handled by network device 20. Alternatively, any other suitable type of state information may be used.
[0034] In some embodiments, although not required, network device 20 includes cache memory 66. Cache memory 66 is located between front-end processor 44 and external memory 68 and caches at least a portion of the state information. In this context, phrases such as "extracting state information from external memory" and "storing state information to external memory" include extracting and storing information in cache 66.
[0035] exist Figure 1 In the example of , the processor 36 includes an execution pipeline, which includes, among other things, a set of architectural registers 48 and a plurality of execution units 52. The architectural registers 48 are also referred to as instruction set architecture (ISA) registers. The execution units 52 may include, for example, one or more arithmetic logic units (ALUs), one or more branch units (BRAs), one or more load units (LDAs), and one or more storage units (STAs). The processor 36 may further include an instruction cache 56 and an internal memory 60 storing user programmable software code 64. In embodiments where some of the program code of the processor 36 is stored in an external memory 68 and should be kept closer for fast execution, the instruction cache 56 is used to cache program instructions. If all of the program code of the processor 36 is stored in the internal memory 60, the instruction cache 56 may be omitted while still achieving good performance.
[0036] Processor 36 is called by matching action circuit 32 to perform programmable actions. Generally, memory 60 stores appropriate software code 64 for each programmable action supported by processor 36. When called to perform a certain programmable action, processor 36 executes the corresponding software code 60 using registers 48 and execution unit 52.
[0037] In some embodiments, network device 20 includes a user interface (e.g., an application programming interface - API) that enables an end user to modify and load user-programmable software code 64. In other embodiments, user-programmable software code 64 is pre-loaded into the network device and cannot be modified by the end user. In the latter case, the term "user" refers to the designer or manufacturer of the network device.
[0038] In some embodiments, processor 36 includes one or more reduced instruction set computer (RISC) cores (e.g., cores supporting RISC-V ISA). In an embodiment, processor 36 includes multiple RISC cores operating in parallel. Each RISC core includes at least a corresponding execution pipeline (e.g., Figure 1 ). This implementation enables processor 36 to perform multiple programmable actions in parallel. Alternatively, any other suitable type of processor may be used.
[0039] In some embodiments, processor 36 runs program code 64 entirely from internal memory 60 in order to avoid delays that may occur when accessing external memory. Even if external memory is accessed via a cache (e.g., instruction cache 56), delays may occur, for example, on cache miss events. In alternative embodiments, the latency to access external memory 68 is sufficiently small, and processor 36 runs program code 64 from external memory 68 (typically via instruction cache 56).
[0040] like Figure 1 As shown, the configuration of network device 20 is an exemplary configuration selected purely for conceptual clarity. In alternative embodiments, any other suitable configuration may be used. For the sake of clarity, elements that are not necessary for understanding the principles of the present invention, such as various interfaces, addressing circuits, timing and sequencing circuits, and debugging circuits, have been omitted from the accompanying drawings.
[0041] The various elements of network device 20 may be implemented in hardware, for example, in one or more application specific integrated circuits (ASICs) or FPGAs. Additionally or alternatively, the elements of network device 20 may be implemented using software or a combination of hardware and software elements.
[0042] In some embodiments, processor 36 may be implemented partially or completely using one or more general purpose processors that are programmed in software to perform the functions described herein. The software may be downloaded to the processor in electronic form, for example, over a network, or it may alternatively or additionally be provided and / or stored on non-transitory tangible media, such as magnetic, optical or electronic memory.
[0043] Use shared architectural registers to perform programmable actions
[0044] In some embodiments, one or more (e.g., all) of the architectural registers 48 of the processor 36 are shared with the match action circuit 44. In this context, the term "shared register" means that the match action circuit can write data directly to the register and can read data directly from the register. The sharing of architectural registers is a novel and efficient mechanism that enables the processor 36 to perform programmable actions without having to interact with the external memory 68.
[0045] In an exemplary embodiment, the total number of shared registers is thirty-two, and each shared register is a 64-bit register. In this example, the total data size that can be used to transmit information using the shared registers is 256 bytes. Alternatively, any other suitable number and size can be used.
[0046] In some embodiments, the execution unit 52 does not include any LDA or STA units. In this exemplary implementation, the execution unit 52 includes only ALU and BRA units. In such an embodiment, the processor 36 is able to perform programmable actions, including receiving all necessary information and returning results, without any access to the external memory 68. However, this implementation is by no means mandatory. In an alternative embodiment, the execution unit 52 does include one or more LDA and / or STA units. These LDA and / or STA units can be used to access the external memory 68, for example, to read information (state information or other) used to perform programmable actions and / or to store the results of programmable actions (updated state information or other).
[0047] In a typical implementation, the matching action circuit 32 instructs the processor 36 to perform a certain programmable action by (i) writing the information required to perform the programmable action into a shared register, and (ii) triggering the processor 36 to perform the programmable action. The information written into the shared register may include, for example, one or more of the following:
[0048] ■ An opcode that identifies the action to be performed.
[0049] ■ A value indicating the starting address of the user programmed software code 64 that performs the action.
[0050] ■ One or more attributes taken from the packet (eg, the value of a header field).
[0051] ■Metadata associated with the group or action.
[0052] ■ Status information (described in detail below).
[0053] ■Any other appropriate information.
[0054] In some embodiments, the write operation (writing information into the shared register) also serves as a trigger for the processor 36 to begin executing a programmable action. In other embodiments, the match action circuit 32 uses a separate interface (e.g., an interrupt) for triggering the processor after the information has been written to the shared register.
[0055] In some embodiments, the processor 36 generates a result (also referred to as a "return value") upon completion of a programmable action. The match action circuit 32 may read the result ("return value") directly from one or more shared registers. The result may be written to an external memory. In addition or as an alternative, the result may be fed back to the match action table 40, for example, to update one or more of the rules. In some embodiments, the processor 36 may modify the value of any shared register while executing program code. When execution is complete, the final value of the register may be read by the match action circuit 32 as the result.
[0056] Figure 2 is a flow chart schematically illustrating a method for performing match action processing in network device 20 according to one embodiment of the present invention. The method begins with network device 20 receiving a packet via one of ports 24 in packet reception phase 80. In matching phase 84, match action circuitry 32 compares the attributes of the received packet with the rules of match action table 40. Assuming a match is found, the match rule specifies an action.
[0057] In the action check phase 88, the front end processor 44 checks whether the action is a programmable action or a non-programmable action. If the action is a non-programmable action, the front end processor 44 executes the action in the non-programmable action execution phase 92.
[0058] If the action is a programmable action, the front end processor 44 instructs the processor 36 to perform the action in a programmable action forwarding stage 96. Typically, the front end processor 44 writes the information required to perform the programmable action into a shared register. In a programmable action execution stage 100, the processor 36 executes the programmable action by running the appropriate user programmable software code 64 using the information written into the shared register.
[0059] Figure 3 FIG. 4 is a flow chart schematically showing a method for matching action processing according to another embodiment of the present invention. Figure 3 The method of focusing on the example embodiment in which (i) stateful actions are performed by processor 36 and (ii) stateless actions are performed by matching action circuit 32. However, this division is by no means mandatory. In alternative embodiments, (i) some or all stateless actions may be performed by processor 36, and (ii) some or all stateful actions may be performed by matching action circuit 32.
[0060] Figure 3 The method begins with network device 20 receiving a packet via one of ports 24 at packet reception phase 104. At matching phase 108, match action circuitry 32 compares the attributes of the received packet to the rules of match action table 40. Assuming a match is found, the match rule specifies an action.
[0061] In the action check phase 112, the front end processor 44 checks whether the action is stateful or stateless. If the action is stateless, then in the stateless action execution phase 116, the front end processor 44 can execute the action.
[0062] If the action is stateful, then in the state acquisition phase 120, the front end processor 44 obtains the relevant state information from the external memory 68. When the action is a programmable action, in the stateful action forwarding phase 124, the front end processor 44 then forwards the state information and any other information required to perform the stateful action to the processor 36. As described above, the front end processor 44 writes the state information and other required information to the shared registers. In one example, the data size of the state information is 64 bytes, occupying 8 64-bit registers. Alternatively, the state information can have any other suitable size.
[0063] In the stateful action execution phase 128, the processor 36 executes the stateful action by running the appropriate user programmable software code 64 using the information written to the shared registers. The processor 36 may use the registers to execute a program, sometimes by modifying their contents. However, as part of the program, the processor writes updated state information to the shared registers.
[0064] In the state update stage 132 , the front end processor 44 reads the updated state information from the shared registers and stores the updated state information in the external memory 68 .
[0065] Although the embodiments described herein primarily address match-action processing in devices such as switches and network adapters, the methods and systems described herein may also be used in other applications, such as in match-action processing in security applications (e.g., IPsec), gateways, and network partitioning.
[0066] Therefore, it should be understood that the above embodiments are cited by way of example, and the present invention is not limited to what is specifically shown and described above. On the contrary, the scope of the present invention includes the combination and sub-combination of the various features described above, as well as changes and modifications thereof that would occur to those skilled in the art upon reading the above description and that are not disclosed in the prior art. The documents incorporated by reference in this patent application are considered to be an integral part of this application, except that to the extent that any term is defined in these incorporated documents in a manner that conflicts with the explicit or implicit definition in this specification, only the definition in this specification should be considered.
Claims
1. A network device, comprising: one or more ports, the one or more ports used to exchange packets between the network device and a network; match action circuitry for matching at least some of the packets to one or more rules to set corresponding actions to be performed, wherein at least one of the actions comprises a programmable action; as well as an instruction processor, the instruction processor being configured to execute the programmable action by running a user programmable software code, wherein the instruction processor includes architectural registers, one or more of the architectural registers being accessible by the match action circuit, and The matching action circuit is used to write information for executing the programmable action into the architecture register.
2. The network device of claim 1, wherein the match action circuit is configured to use information written into the architectural register to instruct the instruction processor to perform the programmable action.
3. The network device of claim 1, wherein the match action circuit is to write at least a value indicative of a starting address of the user programmable software code that performs the programmable action into the architectural register.
4. The network device according to claim 1, wherein the programmable action is a stateful action that depends on state information stored in a memory, and The match action circuit is configured to retrieve the state information from the memory and write the retrieved state information into the architectural register.
5. The network device of claim 4, wherein after completing the stateful action, the match action circuit is configured to read updated state information from the architectural register and save the updated state information in the memory.
6. The network device of claim 1, wherein the match action circuit is configured to perform one or more of the non-programmable actions. 7 . The network device according to claim 1 , wherein the matching action circuit is used to distinguish between programmable actions and non-programmable actions, and is used to trigger the instruction processor to perform the programmable action.
8. The network device of claim 1, wherein the instruction processor includes an execution pipeline for running the user programmable software code, and wherein the match action circuit is used to trigger the execution pipeline after writing the state information to the architectural register.
9. The network device of claim 8, wherein the execution pipeline supports arithmetic logic unit (ALU) operations and flow control operations, but does not support memory load and store operations.
10. The network device of claim 8, wherein the execution pipeline supports memory load and store operations.
11. The network device of claim 1, wherein the instruction processor comprises one or more Reduced Instruction Set Computer (RISC) cores.
12. The network device of claim 1, wherein the instruction processor includes internal memory and is configured to execute the user programmable code entirely from the internal memory.
13. The network device of claim 1, wherein the instruction processor is configured to execute the user programmable code from an external memory using an instruction cache that caches instructions of the user programmable code.
14. A method comprising: Exchange packets between network devices and networks; matching at least some of the packets to one or more rules using match-action circuitry in the network device to set corresponding actions to be performed, wherein at least one of the actions comprises a programmable action; as well as The programmable action is performed by running user programmable software code on an instruction processor in the network device, which includes writing information for performing the programmable action to one or more architectural registers of the instruction processor accessible by the match action circuit through the match action circuit.
15. The method of claim 14, wherein writing the information comprises: At least a value indicative of a starting address of the user programmable software code that performs the programmable action is written into the architectural register.
16. The method according to claim 14, wherein the programmable action is a stateful action that depends on state information stored in a memory, And the method comprises: The state information is retrieved from the memory using the match action circuit, and the retrieved state information is written into the architectural register.
17. The method according to claim 16, comprising: After completing the stateful action, updated state information is read from the architectural register by the match action circuit and the updated state information is saved in the memory.
18. The method according to claim 14, comprising: Using the matching action circuit, programmable actions and non-programmable actions are distinguished, and the instruction processor is triggered to perform the programmable actions.
19. The method of claim 14, wherein performing the programmable action comprises: Using the match action circuit, an execution pipeline of the instruction processor is triggered after the state information is written into the architectural register.
20. The method of claim 19, wherein the execution pipeline supports arithmetic logic unit (ALU) operations and flow control operations, but does not support memory load and store operations.
