WO2020119310A1 - 查找表存储方法、装置及计算机可读存储介质 - Google Patents

查找表存储方法、装置及计算机可读存储介质 Download PDF

Info

Publication number
WO2020119310A1
WO2020119310A1 PCT/CN2019/114427 CN2019114427W WO2020119310A1 WO 2020119310 A1 WO2020119310 A1 WO 2020119310A1 CN 2019114427 W CN2019114427 W CN 2019114427W WO 2020119310 A1 WO2020119310 A1 WO 2020119310A1
Authority
WO
WIPO (PCT)
Prior art keywords
lookup table
storage
capacity
storage unit
message processing
Prior art date
Application number
PCT/CN2019/114427
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 WO2020119310A1 publication Critical patent/WO2020119310A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • G06F3/0607Improving or facilitating administration, e.g. storage management by facilitating the process of upgrading existing storage systems, e.g. for improving compatibility between host and storage device
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools

Definitions

  • the present invention relates to the field of computer communications, and in particular, to a lookup table storage method, device, and computer-readable storage medium.
  • the specifications of the lookup table of the switching device are different, but in the existing implementation scheme, the storage capacity of the RAM (random access storage unit) that stores various lookup tables is fixed. changing.
  • the storage capacity of the lookup table is much smaller than the fixed RAM storage capacity, it will cause a large amount of storage capacity remaining in the RAM, but this part of the remaining storage capacity cannot be used by other lookup tables, causing a huge waste of RAM resources.
  • the main purpose of the present invention is to provide a lookup table storage method, device and computer readable storage medium, aiming to solve the problem that when a fixed RAM is used to store the lookup table, the RAM that stores the small storage capacity lookup table has a large amount of remaining storage space but cannot The waste of resources caused by use.
  • the lookup table storage method includes the following steps:
  • the lookup table When the storage capacity of the lookup table is greater than the preset storage capacity, store the lookup table in a large capacity storage unit, where the large capacity storage unit is a storage unit external to the message processing unit.
  • the method further includes:
  • the step of storing the lookup table in the message processing unit includes:
  • the step of storing the lookup table in the message processing unit according to the first width information and the first depth information includes:
  • the step of storing the lookup table in a large-capacity storage unit includes:
  • the step of storing the lookup table in the mass storage unit according to the second width information and the second depth information includes:
  • the present invention also provides a lookup table storage device, the lookup table storage device includes a processor, a memory, and a lookup table storage program stored on the memory and operable on the processor When the lookup table storage program is executed by the processor, the steps of the lookup table storage method described above are implemented.
  • the present invention also provides a computer-readable storage medium on which a look-up table storage program is stored, and the look-up table storage program is implemented as described above when executed by a processor Steps to lookup table storage method.
  • the method, device and computer readable storage medium for the lookup table storage provided by the present invention, first, obtain the lookup table corresponding to the business needs, and obtain the first storage capacity of the lookup table, and then, determine the first storage of the lookup table Whether the capacity is greater than the second storage capacity of the message processing unit corresponding to the service demand, and then, when the first storage capacity is less than or equal to the second storage capacity, storing the lookup table to the message The processing unit, and finally, when the storage capacity of the lookup table is greater than the preset storage capacity, store the lookup table in a large capacity storage unit, where the large capacity storage unit is a storage unit external to the message processing unit.
  • the invention can store all the lookup tables of services according to the storage capacity of the table, thereby solving the problem that when a fixed RAM is used to store the lookup table, the RAM that stores the small storage capacity lookup table has a large amount of remaining storage space and cannot be used. The problem of waste of resources.
  • FIG. 1 is a schematic diagram of the hardware structure of a lookup table storage device according to an embodiment of the present invention
  • FIG. 2 is a schematic flowchart of a first embodiment of a lookup table storage method of the present invention
  • FIG. 3 is a schematic flowchart of a second embodiment of a lookup table storage method of the present invention.
  • FIG. 4 is a schematic flowchart of a third embodiment of a lookup table storage method of the present invention.
  • FIG. 5 is a schematic flowchart of a fourth embodiment of a lookup table storage method of the present invention.
  • FIG. 6 is a schematic flowchart of a fifth embodiment of a lookup table storage method of the present invention.
  • FIG. 7 is a schematic flowchart of a sixth embodiment of a lookup table storage method of the present invention.
  • the main solutions of the embodiments of the present invention are: obtaining a lookup table corresponding to a business requirement, and obtaining the first storage capacity of the lookup table; judging whether the first storage capacity of the lookup table is greater than a message corresponding to the business requirement The second storage capacity of the processing unit; when the first storage capacity is less than or equal to the second storage capacity, storing the lookup table to the message processing unit; when the storage capacity of the lookup table is greater than the When setting the storage capacity, the look-up table is stored in a large-capacity storage unit, where the large-capacity storage unit is a storage unit external to the message processing unit.
  • the specifications of the lookup table of the switching device are different, but in the existing implementation scheme, the storage capacity of the RAM (random access storage unit) that stores various lookup tables is fixed. changing.
  • the storage capacity of the lookup table is much smaller than the fixed RAM storage capacity, it will cause a large amount of storage capacity remaining in the RAM, but this part of the remaining storage capacity cannot be used by other lookup tables, causing a huge waste of RAM resources.
  • the present invention provides a solution. First, obtain a lookup table corresponding to a business requirement, and obtain a first storage capacity of the lookup table, and then determine whether the first storage capacity of the lookup table is greater than that corresponding to the business requirement The second storage capacity of the message processing unit, and then, when the first storage capacity is less than or equal to the second storage capacity, store the lookup table to the message processing unit, and finally, in the search
  • the lookup table is stored in a large-capacity storage unit, where the large-capacity storage unit is a storage unit external to the message processing unit.
  • the invention can store all the lookup tables of services according to the storage capacity of the table, thereby solving the problem that when a fixed RAM is used to store the lookup table, the RAM that stores the small storage capacity lookup table has a large amount of remaining storage space and cannot be used. The problem of waste of resources.
  • FIG. 1 is a schematic diagram of a hardware structure of a device related to an embodiment of the present invention.
  • the apparatus may include: a processor 1001, such as a CPU, a memory 1002, a communication bus 1003, and a network interface 1004.
  • the communication bus 1003 is used to realize the connection communication between the various components in the device.
  • the network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
  • the memory 1002 may be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as a disk memory.
  • the memory 1002 may optionally be a storage device independent of the foregoing processor 1001.
  • the memory 1002 as a computer storage medium may include an operating system, a network communication module, and a lookup table storage program.
  • the first terminal may further include a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, and so on.
  • sensors such as light sensors, motion sensors and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display screen according to the brightness of the ambient light, and the proximity sensor may turn off the display screen and/or when the smart terminal moves to the ear Backlight.
  • the gravity acceleration sensor can detect the magnitude of acceleration in various directions (generally three axes), and can detect the magnitude and direction of gravity when at rest, and can be used for applications that identify the attitude of smart terminals (such as horizontal and vertical screen switching, Related games, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tap), etc.
  • the smart terminal can also be configured with other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc. No longer.
  • FIG. 1 does not constitute a limitation on the device, and may include more or less components than those illustrated, or combine certain components, or arrange different components.
  • the network interface 1004 can be used to receive all the service-based lookup tables sent by the terminal; and the processor 1001 can be used to call the lookup table storage program stored in the memory 1002 and execute The following operations:
  • the lookup table When the storage capacity of the lookup table is greater than the preset storage capacity, store the lookup table in a large capacity storage unit, where the large capacity storage unit is a storage unit external to the message processing unit.
  • processor 1001 may be used to call a lookup table storage program stored in the memory 1002, and also perform the following operations:
  • processor 1001 may be used to call a lookup table storage program stored in the memory 1002, and also perform the following operations:
  • processor 1001 may be used to call a lookup table storage program stored in the memory 1002, and also perform the following operations:
  • processor 1001 may be used to call a lookup table storage program stored in the memory 1002, and also perform the following operations:
  • processor 1001 may be used to call a lookup table storage program stored in the memory 1002, and also perform the following operations:
  • the user creates all the lookup tables corresponding to the business according to the business requirements, and then uploads the lookup tables to the switching device for the switching chip to configure the lookup tables to the corresponding message processing unit or external mass storage unit.
  • the terminal obtains the first storage capacity of all the lookup tables, where the first storage capacity is the storage capacity of the lookup table.
  • the second storage capacity is the storage capacity of the message processing unit; when it is determined that the first storage capacity is less than or equal to the second storage capacity, the lookup table configuration file corresponding to the business requirement is obtained, and the A lookup table configuration file obtains a message processing unit corresponding to the business requirement, and stores the lookup table in the message processing unit.
  • the look-up table is stored in a large-capacity storage unit, where the large-capacity storage unit is a storage unit external to the message processing unit.
  • FIG. 2 is a first embodiment of a lookup table storage method of the present invention.
  • the lookup table storage method includes:
  • Step S10 Obtain a lookup table corresponding to business requirements, and obtain the first storage capacity of the lookup table;
  • the lookup table storage method provided by the present invention is mainly used for hierarchically storing all service-based lookup tables created by users.
  • the terminal involved in the lookup table storage method provided by the present invention may be a switch, etc., and the terminal is preloaded with related application systems.
  • a user creates all lookup tables corresponding to the business according to business requirements, and then uploads all the lookup tables to the terminal.
  • the terminal obtains the first storage capacity of all the lookup tables.
  • the lookup table is graded according to the size of the storage capacity. It can be divided into two or more levels. This application will be described as a two-level lookup table.
  • the PPU divides the rank order according to the business logic. There are M lookup tables inside each level of the PPU (depending on the amount of RAM, one RAM can only store the contents of one lookup table, but one lookup table can have one or more RAM), the capacity of these lookup tables is relatively small, and can store some content with a relatively small number of entries, such as port attribute table, VLAN (virtual local area network) attribute table, VFI (virtual forwarding domain instance virtual forward instance) attribute table It can be stored in the corresponding PPU.
  • Some large-capacity lookup tables such as MAC address switching tables, MPLS switching tables, and IP routing tables, contain a huge number of entries. These lookup tables are stored in a large-capacity storage unit outside the PPU.
  • the lookup table in the PPU or the lookup table in the large-capacity storage unit can be configured through configuration files or software programming.
  • the depth and width of the lookup table are understandable.
  • there is no lookup table for business use You can configure and allocate 0 RAM resources, and allocate the RAM resources to other lookup tables.
  • each lookup table contains p configuration registers, which are used to generate keywords needed for the lookup table.
  • Each configuration register configures the corresponding byte position of the keyword field in the message descriptor field, the position within the byte, and the bit length of the field. According to the configuration value of the configuration register, the corresponding keyword can be taken from the descriptor field of the message, and then each keyword is spliced according to the order of the configuration register to obtain the table lookup keyword.
  • Step S20 Determine whether the first storage capacity of the lookup table is greater than the second storage capacity of the message processing unit corresponding to the service requirement;
  • a configuration file corresponding to the lookup table is obtained, and then based on the configuration file, the current lookup table is based on which level of PPU the current business is, Then obtain the second storage capacity of the PPU, where the second storage capacity is the current storage capacity of the PPU, and then determine whether the first storage capacity of the lookup table is larger than the first storage capacity of the message processing unit corresponding to the business requirement 2. Storage capacity.
  • the lookup table with a smaller storage capacity is stored in the storage unit inside the PPU (packet processing unit), where the lookup table inside the PPU corresponds to a smaller RAM specification; the lookup table with a larger storage capacity is configured to the PPU Externally implemented, the specifications of the RAM corresponding to the lookup table external to the PPU are relatively large, and can be stored through the external DDR (Double Rate Synchronous Dynamic Random Access Memory).
  • DDR Double Rate Synchronous Dynamic Random Access Memory
  • each level of PPU when each level of PPU supports two large-capacity lookup tables associated with external large-capacity storage units, it can meet the needs of switching services, and each level of PPU can support multiple large-capacity storage associated with external large-capacity storage units. table. It is also possible that any level of PPU is not associated with a large-capacity lookup table in an external large-capacity storage unit.
  • the internal and external RAM read and write control modules of the PPU have a lookup table register.
  • the contents of the lookup table attribute register include the depth information of the lookup table, the byte width of the lookup table, the bit width of the lookup table, Whether to carry the counter pointer (counter pointer), whether to carry the meter pointer (flow meter pointer), etc.
  • each RAM of the RAM reading and writing control module inside the PPU also contains an attribute register describing the RAM.
  • Step S30 When the first storage capacity is less than or equal to the second storage capacity, store the lookup table to the message processing unit;
  • the width and depth of the RAM in the message processing unit are acquired, and then the width corresponding to the current lookup table is acquired And the depth, and then compare the depth of the lookup table with the depth of the RAM, and compare the width of the lookup table with the width of the RAM to obtain the amount of RAM required to store the lookup table in the PPU, for example, if the depth of the table It is 2048, the width is 256-bit RAM, the depth is 512, the width is 128 bits, so the width requires two RAMs, and the depth requires four RAMs. Finally, the two width RAMs are stitched together, and the four depth RAMs are stitched together to get A storage space spliced with eight RAMs stores the lookup table.
  • Step S40 When the storage capacity of the lookup table is greater than the preset storage capacity, store the lookup table in a large capacity storage unit, where the large capacity storage unit is a storage unit external to the message processing unit.
  • the width and depth of the RAM in the large-capacity storage unit are acquired, and then the width and depth corresponding to the current lookup table are acquired Then, the depth of the lookup table is compared with the depth of the RAM, and the width of the lookup table is compared with the width of the RAM to obtain the amount of RAM required to store the lookup table in the large-capacity storage unit. Store the lookup table after splicing the number of RAMs.
  • the user creates all the lookup tables corresponding to the business according to the business requirements, and then uploads the lookup tables to the switching device for the switching chip to configure the lookup tables to the corresponding message processing unit or external mass storage unit.
  • the terminal obtains the first storage capacity of all the lookup tables, where the first storage capacity is the storage capacity of the lookup table.
  • the second storage capacity is the storage capacity of the message processing unit; when it is determined that the first storage capacity is less than or equal to the second storage capacity, the lookup table configuration file corresponding to the business requirement is obtained, and the A lookup table configuration file obtains a message processing unit corresponding to the business requirement, and stores the lookup table in the message processing unit.
  • the look-up table is stored in a large-capacity storage unit, where the large-capacity storage unit is a storage unit external to the message processing unit.
  • the invention can store all the lookup tables of services according to the storage capacity of the table, thereby solving the problem that when a fixed RAM is used to store the lookup table, the RAM that stores the small storage capacity lookup table has a large amount of remaining storage space and cannot be used. The problem of waste of resources.
  • FIG. 3 is a second embodiment of the lookup table storage method of the present invention. Based on the foregoing embodiment, before step S20, the method further includes:
  • Step S50 Obtain the lookup table configuration file corresponding to the business requirement
  • Step S60 Acquire a message processing unit corresponding to the business requirement according to the lookup table configuration file.
  • a preset storage capacity is acquired, and when the first storage capacity is less than or equal to the preset storage capacity, acquired
  • the configuration file corresponding to the lookup table then obtains the PPU corresponding to the current lookup table according to the configuration file, and finally stores the lookup table in the PPU.
  • the message first enters the message processing unit for analysis, obtains the structure of the message, and places the analysis result in the descriptor field of the message, and sends it to the subsequent PPU for processing.
  • the packet analysis result is mainly the packet type, MAC DA, MAC SA, VLAN attribute, Eth-Type, DIP, SIP, IP protocol number, IP TTL and UDP source and destination port number.
  • a message processing requires multi-level PPUs to be processed.
  • the multi-level PPU may be 12 or more levels, or less than 12 levels of PPU.
  • the number of PPU levels required by the service can be configured through a configuration file. Each level of PPU corresponds to a different table lookup function.
  • the lookup table stored in the first level PPU is the port attribute table. After the port attribute is obtained, the next level PPU is entered to perform the lookup table.
  • the lookup table stored in the next level PPU It is the VLAN attribute table. After obtaining the VLAN attribute, continue to enter the next-level PPU to check the table.
  • the contents of the descriptor and message are sent to the message processing unit for message modification. Finally, the message is forwarded from the correct destination port according to the output port indicated by the descriptor field.
  • the PPU determines the RAM block corresponding to the accessed lookup table according to the lookup table attribute register configuration content including the depth of the lookup table.
  • each RAM of the read-write control module of the RAM inside the PPU contains an attribute register.
  • the attribute register stores the logical table number of the RAM belonging to the lookup table, the RAM is located in the row block and the column block corresponding to the lookup table, the hash function number selected by the RAM, etc.
  • each RAM After the table lookup request received by the internal RAM read/write control module of the PPU, each RAM checks the lookup table number of its own RAM attribute register according to the table lookup request and the table lookup address to determine the lookup table number corresponding to the table lookup request After the same number as the lookup table configured in the RAM attribute register, determine whether the address corresponding to the lookup request falls within the row block of the lookup table where it is located. If it is, initiate a request signal to read the RAM, and drive the RAM address to search The address of the table reads the data inside the RAM. Then put the read data into the corresponding position of the result register according to the logical table column block number configured by the RAM attribute register.
  • the result of the table lookup is divided into equal-length fragments. If it is a hash table lookup, then you need to compare the key fields from all the shards with the key fields of the requested table lookup. If they are equal, the corresponding shard is the result of this search. If it is a direct table lookup, then select a slice from all the slices as the result of this table lookup according to the low order of the address.
  • the terminal configures the target PPU stored in the lookup table through the configuration file, thereby facilitating the realization of business logic.
  • the terminal divides the table look-up result into multiple pieces of data, and then takes one piece of data from it as the final result, which saves RAM space.
  • FIG. 4 is a third embodiment of the lookup table storage method of the present invention. Based on the embodiment shown in FIG. 2, the step S30 includes:
  • Step S31 Acquire first width information and first depth information corresponding to the lookup table based on the sub-storage unit in the message processing unit;
  • Step S32 Store the lookup table to the message processing unit according to the first width information and the first depth information.
  • the width and depth of the RAM in the message processing unit are acquired, and then the width corresponding to the current lookup table is acquired And the depth, and then compare the depth of the lookup table with the depth of the RAM, compare the width of the lookup table with the width of the RAM, so as to obtain the first corresponding to the lookup table based on the sub storage unit in the message processing unit Width information and first depth information, and finally store the look-up table to the message processing unit according to the first width information and the first depth information.
  • the terminal obtains the first width information and the first depth information corresponding to the lookup table based on the sub-storage unit in the message processing unit, and then stores the lookup table according to the first width information and the first depth information. Avoid wasting memory resources.
  • FIG. 5 is a fourth embodiment of the lookup table storage method of the present invention. Based on the embodiment shown in FIG. 4, the step S32 includes:
  • Step S321 Acquire the number of first sub-storage units required to store the lookup table in the message processing unit according to the first width information and the first depth information, where the first sub-storage unit A random access storage unit in the message processing unit;
  • Step S322 Store the lookup table in the first sub-storage unit corresponding to the number.
  • the width and depth of the RAM in the message processing unit are acquired, and then the width corresponding to the current lookup table is acquired And the depth, and then compare the depth of the lookup table with the depth of the RAM, and compare the width of the lookup table with the width of the RAM to obtain the amount of RAM required to store the lookup table in the PPU, for example, if the depth of the table It is 2048, the width is 256-bit RAM, the depth is 512, the width is 128 bits, so the width requires two RAMs, and the depth requires four RAMs. Finally, the width two RAMs are spliced, and the depth four RAMs are spliced to get A storage space spliced with eight RAMs stores the lookup table.
  • the terminal obtains the first width information and the first depth information corresponding to the lookup table based on the sub-storage unit in the message processing unit, and then obtains the RAM required for storage in the PPU according to the first width information and the first depth information The number, thus avoiding waste of memory resources.
  • FIG. 6 is a fifth embodiment of the lookup table storage method of the present invention. Based on the embodiment shown in FIG. 2, the step S40 includes:
  • Step S41 Acquire second width information and second depth information of the lookup table based on the sub-storage unit in the large-capacity storage unit;
  • Step S42 Store the lookup table to the large-capacity storage unit according to the second width information and the second depth information.
  • the width and depth of the RAM in the large-capacity storage unit are acquired, and then the width and depth corresponding to the current lookup table are acquired , And then compare the depth of the lookup table with the depth of the RAM, compare the width of the lookup table with the width of the RAM, so as to obtain the second width information of the lookup table based on the sub-storage unit in the mass storage unit and The second depth information, and finally the lookup table is stored in the mass storage unit according to the second width information and the second depth information.
  • the terminal acquires the second width information and the second depth information of the lookup table based on the sub-storage unit in the large-capacity storage unit, and then stores the lookup table according to the second width information and the second depth information, thereby avoiding There is a waste of memory resources.
  • FIG. 7 is a sixth embodiment of the lookup table storage method of the present invention. Based on the embodiment shown in FIG. 6, the step S42 includes:
  • Step S421 Acquire the number of second sub-storage units required for storing the lookup table in the large-capacity storage unit according to the second width information and the second depth information, where the second sub-storage unit A random access storage unit in the large-capacity storage unit;
  • Step S422 Store the lookup table in the second sub-storage unit corresponding to the number.
  • the width and depth of the RAM in the large-capacity storage unit are acquired, and then the width and depth corresponding to the current lookup table are acquired Then, the depth of the lookup table is compared with the depth of the RAM, and the width of the lookup table is compared with the width of the RAM to obtain the amount of RAM required to store the lookup table in a large-capacity storage unit. Store the lookup table after splicing the number of RAMs.
  • the terminal obtains the second width information and the second depth information corresponding to the lookup table based on the sub-storage unit in the large-capacity storage unit, and then acquires and stores in the large-capacity storage unit according to the second width information and the second depth information.
  • the number of RAMs described above avoids wasting memory resources in large-capacity storage units.
  • the present invention also provides a lookup table storage device.
  • the lookup table storage device includes a processor, a memory, and a lookup table storage program stored on the memory and executable on the processor. When the lookup table storage program is executed by the processor, the steps of the lookup table storage method described above are implemented.
  • the present invention also provides a computer-readable storage medium having a look-up table storage program stored on the computer-readable storage medium, the look-up table storage program implementing the look-up table as described above when executed by the processor Steps of storage method.
  • the methods in the above embodiments can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware, but in many cases the former is better Implementation.
  • the technical solution of the present invention can be embodied in the form of a software product in essence or part that contributes to the existing technology, and the computer software product is stored in a storage medium (such as ROM/RAM) as described above , Magnetic disks, optical disks), including several instructions to enable a terminal device (which can be a TV, mobile phone, computer, device, air conditioner, or network equipment, etc.) to perform the methods described in various embodiments of the present invention.
  • a terminal device which can be a TV, mobile phone, computer, device, air conditioner, or network equipment, etc.

