WO2013078824A1 - 实现网卡卸载功能的方法、网卡、主机系统及网络设备 - Google Patents

实现网卡卸载功能的方法、网卡、主机系统及网络设备 Download PDF

Info

Publication number
WO2013078824A1
WO2013078824A1 PCT/CN2012/074628 CN2012074628W WO2013078824A1 WO 2013078824 A1 WO2013078824 A1 WO 2013078824A1 CN 2012074628 W CN2012074628 W CN 2012074628W WO 2013078824 A1 WO2013078824 A1 WO 2013078824A1
Authority
WO
WIPO (PCT)
Prior art keywords
network card
data packet
policy
protocol
entry
Prior art date
Application number
PCT/CN2012/074628
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 华为技术有限公司
Priority to EP12853441.9A priority Critical patent/EP2747381B1/en
Publication of WO2013078824A1 publication Critical patent/WO2013078824A1/zh
Priority to US14/292,096 priority patent/US9680690B2/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/30Profiles
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/60Subscription-based services using application servers or record carriers, e.g. SIM application toolkits

Definitions

  • the present invention belongs to the field of communications technologies, and in particular, to a method, a network card, a host system, and a network device for implementing a network card offload function. Background technique
  • TCP/IP network protocol stack handles the CPU usage more and more, and may even become the bottleneck of the entire server system.
  • network adapter (network card) vendors have introduced network cards with offload functions, by working part of the original TCP/IP network protocol stack (such as calculating TCP/IP checksums). , TCP/UDP packet slicing, etc.) are offloaded to the network card for processing, thereby reducing the CPU resource occupation rate of the TCP/IP protocol stack processing.
  • the offloading function of the network card usually includes calculating TCP/IP checksum, TCP/UDP fragmentation message reassembly, TCP slice unloading, etc. These offload functions depend on whether the network card can correctly parse the message to be processed.
  • the NIC can support standard data packets, such as standard IP packets and IP packets with virtual local area network (VLAN) identifiers.
  • VLAN virtual local area network
  • the private protocol label tag is usually encapsulated in the packet.
  • the network card cannot correctly parse the IP packet, causing various uninstallation. Handling misoperations, resulting in massive packet loss on the network and affecting network transmission performance.
  • the prior art provides a network card offloading function for a specific private protocol through a customized network card. but, The scheme of the customized network card has poor scalability, and at the same time, it still needs to occupy a large amount of CPU resources for processing the unknown protocol IP packet. Summary of the invention
  • the embodiments of the present invention provide a method for implementing a network card offloading function, a network card, a host system, and a network device, which are intended to solve the problem of poor scalability of the network card unloading function in the prior art.
  • a method for implementing a network card offload function including:
  • the received data packet is a known data packet of the network card or an unknown data packet of the network card, according to the network card policy table stored in the network card or the host policy table stored in the host system;
  • the network card When the data packet is a known data packet of the network card, the network card performs a corresponding protocol stack unloading operation on the network card known data packet according to the policy entry in the network card policy table;
  • the data packet is an unknown data packet of the network card
  • parsing the unknown data packet of the network card generating a new policy entry, and updating the new policy entry to the host policy table and the In the NIC policy table.
  • a network card in another aspect, where the network card includes: the network card includes:
  • a first determining module configured to determine, according to the network card policy table, whether the received data packet is a network card known data packet or a network card unknown data packet;
  • the first unloading module is configured to: when the data packet is a data packet with a known data packet, perform a corresponding protocol stack unloading operation on the data packet according to the network card policy table;
  • the uplink packet sending module is configured to: when the data packet is an unknown data packet of the network card, send the data packet to the host system, so that the host system parses the data packet to generate a new policy. Entry
  • the first policy update module is configured to receive the new policy entry and update to the network card policy table.
  • a host system including:
  • a second determining module configured to determine, according to the host policy table, that the received data packet is a known number of network cards According to the message, the network card is unknown data message;
  • a downlink packet sending module configured to: when the data packet is a data packet with a known data packet, send a packet to perform a corresponding protocol stack unloading operation;
  • a packet parsing module configured to parse an unknown data packet of the network card to generate a new policy entry when the received data packet is an unknown data packet of the network card;
  • a second policy update module configured to update the new policy entry to the host policy table, and send the template to the network card.
  • a network device implementing a network card offload function comprising a network card as described above and a host system as described above.
  • the received data packet is a network card known data packet or a network card unknown data packet.
  • the network card is determined according to the network card policy table.
  • the policy entry in the network performs a corresponding protocol stack offload operation on the known data packet of the network card.
  • the unknown data packet of the received network card is parsed. Generating a new policy entry, and then updating the new policy entry to the host policy table and the network card policy table, so that the network card can perform corresponding protocol on the subsequently received data packet according to the new policy entry.
  • the stack unloading operation where the protocol key of the data packet is the same as the protocol key of the network card unknown data packet.
  • the data packet containing the new private or standard protocol header tag only needs to update the function module for parsing the packet, so that it can process the data packet and deliver a new policy entry to the host policy.
  • the network card does not need to be changed, thereby realizing the dynamic expansion of the network card unloading function.
  • FIG. 1 is a flowchart of a method for implementing a network card offloading function according to an embodiment of the present invention
  • FIG. 2 is a schematic structural diagram of a host policy table and a network card policy table according to an embodiment of the present invention
  • 3 is a schematic structural diagram of a protocol parsing table according to an embodiment of the present invention
  • 4 is a flowchart of a method for implementing a network card offload function when a received message is an uplink message according to an embodiment of the present invention
  • FIG. 5 is a flowchart of a method for implementing a network card offload function when a received message is a downlink message according to an embodiment of the present disclosure
  • FIG. 6 is a block diagram of a network device for implementing a network card offloading function according to an embodiment of the present invention
  • FIG. 7 is a system block diagram of a network card offloading function provided by an embodiment of the present invention. detailed description
  • the received data packet is a network card known data packet or a network card unknown data packet.
  • the network card is determined according to the network card policy table.
  • the policy entry in the network performs a corresponding protocol stack unloading operation on the network card known data packet.
  • the data packet is an unknown data packet of the network card
  • the unknown data packet of the network card is parsed to generate a new data packet.
  • the new policy entry is updated to the host policy table and the network card policy table, so that the network card can perform the corresponding protocol stack uninstall operation on the subsequently received data packet according to the new policy entry.
  • the protocol keyword of the data packet is the same as the protocol keyword of the unknown data packet of the network card.
  • the data packet containing the new private or standard protocol header tag only needs to update the function module for parsing the data packet, so that it can process the data packet and send a new policy entry to the host.
  • the network card does not need to be changed, thereby realizing the dynamic expansion of the network card unloading function.
  • FIG. 1 shows a method for implementing a network card offloading function provided by an embodiment of the present invention, and the method can be applied to a network device including a host system and a network card.
  • the method specifically includes:
  • the data packet may be an incoming packet packet, which is also referred to as an uplink packet; or the outgoing packet packet is also referred to as a downlink packet.
  • the network card determines, according to the network card policy table stored in the network card, that the received data packet is the known data of the network card.
  • the packet is still an unknown data packet of the network card.
  • the host system when the received data packet is a downlink packet, that is, when the host system first receives the data packet, the host system according to the host policy table stored in the host system. Determine whether the received data packet is a known data packet of the network card or an unknown data packet of the network card.
  • the network card or the host system determines whether the received data packet is a known data packet of the network card or an unknown data packet of the network card, and specifically includes:
  • a network card or a host system extracts a protocol keyword of the data packet
  • the server 101b searching, according to the protocol keyword, the network card policy table or the host policy table, where the host policy table and the network card policy table include a policy entry, where the policy entry includes a policy type and an action;
  • the data packet is a NIC known data packet, otherwise the data is The message is an unknown data packet of the network card.
  • the network card When the data packet is a data packet known by the network card, the network card performs a corresponding protocol stack unloading operation on the network card known data packet according to the policy entry in the network card policy table.
  • the network card When the data packet is an uplink packet, the network card is sent to the virtual protocol switch (vSwitch) in the host protocol stack or the virtualization platform according to the data packet that is processed by the protocol keyword.
  • VSwitch virtual protocol switch
  • the host system sends the data packet to the network card, so that the network card performs the corresponding protocol stack unloading operation on the data packet according to the corresponding policy entry in the network card policy table.
  • the data message is sent out.
  • the data packet is an unknown data packet of the network card
  • the data packet is unknown to the network card. Parsing, generating a new policy entry, and updating the new policy entry into the host policy table and the NIC policy table.
  • the network card includes a memory, and the network card policy table is stored in the memory.
  • the network card policy table includes a policy entry, and the policy entry includes a policy type and an action.
  • a host policy table is stored in the host system, and the host policy table has the same structure as the network card policy table. The structure of the specific host policy table and network card policy table is shown in Figure 2.
  • the host system may parse the received network card unknown data packet to generate a new policy entry.
  • the host system stores a protocol parsing table.
  • the host system forwards the received network card unknown data packet to the remote server, so that the remote server parses the unknown data packet of the network card to generate a new policy entry, where the host system receives the The new policy entry returned by the remote server;
  • the remote server stores a protocol parsing table, where the protocol parsing table includes a protocol keyword and a protocol parsing function handle, and the structure of the specific protocol parsing table is as shown in the figure 3 is shown.
  • the host system updates the new policy entry to the host policy table and the network card policy table, so that the network card performs a corresponding protocol stack on the subsequently received similar data packet according to the new policy entry.
  • the same type of data packet refers to a data packet whose protocol key is the same as the protocol key of the network card unknown data packet.
  • the analyzing the unknown data packet of the network card specifically includes:
  • Protocol parsing table includes a protocol keyword and a protocol parsing function handle
  • the policy table in the host system and the network card may be initially empty, that is, there is no policy entry.
  • the local packet parsing module or The remote packet parsing module dynamically extends the policy entries of the policy table in the host system and the network card.
  • the policy table maintenance can adopt the passive aging mechanism, that is, the policy entry that covers the least recently used (LRU, Least Recent Used) when the number of policy entries exceeds the upper limit. Thereby saving the storage resources of the network card.
  • the packet containing the new private or standard protocol header tag needs to be updated only by the local packet parsing module or the remote packet parsing module to process the packet and deliver a new policy entry to the local device.
  • the policy table and the network card policy table, and the network card does not need to be changed, thereby realizing the dynamic expansion of the network card unloading function.
  • the method further includes:
  • the host system or the remote server receives the input new protocol registration command, where the new protocol registration command includes a keyword and an entry pointing to the analytic function handle corresponding to the keyword;
  • FIG. 3 shows a protocol parsing table before registration of a new protocol and a protocol parsing table after registration of a new protocol.
  • FIG. 4 illustrates a method for implementing a network card offload function when a data packet is received as an uplink packet according to an embodiment of the present invention, where the method includes:
  • the network card After receiving the uplink packet, the network card extracts a protocol keyword of the uplink packet.
  • the protocol keyword of the uplink packet may be a protocol type.
  • the network card searches for the network card policy table according to the protocol keyword, where the network card policy table includes a policy entry, where the policy entry includes a policy type, where the protocol keyword is in the network card policy table. If the policy type of an existing policy entry matches, the data packet is a known data packet of the network card, and the execution is 403. Otherwise, the data packet is an unknown data packet of the network card, and 404 is performed.
  • the network card policy table is searched according to the keyword, and when the protocol keyword matches the policy type of an existing policy entry in the NIC policy table, step 403 is performed. Otherwise, step 404 is performed.
  • the network card sends the uplink packet to the host system, so that the host system parses the received uplink packet, generates a new policy entry, and updates the new policy entry to the host policy.
  • Table and the NIC policy table are examples of the network card.
  • the network card delivers the uplink packet to the host system.
  • the host system After receiving the uplink packet sent by the network card, the host system first extracts the protocol keyword of the uplink packet by using the local packet parsing module of the host system, and then searches the protocol parsing table according to the protocol keyword, where the protocol parsing table is The protocol keyword and the protocol analytic function handle are included, and when the protocol keyword matches the protocol keyword of an existing protocol parsing information in the protocol parsing table, the protocol analytic function in the existing protocol parsing information is obtained. Handling, and calling the protocol parsing function to parse the unknown data packet of the network card, generate a new policy entry, and then update the new policy entry to the host policy table in the host system, and simultaneously the new policy The entry is sent to the NIC policy table in the NIC.
  • the host policy table and the network card policy table both include a policy entry that matches the protocol keyword of the uplink packet, and after the subsequent network card receives the same data packet as the protocol keyword of the uplink packet, the subsequent network card receives the same data packet as the protocol keyword of the uplink packet.
  • the corresponding protocol stack operation may be performed on the received data message according to the action in the newly added policy entry in the network card policy table or the host policy table.
  • the CPU of the host system can be processed correspondingly (for example, calculating TCP checksum, GRO processing, etc.), after processing, the CPU will process The uplink packet is forwarded to the protocol stack or vSwitch for processing.
  • FIG. 5 shows that when the received message is a downlink message, the embodiment of the present invention provides A method for uninstalling a network card, the method includes:
  • the host system extracts a protocol keyword of the received data packet.
  • the host system After receiving the downlink packet in the TX direction sent by the vS witch or the protocol stack, the host system extracts the protocol keyword of the downlink packet by using the local packet parsing module.
  • the host system searches for the host policy table according to the protocol keyword, where the host policy table includes a policy entry, where the policy entry includes a policy type, and when the protocol keyword is in the host policy table, When the policy type of the existing policy entry is matched, the data packet is a known data packet of the network card, and the execution is 503; otherwise, the data packet is an unknown data packet of the network card, and S504 is performed.
  • the host system sends the packet to the network card, so that the network card performs a corresponding protocol stack unloading operation on the data packet according to the policy entry in the network card policy table.
  • the host system sends the received data packet to the network card, so that the network card performs a corresponding protocol stack unloading operation on the data packet according to the action in the policy entry.
  • the host system parses the packet, generates a new policy entry, and updates the policy entry to the host policy table and the network card policy table.
  • the packet parsing module of the host system parses, generates, and parses the received data packet.
  • the new policy entry corresponding to the result the local package parsing module of the host system updates the generated new policy entry to the host policy table, and delivers the policy entry to the network card policy table to implement the host policy table and the network card policy.
  • a synchronized update of the table For details, see 103a to 103c, and details are not described here.
  • the host system sends the received downlink packet to the network card, so that the network card performs a corresponding protocol stack unloading operation on the downlink packet according to the policy entry.
  • the host system sends the received downlink packet to the network card, because the policy table in the network card has been added.
  • the message performs the corresponding protocol stack offload operation and is sent out to the network.
  • FIG. 6 is a block diagram of a network device for implementing a network card offloading function according to an embodiment of the present invention, for implementing the method shown in FIG. 1, FIG. 4 and FIG.
  • the network device includes a network card 61 and a host system 62.
  • the network card 61 includes: a memory, a memory card policy table is stored in the memory, the network card policy table includes a policy entry, the policy entry includes a policy type and an action, and the network card 61 can be connected to the host system 62.
  • the network card 61 further includes: a first determining module 611, a first unloading module 612, an uplink packet sending module 613, and a first policy updating module 614.
  • the first determining module 611 is configured to determine, according to the network card policy table, whether the received data packet is a known data packet of the network card or an unknown data packet of the network card.
  • the first unloading module 612 is configured to perform a corresponding protocol stack unloading operation on the data packet according to the network card policy table when the data packet is a data packet known by the network card;
  • the uplink packet sending module 613 is configured to: when the data packet is an unknown data packet of the network card, send the data packet to the host system, so that the host system parses the data packet to generate a new policy entry. ;
  • the first policy update module 614 is configured to receive the new policy entry and update to the network card policy.
  • the first determining module 611 includes: a keyword extracting unit and a table lookup unit.
  • the keyword extracting unit is configured to extract a protocol keyword of the data packet
  • the lookup table unit is configured to search the network card policy table according to the protocol keyword extracted by the keyword extracting unit, where the network card policy table includes a policy entry, where the policy entry includes a policy type, and when the protocol keyword is When the policy type of an existing policy entry in the NIC policy table matches, the data packet is a known data packet of the network card, otherwise the data packet is an unknown data packet of the network card.
  • the host system 62 stores a host policy table, where the host policy table includes a policy entry, the policy entry includes a policy type and an action, and the host system 62 includes: a second determining module 621, The downlink message sending module 622, the packet parsing module 623, and the second policy updating module 624.
  • the second determining module 621 is configured to determine, according to the host policy table, whether the received data packet is a network card known data packet or a network card unknown data packet;
  • the downlink packet sending module 622 is configured to: when the data packet is a data packet with a known data packet, perform a corresponding protocol stack unloading operation on the data packet;
  • the packet parsing module 623 is configured to parse the unknown data packet of the network card to generate a new policy entry when the received data packet is an unknown data packet of the network card;
  • the second policy update module 624 is configured to update the new policy entry into the host policy table and send to the network card.
  • the packet parsing module 623 may include: a key segment extracting unit, a key segment matching unit, and a policy entry generating unit. Alternatively, it may include: a message forwarding unit and a policy entry receiving unit.
  • the key segment extracting unit is configured to extract a protocol key of the network card unknown data packet; the key segment matching unit is configured to search for a protocol according to the protocol keyword extracted by the key segment extracting unit.
  • a table, the protocol parsing table includes a protocol keyword and a protocol parsing function handle;
  • the policy entry generating unit is configured to acquire a protocol analytic function handle in the existing protocol parsing information when the protocol keyword matches a protocol keyword of an existing protocol parsing information in the protocol parsing table, And invoking the protocol parsing function to parse the packet to generate the new policy entry.
  • the packet forwarding unit is configured to forward the received network card unknown data packet to the remote server, so that the remote server parses the packet to generate the new policy entry.
  • the policy entry receiving unit is configured to receive the new policy entry.
  • FIG. 7 is a system block diagram of a network card unloading function provided by an embodiment of the present invention. For ease of description, only parts related to the embodiment of the present invention are shown.
  • the system includes a network card 71, a host system 72, and a remote server 73.
  • the network card 71 includes: a memory 711, wherein the memory 711 stores a network card policy table, the network card policy table includes a policy entry, the policy entry includes a policy type and an action, and the network card 71 is connected to the host system 72.
  • the network card 71 further includes: a first determining module 712, a first unloading module 713, an uplink packet sending module 714, and a first policy updating module 15.
  • the first determining module 712 is configured to determine, according to the network card policy table, whether the received data packet is a known data packet of the network card or an unknown data packet of the network card.
  • the first unloading module 713 is configured to: when the data packet is a data packet known by the network card, perform a corresponding protocol stack unloading operation on the data packet according to the network card policy table;
  • the uplink packet sending module 714 is configured to send the data packet to the host system when the data packet is an unknown data packet of the network card, so that the host system parses the data packet to generate a new policy. Entry
  • the first policy update module 715 is configured to receive the new policy entry and update to the network card policy table.
  • the first determining module 712 includes: a keyword extracting unit and a lookup table unit.
  • the keyword extracting unit is configured to extract a protocol keyword of the data packet
  • the lookup table unit is configured to search the network card policy table or the host policy table according to the protocol keyword extracted by the keyword extracting unit, where the host policy table and the network card policy table include a policy entry, where the policy entry includes a policy type
  • the protocol keyword matches the policy type of an existing policy entry in the NIC policy table
  • the data packet is a NIC known data packet, otherwise the datagram
  • the text is an unknown data packet of the network card.
  • the host system 72 stores a host policy table, the host policy table includes a policy entry, the policy entry includes a policy type and an action, and the host system 72 includes: a second determining module 721 and a downlink packet sending module 722.
  • the message forwarding module 723, the policy entry receiving module 724, and the second policy update module 725 are included in the host system 72.
  • the second determining module 721 is configured to determine, according to the host policy table, whether the received data packet is a known data packet of the network card or an unknown data packet of the network card.
  • the downlink packet sending module 722 is configured to: when the data packet is a data packet with a known data packet, perform a corresponding protocol stack unloading operation on the data packet;
  • the packet forwarding module 723 is configured to forward the received network card unknown data packet to the remote server, so that the remote server parses the packet to generate a new policy entry.
  • a policy entry receiving module 724 is configured to receive the new policy entry
  • the second policy update module 725 is configured to update the new policy entry to the host policy table and send it to the network card.
  • the remote server 73 stores a protocol parsing table, where the protocol parsing table includes a protocol header key and an entry pointing to an analytic function handle corresponding to the protocol header keyword, where the protocol header keyword is
  • the remote server 73 further includes a message receiving module 731, a remote packet parsing module 732, a policy entry sending module 733, a registration command receiving module 734, and a protocol parsing table updating module 735.
  • the packet receiving module 731 is configured to receive the network card unknown data packet sent by the host system 2, and the remote packet parsing module 732 is configured to parse the network card unknown data packet received by the packet receiving module 731 to generate a new policy. Entry
  • the policy entry sending module 733 is configured to send the new policy entry to the host system 72 to simultaneously update the new policy entry sent by the policy entry sending unit 733 by the host system 72 to the host policy table of the host system 72. And the NIC policy table.
  • the remote packet parsing module 732 includes: a key segment extracting unit, a key segment matching unit, and a policy entry generating unit.
  • the key field extraction unit is configured to extract the network card unknown data message protocol keyword
  • the keyword segment matching unit is configured to search a protocol parsing table according to the keyword extracted by the keyword segment extracting unit, where the protocol parsing table includes a protocol keyword and a protocol parsing function handle;
  • a policy entry generating unit configured to: when the protocol keyword matches a protocol keyword of an existing protocol parsing information in the protocol parsing table, obtain a protocol parsing function handle in the existing protocol parsing information, and invoke The protocol parsing function parses the packet to generate a policy entry corresponding to the parsing result.
  • the registration command receiving module 734 is configured to receive an input new protocol registration command, where the new protocol registration command includes a keyword and an entry pointing to an analytic function handle corresponding to the keyword;
  • the protocol parsing table update module 735 is configured to update the protocol parsing table in the remote server 3 according to the new protocol registration command received by the registration command receiving module 34.
  • the received network card unknown data packet is parsed, the policy entry corresponding to the parsing result is generated, and the policy entry is simultaneously updated to the host policy table and the network card policy table, to And causing the network card to perform a corresponding protocol stack unloading operation on the subsequently received similar data packet according to the policy entry.
  • the function module for parsing the packet needs to be updated, so that the card does not need to be changed, thereby realizing the dynamic expansion of the network card offload function.
  • the maintenance of the policy table in the host system and the network card can adopt the passive aging mechanism, that is, the policy entry that exceeds the upper limit when the number of policy entries exceeds the upper limit (LRU, Least Recent Used), thereby saving the storage resources of the network card.
  • the embodiment of the present invention divides the packet parsing module into two parts: a local packet parsing module and a remote packet parsing module.
  • the remote packet parsing module is configured to open a new protocol registration function, and is responsible for parsing the packet, generating a policy entry, and sending the policy entry to the local packet parsing module to form a one-to-many service mode, which solves the problem of deploying a similar network card in a large scale.

