WO2023179433A1 - 流表存储及报文转发方法、装置、计算设备及介质 - Google Patents

流表存储及报文转发方法、装置、计算设备及介质 Download PDF

Info

Publication number
WO2023179433A1
WO2023179433A1 PCT/CN2023/081724 CN2023081724W WO2023179433A1 WO 2023179433 A1 WO2023179433 A1 WO 2023179433A1 CN 2023081724 W CN2023081724 W CN 2023081724W WO 2023179433 A1 WO2023179433 A1 WO 2023179433A1
Authority
WO
WIPO (PCT)
Prior art keywords
flow table
hash value
stored
memory
message
Prior art date
Application number
PCT/CN2023/081724
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 WO2023179433A1 publication Critical patent/WO2023179433A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2255Hash tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • 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

Definitions

  • One or more embodiments of this specification relate to the field of communication technology, and in particular, to a flow table storage and message forwarding method, device, computing device, and medium.
  • one or more embodiments of this specification provide a flow table storage and packet forwarding method, device, computing device, and medium.
  • a flow table storage method which method includes:
  • the flow table to be stored has identification information, and storing the second hash value of the flow table to be stored in the first memory according to the first hash value includes:
  • the first hash value obtain the address of the bucket corresponding to the flow table to be stored in the first memory
  • the keywords and data according to the flow table to be stored are stored in the second memory, including:
  • a message forwarding method which method includes:
  • a second hash value of a key of at least one flow table is obtained from the first memory, and by combining the fourth hash value with the key of the at least one flow table Compare the second hash value to determine the flow table that matches the message to be forwarded; wherein the address storing the second hash value in the first memory is based on the first hash of the key of the flow table. The hope value is determined;
  • Flow table including:
  • the second hash value of the flow table stored in each slot of the bucket is compared with the fourth hash value of the message, and the flow table with the same hash value is determined to be the same as the message to be forwarded. Matching flow table.
  • the identification information of the flow table is also stored in each slot of the bucket; the obtaining the key of the flow table from the second memory includes:
  • the identification information obtain the address of the corresponding bucket in the second memory
  • a flow table storage device includes:
  • the first acquisition unit is used to acquire the keywords and data of the flow table to be stored
  • a second acquisition unit configured to acquire the first hash value and the second hash value of the keyword
  • a first storage unit configured to store the second hash value of the flow table to be stored in the first memory according to the first hash value
  • the second storage unit is used to store the keywords and data of the flow table to be stored in the second memory.
  • the flow table to be stored has identification information, and the first storage unit is specifically used for:
  • the first hash value obtain the address of the bucket corresponding to the flow table to be stored in the first memory
  • the second storage unit is specifically used for:
  • a flow table storage device includes:
  • the first obtaining unit is used to obtain the keyword of the message to be forwarded, and obtain the third hash value and the fourth hash value of the keyword;
  • Determining unit configured to obtain a second hash value of a key of at least one flow table from the first memory according to the third hash value, and compare the fourth hash value with the at least one Compare the second hash value of the key of the flow table to determine the flow table that matches the message to be forwarded; wherein, the address of the second hash value stored in the first memory is based on the key of the flow table.
  • the first hash value of the word is determined;
  • a second acquisition unit configured to acquire the keywords of the flow table that match the message to be forwarded from the second memory, where the keywords and data of the flow table are stored in the second memory;
  • a forwarding unit configured to forward the packet to be forwarded according to the data in the flow table when the keyword of the flow table matches the keyword of the packet to be forwarded.
  • the determining unit is specifically used to:
  • the second hash value of the flow table stored in each slot of the bucket is compared with the fourth hash value of the message, and the flow table with the same hash value is determined to be the same as the message to be forwarded. Matching flow table.
  • the forwarding unit is specifically used to:
  • the identification information obtain the address of the corresponding bucket in the second memory
  • a computing device including:
  • Memory used to store instructions executable by the processor
  • the processor executes executable instructions to implement operations performed by the flow table storage method or the packet forwarding method provided in any of the above embodiments.
  • a computer-readable storage medium on which computer instructions are stored.
  • the instructions are executed by a processor, the flow table storage method provided in any embodiment is implemented or The operation performed by the message forwarding method.
  • a computer program product including a computer program.
  • the program When the program is executed by a processor, it implements the flow table storage method or the message forwarding method provided by any embodiment. The operation performed.
  • This application obtains the first hash value and the second hash value of the keyword of the flow table to be stored, and stores the second hash value of the flow table to be stored in the first hash value.
  • the keywords and data of the flow table to be stored are stored in the second memory, more flow tables can be stored while ensuring that the bandwidth is met, and since the address management of the flow table is combined with the flow table Data is separated, reducing hash collisions.
  • FIG. 1 is a schematic diagram of flow table storage in related technology provided by an exemplary embodiment.
  • Figure 2 is a flow chart of a flow table storage method provided by an exemplary embodiment.
  • Figure 3 is a flow chart of a flow table storage method provided by an exemplary embodiment.
  • Figure 4 is a flow chart of packet forwarding provided by an exemplary embodiment.
  • Figure 5 is a block diagram of a flow table storage device provided in an exemplary embodiment.
  • Figure 6 is a block diagram of a packet forwarding device provided in an exemplary embodiment.
  • FIG. 7 is a schematic structural diagram of a computing device provided by an exemplary embodiment.
  • the steps of the corresponding method are not necessarily performed in the order shown and described in this specification.
  • methods may include more or fewer steps than described in this specification.
  • a single step described in this specification may be broken down into multiple steps for description in other embodiments; and multiple steps described in this specification may also be combined into a single step in other embodiments. describe.
  • DRAM dynamic random access memories
  • memories DDR0 and DDR1 are used to store the flow table.
  • the flow table to be stored can be issued by the management and control platform, and usually includes the flow table's identification information (ID, that is, flow_id in Figure 1), keywords (key), and flow table data (value).
  • ID that is, flow_id in Figure 1
  • keywords key
  • flow table data value
  • the exact key is extracted from the information of the flow table to be stored issued by the management and control platform, and the hash value of the key is used to determine the storage address of the flow table.
  • the address pointed to by the hash value of the keyword is addr_3, so the ID, keyword, and data of the flow table are stored in the bucket with the address addr_3.
  • this application provides a flow table storage method, which can be executed by a computer device.
  • the computer device can be a server, such as a server, multiple servers, a cloud computing platform, etc.
  • the computer device can also For other types of equipment, this application does not limit the type of computer equipment.
  • the implementation of the present application is introduced below.
  • Figure 2 is a flow chart of a flow table storage method provided by an exemplary embodiment. The method includes:
  • Step 201 Obtain the keywords and data of the flow table to be stored.
  • the flow table to be stored can be issued by the management and control platform.
  • the information issued by the management and control platform may include keywords and data of the flow table to be stored, etc.
  • Step 202 Obtain the first hash value and the second hash value of the keyword.
  • the hash function a can be used to process the key of the flow table to be stored to obtain the first hash value.
  • This process can be expressed as hasha(key1), where key1 represents the key of the flow table to be stored. Keyword, hasha represents hash function a; at the same time, hash function b can be used to process the keyword of the flow table to be stored to obtain the second hash value.
  • This process can be expressed as hashb(key1), where, key1 represents the key of the flow table to be stored, and hashb represents the hash function b.
  • Step 203 Store the second hash value of the flow table to be stored in the first memory according to the first hash value.
  • the second hash value of the flow table to be stored may be stored in the corresponding location of the first memory according to the address information indicated by the first hash value.
  • Step 204 Store the keywords and data of the flow table to be stored in the second memory.
  • the address in the first memory indicated by the first hash value of the keyword of the flow table to be stored is used to store the second hash value of the keyword, and the flow to be stored
  • the keywords and data of the table are stored in the second memory.
  • the first The flow table information items stored in the memory and the second memory are jointly used to process the message. Since the address indicated by the first hash value stores the second hash value, compared with storing keywords and data, the amount of data stored in the address corresponding to the first hash value is reduced. On the one hand, it makes More flow tables can be stored. On the other hand, when the flow table is used for packet forwarding, one more match with a hash value can be added, thus reducing the probability of a hash conflict.
  • This application obtains the first hash value and the second hash value of the keyword of the flow table to be stored, and stores the second hash value of the flow table to be stored in the first hash value.
  • the keywords and data of the flow table to be stored are stored in the second memory, more flow tables can be stored while ensuring that the bandwidth is met, and since the address management of the flow table is combined with the flow table Data is separated, reducing hash collisions.
  • the flow table to be stored has identification information (ID). According to the identification information, the flow table entries stored in the first memory can be associated with the flow table entries stored in the second memory.
  • ID identification information
  • the address of the bucket corresponding to the flow table to be stored in the first memory can be obtained; the identification information of the flow table to be stored and the second hash The value is stored in the bucket's slot.
  • FIG. 3 See Figure 3 for a schematic diagram of flow table storage.
  • the first hash value hasha key
  • Each bucket of the first memory has several slots, and the ID (flow_id) and the second hash value hashb (key) of the flow table to be stored can be stored in the free slot of the bucket with address addr_3. Since the data volume of the ID and hashb (key) of the flow table to be stored is smaller than the keyword and data, more slots can be set in the addr_3 bucket to store flow table items, thus increasing the number of flow table storage. .
  • each address (each bucket) of DDR0 can store 9 slots.
  • the embodiment of the present disclosure increases the storage capacity of the flow table while ensuring bandwidth.
  • the keywords and data of the flow table can be stored by the following method: according to the identification information of the flow table to be stored, obtain the information in the flow table to be stored. The address of the corresponding bucket in the second memory is used to store the keywords and data of the flow table to be stored in the slot of the bucket.
  • the storage location of the flow table to be stored in the first memory is associated with the storage location of the flow table in the second memory.
  • This application also provides a message forwarding method, which processes the received message based on the flow table stored by the flow table storage method proposed in the embodiment of the present disclosure.
  • the above method can be applied to a message forwarding device.
  • the message forwarding device can be, for example, a computer device, such as a server, multiple servers, a cloud computing platform, etc.
  • the computer device can also be other types of devices, This application does not limit the type of computer equipment.
  • the implementation of the present application is introduced below.
  • Figure 4 is a flow chart of a message forwarding method provided by an exemplary embodiment. The method includes:
  • Step 401 Obtain the keyword of the message to be forwarded, and obtain the third hash value and the fourth hash value of the keyword.
  • the message forwarding device In response to receiving the message, the message forwarding device first obtains the keyword of the message, and obtains the third hash value and the fourth hash value of the keyword.
  • the hash function a can be used to process the keyword of the message to obtain the third hash value.
  • This process can be expressed as hasha(key_m), where key_m represents the keyword of the message.
  • hasha represents hash function a; at the same time, hash function b can be used to process the keyword of the message to obtain the fourth hash value.
  • This process can be expressed as hashb(key_m), where hashb represents hash Function b.
  • Step 402 According to the third hash value, obtain a second hash value of a key of at least one flow table from the first memory, and compare the fourth hash value with the at least one flow table The second hash value of the keyword is compared to determine the flow table matching the message to be forwarded.
  • the address where the second hash value is stored in the first memory is determined based on the first hash value of the key of the flow table.
  • the same hashing process is used for the keywords of the flow table and the keywords of the packets. That is, the first hash value and the second hash value of the keyword of the flow table are also obtained by processing the keyword of the flow table using hash function a and hash function b respectively.
  • the flow table with the same fourth hash value is determined as a matching flow. surface.
  • Step 403 Obtain the keywords of the flow table that match the packet to be forwarded from the second memory, where the keywords and data of the flow table are stored in the second memory.
  • Step 404 If the keyword of the flow table matches the keyword of the packet to be forwarded, perform forwarding processing on the packet to be forwarded according to the data in the flow table.
  • the keywords of the flow table are compared with the keywords of the message to be forwarded. If the keywords are the same and a match is confirmed, the data of the matching flow table is read, and the packet is forwarded according to the action indicated by the data.
  • the message to be forwarded first determine the address pointed to in the first memory according to the third hash value of the keyword of the message, and read the keyword of at least one flow table stored in the address. the second hash value of the message, and determine the matching flow table based on the matching result of the fourth hash value of the message and the second hash value of each flow table; and then read the matching flow in the second memory.
  • the keywords of the flow table and if the keywords of the flow table match the keywords of the message, read the data of the matched flow table and forward the message.
  • the flow table matching the message to be forwarded is determined according to the following method: obtaining the address of the corresponding bucket in the first memory according to the second hash value of the message; The second hash value of the flow table stored in each slot of the bucket is compared with the fourth hash value of the message, and the flow table with the same hash value is determined to match the message to be forwarded. flow table.
  • identification information of the flow table is also stored in each slot of the bucket; obtaining the key of the flow table from the second memory includes: obtaining the flow matching the message to be forwarded.
  • the identification information of the table includes: obtaining the address of the corresponding bucket in the second memory; obtain the keywords and data of the flow table stored in the bucket; compare the keywords of the flow table with the If the keywords of the message to be forwarded match, forwarding processing of the message to be forwarded is performed according to the data in the flow table.
  • the packet forwarding method proposed in this application will be described in detail below, taking the packet forwarding device to store the flow table using the flow table storage method shown in Figure 3 and then forward the packet as an example.
  • the bucket corresponding to each address of the first memory DDR0 has several slots.
  • the ID of the flow table (flow_id) and the second hash value hashb(key) of the key key of the flow table are stored, and each address of the flow table is the same as the second hash value of the key key of the flow table.
  • Each address of the second memory DDR1 corresponds to the ID of the flow table, and the bucket corresponding to each address stores the keyword key and data value of the flow table.
  • the third hash value hasha (key_m) and the fourth hash value hashb (key_m) of the texture information key_m are first obtained.
  • the ID of the flow table can be obtained, and the ID can be used to obtain the flow table entry stored in the second memory DDR1.
  • the ID can be used to obtain the flow table entry stored in the second memory DDR1.
  • determine that the corresponding address in the second memory DDR1 corresponding to the flow table ID is flow_id_m-6, and obtain the information stored in the bucket of this address.
  • the keywords and data of the flow table with ID m-6 Compare the keyword of the message to be forwarded with the keyword of the obtained flow table with ID m-6. If the keywords are the same, that is, they match, the keyword of the message to be forwarded is compared based on the data corresponding to the keyword. Forward the message and perform corresponding forwarding processing.
  • Figure 5 is a block diagram of a flow table storage device provided by an exemplary embodiment.
  • the device includes:
  • the first acquisition unit 501 is used to acquire the keywords and data of the flow table to be stored;
  • the second obtaining unit 502 is used to obtain the first hash value and the second hash value of the keyword
  • the first storage unit 503 is configured to store the second hash value of the flow table to be stored in the first memory according to the first hash value;
  • the second storage unit 504 is used to store the keywords and data of the flow table to be stored in the second memory.
  • the flow table to be stored has identification information, and the first storage unit is specifically used for:
  • the first hash value obtain the address of the bucket corresponding to the flow table to be stored in the first memory
  • the second storage unit is specifically used for:
  • Figure 6 is a block diagram of a message forwarding device provided in an exemplary embodiment.
  • the device includes:
  • the first obtaining unit 601 is used to obtain the keyword of the message to be forwarded, and obtain the third hash value and the fourth hash value of the keyword;
  • Determining unit 602 configured to obtain a second hash value of a key of at least one flow table from the first memory according to the third hash value, and compare the fourth hash value with the at least one Compare the second hash value of the keyword of a flow table to determine the flow table that matches the message to be forwarded; wherein, the address where the second hash value is stored in the first memory is based on the value of the flow table.
  • the first hash value of the keyword is determined;
  • the second acquisition unit 603 is configured to acquire the keywords of the flow table that match the message to be forwarded from the second memory, where the keywords and data of the flow table are stored in the second memory;
  • the forwarding unit 604 is configured to forward the packet to be forwarded according to the data in the flow table when the keyword of the flow table matches the keyword of the packet to be forwarded.
  • the determining unit is specifically used to:
  • the second hash value of the flow table stored in each slot of the bucket is compared with the fourth hash value of the message, and the flow table with the same hash value is determined to be the same as the message to be forwarded. Matching flow table.
  • the forwarding unit is specifically used to:
  • the identification information obtain the address of the corresponding bucket in the second memory
  • the device embodiment since it basically corresponds to the method embodiment, please refer to the partial description of the method embodiment for relevant details.
  • the device embodiments described above are only illustrative.
  • the units described as separate components may or may not be physically separated.
  • the components shown as units may or may not be physical units, that is, they may be located in One place, or it can be distributed to multiple network modules. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution in this specification. Persons of ordinary skill in the art can understand and implement the method without any creative effort.
  • FIG. 7 is a schematic structural diagram of a computing device provided in an exemplary embodiment.
  • the device includes a processor 702, an internal bus 704, a network interface 706, a memory 708, and a non-volatile memory 710.
  • the processor 702 reads the corresponding computer program from the non-volatile memory 710 into the memory 708 and then runs it.
  • the execution subject of the following processing flow is not limited to each A logic unit can also be a hardware or logic device.
  • the present application also provides a computer program product, including a computer program.
  • a computer program product including a computer program.
  • the computer program is executed by a processor, the data transmission method provided by any embodiment of the present application is implemented.
  • a typical implementation device is a computer, which may be in the form of a personal computer, a laptop, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, or a game controller. desktop, tablet, wearable device, or a combination of any of these devices.
  • a computer includes one or more processors (Central Processing Unit, CPU), Input/output interfaces, network interfaces, and memory.
  • processors Central Processing Unit, CPU
  • Input/output interfaces Input/output interfaces
  • network interfaces and memory.
  • Memory may include non-permanent storage in computer-readable media, random access memory (Random Access Memory, RAM) and/or non-volatile memory, such as read-only memory (Read-Only Memory, ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
  • RAM Random Access Memory
  • ROM read-only memory
  • flash RAM flash memory
  • Computer-readable media includes both persistent and non-volatile, removable and non-removable media that can be implemented by any method or technology for storage of information.
  • Information may be computer-readable instructions, data structures, modules of programs, or other data.
  • Examples of computer storage media include, but are not limited to, Phase-change Random Access Memory (PRAM), Static Random-Access Memory (SRAM), Dynamic Random Access Memory (Dynamic Random Access Memory) , DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology , Compact Disc Read Only Memory (CD-ROM), Digital Video Disc (DVD) or other optical storage, magnetic tape cassette, magnetic disk storage, quantum memory, graphene-based Storage media or other magnetic storage devices, or any other non-transmission medium, may be used to store information that can be accessed by a computing device.
  • computer-readable media does not include temporary computer-readable media (Transitory Media), such as modulated data signals and
  • first, second, third, etc. may use the terms first, second, third, etc. to describe various information, the information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other.
  • first information may also be called second information, and similarly, the second information may also be called first information.
  • word “if” as used herein may be interpreted as "when” or “when” or “in response to determining.”

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

公开了一种流表存储及报文转发方法、装置、计算设备及介质,所述流表存储方法包括:获取待存储流表的关键字和数据;获取所述关键字的第一哈希值和第二哈希值;根据所述第一哈希值,将所述待存储流表的第二哈希值存储在第一存储器中;将所述待存储流表的关键字和数据存储在第二存储器中,可以在确保带宽满足的情况下存储更多的流表,并且由于将流表的地址管理与流表的数据进行分离,减少了哈希冲突。

Description

流表存储及报文转发方法、装置、计算设备及介质
本申请要求于2022年03月23日提交中国专利局、申请号为202210295137.9、申请名称为“流表存储及报文转发方法、装置、计算设备及介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本说明书一个或多个实施例涉及通信技术领域,尤其涉及一种流表存储及报文转发方法、装置、计算设备及介质。
背景技术
随着云计算的高速发展,智能网卡芯片在云网络的地位不断上升,而智能网卡芯片核心在于有效管理流表。增加转发流表数量是流表管理最重要的手段之一,由于通常使用HASH算法来计算地址并存储在对应的地址空间,因此在增加了转发流表数量的情况下,HASH算法导致地址冲突是无法回避的困难问题。如何在尽可能存储更多转发流表的情况下,减少哈希冲突是目前亟待解决的问题。
发明内容
有鉴于此,本说明书一个或多个实施例提供一种流表存储及报文转发方法、装置、计算设备及介质。
为实现上述目的,本说明书一个或多个实施例提供技术方案如下:
根据本说明书一个或多个实施例的第一方面,提出了一种流表存储方法,该方法包括:
获取待存储流表的关键字和数据;
获取所述关键字的第一哈希值和第二哈希值;
根据所述第一哈希值,将所述待存储流表的第二哈希值存储在第一存储器中;
将所述待存储流表的关键字和数据存储在第二存储器中。
在一些实施例中,所述待存储流表具有标识信息,所述根据所述第一哈希值,将所述待存储流表的第二哈希值存储在第一存储器中,包括:
根据所述第一哈希值,得到所述待存储流表在所述第一存储器中对应的桶的地址;
将所述待存储流表的标识信息和所述第二哈希值存储于所述桶的槽位中。
在一些实施例中,所述根据所述待存储流表的关键字和数据存储在第二存储器中,包括:
根据所述待存储流表的标识信息,得到所述待存储流表在所述第二存储器中对应的桶的地址;
将所述待存储流表的关键字和数据存储在所述桶的槽位中。
根据本说明书一个或多个实施例的第二方面,提出了一种报文转发方法,该方法包括:
获取待转发报文的关键字,并获取所述关键字的第三哈希值和第四哈希值;
根据所述第三哈希值,从所述第一存储器获取至少一个流表的关键字的第二哈希值,并通过将所述第四哈希值与所述至少一个流表的关键字的第二哈希值进行比较,确定与所述待转发报文匹配的流表;其中,所述第一存储器中存储第二哈希值的地址根据所述流表的关键字的第一哈希值确定;
从第二存储器中获取与所述待转发报文匹配的流表的关键字,其中,所述第二存储器中存储有流表的关键字和数据;
在所述流表的关键字与所述待转发报文的关键字匹配的情况下,根据所述流表的数据执行对所述待转发报文进行转发处理。
在一些实施例中,所述通过将所述报文的关键字的第四哈希值与所述至少一个流表的关键字的第二哈希值进行比较,确定与所述报文匹配的流表,包括:
根据所述报文的第二哈希值,得到所述第一存储器中对应的桶的地址;
将所述桶的各个槽位中存储的流表的第二哈希值与所述报文的第四哈希值进行比较,将具有相同哈希值的流表确定为与所述待转发报文匹配的流表。
在一些实施例中,所述桶的各个槽中还存储有流表的标识信息;所述从第二存储器中获取所述流表的关键字,包括:
获取与所述待转发报文匹配的流表的标识信息;
根据所述标识信息,得到所述第二存储器中对应的桶的地址;
获取所述桶中存储的流表的关键字和数据;
在所述流表的关键字与所述待转发报文的关键字匹配的情况下,根据所述流表的数据执行对所述待转发报文进行转发处理。
根据本说明书一个或多个实施例的第三方面,提出了一种流表存储装置,所述装置包括:
第一获取单元,用于获取待存储流表的关键字和数据;
第二获取单元,用于获取所述关键字的第一哈希值和第二哈希值;
第一存储单元,用于根据所述第一哈希值,将所述待存储流表的第二哈希值存储在第一存储器中;
第二存储单元,用于将所述待存储流表的关键字和数据存储在第二存储器中。
在一些实施例中,所述待存储流表具有标识信息,所述第一存储单元具体用于:
根据所述第一哈希值,得到所述待存储流表在所述第一存储器中对应的桶的地址;
将所述待存储流表的标识信息和所述第二哈希值存储于所述桶的槽位中。
在一些实施例中,所述第二存储单元具体用于:
根据所述待存储流表的标识信息,得到所述待存储流表在所述第二存储器中对应的桶的地址;
将所述待存储流表的关键字和数据存储在所述桶的槽位中。
根据本说明书一个或多个实施例的第四方面,提出了一种流表存储装置,所述装置包括:
第一获取单元,用于获取待转发报文的关键字,并获取所述关键字的第三哈希值和第四哈希值;
确定单元,用于根据所述第三哈希值,从所述第一存储器获取至少一个流表的关键字的第二哈希值,并通过将所述第四哈希值与所述至少一个流表的关键字的第二哈希值进行比较,确定与所述待转发报文匹配的流表;其中,所述第一存储器中存储第二哈希值的地址根据所述流表的关键字的第一哈希值确定;
第二获取单元,用于从第二存储器中获取与所述待转发报文匹配的流表的关键字,其中,所述第二存储器中存储有流表的关键字和数据;
转发单元,用于在所述流表的关键字与所述待转发报文的关键字匹配的情况下,根据所述流表的数据执行对所述待转发报文进行转发处理。
在一些实施例中,所述确定单元具体用于:
根据所述报文的第二哈希值,得到所述第一存储器中对应的桶的地址;
将所述桶的各个槽位中存储的流表的第二哈希值与所述报文的第四哈希值进行比较,将具有相同哈希值的流表确定为与所述待转发报文匹配的流表。
在一些实施例中,所述转发单元具体用于:
获取与所述待转发报文匹配的流表的标识信息;
根据所述标识信息,得到所述第二存储器中对应的桶的地址;
获取所述桶中存储的流表的关键字和数据;
在所述流表的关键字与所述待转发报文的关键字匹配的情况下,根据所述流表的数据执行对所述待转发报文进行转发处理。
根据本说明书一个或多个实施例的第五方面,提出了一种计算设备,该计算设备包括:
处理器;
用于存储处理器可执行指令的存储器;
其中,处理器通过运行可执行指令以实现上述任一实施例所提供的流表存储方法或报文转发方法所执行的操作。
根据本说明书一个或多个实施例的第六方面,提出了一种计算机可读存储介质,其上存储有计算机指令,指令被处理器执行时实现任一实施例所提供的流表存储方法或报文转发方法所执行的操作。
根据本说明书一个或多个实施例的第七方面,提出了一种计算机程序产品,包括计算机程序,程序被处理器执行时实现任一实施例所提供的流表存储方法或报文转发方法所执行的操作。
本申请通过获取待存储流表的关键字的第一哈希值和第二哈希值,并根据所述第一哈希值,将所述待存储流表的第二哈希值存储在第一存储器中;根据所述待存储流表的关键字和数据存储在第二存储器中,可以在确保带宽满足的情况下存储更多的流表,并且由于将流表的地址管理与流表的数据进行分离,减少了哈希冲突。
附图说明
图1是一示例性实施例提供的相关技术中流表存储地示意图。
图2是一示例性实施例提供的一种流表存储方法的流程图。
图3是一示例性实施例提供的一种流表存储方法的流程图。
图4是一示例性实施例提供的一种报文转发的流程图。
图5是一示例性实施例提供的一种流表存储装置的框图。
图6是一示例性实施例提供的一种报文转发装置的框图。
图7是一示例性实施例提供的一种计算设备的示意结构图。
具体实施方式
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本说明书一个或多个实施例相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本说明书一个或多个实施例的一些方面相一致的装置和方法的例子。
需要说明的是:在其他实施例中并不一定按照本说明书示出和描述的顺序来执行相应方法的步骤。在一些其他实施例中,其方法所包括的步骤可以比本说明书所描述的更多或更少。此外,本说明书中所描述的单个步骤,在其他实施例中可能被分解为多个步骤进行描述;而本说明书中所描述的多个步骤,在其他实施例中也可能被合并为单个步骤进行描述。
相关技术中存储流表或者插入流表的方式通常是合并流并的地址和数据。以下结合图1描述相关技术中通常采用的存储流表方法。
目前的智能网卡系统同常使用两个动态随机存储器(DRAM)来存储流表,如图1所示,在本示例中利用存储器DDR0和DDR1来存储流表。待存储流表可以由管控平台下发,通常包括流表的标志信息(ID,也即图1中的flow_id)、关键字(key)以及流表的数据(value)。首先,从管控平台下发的待存储流表的信息中提取关键字(exact key),并将关键字的哈希值确定流表的存储地址。在本示例中,关键字的哈希值指向的地址是addr_3,因此将流表的ID、关键字、数据存储在地址为addr_3的桶中。
在上述方案中,假设每个槽位(slot)存储64Byte,两个DRAM最多可以存储4个slot。而如果通过增加存储器来扩展存储流表的容量,不但增加了硬件的负担,还更容易产生哈 希冲突的问题。
有鉴于此,本申请提供了一种流表存储方法,该方法可以由计算机设备执行,计算机设备可以为服务器,如一台服务器、多台服务器、云计算平台等,可选地,计算机设备还可以为其他类型的设备,本申请对计算机设备的设备类型不加以限定。下面对本申请的实施方式进行介绍。
参见图2,图2是一示例性实施例提供的一种流表存储方法的流程图,该方法包括:
步骤201、获取待存储流表的关键字和数据。
其中,所述待存储流表可以由管控平台下发。管控平台所下发的信息中可以包括待存储流表的关键字和数据等等。
步骤202、获取所述关键字的第一哈希值和第二哈希值。
在一个示例中,可以利用哈希函数a对所述待存储流表的关键字进行处理,得到第一哈希值,该过程可以表示为hasha(key1),其中,key1表示待存储流表的关键字,hasha表示哈希函数a;同时,可以利用哈希函数b对所述待存储流表的关键字进行处理,得到第二哈希值,该过程可以表示为hashb(key1),其中,key1表示待存储流表的关键字,hashb表示哈希函数b。
步骤203、根据所述第一哈希值,将所述待存储流表的第二哈希值存储在第一存储器中。
在本步骤中,可以根据所述第一哈希值所指示的地址信息,将所述待存储流表的第二哈希值存储在所述第一存储器的相应位置处。
步骤204、将所述待存储流表的关键字和数据存储在第二存储器中。
在本公开实施例中,待存储流表的关键字的第一哈希值所指示的第一存储器中的地址,用于存储所述关键字的第二哈希值,而所述待存储流表的关键字和数据是存储在第二存储器中,通过将第一存储器中存储的第二哈希值,与第二存储器中用于存储关键字和数据的地址进行关联,则可以使第一存储器和第二存储器中存储的流表信息项共同用于对报文进行处理。由于第一哈希值所指示的地址中存储的是第二哈希值,相较于存储关键字和数据,减小了在第一哈希值对应的地址中存储的数据量,一方面使得可以存储更多的流表,另一方面在所述流表用于报文转发时可以增加一次与哈希值的匹配,因此可以减少哈希冲突的概率。
本申请通过获取待存储流表的关键字的第一哈希值和第二哈希值,并根据所述第一哈希值,将所述待存储流表的第二哈希值存储在第一存储器中;根据所述待存储流表的关键字和数据存储在第二存储器中,可以在确保带宽满足的情况下存储更多的流表,并且由于将流表的地址管理与流表的数据进行分离,减少了哈希冲突。
上述为对本申请的基本实现过程的介绍,下面对本申请的多个可选实现方式进行介绍。
在一个示例中,待存储流表具有标识信息(ID),根据该标识信息可以将第一存储器中存储的流表项,与第二存储器中存储的流表项进行关联。
具体地,根据所述第一哈希值,可以得到所述待存储流表在所述第一存储器中对应的桶的地址;将所述待存储流表的标识信息和所述第二哈希值存储于所述桶的槽位中。
参见图3所示的流表存储的示意图。如图3所示,根据第一哈希值hasha(key),确定所述待存储流表在第一存储器DDR0中对应的地址是addr_3,也即地址为addr_3的桶。第一存储器的每一个桶中具有若干个槽位,可以将所述待存储流表的ID(flow_id)和第二哈希值hashb(key)存储在地址为addr_3的桶的空闲槽位中。由于待存储流表的ID以及hashb(key)的数据量小于关键字和数据,因此在addr_3的桶中可以设置更多的槽位来进行流表项的存储,从而增加了流表的存储数量。以图3为例,在待存储流表的ID以及hashb(key)的数据量为56bit的情况下,DDR0的每个地址(每个桶)可以存放9个槽位。相较于相关技术中的相同配置,本公开实施例在确保带宽的前提下,提高了流表的存储量。
在待存储流表具有标识信息(ID)的情况下,可以通过以下方法来存储流表的关键字和数据:根据所述待存储流表的标识信息,得到所述待存储流表在所述第二存储器中对应的桶的地址,将所述待存储流表的关键字和数据存储在所述桶的槽位中。
参见图3所示的流表存储的示意图。如图3所示,根据待存储流表的ID(flow_id),得到流表在第二存储器中待存储的桶的地址。以待存储流表的ID为m-6为例,根据该ID所指示的在第二存储器中待存储的桶的地址为flow_id_m-6,将所述待存储流表的关键字和数据存储在地址为flow_id_m-6的桶的槽位中。
在本公开实施例中,通过利用待存储流表的标识信息,将待存储流表在第一存储器中的存储位置与该流表在第二存储器中的存储位置关联起来,可以在流表的地址管理与数据存储的分离,减少了哈希冲突的情况下实现对报文的正常处理。
本申请还提供了一种报文转发方法,该方法基于本公开实施例所提出的流表存储方法进行存储的流表对接收到的报文进行处理。上述方法可以应用于报文转发设备,所述报文转发设备例如可以是计算机设备,比如一台服务器、多台服务器、云计算平台等,可选地,计算机设备还可以为其他类型的设备,本申请对计算机设备的设备类型不加以限定。下面对本申请的实施方式进行介绍。
参见图4,图4是一示例性实施例提供的一种报文转发方法的流程图,该方法包括:
步骤401、获取待转发报文的关键字,并获取所述关键字的第三哈希值和第四哈希值。
响应于接收到报文,报文转发设备首先获取该报文的关键字,并获取所述关键字的第三哈希值和第四哈希值。
在一个示例中,可以利用哈希函数a对所述报文的关键字进行处理,得到第三哈希值,该过程可以表示为hasha(key_m),其中,key_m表示所述报文的关键字,hasha表示哈希函数a;同时,可以利用哈希函数b对所述报文的关键字进行处理,得到第四哈希值,该过程可以表示为hashb(key_m),其中,hashb表示哈希函数b。
步骤402、根据所述第三哈希值,从所述第一存储器获取至少一个流表的关键字的第二哈希值,并通过将所述第四哈希值与所述至少一个流表的关键字的第二哈希值进行比较,确定与所述待转发报文匹配的流表。
其中,所述第一存储器中存储第二哈希值的地址根据所述流表的关键字的第一哈希值确定。
在本公开实施例中,对于流表的关键字与报文的关键字采用相同的哈希处理。也即,所述流表的关键字的第一哈希值和第二哈希值,同样也是分别利用哈希函数a和哈希函数b对流表的关键字进行处理得到的。
在获取到待转发报文的关键字的第三哈希值后,确定所述第三哈希值在所述第一存储器中指向的地址,从而可以得到该地址中存储的至少一个流表项,也即至少一个流表的关键字的第二哈希值。通过将待转发报文的关键字的第四哈希值与所述至少一个流表的关键字的第二哈希值进行比较,将与第四哈希值相同的流表确定为匹配的流表。
步骤403,从第二存储器中获取与所述待转发报文匹配的流表的关键字,其中,所述第二存储器中存储有流表的关键字和数据。
步骤404,在所述流表的关键字与所述待转发报文的关键字匹配的情况下,根据所述流表的数据执行对所述待转发报文进行转发处理。
在获取了所述匹配的流表的关键字后,将所述流表的关键字与所述待转发报文的关键字进行比较,在所述流表的关键字与所述待转发报文的关键字相同的情况下,确认匹配,则读取该匹配流表的数据,并根据所述数据指示的动作对所述报文进行转发处理。
在本公开实施例中,对于待转发报文首先根据报文的关键字的第三哈希值确定在所述第一存储器中指向的地址,读取地址中存储的至少一个流表的关键字的第二哈希值,并根据报文的第四哈希值与各个流表的第二哈希值的匹配结果,确定匹配的流表;之后再在第二存储器中读取所匹配的流表的关键字,并在所述流表的关键字与报文的关键字匹配的请况下,读取所匹配的流表的数据对所述报文进行转发处理。通过增加对流表的第二哈希值与报文的第四哈希值之间的匹配,减少了哈希冲突的概率,提高了报文转发的质量。
上述为对本申请的报文转发基本实现过程的介绍,下面对本申请的多个可选实现方式进行介绍。
在一个示例中,根据根据以下方法确定与所述待转发报文匹配的流表:根据所述报文的第二哈希值,得到所述第一存储器中对应的桶的地址;将所述桶的各个槽位中存储的流表的第二哈希值与所述报文的第四哈希值进行比较,将具有相同哈希值的流表确定为与所述待转发报文匹配的流表。
在一个示例中,所述桶的各个槽中还存储有流表的标识信息;所述从第二存储器中获取所述流表的关键字,包括:获取与所述待转发报文匹配的流表的标识信息;根据所述标识信息,得到所述第二存储器中对应的桶的地址;获取所述桶中存储的流表的关键字和数据;在所述流表的关键字与所述待转发报文的关键字匹配的情况下,根据所述流表的数据执行对所述待转发报文进行转发处理。
下面以报文转发设备利用图3所示的流表存储方法进行存储得到的流表进行报文转发为例,对本申请提出的报文转发方法进行详细说明。
如图3所示,第一存储器DDR0的每个地址对应的桶中具有若干槽位,每个槽位中 存储有流表的ID(flow_id)和所述流表的关键字key的第二哈希值hashb(key),而所述流表的每个地址是与所述流表的关键字key的第一哈希值hasha(key)对应的。第二存储器DDR1的每个地址与所述流表的ID对应,并且所述每个地址对应的桶中存储有所述流表的关键字key和数据value。
在接收到待转发报文并获取到所述报文的纹理信息key_m的情况下,首先获取纹理信息key_m的第三哈希值hasha(key_m)和第四哈希值hashb(key_m)。
接下来,根据第三哈希值hasha(key_m)确定在第一存储器DDR0中对应的桶的地址,例如地址为addr_3,则提取addr_3对应的桶中存储的各个流表的第二哈希值hashb(key)。并将待转发报文的第四哈希值hashb(key_m)与上述各个流表的第二哈希值hashb(key)进行比较,并将具有相同哈希值的流表作为与所述待转发报文匹配的流表。
在确定了匹配的流表后,则可以获取该流表的ID,利用该ID获取在第二存储器DDR1中存储的流表项。以与所述待转发报文匹配的流表ID为m-6为例,确定与该流表ID对应的第二存储器DDR1中对应的地址为flow_id_m-6,并获取该地址的桶中所存储的与ID为m-6的流表的关键字和数据。将所述待转发报文的关键字与所获取的ID为m-6的流表的关键字进行比较,在关键字相同也即匹配的情况下,根据该关键字对应的数据对所述待转发报文进行相应的转发处理。
参见图5,图5是一示例性实施例提供的一种流表存储装置的框图,该装置包括:
第一获取单元501,用于获取待存储流表的关键字和数据;
第二获取单元502,用于获取所述关键字的第一哈希值和第二哈希值;
第一存储单元503,用于根据所述第一哈希值,将所述待存储流表的第二哈希值存储在第一存储器中;
第二存储单元504,用于将所述待存储流表的关键字和数据存储在第二存储器中。
在一些实施例中,所述待存储流表具有标识信息,所述第一存储单元具体用于:
根据所述第一哈希值,得到所述待存储流表在所述第一存储器中对应的桶的地址;
将所述待存储流表的标识信息和所述第二哈希值存储于所述桶的槽位中。
在一些实施例中,所述第二存储单元具体用于:
根据所述待存储流表的标识信息,得到所述待存储流表在所述第二存储器中对应的桶的地址;
将所述待存储流表的关键字和数据存储在所述桶的槽位中。
参见图6,图6是一示例性实施例提供的一种报文转发装置的框图,该装置包括:
第一获取单元601,用于获取待转发报文的关键字,并获取所述关键字的第三哈希值和第四哈希值;
确定单元602,用于根据所述第三哈希值,从所述第一存储器获取至少一个流表的关键字的第二哈希值,并通过将所述第四哈希值与所述至少一个流表的关键字的第二哈希值进行比较,确定与所述待转发报文匹配的流表;其中,所述第一存储器中存储第二哈希值的地址根据所述流表的关键字的第一哈希值确定;
第二获取单元603,用于从第二存储器中获取与所述待转发报文匹配的流表的关键字,其中,所述第二存储器中存储有流表的关键字和数据;
转发单元604,用于在所述流表的关键字与所述待转发报文的关键字匹配的情况下,根据所述流表的数据执行对所述待转发报文进行转发处理。
在一些实施例中,所述确定单元具体用于:
根据所述报文的第二哈希值,得到所述第一存储器中对应的桶的地址;
将所述桶的各个槽位中存储的流表的第二哈希值与所述报文的第四哈希值进行比较,将具有相同哈希值的流表确定为与所述待转发报文匹配的流表。
在一些实施例中,所述转发单元具体用于:
获取与所述待转发报文匹配的流表的标识信息;
根据所述标识信息,得到所述第二存储器中对应的桶的地址;
获取所述桶中存储的流表的关键字和数据;
在所述流表的关键字与所述待转发报文的关键字匹配的情况下,根据所述流表的数据执行对所述待转发报文进行转发处理。
对于装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部单元来实现本说明书方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。
本申请还提供了一种计算设备,参见图7,图7是一示例性实施例提供的一种计算设备的示意结构图。请参考图7,在硬件层面,该设备包括处理器702、内部总线704、网络接口706、内存708以及非易失性存储器710,当然还可能包括实现其他功能所需要的硬件。本说明书一个或多个实施例可以基于软件方式来实现,比如由处理器702从非易失性存储器710中读取对应的计算机程序到内存708中然后运行。当然,除了软件实现方式之外,本说明书一个或多个实施例并不排除其他实现方式,比如逻辑器件抑或软硬件结合的方式等等,也就是说以下处理流程的执行主体并不限定于各个逻辑单元,也可以是硬件或逻辑器件。
本申请还提供了一种计算机程序产品,包括计算机程序,计算机程序被处理器执行时实现本申请任一实施例所提供的数据传输方法。
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机,计算机的具体形式可以是个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合。
在一个典型的配置中,计算机包括一个或多个处理器(Central Processing Unit,CPU)、 输入/输出接口、网络接口和内存。
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(Random Access Memory,RAM)和/或非易失性内存等形式,如只读存储器(Read-Only Memory,ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(Phase-change Random Access Memory,PRAM)、静态随机存取存储器(Static Random-Access Memory,SRAM)、动态随机存取存储器(Dynamic Random Access Memory,DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(Electrically Erasable Programmable Read Only Memory,EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(Compact Disc Read Only Memory,CD-ROM)、数字多功能光盘(Digital Video Disc,DVD)或其他光学存储、磁盒式磁带、磁盘存储、量子存储器、基于石墨烯的存储介质或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(Transitory Media),如调制的数据信号和载波。
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。
在本说明书一个或多个实施例使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本说明书一个或多个实施例。在本说明书一个或多个实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组
应当理解,尽管在本说明书一个或多个实施例可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本说明书一个或多个实施例范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。
以上所述仅为本说明书一个或多个实施例的较佳实施例而已,并不用以限制本说明书一个或多个实施例,凡在本说明书一个或多个实施例的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本说明书一个或多个实施例保护的范围之内。

Claims (10)

  1. 一种流表存储方法,其特征在于,所述方法包括:
    获取待存储流表的关键字和数据;
    获取所述关键字的第一哈希值和第二哈希值;
    根据所述第一哈希值,将所述待存储流表的第二哈希值存储在第一存储器中;
    将所述待存储流表的关键字和数据存储在第二存储器中。
  2. 根据权利要求1所述的方法,其特征在于,所述待存储流表具有标识信息,所述根据所述第一哈希值,将所述待存储流表的第二哈希值存储在第一存储器中,包括:
    根据所述第一哈希值,得到所述待存储流表在所述第一存储器中对应的桶的地址;
    将所述待存储流表的标识信息和所述第二哈希值存储于所述桶的槽位中。
  3. 根据权利要求2所述的方法,其特征在于,所述根据所述待存储流表的关键字和数据存储在第二存储器中,包括:
    根据所述待存储流表的标识信息,得到所述待存储流表在所述第二存储器中对应的桶的地址;
    将所述待存储流表的关键字和数据存储在所述桶的槽位中。
  4. 一种报文转发方法,其特征在于,所述方法包括:
    获取待转发报文的关键字,并获取所述关键字的第三哈希值和第四哈希值;
    根据所述第三哈希值,从第一存储器获取至少一个流表的关键字的第二哈希值,并通过将所述第四哈希值与所述至少一个流表的关键字的第二哈希值进行比较,确定与所述待转发报文匹配的流表;其中,所述第一存储器中存储第二哈希值的地址根据所述流表的关键字的第一哈希值确定;
    从第二存储器中获取与所述待转发报文匹配的流表的关键字,其中,所述第二存储器中存储有流表的关键字和数据;
    在所述流表的关键字与所述待转发报文的关键字匹配的情况下,根据所述流表的数据执行对所述待转发报文进行转发处理。
  5. 根据权利要求4所述的方法,其特征在于,所述通过将所述报文的关键字的第四哈希值与所述至少一个流表的关键字的第二哈希值进行比较,确定与所述报文匹配的流表,包括:
    根据所述报文的第二哈希值,得到所述第一存储器中对应的桶的地址;
    将所述桶的各个槽位中存储的流表的第二哈希值与所述报文的第四哈希值进行比较,将具有相同哈希值的流表确定为与所述待转发报文匹配的流表。
  6. 根据权利要求5所述的方法,其特征在于,所述桶的各个槽中还存储有流表的标 识信息;所述从第二存储器中获取所述流表的关键字,包括:
    获取与所述待转发报文匹配的流表的标识信息;
    根据所述标识信息,得到所述第二存储器中对应的桶的地址;
    获取所述桶中存储的流表的关键字和数据;
    在所述流表的关键字与所述待转发报文的关键字匹配的情况下,根据所述流表的数据执行对所述待转发报文进行转发处理。
  7. 一种流表存储装置,其特征在于,所述装置包括:
    第一获取单元,用于获取待存储流表的关键字和数据;
    第二获取单元,用于获取所述关键字的第一哈希值和第二哈希值;
    第一存储单元,用于根据所述第一哈希值,将所述待存储流表的第二哈希值存储在第一存储器中;
    第二存储单元,用于将所述待存储流表的关键字和数据存储在第二存储器中。
  8. 一种报文转发装置,其特征在于,所述装置包括:
    第一获取单元,用于获取待转发报文的关键字,并获取所述关键字的第三哈希值和第四哈希值;
    确定单元,用于根据所述第三哈希值,从所述第一存储器获取至少一个流表的关键字的第二哈希值,并通过将所述第四哈希值与所述至少一个流表的关键字的第二哈希值进行比较,确定与所述待转发报文匹配的流表;其中,所述第一存储器中存储第二哈希值的地址根据所述流表的关键字的第一哈希值确定;
    第二获取单元,用于从第二存储器中获取与所述待转发报文匹配的流表的关键字,其中,所述第二存储器中存储有流表的关键字和数据;
    转发单元,用于在所述流表的关键字与所述待转发报文的关键字匹配的情况下,根据所述流表的数据执行对所述待转发报文进行转发处理。
  9. 一种计算设备,其特征在于,包括:
    处理器;
    用于存储处理器可执行指令的存储器;
    其中,所述处理器通过运行所述可执行指令以实现如权利要求1至3任一项或4至6任一项所述的方法。
  10. 一种计算机可读存储介质,其上存储有计算机指令,其特征在于,该指令被处理器执行时实现如权利要求1至3任一项或4至6任一项所述的方法。
PCT/CN2023/081724 2022-03-23 2023-03-15 流表存储及报文转发方法、装置、计算设备及介质 WO2023179433A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210295137.9A CN114780537A (zh) 2022-03-23 2022-03-23 流表存储及报文转发方法、装置、计算设备及介质
CN202210295137.9 2022-03-23

Publications (1)

Publication Number Publication Date
WO2023179433A1 true WO2023179433A1 (zh) 2023-09-28

Family

ID=82425216

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/081724 WO2023179433A1 (zh) 2022-03-23 2023-03-15 流表存储及报文转发方法、装置、计算设备及介质

Country Status (2)

Country Link
CN (1) CN114780537A (zh)
WO (1) WO2023179433A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114780537A (zh) * 2022-03-23 2022-07-22 阿里巴巴(中国)有限公司 流表存储及报文转发方法、装置、计算设备及介质
CN116248593A (zh) * 2022-12-30 2023-06-09 天翼云科技有限公司 一种流表关键字匹配方法、装置、电子设备和存储介质
CN116600031B (zh) * 2023-07-18 2023-10-31 无锡沐创集成电路设计有限公司 报文处理方法、装置、设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101247337A (zh) * 2008-02-18 2008-08-20 华为技术有限公司 一种报文转发的方法和设备
WO2016184029A1 (zh) * 2015-05-18 2016-11-24 深圳市中兴微电子技术有限公司 支持哈希查找和路由查找的存储、查找方法和装置、存储介质
CN114064572A (zh) * 2021-11-12 2022-02-18 苏州慧工云信息科技有限公司 一种基于哈希算法的对象存储方法及系统
CN114780537A (zh) * 2022-03-23 2022-07-22 阿里巴巴(中国)有限公司 流表存储及报文转发方法、装置、计算设备及介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101247337A (zh) * 2008-02-18 2008-08-20 华为技术有限公司 一种报文转发的方法和设备
WO2016184029A1 (zh) * 2015-05-18 2016-11-24 深圳市中兴微电子技术有限公司 支持哈希查找和路由查找的存储、查找方法和装置、存储介质
CN114064572A (zh) * 2021-11-12 2022-02-18 苏州慧工云信息科技有限公司 一种基于哈希算法的对象存储方法及系统
CN114780537A (zh) * 2022-03-23 2022-07-22 阿里巴巴(中国)有限公司 流表存储及报文转发方法、装置、计算设备及介质

Also Published As

Publication number Publication date
CN114780537A (zh) 2022-07-22

Similar Documents

Publication Publication Date Title
WO2023179433A1 (zh) 流表存储及报文转发方法、装置、计算设备及介质
EP3776249B1 (en) Blockchain-based cross-chain data access method and apparatus
TWI728654B (zh) 資料儲存方法及節點
US10230824B2 (en) Packet classification using memory pointer information
WO2017114205A1 (zh) 短链接处理方法、装置及服务器
US11294875B2 (en) Data storage on tree nodes
US11182365B2 (en) Systems and methods for distributed storage of data across multiple hash tables
CN107153644B (zh) 一种数据同步方法及装置
CN111324665B (zh) 一种日志回放方法及装置
US20110296437A1 (en) Method and apparatus for lockless communication between cores in a multi-core processor
CN108762915B (zh) 一种在gpu内存中缓存rdf数据的方法
US9836491B1 (en) Method and apparatus for hardware-implemented AVL tree updates
WO2014029084A1 (zh) 数据存储方法、查找方法及装置
US11385900B2 (en) Accessing queue data
US11360684B2 (en) Data storage method and apparatus, storage medium and computer device
CN107493309A (zh) 一种分布式系统中的文件写入方法及装置
CN107276998B (zh) 一种基于OpenSSL的性能优化方法及装置
WO2023207087A1 (zh) 用于区块链的最优链路选择方法及装置和电子设备
WO2019237949A1 (zh) 搜索方法及装置
JP6189266B2 (ja) データ処理装置、データ処理方法及びデータ処理プログラム
CN109214884B (zh) 需求撮合方法及装置、电子设备
US11063869B2 (en) ARP table management system
CN115037783B (zh) 数据传输方法及装置
WO2022028165A1 (zh) 缓存管理方法、终端以及存储介质
CN113656411B (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: 23773681

Country of ref document: EP

Kind code of ref document: A1