Abstract

本发明公开了一种查找表存储方法、装置以及计算机可读存储介质,包括以下步骤:获取业务需求对应的查找表,并获取所述查找表的第一存储容量;判断所述查找表的第一存储容量是否大于所述业务需求对应的报文处理单元的第二存储容量;在所述第一存储容量小于或等于所述第二存储容量时,将所述查找表存储至所述报文处理单元;在所述查找表的存储容量大于预设存储容量时,将所述查找表存储至大容量存储单元,其中,所述大容量存储单元为报文处理单元外部的存储单元。因本发明能够对业务的所有查找表根据表的存储容量进行分级存储,从而解决了在使用固定的RAM存储查找表时,存储小存储容量查找表的RAM剩余大量存储空间又不能使用而造成的资源浪费问题。

Description

查找表存储方法、装置及计算机可读存储介质 技术领域
本发明涉及计算机通讯领域,尤其涉及一种查找表存储方法、装置以及计算机可读存储介质。
背景技术
随着通信网络技术向纵深发展,特别是新一代移动互联网和物联网技术逐渐成熟,带来了海量终端接入到通讯网络中。由于终端互联需要在交换设备中保存其对应的路由信息,所以海量终端互联造成了交换设备中的交换芯片的查找表越来越大。现代网络考虑到管理维护方便以及技术迭代更新,一般采用多协议,多层次的组网方式来实现终端设备的互联。例如在局域网内,终端设备采用二层网络协议来完成设备间的互联,但是到了网际则采用IP路由协议来完成设备之间的互联。
在不同的应用场景下,对交换设备的查找表的规格是不一样的,但是在现有的实现方案中,存储各类查找表的RAM(随机访问存储单元)存储容量的大小都是固定不变的。在查找表的存储容量远小于固定的RAM存储容量时,会导致在RAM中剩余大量存储容量,但是这部分剩余的存储容量却不能给别的查找表使用,造成了RAM资源的巨大浪费。
上述内容仅用于辅助理解本发明的技术方案,并不代表承认上述内容是现有技术。
发明内容
本发明的主要目的在于提供一种查找表存储方法、装置以及计算机可读存储介质,旨在解决了在使用固定的RAM存储查找表时,存储小存储容量查找表的RAM剩余大量存储空间又不能使用而造成的资源浪费问题。
为了达到上述目的,本发明提供一种查找表存储方法,所述查找表存储方法包括以下步骤:
获取业务需求对应的查找表,并获取所述查找表的第一存储容量;
判断所述查找表的第一存储容量是否大于所述业务需求对应的报文处理单元的第二存储容量;
在所述第一存储容量小于或等于所述第二存储容量时,将所述查找表存储至所述报文处理单元;
在所述查找表的存储容量大于预设存储容量时,将所述查找表存储至大容量存储单元,其中,所述大容量存储单元为报文处理单元外部的存储单元。
优选地,所述判断所述查找表的第一存储容量是否大于所述业务需求对应的报文处理单元的第二存储容量的步骤之前,还包括:
获取所述业务需求对应的查找表配置文件;
根据所述查找表配置文件获取所述业务需求对应的报文处理单元。
优选地,所述将所述查找表存储至所述报文处理单元的步骤包括:
基于所述报文处理单元中的子存储单元获取所述查找表对应的第一宽度信息以及第一深度信息;
根据所述第一宽度信息以及所述第一深度信息将所述查找表存储至所述报文处理单元。
优选地,所述根据所述第一宽度信息以及所述第一深度信息将所述查找表存储至所述报文处理单元的步骤包括:
根据所述第一宽度信息以及所述第一深度信息获取所述查找表存储至所述报文处理单元所需要的第一子存储单元的数量,其中,所述第一子存储单元为所述报文处理单元中的随机访问存储单元;
将所述查找表存储至与所述数量对应的第一子存储单元中。
优选地,所述将所述查找表存储至大容量存储单元的步骤包括:
基于所述大容量存储单元中的子存储单元获取所述查找表的第二宽度信息以及第二深度信息;
根据所述第二宽度信息以及所述第二深度信息将所述查找表存储至所述大容量存储单元。
优选地,所述根据所述第二宽度信息以及所述第二深度信息将所述查找表存储至所述大容量存储单元的步骤包括:
根据所述第二宽度信息以及所述第二深度信息获取所述查找表存储至所述大容量存储单元所需要的第二子存储单元的数量,其中,所述第二子存储单元为所述大容量存储单元中的随机访问存储单元;
将所述查找表存储至与所述数量对应的第二子存储单元中。
此外,为实现上述目的,本发明还提供一种查找表存储装置,所述查找表存储装置包括处理器、存储器及存储在所述存储器上并可在所述处理器上运行的查找表存储程序,所述查找表存储程序被所述处理器执行时实现如上所述的查找表存储方法的步骤。
此外,为实现上述目的,本发明还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有查找表存储程序,所述查找表存储程序被处理器执行时实现如上所述的查找表存储方法的步骤。
本发明提供的查找表存储方法、装置以及计算机可读存储介质,首先,获取业务需求对应的查找表,并获取所述查找表的第一存储容量,然后,判断所述查找表的第一存储容量是否大于所述业务需求对应的报文处理单元的第二存储容量,再,在所述第一存储容量小于或等于所述第二存储容量时,将所述查找表存储至所述报文处理单元,最后,在所述查找表的存储容量大于预设存储容量时,将所述查找表存储至大容量存储单元,其中,所述大容量存储单元为报文处理单元外部的存储单元。因本发明能够对业务的所有查找表根据表的存储容量进行分级存储,从而解决了在使用固定的RAM存储查找表时,存储小存储容量查找表的RAM剩余大量存储空间又不能使用而造成的资源浪费问题。
附图说明
附图说明用来提供对本发明的进一步理解,并且构成说明书的一部分,与本发明的实施例一起用于解释本发明,并不构成对本发明的限制。在附图中:
图1为本发明实施例方案涉及的查找表存储装置的硬件结构示意图;
图2为本发明查找表存储方法第一实施例的流程示意图;
图3为本发明查找表存储方法第二实施例的流程示意图;
图4为本发明查找表存储方法第三实施例的流程示意图;
图5为本发明查找表存储方法第四实施例的流程示意图;
图6为本发明查找表存储方法第五实施例的流程示意图;
图7为本发明查找表存储方法第六实施例的流程示意图。
本发明目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。
本发明实施例的主要解决方案是:获取业务需求对应的查找表,并获取所述查找表的第一存储容量;判断所述查找表的第一存储容量是否大于所述业务需求对应的报文处理单元的第二存储容量;在所述第一存储容量小于或等于所述第二存储容量时,将所述查找表存储至所述报文处理单元;在所述查找表的存储容量大于预设存储容量时,将所述查找表存储至大容量存储单元,其中,所述大容量存储单元为报文处理单元外部的存储单元。
在不同的应用场景下,对交换设备的查找表的规格是不一样的,但是在现有的实现方案中,存储各类查找表的RAM(随机访问存储单元)存储容量的大小都是固定不变的。在查找表的存储容量远小于固定的RAM存储容量时,会导致在RAM中剩余大量存储容量,但是这部分剩余的存储容量却不能给别的查找表使用,造成了RAM资源的巨大浪费。
本发明提供一种解决方案,首先,获取业务需求对应的查找表,并获取所述查找表的第一存储容量,然后,判断所述查找表的第一存储容量是否大于所述业务需求对应的报文处理单元的第二存储容量,再,在所述第一存储容量小于或等于所述第二存储容量时,将所述查找表存储至所述报文处理单元,最后,在所述查找表的存储容量大于预设存储容量时,将所述查找表存储至大容量存储单元,其中,所述大容量存储单元为报文处理单元外部的存储单元。因本发明能够对业务的所有查找表根据表的存储容量进行分级存储,从而解决了在使用固定的RAM存储查找表时,存储小存储容量查找表的RAM剩余大量存储空间又不能使用而造成的资源浪费问题。
如图1所示,图1是本发明实施例方案涉及装置的硬件结构示意图。
参照图1,该装置可以包括:处理器1001,例如CPU,存储器1002,通信总线1003,网络接口1004。其中,通信总线1003用于实现该装置中各组成部件之间的连接通信。网络接口1004可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。存储器1002可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。存储器1002可选的还可以是独立于前述处理器1001的存储装置。如图1所示,作为一种计算机存储介质的存储器1002中可以包括操作系统、网络通信模块以及查找表存储程序。
可选地,第一终端还可以包括摄像头、RF(Radio Frequency,射频)电路,传感器、音频电路、WiFi模块等等。其中,传感器比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示屏的亮度,接近传感器可在智能终端移动到耳边时,关闭显示屏和/或背光。作为运动传感器的一种,重力加速度传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别智能终端姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;当然,智能终端还可配置陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。
本领域技术人员可以理解,图1中示出的装置结构并不构成对装置的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
在图1所示的装置所涉及的硬件中,网络接口1004可以用于接收终端发送的基于业务的所有查找表;而处理器1001可以用于调用存储器1002中存储的查找表存储程序,并执行以下操作:
获取业务需求对应的查找表,并获取所述查找表的第一存储容量;
判断所述查找表的第一存储容量是否大于所述业务需求对应的报文处理单元的第二存储容量;
在所述第一存储容量小于或等于所述第二存储容量时,将所述查找表存储至所述报文处理单元;
在所述查找表的存储容量大于预设存储容量时,将所述查找表存储至大容量存储单元,其中,所述大容量存储单元为报文处理单元外部的存储单元。
进一步地,处理器1001可以用于调用存储器1002中存储的查找表存储程序,还执行以下操作:
获取所述业务需求对应的查找表配置文件;
根据所述查找表配置文件获取所述业务需求对应的报文处理单元。
进一步地,处理器1001可以用于调用存储器1002中存储的查找表存储程序,还执行以下操作:
基于所述报文处理单元中的子存储单元获取所述查找表对应的第一宽度信息以及第一深度信息;
根据所述第一宽度信息以及所述第一深度信息将所述查找表存储至所述报文处理单元。
进一步地,处理器1001可以用于调用存储器1002中存储的查找表存储程序,还执行以下操作:
根据所述第一宽度信息以及所述第一深度信息获取所述查找表存储至所述报文处理单元所需要的第一子存储单元的数量,其中,所述第一子存储单元为所述报文处理单元中的随机访问存储单元;
将所述查找表存储至与所述数量对应的第一子存储单元中。
进一步地,处理器1001可以用于调用存储器1002中存储的查找表存储程序,还执行以下操作:
基于所述大容量存储单元中的子存储单元获取所述查找表的第二宽度信息以及第二深度信息;
根据所述第二宽度信息以及所述第二深度信息将所述查找表存储至所述大容量存储单元。
进一步地,处理器1001可以用于调用存储器1002中存储的查找表存储程序,还执行以下操作:
根据所述第二宽度信息以及所述第二深度信息获取所述查找表存储至所述大容量存储单元所需要的第二子存储单元的数量,其中,所述第二子存储单元为所述大容量存储单元中的随机访问存储单元;
将所述查找表存储至与所述数量对应的第二子存储单元中。
本发明根据上述方案,用户根据业务需求创建所述业务对应的所有查找表,然后将查找表上传到交换设备,以供交换芯片将查找表配置到对于的报 文处理单元或外部的大容量存储单元。终端在获取到所有所述查找表时,获取所有所述查找表的第一存储容量,其中,所述第一存储容量为所述查找表的存储容量大小。然后获取所述业务需求对应的报文处理单元的第二存储容量,并判断所述查找表的第一存储容量是否大于所述业务需求对应的报文处理单元的第二存储容量,其中,所述第二存储容量为所述报文处理单元的存储容量;在判定所述第一存储容量小于或等于所述第二存储容量时,获取所述业务需求对应的查找表配置文件,通过所述查找表配置文件获取所述业务需求对应的报文处理单元,将所述查找表存储至所述报文处理单元中。在判定所述查找表的存储容量大于预设存储容量时,将所述查找表存储至大容量存储单元,其中,所述大容量存储单元为报文处理单元外部的存储单元。
参照图2,图2为本发明查找表存储方法的第一实施例,所述查找表存储方法包括:
步骤S10、获取业务需求对应的查找表,并获取所述查找表的第一存储容量;
本发明提供的查找表存储方法主要用于将用户创建的基于业务的所有查找表进行分级存储。本发明提供的查找表存储方法涉及的终端包括可以是交换机等,所述终端上预先加载有相关的应用系统。
本发明提供的技术方案,用户根据业务需求创建所述业务对应的所有查找表,然后将所有所述查找表上传到终端。终端在获取到所有所述查找表时,获取所有所述查找表的第一存储容量。
需要说明的是,本申请规划了多级查找表。所述查找表根据储存容量的大小进行分级。可以划分两级或两级以上,本申请以划分为两级查找表进行阐述。所述PPU根据业务逻辑划分等级先后顺序,每级PPU内部有M张查找表(取决于RAM的数量,一个RAM对应只能存储一张查找表的内容,但是一张查找表可以有一个或多个RAM组成),这些查找表的容量比较小,可以存储一些表项条目数比较少的内容,例如端口属性表,VLAN(虚拟局域网)属性表,VFI(虚拟转发域实例virtual forward instance)属性表就可以存放在对应的PPU内。有些容量较大的查找表,例如MAC地址交换表,MPLS交换表,IP路由表等包含巨大条目数,这些查找表存储在PPU外部的大容量存储单元中。
需要说明的是,PPU内部的查找表或者大容量存储单元中的查找表,查找表的深度和宽度都是可通过配置文件或软件编程配置其深度和宽度的大小,可以理解的是,对于在某种特定场景下没有业务使用的查找表,可以配置分配0块RAM资源,将其RAM的资源可以分配给其他的查找表使用。
需要说明的是,每个查找表都包含p个配置寄存器,用于生成查表需要的关键字。每个配置寄存器配置了关键字的字段在报文描述符字段的对应的字节位置,字节内的位置,字段的比特长度。根据配置寄存器的配置值可以从报文的描述符字段取出对应的关键字,然后根据配置寄存器的顺序将各个关键字进行拼接,得到查表关键字。
步骤S20、判断所述查找表的第一存储容量是否大于所述业务需求对应的报文处理单元的第二存储容量;
本实施例提供的技术方案中,在获取到当前存储表的存储容量后,获取所述查找表对应的配置文件,然后根据所述配置文件获取当前查找表基于当前业务是哪一级的PPU,再获取所述PPU的第二存储容量,所述第二存储容量为当前PPU的存储容量大小,再判断所述查找表的第一存储容量是否大于所述业务需求对应的报文处理单元的第二存储容量。
需要说明的是,本申请规划了多级查找表。存储容量较小的查找表存储在PPU(报文处理单元packet process unit)内部的存储单元中,其中,PPU内部的查找表对应的RAM规格比较小;存储容量较大的查找表配置到PPU的外部实现,PPU外部的查找表对应的RAM的规格比较大,可以通过外挂的DDR(双倍速率同步动态随机存储器)进行存储。可以理解的是,为了存储更大容量的查找表,所述PPU外部的RAM的深度是内部的RAM的深度四倍或四倍以上,但PPU外部的RAM的深度是内部的RAM的深度也可以是相同的。即便同等深度的查找表,其表项的宽度差别也是比较大的,有些查找表的宽度只有二十几比特,有些查找表的宽度四五百比特。
需要说明的是,每级PPU支持与外部的大容量存储单元关联两张大容量查找表时,即可满足交换业务的需求,也可以每级PPU支持与外部的大容量存储单元关联多张大容量存储表。也可以任一级PPU不与外部的大容量存储单元中的大容量查找表关联。
需要说明的是,PPU内部和外部的RAM读写控制模块都有一个查找表寄存器,所述查找表属性寄存器的内容包括查找表的深度信息、查找表的字 节宽度、查找表的比特宽度、是否携带counter指针(计数器指针),是否携带meter指针(流量测量器指针)等。同时PPU内部的RAM读写控制模块的每一块RAM也包含描述该RAM的属性寄存器。
步骤S30、在所述第一存储容量小于或等于所述第二存储容量时,将所述查找表存储至所述报文处理单元;
本实施例提供的技术方案中,在所述第一存储容量小于或等于所述第二存储容量时,获取所述报文处理单元中的RAM的宽度以及深度,然后获取当前查找表对应的宽度以及深度,再将查找表的深度与RAM的深度进行比较,将查找表的宽度与RAM的宽度进行比较,从而得到在PPU中存储所述查找表需要的RAM的数量,例如,如果表的深度是2048,宽度是256比特RAM的深度是512,宽度是128比特那么宽度需要两个RAM,深度需要四块RAM,最后将宽度的两个RAM进行拼接,将深度的四个RAM进行拼接,得到一个拼接了八块RAM的存储空间存储所述查找表。
步骤S40、在所述查找表的存储容量大于预设存储容量时,将所述查找表存储至大容量存储单元,其中,所述大容量存储单元为报文处理单元外部的存储单元。
本实施例提供的技术方案中,在所述第一存储容量大于所述第二存储容量时,获取所述大容量存储单元中的RAM的宽度以及深度,然后获取当前查找表对应的宽度以及深度,再将查找表的深度与RAM的深度进行比较,将查找表的宽度与RAM的宽度进行比较,从而得到在所述大容量存储单元中存储所述查找表需要的RAM的数量。拼接所述数量的RAM后存储所述查找表。
本发明根据上述方案,用户根据业务需求创建所述业务对应的所有查找表,然后将查找表上传到交换设备,以供交换芯片将查找表配置到对于的报文处理单元或外部的大容量存储单元。终端在获取到所有所述查找表时,获取所有所述查找表的第一存储容量,其中,所述第一存储容量为所述查找表的存储容量大小。然后获取所述业务需求对应的报文处理单元的第二存储容量,并判断所述查找表的第一存储容量是否大于所述业务需求对应的报文处理单元的第二存储容量,其中,所述第二存储容量为所述报文处理单元的存储容量;在判定所述第一存储容量小于或等于所述第二存储容量时,获取所述业务需求对应的查找表配置文件,通过所述查找表配置文件获取所述业务 需求对应的报文处理单元,将所述查找表存储至所述报文处理单元中。在判定所述查找表的存储容量大于预设存储容量时,将所述查找表存储至大容量存储单元,其中,所述大容量存储单元为报文处理单元外部的存储单元。
因本发明能够对业务的所有查找表根据表的存储容量进行分级存储,从而解决了在使用固定的RAM存储查找表时,存储小存储容量查找表的RAM剩余大量存储空间又不能使用而造成的资源浪费问题。
进一步的,参照图3,图3为本发明查找表存储方法的第二实施例,基于上述实施例,所述步骤S20之前,还包括:
步骤S50、获取所述业务需求对应的查找表配置文件;
步骤S60、根据所述查找表配置文件获取所述业务需求对应的报文处理单元。
本实施例提供的技术方案中,进一步地,在获取到当前存储表的第一存储容量后,获取预设存储容量,在所述第一存储容量小于或等于所述预设存储容量时,获取所述查找表对应的配置文件,然后根据所述配置文件获取当前查找表对应的PPU,最后将查找表存储至所述PPU中。
进一步地,报文首先进入报文处理单元进行解析,获取报文的结构,并将解析结果放置到报文的描述符字段,发送至后续的PPU进行处理。其中,所述报文解析结果主要是报文的类型、MAC DA、MAC SA、VLAN属性、Eth-Type、DIP、SIP、IP协议号、IP TTL以及UDP源目的端口号等。一个报文处理需要多级PPU才能处理完,所述多级PPU可以是12级或更多级,也可以少于12级PPU,业务需要的PPU级数可通过配置文件进行配置。每级PPU对应不同的查表功能,例如,第一级的PPU存储的查找表为端口属性表,在获取到端口属性后,进入下一级PPU进行查表,下一级PPU存储的查找表为VLAN属性表,获取了VLAN属性后继续进入下一级的PPU进行查表。经过多级PPU处理后将描述符和报文的内容送给报文处理单元进行报文修改,最后根据描述符字段指示的输出端口将报文从正确的目的端口转发出去。
进一步地,在报文进入PPU进行查表时,PPU根据查找表属性寄存器配置内容包括查找表的深度确定访问的查找表对应的RAM块。可以理解的是,PPU内部的RAM读写控制模块的每一块RAM都含有属性寄存器。所述属 性寄存器存储了RAM属于查找表的逻辑表号,所述RAM位于对应查找表的行块和列块,该RAM选用的hash函数编号等。所述PPU内部RAM读写控制模块接收到的查表请求后,每块RAM都根据查表的请求和查表地址查看自己的RAM属性寄存器的查找表编号,确定查表请求对应的查找表编号和RAM属性寄存器配置的查找表编号一致后,再判断查表请求对应的地址是否落在自己所在的查找表的行块内,如果是则发起读RAM的请求信号,同时驱动RAM的地址为查找表的地址,读出RAM内部的数据。然后根据RAM的属性寄存器配置的逻辑表列块号将读出的数据放入到结果寄存器的对应位置上。最后将查表的结果按照查找表属性寄存器中的表字节宽度配置值将查表结果切成等长的分片。如果是hash表查找,那么需要将所有分片中取出关键字字段和请求查表的关键字段进行比较,如果相等则对应的该分片为本次查找的结果。如果是直接表查找,那么根据地址的低位从所有分片中选择一片作为本次查表的结果。
终端通过配置文件配置查找表存储的目标PPU,从而方便业务逻辑的实现。所述终端将查表结果分成多片数据,再从中取一片数据作为最终结果,节省了RAM的空间。
进一步的,参照图4,图4为本发明查找表存储方法的第三实施例,在上述图2所示的实施例基础上,所述步骤S30,包括:
步骤S31、基于所述报文处理单元中的子存储单元获取所述查找表对应的第一宽度信息以及第一深度信息;
步骤S32、根据所述第一宽度信息以及所述第一深度信息将所述查找表存储至所述报文处理单元。
本实施例提供的技术方案中,在所述第一存储容量小于或等于所述第二存储容量时,获取所述报文处理单元中的RAM的宽度以及深度,然后获取当前查找表对应的宽度以及深度,再将查找表的深度与RAM的深度进行比较,将查找表的宽度与RAM的宽度进行比较,从而基于所述报文处理单元中的子存储单元获取所述查找表对应的第一宽度信息以及第一深度信息,最后根据所述第一宽度信息以及所述第一深度信息将所述查找表存储至所述报文处理单元。
终端基于所述报文处理单元中的子存储单元获取所述查找表对应的第一 宽度信息以及第一深度信息,再根据第一宽度信息以及第一深度信息存储所述查找表,所述从而避免了内存资源浪费。
进一步的,参照图5,图5为本发明查找表存储方法的第四实施例,在上述图4所示的实施例基础上,所述步骤S32,包括:
步骤S321、根据所述第一宽度信息以及所述第一深度信息获取所述查找表存储至所述报文处理单元所需要的第一子存储单元的数量,其中,所述第一子存储单元为所述报文处理单元中的随机访问存储单元;
步骤S322、将所述查找表存储至与所述数量对应的第一子存储单元中。
本实施例提供的技术方案中,在所述第一存储容量小于或等于所述第二存储容量时,获取所述报文处理单元中的RAM的宽度以及深度,然后获取当前查找表对应的宽度以及深度,再将查找表的深度与RAM的深度进行比较,将查找表的宽度与RAM的宽度进行比较,从而得到在PPU中存储所述查找表需要的RAM的数量,例如,如果表的深度是2048,宽度是256比特RAM的深度是512,宽度是128比特那么宽度需要两个RAM,深度需要四块RAM,最后将宽度的两个RAM进行拼接,将深度的四个RAM进行拼接,得到一个拼接了八块RAM的存储空间存储所述查找表。
终端基于所述报文处理单元中的子存储单元获取所述查找表对应的第一宽度信息以及第一深度信息,再根据第一宽度信息以及第一深度信息获取存储到PPU中需要的RAM的数量,所述从而避免了内存资源浪费。
进一步的,参照图6,图6为本发明查找表存储方法的第五实施例,在上述图2所示的实施例基础上,所述步骤S40,包括:
步骤S41、基于所述大容量存储单元中的子存储单元获取所述查找表的第二宽度信息以及第二深度信息;
步骤S42、根据所述第二宽度信息以及所述第二深度信息将所述查找表存储至所述大容量存储单元。
本实施例提供的技术方案中,在所述第一存储容量大于所述第二存储容量时,获取所述大容量存储单元中的RAM的宽度以及深度,然后获取当前查找表对应的宽度以及深度,再将查找表的深度与RAM的深度进行比较,将查找表的宽度与RAM的宽度进行比较,从而基于所述大容量存储单元中 的子存储单元获取所述查找表的第二宽度信息以及第二深度信息,最后根据所述第二宽度信息以及所述第二深度信息将所述查找表存储至所述大容量存储单元。
终端基于所述大容量存储单元中的子存储单元获取所述查找表的第二宽度信息以及第二深度信息,再根据第二宽度信息以及第二深度信息存储所述查找表,所述从而避免了内存资源浪费。
进一步的,参照图7,图7为本发明查找表存储方法的第六实施例,在上述图6所示的实施例基础上,所述步骤S42,包括:
步骤S421、根据所述第二宽度信息以及所述第二深度信息获取所述查找表存储至所述大容量存储单元所需要的第二子存储单元的数量,其中,所述第二子存储单元为所述大容量存储单元中的随机访问存储单元;
步骤S422、将所述查找表存储至与所述数量对应的第二子存储单元中。
本实施例提供的技术方案中,在所述第一存储容量大于所述第二存储容量时,获取所述大容量存储单元中的RAM的宽度以及深度,然后获取当前查找表对应的宽度以及深度,再将查找表的深度与RAM的深度进行比较,将查找表的宽度与RAM的宽度进行比较,从而得到在大容量存储单元中存储所述查找表需要的RAM的数量。拼接所述数量的RAM后存储所述查找表。
终端基于所述大容量存储单元中的子存储单元获取所述查找表对应的第二宽度信息以及第二深度信息,再根据第二宽度信息以及第二深度信息获取存储到大容量存储单元中需要的RAM的数量,所述从而避免了大容量存储单元中内存资源浪费。
为实现上述目的,本发明还提供一种查找表存储装置,所述查找表存储装置包括处理器、存储器及存储在所述存储器上并可在所述处理器上运行的查找表存储程序,所述查找表存储程序被所述处理器执行时实现如上所述的查找表存储方法的步骤。
为实现上述目的,本发明还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有查找表存储程序,所述查找表存储程序被处理器执行 时实现如上所述的查找表存储方法的步骤。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者系统不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者系统所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者系统中还存在另外的相同要素。
上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是电视机,手机,计算机,装置,空调器,或者网络设备等)执行本发明各个实施例所述的方法。
以上仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。