Landscapes

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

Abstract

本发明适用于通信技术领域,提供了一种实现网卡卸载功能的方法、网卡、主机系统及网络设备。当网卡或者主机系统接收到的数据报文为网卡未知数据报文时,对所述网卡未知数据报文进行解析,生成新的策略条目,并将所述新的策略条目更新到所述主机策略表和所述网卡策略表中。本发明对含新的私有或标准协议头Tag的报文,只需更新对所述报文进行解析的功能模块,使其能够处理该类报文并下发新的策略条目至主机策略表及网卡策略表中,而网卡无需变动,从而实现了网卡卸载功能的动态扩展。

Description

实现网卡卸载功能的方法、 网卡、 主机系统及网络设备 本申请要求于 2011 年 11 月 30 日提交中国专利局、 申请号为 201110389265. 发明名称为 "实现网卡卸载功能的方法、 网卡、 主机系统及 网络设备" 的中国专利申请的优先权, 其全部内容通过引用结合在本申请中。 技术领域
本发明属于通信技术领域,尤其涉及一种实现网卡卸载功能的方法、 网卡、 主机系统及网络设备。 背景技术
随着互联网业务的快速发展, 网络视频流量急剧增加, 为了实现对硬件资 源的充分利用, 服务器虚拟化技术在数据中心得到越来越广泛的应用。 在这种 情形下, TCP/IP网络协议栈处理对 CPU资源的占用率越来越高, 甚至可能成为 整个服务器系统的瓶颈。 为了降低 CPU的负载, 进而提高整个服务器系统的性 能, 网络适配器(网卡)厂商纷纷推出带卸载功能的网卡, 通过将原本 TCP/IP 网络协议栈负责的部分工作(如计算 TCP/IP校验和、 TCP/UDP报文切片等)卸 载给网卡处理, 从而降低 TCP/IP协议栈处理对 CPU资源的占用率。
目前, 网卡具有的卸载功能通常包括计算 TCP/IP校验和、 TCP/UDP分片报 文重组、 TCP切片卸载等, 这些卸载功能都依赖于网卡能否正确解析所要处理 的报文。 通常, 网卡可以支持标准数据报文, 例如标准 IP报文、 带虚拟局域网 Virtual ( Local Area Network, VLAN )标识的 IP报文的处理。 但是, 在服务 器虚拟化情形下, 为了隔离网络流量, 通常在报文中封装私有协议标签 Tag, 对 于含有私有协议 Tag的 IP报文, 因网卡无法正确解析该类 IP报文,造成各种卸载 处理误操作, 从而导致网络大量丢包, 影响网络传输性能。
现有技术通过定制的网卡, 提供对特定私有协议的网卡卸载功能。 但是, 定制网卡的方案, 可扩展性差, 同时对于未知协议 IP报文的处理, 仍然需要占 用大量的 CPU资源。 发明内容
本发明实施例提供了一种实现网卡卸载功能的方法、 网卡、 主机系统及网 络设备, 旨在解决现有技术中网卡卸载功能扩展性差的问题。
一方面, 提供一种实现网卡卸载功能的方法, 包括:
根据网卡中存储的网卡策略表或者主机系统中存储的主机策略表判断接收 到的数据报文为网卡已知数据报文还是网卡未知数据报文;
当所述数据报文为网卡已知数据报文时, 由网卡根据所述网卡策略表中的 策略条目对所述网卡已知数据报文进行相应的协议栈卸载操作;
当所述数据报文为网卡未知数据报文时, 则对所述网卡未知数据报文进行 解析, 生成新的策略条目, 并将所述新的策略条目更新到所述主机策略表和所 述网卡策略表中。
另一方面, 提供一种网卡, 所述网卡包括: 所述网卡包括:
第一判断模块, 用于依据网卡策略表判断接收到的数据报文是网卡已知数 据报文还是网卡未知数据报文;
第一卸载模块, 用于当所述数据报文是网卡已知数据报文时, 根据网卡策 略表对所述数据报文进行相应的协议栈卸载操作;
上行报文发送模块, 用于当所述数据报文是网卡未知数据报文时, 将所述 数据报文发送给主机系统, 以使主机系统对所述数据报文进行解析, 生成新的 策略条目;
第一策略更新模块, 用于接收所述新的策略条目, 并更新到所述网卡策略 表中。
再一方面, 提供一种主机系统, 包括:
第二判断模块, 用于根据主机策略表判断接收到的数据报文为网卡已知数 据报文还是网卡未知数据报文;
下行报文发送模块, 用于当所述数据报文是网卡已知数据报文时, 则发送 报文进行相应的协议栈卸载操作;
包解析模块, 用于当接收到的数据报文为网卡未知数据报文时, 对所述网 卡未知数据报文进行解析, 生成新的策略条目;
第二策略更新模块, 用于将所述新的策略条目更新到主机策略表中, 并发 送给所述网卡。
又一方面, 提供一种实现网卡卸载功能的网络设备, 所述网络设备包括如 上所述的网卡和如上所述的主机系统。
在本发明实施例中, 先判断接收到的数据报文是网卡已知数据报文还是网 卡未知数据报文, 当所述数据报文为网卡已知数据报文时, 由网卡根据网卡策 略表中的策略条目对所述网卡已知数据报文进行相应的协议栈卸载操作, 当所 述数据报文为网卡未知数据报文时, 则对所述对接收到的网卡未知数据报文进 行解析, 生成新的策略条目, 再将所述新的策略条目同时更新到主机策略表和 网卡策略表中, 以使网卡能根据所述新的策略条目对后续接收到的数据报文进 行相应的协议栈卸载操作, 其中, 所述数据报文的协议关键字与所述网卡未知 数据报文的协议关键字相同。 本发明对含新的私有或标准协议头 Tag的数据报 文, 只需更新对所述报文进行解析的功能模块, 使其能够处理该类数据报文并 下发新的策略条目至主机策略表及网卡策略表中, 而网卡无需变动, 从而实现 了网卡卸载功能的动态扩展。 附图说明
图 1是本发明实施例提供的一种实现网卡卸载功能的方法流程图; 图 2是本发明实施例提供的主机策略表和网卡策略表的结构示意图;
图 3是本发明实施例提供的协议解析表的结构示意图; 图 4是本发明实施例提供的当接收到报文是上行报文时, 实现网卡卸载功 能的方法流程图;
图 5是本发明实施例提供的当接收到报文是下行报文时, 实现网卡卸载功 能的方法流程图;
图 6是本发明实施例提供的实现网卡卸载功能的网络设备框图;
图 7是本发明实施例提供的实现网卡卸载功能的系统框图。 具体实施方式
为了使本发明的目的、 技术方案及优点更加清楚明白, 以下结合附图及实 施例, 对本发明进行进一步详细说明。 应当理解, 此处所描述的具体实施例仅 仅用以解释本发明, 并不用于限定本发明。
在本发明实施例中, 先判断接收到的数据报文是网卡已知数据报文还是网 卡未知数据报文, 当所述数据报文为网卡已知数据报文时, 由网卡根据网卡策 略表中的策略条目对所述网卡已知数据报文进行相应的协议栈卸载操作, 当所 述数据报文为网卡未知数据报文时, 则对所述网卡未知数据报文进行解析, 生 成新的策略条目, 再将所述新的策略条目同时更新到主机策略表和网卡策略表 中, 以使网卡能根据所述新的策略条目对后续接收到的数据报文进行相应的协 议栈卸载操作, 其中, 所述数据报文的协议关键字与所述网卡未知数据报文的 协议关键字相同。 本发明对含新的私有或标准协议头 Tag的数据报文, 只需更 新对所述数据报文进行解析的功能模块, 使其能够处理该类数据报文并下发新 的策略条目至主机策略表或者网卡策略表中, 而网卡无需变动, 从而实现了网 卡卸载功能的动态扩展。
图 1示出了本发明实施例提供的实现网卡卸载功能的方法, 该方法可以应 用于包括主机系统和网卡的网络设备。 所述方法具体包括:
101、根据网卡中存储的网卡策略表或者主机系统中存储的主机策略表判断 接收到的数据报文为网卡已知数据报文还是网卡未知数据报文。 在本发明实施例中, 数据报文可以是入向包报文, 也称为上行报文; 或者 出向包报文也称为下行报文。 其中, 当接收到的数据报文是上行报文时, 即网 卡先接收到所述数据报文时, 则由网卡根据网卡中存储的网卡策略表判断接收 到的数据报文为网卡已知数据报文还是网卡未知数据报文, 否则, 当接收到的 数据报文是下行报文时, 即主机系统先接收到所述数据报文时, 则由主机系统 根据主机系统中存储的主机策略表判断接收到的数据报文为网卡已知数据报文 还是网卡未知数据报文。
其中, 网卡或者主机系统判断接收到的数据报文为网卡已知数据报文还是 网卡未知数据报文, 具体包括:
101a, 网卡或者主机系统提取数据报文的协议关键字;
101b, 根据所述协议关键字查找所述网卡策略表或所述主机策略表, 所述 主机策略表和所述网卡策略表中包括策略条目, 所述策略条目中包括策略类型 和动作;
101c, 当所述协议关键字与所述主机策略表或所述网卡策略表中一条已有 策略条目的策略类型匹配时, 则所述数据报文是网卡已知数据报文, 否则所述 数据报文是网卡未知数据报文。
102、 当所述数据报文为网卡已知数据报文时, 由网卡根据所述网卡策略表 中的策略条目对所述网卡已知数据报文进行相应的协议栈卸载操作。
其中, 当所述数据报文是上行报文时, 使所述网卡根据与所述协议关键字 理后的数据报文发送给主机协议栈或虚拟化平台中的虚拟交换机( vSwitch )处 理。
当所述数据报文是下行报文时, 则主机系统发送所述数据报文至网卡, 以 使网卡根据网卡策略表中的相应策略条目对所述数据报文进行相应的协议栈卸 载操作并外发所述数据报文。
103、 当所述数据报文为网卡未知数据报文时, 则对所述网卡未知数据报文 进行解析, 生成新的策略条目, 并将所述新的策略条目更新到所述主机策略表 和所述网卡策略表中。
其中, 所述网卡中包括内存, 内存中存储有网卡策略表, 网卡策略表中包 括策略条目, 策略条目中包括策略类型和动作。 所述主机系统中存储有主机策 略表, 所述主机策略表与所述网卡策略表结构相同。 具体的主机策略表和网卡 策略表的结构如图 2所示。
具体的 103中, 可以由主机系统对接收到的网卡未知数据报文进行解析, 生成新的策略条目; 所述主机系统中存储有协议解析表。 或者, 由主机系统将 接收到的网卡未知数据报文转发给远端服务器, 以使所述远端服务器对所述网 卡未知数据报文进行解析, 生成新的策略条目, 所述主机系统接收所述远端服 务器返回的所述新的策略条目; 所述远端服务器中存储有协议解析表, 所述协 议解析表中包含协议关键字和协议解析函数句柄, 具体的协议解析表的结构如 图 3所示。
所述主机系统将所述新的策略条目更新到所述主机策略表和所述网卡策略 表中, 以使网卡根据所述新的策略条目对后续接收到的同类数据报文进行相应 的协议栈卸载操作, 所述同类数据报文是指其协议关键字与所述网卡未知数据 报文的协议关键字相同的数据报文。
其中, 对所述网卡未知数据报文进行解析具体包括:
103a, 提取所述网卡未知数据报文的协议关键字;
103b, 根据所述协议关键字查找协议解析表, 所述协议解析表中包含协议 关键字和协议解析函数句柄;
103c, 当所述协议关键字与所述协议解析表中一条已有协议解析信息的协 议关键字匹配时, 获取所述已有协议解析信息中的协议解析函数句柄, 并调用 所述协议解析函数对所述网卡未知数据报文进行解析。
需要说明的是, 主机系统和网卡中的策略表初始可以为空, 即没有任何策 略条目, 随着网卡不断接收到各种协议类型的流量报文, 本地包解析模块或者 远端包解析模块动态扩展主机系统及网卡中的策略表的策略条目, 策略表维护 可以采用被动老化机制,即策略条目数超过上限时覆盖最近最少用( LRU, Least Recent Used ) 的策略条目, 从而节省网卡的存储资源。
在本实施例中,对含新的私有或标准协议头 Tag的报文,只需更新本地包解 析模块或者远端包解析模块使其能处理该类报文并下发新的策略条目至本地策 略表及网卡策略表, 而网卡无需变动, 从而实现了网卡卸载功能动态扩展。
可选的, 为了使主机系统或者远端服务器能够对接收到的网卡未知数据报 文进行解析, 在步骤 101之前, 所述方法还包括:
主机系统或者远端服务器接收输入的新协议注册命令, 所述新协议注册命 令中包括关键字和指向与所述关键字对应的解析函数句柄的表项;
所述主机系统或者所述远端服务器, 根据所述新协议注册命令更新协议解 析表。 图 3示出了新协议注册前的协议解析表和新协议注册后的协议解析表。
举例来说, 图 4示出了本发明实施例提供的当接收到数据报文是上行报文 时, 实现网卡卸载功能的方法, 所述方法包括:
401 , 网卡接收到上行报文后, 提取所述上行报文的协议关键字。
其中, 上行报文的协议关键字可以是协议类型。
402,所述网卡根据所述协议关键字查找所述网卡策略表,所述网卡策略表 中包括策略条目, 所述策略条目中包括策略类型, 当所述协议关键字与所述网 卡策略表中一条已有策略条目的策略类型匹配时, 则所述数据报文是网卡已知 数据报文, 执行 403 , 否则所述数据报文是网卡未知数据报文, 执行 404。
网卡提取到上行报文的协议关键字后, 根据该关键字查找网卡策略表, 当 所述协议关键字与所述网卡策略表中一条已有策略条目的策略类型匹配时, 则 执行步骤 403 , 否则执行步骤 404。
具体的匹配规则是查找策略条目中的策略类型, 当网卡策略表中存在与该 关键字相同的策略类型时, 则认为网卡策略表中存在与该关键字匹配的策略条 。 当所述协议关键字与所述网卡策略表中一条已有策略条目的策略类型匹配 的协议栈卸载操作, 比如计算 TCP校验和、 GRO处理等, 最后, 将上行报文 送交主机系统的协议栈或虚拟化平台中的虚拟交换机(vSwitch )处理。
404 中, 所述网卡发送所述上行报文至主机系统, 以使主机系统对接收到 的所述上行报文进行解析, 生成新的策略条目, 并将所述新的策略条目更新到 主机策略表和所述网卡策略表中。
当所述协议关键字与所述网卡策略表中任一条已有策略条目的策略类型都 不匹配时, 网卡将该上行报文交给主机系统。
主机系统接收到的网卡发送的上行报文后, 首先通过主机系统的本地包解 析模块提取所述上行报文的协议关键字, 再根据所述协议关键字查找协议解析 表, 所述协议解析表中包含协议关键字和协议解析函数句柄, 当所述协议关键 字与所述协议解析表中一条已有协议解析信息的协议关键字匹配时, 获取所述 已有协议解析信息中的协议解析函数句柄, 并调用所述协议解析函数对所述网 卡未知数据报文进行解析, 生成新的策略条目, 然后将该新的策略条目更新到 主机系统中的主机策略表中, 同时将该新的策略条目下发到网卡中的网卡策略 表。
这时主机策略表和网卡策略表中都包括了与所述上行报文的协议关键字匹 配的策略条目, 后续网卡接收到与所述上行报文的协议关键字相同的数据报文 后, 就可按照网卡策略表或者主机策略表中新增加的策略条目中的动作对接收 到的数据报文执行相应的协议栈操作。
另一方面, 通过主机系统对网卡和主机策略表进行更新后, 可以利用主机 系统的 CPU对该上行报文进行相应处理 (如计算 TCP校验和、 GRO处理等), 处理完后, CPU将该上行报文转给协议栈或 vSwitch处理。
又例如, 图 5示出了本发明实施例提供的当接收到报文是下行报文时, 实 现网卡卸载功能的方法, 所述方法包括:
501 , 主机系统提取接收到的数据报文的协议关键字。
当主机系统接收到从 vS witch或协议栈下发的 TX方向的下行报文后, 通 过本地包解析模块提取所述下行报文的协议关键字。
502,主机系统根据所述协议关键字查找所述主机策略表, 所述主机策略表 中包括策略条目, 所述策略条目中包括策略类型, 当所述协议关键字与所述主 机策略表中一条已有策略条目的策略类型匹配时, 则所述数据报文是网卡已知 数据报文, 执行 503; 否则所述数据报文是网卡未知数据报文, 执行 S504。
503 ,主机系统发送所述报文至网卡, 以使网卡根据网卡策略表中的策略条 目对所述数据报文进行相应的协议栈卸载操作。
当数据报文的协议关键字与主机策略表中一条已有策略条目的策略类型匹 配时, 由于主机策略表和网卡策略表是同时更新的, 因此可以得出, 网卡策略 表中也存在与所述关键字匹配的策略条目, 则主机系统发送接收到的数据报文 至网卡, 使网卡根据所述策略条目中的动作对所述数据报文执行相应的协议栈 卸载操作。
504, 主机系统对所述报文进行解析, 生成新的策略条目, 并将所述策略条 目更新到所述主机策略表和网卡策略表中。
当数据报文的协议关键字与主机策略表中任意一条已有策略条目的策略类 型都不匹配时, 则通过主机系统的本的包解析模块对接收到的数据报文进行解 析, 生成与解析结果对应的新的策略条目, 主机系统的本地包解析模块将生成 的新的策略条目更新到主机策略表中,同时将该策略条目下发到网卡策略表中, 以实现主机策略表和网卡策略表的同步更新。 具体步骤可以参见 103a至 103c, 在此不再赘述。
505 ,主机系统发送接收到的下行报文至网卡, 以使所述网卡根据所述策略 条目对所述下行报文执行相应的协议栈卸载操作。
主机系统发送接收到的下行报文至网卡, 由于网卡中的策略表已经添加了 报文执行相应的协议栈卸载操作并外发到网络中。
图 6示出了本发明实施例提供的实现网卡卸载功能的网络设备框图, 用于 实现本发明中图 1、 图 4和图 5所示的方法。所述网络设备包括网卡 61和主机 系统 62。
所述网卡 61包括: 内存, 所述内存中存储有网卡策略表, 所述网卡策略表 包括策略条目,所述策略条目包括策略类型和动作,所述网卡 61可以与所述主 机系统 62连接, 所述网卡 61还包括: 第一判断模块 611、 第一卸载模块 612、 上行报文发送模块 613和第一策略更新模块 614。
其中, 第一判断模块 611用于依据网卡策略表判断接收到的数据报文是网 卡已知数据报文还是网卡未知数据报文;
第一卸载模块 612用于当所述数据报文是网卡已知数据报文时, 根据网卡 策略表对所述数据报文进行相应的协议栈卸载操作;
上行报文发送模块 613用于当所述数据报文是网卡未知数据报文时, 将所 述数据报文发送给主机系统以使主机系统对所述数据报文进行解析, 生成新的 策略条目;
第一策略更新模块 614用于接收所述新的策略条目, 并更新到所述网卡策 其中, 第一判断模块 611包括: 关键字提取单元和查表单元。
关键字提取单元用于提取所述数据报文的协议关键字;
查表单元用于根据所述关键字提取单元提取的协议关键字查找网卡策略 表, 所述网卡策略表中包括策略条目, 所述策略条目中包括策略类型, 当所述 协议关键字与所述网卡策略表中一条已有策略条目的策略类型匹配时, 则所述 数据报文是网卡已知数据报文, 否则所述数据报文是网卡未知数据报文。
所述主机系统 62中存储有主机策略表,所述主机策略表包括策略条目,所 述策略条目包括策略类型和动作, 所述主机系统 62包括: 第二判断模块 621、 下行报文发送模块 622、 包解析模块 623和第二策略更新模块 624。 其中, 第二判断模块 621用于根据主机策略表判断接收到的数据报文为网 卡已知数据报文还是网卡未知数据报文;
下行报文发送模块 622用于当所述数据报文是网卡已知数据报文时, 则发 据报文进行相应的协议栈卸载操作;
包解析模块 623用于当接收到的数据报文为网卡未知数据报文时, 对所述 网卡未知数据报文进行解析, 生成新的策略条目;
第二策略更新模块 624 用于将所述新的策略条目更新到所述主机策略表 中, 并发送给所述网卡。
其中, 所述包解析模块 623可以包括: 关键字段提取单元、 关键字段匹配 单元和策略条目生成单元。 或者, 可以包括: 报文转发单元和策略条目接收单 元。
所述关键字段提取单元用于提取所述网卡未知数据报文的协议关键字; 所述关键字段匹配单元用于根据所述关键字段提取单元提取的所述协议关 键字, 查找协议解析表, 所述协议解析表中包含协议关键字和协议解析函数句 柄;
所述策略条目生成单元, 用于当所述协议关键字与所述协议解析表中一条 已有协议解析信息的协议关键字匹配时, 获取所述已有协议解析信息中的协议 解析函数句柄, 并调用所述协议解析函数对所述报文进行解析, 生成所述新的 策略条目。
所述报文转发单元,用于将接收到的网卡未知数据报文转发给远端服务器, 以由所述远端服务器对所述报文进行解析, 生成所述新的策略条目;
所述策略条目接收单元, 用于接收所述新的策略条目。
需要说明的是, 主机系统和网卡中的策略表初始可以为空, 即没有任何策 略条目, 随着网卡不断接收到各种协议类型的流量报文, 本地包解析模块或者 远端包解析模块动态扩展主机系统及网卡中的策略表的策略条目, 策略表维护 可以采用被动老化机制,即策略条目数超过上限时覆盖最近最少用( LRU, Least Recent Used ) 的策略条目, 从而节省网卡的存储资源。 图 7示出了本发明实施例提供的实现网卡卸载功能的系统框图, 为了便于 说明, 仅示出了与本发明实施例相关的部分。 所述系统包括网卡 71、 主机系统 72和远端服务器 73。
所述网卡 71包括: 内存 711 , 所述内存 711中存储有网卡策略表, 所述网 卡策略表包括策略条目,所述策略条目包括策略类型和动作,所述网卡 71与主 机系统 72连接, 所述网卡 71还包括: 第一判断模块 712、 第一卸载模块 713、 上行报文发送模块 714和第一策略更新模块 15。
其中, 第一判断模块 712用于依据网卡策略表判断接收到的数据报文是网 卡已知数据报文还是网卡未知数据报文;
第一卸载模块 713用于当所述数据报文是网卡已知数据报文时, 根据网卡 策略表对所述数据报文进行相应的协议栈卸载操作;
上行报文发送模块 714用于当所述数据报文是网卡未知数据报文时, 将所 述数据报文发送给主机系统, 以使主机系统对所述数据报文进行解析, 生成新 的策略条目;
第一策略更新模块 715用于接收所述新的策略条目, 并更新到所述网卡策 略表中。
其中, 第一判断模块 712包括: 关键字提取单元和查表单元。
关键字提取单元用于提取所述数据报文的协议关键字;
查表单元用于根据所述关键字提取单元提取的协议关键字查找网卡策略表 或主机策略表, 所述主机策略表和所述网卡策略表中包括策略条目, 所述策略 条目中包括策略类型, 当所述协议关键字与所述网卡策略表中一条已有策略条 目的策略类型匹配时, 则所述数据报文是网卡已知数据报文, 否则所述数据报 文是网卡未知数据报文。
所述主机系统 72中存储有主机策略表,所述主机策略表包括策略条目,所 述策略条目包括策略类型和动作, 所述主机系统 72包括: 第二判断模块 721、 下行报文发送模块 722、报文转发模块 723、策略条目接收模块 724和第二策略 更新模块 725。
其中, 第二判断模块 721用于根据主机策略表判断接收到的数据报文为网 卡已知数据报文还是网卡未知数据报文;
下行报文发送模块 722用于当所述数据报文是网卡已知数据报文时, 则发 据报文进行相应的协议栈卸载操作;
报文转发模块 723用于将接收到的网卡未知数据报文转发给远端服务器, 以由所述远端服务器对所述报文进行解析, 生成新的策略条目;
策略条目接收模块 724用于接收所述新的策略条目;
第二策略更新模块 725用于将所述新的策略条目更新到主机策略表, 并发 送给所述网卡。
所述远端服务器 73中存储有协议解析表,所述协议解析表包括协议头关键 字和指向与所述协议头关键字对应的解析函数句柄的表项, 所述协议头关键字 是所述协议解析表的索引, 所述远端服务器 73还包括报文接收模块 731、 远端 包解析模块 732、策略条目发送模块 733、注册命令接收模块 734和协议解析表 更新模块 735。
报文接收模块 731用于接收主机系统 2发送的网卡未知数据报文; 远端包解析模块 732用于对所述报文接收模块 731接收到的网卡未知数据 报文进行解析, 生成新的策略条目;
策略条目发送模块 733用于发送所述新的策略条目至主机系统 72, 以由所 述主机系统 72将所述策略条目发送单元 733发送的新的策略条目同时更新到主 机系统 72的主机策略表和网卡策略表中。 其中, 所述远端包解析模块 732包括: 关键字段提取单元、 关键字段匹配 单元和策略条目生成单元。
关键字段提取单元用于提取所述网卡未知数据报文协议关键字;
关键字段匹配单元用于根据所述关键字段提取单元提取的关键字, 查找协 议解析表, 所述协议解析表中包含协议关键字和协议解析函数句柄;
策略条目生成单元, 用于当所述协议关键字与所述协议解析表中一条已有 协议解析信息的协议关键字匹配时, 获取所述已有协议解析信息中的协议解析 函数句柄, 并调用所述协议解析函数对所述报文进行解析, 生成与解析结果对 应的策略条目。
注册命令接收模块 734用于接收输入的新协议注册命令, 所述新协议注册 命令中包括关键字和指向与所述关键字对应的解析函数句柄的表项;
协议解析表更新模块 735用于根据所述注册命令接收模块 34接收到的新协 议注册命令更新远端服务器 3中的协议解析表。 在本发明实施例中, 一方面先 对接收到的网卡未知数据报文进行解析, 生成与解析结果对应的策略条目, 再 将所述策略条目同时更新到主机策略表和网卡策略表中, 以使网卡根据所述策 略条目对后续接收到的同类数据报文进行相应的协议栈卸载操作。 对含新的私 有或标准协议头 Tag的报文, 只需更新对所述报文进行解析的功能模块, 使其 卡无需变动, 从而实现了网卡卸载功能的动态扩展。 另一方面, 主机系统和网 卡中的策略表的维护可以采用被动老化机制, 即策略条目数超过上限时覆盖最 近最少用 (LRU, Least Recent Used ) 的策略条目, 从而节省网卡的存储资源。 又一方面, 本发明实施例将包解析模块分成本地包解析模块和远端包解析模块 两部分。 远端包解析模块对外开放新协议注册功能, 负责解析报文、 生成策略 条目并发送给本地包解析模块, 形成一对多的服务模式, 解决了大范围部署同 类网卡时, 由于需要在每台服务器的包解析模块上注册新协议, 并进行协议解 析, 增加处理开销和不利于管理的问题。 以上所述仅为本发明的较佳实施例而已, 并不用以限制本发明, 凡在本发 明的精神和原则之内所作的任何修改、 等同替换和改进等, 均应包含在本发明 的保护范围之内。

