WO2016029684A1 - Packet processing and forwarding device and method, and computer storage medium - Google Patents

Packet processing and forwarding device and method, and computer storage medium Download PDF

Info

Publication number
WO2016029684A1
WO2016029684A1 PCT/CN2015/074577 CN2015074577W WO2016029684A1 WO 2016029684 A1 WO2016029684 A1 WO 2016029684A1 CN 2015074577 W CN2015074577 W CN 2015074577W WO 2016029684 A1 WO2016029684 A1 WO 2016029684A1
Authority
WO
WIPO (PCT)
Prior art keywords
tcam
message
module
unit
field
Prior art date
Application number
PCT/CN2015/074577
Other languages
French (fr)
Chinese (zh)
Inventor
胡达
李彧
钱晓东
成诚
石金锋
Original Assignee
深圳市中兴微电子技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市中兴微电子技术有限公司 filed Critical 深圳市中兴微电子技术有限公司
Publication of WO2016029684A1 publication Critical patent/WO2016029684A1/en

Links

Images

Definitions

  • the present invention relates to a packet forwarding technology in the communication field, and in particular, to a message processing and forwarding device, a method, and a computer storage medium.
  • packet forwarding is usually implemented by a general-purpose CPU, a fully programmable network processor NP, or a chip implemented by hard logic; a general-purpose CPU can only satisfy some extremely low line-rate requirements due to limited processing performance; Programmable network processor has high flexibility, but the cost and power consumption are relatively high.
  • the advantages and disadvantages of hard logic implementation are also obvious. The advantage is that it can control the cost and power consumption of the chip. The disadvantage is that the chip In the development process, the understanding and combing of the business process need not be mistaken, which leads to the development and verification of the development process.
  • embodiments of the present invention are directed to providing a message processing forwarding device, method, and computer storage medium to maintain the device with certain flexibility while maintaining low hardware cost and low development difficulty.
  • a first aspect of the present invention provides a message processing and forwarding device, where the device includes at least one processing structure; each of the processing structures includes a TCAM processing unit and a table lookup unit;
  • the TCAM processing unit includes:
  • a first extraction module configured to extract a feature field from the corresponding message and the message descriptor
  • a matching module configured to match the feature field with a TCAM entry to form a match result
  • the first execution module is a programmable module, configured to perform a first operation on the message and the message descriptor according to the matching result, and form a key value domain index;
  • the lookup unit includes:
  • a second extraction module configured to receive the key value domain index and obtain a key value field according to the key value domain index
  • the table lookup module is configured to perform a table lookup according to the key value field to form a table lookup result
  • a second execution module which is a programmable module, configured to perform a second operation on the message and the message description input according to the check result
  • the processing structure is further configured to: after the specified processing structure performs the first operation and the second operation, send the message processed by the processing structure.
  • the TCAM processing unit further includes:
  • a peripheral logic module configured to convert a specified field in the feature field into a matching field of the TCAM entry, and the matching field is sent to the matching module.
  • the TCAM processing unit further includes:
  • a first acquiring module configured to acquire operation information of the first operation according to the matching result
  • the first execution module is configured to perform a first operation on the packet according to the operation information, and obtain a key field index corresponding to the matching result according to the matching result query.
  • the second extraction module is further configured to form the key value field into a predetermined key value structure and send the key value structure to the lookup table module.
  • the lookup unit includes:
  • a second acquiring module configured to acquire operation information of the second operation according to the result of the table lookup
  • the second execution module is configured to perform a second operation on the message according to the operation information.
  • the first execution module and the second execution module are ultra-long instruction programmable modules.
  • the TCAM processing unit and the table lookup unit are capable of processing N pieces of the feature fields at a time; the N is an integer not less than 1;
  • the device further includes a delay unit, and is respectively connected to the TCAM processing unit and the programmable logic instruction query unit;
  • the delay unit is configured to store, when the number M of the feature fields is greater than the N, a matching result corresponding to the M feature fields and the feature field, and a table lookup result, waiting for the TCAM After the processing unit and the lookup table unit process the M feature fields, the message is output.
  • a second aspect of the present invention provides a packet processing forwarding method, which is applied to an apparatus including at least one processing structure, where the processing structure includes a TCAM processing unit and a table lookup unit;
  • the message descriptor performs a second operation
  • the TCAM processing unit includes a peripheral logic module
  • the method further includes:
  • performing, according to the matching result, performing a first operation on the message by using a programmable instruction in the TCAM processing unit and forming a key value domain index includes:
  • the key field index corresponding to the matching result is queried according to the matching result.
  • the method further includes:
  • the lookup table is formed according to the key value structure to form the lookup table result.
  • Performing the second operation on the packet by using the programmable instruction in the lookup unit according to the result of the lookup table includes:
  • the programmable instructions in the TCAM processing unit and the lookup table unit are very long instructions.
  • the TCAM processing unit and the lookup table unit are capable of processing N the feature fields at a time; the N is an integer not less than 1; the device further includes a delay unit;
  • the method further includes: when the number M of the feature fields is greater than the N, storing, by the delay unit, the M feature fields and a matching result and a table lookup result corresponding to the feature field, Waiting for the TCAM processing unit and the lookup table unit to process the M feature fields, and outputting the message.
  • the third aspect of the embodiments of the present invention further provides a computer storage medium, where the computer storage medium stores computer executable instructions, where the computer executable instructions are used to execute at least one of the methods of the first aspect of the embodiments of the present invention. one.
  • the message processing and forwarding method, device and computer storage medium according to the embodiment of the present invention in combination with the TCAM processing unit and the table lookup unit, can implement the line of the device by expanding the programmable first execution module and the second execution module.
  • Business development and business adjustment, maintaining high flexibility, compared with hard logic chips can reduce development difficulty and verification difficulty; through the introduction of TCAM processing unit, TCAM is used to partially process the message, reducing the need for programmable modules to be processed.
  • the workload can reduce the cost and power consumption relatively.
  • FIG. 1 is a schematic structural diagram of a packet processing and forwarding apparatus according to an embodiment of the present invention
  • FIG. 2 is a schematic structural diagram of a processing structure according to an embodiment of the present invention.
  • FIG. 3 is a schematic structural diagram of a TCAM processing unit according to an embodiment of the present invention.
  • FIG. 4 is a second schematic structural diagram of a processing structure according to an embodiment of the present invention.
  • FIG. 5 is a schematic flowchart of a packet processing method according to an embodiment of the present disclosure.
  • FIG. 6 is a flowchart of performing a first operation and forming a key value domain index according to an embodiment of the present invention. schematic diagram;
  • FIG. 7 is a schematic structural view of a processing structure according to an example of the present invention.
  • the embodiment provides a message processing and forwarding device, where the device includes at least one processing structure 11; in FIG. 1, the device includes n+1 processing structures CELL; Said n is an integer not less than one; the at least one processing structure is CELL 0, CELL 1, ... CELL n-1 and CELL n at a time;
  • Each of the processing structures 11 includes a TCAM processing unit 110 and a lookup unit 120;
  • the TCAM processing unit includes:
  • the first extraction module 111 is configured to extract a feature field from the corresponding message and the message descriptor
  • the matching module 112 is configured to match the feature field with the TCAM entry to form a matching result
  • the first execution module 113 is a programmable module, configured to perform a first operation on the message and the message descriptor according to the matching result, and form a key value domain index;
  • the lookup unit 120 includes:
  • the second extraction module 121 is configured to receive the key value domain index and obtain a key value field according to the key value domain index;
  • the lookup table module 122 is configured to perform a table lookup according to the key value field to form a table lookup result
  • the second execution module 133 is a programmable module, configured to perform a second operation on the message and the message descriptor according to the table lookup result;
  • the processing structure is further configured to perform the first operation after the specified processing structure After the second operation, the message processed by the processing structure is sent.
  • the message is a message to be forwarded; the message descriptor is information carrying the message characteristic information; the message descriptor entering the device may include a port according to receiving the message. Configuring the obtained information and the information obtained by parsing the message; in a specific implementation process, the descriptor received by the latter processing structure further includes the processing structure formed by the previous processing structure according to the table lookup module information.
  • the MF_IN is a message input to the device and a message descriptor of the message;
  • the MF_OUT is a processed output result, such as a processed message.
  • the TCAM is an abbreviation of Ternary Content Addressable Memory, which is a three-state content addressed memory; the TCAM entry is content stored in the TCAM.
  • the TCAM has three states corresponding to the TCAM entry. Each bit of the TCAM entry has three states. In addition to “0" and “1”, there is also a “don't care” state, so it is called “ “Three-state”, based on the above three states, the TCAM can perform exact matching and can perform fuzzy matching.
  • the TCAM processing unit is a structure including at least one of the TCAMs.
  • the TCAM processing unit preferably includes a plurality of the TCAMs, so that matching processing of multiple feature fields can be simultaneously implemented to improve Rate of forwarding processing of packets.
  • the first execution module is a programmable module, and the function performed by the first execution module can be changed by changing the code in the first execution module, thereby increasing the flexibility of the device.
  • the matching unit may be configured to send the feature field according to the microcode to send to the matching module, where the microcode is a lower-level code, which can be easily converted from microcode to mechanical language. Can improve processing efficiency.
  • the packet and the packet descriptor include the MAC address, the VLAN, the MLPS, the IP address, the TTL of the lifetime label, the packet type, the packet length, the inbound port of the packet, the packet outgoing port, and the next.
  • Information such as hop information (next network device information), priority of packet processing, and so on.
  • the specific structure of the first execution module 113 may be a processor, and the processor is configured to perform the first operation and form a key value domain index.
  • the first operation includes the first modification operation; the first modification operation may be a modification operation of a forwarding path of a message, and the like.
  • the first modification operation may include: obtaining, according to the matching result, a flag bit that needs to perform a specified operation; the specified operation may be a packet reporting operation, a message mirroring operation, a message sampling operation, etc.; Replace the destination MAC address in the packet, add the VLAN tag of the virtual LAN, modify the destination IP address, and modify the priority of the packet.
  • the first operation may also include a statistical operation; performing statistics on the forwarded packets; for example, performing statistics on the packets received from a certain port; or performing flow-based packet statistics operations.
  • the first operation may further include adding a discard flag or the like to the descriptor that does not satisfy the forwarding rule, for example, when detecting that the length of the IP header of the packet is less than 20 bytes, adding a discard in the descriptor. mark.
  • the feature field may further include packet length information, and the packet length information is mainly used to report the encapsulation time, and recalculate the length of the new packet according to the packet length and the added length of the encapsulation to ensure a new encapsulation.
  • the length of the packet does not exceed the maximum packet length that the port can send.
  • the specific implementation of the first operation may be determined according to the TCAM entry.
  • the specific structure of the lookup table unit 120 may include a processor and a programmable logic device corresponding to the second execution module; the programmable logic device may perform different functions according to changes with programmable code; It has the advantages of high flexibility, low development and verification difficulty.
  • the specific structure of the lookup table module 122 may include a storage medium in which entry information is stored.
  • the entry information includes a key field index and information of the second operation.
  • the specific structure of the second execution module 133 includes a programmable logic device, which can be modified Writing code of the programmable device to cause the second execution module to perform different functions
  • the second operation is similar to the first operation, and is a supplementary processing operation for the first operation, and the same includes the modification and/or determination operation of the forwarding path of the message, and the forwarding of the text. Or discard and other operations.
  • the device in this embodiment uses the TCAM processing unit 110 to process conditions such as matching or selecting branches; for example, as a gateway node of a virtual local area network, the VLAN tag is parsed.
  • the parsing of the VLAN tag may include determining the number of layers of the VLAN added in the packet. For example, whether the packet is added with only one layer of VLAN or two layers of VLANs.
  • the look-up table unit 120 greatly reduces the difficulty of one development due to the programmability of the code, and has the advantage of great flexibility; and because of its programmability, it leaves room for subsequent service adjustment and business development; Some basic processing is done by the TCAM processing unit, which has the advantage of being less costly than being handled entirely by the programmable module.
  • the TCAM processing unit is mainly used to complete the processing of conditional judgment and/or branch selection operation in the process of message processing and forwarding; for example, the condition is true and false.
  • the TCAM processing unit further includes:
  • the peripheral logic module 114 is configured to convert the specified field in the feature field into a matching field of the TCAM entry, and the matching field is sent to the matching module.
  • the peripheral logic module 114 includes a circuit structure such as a logic circuit having a processing function.
  • the specified fields may include fields corresponding to range comparisons and/or fields requiring logical operations, and the like.
  • TCAM to directly perform range comparison or logic operations will result in complex TCAM entries in the TCAM and difficulties in implementation.
  • the peripheral circuit is used to assist the execution, and not only the above functions but also the simple implementation can be realized.
  • the TCAM processing unit further includes:
  • a first acquiring module configured to acquire the operation of the first operation according to the matching result information
  • the first execution module is configured to perform a first operation on the packet according to the operation information, and obtain a key field index corresponding to the matching result according to the matching result query.
  • the TCAM entry generally includes a field to be matched corresponding to the feature field and operation information ACTION corresponding to each matching result; if an operation such as performing VLAN resolution and/or specific IP address resolution is performed, the ACTION includes an operation corresponding to each analysis result.
  • the first execution module includes a storage medium, and the storage medium has a mapping relationship between each matching result and a key value domain index; the first execution module queries the query according to the matching result. Key-valued domain index.
  • the second extraction module is further configured to form the key value field into a predetermined key value structure, and send the key value structure to the lookup table module.
  • the lookup table index in the lookup table module has a fixed structure, and the key value output by the TCAM processing unit may not have a corresponding fixed structure.
  • the second extraction module is adopted.
  • the key value field is formed into a predetermined key value structure to facilitate the lookup table of the table lookup module.
  • the specific second extraction module is specifically configured to splicing one or more of the key value domain indexes to form a corresponding key value structure.
  • the lookup unit 120 includes:
  • a second acquiring module configured to acquire operation information of the second operation according to the result of the table lookup
  • the second execution module is configured to perform a second operation on the message and the message descriptor according to the operation information.
  • the second obtaining module may include a communication interface and a processor inside the device, and the communication interface, such as a communication bus, is used to obtain operation information from the table lookup module.
  • the first execution module and the second execution module are both ultra-long instruction programmable units.
  • the look-up table unit is a super-long instruction programmable logic unit, and when the at least part of the corresponding function of the table look-up unit is completed, a super-long instruction is adopted; when the device performs a long-length instruction, It is possible to realize execution of a plurality of sub-operations in the super-long instruction in parallel, which can speed up execution efficiency.
  • the TCAM processing unit and the table lookup unit are capable of processing N pieces of the feature fields at a time; the N is an integer not less than 1;
  • the device further includes a delay unit 130, and is respectively connected to the TCAM processing unit and the programmable logic instruction query unit;
  • the delay unit 130 is configured to store, when the number M of the feature fields is greater than the N, a matching result corresponding to the M feature fields and the feature field, and a table lookup result, waiting for the After the TCAM processing unit and the lookup table unit process the M feature fields, the message is output.
  • the specific structure of the delay unit 130 may include a storage medium; the storage medium is configured to store the feature field and the matching result and the lookup table result.
  • the delay unit will absorb the The delays of the TCAM processing unit 110 and the lookup table unit 120 first store four feature fields, let the TCAM processing unit 110 and the lookup table unit 120 process two first, and store the two features processed first.
  • the matching result and the query result corresponding to the field; after the feature field is processed, the first processing operation and the second operation are performed according to each feature field, and the output message is sent to the next processing structure or Forwarded by the device to the next device.
  • a TCAM processing unit and a table lookup unit that can simultaneously process four feature fields can also be used to implement packet processing and forwarding.
  • the structure of the TCAM processing unit and the table lookup unit is complicated, and more TCAMs or processors may be needed to support concurrently processing multiple programmable instructions, such as supporting simultaneous execution. Multiple long instructions, This will result in an increase in the hardware cost of the device; in the present embodiment, the above problem can be well handled by the setting of the delay unit.
  • each of the devices may be considered to correspond to one forwarding node, and after the specified processing structure is processed, the device sends the processed packet to the next forwarding node.
  • the message needs to pass through two or more processing structures, after the first processing structure completes the first operation and the second operation, the processed message and the message corresponding to the message are corresponding.
  • the message descriptor is sent to the latter processing structure, and the processing structure continues to be processed by the latter processing structure.
  • the last processing structure of the message and the message descriptor is processed, and the first operation and the second processing are processed. After the second operation, the processed message will be sent directly to the next device.
  • the specified processing structure may be one or more of n+1 of the processing structures.
  • Embodiment 2 is a diagrammatic representation of Embodiment 1:
  • the embodiment further provides a packet forwarding method, which is applied to an apparatus including at least one processing structure, where the processing structure includes a TCAM processing unit and a table lookup unit;
  • Step S110 Extract a feature field from the message and the message descriptor by using the TCAM processing unit, and match the feature field with the TCAM entry to form a matching result;
  • Step S120 Perform a first operation on the message and the message descriptor by using a programmable instruction in the TCAM processing unit according to the matching result, and form a key value domain index;
  • Step S130 extracting the key field index by using the table lookup unit, searching for a key value according to the key field index, and performing a table lookup according to the key field index to form a table lookup result;
  • Step S140 Perform a second operation on the message and the message descriptor by using a programmable instruction in the table lookup unit according to the result of the lookup table;
  • Step S150 After the specified processing structure performs the first operation and the second operation, send the message processed by the processing structure.
  • the method described in this embodiment may be implemented by using the apparatus as described in the first embodiment, combining the TCAM processing unit and the table lookup unit to perform the first operation and the second operation on the packet.
  • the purpose of packet processing forwarding is achieved.
  • the specific structure of the TCAM processing unit and the lookup table unit refer to the detailed description in the first embodiment.
  • Extracting the feature field from the description input in step S110 may be performed by the first extraction unit in the TCAM processing unit described in the first embodiment; in step S110, the feature field is matched with the TCAM entry to form a matching result, which may It is executed by the matching module of the TCAM processing unit described in the first embodiment.
  • the step S120 can be performed by the first execution module of the TCAM processing unit described in the first embodiment.
  • the method in this embodiment uses the TCAM processing unit and the look-up table unit to process and forward the message, and has the advantages of using the TCAM processing unit and the programmable device, and the cost is relative to using only the programmable device.
  • the device has the advantages of low cost and low power consumption; at the same time, it has high flexibility with respect to the curing chip, and is convenient for subsequent business adjustment and business development.
  • the TCAM processing unit mainly performs basic processing for converting condition determination or branch selection operation.
  • the TCAM processing unit includes a peripheral logic module
  • the method also includes converting, by the peripheral logic module, a specified one of the feature fields into a match field of the TCAM entry; the match field is for matching with the TCAM entry.
  • some feature fields are the same as the matching field, that is, the TCAM can also be processed.
  • the peripheral logic circuit of the TCAM unit can be used for conversion. The use of peripheral logic for conversion can simplify the processing of TCAM.
  • the step S120 includes:
  • Step S121 Acquire operation information of the first operation according to the matching result
  • Step S122 Perform a first operation on the message and the message descriptor according to the operation information
  • Step S123 Query a key field index corresponding to the matching result according to the matching result.
  • the first operation performed by the execution unit in this embodiment may be a modification of the information about the packet forwarding path, such as setting the upload flag of the sent message to be valid.
  • the first operation in the embodiment of the present invention includes one or more operations performed according to the matching result.
  • the first operation refer to the corresponding part in the first embodiment.
  • the method further includes:
  • the step S130 may specifically include: performing a lookup table according to the key value structure to form the lookup table result.
  • the step S130 includes: acquiring operation information of the second operation according to the table lookup result; and performing a second operation on the message according to the operation information.
  • the result of the lookup table may be: whether the key field index matches the index in the pre-stored matching information, and specifically matches the matching information. If the key value A or the key value structure A matches the index B of the matching information, the operation information corresponding to the index B is extracted according to the matching result; and the second operation is performed according to the operation information.
  • the operation information includes information such as a specifically performed operation, an operation type, and/or an operation parameter.
  • the programmable instructions in the TCAM processing unit and the look-up table unit are both ultra-long instructions; the use of ultra-long instructions has the advantage of high efficiency.
  • the TCAM processing unit and the lookup table unit can process N the feature fields at a time; the N is an integer not less than 1.
  • a partial feature word is post-processed.
  • the method further includes: when the number M of the feature fields is greater than the N, storing, by the delay unit, the M feature fields and the feature field corresponding to And the result of the lookup, waiting for the TCAM processing unit and the table lookup unit to process the M feature fields, and output the message.
  • the embodiment of the present invention further provides a computer storage medium, where the computer storage medium stores computer executable instructions, where the computer executable instructions are used to perform at least one of the foregoing methods, specifically as shown in FIG. 5 and/or The method shown in 6.
  • the computer storage medium may be a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and the like, which can store program code.
  • the computer storage medium is a non-transitory storage medium.
  • the present example provides a system including n message forwarding processing devices CELL 11; wherein n is an integer that is not less than one; and one of the processing structures CELL 11 includes a path forwarding node that can be considered to be corresponding. .
  • the internal structure of each CELL 11 can be as shown in FIG. 7; specifically, the delay unit 200 (abbreviation MF_DELAY), the TCAM processing unit 209, and the look-up table unit 210 are included.
  • the TCAM processing unit 209 includes an extraction module 201 (abbreviated as T_KEY-SEL), a peripheral logic module 202 (abbreviated as LOGIC), a TCAM module 203 (abbreviated as TCAM), an acquisition module 204 (abbreviated as T_ACTION), and an execution module 205.
  • T_KEY-SEL extraction module 201
  • LOGIC peripheral logic module
  • TCAM TCAM module
  • T_ACTION acquisition module
  • T_ACTION acquisition module
  • execution module 205 a program.g., a program, a program, a program, and a program.
  • T_EX Korean abbreviation T_EX
  • the extraction module 201 corresponds to the first extraction module in the first embodiment
  • the TCAM module corresponds to the matching module in the embodiment
  • the acquired module and the execution module jointly correspond to the first execution in the first embodiment Module.
  • the lookup table unit 210 includes an extraction module 206 (English abbreviation S_KEY-SEL), an entry Module 211 (abbreviation TBL), acquisition module 208 (English abbreviation S_ACTION), and execution module 207 (English abbreviation S_EX).
  • the extraction module 201 corresponds to the second extraction module in the first embodiment; the entry module corresponds to the look-up table module in the embodiment; the acquired module and the execution module jointly correspond to the first embodiment Second execution module.
  • the delay unit 200 is configured to absorb delays of item matching and table item searching, that is, to implement delay processing of part of the feature fields;
  • An extraction module 201 configured to extract a feature field required for matching from the description input MF-IN; the MF-OUT is an output result after processing the MF-IN;
  • peripheral logic module 202 configured to improve processing capability of the TCAM module 203;
  • the TCAM module 203 is configured to store a matching entry converted by the microcode for matching with the feature field extracted by the module 201 and the field converted by 202; the matching entry is a TCAM entry.
  • the obtaining module 204 is configured to obtain ACTION information corresponding to the TCAM matching result according to the TCAM matching result;
  • the execution module 205 is configured to parse and execute the custom instruction corresponding to the ACTION information acquired from the module 204, and form a key value domain index.
  • the extracting module 206 is configured to: obtain a key field index of the lookup table according to the ACTION information obtained from the module 205, and extract the key value field into a key value structure and send the data to the table lookup unit;
  • An entry module 211 configured to perform a table lookup according to the key value structure
  • the obtaining module 207 is configured to obtain, according to the result returned by the lookup table, the ACTION information corresponding thereto;
  • the execution module 208 is configured to parse and execute the custom instruction corresponding to the ACTION information acquired by the module 207.
  • the forwarding process of the packet in this example is as follows:
  • Step 1 extract the feature field in the MF_IN from the rule written according to the microcode into the CELL unit to the TCAM processing unit 209; perform TCAM matching by the TCAM processing unit, and obtain corresponding ACTION information according to the matching result;
  • Step 2 Decode the obtained ACTION information, modify the message according to the decoded instruction, and generate a key field index for searching for a table;
  • Step 3 extracting the key value field according to the key value field index and splicing according to the agreed key value structure, and then sending it to the table item module; the table item module performs table lookup processing;
  • Step 4 Obtain corresponding ACTION information according to the result returned by the lookup table
  • Step 5 The obtained ACTION information is decoded, and the message is modified according to the decoded instruction, and the entry address of the next CELL 11 is determined.
  • Step 8 After the packet is processed by multiple nodes, the real outbound port and the next hop node are determined, and the packet is forwarded.
  • the disclosed apparatus and method may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • there may be another division manner such as: multiple units or components may be combined, or Can be integrated into another system, or some features can be ignored or not executed.
  • the coupling, or direct coupling, or communication connection of the components shown or discussed may be indirect coupling or communication connection through some interfaces, devices or units, and may be electrical, mechanical or other forms. of.
  • the units described above as separate components may or may not be physically separated, and the components displayed as the unit may or may not be physical units, that is, may be located in one place or distributed to multiple network units; Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present invention may be integrated in one process.
  • each unit may be separately used as one unit, or two or more units may be integrated into one unit; the integrated unit may be implemented in the form of hardware or a hardware plus software function unit. Formal realization.
  • the foregoing program may be stored in a computer readable storage medium, and the program is executed when executed.
  • the foregoing storage device includes the following steps: the foregoing storage medium includes: a mobile storage device, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
  • ROM read-only memory
  • RAM random access memory
  • magnetic disk or an optical disk.
  • optical disk A medium that can store program code.

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