Claims (8)

  1. 一种查找表存储方法,其特征在于,所述查找表存储方法包括以下步骤:
    获取业务需求对应的查找表,并获取所述查找表的第一存储容量;
    判断所述查找表的第一存储容量是否大于所述业务需求对应的报文处理单元的第二存储容量;
    在所述第一存储容量小于或等于所述第二存储容量时,将所述查找表存储至所述报文处理单元;
    在所述查找表的存储容量大于预设存储容量时,将所述查找表存储至大容量存储单元,其中,所述大容量存储单元为报文处理单元外部的存储单元。
  2. 如权利要求1所述的查找表存储方法,其特征在于,所述判断所述查找表的第一存储容量是否大于所述业务需求对应的报文处理单元的第二存储容量的步骤之前,还包括:
    获取所述业务需求对应的查找表配置文件;
    根据所述查找表配置文件获取所述业务需求对应的报文处理单元。
  3. 如权利要求1所述的查找表存储方法,其特征在于,所述将所述查找表存储至所述报文处理单元的步骤包括:
    基于所述报文处理单元中的子存储单元获取所述查找表对应的第一宽度信息以及第一深度信息;
    根据所述第一宽度信息以及所述第一深度信息将所述查找表存储至所述报文处理单元。
  4. 如权利要求3所述的查找表存储方法,其特征在于,所述根据所述第一宽度信息以及所述第一深度信息将所述查找表存储至所述报文处理单元的步骤包括:
    根据所述第一宽度信息以及所述第一深度信息获取所述查找表存储至所述报文处理单元所需要的第一子存储单元的数量,其中,所述第一子存储单元为所述报文处理单元中的随机访问存储单元;
    将所述查找表存储至与所述数量对应的第一子存储单元中。
  5. 如权利要求1所述的查找表存储方法,其特征在于,所述将所述查找表存储至大容量存储单元的步骤包括:
    基于所述大容量存储单元中的子存储单元获取所述查找表的第二宽度信息以及第二深度信息;
    根据所述第二宽度信息以及所述第二深度信息将所述查找表存储至所述大容量存储单元。
  6. 如权利要求5所述的查找表存储方法,其特征在于,所述根据所述第二宽度信息以及所述第二深度信息将所述查找表存储至所述大容量存储单元的步骤包括:
    根据所述第二宽度信息以及所述第二深度信息获取所述查找表存储至所述大容量存储单元所需要的第二子存储单元的数量,其中,所述第二子存储单元为所述大容量存储单元中的随机访问存储单元;
    将所述查找表存储至与所述数量对应的第二子存储单元中。
  7. 一种查找表存储装置,其特征在于,所述查找表存储装置包括处理器、存储器及存储在所述存储器上并可在所述处理器上运行的查找表存储程序,所述查找表存储程序被所述处理器执行时实现如权利要求1至6中任一项所述的查找表存储方法的步骤。
  8. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有查找表存储程序,所述查找表存储程序被处理器执行时实现如权利要求1至6中任一项所述的查找表存储方法的步骤。
PCT/CN2019/114427 2018-12-11 2019-10-30 查找表存储方法、装置及计算机可读存储介质 WO2020119310A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811515641.5A CN109558091B (zh) 2018-12-11 2018-12-11 查找表存储方法、装置及计算机可读存储介质
CN201811515641.5 2018-12-11

Publications (1)

Publication Number Publication Date
WO2020119310A1 true WO2020119310A1 (zh) 2020-06-18

Family

ID=65869605

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/114427 WO2020119310A1 (zh) 2018-12-11 2019-10-30 查找表存储方法、装置及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN109558091B (zh)
WO (1) WO2020119310A1 (zh)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109558091B (zh) * 2018-12-11 2020-10-13 广东省新一代通信与网络创新研究院 查找表存储方法、装置及计算机可读存储介质
CN112905587A (zh) * 2019-12-04 2021-06-04 北京金山云网络技术有限公司 数据库的数据管理方法、装置及电子设备
CN111078627A (zh) * 2019-12-04 2020-04-28 广东省新一代通信与网络创新研究院 一种阵列处理器的无冲突访问方法、装置及存储介质
CN111683036B (zh) * 2020-02-29 2022-05-27 新华三信息安全技术有限公司 数据存储方法、装置以及报文识别方法和装置
CN112668260B (zh) * 2020-12-17 2024-04-12 北京物芯科技有限责任公司 一种芯片sram拼接方法、装置、电子设备和存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5951629A (en) * 1997-09-15 1999-09-14 Motorola, Inc. Method and apparatus for log conversion with scaling
CN1434603A (zh) * 2002-01-23 2003-08-06 华为技术有限公司 一种查找表电路的实现方法及查找表电路
CN103414658A (zh) * 2013-08-05 2013-11-27 北京华为数字技术有限公司 查找表和报文缓存共享动态随机访问存储器的系统和方法
CN109558091A (zh) * 2018-12-11 2019-04-02 广东省新代通信与网络创新研究院 查找表存储方法、装置及计算机可读存储介质

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1176539C (zh) * 2001-11-27 2004-11-17 华为技术有限公司 一种节省查找表存储器和中间状态存储器的方法
US8576206B2 (en) * 2007-12-05 2013-11-05 Hamamatsu Photonics K.K. Phase modulating apparatus and phase modulating method
US9129441B2 (en) * 2010-06-21 2015-09-08 Microsoft Technology Licensing, Llc Lookup tables for text rendering
CN104539537B (zh) * 2014-12-25 2018-04-20 北京华为数字技术有限公司 一种路由查找方法和装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5951629A (en) * 1997-09-15 1999-09-14 Motorola, Inc. Method and apparatus for log conversion with scaling
CN1434603A (zh) * 2002-01-23 2003-08-06 华为技术有限公司 一种查找表电路的实现方法及查找表电路
CN103414658A (zh) * 2013-08-05 2013-11-27 北京华为数字技术有限公司 查找表和报文缓存共享动态随机访问存储器的系统和方法
CN109558091A (zh) * 2018-12-11 2019-04-02 广东省新代通信与网络创新研究院 查找表存储方法、装置及计算机可读存储介质

Also Published As

Publication number Publication date
CN109558091A (zh) 2019-04-02
CN109558091B (zh) 2020-10-13

Similar Documents

Publication Publication Date Title
WO2020119310A1 (zh) 查找表存储方法、装置及计算机可读存储介质
CN110621045B (zh) 一种物联网业务路由的方法
US9917889B2 (en) Enterprise service bus routing system
KR102376713B1 (ko) 복합 파티션 함수 제공 기법
US20150304212A1 (en) Method and apparatus for matching flow table, and switch
US10459729B2 (en) Map tables for hardware tables
US20180131584A1 (en) Reliable Address Discovery Cache
WO2021128903A1 (zh) 加快读取现场可更换单元信息的方法、系统、设备及介质
US11012358B2 (en) Forwarding table management
US20140164645A1 (en) Routing table maintenance
CN111064804B (zh) 网络访问方法和装置
CN111756629B (zh) 设备接入overlay网络及通信的方法、装置、设备、网络及介质
WO2014190700A1 (zh) 一种内存访问的方法、缓冲调度器和内存模块
WO2024041335A1 (zh) 一种寻址测试的方法、装置、存储介质及电子设备
WO2021227873A1 (zh) 用于报文传输的方法和节点
US20180367452A1 (en) Information centric networking over multi-access network interfaces
CN112291212B (zh) 静态规则的管理方法、装置、电子设备和存储介质
WO2016197607A1 (zh) 一种实现路由查找的方法及装置
WO2021211311A1 (en) Distributed flow processing and flow cache
KR102467294B1 (ko) 병렬 연산을 이용한 중복 음원 검출 장치 및 중복 음원 검출 방법
CN117097779B (zh) 一种网络通信的方法、装置、存储介质及电子设备
US11528206B2 (en) Identifying and mapping applications to devices in a network
US20230409514A1 (en) Transaction based remote direct memory access
US11853560B2 (en) Conditional role decision based on source environments
CN116527529A (zh) 数据通信方法、装置、电子设备和介质

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

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 20.10.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 19897485

Country of ref document: EP

Kind code of ref document: A1