Claims

权利 要求 书
1、 一种实现网卡卸载功能的方法, 其特征在于, 包括:
根据网卡中存储的网卡策略表或者主机系统中存储的主机策略表判断接收 到的数据报文为网卡已知数据报文还是网卡未知数据报文;
当所述数据报文为网卡已知数据报文时, 由网卡根据所述网卡策略表中的 策略条目对所述网卡已知数据报文进行相应的协议栈卸载操作;
当所述数据报文为网卡未知数据报文时, 则对所述网卡未知数据报文进行 解析, 生成新的策略条目, 并将所述新的策略条目更新到所述主机策略表和所 述网卡策略表中。
2、 如权利要求 1所述的方法, 其特征在于, 所述当所述数据报文为网卡未 知数据报文时, 则对所述网卡未知数据报文进行解析, 生成新的策略条目具体 包括:
主机系统对接收到的网卡未知数据报文进行解析, 生成新的策略条目; 或 者,
主机系统将接收到的网卡未知数据报文转发给远端服务器, 以使所述远端 服务器对所述网卡未知数据报文进行解析并生成新的策略条目, 所述主机系统 接收所述远端服务器返回的所述新的策略条目。
3、 如权利要求 1或 2所述的方法, 其特征在于, 所述对所述网卡未知数据 报文进行解析具体包括:
提取所述网卡未知数据报文的协议关键字;
根据所述协议关键字查找协议解析表, 所述协议解析表中包含协议关键字 和协议解析函数句柄;
当所述协议关键字与所述协议解析表中一条已有协议解析信息的协议关键 字匹配时, 获取所述已有协议解析信息中的协议解析函数句柄, 并调用所述协 议解析函数对所述网卡未知数据报文进行解析。
4、 如权利要求 1至 3任一项所述的方法, 其特征在于, 所述根据网卡中存 储的网卡策略表或者主机系统中存储的主机策略表判断接收到的数据报文为网 卡已知数据报文还是网卡未知数据报文具体包括:
所述网卡或者所述主机系统提取所述数据报文的协议关键字;
根据所述协议关键字查找所述网卡策略表或所述主机策略表, 所述主机策 略表和所述网卡策略表中包括策略条目, 所述策略条目中包括策略类型;
当所述协议关键字与所述主机策略表或所述网卡策略表中一条已有策略条 目的策略类型匹配时, 则所述数据报文是网卡已知数据报文, 否则所述数据报 文是网卡未知数据报文。
5、 一种网卡, 其特征在于, 所述网卡包括:
第一判断模块, 用于依据网卡策略表判断接收到的数据报文是网卡已知数 据报文还是网卡未知数据报文;
第一卸载模块, 用于当所述数据报文是网卡已知数据报文时, 根据网卡策 略表对所述数据报文进行相应的协议栈卸载操作;
上行报文发送模块, 用于当所述数据报文是网卡未知数据报文时, 将所述 数据报文发送给主机系统, 以使主机系统对所述数据报文进行解析并生成新的 策略条目;
第一策略更新模块, 用于接收所述新的策略条目, 并更新到所述网卡策略 表中。
6、 如权利要求 5所述的网卡, 其特征在于, 所述第一判断模块具体包括: 关键字提取单元, 用于提取所述数据报文的协议关键字;
查表单元, 用于根据所述关键字提取单元提取的协议关键字查找网卡策略 表, 所述网卡策略表中包括策略条目, 所述策略条目中包括策略类型; 当所述 协议关键字与所述网卡策略表中一条已有策略条目的策略类型匹配时, 则所述 数据报文是网卡已知数据报文, 否则所述数据报文是网卡未知数据报文。
7、 一种主机系统, 其特征在于, 所述主机系统包括: 第二判断模块 , 用于根据主机策略表判断接收到的数据报文为网卡已知数 据报文还是网卡未知数据报文;
下行报文发送模块, 用于当所述数据报文是网卡已知数据报文时, 则发送 报文进行相应的协议栈卸载操作;
包解析模块, 用于当接收到的数据报文为网卡未知数据报文时, 对所述网 卡未知数据报文进行解析, 生成新的策略条目;
第二策略更新模块, 用于将所述新的策略条目更新到所述主机策略表中, 并发送给所述网卡。
8、如权利要求 7所述的主机系统,其特征在于,所述包解析模块具体包括: 关键字段提取单元, 用于提取所述网卡未知数据报文的协议关键字; 关键字段匹配单元, 用于根据所述关键字段提取单元提取的所述协议关键 字, 查找协议解析表,所述协议解析表中包含协议关键字和协议解析函数句柄; 策略条目生成单元, 用于当所述协议关键字与所述协议解析表中一条已有 协议解析信息的协议关键字匹配时, 获取所述已有协议解析信息中的协议解析 函数句柄, 并调用所述协议解析函数对所述报文进行解析, 生成所述新的策略 条目。
9、如权利要求 7所述的主机系统,其特征在于,所述包解析模块具体包括: 报文转发单元, 用于将接收到的网卡未知数据报文转发给远端服务器, 以 使所述远端服务器对所述报文进行解析, 生成所述新的策略条目;
策略条目接收单元, 用于接收所述新的策略条目。
10、 一种实现网卡卸载功能的网络设备, 其特征在于, 包括如权利要求 5 至 6任一项所述的网卡和如权利要求 7至 9任一项所述的主机系统。
PCT/CN2012/074628 2011-11-30 2012-04-25 实现网卡卸载功能的方法、网卡、主机系统及网络设备 WO2013078824A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP12853441.9A EP2747381B1 (en) 2011-11-30 2012-04-25 Method, network device and system for implementing network card offloading function
US14/292,096 US9680690B2 (en) 2011-11-30 2014-05-30 Method, network adapter, host system, and network device for implementing network adapter offload function

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201110389265.1 2011-11-30
CN201110389265.1A CN103139253B (zh) 2011-11-30 2011-11-30 实现网卡卸载功能的方法、网卡、主机系统及网络设备

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US14/292,096 Continuation US9680690B2 (en) 2011-11-30 2014-05-30 Method, network adapter, host system, and network device for implementing network adapter offload function