Disclosed are a packet processing and forwarding device and method, and a computer storage medium. The device comprises processing structures. Each processing structure comprises a TCAM processing unit and a table lookup unit. The TCAM processing unit comprises: a first extraction module, used for extracting a feature field from a corresponding packet and a packet descriptor; a matching module, used for matching the feature field with TCAM items to form a matching result; and a first execution module, used for executing a primary operation on the packet and the packet descriptor according to the matching result, and forming a key value domain index. The table lookup unit comprises: a second extraction module, used for receiving the key value domain index and acquiring a key value field according to the key value domain index; a table lookup module, used for performing table lookup according to the key value field to form a table lookup result; and a second execution module, used for executing a secondary operation on the packet and the packet descriptor according to the table lookup result. The processing structure is also used for sending the packet processed by the processing structure after the specified processing structure executes the primary operation and the secondary operation.

Description

报文处理转发装置、方法和计算机存储介质Message processing forwarding device, method and computer storage medium 技术领域Technical field
本发明涉及通信领域的报文转发技术,尤其涉及一种报文处理转发装置、方法和计算机存储介质。The present invention relates to a packet forwarding technology in the communication field, and in particular, to a message processing and forwarding device, a method, and a computer storage medium.
背景技术Background technique
目前报文转发通常由通用中央处理器CPU、完全可编程的网络处理器NP或硬逻辑实现的芯片来实现;通用CPU由于受限其处理性能,只能满足一些极低线速要求的场景;可编程的网络处理器灵活度很高,但是成本和功耗的代价也相对比较高;硬逻辑实现的芯片优缺点也非常明显,优点是能很好的控制芯片的成本功耗,缺点是芯片开发过程中需要对业务流程的理解和梳理不能有差错,从而导致开发过程中的开发及验证难度大的问题。At present, packet forwarding is usually implemented by a general-purpose CPU, a fully programmable network processor NP, or a chip implemented by hard logic; a general-purpose CPU can only satisfy some extremely low line-rate requirements due to limited processing performance; Programmable network processor has high flexibility, but the cost and power consumption are relatively high. The advantages and disadvantages of hard logic implementation are also obvious. The advantage is that it can control the cost and power consumption of the chip. The disadvantage is that the chip In the development process, the understanding and combing of the business process need not be mistaken, which leads to the development and verification of the development process.
发明内容Summary of the invention
有鉴于此,本发明实施例期望提供一种报文处理转发装置、方法和计算机存储介质,以保持所述装置具有一定的灵活性,同时维持较低的硬件成本以及较低的开发难度。In view of this, embodiments of the present invention are directed to providing a message processing forwarding device, method, and computer storage medium to maintain the device with certain flexibility while maintaining low hardware cost and low development difficulty.
本发明实施例的技术方案是这样实现的:The technical solution of the embodiment of the present invention is implemented as follows:
本发明第一方面提供一种报文处理转发装置,所述装置包括至少一个处理结构;每一个所述处理结构包括TCAM处理单元及查表单元;A first aspect of the present invention provides a message processing and forwarding device, where the device includes at least one processing structure; each of the processing structures includes a TCAM processing unit and a table lookup unit;
所述TCAM处理单元包括:The TCAM processing unit includes:
第一提取模块,配置为从对应于报文及报文描述符中提取特征字段;a first extraction module, configured to extract a feature field from the corresponding message and the message descriptor;
匹配模块,配置为将所述特征字段与TCAM条目进行匹配,形成匹配 结果;a matching module configured to match the feature field with a TCAM entry to form a match result;
第一执行模块,为可编程模块,配置为依据所述匹配结果,对所述报文及所述报文描述符执行第一次操作并形成键值域索引;The first execution module is a programmable module, configured to perform a first operation on the message and the message descriptor according to the matching result, and form a key value domain index;
所述查表单元包括:The lookup unit includes:
第二提取模块,配置为接收所述键值域索引并依据所述键值域索引获取键值字段;a second extraction module, configured to receive the key value domain index and obtain a key value field according to the key value domain index;
查表模块,配置为依据所述键值字段进行查表,形成查表结果;The table lookup module is configured to perform a table lookup according to the key value field to form a table lookup result;
第二执行模块,为可编程模块,配置为根据所述查表结果对所述报文及所述报文描述输入执行第二次操作;a second execution module, which is a programmable module, configured to perform a second operation on the message and the message description input according to the check result;
所述处理结构,还配置为在指定的所述处理结构执行完所述第一次操作和所述第二次操作后,发送所述处理结构处理后的所述报文。The processing structure is further configured to: after the specified processing structure performs the first operation and the second operation, send the message processed by the processing structure.
基于上述方案,Based on the above scheme,
所述TCAM处理单元还包括:The TCAM processing unit further includes:
外围逻辑模块,配置为将所述特征字段中的指定字段转化成所述TCAM条目的匹配字段,并所述匹配字段发送给所述匹配模块。A peripheral logic module configured to convert a specified field in the feature field into a matching field of the TCAM entry, and the matching field is sent to the matching module.
基于上述方案,Based on the above scheme,
所述TCAM处理单元还包括:The TCAM processing unit further includes:
第一获取模块,配置为依据所述匹配结果获取所述第一次操作的操作信息;a first acquiring module, configured to acquire operation information of the first operation according to the matching result;
所述第一执行模块,配置为依据所述操作信息,对所述报文执行第一次操作并依据匹配结果查询获得对应所述匹配结果的键值域索引。The first execution module is configured to perform a first operation on the packet according to the operation information, and obtain a key field index corresponding to the matching result according to the matching result query.
基于上述方案,Based on the above scheme,
所述第二提取模块还配置为将所述键值字段形成预定的键值结构,并将所述键值结构发给所述查表模块。The second extraction module is further configured to form the key value field into a predetermined key value structure and send the key value structure to the lookup table module.
基于上述方案, Based on the above scheme,
所述查表单元包括:The lookup unit includes:
第二获取模块,配置为依据所述查表结果获取所述第二次操作的操作信息;a second acquiring module, configured to acquire operation information of the second operation according to the result of the table lookup;
所述第二执行模块,配置为依据所述操作信息,对所述报文执行第二次操作。The second execution module is configured to perform a second operation on the message according to the operation information.
基于上述方案,Based on the above scheme,
所述第一执行模块和所述第二执行模块为超长指令可编程模块。The first execution module and the second execution module are ultra-long instruction programmable modules.
基于上述方案,Based on the above scheme,
所述TCAM处理单元及所述查表单元,一次能够处理N个所述特征字段;所述N为不小于1的整数;The TCAM processing unit and the table lookup unit are capable of processing N pieces of the feature fields at a time; the N is an integer not less than 1;
所述装置还包括延时单元,且分别于所述TCAM处理单元及所述可编程逻辑指令查询单元相连;The device further includes a delay unit, and is respectively connected to the TCAM processing unit and the programmable logic instruction query unit;
所述延时单元,配置为当所述特征字段的个数M大于所述N时,存储所述M个所述特征字段以及所述特征字段对应的匹配结果和查表结果,等待所述TCAM处理单元及所述查表单元对所述M个所述特征字段处理之后,输出所述报文。The delay unit is configured to store, when the number M of the feature fields is greater than the N, a matching result corresponding to the M feature fields and the feature field, and a table lookup result, waiting for the TCAM After the processing unit and the lookup table unit process the M feature fields, the message is output.
本发明第二方面提供一种报文处理转发方法,应用于包括至少一个处理结构的装置中,所述处理结构包括TCAM处理单元及查表单元;A second aspect of the present invention provides a packet processing forwarding method, which is applied to an apparatus including at least one processing structure, where the processing structure includes a TCAM processing unit and a table lookup unit;
通过所述TCAM处理单元从对应于报文及报文描述符中提取特征字段;Extracting a feature field from the corresponding message and the message descriptor by the TCAM processing unit;
依据所述匹配结果,采用所述TCAM处理单元中的可编程指令对所述报文及所述报文描述符执行第一次操作并形成键值域索引;Performing a first operation on the message and the message descriptor and forming a key value domain index by using a programmable instruction in the TCAM processing unit according to the matching result;
通过所述查表单元接收所述键值域索引,依据所述键值域索引查找键值字段,依据所述键值字段进行查表形成查表结果;Receiving, by the lookup table unit, the key field index, searching for a key value field according to the key field index, and performing a table lookup according to the key value field to form a table lookup result;
根据所述查表结果采用所述查表单元中的可编程指令对所述报文及所 述报文描述符执行第二次操作;And using the programmable instruction in the lookup unit to use the message and the location according to the result of the lookup table The message descriptor performs a second operation;
在指定的所述处理结构执行完所述第一次操作和所述第二次操作后,发送所述处理结构处理后的所述报文。And after the specified processing structure performs the first operation and the second operation, sending the message processed by the processing structure.
基于上述方案,Based on the above scheme,
所述TCAM处理单元包括外围逻辑模块;The TCAM processing unit includes a peripheral logic module;
所述方法还包括:The method further includes:
通过所述外围逻辑模块将所述特征字段中的指定字段转化成所述TCAM条目的匹配字段;Converting a specified field in the feature field into a matching field of the TCAM entry by the peripheral logic module;
所述匹配字段用于与所述TCAM条目进行匹配The matching field is used to match the TCAM entry
基于上述方案,Based on the above scheme,
所述依据所述匹配结果,采用所述TCAM处理单元中的可编程指令对所述报文执行第一次操作并形成键值域索引包括:And performing, according to the matching result, performing a first operation on the message by using a programmable instruction in the TCAM processing unit and forming a key value domain index includes:
依据所述匹配结果获取所述第一次操作的操作信息;Obtaining operation information of the first operation according to the matching result;
依据所述操作信息,对所述报文执行第一次操作;Performing a first operation on the message according to the operation information;
依据所述匹配结果查询对应所述匹配结果的键值域索引。The key field index corresponding to the matching result is queried according to the matching result.
基于上述方案,Based on the above scheme,
所述方法还包括:The method further includes:
将所述键值字段形成预定的键值结构;Forming the key value field into a predetermined key value structure;
所述依据所述键值字段进行查表形成查表结果具体为:The result of performing a table lookup according to the key value field is specifically:
依据键值结构进行查表形成所述查表结果。The lookup table is formed according to the key value structure to form the lookup table result.
基于上述方案,Based on the above scheme,
所述根据所述查表结果采用所述查表单元中的可编程指令对所述报文执行第二次操作包括:Performing the second operation on the packet by using the programmable instruction in the lookup unit according to the result of the lookup table includes:
依据所述查表结果获取所述第二次操作的操作信息;Obtaining operation information of the second operation according to the result of the lookup table;
依据所述操作信息,对所述报文执行第二次操作。 Performing a second operation on the message according to the operation information.
基于上述方案,Based on the above scheme,
所述TCAM处理单元和查表单元中的可编程指令为超长指令。The programmable instructions in the TCAM processing unit and the lookup table unit are very long instructions.
基于上述方案,Based on the above scheme,
所述TCAM处理单元及所述查表单元,一次能够处理N个所述特征字段;所述N为不小于1的整数;所述装置还包括延时单元;The TCAM processing unit and the lookup table unit are capable of processing N the feature fields at a time; the N is an integer not less than 1; the device further includes a delay unit;
所述方法还包括:当所述特征字段的个数M大于所述N时,通过所述延时单元存储所述M个所述特征字段以及所述特征字段对应的匹配结果和查表结果,等待所述TCAM处理单元及所述查表单元对所述M个所述特征字段处理之后,输出所述报文。The method further includes: when the number M of the feature fields is greater than the N, storing, by the delay unit, the M feature fields and a matching result and a table lookup result corresponding to the feature field, Waiting for the TCAM processing unit and the lookup table unit to process the M feature fields, and outputting the message.
本发明实施例第三方面还提供一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行本发明实施例第一方面所述方法的至少其中之一。The third aspect of the embodiments of the present invention further provides a computer storage medium, where the computer storage medium stores computer executable instructions, where the computer executable instructions are used to execute at least one of the methods of the first aspect of the embodiments of the present invention. one.
本发明实施例所述报文处理转发方法、装置和计算机存储介质,结合TCAM处理单元及查表单元,可通过对可编程的第一执行模块和第二执行模块进行拓展实现所述装置的行业务拓展及业务调整,保持较高的灵活性,相比较于硬逻辑芯片可降低开发难度及验证难度;通过TCAM处理单元的引入,采用TCAM对报文进行部分处理,减少可编程模块需要处理的工作量,可相对的降低成本及功耗等。The message processing and forwarding method, device and computer storage medium according to the embodiment of the present invention, in combination with the TCAM processing unit and the table lookup unit, can implement the line of the device by expanding the programmable first execution module and the second execution module. Business development and business adjustment, maintaining high flexibility, compared with hard logic chips can reduce development difficulty and verification difficulty; through the introduction of TCAM processing unit, TCAM is used to partially process the message, reducing the need for programmable modules to be processed. The workload can reduce the cost and power consumption relatively.
附图说明DRAWINGS
图1为本发明实施例所述的报文处理转发装置的结构示意图;FIG. 1 is a schematic structural diagram of a packet processing and forwarding apparatus according to an embodiment of the present invention;
图2为本发明实施例所述的处理结构的结构示意图之一;2 is a schematic structural diagram of a processing structure according to an embodiment of the present invention;
图3为本发明实施例所述的TCAM处理单元的结构示意图;3 is a schematic structural diagram of a TCAM processing unit according to an embodiment of the present invention;
图4为本发明实施例所述的处理结构的结构示意图之二;4 is a second schematic structural diagram of a processing structure according to an embodiment of the present invention;
图5为本发明实施例所述的报文处理方法的流程示意图之一;FIG. 5 is a schematic flowchart of a packet processing method according to an embodiment of the present disclosure;
图6为本发明实施例所述的执行第一次操作并形成键值域索引的流程 示意图;FIG. 6 is a flowchart of performing a first operation and forming a key value domain index according to an embodiment of the present invention; schematic diagram;
图7为本发明示例所述的处理结构的结构示意图。FIG. 7 is a schematic structural view of a processing structure according to an example of the present invention.
具体实施方式detailed description
以下结合附图对本发明的优选实施例进行详细说明,应当理解,以下所说明的优选实施例仅用于说明和解释本发明,并不用于限定本发明。The preferred embodiments of the present invention are described in detail below with reference to the accompanying drawings.
实施例一 Embodiment 1
如图1及图2所示,本实施例提供一种报文处理转发装置,所述装置包括至少一个处理结构11;在图1中所述装置包括n+1个处理结构CELL;其中,所述n为不小1的整数;所述至少一个处理结构一次是CELL 0、CELL 1、……CELL n-1以及CELL n;As shown in FIG. 1 and FIG. 2, the embodiment provides a message processing and forwarding device, where the device includes at least one processing structure 11; in FIG. 1, the device includes n+1 processing structures CELL; Said n is an integer not less than one; the at least one processing structure is CELL 0, CELL 1, ... CELL n-1 and CELL n at a time;
每一个所述处理结构11包括TCAM处理单元110及查表单元120;Each of the processing structures 11 includes a TCAM processing unit 110 and a lookup unit 120;
所述TCAM处理单元包括:The TCAM processing unit includes:
第一提取模块111,配置为从对应于报文及报文描述符中提取特征字段;The first extraction module 111 is configured to extract a feature field from the corresponding message and the message descriptor;
匹配模块112,配置为将所述特征字段与TCAM条目进行匹配,形成匹配结果;The matching module 112 is configured to match the feature field with the TCAM entry to form a matching result;
第一执行模块113,为可编程模块,配置为依据所述匹配结果,对所述报文及所述报文描述符执行第一次操作并形成键值域索引;The first execution module 113 is a programmable module, configured to perform a first operation on the message and the message descriptor according to the matching result, and form a key value domain index;
所述查表单元120包括:The lookup unit 120 includes:
第二提取模块121,配置为接收所述键值域索引并依据所述键值域索引获取键值字段;The second extraction module 121 is configured to receive the key value domain index and obtain a key value field according to the key value domain index;
查表模块122,配置为依据所述键值字段进行查表,形成查表结果;The lookup table module 122 is configured to perform a table lookup according to the key value field to form a table lookup result;
第二执行模块133,为可编程模块,配置为根据所述查表结果对所述报文及所述报文描述符执行第二次操作;The second execution module 133 is a programmable module, configured to perform a second operation on the message and the message descriptor according to the table lookup result;
所述处理结构,还配置为在指定的所述处理结构执行完所述第一次操 作和所述第二次操作后,发送所述处理结构处理后的所述报文。The processing structure is further configured to perform the first operation after the specified processing structure After the second operation, the message processed by the processing structure is sent.
所述报文为待转发的报文;所述报文描述符为承载有所述报文特征信息的信息;进入所述装置的所述报文描述符可包括依据接收所述报文的端口配置获得的信息以及解析报文获得的信息;在具体的实现过程中,后一个所述处理结构接收的所述描述符,还包括上一所述处理结构根据查表模块的查表结果形成的信息。The message is a message to be forwarded; the message descriptor is information carrying the message characteristic information; the message descriptor entering the device may include a port according to receiving the message. Configuring the obtained information and the information obtained by parsing the message; in a specific implementation process, the descriptor received by the latter processing structure further includes the processing structure formed by the previous processing structure according to the table lookup module information.
在图1中所述MF_IN为输入到所述装置的报文以及所述报文的报文描述符;所述MF_OUT为处理后的输出结果,具体如处理后的报文。In FIG. 1, the MF_IN is a message input to the device and a message descriptor of the message; the MF_OUT is a processed output result, such as a processed message.
所述TCAM为Ternary Content Addressable Memory的缩写,是一种三态内容寻址存储器;所述TCAM条目为存储在所述TCAM内的内容。所述TCAM依据所述TCAM条目对应有三种状态,TCAM条目中每个bit位有三种状态,除掉“0”和“1”外,还有一个“don’t care”状态,所以称为“三态”,基于上述三种状态所述TCAM能够进行精确匹配,又能进行模糊匹配。The TCAM is an abbreviation of Ternary Content Addressable Memory, which is a three-state content addressed memory; the TCAM entry is content stored in the TCAM. The TCAM has three states corresponding to the TCAM entry. Each bit of the TCAM entry has three states. In addition to "0" and "1", there is also a "don't care" state, so it is called " "Three-state", based on the above three states, the TCAM can perform exact matching and can perform fuzzy matching.
所述TCAM处理单元为至少包括一个所述TCAM的结构;在本实施例中优选为所述TCAM处理单元包括多个所述TCAM,从而能同时实现对多个特征字段的进行匹配处理,以提高对报文的转发处理速率。The TCAM processing unit is a structure including at least one of the TCAMs. In the embodiment, the TCAM processing unit preferably includes a plurality of the TCAMs, so that matching processing of multiple feature fields can be simultaneously implemented to improve Rate of forwarding processing of packets.
所述第一执行模块为可编程模块,通过对所述第一执行模块中代码的改变,可以改变第一执行模块执行的功能,从而能增加装置的灵活性。The first execution module is a programmable module, and the function performed by the first execution module can be changed by changing the code in the first execution module, thereby increasing the flexibility of the device.
在具体的实现过程中,所述匹配单元可配置为根据微码提取所述特征字段发送给所述匹配模块,所述微码为较为底层的代码,可简便的实现从微码转换成机械语言,能提高处理效率。In a specific implementation process, the matching unit may be configured to send the feature field according to the microcode to send to the matching module, where the microcode is a lower-level code, which can be easily converted from microcode to mechanical language. Can improve processing efficiency.
所述报文及报文描述符具体包括Mac地址、VLAN、MLPS、IP地址以及生命周期标签TTL等信息及报文类型、报文长度、报文的入向端口、报文出向端口、下一跳信息(下一个网络设备信息)、报文处理的优先级等信息。 The packet and the packet descriptor include the MAC address, the VLAN, the MLPS, the IP address, the TTL of the lifetime label, the packet type, the packet length, the inbound port of the packet, the packet outgoing port, and the next. Information such as hop information (next network device information), priority of packet processing, and so on.
所述第一执行模块113的具体结构可为处理器,所述处理器用于执行所述第一次操作并形成键值域索引。The specific structure of the first execution module 113 may be a processor, and the processor is configured to perform the first operation and form a key value domain index.
所述第一次操作包括所述第一修改操作;所述第一修改操作可为报文的转发路径的修改操作等。The first operation includes the first modification operation; the first modification operation may be a modification operation of a forwarding path of a message, and the like.
所述第一修改操作可包括根据匹配结果获取报文需要进行指定操作的标记位;所述指定操作具体可以是报文上报操作、报文镜像操作以及报文采样操作等;依据所述匹配结果替换所述报文中的目的Mac地址、添加虚拟局域网VLAN标签、修改目的IP地址及修改报文的优先级等操作。The first modification operation may include: obtaining, according to the matching result, a flag bit that needs to perform a specified operation; the specified operation may be a packet reporting operation, a message mirroring operation, a message sampling operation, etc.; Replace the destination MAC address in the packet, add the VLAN tag of the virtual LAN, modify the destination IP address, and modify the priority of the packet.
所述第一次操作还可包括统计操作;对转发的报文进行统计;具体如,对从某一端口接收的报文进行统计等操作;还可以是基于流的报文统计操作。The first operation may also include a statistical operation; performing statistics on the forwarded packets; for example, performing statistics on the packets received from a certain port; or performing flow-based packet statistics operations.
所述第一次操作还可包括将不满足转发规则的描述符中添加丢弃标记等,具体如当检测到报文的IP头的长度小于20个字节时,在所述描述符中添加丢弃标记。The first operation may further include adding a discard flag or the like to the descriptor that does not satisfy the forwarding rule, for example, when detecting that the length of the IP header of the packet is less than 20 bytes, adding a discard in the descriptor. mark.
所述特征字段还可能包括报文长度信息,所述报文长度信息主要用于报封装的时候,依据所述报文长度以及封装新增长度重新计算新报文的长度,以保证新封装成的报文长度不超过端口可发送的最大报文长度。The feature field may further include packet length information, and the packet length information is mainly used to report the encapsulation time, and recalculate the length of the new packet according to the packet length and the added length of the encapsulation to ensure a new encapsulation. The length of the packet does not exceed the maximum packet length that the port can send.
在具体的过程中,所述第一次操作的具体实现,可根据所述TCAM条目来确定。In a specific process, the specific implementation of the first operation may be determined according to the TCAM entry.
所述查表单元120的具体结构,可包括处理器以及对应于所述第二执行模块的可编程逻辑器件;所述可编程逻辑器件可以根据随着可编程代码的变化,而执行功能不同;具有灵活性高,开发及验证难度低的优点。The specific structure of the lookup table unit 120 may include a processor and a programmable logic device corresponding to the second execution module; the programmable logic device may perform different functions according to changes with programmable code; It has the advantages of high flexibility, low development and verification difficulty.
所述查表模块122的具体结构可包括存储介质,所述存储介质中存储有表项信息。所述表项信息包括键值域索引及第二次操作的信息等。The specific structure of the lookup table module 122 may include a storage medium in which entry information is stored. The entry information includes a key field index and information of the second operation.
所述第二执行模块133的具体结构包括可编程逻辑器件,能够通过改 写可编程器件的代码,使所述第二执行模块执行不同的功能The specific structure of the second execution module 133 includes a programmable logic device, which can be modified Writing code of the programmable device to cause the second execution module to perform different functions
所述第二次操作与第一次操作类似,是对第一次操作的补充处理操作,同样的是包括对报文的转发路径的修改和/或确定操作等,还可对报文本身转发或丢弃等操作。The second operation is similar to the first operation, and is a supplementary processing operation for the first operation, and the same includes the modification and/or determination operation of the forwarding path of the message, and the forwarding of the text. Or discard and other operations.
本实施例所述的装置,结合了TCAM处理单元及查表单元120,采用TCAM处理单元110处理条件匹配或选择分支等操作;如作为虚拟局域网的网关节点,解析VLAN标签。所述解析VLAN标签具体可包括解析报文中添加的VLAN的层数;具体如报文是仅添加了一层VLAN还是两层VLAN。The device in this embodiment, in combination with the TCAM processing unit and the look-up table unit 120, uses the TCAM processing unit 110 to process conditions such as matching or selecting branches; for example, as a gateway node of a virtual local area network, the VLAN tag is parsed. The parsing of the VLAN tag may include determining the number of layers of the VLAN added in the packet. For example, whether the packet is added with only one layer of VLAN or two layers of VLANs.
所述查表单元120由于其具有代码的可编程性,大大降低了一次开发的难度,具有灵活性大的优点;且由于其可编程性为后续的业务调整以及业务拓展留下了空间;将一些基本处理由TCAM处理单元来做,相对于全部由可编程模块来处理具有成本低的优点。在本实施例中所述TCAM处理单元,主要用于完成在报文处理转发过程中可以写成条件判断和/或分支选择操作的处理;具体如条件真假判断等。The look-up table unit 120 greatly reduces the difficulty of one development due to the programmability of the code, and has the advantage of great flexibility; and because of its programmability, it leaves room for subsequent service adjustment and business development; Some basic processing is done by the TCAM processing unit, which has the advantage of being less costly than being handled entirely by the programmable module. In the embodiment, the TCAM processing unit is mainly used to complete the processing of conditional judgment and/or branch selection operation in the process of message processing and forwarding; for example, the condition is true and false.
如图3所示,所述TCAM处理单元还包括:As shown in FIG. 3, the TCAM processing unit further includes:
外围逻辑模块114,配置为将所述特征字段中的指定字段转化成所述TCAM条目的匹配字段,并所述匹配字段发送给所述匹配模块。The peripheral logic module 114 is configured to convert the specified field in the feature field into a matching field of the TCAM entry, and the matching field is sent to the matching module.
所述外围逻辑模块114包括具有处理功能的逻辑电路等电路结构。The peripheral logic module 114 includes a circuit structure such as a logic circuit having a processing function.
所述指定字段可包括对应于范围比较的字段和/或需要进行逻辑运算的字段等。采用TCAM直接执行范围比较或逻辑运算,会导致TCAM内的TCAM条目复杂,实现困难。在本实施例中采用外围电路来辅助执行,不仅能实现上述功能,同时还能简便实现。The specified fields may include fields corresponding to range comparisons and/or fields requiring logical operations, and the like. Using TCAM to directly perform range comparison or logic operations will result in complex TCAM entries in the TCAM and difficulties in implementation. In the embodiment, the peripheral circuit is used to assist the execution, and not only the above functions but also the simple implementation can be realized.
基于上述方案,所述TCAM处理单元还包括:Based on the foregoing solution, the TCAM processing unit further includes:
第一获取模块,配置为依据所述匹配结果获取所述第一次操作的操作 信息;a first acquiring module, configured to acquire the operation of the first operation according to the matching result information;
所述第一执行模块,配置为依据所述操作信息,对所述报文执行第一次操作并依据匹配结果查询获得对应所述匹配结果的键值域索引。The first execution module is configured to perform a first operation on the packet according to the operation information, and obtain a key field index corresponding to the matching result according to the matching result query.
所述TCAM条目通常包括对应于特征字段的待匹配字段以及对应各匹配结果的操作信息ACTION;如执行VLAN解析和/或特定IP地址解析等操作,则所述ACTION包括各解析结果对应的操作。The TCAM entry generally includes a field to be matched corresponding to the feature field and operation information ACTION corresponding to each matching result; if an operation such as performing VLAN resolution and/or specific IP address resolution is performed, the ACTION includes an operation corresponding to each analysis result.
在具体的实现过程中所述第一执行模块包括存储介质,所述存储介质有存储有各匹配结果与键值域索引的映射关系;所述第一执行模块为依据所述匹配结果查询所述键值域索引。In a specific implementation process, the first execution module includes a storage medium, and the storage medium has a mapping relationship between each matching result and a key value domain index; the first execution module queries the query according to the matching result. Key-valued domain index.
基于上述方案,所述第二提取模块还用于将所述键值字段形成预定的键值结构,并将所述键值结构发给所述查表模块。在具体实现过程中,所述查表模块中的查表索引是有固定结构的,而所述TCAM处理单元输出的键值则可能没有对应的固定结构,在本实施例中通过第二提取模块将所述键值字段形成预定的键值结构,便于所述查表模块的查表。具体的所述第二提取模块具体可用于将一个或多个所述键值域索引拼接形成对应的键值结构。Based on the foregoing solution, the second extraction module is further configured to form the key value field into a predetermined key value structure, and send the key value structure to the lookup table module. In a specific implementation process, the lookup table index in the lookup table module has a fixed structure, and the key value output by the TCAM processing unit may not have a corresponding fixed structure. In this embodiment, the second extraction module is adopted. The key value field is formed into a predetermined key value structure to facilitate the lookup table of the table lookup module. The specific second extraction module is specifically configured to splicing one or more of the key value domain indexes to form a corresponding key value structure.
所述查表单元120包括:The lookup unit 120 includes:
第二获取模块,配置为依据所述查表结果获取所述第二次操作的操作信息;a second acquiring module, configured to acquire operation information of the second operation according to the result of the table lookup;
所述第二执行模块,配置为依据所述操作信息,对所述报文及所述报文描述符执行第二次操作。The second execution module is configured to perform a second operation on the message and the message descriptor according to the operation information.
在具体的实现过程中,所述第二获取模块可包括所述装置内部的通信接口及处理器,所述通信接口如通信总线等,用于从所述查表模块中获取操作信息In a specific implementation process, the second obtaining module may include a communication interface and a processor inside the device, and the communication interface, such as a communication bus, is used to obtain operation information from the table lookup module.
所述第一执行模块和第二执行模块均为超长指令可编程单元。 The first execution module and the second execution module are both ultra-long instruction programmable units.
在本实施例中所述查表单元为超长指令可编程逻辑单元,在完成所述查表单元的对应的至少部分功能时,采用的超长指令;所述装置在执行超长指令时,能够实现并行执行所述超长指令中的多个子操作,能够加快执行效率。In the embodiment, the look-up table unit is a super-long instruction programmable logic unit, and when the at least part of the corresponding function of the table look-up unit is completed, a super-long instruction is adopted; when the device performs a long-length instruction, It is possible to realize execution of a plurality of sub-operations in the super-long instruction in parallel, which can speed up execution efficiency.
所述TCAM处理单元及所述查表单元,一次能够处理N个所述特征字段;所述N为不小于1的整数;The TCAM processing unit and the table lookup unit are capable of processing N pieces of the feature fields at a time; the N is an integer not less than 1;
如图4所示,所述装置还包括延时单元130,且分别于所述TCAM处理单元及所述可编程逻辑指令查询单元相连;As shown in FIG. 4, the device further includes a delay unit 130, and is respectively connected to the TCAM processing unit and the programmable logic instruction query unit;
所述延时单元130,配置为当所述特征字段的个数M大于所述N时,存储所述M个所述特征字段以及所述特征字段对应的匹配结果和查表结果,等待所述TCAM处理单元及所述查表单元对所述M个所述特征字段处理之后,输出所述报文。The delay unit 130 is configured to store, when the number M of the feature fields is greater than the N, a matching result corresponding to the M feature fields and the feature field, and a table lookup result, waiting for the After the TCAM processing unit and the lookup table unit process the M feature fields, the message is output.
所述延时单元130的具体结构可包括存储介质;所述存储介质用于存储所述特征字段及所述匹配结果和查表结果。The specific structure of the delay unit 130 may include a storage medium; the storage medium is configured to store the feature field and the matching result and the lookup table result.
具体的如,当所述M=4;而所述N=2时,所述TCAM处理单元和所述查表单元不能同时执行4个特征字段的处理,则所述延时单元将吸收所述TCAM处理单元110和所述查表单元120的延时,先存储着4个特征字段,让所述TCAM处理单元110和所述查表单元120先处理两个,并且存储先处理的2个特征字段对应的匹配结果和查询结果;待所述特征字段都处理完了,也依据每一特征字段完成了对报文的第一次操作和第二次操作之后,输出报文给下一个处理结构或由所述装置转发给下一装置。在具体的实现过程中,也可以采用能同时处理4个特征字段的TCAM处理单元和查表单元来实现报文处理转发。通常能够同时处理特征字段个数越多,则TCAM处理单元和查表单元的结构就复杂,可能需要更多的TCAM或处理器可能需要支撑能同时并发处理多条可编程指令,如支持同时执行多条超长指令, 这将导致装置的硬件成本增加;而在本实施例中,通过延时单元的设置,可以很好的处理以上问题。Specifically, when the M=4; and the N=2, the TCAM processing unit and the table lookup unit cannot simultaneously perform processing of four feature fields, then the delay unit will absorb the The delays of the TCAM processing unit 110 and the lookup table unit 120 first store four feature fields, let the TCAM processing unit 110 and the lookup table unit 120 process two first, and store the two features processed first. The matching result and the query result corresponding to the field; after the feature field is processed, the first processing operation and the second operation are performed according to each feature field, and the output message is sent to the next processing structure or Forwarded by the device to the next device. In a specific implementation process, a TCAM processing unit and a table lookup unit that can simultaneously process four feature fields can also be used to implement packet processing and forwarding. Generally, the more the number of feature fields can be processed at the same time, the structure of the TCAM processing unit and the table lookup unit is complicated, and more TCAMs or processors may be needed to support concurrently processing multiple programmable instructions, such as supporting simultaneous execution. Multiple long instructions, This will result in an increase in the hardware cost of the device; in the present embodiment, the above problem can be well handled by the setting of the delay unit.
在具体的实现过程中,每一个所述装置可认为对应了一个所述转发节点,在指定的所述处理结构处理完之后,所述装置将处理后的报文发送到下一转发节点。当所述报文需要经过两个以上所述处理结构时,在前一个所述处理结构完成所述第一次操作和第二操作之后,会将处理后的报文以及所述报文对应的报文描述符发送到后一处理结构中,由后一处理结构继续处理,最后一个处理所述报文及报文描述符的处理结构,在处理完所述第一次操作和所述第二次操作后将直接向下一装置发送处理后的所述报文。In a specific implementation process, each of the devices may be considered to correspond to one forwarding node, and after the specified processing structure is processed, the device sends the processed packet to the next forwarding node. When the message needs to pass through two or more processing structures, after the first processing structure completes the first operation and the second operation, the processed message and the message corresponding to the message are corresponding. The message descriptor is sent to the latter processing structure, and the processing structure continues to be processed by the latter processing structure. The last processing structure of the message and the message descriptor is processed, and the first operation and the second processing are processed. After the second operation, the processed message will be sent directly to the next device.
其中,所述指定的处理结构,可以为n+1个所述处理结构中的一个或多个。The specified processing structure may be one or more of n+1 of the processing structures.
实施例二:Embodiment 2:
如图5所示,本实施例还提供了一种报文转发方法,应用于包括至少一个处理结构的装置中,所述处理结构包括TCAM处理单元及查表单元;As shown in FIG. 5, the embodiment further provides a packet forwarding method, which is applied to an apparatus including at least one processing structure, where the processing structure includes a TCAM processing unit and a table lookup unit;
步骤S110:通过所述TCAM处理单元从报文及报文描述符中提取特征字段,将所述特征字段与TCAM条目进行匹配形成匹配结果;Step S110: Extract a feature field from the message and the message descriptor by using the TCAM processing unit, and match the feature field with the TCAM entry to form a matching result;
步骤S120:依据所述匹配结果,采用所述TCAM处理单元中的可编程指令对所述报文及报文描述符执行第一次操作并形成键值域索引;Step S120: Perform a first operation on the message and the message descriptor by using a programmable instruction in the TCAM processing unit according to the matching result, and form a key value domain index;
步骤S130:通过所述查表单元提取所述键值域索引,依据所述键值域索引查找键值,依据所述键值域索引进行查表形成查表结果;Step S130: extracting the key field index by using the table lookup unit, searching for a key value according to the key field index, and performing a table lookup according to the key field index to form a table lookup result;
步骤S140:根据所述查表结果采用所述查表单元中的可编程指令对所述报文及所述报文描述符执行第二次操作;Step S140: Perform a second operation on the message and the message descriptor by using a programmable instruction in the table lookup unit according to the result of the lookup table;
步骤S150:在指定的所述处理结构执行完所述第一次操作和所述第二次操作后,发送所述处理结构处理后的所述报文。 Step S150: After the specified processing structure performs the first operation and the second operation, send the message processed by the processing structure.
本实施例所述的方法可以采用如实施例一中所述的装置进行来实现,结合所述TCAM处理单元及所述查表单元,对报文进行第一次操作和第二次操作,以达到报文处理转发的目的。所述TCAM处理单元和所述查表单元的具体结构可参见实施例一中的详细描述。The method described in this embodiment may be implemented by using the apparatus as described in the first embodiment, combining the TCAM processing unit and the table lookup unit to perform the first operation and the second operation on the packet. The purpose of packet processing forwarding is achieved. For the specific structure of the TCAM processing unit and the lookup table unit, refer to the detailed description in the first embodiment.
在步骤S110中从描述输入中提取特征字段可以由实施例一中所述的TCAM处理单元中的第一提取单元来执行;步骤S110中将所述特征字段与TCAM条目进行匹配形成匹配结果,可以由实施例一中所述的TCAM处理单元的匹配模块来执行。所述步骤S120可以由实施例一中所述的TCAM处理单元的第一执行模块来执行。Extracting the feature field from the description input in step S110 may be performed by the first extraction unit in the TCAM processing unit described in the first embodiment; in step S110, the feature field is matched with the TCAM entry to form a matching result, which may It is executed by the matching module of the TCAM processing unit described in the first embodiment. The step S120 can be performed by the first execution module of the TCAM processing unit described in the first embodiment.
本实施例所述的方法采用所述TCAM处理单元及所述查表单元对报文进行处理转发,同时兼具了采用TCAM处理单元和可编程器件的优点,成本相对于仅采用可编程器件的装置具有成本低及功耗低的优点;同时相对于固化芯片具有灵活性高,方便后续进行业务调整以及业务拓展。在本实施例中所述TCAM处理单元主要是完成一些可以转换条件判断或分支选择操作的基本处理。The method in this embodiment uses the TCAM processing unit and the look-up table unit to process and forward the message, and has the advantages of using the TCAM processing unit and the programmable device, and the cost is relative to using only the programmable device. The device has the advantages of low cost and low power consumption; at the same time, it has high flexibility with respect to the curing chip, and is convenient for subsequent business adjustment and business development. In the embodiment, the TCAM processing unit mainly performs basic processing for converting condition determination or branch selection operation.
所述TCAM处理单元包括外围逻辑模块;The TCAM processing unit includes a peripheral logic module;
所述方法还包括:通过所述外围逻辑模块将所述特征字段中的指定字段转化成所述TCAM条目的匹配字段;所述匹配字段用于与所述TCAM条目进行匹配。The method also includes converting, by the peripheral logic module, a specified one of the feature fields into a match field of the TCAM entry; the match field is for matching with the TCAM entry.
在具体的实现过程中,有些特征字段与匹配字段相同,即TCAM也能处理完成;但是对于具有范围比较或逻辑运算的特征字段,在本实施例中可以通过TCAM单元的外围逻辑电路进行转化,采用外围逻辑电路进行转换,能简化TCAM的处理。In a specific implementation process, some feature fields are the same as the matching field, that is, the TCAM can also be processed. However, for the feature field with range comparison or logical operation, in the embodiment, the peripheral logic circuit of the TCAM unit can be used for conversion. The use of peripheral logic for conversion can simplify the processing of TCAM.
可选地,如图6所示,所述步骤S120包括:Optionally, as shown in FIG. 6, the step S120 includes:
步骤S121:依据所述匹配结果获取所述第一次操作的操作信息; Step S121: Acquire operation information of the first operation according to the matching result;
步骤S122:依据所述操作信息,对所述报文及报文描述符执行第一次操作;Step S122: Perform a first operation on the message and the message descriptor according to the operation information;
步骤S123:依据所述匹配结果查询对应所述匹配结果的键值域索引。Step S123: Query a key field index corresponding to the matching result according to the matching result.
本实施例中所述执行单元执行的第一次操作,可能是对报文转发路径相关信息的修改,如将上送报文的上送标记置为有效等操作。具体的详细阐述可以参见实施例一中对应部分。在本发明实施例中所述第一次操作包括一个或多个依据所述匹配结果执行的操作。所述第一次操作的具体详细描述可以参见实施例一中的对应部分。The first operation performed by the execution unit in this embodiment may be a modification of the information about the packet forwarding path, such as setting the upload flag of the sent message to be valid. For a detailed description, refer to the corresponding part in the first embodiment. The first operation in the embodiment of the present invention includes one or more operations performed according to the matching result. For a detailed description of the first operation, refer to the corresponding part in the first embodiment.
可选地,Optionally,
所述方法还包括:The method further includes:
将所述键值形成预定的键值结构;Forming the key value into a predetermined key value structure;
所述步骤S130具体可包括为:依据键值结构进行查表形成所述查表结果。The step S130 may specifically include: performing a lookup table according to the key value structure to form the lookup table result.
基于上述方案,所述步骤S130包括:依据所述查表结果获取所述第二次操作的操作信息;及依据所述操作信息,对所述报文执行第二次操作。Based on the foregoing solution, the step S130 includes: acquiring operation information of the second operation according to the table lookup result; and performing a second operation on the message according to the operation information.
所述查表结果可为:键值域索引是否与预先存储的匹配信息的中的索引是否匹配的结果,具体匹配那一条匹配信息。如键值A或所述键值结构A与匹配信息的索引B匹配成功;则依据所述匹配结果,提对应于所述索引B的操作信息;再依据所述操作信息执行第二次操作。所述操作信息包括具体执行的操作,操作类型和/或操作参数等信息。The result of the lookup table may be: whether the key field index matches the index in the pre-stored matching information, and specifically matches the matching information. If the key value A or the key value structure A matches the index B of the matching information, the operation information corresponding to the index B is extracted according to the matching result; and the second operation is performed according to the operation information. The operation information includes information such as a specifically performed operation, an operation type, and/or an operation parameter.
基于上述方案,所述TCAM处理单元及所述查表单元中的所述可编程指令均为超长指令;采用超长指令具有理效率高的优点。Based on the above solution, the programmable instructions in the TCAM processing unit and the look-up table unit are both ultra-long instructions; the use of ultra-long instructions has the advantage of high efficiency.
为了简化所述TCAM处理单元及查表单元的结构,降低硬件成本,假设所述TCAM处理单元及所述查表单元,一次能够处理N个所述特征字段;所述N为不小于1的整数;则在本实施例中增设使部分特征字延时后处理 的延时单元;具体地,所述方法还包括:当所述特征字段的个数M大于所述N时,通过所述延时单元存储所述M个所述特征字段以及所述特征字段对应的匹配结果和查表结果,等待所述TCAM处理单元及所述查表单元对所述M个所述特征字段处理之后,输出所述报文。In order to simplify the structure of the TCAM processing unit and the table lookup unit and reduce the hardware cost, it is assumed that the TCAM processing unit and the lookup table unit can process N the feature fields at a time; the N is an integer not less than 1. In this embodiment, a partial feature word is post-processed. The method further includes: when the number M of the feature fields is greater than the N, storing, by the delay unit, the M feature fields and the feature field corresponding to And the result of the lookup, waiting for the TCAM processing unit and the table lookup unit to process the M feature fields, and output the message.
本发明实施例还提供一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行上述方法的至少其中之一,具体如图5和/或图6所示的方法。The embodiment of the present invention further provides a computer storage medium, where the computer storage medium stores computer executable instructions, where the computer executable instructions are used to perform at least one of the foregoing methods, specifically as shown in FIG. 5 and/or The method shown in 6.
所述计算机存储介质可为U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质;在一些实施例中,所述计算机存储介质为非瞬间存储介质。The computer storage medium may be a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and the like, which can store program code. In some embodiments, the computer storage medium is a non-transitory storage medium.
以下基于实施例一和/或实施例二,提供两个具体示例:Two specific examples are provided below based on the first embodiment and/or the second embodiment:
示例一:Example 1:
如图1所示,本示例提供一个系统包括n个报文转发处理装置CELL 11;其中,所述n为不小1的整数;一个所述处理结构CELL 11包括可认为是对应一个路径转发节点。每一个CELL 11的内部结构可为如图7所示;具体包括延时单元200(英文缩写MF_DELAY)、TCAM处理单元209、查表单元210。As shown in FIG. 1, the present example provides a system including n message forwarding processing devices CELL 11; wherein n is an integer that is not less than one; and one of the processing structures CELL 11 includes a path forwarding node that can be considered to be corresponding. . The internal structure of each CELL 11 can be as shown in FIG. 7; specifically, the delay unit 200 (abbreviation MF_DELAY), the TCAM processing unit 209, and the look-up table unit 210 are included.
所述TCAM处理单元209包括、提取模块201(英文缩写T_KEY-SEL)、外围逻辑模块202(英文缩写LOGIC)、TCAM模块203(英文缩写TCAM)、获取模块204(英文缩写T_ACTION)以及执行模块205(英文缩写T_EX)。所述提取模块201对应于实施例一中的第一提取模块;所述TCAM模块对应于实施例中的匹配模块;所述获获取模块及所述执行模块共同对应实施例一中的第一执行模块。The TCAM processing unit 209 includes an extraction module 201 (abbreviated as T_KEY-SEL), a peripheral logic module 202 (abbreviated as LOGIC), a TCAM module 203 (abbreviated as TCAM), an acquisition module 204 (abbreviated as T_ACTION), and an execution module 205. (English abbreviation T_EX). The extraction module 201 corresponds to the first extraction module in the first embodiment; the TCAM module corresponds to the matching module in the embodiment; the acquired module and the execution module jointly correspond to the first execution in the first embodiment Module.
所述查表单元210包括、提取模块206(英文缩写S_KEY-SEL)、表项 模块211(英文缩写TBL)、获取模块208(英文缩写S_ACTION)以及执行模块207(英文缩写S_EX)。所述提取模块201对应于实施例一中的第二提取模块;所述表项模块对应于实施例中的查表模块;所述获获取模块及所述执行模块共同对应实施例一中的第二执行模块。The lookup table unit 210 includes an extraction module 206 (English abbreviation S_KEY-SEL), an entry Module 211 (abbreviation TBL), acquisition module 208 (English abbreviation S_ACTION), and execution module 207 (English abbreviation S_EX). The extraction module 201 corresponds to the second extraction module in the first embodiment; the entry module corresponds to the look-up table module in the embodiment; the acquired module and the execution module jointly correspond to the first embodiment Second execution module.
所述延时单元200,用于吸收条目匹配和表项查找的延时,即实现部分特征字段的延时处处理;The delay unit 200 is configured to absorb delays of item matching and table item searching, that is, to implement delay processing of part of the feature fields;
提取模块201,用于提取从描述输入MF-IN中匹配需要的特征字段;所述MF-OUT为对所述MF-IN处理之后的输出结果;An extraction module 201, configured to extract a feature field required for matching from the description input MF-IN; the MF-OUT is an output result after processing the MF-IN;
外围逻辑模块202,用于提升TCAM模块203的处理能力;a peripheral logic module 202, configured to improve processing capability of the TCAM module 203;
TCAM模块203,用于存储由微码转换来的匹配条目,用于跟模块201提取的特征字段以及由202转换后的字段作比较匹配;所述匹配条目为TCAM条目。The TCAM module 203 is configured to store a matching entry converted by the microcode for matching with the feature field extracted by the module 201 and the field converted by 202; the matching entry is a TCAM entry.
获取模块204,用于根据TCAM匹配结果获取与之对应的ACTION信息;The obtaining module 204 is configured to obtain ACTION information corresponding to the TCAM matching result according to the TCAM matching result;
执行模块205,用于解析并执行从模块204中获取的ACTION信息对应的自定义指令,并形成键值域索引。The execution module 205 is configured to parse and execute the custom instruction corresponding to the ACTION information acquired from the module 204, and form a key value domain index.
提取模块206,用于根据从模块205中获取的ACTION信息中获取查表的键值域索引并提取键值字段组装成键值结构向查表单元发送;The extracting module 206 is configured to: obtain a key field index of the lookup table according to the ACTION information obtained from the module 205, and extract the key value field into a key value structure and send the data to the table lookup unit;
表项模块211,用于依据所述键值结构进行查表;An entry module 211, configured to perform a table lookup according to the key value structure;
获取模块207,用于根据查表返回的结果获取与之对应的ACTION信息;The obtaining module 207 is configured to obtain, according to the result returned by the lookup table, the ACTION information corresponding thereto;
执行模块208,用于解析并执行从模块207中获取的ACTION信息对应的自定义指令。The execution module 208 is configured to parse and execute the custom instruction corresponding to the ACTION information acquired by the module 207.
示例二:Example two:
基于示例一中所述的结构,本示例对报文的转发处理步骤如下: Based on the structure described in the first example, the forwarding process of the packet in this example is as follows:
步骤1:对进入到CELL单元的根据微码编写的规则提取MF_IN中的特征字段给TCAM处理单元209;由TCAM处理单元进行TCAM匹配,并根据匹配结果获取对应的ACTION信息;Step 1: extract the feature field in the MF_IN from the rule written according to the microcode into the CELL unit to the TCAM processing unit 209; perform TCAM matching by the TCAM processing unit, and obtain corresponding ACTION information according to the matching result;
步骤2:对获取的ACTION信息进行解码,根据解码出的指令修改报文,并生成查找用于查表的键值域索引;Step 2: Decode the obtained ACTION information, modify the message according to the decoded instruction, and generate a key field index for searching for a table;
步骤3:根据键值域索引提取键值字段并按约定的键值结构拼接后发送给表项模块;由表项模块进行查表处理;Step 3: extracting the key value field according to the key value field index and splicing according to the agreed key value structure, and then sending it to the table item module; the table item module performs table lookup processing;
步骤4:根据查表返回的结果获取对应的ACTION信息;Step 4: Obtain corresponding ACTION information according to the result returned by the lookup table;
步骤5:获取的ACTION信息进行解码,根据解码出的指令修改报文,决策产生下一CELL 11的入口地址;Step 5: The obtained ACTION information is decoded, and the message is modified according to the decoded instruction, and the entry address of the next CELL 11 is determined.
步骤8:报文经过多个节点处理后决策出真正的出端口和下一跳节点,完成报文的转发;Step 8: After the packet is processed by multiple nodes, the real outbound port and the next hop node are determined, and the packet is forwarded.
在本申请所提供的几个实施例中,应该理解到,所揭露的设备和方法,可以通过其它的方式实现。以上所描述的设备实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,如:多个单元或组件可以结合,或可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的各组成部分相互之间的耦合、或直接耦合、或通信连接可以是通过一些接口,设备或单元的间接耦合或通信连接,可以是电性的、机械的或其它形式的。In the several embodiments provided by the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. The device embodiments described above are merely illustrative. For example, the division of the unit is only a logical function division. In actual implementation, there may be another division manner, such as: multiple units or components may be combined, or Can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, or direct coupling, or communication connection of the components shown or discussed may be indirect coupling or communication connection through some interfaces, devices or units, and may be electrical, mechanical or other forms. of.
上述作为分离部件说明的单元可以是、或也可以不是物理上分开的,作为单元显示的部件可以是、或也可以不是物理单元,即可以位于一个地方,也可以分布到多个网络单元上;可以根据实际的需要选择其中的部分或全部单元来实现本实施例方案的目的。The units described above as separate components may or may not be physically separated, and the components displayed as the unit may or may not be physical units, that is, may be located in one place or distributed to multiple network units; Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
另外,在本发明各实施例中的各功能单元可以全部集成在一个处理 模块中,也可以是各单元分别单独作为一个单元,也可以两个或两个以上单元集成在一个单元中;上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated in one process. In the module, each unit may be separately used as one unit, or two or more units may be integrated into one unit; the integrated unit may be implemented in the form of hardware or a hardware plus software function unit. Formal realization.
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:移动存储设备、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。A person skilled in the art can understand that all or part of the steps of implementing the above method embodiments may be completed by using hardware related to the program instructions. The foregoing program may be stored in a computer readable storage medium, and the program is executed when executed. The foregoing storage device includes the following steps: the foregoing storage medium includes: a mobile storage device, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk. A medium that can store program code.
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此。凡按照本发明原理所作的修改,都应当理解为落入本发明的保护范围。 The above description is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Modifications made in accordance with the principles of the invention are understood to fall within the scope of the invention.

