WO2018192587A1 - 一种查表方法及装置、计算机存储介质 - Google Patents

一种查表方法及装置、计算机存储介质 Download PDF

Info

Publication number
WO2018192587A1
WO2018192587A1 PCT/CN2018/084119 CN2018084119W WO2018192587A1 WO 2018192587 A1 WO2018192587 A1 WO 2018192587A1 CN 2018084119 W CN2018084119 W CN 2018084119W WO 2018192587 A1 WO2018192587 A1 WO 2018192587A1
Authority
WO
WIPO (PCT)
Prior art keywords
entry
message
information
packet
field
Prior art date
Application number
PCT/CN2018/084119
Other languages
English (en)
French (fr)
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 WO2018192587A1 publication Critical patent/WO2018192587A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • H04L45/74591Address table lookup; Address filtering using content-addressable memories [CAM]

Definitions

  • the present disclosure relates to the field of data communications, and in particular, to a table lookup method and apparatus based on a Ternary Content Addressable Memory (TCAM), and a computer storage medium.
  • TCAM Ternary Content Addressable Memory
  • TCAM is a dedicated three-state content addressable memory that allows for a large number of parallel searches via TCAM.
  • all the entries in the TCAM will match the keywords at the same time, and the obtained search result is the physical address of the matching item.
  • each bit of the entry may be 0, 1, or X. If it is X, the bit does not participate in the comparison and the default result is successful, otherwise the keyword will be compared with the content of the entry. Compare, if the match is successful, it returns success, if the match fails, it returns failure.
  • the fast matching feature of the TCAM is widely used for route lookup of routing tables and rule matching of access control lists (ACLs).
  • a data communication device such as a router or a switch uses TCAM to perform packet forwarding, it needs to pass through a Network Processor (NP), an Application Specific Integrated Circuits (ASIC) chip, a TCAM chip, and an external random access memory (External).
  • NP Network Processor
  • ASIC Application Specific Integrated Circuits
  • TCAM TCAM
  • External external random access memory
  • the RAM External Random-Access Memory
  • the current implementation process has high performance requirements for the NP/ASIC chip and the TCAM chip, which has very high requirements on the power consumption and heat dissipation capability of the product. And it brings huge cost pressure to the product.
  • an embodiment of the present disclosure provides a table lookup method and apparatus, and a computer storage medium.
  • the query request packet is parsed to obtain the ID information of the TCAM chip.
  • User data information is queried in the storage module according to the physical address.
  • the parsing unit is configured to: after receiving the packet and determining that the packet is an entry query request packet, parsing the request query packet to obtain the ID information of the TCAM chip;
  • the sending unit is configured to send the entry query request message to the corresponding TCAM chip to perform an entry search operation according to the ID information of the TCAM chip;
  • a receiving unit configured to receive an entry search result sent by the TCAM chip, where the entry search result carries an entry identifier
  • An address translation unit configured to convert the entry identifier into a corresponding physical address in the storage module
  • the memory control unit is configured to query the user data information in the storage module according to the physical address.
  • Embodiments of the present disclosure also provide a computer storage medium storing a computer program configured to perform the above-described table lookup method.
  • the query request packet when receiving the packet and determining that the packet is an entry query request packet, is parsed to obtain the ID information of the TCAM chip;
  • the ID information of the TCAM chip is sent to the corresponding TCAM chip to perform an entry search operation, and the result of the entry searched by the TCAM chip is received, and the entry of the entry carries the entry.
  • the identifier is converted into a corresponding physical address in the storage module; and the user data information is queried in the storage module according to the physical address.
  • the TCAM chip with lower data bit width can be used to implement the lookup table key keyword in combination, which reduces the power consumption and hardware cost of the TCAM while ensuring the search performance.
  • the embodiment of the present disclosure can directly return the user data information after publishing the item query request message under the NP module by integrating the address conversion module (implementing the conversion of the TCAM address and the physical address of the external RAM) and the extended/integrated memory control module ( For example, the outbound port, the link layer physical address, and the like, the packet header information is quickly searched, and the packet processing load of the NP module is also reduced, which is helpful for the power consumption design of the NP module.
  • the address conversion module implementing the conversion of the TCAM address and the physical address of the external RAM
  • the extended/integrated memory control module For example, the outbound port, the link layer physical address, and the like, the packet header information is quickly searched, and the packet processing load of the NP module is also reduced, which is helpful for the power consumption design of the NP module.
  • FIG. 1 is an architectural diagram of a TCAM-based router/switch device implementation lookup table
  • FIG. 2 is an architectural diagram of implementing a table lookup according to an embodiment of the present disclosure
  • FIG. 3 is a schematic flowchart diagram of a table lookup method according to an embodiment of the present disclosure
  • FIG. 4 is a schematic flowchart of an entry query process according to an embodiment of the present disclosure.
  • FIG. 5 is a schematic diagram of a process for delivering an entry according to an embodiment of the present disclosure
  • FIG. 6 is a schematic structural diagram of a table look-up device according to an embodiment of the present disclosure.
  • FIG. 1 shows the architecture of the TCAM-based router/switch device.
  • the circuit logic consists of NP/ASIC. Chip, TCAM chip and External RAM module.
  • the NP/ASIC chip After receiving the inbound packet, the NP/ASIC chip searches for the TCAM entry based on the packet header. If the matching entry is found, the TCAM returns the address information of the entry. (The address information has a higher priority). After that, the NP/ASIC chip will query the corresponding user data information (such as the outbound port information of the packet) according to the address information of the entry, and the NP/ASIC chip obtains the complete user data information, according to the user. The data information re-encapsulates the data packet, and then forwards the packet through the network port.
  • the NP/ASIC chip After receiving the inbound packet, the NP/ASIC chip searches for the TCAM entry based on the packet header. If the matching entry is found, the TCAM returns the address information of the entry. (The address information has a higher priority
  • the performance requirements of the device for the NP/ASIC chip and the TCAM chip are relatively high.
  • the packet header information received by the port often has a large bit width, such as the source IP address (SIP, Source IP) in Internet Protocol Version 6 (IPV6, Internet Protocol Version 6).
  • the data width of the destination IP address (DIP, Destination IP) is 128 bits, and the bit width of the following table in the specific ACL search mode will exceed 500 bits. Therefore, when using a single TCAM chip, the chip needs to support larger data. Bit width.
  • the capacity requirements for the entries also increase, which also requires TCAM to have a larger storage capacity.
  • the TCAM with large bit width and high capacity often has very high power consumption, which has very high requirements on the power consumption and heat dissipation capability of the product.
  • the TCAM with large bit width and high capacity is often expensive, and also brings the product. Huge cost pressure.
  • the TCAM chip For the NP/ASIC chip, each time the message is forwarded, the TCAM chip needs to be searched first. After obtaining the highest priority address, the address is converted into the address corresponding to the corresponding entry of the External RAM, and then the corresponding address of the external RAM is read according to the address of the corresponding entry of the external RAM.
  • the content of the entry therefore, the NP/ASIC chip needs high-speed search and message processing capability in the high-speed forwarding process of the message, and the NP/ASIC chip with high-speed processing capability is generally very large, and the price is very expensive.
  • the embodiment of the present disclosure provides a table lookup method and device, which can implement a fast search operation of a data message by using a TCAM chipset with a low data bit width. Further, the NP/ASIC chip can also be used to send a search command. Directly return the required user data information, so as to quickly find the header information.
  • FIG. 2 is a structural diagram of implementing a look-up table according to an embodiment of the present disclosure.
  • the architecture of the embodiment of the present disclosure mainly includes the following modules:
  • the NP module refers to the NP/ASIC chip, and the NP module supports the table item search operation of the external TCAM control module.
  • the NP module and the external TCAM control module are connected by a high speed bus interface.
  • the TCAM control module includes: a packet parsing module, a TCAM Transmit module, a TCAM Receive module, an address transfer module, and a memory control ( Memory Controller) module.
  • the TCAM control module is connected to the TCAM chipset. In practical applications, the TCAM control module can be designed as an integral module with the TCAM chipset.
  • TCAM chipset contains multiple pieces of the same type of TCAM chip, wherein the TCAM chip can be selected according to the longest entry keyword to be searched for the message and the selected TCAM chip bit width, chip cost and chip work. The cost is determined, and the TCAM chipset with the lowest cost and power consumption is sought under the premise of ensuring the performance requirements of the look-up table.
  • the External RAM module stores the user data information of the user, and the user data information has a one-to-one correspondence with the contents of the entries in the TCAM chipset.
  • the TCAM control module is a core module, and the TCAM control module can receive an entry query request message sent by the NP module, and query the request message according to the entry in the TCAM chipset and the External.
  • the table entry search operation is performed in the RAM module, and the user data information required for packet forwarding is directly returned after the search is completed.
  • the TCAM control module mainly includes a Packet Parsing module, an Index transfer module, a TCAM Transmit module, and a TCAM Receive module.
  • the working principle of the TCAM control module includes the following two methods:
  • Method 1 The NP module performs an entry search operation:
  • the Packet Parsing module receives the entry query request packet through the high-speed bus interface of the NP module, and searches the packet control field in the request packet by parsing the entry, and identifies the operation type field as the entry search operation, and identifies the
  • the TCAM chip ID field is forwarded to the corresponding TCAM chip by the TCAM Transmit module according to the TCAM Transmit module to perform an entry search operation.
  • the packet transmitted by the high-speed bus interface (such as the query request packet) includes two parts: a packet control field and a packet data field, where the packet data field carries the entry keyword and the user data information. And the entry query status flag, etc.; the message control field contains the following specific fields:
  • the operation type field indicates the operation type of the packet.
  • the operation type field corresponding to the query request packet is an entry search operation
  • the operation type field corresponding to the write request packet is a write table entry operation and a read table.
  • the operation type field corresponding to the item request message is the operation of the table entry
  • the operation type field corresponding to the entry deletion request message is the entry deletion operation.
  • SOP Start Of Packet
  • EOP End Of Packet
  • the TCAM chip ID field is configured to distinguish different TCAM chips in the TCAM chipset.
  • the NP module needs to split the keyword of the long data bit width into the short bit width keywords satisfying the TCAM chip support bit width according to the number of TCAM chips when publishing the item query request message.
  • the short bit width keywords are encapsulated into table entry query request messages and interleaved to the Packet Parsing module, which is parsed by the Packet Parsing module and then sent to the TCAM Transmit module.
  • the NP module needs to query the long bit width keyword is key0 and key0 can be split into short keywords key1 according to the bit width of the TCAM chip.
  • the NP module encapsulates key1 and key2 into the packet data fields of the two-item query request packets with different TCAM chip ID fields, and sends them to Packet Parsing in turn. Module.
  • the SOP field and the EOP field in the message control field of the request query message can be distinguished by using the SOP field and the EOP field in the message control field of the entry query request message, in particular, to identify the combination of the two request entries with the key1 and the key2.
  • the format of the packet group is shown in Table 1, where ctrl wd represents the packet control field, and data wd represents the packet data field:
  • the shaded part represents the query request message of the key1
  • the gray part represents the query request message of the key2.
  • the query response message is returned to the TCAM Receive module of the TCAM control module.
  • Index1, index2 ⁇ also includes the TCAM chip ID corresponding to the entry query request message and the keyword information key1, key2.
  • the TCAM Receive module returns the query response packets of all the TCAM chips to the Packet Parsing module through the internal interface.
  • the Index Transfer module has an address translation function, which translates the highest priority address (ie, index) where the query result entry is located into the physical address of the External RAM, and returns it to the Packet Parsing module. If the index returned by the TCAM chip does not have a corresponding physical address, the return value of the Index Transfer module is null, indicating that the entry has not been established before the NP module, and the search fails. If the return value is non-null, the Packet Parsing module confirms that there is a valid physical address and sends a read request containing the physical address to the Memory Controller module based on the return value.
  • the Memory Controller module can be integrated inside the TCAM control module or integrated inside the NP module.
  • the Packet Parsing module encapsulates the index corresponding to the key value and the physical address of the External RAM into a query response message recognized by the NP module, and returns it to the NP module through the high-speed bus interface, and then the NP module.
  • the module reads the user data information corresponding to the physical address in the External RAM.
  • the TCAM control module can directly integrate the Memory Controller module (as shown in Figure 2).
  • the Memory Controller module can receive the Packet Parsing module or the Index Transfer module through the internal bus of the TCAM control module. Returning the physical address and reading the user data information corresponding to the physical address in the External RAM.
  • the Memory Controller module is configured as a burst read/write mode, and the burst read and write length is the user data information corresponding to the entry. The length is determined.
  • the Memory Controller module After reading the corresponding user data information in the external RAM, the Memory Controller module returns to the Packet Parsing module, and the Packet Parsing module repackages the user data information and the corresponding key value into the query response message identified by the NP module, and passes the high speed.
  • the bus interface is returned to the NP module, wherein the user data information and the corresponding key value are filled in the message data field in the query response message, and the specific format of the message data field can be customized by the user.
  • the NP module completes an entry search process.
  • Method 2 The NP module performs a table entry operation:
  • the NP module Before the NP module writes the entry, it first determines whether the content of the current entry already exists through the query entry. If it exists, cancels the operation of writing the entry. The NP module performs the write entry only when the TCAM control module does not query the entry. The NP module writes the entry to the TCAM control module to provide the key (key value) information of the write table entry and the corresponding physical address information. When the Memory Controller module is integrated for the TCAM control module as needed, the Memory Controller module is also required to be used. The External RAM module writes user data information. The Key value is stored in the TCAM chipset.
  • the software running by the NP module records the position of the last write entry, that is, the index value, and writes the index and the corresponding physical address into the Index Transfer module in a table correspondence relationship.
  • the TCAM chipset composed of two TCAM chips is taken as an example. The principle of describing the operation of writing a table entry is as follows:
  • the NP module Before the NP module writes the entry, it first determines whether the content of the current entry already exists through the query entry. The process of querying the entry is still performed according to the mode 1. When the TCAM control module does not query the key 0 of the entry, the returned query The invalid bit in the data field in the response message is set to 1 to indicate that the entry does not exist. The Packet Parsing module will return the query response message to the NP module only if none of the TCAM chips in the TCAM chipset are hit. Invalid position 1, the NP module judges that the entry does not exist, and then writes the entry.
  • the Packet Parsing module receives the write entry request message through the high-speed bus interface of the NP module, and determines the write request request message by writing the request message by parsing the opcode field value in the received write entry request message.
  • the text is still written as a user data request message.
  • the message control field contains the ID of the TCAM chip
  • the message data field contains the keyword information and the corresponding Index.
  • the Packet Parsing module writes the keyword information to the corresponding TCAM chip through the TCAM Transmit module according to the ID of the TCAM chip, and then the TCAM Receive module returns a write entry response message to the Packet Parsing module to indicate whether the write is successful.
  • the message control field contains the ID of the Memory Controller module, which points to the Memory Controller module, and the message data field contains the user data information and the corresponding physical address.
  • the Packet Parsing module writes the user data information to the External RAM through the Memory Controller module according to the address, and then notifies the Packet Parsing module that the writing is completed.
  • the Packet Parsing module writes the index corresponding to the key value and the physical address corresponding to the user data into the Index Transfer module in a one-to-one correspondence. This correspondence is generally stored in the Index Transfer module in a tabular form. After the index transfer module is written, the internal interface is notified to the Packet Parsing module to trigger the write entry response message to the NP module.
  • the NP module completes the process of delivering the entry.
  • FIG. 3 is a schematic flowchart of a table lookup method according to an embodiment of the present disclosure. As shown in FIG. 3, the table lookup method includes the following steps:
  • Step 301 When receiving the packet and determining that the packet is an entry query request packet, the query request packet is parsed to obtain the ID information of the TCAM chip.
  • the message includes a message control field and a message data field
  • the message control field includes at least one of the following: an operation type field, a message start field, a message end field, a chip ID field, and a user-defined field;
  • the message data field includes at least one of the following: an entry key field, a user data information field, and an entry query status field.
  • the packet control field of the packet is parsed
  • the chip ID field in the message control field of the packet is parsed to obtain ID information of the TCAM chip.
  • the Query Request message is sent by the NP module, where the number of the Query Requests sent by the NP module is more than one, and the one or more entries are queried.
  • the text corresponds to a packet group, and the keywords carried in the request packet of each entry in the packet group constitute a keyword to be queried.
  • Step 302 Send the entry query request message to the corresponding TCAM chip to perform an entry search operation according to the ID information of the TCAM chip.
  • Step 303 Receive an entry search result sent by the TCAM chip, where the entry search result carries an entry identifier; and convert the entry identifier to a corresponding physical address in the storage module.
  • the result of the entry sent by the TCAM chip carries the ID of the TCAM chip and the keyword information
  • the entry result in the entry is The carried entry identifier is converted to the corresponding physical address in the storage module.
  • Step 304 Query user data information in the storage module according to the physical address.
  • the method further includes: encapsulating the user data information and the corresponding keyword into a query response message; and sending the query response message to the NP module.
  • the method further includes:
  • the request packet of the write entry is parsed to determine the type of the request packet of the write entry;
  • the write entry request message is a write keyword request message, parsing the message control field and the message data field of the write keyword request message to obtain ID information and keyword information of the TCAM chip. And the item identification information; and the parsed keyword information is written into the corresponding TCAM chip according to the ID information of the TCAM chip;
  • the write entry request message is a write user data request message, parsing the message control field and the message data field of the write keyword request message, and obtaining the ID information and the user data of the memory control module.
  • Information, physical address information; the user data information is written in the storage module by the memory control module according to the physical address information.
  • the method further includes:
  • the TCAM chipset includes two TCAM chips as an example.
  • the number of TCAM chips actually used is determined by the key word width of the NP module and the TCAM chip width.
  • the Interlaken Look-Aside interface can be used for the high-speed bus interface.
  • the Interlaken Look-Aside interface is widely used in network devices such as search engines, policy engines, message counting engines, and traffic schedulers and main service packet processing. Service message interaction interface between devices.
  • the Interlaken Look-Aside interface uses the Interlaken Look-Aside protocol.
  • the Interlaken Look-Aside protocol (ILKA-LA for short) is the Interlaken Alliance for the development of message interaction between the main service processor of the network device and the message processing unit.
  • ILKA-LA Interlaken Alliance for the development of message interaction between the main service processor of the network device and the message processing unit.
  • a set of protocol standards that are particularly applicable to event-triggered fast packet transitions by simplifying the Interlaken protocol (eg, simplifying logical channels, flow control features, etc.).
  • the TCAM chip in the embodiment of the present disclosure supports an entry query operation based on the ILKA-LA interface.
  • the Interlaken Look-Aside interface (ILKN-LA interface for short) is used as a high-speed bus interface between the NP module and the TCAM control module.
  • the ILKA-LA interface performs control and data packets in 66-bit encoding mode.
  • the message control field field can be defined in the format shown in Table 2.
  • Bit Pos indicates the position of the bit and Field indicates the field.
  • the opcode[5:0] field is the operation type field.
  • the chip ID[1:0] field is the TCAM chip ID field, and the latter TCAM Transmit module can forward the message to the corresponding TCAM chip according to the TCAM chip ID.
  • the Packet Parsing module and the TCAM Receive module can also identify the TCAM from the TCAM based on the TCAM chip ID. Which TCAM chip the ILKN-LA message received on the interface comes from.
  • the ILA field is associated with the ILKA-LA interface protocol layer and is defined by the protocol standard.
  • the user defined field is a user-defined field.
  • the specific defined content is related to the instruction format supported by the TCAM chip. For example, Netlogic's NL11K series TCAM chip, the user defined field is defined as follows:
  • the NP chip needs to split the long data bit width keyword into the short bit width keyword satisfying the TCAM chip support bit width according to the number of TCAM chips when publishing the item query request message.
  • the short bit width keywords are respectively encapsulated into table entry query request messages and interleaved to the Packet Parsing module, which is parsed by the Packet Parsing module and then sent to the TCAM Transmit module.
  • the TCAM control module directly integrates the Memory Controller module.
  • FIG. 4 is a schematic diagram of an entry query process according to an embodiment of the present disclosure. As shown in FIG. 4, the process includes the following steps:
  • Step 401 When the NP module needs to perform an entry query operation, the item query request message is published in the format of Table 3.
  • the performance query request message is a message group, and the message group includes the query item key.
  • Key0 ⁇ key1,key2 ⁇ .
  • Step 402 The Packet Parsing module receives a complete packet group through the ILKN-LA interface and performs a parsing operation.
  • Step 403 The Packet Parsing module determines whether to query the request message for the entry according to the opcode[5:0] field in the message control field. If yes, go to step 405. Otherwise, go to step 404.
  • Step 404 After the non-event entry query request message is determined, the operation process corresponding to the opcode[5:0] field is processed. For example, if it is determined that the table entry operation is performed, it is processed according to the flow of the write table entry operation.
  • Step 405 The Packet Parsing module extracts the control field information such as the key information key1, key2 and the chip ID corresponding to each key from the entry query request message, and sends the control field information to the TCAM Transmit module, and the module corresponds to the ILKN according to the chip ID.
  • the LA message is forwarded to the corresponding TCAM chip for entry query.
  • the query response message further includes a chip ID corresponding to the TCAM chip and search keyword information key1, key2.
  • Step 407 The TCAM Receive module determines whether the query result is valid according to the valid field in the response packet. If invalid, step 408 is performed; if yes, step 409 is performed.
  • Step 408 The TCAM Receive module instructs the Packet Parsing module to query the miss through the internal interface, and then performs step 410.
  • Step 410 The Packet Parsing module sends a response message of the query miss to the NP module through the ILKN-LA interface.
  • Step 409 The TCAM Receive module returns the query result of the TCAM chipset to the Packet Parsing module through the internal interface.
  • Step 411 The Packet Parsing module compares the key information key1 and key2 in the query response message with the key value in the previously recorded query request message, and after performing the same, step 413 is performed; otherwise, step 412 is performed.
  • Step 412 It is determined that the key value of the query request does not correspond to the key value of the TCAM return query, indicating that an error occurs during the query, and the Packet Parsing module notifies the NP module of the query error status, and the error is performed by the software running by the NP module. , such as determining whether to re-query the item under key0.
  • Step 414 The Index Transfer module determines whether the Index returned by the Packet Parsing has a corresponding physical address by using the internal lookup table result. If not, step 415 is performed, and if yes, step 416 is performed.
  • Step 415 The Packet Parsing module sends a query response message to the NP chip, and the user data field in the message is indicated as invalid.
  • Step 416 The Index Transfer module returns the physical address corresponding to the Index, and the Packet Parsing module sends the read request of the physical address to the Memory Controller module.
  • the Memory Controller module reads the user data information corresponding to the physical address in the External RAM module according to the configuration. Generally, the burst read and write method is adopted.
  • Step 417 The Memory Controller module returns the corresponding user data information in the External RAM to the Packet Parsing module, and the Packet Parsing module re-encapsulates the user data information and the corresponding key value into an ILKN-LA query response message, and passes the ILKN.
  • the -LA interface is returned to the NP module, and the NP module completes an entry search process.
  • FIG. 5 is a schematic diagram of a process for delivering an entry according to an embodiment of the present disclosure. As shown in FIG. 5, the process includes the following steps:
  • Step 501 When the NP module needs to perform the operation of sending the entry, it is necessary to determine whether the entry corresponding to the keyword already exists in the TCAM chipset. Therefore, the entry query operation is required, and the query is completed and then enters 502.
  • Step 502 The NP module determines whether the query result is empty. If the hit is successful, the entry does not need to be sent. Therefore, step 503 is performed to cancel the current delivery operation, otherwise step 504 is performed.
  • Step 503 The entry has been deleted, and the operation of sending the entry is cancelled.
  • Step 504 The NP module sends a write request message through the ILKN-LA interface, and the write request message is a packet group.
  • the format of the packet group is as shown in Table 4:
  • Step 505 The Packet Parsing module parses the received write entry request message.
  • Step 506 Determine whether the write request message is a write keyword request message or a write user data request message. If the request message is a write keyword request message, step 513 is performed; otherwise, step 507 is performed.
  • Step 507 When the Packet Parsing module parses out that the user data request message is written, the process proceeds to step 509. Otherwise, it is determined to be another operation request, and step 508 is performed.
  • Step 508 Process the corresponding process according to other operations.
  • Step 509 For the write user data request message, the chip ID points to the Memory Controller module, and the Packet Parsing module sends the user data information to be written together with the physical address of the RAM to the Memory Controller module, and the module writes the user data information.
  • the physical address location in the External RAM is entered, and then step 510 is performed.
  • Step 510 The Memory Controller module determines whether the external RAM is successfully written. If the write is successful, step 512 is performed, that is, the internal state indication signal is fed back to the Packet Parsing module for a successful write state, otherwise step 511 is executed to indicate that the write error is abnormal.
  • Step 511 Instructing a write exception error.
  • Step 512 The internal state indication signal is fed back to the Packet Parsing module to write a successful state.
  • Step 513 The Packet Parsing module extracts the keyword information key1, key2 and the index position information written by each key in the TCAM chip from the write entry request message, and sends the control field information such as the corresponding chip ID to the TCAM Transmit module.
  • Step 514 is performed by the module to perform an entry writing process.
  • Step 514 The TCAM Transmit module performs an entry writing process.
  • Step 515 After the entry is successfully written, the Packet Parsing module receives the write entry response message through the TCAM Receive module, and determines whether the entry is successfully written. If the write succeeds, step 517 is performed; otherwise, step 516 is performed.
  • Step 516 The Packet Parsing module feeds back the abnormal response message of the entry through the ILKN-LA interface, and the software running by the NP module determines the subsequent processing, such as whether to rewrite the entry.
  • Step 517 After the entry keyword and the user data information are successfully written, the Packet Parsing module writes the index corresponding to the key and the physical address corresponding to the user data into the Index Transfer module in a one-to-one correspondence. Saved in the form of a table in the Index Transfer module.
  • Step 518 After the index transfer module is written, the internal packet is notified to the Packet Parsing module to trigger the write of the entry response message to the NP module.
  • the NP module completes the process of delivering the entry.
  • FIG. 6 is a schematic structural diagram of a table look-up device according to an embodiment of the present disclosure. As shown in FIG. 6, the device includes:
  • the parsing unit 61 is configured to: when receiving the packet and determining that the packet is an entry query request packet, parsing the request query packet to obtain the ID information of the TCAM chip;
  • the sending unit 62 is configured to send the entry query request message to the corresponding TCAM chip to perform an entry search operation according to the ID information of the TCAM chip.
  • the receiving unit 63 is configured to receive an entry search result sent by the TCAM chip, where the entry search result carries an entry identifier
  • the address conversion unit 64 is configured to convert the entry identifier into a corresponding physical address in the storage module.
  • the memory control unit 65 is configured to query the user data information in the storage module according to the physical address.
  • the message includes a message control field and a message data field
  • the message control field includes at least one of the following: an operation type field, a message start field, a message end field, a chip ID field, and a user-defined field;
  • the message data field includes at least one of the following: an entry key field, a user data information field, and an entry query status field.
  • the parsing unit 61 is further configured to parse the packet control field of the packet when the packet is received; if the operation type field in the packet control field is parsed as a table The item search operation determines that the received message is an entry query request message.
  • the parsing unit 61 is further configured to parse the chip ID field in the packet control field of the packet to obtain ID information of the TCAM chip.
  • the parsing unit 61 is further configured to receive an entry query request message sent by the NP module, where the number of the entry query request messages sent by the NP module is more than one,
  • the one or more entry query request message corresponds to a message group, and the keywords carried in the query request message of each entry in the message group constitute a keyword to be queried.
  • the result of the entry sent by the TCAM chip carries the ID of the TCAM chip and the keyword information
  • the address translation unit 64 The identifier of the entry carried in the search result of the entry is converted to the corresponding physical address in the storage module.
  • the device further includes:
  • the encapsulating unit 66 is configured to encapsulate the user data information and the corresponding keyword into a query response message, and send the query response message to the NP module.
  • the parsing unit 61 is further configured to: when receiving the write entry request message, parse the write request message, and determine the type of the write request message;
  • the write entry request message is a write keyword request message, and parsing the message control field and the message data field of the write keyword request message to obtain ID information and keyword information of the TCAM chip, Entry identification information;
  • the sending unit 62 is further configured to write the parsed keyword information into the corresponding TCAM chip according to the ID information of the TCAM chip;
  • the parsing unit 61 is further configured to parse the message control field and the packet data field of the write keyword request message if the write entry request message is a write user data request message, ID information and user data information and physical address information of the memory control module;
  • the memory control unit 65 is further configured to write the user data information in the storage module according to the physical address information.
  • the address conversion unit 64 is further configured to store the entry corresponding to the keyword information and the physical address corresponding to the user data information according to the corresponding relationship.
  • the implementation functions of the units in the look-up table device shown in FIG. 6 can be understood by referring to the related description of the foregoing table look-up method.
  • the functions of the units in the look-up table device shown in FIG. 6 can be realized by a program running on a processor, or can be realized by a specific logic circuit.
  • the look-up table device shown in FIG. 6 can be implemented by a TCAM control module, wherein the parsing unit 61 and the encapsulating unit 66 are integrated in a Packet Parsing module, the transmitting unit 62 is integrated in a TCAM Transmit module, and the receiving unit 63 is integrated.
  • the address conversion unit 64 is integrated in the Index Transfer module, and the memory control unit 65 is integrated in the Memory Controller module.
  • each unit in the look-up table device may be implemented by a central processing unit (CPU) or a microprocessor (MPU, Micro Processor Unit) located in the meter reading device. Or digital signal processor (DSP, Digital Signal Processor), or Field Programmable Gate Array (FPGA) implementation.
  • CPU central processing unit
  • MPU Micro Processor Unit
  • DSP Digital Signal Processor
  • FPGA Field Programmable Gate Array
  • Embodiments of the Invention can also be stored in a computer readable storage medium if it is implemented in the form of a software function module and sold or used as a stand-alone product. Based on such understanding, the technical solution of the embodiments of the present invention may be embodied in the form of a software product in essence or in the form of a software product stored in a storage medium, including a plurality of instructions.
  • a computer device (which may be a personal computer, server, or network device, etc.) is caused to perform all or part of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read only memory (ROM), a magnetic disk, or an optical disk.
  • program codes such as a USB flash drive, a mobile hard disk, a read only memory (ROM), a magnetic disk, or an optical disk.
  • an embodiment of the present invention further provides a computer storage medium, wherein a computer program is configured, and the computer program is configured to perform a table lookup method according to an embodiment of the present invention.
  • the disclosed method and smart device 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 disclosure may be integrated into one second processing unit, or each unit may be separately used as one unit, or two or more units may be integrated into one unit;
  • the above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional units.
  • the technical solution of the embodiment of the present disclosure when receiving the packet and determining that the packet is an entry query request packet, parsing the request query packet to obtain the ID information of the TCAM chip;
  • the ID information of the TCAM chip sends the entry query request message to the corresponding TCAM chip to perform an entry search operation; and receives an entry search result sent by the TCAM chip, where the entry search result carries the entry identifier Translating the entry identifier into a corresponding physical address in the storage module; and querying the user data information in the storage module according to the physical address.
  • the TCAM chip with lower data bit width can be used to implement the lookup table key keyword in combination, which reduces the power consumption and hardware cost of the TCAM while ensuring the search performance.
  • the embodiment of the present disclosure can directly return the user data information after publishing the item query request message under the NP module by integrating the address conversion module (implementing the conversion of the TCAM address and the physical address of the external RAM) and the extended/integrated memory control module ( For example, the outbound port, the link layer physical address, and the like, the packet header information is quickly searched, and the packet processing load of the NP module is also reduced, which is helpful for the power consumption design of the NP module.
  • the address conversion module implementing the conversion of the TCAM address and the physical address of the external RAM
  • the extended/integrated memory control module For example, the outbound port, the link layer physical address, and the like, the packet header information is quickly searched, and the packet processing load of the NP module is also reduced, which is helpful for the power consumption design of the NP module.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本公开公开了一种查表方法及装置、计算机存储介质,所述方法包括:接收到报文并确定出所述报文为表项查询请求报文时,对所述表项查询请求报文进行解析,得到TCAM芯片的ID信息;根据所述TCAM芯片的ID信息,将所述表项查询请求报文发送给相应的TCAM芯片进行表项查找操作;接收所述TCAM芯片发送的表项查找结果,所述表项查找结果携有表项标识;将所述表项标识转换为存储模块中对应的物理地址;依据所述物理地址,在存储模块中查询用户数据信息。

Description

一种查表方法及装置、计算机存储介质
相关申请的交叉引用
本申请基于申请号为201710273440.8、申请日为2017年04月21日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。
技术领域
本公开涉及数据通信领域,尤其涉及一种基于三态内容可寻址存储器(TCAM,Ternary Content Addressable Memory)的查表方法及装置、计算机存储介质。
背景技术
TCAM是一种专用的三态内容可寻址存储器,通过TCAM可以进行大量的并行搜索。利用TCAM对关键字进行搜索时,TCAM中所有的表项会同时与关键字进行匹配,得到的搜索结果就是匹配项的物理地址。在进行条目匹配时,条目的每个比特(bit)可以是0、1、X三种状态,如果是X则表示该bit不参与比较且默认结果为成功,否则关键字将和条目的内容进行比较,如果匹配成功则返回成功,如果匹配失败则返回失败。TCAM的快速匹配特性被广泛用于路由表的路由查找以及访问控制列表(ACL,Access Control List)的规则匹配。
路由器、交换机等数据通信设备使用TCAM进行报文转发时,需要通过网络处理器(NP,Network Processor)/专用集成电路(ASIC,Application Specific Integrated Circuits)芯片、TCAM芯片以及外部随机存取存储器(External RAM,External Random-Access Memory)模块来实现,然而,目 前的实现过程对NP/ASIC芯片以及TCAM芯片的性能要求都比较高,这对于产品的电源功耗、以及散热能力有着非常高的要求,而且给产品带来了巨大的成本压力。
发明内容
为解决上述技术问题,本公开实施例提供了一种查表方法及装置、计算机存储介质。
本公开实施例提供的查表方法,包括:
接收到报文并确定出所述报文为表项查询请求报文时,对所述表项查询请求报文进行解析,得到TCAM芯片的ID信息;
根据所述TCAM芯片的ID信息,将所述表项查询请求报文发送给相应的TCAM芯片进行表项查找操作;
接收所述TCAM芯片发送的表项查找结果,所述表项查找结果携有表项标识;将所述表项标识转换为存储模块中对应的物理地址;
依据所述物理地址,在存储模块中查询用户数据信息。
本公开实施例提供的查表装置,包括:
解析单元,配置为接收到报文并确定出所述报文为表项查询请求报文时,对所述表项查询请求报文进行解析,得到TCAM芯片的ID信息;
发送单元,配置为根据所述TCAM芯片的ID信息,将所述表项查询请求报文发送给相应的TCAM芯片进行表项查找操作;
接收单元,配置为接收所述TCAM芯片发送的表项查找结果,所述表项查找结果携有表项标识;
地址转换单元,配置为将所述表项标识转换为存储模块中对应的物理地址;
存储器控制单元,配置为依据所述物理地址,在存储模块中查询用户数据信息。
本公开实施例还提供一种计算机存储介质,该计算机存储介质存储有计算机程序,该计算机程序配置为执行上述查表方法。
本公开实施例的技术方案中,接收到报文并确定出所述报文为表项查询请求报文时,对所述表项查询请求报文进行解析,得到TCAM芯片的ID信息;根据所述TCAM芯片的ID信息,将所述表项查询请求报文发送给相应的TCAM芯片进行表项查找操作;接收所述TCAM芯片发送的表项查找结果,所述表项查找结果携有表项标识;将所述表项标识转换为存储模块中对应的物理地址;依据所述物理地址,在存储模块中查询用户数据信息。可以利用较低数据位宽的TCAM芯片通过组合的方式实现查找表项关键字,在保证查找性能的前提下降低了TCAM的功耗和硬件成本。此外,本公开实施例通过集成地址转换模块(实现TCAM地址和外部RAM的物理地址的转换)以及扩展/集成存储器控制模块,可以在NP模块下发表项查询请求报文后直接返回用户数据信息(如出端口、链路层物理地址等),从而实现了报文头信息的快速查找,也减轻了NP模块的报文处理负担,对于NP模块的降功耗设计具有很大帮助。
附图说明
图1为基于TCAM的路由器/交换机设备实现查表的架构图;
图2为本公开实施例实现查表的架构图;
图3为本公开实施例的查表方法的流程示意图;
图4为本公开实施例的表项查询流程示意图;
图5为本公开实施例的表项下发流程示意图;
图6为本公开实施例的查表装置的结构组成示意图。
具体实施方式
为了能够更加详尽地了解本公开实施例的特点与技术内容,下面结合 附图对本公开实施例的实现进行详细阐述,所附附图仅供参考说明之用,并非用来限定本公开实施例。
路由器、交换机等数据通信设备使用TCAM进行报文转发的查表操作,图1为基于TCAM的路由器/交换机设备实现查表的架构图,如图1所示,电路逻辑构成主要包括:NP/ASIC芯片,TCAM芯片以及External RAM模块。NP/ASIC芯片通过端口(如port1、port2)接收到入向报文后会根据报文头信息进行TCAM表项查找,如果查找到匹配的表项,则TCAM会返回该表项所在的地址信息(该地址信息有较高优先级)。之后,NP/ASIC芯片会根据表项所在的地址信息去External RAM模块查询对应的用户数据信息(如报文的出端口信息等),NP/ASIC芯片获得完整的用户数据信息后,根据该用户数据信息将数据报文重新封装,再通过网络端口将报文转发出去。
通过上述查表转发过程可以看出,设备对NP/ASIC芯片以及TCAM芯片的性能要求都比较高。对于TCAM芯片来说,通过端口接收到报文的报文头信息往往存在较大位宽,如互联网协议版本6(IPV6,Internet Protocol Version 6)中的报文源IP地址(SIP,Source IP)和目的IP地址(DIP,Destination IP)的数据位宽各为128bit,而在特定ACL查找模式下表项位宽将超过500bit,因此,使用单片TCAM芯片时需要该芯片能够支持较大的数据位宽。同时,由于用户数的不断增多,对于表项的容量要求也随之增加,这也要求TCAM有着更大的存储容量。而大位宽、高容量的TCAM往往功耗非常高,对于产品的电源功耗、以及散热能力有着非常高的要求;另外大位宽、高容量的TCAM往往价格昂贵,也给产品带来了巨大的成本压力。
对于NP/ASIC芯片来说,每次报文转发都需要先查找TCAM芯片,获得最高优先级地址后将该地址转换成对应External RAM相应条目的地址,再根据外部RAM相应条目的地址读取相应条目的内容,因此,在报文高速 转发过程中需要NP/ASIC芯片具有高速查找及报文处理能力,而具有高速处理能力的NP/ASIC芯片功耗一般都非常大,而且价格非常昂贵。
基于此,本公开实施例提出了一种查表方法及装置,可以利用低数据位宽的TCAM芯片组实现数据报文的快速查找操作,进一步,还可以实现NP/ASIC芯片下发查找指令后直接返回需要的用户数据信息,从而实现报文头信息的快速查找。
图2为本公开实施例实现查表的架构图,本公开实施例的架构主要包括以下模块:
NP模块,NP模块是指NP/ASIC芯片,NP模块支持外挂的TCAM控制模块的表项查找操作,在一实施方式中,NP模块和外挂的TCAM控制模块之间通过高速总线接口连接。
TCAM控制模块,TCAM控制模块包括:数据包解析(Packet Parsing)模块、TCAM发送(TCAM Transmit)模块、TCAM接收(TCAM Receive)模块、地址转换(Index Transfer)模块,此外,还可以包括存储器控制(Memory Controller)模块。TCAM控制模块与TCAM芯片组连接,实际应用中,TCAM控制模块可以与TCAM芯片组设计成一个整体模块。
TCAM芯片组,TCAM芯片组包含了多片相同类型的TCAM芯片,其中,TCAM芯片的选取可以依据报文所要查找的最长表项关键字以及所选取的TCAM芯片位宽、芯片成本和芯片功耗确定,在保证查表性能要求的前提下寻求成本和功耗最低的TCAM芯片组。
External RAM模块,External RAM模块保存了用户的用户数据信息,该用户数据信息和TCAM芯片组中的表项内容为一一对应的关系。
在如图2所示的架构中,TCAM控制模块为核心模块,TCAM控制模块可以接收NP模块发来的表项查询请求报文,并根据该表项查询请求报文分别在TCAM芯片组以及External RAM模块中进行表项查找操作,查找完 成后直接返回报文转发所需要的用户数据信息。在TCAM控制模块中,主要包括Packet parsing模块、Index transfer模块、TCAM Transmit模块和TCAM Receive模块,TCAM控制模块的工作原理包括以下两种方式:
方式一、NP模块进行表项查找操作:
Packet Parsing模块通过NP模块的高速总线接口接收到表项查询请求报文,通过解析表项查询请求报文中的报文控制字段,识别其中的操作类型字段为表项查找操作,同时识别其中的TCAM芯片ID字段,并将该表项查询请求报文通过TCAM Transmit模块依据TCAM芯片ID字段转发给对应的TCAM芯片进行表项查找操作。上述方案中,高速总线接口传输的报文(如所述表项查询请求报文)包括报文控制字段和报文数据字段两部分,其中,报文数据字段携带表项关键字、用户数据信息及表项查询状态标志等;报文控制字段包含如下具体的字段:
1、操作类型字段,表示报文的操作类型,如表项查询请求报文对应的操作类型字段为表项查找操作,写表项请求报文对应的操作类型字段为写表项操作、读表项请求报文对应的操作类型字段为读表项操作、表项删除请求报文对应的操作类型字段为表项删除操作等。
2、报文起始(SOP,Start Of Packet)字段和报文结束(EOP,End Of Packet)字段,用以构成并区分一次完整的报文。
3、TCAM芯片ID字段,配置为区分TCAM芯片组中不同的TCAM芯片。
4、用户自定义字段,具体定义的内容与TCAM芯片支持的报文格式相关。
由于单个TCAM芯片数据位宽有限,NP模块在下发表项查询请求报文时需要将长数据位宽的关键字按TCAM芯片数量拆分成满足TCAM芯片支持位宽的短位宽关键字,再将短位宽关键字分别封装成表项查询请求报 文并交错传输至Packet Parsing模块,由Packet Parsing模块解析后再发送给TCAM Transmit模块。
本公开以下实施例以TCAM芯片组包含两个TCAM芯片为例进行解释说明,当NP模块需要查询的长位宽关键字为key0并且key0可以按TCAM芯片的位宽拆分为短关键字key1、key2,即key0={key1,key2},则NP模块分别将key1、key2封装至带有不同TCAM芯片ID字段的两个表项查询请求报文的报文数据字段中,并依次发送给Packet Parsing模块。为了标识带有key1、key2的两个表项查询请求报文属于一次查找命令的报文组合,可以利用表项查询请求报文的报文控制字段中的SOP字段和EOP字段加以区分,具体地,构成key0的报文组前两个报文的报文控制字段中的SOP=1、EOP=0,表示报文组发送开始;构成key0的报文组最后两个报文的报文控制字段中的SOP=0、EOP=1,表示报文组结束。报文组的格式如表1所示,其中,ctrl wd表示报文控制字段,data wd表示报文数据字段:
Figure PCTCN2018084119-appb-000001
表1
如表1所示,阴影部分代表key1所在的表项查询请求报文,灰色部分代表key2所在的表项查询请求报文。Packet Parsing模块识别并接收到一个完整的报文组后提取其中的TCAM芯片ID字段和对应的关键字信息(key1、key2)并记录下来,随后将报文组通过内部接口发送给TCAM Transmit模块,TCAM Transmit模块根据TCAM芯片ID将表项查询请求报文分别发送至相应的TCAM芯片。
当各TCAM芯片完成表项查找操作后,将查询响应报文返回给TCAM控制模块的TCAM Receive模块,这里,查询响应报文中包含查询结果表项(记录有用户数据信息)所在的index={index1,index2},还包含表项查询 请求报文对应的TCAM芯片ID以及关键字信息key1、key2。TCAM Receive模块将所有TCAM芯片的查询响应报文通过内部接口返回给Packet Parsing模块,Packet Parsing模块首先将查询响应报文中的关键字信息key1、key2与之前记录的表项查询请求报文中的key值进行对比,确定相同后再将index={index1,index2}信息发送给Index Transfer模块进行地址翻译。
Index Transfer模块具有地址翻译功能,主要将查询结果表项所在的具有最高优先级地址(即index)翻译成External RAM的物理地址,并返回给Packet Parsing模块。如果TCAM芯片返回的index无对应的物理地址,则Index Transfer模块返回值为null,表明NP模块之前并未建立过该表项,查找失败。如返回值非null,Packet Parsing模块根据该返回值,确认存在有效的物理地址后将含有该物理地址的读请求发送给Memory Controller模块。Memory Controller模块可以集成在TCAM控制模块内部也可以集成在NP模块内部。当Memory Controller模块集成在NP模块内部时,Packet Parsing模块将key值对应的Index和External RAM的物理地址封装成NP模块识别的查询响应报文,并通过高速总线接口返回给NP模块,之后由NP模块读取External RAM中该物理地址所对应的用户数据信息。
作为另一种实现方式,TCAM控制模块可以直接集成Memory Controller模块(如图2所示),此种情形下,Memory Controller模块可以按配置通过TCAM控制模块的内部总线接收Packet Parsing模块或者Index Transfer模块返回的物理地址,并读取External RAM中该物理地址所对应的用户数据信息,一般,Memory Controller模块被配置为突发(burst)读写模式,burst读写长度由表项对应的用户数据信息长度确定。
Memory Controller模块在读取External RAM中的相应的用户数据信息后,返回给Packet Parsing模块,Packet Parsing模块将用户数据信息、对应的key值重新封装成NP模块识别的查询响应报文,并通过高速总线接口返 回给NP模块,其中,用户数据信息以及对应的key值填充进查询响应报文中的报文数据字段,报文数据字段的具体格式可以由用户自定义。至此,NP模块完成一次表项查找过程。
方式二、NP模块进行写表项操作:
NP模块写表项之前会先通过查询表项判断当前表项内容是否已经存在,如已存在则取消写表项操作。只有当TCAM控制模块未查询到该表项时NP模块才会进行写表项操作。NP模块写表项需要向TCAM控制模块同时提供写表项的关键字(key值)信息和对应的物理地址信息,同时根据需要对于TCAM控制模块集成Memory Controller模块时,还需要通过Memory Controller模块向External RAM模块写入用户数据信息。Key值保存在TCAM芯片组中,同时NP模块运行的软件会记录上一次写表项的位置,即index值,并将index和对应的物理地址以表格对应关系写入Index Transfer模块中。这里仍以两片TCAM芯片构成的TCAM芯片组为例,描述写表项操作的原理如下:
NP模块写表项之前会先通过查询表项判断当前表项内容是否已经存在,查询表项的过程仍按方式一的方式进行,当TCAM控制模块未查询到表项key0信息时,返回的查询响应报文中的数据字段中无效位会置1表示不存在该表项,只有当TCAM芯片组中各TCAM芯片都没有命中的情况下Packet Parsing模块将返回给NP模块的查询响应报文中的无效位置1,NP模块据此判断表项不存在,之后进行写表项操作。
NP模块写表项时会先后依次下发写关键字请求报文和写用户数据请求报文。Packet Parsing模块通过NP模块的高速总线接口接收到写表项请求报文,通过解析接收到的写表项请求报文中的opcode字段值,确定该写表项请求报文是写关键字请求报文还是写用户数据请求报文。对于关键字为key0={key1,key2}的写关键字请求报文,其报文控制字段包含了TCAM 芯片的ID,报文数据字段包含关键字信息和对应的Index。Packet Parsing模块根据TCAM芯片的ID将关键字信息通过TCAM Transmit模块写入对应的TCAM芯片,之后TCAM Receive模块会返回写表项响应报文给Packet Parsing模块表明是否成功写入。
对于写用户数据请求报文,其报文控制字段包含了Memory Controller模块的ID,指向了Memory Controller模块,其报文数据字段包含了用户数据信息和对应的物理地址。对于TCAM控制模块集成了Memory Controller模块时,Packet Parsing模块根据该地址通过Memory Controller模块将用户数据信息写入External RAM中,随后通知Packet Parsing模块写入完成。Packet Parsing模块将key值对应的index和用户数据对应的物理地址以一一对应的关系写入Index Transfer模块中,这种对应关系一般以表格形式保存在Index Transfer模块中。Index Transfer模块写入完成后,通过内部接口通知Packet Parsing模块触发写表项响应报文给NP模块。
当一次完整的写关键字请求报文和写用户数据请求报文都完成后,NP模块完成了表项下发过程。
图3为本公开实施例的查表方法的流程示意图,如图3所示,所述查表方法包括以下步骤:
步骤301:接收到报文并确定出所述报文为表项查询请求报文时,对所述表项查询请求报文进行解析,得到TCAM芯片的ID信息。
本公开实施例中,所述报文包括报文控制字段和报文数据字段;其中,
所述报文控制字段包括以下至少之一:操作类型字段、报文起始字段、报文结束字段、芯片ID字段、用户自定义字段;
所述报文数据字段包括以下至少之一:表项关键字字段、用户数据信息字段、表项查询状态字段。
本公开实施例中,接收到报文时,对所述报文的报文控制字段进行解 析;
如果解析出所述报文控制字段中的操作类型字段为表项查找操作,则确定接收到的报文为表项查询请求报文。
本公开实施例中,对所述报文的报文控制字段中的芯片ID字段进行解析,得到TCAM芯片的ID信息。
本公开实施例中,接收由NP模块下发的表项查询请求报文,其中,所述NP模块下发的表项查询请求报文的数量为一个以上,所述一个以上表项查询请求报文对应一个报文组,所述报文组中的各个表项查询请求报文所携带的关键字组成待查询的关键字。
步骤302:根据所述TCAM芯片的ID信息,将所述表项查询请求报文发送给相应的TCAM芯片进行表项查找操作。
步骤303:接收所述TCAM芯片发送的表项查找结果,所述表项查找结果携有表项标识;将所述表项标识转换为存储模块中对应的物理地址。
本公开实施例中,所述TCAM芯片发送的表项查找结果还携有TCAM芯片的ID以及关键字信息;
如果所述表项查找结果携带的TCAM芯片的ID以及关键字信息,与所述表项查询请求报文中解析出来的TCAM芯片的ID以及关键字信息一致,则将所述表项查找结果中携带的表项标识转换为存储模块中对应的物理地址。
步骤304:依据所述物理地址,在存储模块中查询用户数据信息。
本公开实施例中,所述方法还包括:将所述用户数据信息以及相应的关键字封装成查询响应报文;将所述查询响应报文发送给NP模块。
上述方案中,如果所述TCAM芯片发送的表项查找结果表明不存在与所述表项查询请求报文相应的表项时,所述方法还包括:
接收到写表项请求报文时,对所述写表项请求报文进行解析,确定所 述写表项请求报文的类型;
如果所述写表项请求报文为写关键字请求报文,则对所述写关键字请求报文的报文控制字段和报文数据字段进行解析,得到TCAM芯片的ID信息和关键字信息、表项标识信息;依据所述TCAM芯片的ID信息,将所解析得到的关键字信息写入相应的TCAM芯片;
如果所述写表项请求报文为写用户数据请求报文,则对所述写关键字请求报文的报文控制字段和报文数据字段进行解析,得到存储器控制模块的ID信息和用户数据信息、物理地址信息;通过所述存储器控制模块依据所述物理地址信息在存储模块中写入所述用户数据信息。
本公开实施例中,所述方法还包括:
将所述关键字信息对应的表项标识与所述用户数据信息对应的物理地址,按照对应关系进行存储。
下面结合具体示例对本公开实施例的技术方案再做进一步详细描述。为描述方便,下面仍以TCAM芯片组包含两个TCAM芯片为例进行说明,实际使用的TCAM芯片数由NP模块所需的表项关键字位宽以及TCAM芯片位宽确定。
在以下实施例中,高速总线接口可以采用Interlaken Look-Aside接口,Interlaken Look-Aside接口被广泛应用于网络设备中,如搜索引擎、策略引擎、报文计数引擎以及流量调度器与主业务包处理器之间的业务报文交互接口。Interlaken Look-Aside接口采用Interlaken Look-Aside协议,这里,Interlaken Look-Aside协议(简称ILKA-LA)是Interlaken联盟为网络设备的主业务处理器和报文协处理单元之间的报文交互开发的一套协议标准,该协议通过对Interlaken协议的简化(如简化了逻辑通道,流控特性等)特别适用于事件触发型的快速短包交互过程。本公开实施例中的TCAM芯片支持基于ILKA-LA接口的表项查询操作。作为一种可选的实施方式,以 Interlaken Look-Aside接口(简称ILKN-LA接口)作为NP模块与TCAM控制模块之间的高速总线接口。ILKA-LA接口进行交互的控制和数据报文采用66bit编码方式,其中,报文控制字段字段,可以采用表2所示的格式定义,其中,Bit Pos表示bit的位置,Field表示字段。
Figure PCTCN2018084119-appb-000002
表2
如表2所示,其中:
opcode[5:0]字段为操作类型字段。
芯片ID[1:0]字段为TCAM芯片ID字段,后级TCAM Transmit模块可以根据TCAM芯片ID将报文转发给对应的TCAM芯片,Packet Parsing模块和TCAM Receive模块也可以根据TCAM芯片ID识别从TCAM接口上接收到的ILKN-LA报文来自哪个TCAM芯片。
ILA字段和ILKA-LA接口协议层相关,为协议标准定义。
user defined字段为用户自定义字段,具体定义的内容和TCAM芯片支持的指令格式相关,如Netlogic的NL11K系列TCAM芯片,user defined字段定义如下:
user defined0bit[55:42]对应TCAM内部的context addr[13:0];
user defined1bit[38:33]对应TCAM内部的LTR addr[5:0]。
由于使用的单个TCAM芯片数据位宽有限,NP芯片在下发表项查询请求报文时需要将长数据位宽的关键字按TCAM芯片数量拆分成满足TCAM芯片支持位宽的短位宽关键字,再将短位宽关键字分别封装成表项 查询请求报文并交错传输至Packet Parsing模块,由Packet Parsing模块解析后再发送给TCAM Transmit模块。作为一种实现方式,TCAM控制模块直接集成Memory Controller模块。
图4为本公开实施例的表项查询流程示意图,如图4所示,所述流程包括以下步骤:
步骤401:NP模块需要进行表项查询操作时,按表3的格式下发表项查询请求报文,该表现查询请求报文为一报文组,报文组中包含了查询的表项关键字key0={key1,key2}。
Figure PCTCN2018084119-appb-000003
表3
步骤402:Packet Parsing模块通过ILKN-LA接口接收到一个完整的报文组并进行解析操作。
步骤403:Packet Parsing模块根据报文控制字段中的opcode[5:0]字段判断是否为表项查询请求报文,是时执行步骤405,否时执行步骤404。
步骤404:判断非表项查询请求报文后按opcode[5:0]字段对应的操作流程处理。例如:判断为写表项操作,则按写表项操作的流程处理。
步骤405:Packet Parsing模块从表项查询请求报文中提取关键字信息key1、key2及各key对应的芯片ID等控制字段信息后发送给TCAM Transmit模块,由该模块根据芯片ID将对应的ILKN-LA报文转发到对应的TCAM芯片上进行表项查询。
步骤406:当TCAM芯片组内的各TCAM芯片完成表项查找后将查询 响应报文返回给TCAM Receive模块,查询响应报文包含各TCAM芯片命中表项所在的index={index1,index2}以及各index有效指示位{valid1,valid2},其中index1为key1所在表项对应的index,index2为key2所在表项对应的index……。查询响应报文还包含TCAM芯片对应的芯片ID以及查找关键字信息key1、key2。
步骤407:TCAM Receive模块根据响应报文中的valid字段判断查询结果是否有效,如无效则执行步骤408;如有效则执行步骤409。
步骤408:TCAM Receive模块通过内部接口指示Packet Parsing模块查询未命中,之后执行步骤410。
步骤410:Packet Parsing模块通过ILKN-LA接口发送查询未命中的响应报文给NP模块。
步骤409:TCAM Receive模块将TCAM芯片组的查询结果通过内部接口返回给Packet Parsing模块。
步骤411:Packet Parsing模块将查询响应报文中的关键字信息key1、key2与之前记录的查询请求报文中的key值进行对比,确定相同后执行步骤413,否则执行步骤412。
步骤412:判断查询请求的key值与TCAM返回查询的key值不对应,说明查询过程中出现错误,Packet Parsing模块将查询错误状态通告给NP模块,由NP模块运行的软件对该错误进行后续处理,如确定是否重新对key0下发表项查询操作。
步骤413:Packet Parsing模块将index={index1,index2}信息发送给Index Transfer模块进行地址翻译。
步骤414:Index Transfer模块通过内部查找表结果确定Packet Parsing返回的Index有无对应的物理地址,没有的话执行步骤415,存在的话执行步骤416。
步骤415:Packet Parsing模块发送查询响应报文给NP芯片,报文中的用户数据字段被指示为无效。
步骤416:Index Transfer模块返回Index对应的物理地址,Packet Parsing模块将该物理地址的读请求发送给Memory Controller模块,Memory Controller模块按配置读取External RAM模块中该物理地址所对应的用户数据信息,一般采用burst读写方式。
步骤417:Memory Controller模块在读取External RAM中的相应用户数据信息后返回给Packet Parsing模块,Packet Parsing模块将用户数据信息、对应的key值重新封装成ILKN-LA查询应答报文,并通过ILKN-LA接口返回给NP模块,至此NP模块完成一次表项查找过程。
图5为本公开实施例的表项下发流程示意图,如图5所示,所述流程包括以下步骤:
步骤501:当NP模块需要进行表项下发操作时,需要先判断TCAM芯片组中是否已存在该关键字对应的表项,因此需要进行表项查询操作,查询完成后进入502。
步骤502:NP模块判断查询结果是否为空,如已命中则说明表项已存在无需下发,因此执行步骤503取消本次表项下发操作,否则执行步骤504。
步骤503:表项已存在,取消本次表项下发操作。
步骤504:NP模块通过ILKN-LA接口下发写表项请求报文,该写表项请求报文为一报文组,报文组格式如表4所示:
Figure PCTCN2018084119-appb-000004
表4
步骤505:Packet Parsing模块解析收到的写表项请求报文。
步骤506:判断写表项请求报文是写关键字请求报文还是写用户数据请求报文,如为写关键字请求报文则执行步骤513,否则执行步骤507。
步骤507:当Packet Parsing模块解析出是写用户数据请求报文时继续执行步骤509,否则被判断为其它操作请求,执行步骤508。
步骤508:按其他操作请求对应的流程进行处理。
步骤509:对于写用户数据请求报文,其芯片ID指向了Memory Controller模块,Packet Parsing模块将需要写的用户数据信息和RAM的物理地址一起发送给Memory Controller模块,由该模块将用户数据信息写入External RAM中的物理地址位置,随后执行步骤510。
步骤510:Memory Controller模块判断External RAM是否写入成功,如成功写入则执行步骤512,即通过内部状态指示信号反馈给Packet Parsing模块写入成功状态,否则执行步骤511指示写入异常错误。
步骤511:指示写入异常错误。
步骤512:通过内部状态指示信号反馈给Packet Parsing模块写入成功状态。
步骤513:Packet Parsing模块从写表项请求报文中提取关键字信息key1、key2及各key计划在TCAM芯片中写入的index位置信息,对应的芯片ID等控制字段信息一起发送给TCAM Transmit模块,由该模块执行步骤514进行表项写入过程。
步骤514:TCAM Transmit模块进行表项写入过程。
步骤515:表项成功写入后Packet Parsing模块通过TCAM Receive模块收到写表项响应报文,并判断表项是否写入成功,如写入成功则执行步骤517,否则执行步骤516。
步骤516:Packet Parsing模块通过ILKN-LA接口反馈写表项异常响应报文,由NP模块运行的软件确定后续处理过程,如是否重写该表项等。
步骤517:当表项关键字和用户数据信息都写入成功后,Packet Parsing模块将key对应的index和用户数据对应的物理地址以一一对应关系写入Index Transfer模块中,这种对应关系一般以表格形式保存在Index Transfer模块中。
步骤518:Index Transfer模块写入完成后通过内部接口通知Packet Parsing模块触发写表项响应报文给NP模块,至此NP模块完成了表项下发过程。
图6为本公开实施例的查表装置的结构组成示意图,如图6所示,所述装置包括:
解析单元61,配置为接收到报文并确定出所述报文为表项查询请求报文时,对所述表项查询请求报文进行解析,得到TCAM芯片的ID信息;
发送单元62,配置为根据所述TCAM芯片的ID信息,将所述表项查询请求报文发送给相应的TCAM芯片进行表项查找操作;
接收单元63,配置为接收所述TCAM芯片发送的表项查找结果,所述表项查找结果携有表项标识;
地址转换单元64,配置为将所述表项标识转换为存储模块中对应的物理地址;
存储器控制单元65,配置为依据所述物理地址,在存储模块中查询用户数据信息。
本公开实施例中,所述报文包括报文控制字段和报文数据字段;其中,
所述报文控制字段包括以下至少之一:操作类型字段、报文起始字段、报文结束字段、芯片ID字段、用户自定义字段;
所述报文数据字段包括以下至少之一:表项关键字字段、用户数据信 息字段、表项查询状态字段。
本公开实施例中,所述解析单元61,还配置为接收到报文时,对所述报文的报文控制字段进行解析;如果解析出所述报文控制字段中的操作类型字段为表项查找操作,则确定接收到的报文为表项查询请求报文。
本公开实施例中,所述解析单元61,还配置为对所述报文的报文控制字段中的芯片ID字段进行解析,得到TCAM芯片的ID信息。
本公开实施例中,所述解析单元61,还配置为接收由NP模块下发的表项查询请求报文,其中,所述NP模块下发的表项查询请求报文的数量为一个以上,所述一个以上表项查询请求报文对应一个报文组,所述报文组中的各个表项查询请求报文所携带的关键字组成待查询的关键字。
本公开实施例中,所述TCAM芯片发送的表项查找结果还携有TCAM芯片的ID以及关键字信息;
如果所述表项查找结果携带的TCAM芯片的ID以及关键字信息,与所述表项查询请求报文中解析出来的TCAM芯片的ID以及关键字信息一致,则所述地址转换单元64将所述表项查找结果中携带的表项标识转换为存储模块中对应的物理地址。
本公开实施例中,所述装置还包括:
封装单元66,配置为将所述用户数据信息以及相应的关键字封装成查询响应报文;将所述查询响应报文发送给NP模块。
本公开实施例中,所述解析单元61,还配置为接收到写表项请求报文时,对所述写表项请求报文进行解析,确定所述写表项请求报文的类型;如果所述写表项请求报文为写关键字请求报文,则对所述写关键字请求报文的报文控制字段和报文数据字段进行解析,得到TCAM芯片的ID信息和关键字信息、表项标识信息;
所述发送单元62,还配置为依据所述TCAM芯片的ID信息,将所解 析得到的关键字信息写入相应的TCAM芯片;
所述解析单元61,还配置为如果所述写表项请求报文为写用户数据请求报文,则对所述写关键字请求报文的报文控制字段和报文数据字段进行解析,得到存储器控制模块的ID信息和用户数据信息、物理地址信息;
所述存储器控制单元65,还配置为依据所述物理地址信息在存储模块中写入所述用户数据信息。
本公开实施例中,所述地址转换单元64,还配置为将所述关键字信息对应的表项标识与所述用户数据信息对应的物理地址,按照对应关系进行存储。
本领域技术人员应当理解,图6所示的查表装置中的各单元的实现功能可参照前述查表方法的相关描述而理解。图6所示的查表装置中的各单元的功能可通过运行于处理器上的程序而实现,也可通过具体的逻辑电路而实现。
参照图2,图6所示的查表装置可以通过TCAM控制模块来实现,其中,解析单元61和封装单元66集成在Packet Parsing模块中,发送单元62集成在TCAM Transmit模块中,接收单元63集成在TCAM Receive模块中,地址转换单元64集成在Index Transfer模块中,存储器控制单元65集成在Memory Controller模块中。
在实际应用中,所述查表装置中的各个单元所实现的功能,均可由位于查表装置中的中央处理器(CPU,Central Processing Unit)、或微处理器(MPU,Micro Processor Unit)、或数字信号处理器(DSP,Digital Signal Processor)、或现场可编程门阵列(FPGA,Field Programmable Gate Array)等实现。
本发明实施例上述查表装置如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基 于这样的理解,本发明实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机、服务器、或者网络设备等)执行本发明各个实施例所述方法的全部或部分。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read Only Memory)、磁碟或者光盘等各种可以存储程序代码的介质。这样,本发明实施例不限制于任何特定的硬件和软件结合。
相应地,本发明实施例还提供一种计算机存储介质,其中存储有计算机程序,该计算机程序配置为执行本发明实施例的查表方法。
本公开实施例所记载的技术方案之间,在不冲突的情况下,可以任意组合。
在本公开所提供的几个实施例中,应该理解到,所揭露的方法和智能设备,可以通过其它的方式实现。以上所描述的设备实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,如:多个单元或组件可以结合,或可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的各组成部分相互之间的耦合、或直接耦合、或通信连接可以是通过一些接口,设备或单元的间接耦合或通信连接,可以是电性的、机械的或其它形式的。
上述作为分离部件说明的单元可以是、或也可以不是物理上分开的,作为单元显示的部件可以是、或也可以不是物理单元,即可以位于一个地方,也可以分布到多个网络单元上;可以根据实际的需要选择其中的部分或全部单元来实现本实施例方案的目的。
另外,在本公开各实施例中的各功能单元可以全部集成在一个第二处理单元中,也可以是各单元分别单独作为一个单元,也可以两个或两个以上单元集成在一个单元中;上述集成的单元既可以采用硬件的形式实现, 也可以采用硬件加软件功能单元的形式实现。
以上所述,仅为本公开的具体实施方式,但本公开的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本公开揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本公开的保护范围之内。
工业实用性
本公开实施例的技术方案,接收到报文并确定出所述报文为表项查询请求报文时,对所述表项查询请求报文进行解析,得到TCAM芯片的ID信息;根据所述TCAM芯片的ID信息,将所述表项查询请求报文发送给相应的TCAM芯片进行表项查找操作;接收所述TCAM芯片发送的表项查找结果,所述表项查找结果携有表项标识;将所述表项标识转换为存储模块中对应的物理地址;依据所述物理地址,在存储模块中查询用户数据信息。可以利用较低数据位宽的TCAM芯片通过组合的方式实现查找表项关键字,在保证查找性能的前提下降低了TCAM的功耗和硬件成本。此外,本公开实施例通过集成地址转换模块(实现TCAM地址和外部RAM的物理地址的转换)以及扩展/集成存储器控制模块,可以在NP模块下发表项查询请求报文后直接返回用户数据信息(如出端口、链路层物理地址等),从而实现了报文头信息的快速查找,也减轻了NP模块的报文处理负担,对于NP模块的降功耗设计具有很大帮助。

Claims (19)

  1. 一种查表方法,所述方法包括:
    接收到报文并确定出所述报文为表项查询请求报文时,对所述表项查询请求报文进行解析,得到三态内容可寻址存储器TCAM芯片的ID信息;
    根据所述TCAM芯片的ID信息,将所述表项查询请求报文发送给相应的TCAM芯片进行表项查找操作;
    接收所述TCAM芯片发送的表项查找结果,所述表项查找结果携有表项标识;将所述表项标识转换为存储模块中对应的物理地址;
    依据所述物理地址,在存储模块中查询用户数据信息。
  2. 根据权利要求1所述的查表方法,其中,所述报文包括报文控制字段和报文数据字段;其中,
    所述报文控制字段包括以下至少之一:操作类型字段、报文起始字段、报文结束字段、芯片ID字段、用户自定义字段;
    所述报文数据字段包括以下至少之一:表项关键字字段、用户数据信息字段、表项查询状态字段。
  3. 根据权利要求2所述的查表方法,其中,所述方法还包括:
    接收到报文时,对所述报文的报文控制字段进行解析;
    如果解析出所述报文控制字段中的操作类型字段为表项查找操作,则确定接收到的报文为表项查询请求报文。
  4. 根据权利要求2所述的查表方法,其中,所述对所述表项查询请求报文进行解析,得到TCAM芯片的ID信息,包括:
    对所述报文的报文控制字段中的芯片ID字段进行解析,得到TCAM芯片的ID信息。
  5. 根据权利要求1所述的查表方法,其中,所述方法还包括:
    接收由NP模块下发的表项查询请求报文,其中,所述NP模块下发的表项查询请求报文的数量为一个以上,所述一个以上表项查询请求报文对应一个报文组,所述报文组中的各个表项查询请求报文所携带的关键字组成待查询的关键字。
  6. 根据权利要求1所述的查表方法,其中,所述TCAM芯片发送的表项查找结果还携有TCAM芯片的ID以及关键字信息;
    如果所述表项查找结果携带的TCAM芯片的ID以及关键字信息,与所述表项查询请求报文中解析出来的TCAM芯片的ID以及关键字信息一致,则将所述表项查找结果中携带的表项标识转换为存储模块中对应的物理地址。
  7. 根据权利要求1所述的查表方法,其中,所述方法还包括:
    将所述用户数据信息以及相应的关键字封装成查询响应报文;
    将所述查询响应报文发送给NP模块。
  8. 根据权利要求1所述的查表方法,其中,如果所述TCAM芯片发送的表项查找结果表明不存在与所述表项查询请求报文相应的表项时,所述方法还包括:
    接收到写表项请求报文时,对所述写表项请求报文进行解析,确定所述写表项请求报文的类型;
    如果所述写表项请求报文为写关键字请求报文,则对所述写关键字请求报文的报文控制字段和报文数据字段进行解析,得到TCAM芯片的ID信息和关键字信息、表项标识信息;依据所述TCAM芯片的ID信息,将所解析得到的关键字信息写入相应的TCAM芯片;
    如果所述写表项请求报文为写用户数据请求报文,则对所述写关键字请求报文的报文控制字段和报文数据字段进行解析,得到存储器控制模块的ID信息和用户数据信息、物理地址信息;通过所述存储器控制模 块依据所述物理地址信息在存储模块中写入所述用户数据信息。
  9. 根据权利要求8所述的查表方法,其中,所述方法还包括:
    将所述关键字信息对应的表项标识与所述用户数据信息对应的物理地址,按照对应关系进行存储。
  10. 一种查表装置,所述装置包括:
    解析单元,配置为接收到报文并确定出所述报文为表项查询请求报文时,对所述表项查询请求报文进行解析,得到TCAM芯片的ID信息;
    发送单元,配置为根据所述TCAM芯片的ID信息,将所述表项查询请求报文发送给相应的TCAM芯片进行表项查找操作;
    接收单元,配置为接收所述TCAM芯片发送的表项查找结果,所述表项查找结果携有表项标识;
    地址转换单元,配置为将所述表项标识转换为存储模块中对应的物理地址;
    存储器控制单元,配置为依据所述物理地址,在存储模块中查询用户数据信息。
  11. 根据权利要求10所述的查表装置,其中,所述报文包括报文控制字段和报文数据字段;其中,
    所述报文控制字段包括以下至少之一:操作类型字段、报文起始字段、报文结束字段、芯片ID字段、用户自定义字段;
    所述报文数据字段包括以下至少之一:表项关键字字段、用户数据信息字段、表项查询状态字段。
  12. 根据权利要求11所述的查表装置,其中,所述解析单元,还配置为接收到报文时,对所述报文的报文控制字段进行解析;如果解析出所述报文控制字段中的操作类型字段为表项查找操作,则确定接收到的报文为表项查询请求报文。
  13. 根据权利要求11所述的查表装置,其中,所述解析单元,还配置为对所述报文的报文控制字段中的芯片ID字段进行解析,得到TCAM芯片的ID信息。
  14. 根据权利要求10所述的查表装置,其中,所述解析单元,还配置为接收由NP模块下发的表项查询请求报文,其中,所述NP模块下发的表项查询请求报文的数量为一个以上,所述一个以上表项查询请求报文对应一个报文组,所述报文组中的各个表项查询请求报文所携带的关键字组成待查询的关键字。
  15. 根据权利要求10所述的查表装置,其中,所述TCAM芯片发送的表项查找结果还携有TCAM芯片的ID以及关键字信息;
    如果所述表项查找结果携带的TCAM芯片的ID以及关键字信息,与所述表项查询请求报文中解析出来的TCAM芯片的ID以及关键字信息一致,则所述地址转换单元将所述表项查找结果中携带的表项标识转换为存储模块中对应的物理地址。
  16. 根据权利要求10所述的查表装置,其中,所述装置还包括:
    封装单元,配置为将所述用户数据信息以及相应的关键字封装成查询响应报文;将所述查询响应报文发送给NP模块。
  17. 根据权利要求10所述的查表装置,其中,所述解析单元,还配置为接收到写表项请求报文时,对所述写表项请求报文进行解析,确定所述写表项请求报文的类型;如果所述写表项请求报文为写关键字请求报文,则对所述写关键字请求报文的报文控制字段和报文数据字段进行解析,得到TCAM芯片的ID信息和关键字信息、表项标识信息;
    所述发送单元,还配置为依据所述TCAM芯片的ID信息,将所解析得到的关键字信息写入相应的TCAM芯片;
    所述解析单元,还配置为如果所述写表项请求报文为写用户数据请 求报文,则对所述写关键字请求报文的报文控制字段和报文数据字段进行解析,得到存储器控制模块的ID信息和用户数据信息、物理地址信息;
    所述存储器控制单元,还配置为依据所述物理地址信息在存储模块中写入所述用户数据信息。
  18. 根据权利要求17所述的查表装置,其中,所述地址转换单元,还配置为将所述关键字信息对应的表项标识与所述用户数据信息对应的物理地址,按照对应关系进行存储。
  19. 一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,该计算机可执行指令配置为执行权利要求1至9任一项所述的查表方法。
PCT/CN2018/084119 2017-04-21 2018-04-23 一种查表方法及装置、计算机存储介质 WO2018192587A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710273440.8 2017-04-21
CN201710273440.8A CN108737278A (zh) 2017-04-21 2017-04-21 一种查表方法及装置

Publications (1)

Publication Number Publication Date
WO2018192587A1 true WO2018192587A1 (zh) 2018-10-25

Family

ID=63856219

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/084119 WO2018192587A1 (zh) 2017-04-21 2018-04-23 一种查表方法及装置、计算机存储介质

Country Status (2)

Country Link
CN (1) CN108737278A (zh)
WO (1) WO2018192587A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3723330A4 (en) * 2018-12-13 2021-03-24 Huawei Technologies Co., Ltd. PROCEDURE AND CHIP FOR COMMAND PROCESSING
CN113992579A (zh) * 2021-09-23 2022-01-28 新华三信息安全技术有限公司 一种路由表项存储方法、查找方法及装置
CN114844832A (zh) * 2022-03-22 2022-08-02 阿里云计算有限公司 硬件转发表项配置方法、设备、介质及产品
CN115225591A (zh) * 2022-07-15 2022-10-21 井芯微电子技术(天津)有限公司 一种处理交换芯片控制报文的方法

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109657456B (zh) * 2018-12-12 2022-02-08 苏州盛科通信股份有限公司 Tcam验证方法及系统
CN109688148A (zh) * 2018-12-29 2019-04-26 苏州睿安芯微电子有限公司 一种基于软件配置的自定转发协议安全网络的系统及方法
CN112632340B (zh) * 2020-12-28 2024-04-16 苏州盛科通信股份有限公司 查表方法及装置、存储介质以及电子设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101834802A (zh) * 2010-05-26 2010-09-15 华为技术有限公司 转发数据包的方法及装置
CN102402611A (zh) * 2011-12-12 2012-04-04 盛科网络(苏州)有限公司 一种用tcam实现关键字快速查找并读表的方法
US20120287782A1 (en) * 2011-05-12 2012-11-15 Microsoft Corporation Programmable and high performance switch for data center networks
CN103475584A (zh) * 2012-06-07 2013-12-25 中兴通讯股份有限公司 三态内容寻址存储器(tcam)查询方法和装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101834802A (zh) * 2010-05-26 2010-09-15 华为技术有限公司 转发数据包的方法及装置
US20120287782A1 (en) * 2011-05-12 2012-11-15 Microsoft Corporation Programmable and high performance switch for data center networks
CN102402611A (zh) * 2011-12-12 2012-04-04 盛科网络(苏州)有限公司 一种用tcam实现关键字快速查找并读表的方法
CN103475584A (zh) * 2012-06-07 2013-12-25 中兴通讯股份有限公司 三态内容寻址存储器(tcam)查询方法和装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
OGUZHAN ERDEM ET AL.: "MIPS Extension for a TCAM Based Parallel Architecture for Fast IP Lookup", IEEE, 24TH INTERNATIONAL SYMPOSIUM ON COMPUTER AND INFORMATION SCIENCES, 16 September 2009 (2009-09-16), pages 310 - 315, XP055545431 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3723330A4 (en) * 2018-12-13 2021-03-24 Huawei Technologies Co., Ltd. PROCEDURE AND CHIP FOR COMMAND PROCESSING
US11442735B2 (en) 2018-12-13 2022-09-13 Huawei Technologies Co., Ltd. Search instruction to access a TCAM and memory to return a program counter value from the TCAM
CN113992579A (zh) * 2021-09-23 2022-01-28 新华三信息安全技术有限公司 一种路由表项存储方法、查找方法及装置
CN113992579B (zh) * 2021-09-23 2023-03-31 新华三信息安全技术有限公司 一种路由表项存储方法、查找方法及装置
CN114844832A (zh) * 2022-03-22 2022-08-02 阿里云计算有限公司 硬件转发表项配置方法、设备、介质及产品
CN115225591A (zh) * 2022-07-15 2022-10-21 井芯微电子技术(天津)有限公司 一种处理交换芯片控制报文的方法
CN115225591B (zh) * 2022-07-15 2023-12-26 井芯微电子技术(天津)有限公司 一种处理交换芯片控制报文的方法

Also Published As

Publication number Publication date
CN108737278A (zh) 2018-11-02

Similar Documents

Publication Publication Date Title
WO2018192587A1 (zh) 一种查表方法及装置、计算机存储介质
US10445380B2 (en) System and method for direct storage access in a content-centric network
CN109587065B (zh) 转发报文的方法、装置、交换机、设备及存储介质
CN108306835B (zh) 一种以太网交换机的输入缓存及数据转发方法
WO2019185051A1 (zh) 一种基于集成流表转发报文的方法及装置
US11431624B2 (en) Communication method and network interface card
EP2604006B1 (en) Method and apparatus for packet processing and a preprocessor
JP2020520612A (ja) パケット伝送方法、エッジデバイス及び機械可読記憶媒体
EP2890064A1 (en) Packet forwarding method and system
WO2014166073A1 (zh) 报文转发方法和网络设备
CN113746749A (zh) 网络连接设备
US10430364B2 (en) Packet forwarding
EP2953302B1 (en) Service packet processing method, apparatus and system
US10185783B2 (en) Data processing device, data processing method, and non-transitory computer readable medium
KR100687745B1 (ko) IPv6 송신자 기반 멀티캐스트 패킷 포워딩을 위한네트워크 프로세서 및 그 방법
WO2022100511A1 (zh) 转发表项的处理方法和装置
CN116032837A (zh) 一种流表卸载方法及装置
JP7044223B2 (ja) サービス処理方法およびネットワークデバイス
TWI281804B (en) Packet forwarding method and system
CN116095197A (zh) 数据传输方法及相关装置
WO2015010514A1 (zh) 一种信号转换方法、装置及系统
CN113132273B (zh) 一种数据转发方法及装置
US20170279915A1 (en) Switch access module, cell encapsulation method, switching network system and computer storage medium
CN111865801B (zh) 一种基于Virtio端口传输数据的方法和系统
CN103051541B (zh) 一种标识网内的报文转发方法、asr及isr

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: 18787936

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: 18787936

Country of ref document: EP

Kind code of ref document: A1