Publications (1)

Publication Number Publication Date
WO2013078824A1 true WO2013078824A1 (zh) 2013-06-06

Family

ID=48498554

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/074628 WO2013078824A1 (zh) 2011-11-30 2012-04-25 实现网卡卸载功能的方法、网卡、主机系统及网络设备

Country Status (4)

Country Link
US (1) US9680690B2 (zh)
EP (1) EP2747381B1 (zh)
CN (1) CN103139253B (zh)
WO (1) WO2013078824A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115150278A (zh) * 2021-03-29 2022-10-04 迈络思科技有限公司 使用数据处理单元(dpu)作为基于图形处理单元(gpu)的机器学习的预处理器
CN116679654A (zh) * 2023-07-10 2023-09-01 河北大学 一种基于Petri网的柔性制造系统死锁控制方法

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10194337B2 (en) * 2012-07-12 2019-01-29 Qualcomm Incorporated Methods and apparatus for offloading checksum processing
US9356866B1 (en) 2014-01-10 2016-05-31 Juniper Networks, Inc. Receive packet steering for virtual networks
US10341203B2 (en) * 2015-01-02 2019-07-02 Gigamon Inc. Policy tracking in a network that includes virtual devices
CN105991625B (zh) * 2015-03-06 2020-11-06 电信科学技术研究院 一种进行数据传输的方法和设备
CN105406989B (zh) * 2015-10-26 2019-04-05 华为技术有限公司 处理报文的方法、网卡及系统、更新信息的方法及主机
CN114095427A (zh) * 2017-12-29 2022-02-25 西安华为技术有限公司 一种处理数据报文的方法和网卡
CN110851371B (zh) 2018-08-20 2023-09-26 华为技术有限公司 报文处理方法及相关设备
CN114363256A (zh) * 2020-09-28 2022-04-15 华为云计算技术有限公司 基于网卡的报文解析方法以及相关装置

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070022212A1 (en) * 2005-07-22 2007-01-25 Fan Kan F Method and system for TCP large receive offload
CN101212314A (zh) * 2006-12-30 2008-07-02 北京天融信网络安全技术有限公司 单一芯片实现多项网络安全功能的方法
CN102217281A (zh) * 2011-06-13 2011-10-12 华为技术有限公司 协议解析方法及装置

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6876654B1 (en) * 1998-04-10 2005-04-05 Intel Corporation Method and apparatus for multiprotocol switching and routing
US7239639B2 (en) * 2001-12-27 2007-07-03 3Com Corporation System and method for dynamically constructing packet classification rules
US7860097B1 (en) * 2004-02-13 2010-12-28 Habanero Holdings, Inc. Fabric-backplane enterprise servers with VNICs and VLANs
US8243595B2 (en) * 2005-08-05 2012-08-14 Hewlett-Packard Development Company, L.P. Prioritization of network traffic sent to a processor by using packet importance
US20070294360A1 (en) * 2006-06-15 2007-12-20 International Business Machines Corporation Method and apparatus for localized adaptation of client devices based on correlation or learning at remote server
US8619766B2 (en) * 2007-03-02 2013-12-31 At&T Intellectual Property Ii, L.P. Method and apparatus for classifying packets
US8031606B2 (en) * 2008-06-24 2011-10-04 Intel Corporation Packet switching
CN102045247A (zh) * 2009-10-12 2011-05-04 曙光信息产业(北京)有限公司 基于Snort规则集的报文处理方法和装置
CN102143148B (zh) * 2010-11-29 2014-04-02 华为技术有限公司 用于通用协议解析的参数获取和通用协议解析方法及装置
CN102014065A (zh) * 2010-12-10 2011-04-13 中兴通讯股份有限公司 报文包头的解析方法、包头解析预处理装置和网络处理器

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070022212A1 (en) * 2005-07-22 2007-01-25 Fan Kan F Method and system for TCP large receive offload
CN101212314A (zh) * 2006-12-30 2008-07-02 北京天融信网络安全技术有限公司 单一芯片实现多项网络安全功能的方法
CN102217281A (zh) * 2011-06-13 2011-10-12 华为技术有限公司 协议解析方法及装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP2747381A4 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115150278A (zh) * 2021-03-29 2022-10-04 迈络思科技有限公司 使用数据处理单元(dpu)作为基于图形处理单元(gpu)的机器学习的预处理器
CN116679654A (zh) * 2023-07-10 2023-09-01 河北大学 一种基于Petri网的柔性制造系统死锁控制方法
CN116679654B (zh) * 2023-07-10 2024-02-02 河北大学 一种基于Petri网的柔性制造系统死锁控制方法