Claims (15)

  1. 一种报文处理转发装置,所述装置包括至少一个处理结构;每一个所述处理结构包括TCAM处理单元及查表单元;A message processing forwarding device, the device comprising at least one processing structure; each of the processing structures comprising a TCAM processing unit and a table lookup unit;
    所述TCAM处理单元包括:The TCAM processing unit includes:
    第一提取模块,配置为从对应于报文及报文描述符中提取特征字段;a first extraction module, configured to extract a feature field from the corresponding message and the message descriptor;
    匹配模块,配置为将所述特征字段与TCAM条目进行匹配,形成匹配结果;a matching module configured to match the feature field with a TCAM entry to form a matching result;
    第一执行模块,为可编程模块,配置为依据所述匹配结果,对所述报文及所述报文描述符执行第一次操作并形成键值域索引;The first execution module is a programmable module, configured to perform a first operation on the message and the message descriptor according to the matching result, and form a key value domain index;
    所述查表单元包括:The lookup unit includes:
    第二提取模块,配置为接收所述键值域索引并依据所述键值域索引获取键值字段;a second extraction module, configured to receive the key value domain index and obtain a key value field according to the key value domain index;
    查表模块,配置为依据所述键值字段进行查表,形成查表结果;The table lookup module is configured to perform a table lookup according to the key value field to form a table lookup result;
    第二执行模块,为可编程模块,配置为根据所述查表结果对所述报文及所述报文描述输入执行第二次操作;a second execution module, which is a programmable module, configured to perform a second operation on the message and the message description input according to the check result;
    所述处理结构,还配置为在指定的所述处理结构执行完所述第一次操作和所述第二次操作后,发送所述处理结构处理后的所述报文。The processing structure is further configured to: after the specified processing structure performs the first operation and the second operation, send the message processed by the processing structure.
  2. 根据权利要求1所述的装置,其中,The device according to claim 1, wherein
    所述TCAM处理单元还包括:The TCAM processing unit further includes:
    外围逻辑模块,配置为将所述特征字段中的指定字段转化成所述TCAM条目的匹配字段,并所述匹配字段发送给所述匹配模块。A peripheral logic module configured to convert a specified field in the feature field into a matching field of the TCAM entry, and the matching field is sent to the matching module.
  3. 根据权利要求2所述的装置,其中,The device according to claim 2, wherein
    所述TCAM处理单元还包括:The TCAM processing unit further includes:
    第一获取模块,配置为依据所述匹配结果获取所述第一次操作的操作 信息;a first acquiring module, configured to acquire the operation of the first operation according to the matching result information;
    所述第一执行模块,配置为依据所述操作信息,对所述报文执行第一次操作并依据匹配结果查询获得对应所述匹配结果的键值域索引。The first execution module is configured to perform a first operation on the packet according to the operation information, and obtain a key field index corresponding to the matching result according to the matching result query.
  4. 根据权利要求1所述的装置,其中,所述第二提取模块还配置为将所述键值字段形成预定的键值结构,并将所述键值结构发给所述查表模块。The apparatus of claim 1, wherein the second extraction module is further configured to form the key value field into a predetermined key value structure and to send the key value structure to the lookup table module.
  5. 根据权利要求1或4所述的装置,其中,The apparatus according to claim 1 or 4, wherein
    所述查表单元包括:The lookup unit includes:
    第二获取模块,配置为依据所述查表结果获取所述第二次操作的操作信息;a second acquiring module, configured to acquire operation information of the second operation according to the result of the table lookup;
    所述第二执行模块,配置为依据所述操作信息,对所述报文执行第二次操作。The second execution module is configured to perform a second operation on the message according to the operation information.
  6. 根据权利要求1、4或5所述的装置,其中,A device according to claim 1, 4 or 5, wherein
    所述第一执行模块和所述第二执行模块为超长指令可编程模块。The first execution module and the second execution module are ultra-long instruction programmable modules.
  7. 根据权利要求1至5任一项所述的装置,其中,The apparatus according to any one of claims 1 to 5, wherein
    所述TCAM处理单元及所述查表单元,一次能够处理N个所述特征字段;所述N为不小于1的整数;The TCAM processing unit and the table lookup unit are capable of processing N pieces of the feature fields at a time; the N is an integer not less than 1;
    所述装置还包括延时单元,且分别于所述TCAM处理单元及所述可编程逻辑指令查询单元相连;The device further includes a delay unit, and is respectively connected to the TCAM processing unit and the programmable logic instruction query unit;
    所述延时单元,用于当所述特征字段的个数M大于所述N时,存储所述M个所述特征字段以及所述特征字段对应的匹配结果和查表结果,等待所述TCAM处理单元及所述查表单元对所述M个所述特征字段处理之后,输出所述报文。The delay unit is configured to store, when the number M of the feature fields is greater than the N, a matching result corresponding to the M feature fields and the feature field, and a table lookup result, waiting for the TCAM After the processing unit and the lookup table unit process the M feature fields, the message is output.
  8. 一种报文处理转发方法,应用于包括至少一个处理结构的装置中,所述处理结构包括TCAM处理单元及查表单元;A packet processing forwarding method is applied to an apparatus including at least one processing structure, where the processing structure includes a TCAM processing unit and a table lookup unit;
    通过所述TCAM处理单元从对应于报文及报文描述符中提取特征字 段;Extracting feature words from corresponding message and message descriptors by the TCAM processing unit segment;
    依据所述匹配结果,采用所述TCAM处理单元中的可编程指令对所述报文及所述报文描述符执行第一次操作并形成键值域索引;Performing a first operation on the message and the message descriptor and forming a key value domain index by using a programmable instruction in the TCAM processing unit according to the matching result;
    通过所述查表单元接收所述键值域索引,依据所述键值域索引查找键值字段,依据所述键值字段进行查表形成查表结果;Receiving, by the lookup table unit, the key field index, searching for a key value field according to the key field index, and performing a table lookup according to the key value field to form a table lookup result;
    根据所述查表结果采用所述查表单元中的可编程指令对所述报文及所述报文描述符执行第二次操作;Performing a second operation on the message and the message descriptor by using a programmable instruction in the lookup unit according to the result of the lookup table;
    在指定的所述处理结构执行完所述第一次操作和所述第二次操作后,发送所述处理结构处理后的所述报文。And after the specified processing structure performs the first operation and the second operation, sending the message processed by the processing structure.
  9. 根据权利要求8所述的方法,其中,The method of claim 8 wherein
    所述TCAM处理单元包括外围逻辑模块;The TCAM processing unit includes a peripheral logic module;
    所述方法还包括:The method further includes:
    通过所述外围逻辑模块将所述特征字段中的指定字段转化成所述TCAM条目的匹配字段;Converting a specified field in the feature field into a matching field of the TCAM entry by the peripheral logic module;
    所述匹配字段用于与所述TCAM条目进行匹配。The match field is used to match the TCAM entry.
  10. 根据权利要求9所述的方法,其中,The method of claim 9 wherein
    所述依据所述匹配结果,采用所述TCAM处理单元中的可编程指令对所述报文执行第一次操作并形成键值域索引包括:And performing, according to the matching result, performing a first operation on the message by using a programmable instruction in the TCAM processing unit and forming a key value domain index includes:
    依据所述匹配结果获取所述第一次操作的操作信息;Obtaining operation information of the first operation according to the matching result;
    依据所述操作信息,对所述报文执行第一次操作;Performing a first operation on the message according to the operation information;
    依据所述匹配结果查询对应所述匹配结果的键值域索引。The key field index corresponding to the matching result is queried according to the matching result.
  11. 根据权利要求8所述的方法,其中,The method of claim 8 wherein
    所述方法还包括:The method further includes:
    将所述键值字段形成预定的键值结构;Forming the key value field into a predetermined key value structure;
    所述依据所述键值字段进行查表形成查表结果具体为: The result of performing a table lookup according to the key value field is specifically:
    依据键值结构进行查表形成所述查表结果。The lookup table is formed according to the key value structure to form the lookup table result.
  12. 根据权利要求8或11所述的方法,其中,The method according to claim 8 or 11, wherein
    所述根据所述查表结果采用所述查表单元中的可编程指令对所述报文执行第二次操作包括:Performing the second operation on the packet by using the programmable instruction in the lookup unit according to the result of the lookup table includes:
    依据所述查表结果获取所述第二次操作的操作信息;Obtaining operation information of the second operation according to the result of the lookup table;
    依据所述操作信息,对所述报文执行第二次操作。Performing a second operation on the message according to the operation information.
  13. 根据权利要求8、11或12所述的方法,其中,The method according to claim 8, 11 or 12, wherein
    所述TCAM处理单元和查表单元中的可编程指令为超长指令。The programmable instructions in the TCAM processing unit and the lookup table unit are very long instructions.
  14. 根据权利要求8至12任一项所述的方法,其中,A method according to any one of claims 8 to 12, wherein
    所述TCAM处理单元及所述查表单元,一次能够处理N个所述特征字段;所述N为不小于1的整数;所述装置还包括延时单元;The TCAM processing unit and the lookup table unit are capable of processing N the feature fields at a time; the N is an integer not less than 1; the device further includes a delay unit;
    所述方法还包括:当所述特征字段的个数M大于所述N时,通过所述延时单元存储所述M个所述特征字段以及所述特征字段对应的匹配结果和查表结果,等待所述TCAM处理单元及所述查表单元对所述M个所述特征字段处理之后,输出所述报文。The method further includes: when the number M of the feature fields is greater than the N, storing, by the delay unit, the M feature fields and a matching result and a table lookup result corresponding to the feature field, Waiting for the TCAM processing unit and the lookup table unit to process the M feature fields, and outputting the message.
  15. 一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行权利要求8至14所述方法的至少其中之一。 A computer storage medium having stored therein computer executable instructions for performing at least one of the methods of claims 8-14.
PCT/CN2015/074577 2014-08-25 2015-03-19 Packet processing and forwarding device and method, and computer storage medium WO2016029684A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410422447.8A CN105376159A (en) 2014-08-25 2014-08-25 Packet processing and forwarding device and method
CN201410422447.8 2014-08-25

Publications (1)

Publication Number Publication Date
WO2016029684A1 true WO2016029684A1 (en) 2016-03-03

Family

ID=55377979

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/074577 WO2016029684A1 (en) 2014-08-25 2015-03-19 Packet processing and forwarding device and method, and computer storage medium

Country Status (2)

Country Link
CN (1) CN105376159A (en)
WO (1) WO2016029684A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017215466A1 (en) * 2016-06-15 2017-12-21 中兴通讯股份有限公司 Table look-up method for a network processor, network processor, table look-up system and storage medium

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106572034A (en) * 2016-11-07 2017-04-19 深圳市楠菲微电子有限公司 Programmable processing method for processing network messages applied to switch chip
CN108664518B (en) * 2017-03-31 2021-12-07 深圳市中兴微电子技术有限公司 Method and device for realizing table look-up processing
CN107342948B (en) * 2017-06-09 2019-08-13 烽火通信科技股份有限公司 A kind of data flow recognition process unit based on TCAM, system and method
CN107579960A (en) * 2017-08-22 2018-01-12 深圳市盛路物联通讯技术有限公司 A kind of data filtering method and device
CN107689962B (en) * 2017-09-25 2021-03-19 深圳市盛路物联通讯技术有限公司 Data stream filtering method and system
CN107786447B (en) * 2017-11-09 2020-06-16 锐捷网络股份有限公司 Message forwarding method and device based on FPGA
CN108270800B (en) * 2018-04-26 2020-08-04 浪潮集团有限公司 Message processing method and system based on self-authentication code
CN111107042B (en) * 2018-10-26 2021-03-09 广州汽车集团股份有限公司 Message parsing method and device, computer equipment and storage medium
CN109905322B (en) * 2019-04-01 2021-05-07 盛科网络(苏州)有限公司 Message matching information preprocessing method and device
CN114079634B (en) * 2020-08-21 2024-03-12 深圳市中兴微电子技术有限公司 Message forwarding method and device and computer readable storage medium
CN115988105B (en) * 2022-11-02 2023-11-07 南京金阵微电子技术有限公司 Universal stream comparison method, verification platform, storage medium and electronic device
CN116055397B (en) * 2023-03-27 2023-08-18 井芯微电子技术(天津)有限公司 Queue entry maintenance method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101505279A (en) * 2009-03-20 2009-08-12 中国人民解放军信息工程大学 Route searching method and apparatus
CN101834802A (en) * 2010-05-26 2010-09-15 华为技术有限公司 Method and device for forwarding data packet
US7869411B2 (en) * 2005-11-21 2011-01-11 Broadcom Corporation Compact packet operation device and method
CN103905310A (en) * 2014-03-24 2014-07-02 华为技术有限公司 Message processing method and forwarding device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1787477A (en) * 2004-12-09 2006-06-14 北京三星通信技术研究有限公司 Method for searching IPv6 routing table
CN102075404A (en) * 2009-11-19 2011-05-25 华为技术有限公司 Message detection method and device
US20130111122A1 (en) * 2011-10-31 2013-05-02 Futurewei Technologies, Inc. Method and apparatus for network table lookups
US9411908B2 (en) * 2013-01-30 2016-08-09 Marvell Israel (M.I.S.L) Ltd. Architecture for TCAM sharing

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7869411B2 (en) * 2005-11-21 2011-01-11 Broadcom Corporation Compact packet operation device and method
CN101505279A (en) * 2009-03-20 2009-08-12 中国人民解放军信息工程大学 Route searching method and apparatus
CN101834802A (en) * 2010-05-26 2010-09-15 华为技术有限公司 Method and device for forwarding data packet
CN103905310A (en) * 2014-03-24 2014-07-02 华为技术有限公司 Message processing method and forwarding device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017215466A1 (en) * 2016-06-15 2017-12-21 中兴通讯股份有限公司 Table look-up method for a network processor, network processor, table look-up system and storage medium

Also Published As

Publication number Publication date
CN105376159A (en) 2016-03-02

Similar Documents

Publication Publication Date Title
WO2016029684A1 (en) Packet processing and forwarding device and method, and computer storage medium
US20200244483A1 (en) Multicast multipathing in an overlay network
US20190058661A1 (en) Storing keys with variable sizes in a multi-bank database
US20230275835A1 (en) Apparatus and method of generating lookups and making decisions for packet modifying and forwarding in a software-defined network engine
EP3035613B1 (en) Ccn routing using hardware-assisted hash tables
US10135734B1 (en) Pipelined evaluations for algorithmic forwarding route lookup
WO2019128817A1 (en) Message processing method and device
US9385957B1 (en) Flow key lookup involving multiple simultaneous cam operations to identify hash values in a hash bucket
US8799507B2 (en) Longest prefix match searches with variable numbers of prefixes
JP6369532B2 (en) Network control method, network system and apparatus, and program
US20100260188A1 (en) Method and device for processing qinq packet
US11652735B2 (en) Multicast data packet processing method, and apparatus
US20210160350A1 (en) Generating programmatically defined fields of metadata for network packets
WO2019185051A1 (en) Integrated flow table-based packet forwarding method and device
US20160218975A1 (en) Information processing system, information processing apparatus and control method of information processing system
WO2021104393A1 (en) Method for achieving multi-rule flow classification, device, and storage medium
WO2016106506A1 (en) Routing method and device
CN113806403A (en) Method for reducing search matching logic resources in intelligent network card/DPU
CN115883681A (en) Message analysis method and device, electronic equipment and storage medium
CN102014065A (en) Method for analyzing packet headers, header analysis preprocessing device and network processor
WO2008119282A1 (en) Method for routing lookup and system for forwarding
CN112087389B (en) Message matching table look-up method, system, storage medium and terminal
WO2014146571A1 (en) Network processor, and network processor-based packet preprocessing method and device
US20120106555A1 (en) Low latency carrier class switch-router
US9590897B1 (en) Methods and systems for network devices and associated network transmissions

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15835142

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15835142

Country of ref document: EP

Kind code of ref document: A1