Also Published As

Publication number Publication date
EP2747381A4 (en) 2015-04-08
US20140280857A1 (en) 2014-09-18
CN103139253A (zh) 2013-06-05
EP2747381A1 (en) 2014-06-25
EP2747381B1 (en) 2017-02-22
CN103139253B (zh) 2016-03-09
US9680690B2 (en) 2017-06-13

Similar Documents

Publication Publication Date Title
WO2013078824A1 (zh) 实现网卡卸载功能的方法、网卡、主机系统及网络设备
US10516611B2 (en) Preferential selection of IP protocol version with domain name matching on proxy servers
CN110099115B (zh) 一种透明调度转发的负载均衡方法及系统
US9843514B2 (en) Packet processing method and background server
WO2019062593A1 (zh) 报文传输方法及装置、计算机可读存储介质
JP2006180162A (ja) パケット交換装置およびパケット交換方法
CN114745255B (zh) 硬件芯片、dpu、服务器、通信方法及相关装置
US11509749B2 (en) Data processing method and apparatus, and computer
WO2011069388A1 (zh) 一种协议识别的方法、装置和系统
CN111786905A (zh) 报文重组方法及装置、处理器、存储介质及网络设备
US11558456B2 (en) Method and apparatus for providing and utilizing a link metadata system for the internet
CN113316926A (zh) 域名处理方法、装置、电子设备以及存储介质
US8619790B2 (en) Adaptive cache for caching context and for adapting to collisions in a session lookup table
CN109413001B (zh) 对云计算系统内的交互数据进行安全保护的方法及装置
KR100597405B1 (ko) 소켓 어플리케이션 프로그램을 이용한 데이터 중계 시스템및 데이터 중계 방법
KR102420610B1 (ko) 다층 캐싱 전략을 이용하는 패킷 데이터 처리 방법 및 이를 사용하는 전자 장치
CN113489775B (zh) 一种基于vpp的七层负载均衡服务器及负载均衡方法
US11381544B2 (en) Service type determining method and related device
US11330074B2 (en) TCP (transmission control protocol) fast open for classification acceleration of cache misses in a network processor
WO2015096058A1 (zh) 一种数据包处理方法和装置
CN114449051A (zh) 一种数据包的传输方法、装置以及通信设备
CN109194558B (zh) 隧道报文认证转发方法及系统
US11962502B2 (en) Control apparatus, communication system, control method and program
CN116455868B (zh) 一种基于泛域名解析加私有协议内网穿透的集成服务系统
TWI483605B (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: 12853441

Country of ref document: EP

Kind code of ref document: A1

REEP Request for entry into the european phase

Ref document number: 2012853441

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE