Network card chip and dynamic allocation method of queue resources thereof

CN118900260APending Publication Date: 2024-11-05QINGXIN SEMICON TECH (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410920991.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-10
Publication Date
2024-11-05

AI Technical Summary

Technical Problem

若考虑动态分配,当VF数量多的时候,需要增加很多寄存器来表示每种队列资源的第一个队列和最后一个队列;如果发送队列,接收队列,事件队列按照图4所示排列,动态分配时将队列物理地址映射到VF BAR的计算式是变化的,为实现使用较小的VF BAR,VFBAR地址空间的管理较为复杂

Benefits of technology

[0029] The invention provides a dynamic allocation method for network card chips and queue resources, which uses very little hardware resource overhead to dynamically allocate the queue resources of each VF of SR-IOV, and uses a simple and unified queue physical address to map to the VF BAR space. The calculation formula can realize the use of smaller VF BAR, which effectively improves the efficiency of hardware usage. The method can be applied to the improved design of existing network card chips. The design that does not support SR-IOV is improved to support SR-IOV, and the design that statically allocates queue resources is improved to dynamically allocate queue resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118900260A_ABST
    Figure CN118900260A_ABST
Patent Text Reader

Abstract

The invention discloses a network card chip which comprises a PC I e module and an address mapping module, the PC I e module is used for communicating with an external host, the external host configures a sending queue, a receiving queue and an event queue of a virtual network card and / or reads a state register through the PC I e module, and the address mapping module is in communication connection with the PC I e module. The address in the base address register space of the virtual network card of the PC I e module is converted into an internal physical address based on the configuration of the queue. Wherein the base address register space of the virtual network card comprises a plurality of queue groups which can be dynamically distributed, each queue group comprises at least one sending queue, one receiving queue and one event queue, and the queue of each virtual network card comprises at least one queue group. According to the network card chip, the queue resource of each VF of the SR-IOV is dynamically allocated by using very small hardware resource overhead, and the use efficiency of hardware is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of integrated circuits, and in particular to a network card chip and a method for dynamically allocating queue resources thereof. Background Art

[0002] Single-root I / O virtualization (SR-IOV) is an IO virtualization technology implemented on a physical network interface card (NIC). It uses the special hardware functions on the physical NIC to divide a physical NIC into multiple virtual NICs (VFs). Each VF can be assigned to a different virtual machine or container and has its own MAC address and PCI device ID. The VF communicates with the external network directly through the physical NIC without going through a virtual switch or virtual router, thereby providing higher network performance and lower latency.

[0003] In the SR-IOV application of the network card chip, it is usually necessary to allocate queue resources to each VF, and the queue resources include, for example, a sending queue, a receiving queue, and an event queue. Figure 1 As shown in FIG. 1 , after the system is powered on, (n+1)*t transmit queue resources are evenly distributed to (n+1) VFs, that is, the transmit queue resource addresses are mapped to the corresponding VF base address register (BAR, Base Address Register) space. Figure 1 Each VF shown in the figure is allocated t transmit queue resources. If 2(n+1) registers are added to configure the first transmit queue and the last transmit queue of each VF, the transmit queue resources allocated to each VF can also be different. Similarly, Figure 2 and Figure 3 The diagram shows the situation where (n+1)*r receive queue resources and (n+1)*e event queue resources are evenly distributed to (n+1) VFs. Figures 1 to 3 The method shown is to statically allocate queue resources for each VF. If dynamic allocation is considered, when the number of VFs is large, many registers need to be added to represent the first and last queues of each queue resource; if the send queue, receive queue, and event queue are in accordance with Figure 4 As shown in the arrangement, the calculation formula for mapping the queue physical address to the VF BAR during dynamic allocation is variable. In order to use a smaller VF BAR, the management of the VFBAR address space is more complicated. Summary of the invention

[0004] In view of some or all of the problems in the prior art, the present invention provides a network card chip in a first aspect, wherein the interface part with the host comprises:

[0005] A PCIe module, which is used to communicate with an external host, wherein the external host configures queue resources and / or reads a status register through the PCIe module, wherein the queue resources include a sending queue resource, a receiving queue resource, and an event queue resource; and

[0006] An address mapping module is communicatively connected to the PCIe module and is used to convert an address in a virtual network card base address register (VF BAR) space of the PCIe module into an internal physical address based on the configuration of the queue resources.

[0007] Furthermore, the virtual network card base address register space includes a plurality of dynamically assignable queue groups, wherein each queue group includes at least one sending queue, one receiving queue and one event queue, and each virtual network card can be assigned at least one queue group.

[0008] Furthermore, the network card chip also includes:

[0009] a sending queue management module, which is communicatively connected to the address mapping module via a bus, and manages sending queue resources based on the internal physical address converted by the address mapping module;

[0010] a receiving queue management module, which is communicatively connected to the address mapping module via a bus, and manages receiving queue resources based on the internal physical address converted by the address mapping module; and

[0011] An event queue management module is communicatively connected to the address mapping module via a bus, and the event queue management module manages event queue resources based on the internal physical address converted by the address mapping module.

[0012] Furthermore, when the system allocates queue resources, it is necessary to configure the number of virtual network cards, the size of the base address register space of each virtual network card, and the number of queue groups of each virtual network card.

[0013] Based on the network card chip as described above, the second aspect of the present invention provides a method for dynamically allocating queue resources thereof, including:

[0014] The queue resources of the virtual network card are configured through the external host and sent to the PCI e module of the network card chip;

[0015] Converting the configuration of queue resources into internal physical addresses through an address mapping module; and

[0016] Based on the internal physical address, the queue is managed by a queue management module.

[0017] Furthermore, configuring the queue of the virtual network card includes: setting the number of virtual network cards, the size of the base address register space of each virtual network card, and the number of queue groups of each virtual network card.

[0018] Furthermore, converting the configuration of the queue to an internal physical address includes:

[0019] According to the size of the virtual network card base address register space, the corresponding position of the internal physical address is set to zero;

[0020] Determine whether the value of the designated bit of the internal physical address is greater than a preset value, wherein the preset value is equal to the size of the resources in the virtual network card base address register space excluding the queue resources:

[0021] If so, converting the address of the queue resource; and

[0022] If not, the addresses of resources other than queue resources are converted.

[0023] Furthermore, converting the address of the queue resource includes:

[0024] Determining the type of the address of the address queue resource, wherein the type includes an event queue address, a send queue address, and a receive queue address; and

[0025] The event queue address, the sending queue address and the receiving queue address are converted respectively according to the type.

[0026] Further, determining the type of the address of the address queue resource includes:

[0027] The type is determined according to the value of the designated bit of the address, where if the value of the designated bit is 0, it is the event queue address, if the value of the designated bit is 1, it is the send queue address, and if the value of the designated bit is 2, it is the receive queue address.

[0028] Furthermore, the conversion of the event queue address, the sending queue address and the receiving queue address is determined based on the total number of queue groups allocated for use by all virtual network cards before the current virtual network card and the sequence number of the queue group in all queue groups used by the current virtual network card.

[0029] The present invention provides a network card chip and a method for dynamically allocating queue resources thereof, which realizes dynamic allocation of queue resources for each VF of SR-IOV with very little hardware resource overhead, and uses a simple and unified queue physical address to map to a calculation formula in the VF BAR space to realize the use of a smaller VF BAR, thereby effectively improving the use efficiency of the hardware. The method can be applied to the improved design of the existing network card chip, improving the design that does not support SR-IOV to support SR-IOV, and improving the design that statically allocates queue resources to dynamically allocate queue resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] To further illustrate the above and other advantages and features of various embodiments of the present invention, a more specific description of various embodiments of the present invention will be presented with reference to the accompanying drawings. It will be understood that these drawings only depict typical embodiments of the present invention and are therefore not to be considered as limiting the scope thereof. In the accompanying drawings, for clarity, identical or corresponding parts will be represented by identical or similar reference numerals.

[0031] Figure 1 A schematic diagram showing the allocation of sending queue resources in an existing network card chip;

[0032] Figure 2 A schematic diagram showing allocation of receiving queue resources in an existing network card chip is shown;

[0033] Figure 3 A schematic diagram showing the allocation of event queue resources in an existing network card chip is shown;

[0034] Figure 4 A schematic diagram showing the structure of a virtual network card base address register space of an existing network card chip;

[0035] Figure 5 A schematic diagram showing the structure of a network card chip and a host interface portion according to an embodiment of the present invention;

[0036] Figure 6 A schematic diagram showing queue resources of a virtual network card of a network card chip according to an embodiment of the present invention is shown;

[0037] Figure 7 A schematic diagram showing the structure of the base address register space of a network card chip according to an embodiment of the present invention;

[0038] Figure 8 A schematic diagram showing an address mapping module according to an embodiment of the present invention;

[0039] Fig. 9 A schematic diagram showing the process of address mapping according to an embodiment of the present invention; and

[0040] Fig.10 A schematic flow chart showing a method for dynamically allocating queue resources of a network card chip according to an embodiment of the present invention. DETAILED DESCRIPTION

[0041] In the following description, the present invention is described with reference to various embodiments. However, those skilled in the art will recognize that various embodiments can be implemented without one or more specific details or with other replacement and / or additional methods, materials or components. In other cases, well-known structures, materials or operations are not shown or described in detail to avoid blurring the inventive point of the present invention. Similarly, for the purpose of explanation, specific quantities, materials and configurations are set forth to provide a comprehensive understanding of embodiments of the present invention. However, the present invention is not limited to these specific details. In addition, it should be understood that the various embodiments shown in the drawings are illustrative representations and are not necessarily drawn in correct proportions.

[0042] In this specification, reference to "one embodiment" or "the embodiment" means that a particular feature, structure, or characteristic described in conjunction with the embodiment is included in at least one embodiment of the present invention. The phrase "in one embodiment" appearing in various places in this specification does not necessarily all refer to the same embodiment.

[0043] It should be noted that the embodiments of the present invention describe the process steps in a specific order, but this is only for the purpose of illustrating the specific embodiment, rather than limiting the order of the steps. On the contrary, in different embodiments of the present invention, the order of the steps can be adjusted according to the adjustment of the process.

[0044] The inventor has found through research that high-performance network card chips usually include thousands of transmission queues, and the states of these queues are stored in the hardware RAM. The queue management logic effectively stores and manages the queue states. The queue states include, for example, a pointer to the DMA address of the ring buffer, the size of the ring buffer, producer and user pointers, etc. The number of queues supported by the network card chip is determined by the size of the hardware RAM. In SR-IOV applications, the flexible and efficient use of these queues can maximize the utilization of hardware resources, that is, if the queue resources can be dynamically allocated, the use efficiency of the hardware will be greatly improved. To achieve this goal, for example, the queue resources of each VF can be reallocated at each power-on, and the queue resources released by some VFs after power-on can be allocated to other VFs for reuse. Based on this, the present invention proposes a method for dynamically allocating queue resources of each VF of SR-IOV with a simple structure, low hardware resource overhead, and easy use. It adds an address mapping module to the existing network card chip architecture, converts the address in the VF BAR space of the PCI e module into an internal physical address, and then configures the corresponding queue manager, thereby realizing flexible allocation of queue resources for each VF. At power-on, each VF can allocate queue resources of different sizes according to application requirements. After power-on, queue resources released by a VF can be reallocated to other VFs. Based on this, only the BAR addresses of queue resources need to be reorganized to form a smaller (e.g. 1KB) dynamically allocable queue group. Each VF can dynamically configure how many queue groups it needs through registers. The relationship between the number of queue groups and the size of the VF BAR is also very intuitive and should be as small as possible.

[0045] The technical solution of the present invention is further described below in conjunction with the accompanying drawings of the embodiments.

[0046] Figure 5 FIG. 1 is a schematic diagram showing the structure of the network card chip and the host interface part of an embodiment of the present invention. Figure 5 As shown, a network card chip, the interface part with the host mainly includes a PCI e module 501 and an address mapping module 502.

[0047] The PCI e module 501 is communicatively connected to the external host 001, and the external host 001 reads the information of the status register through the PCI e module 501 and allocates queue resources, wherein the queue resources include sending queue resources, receiving queue resources and event queue resources. Figure 6 A schematic diagram of queue resources of a virtual network card of a network card chip according to an embodiment of the present invention is shown as follows: Figure 6As shown, unlike the existing network card chip, in an embodiment of the present invention, the BAR is divided into a plurality of dynamically allocated queue groups, wherein each queue group includes at least one sending queue, one receiving queue and one event queue. The size of each queue group is relatively small, for example, it can be 1KB. Based on this, in one embodiment of the present invention, the allocation of queue resources mainly includes setting the number of virtual network card VFs, the size of the base address register space required for each VF, and the number of queue groups for each VF. In one embodiment of the present invention, when reallocating the queue resources of each VF, it is mainly necessary to configure two sets of registers: vf_size[vf_num-1:0], and vf_qset_num[vf_num-1:0], wherein vf_num represents the number of VFs, the nth bit of vf_size represents the BAR size allocated to the nth virtual network card VFn, and the nth bit of vf_qset_num represents the number of queue groups of VFn. In actual operation, after configuring the number of queue groups for each VF, the size of the BAR required for each VF can be intuitively obtained. Figure 7 A schematic diagram showing the structure of the base address register space of the network card chip according to an embodiment of the present invention is shown as follows: Figure 7 As shown in the figure, any VF BAR includes several queue groups and other resources such as interrupts and mailboxes. Assuming that the size of a queue group is 1KB and the size of other resources such as interrupts and mailboxes is 4KB, when a VF is configured with 4 queue groups, the corresponding VF BAR should not be less than 8K.

[0048] The address mapping module 502 is communicatively connected to the PCIe module 501, and is used to convert the address in the VF BAR space of the PCIe module into an internal physical address based on the configuration of the queue resources, so that the queue management module can perform queue management. Figure 8 A schematic diagram of an address mapping module according to an embodiment of the present invention is shown as follows: Figure 8 As shown, in one embodiment of the present invention, for any VF, the input of the address mapping module 502 mainly includes vf_size[vf_id], vf_qset_num[vf_id-1:0] and addr_i n_vfbar[vf_id], where vf_id is the number of the VF, and the input is actually the size of the BAR of the VF, the number of queue groups of the VF before the VF, and the address within the VFBAR. The main output of the address mapping module 502 is the internal physical address internal_physical_addr. Taking VF0 as an example, Fig. 9 A schematic diagram showing the address mapping process of an embodiment of the present invention is shown as follows: Fig. 9As shown, the value of vf_qset_num[0] of VF0 is x, which means that VF0 needs x queue groups.

[0049] like Figure 5 As shown, in one embodiment of the present invention, the queue management module includes a sending queue management module 531, a receiving queue management module 532 and an event queue management module 533, all of which are communicatively connected to the address mapping module 502 through a bus 504, and can then manage the sending queue, receiving queue and event queue respectively based on the internal physical address converted by the address mapping module.

[0050] Based on the network card chip as mentioned above, Fig.10 A schematic diagram showing a flow chart of a method for dynamically allocating queue resources of a network card chip according to an embodiment of the present invention is shown as follows: Fig.10 The method for dynamically allocating queue resources of the network card chip includes:

[0051] First, in step 1001, queue resources are configured. The queue resources of the virtual network card are configured through an external host, mainly including configuring registers vf_size[vf_num-1:0] and vf_qset_num[vf_num-1:0] to set the size of the base address register space required by each VF and the number of queue groups of each VF, and send them to the PCIe module of the network card chip;

[0052] Next, in step 1002, address conversion is performed. The configuration of the queue resources is converted into an internal physical address through an address mapping module. In one embodiment of the present invention, the address conversion includes:

[0053] First, according to the size of the VF BAR, the corresponding position of the internal physical address is set to zero. Specifically, the corresponding high position of internal_physical_addr is set to zero according to the size of the VF BAR, so as to prevent the unused high address bits from being used incorrectly in the subsequent steps. Assuming that the size of the VF BAR can be 8KB to 256KB, the size of a queue group is 1KB, and other resources such as interrupts and mailboxes are located in the 0th to Nth KB of the VF BAR, queue group 0 is located in the (N+1)th KB of the VF BAR, queue group 1 is located in the (N+2)th KB of the VF BAR, and queue group n is located in the (N+n+1)th KB of the VF BAR. At the same time, assuming that the space allocated to the event queue, the send queue, and the receive queue in a queue group is 256B, the corresponding high position of internal_physical_addr[17:10] needs to be set to zero according to the size of the VFBAR, as shown in Table 1:

[0054] VF BAR internal_physical_addr[17:10] 8KB {5'h0,addr_in_vfbar[12:10]} 16KB {4'h0,addr_in_vfbar[13:10]} 32KB {3'h0,addr_in_vfbar[14:10]} 64KB {2'h0,addr_in_vfbar[15:10]} 128KB {1'h0,addr_in_vfbar[16:10]} 256KB addr_in_vfbar[17:10]

[0055] Table 1

[0056] Next, it is determined whether the value of the designated bit of the internal physical address is greater than a preset value, wherein the designated bit is the position where the operation is performed in the aforementioned steps, such as internal_physical_addr[17:10] in the aforementioned embodiment, and the preset value is equal to the size of the resources in the VF BAR except the queue resources, that is, the value of N. As mentioned above, when the designated value is greater than N, it means that the address is a queue group address, and the address type is further determined. In one embodiment of the present invention, the address type is further determined according to the value of the designated bit of the address, and the corresponding address conversion is performed according to the address type. If the value of the designated bit is 0, it is the event queue address, if the value of the designated bit is 1, it is the sending queue address, and if the value of the designated bit is 2, it is the receiving queue address. Still taking the aforementioned embodiment as an example, the designated bit refers to the value of addr_in_vfbar[9:8]. It should be understood that the address bit width of the designated bit is different based on the size of the space allocated to different queues. For example, assuming that the space allocated to the event queue, the sending queue, and the receiving queue in a queue group is 128B, the designated bit becomes addr_i n_vfbar[9:7]. If the value of the designated bit is not greater than the preset value, the address is an interrupt, mailbox, or other resource address, and the address conversion of the interrupt, mailbox, or other resource is performed; and

[0057] Finally, according to the type of the address, the address conversion is performed based on different calculation formulas, wherein the conversion of the event queue address, the sending queue address, and the receiving queue address is determined based on vf_id being less than the total number of queue groups used by all VFs of the virtual network card, and the sequence number of each queue group in all queue groups used by the virtual network card. That is, it needs to use vf_qset_sum[vf_id] and qset_i ndex. Among them, vf_qset_sum[vf_id] represents the total number of queue groups used by all VFs before VF[vf_id], which is calculated based on the vf_qset_num[vf_num-1:0] register group configured by the user: vf_qset_sum[vf_id]=

[0058] vf_qset_sum[0]+vf_qset_sum[1]+…+vf_qset_sum[vf_id-1]. qset_index represents the sequence number of each queue group in all queue groups used by the VF, which is calculated from internal_physical_addr[17:10] and N: qset_index=

[0059] internal_physical_addr[17:10]-(N+1); and

[0060] Finally, in step 1003, queue management, a corresponding queue manager is configured based on the internal physical address to manage the queue.

[0061] So far, the network card chip has realized the dynamic allocation of queue resources for each VF of SR-IOV with only a small amount of hardware resource overhead, and it uses a simple and unified calculation formula to map the queue physical address to the VF BAR to realize the use of a smaller VF BAR. Applying it to the improved design of existing network card chips can improve the design that does not support SR-IOV to support SR-IOV, and improve the design of statically allocating queue resources to dynamically allocating queue resources, greatly improving the efficiency of hardware use.

[0062] Although various embodiments of the present invention are described above, it should be understood that they are presented as examples only and not as limitations. It is obvious to those skilled in the relevant art that various combinations, modifications and changes can be made thereto without departing from the spirit and scope of the present invention. Therefore, the breadth and scope of the present invention disclosed herein should not be limited by the exemplary embodiments disclosed above, but should only be defined according to the attached claims and their equivalents.

Claims

1. A network card chip, characterized in that: include: A PCIe module configured to communicate with an external host, wherein the external host reads information of a status register through the PCIe module and configures queue resources of a virtual network card, wherein the queue resources include a sending queue resource, a receiving queue resource, and an event queue resource; as well as An address mapping module is communicatively connected to the PCIe module and is configured to convert an address in a virtual network card base address register space of the PCIe module into an internal physical address based on the configuration of the queue resources, wherein the virtual network card base address register space includes a plurality of dynamically assignable queue groups, wherein each queue group includes at least one sending queue, one receiving queue and one event queue, and each queue of the virtual network card includes at least one queue group.

2. The network card chip according to claim 1, characterized in that: Also includes: a sending queue management module, which is communicatively connected to the address mapping module via a bus, and is configured to manage sending queue resources based on the internal physical address converted by the address mapping module; a receiving queue management module, which is communicatively connected to the address mapping module via a bus, and is configured to manage receiving queue resources based on the internal physical address converted by the address mapping module; and An event queue management module is communicatively connected to the address mapping module via a bus, and the event queue management module is configured to manage event queue resources based on the internal physical address converted by the address mapping module.

3. The network card chip according to claim 1, characterized in that: The configuration of the queue includes the number of virtual network cards, the size of the base address register space of each virtual network card, and the number of queue groups of each virtual network card.

4. A method for dynamically allocating queue resources of a network card chip according to any one of claims 1 to 3, characterized in that: Includes steps: The queue resources of the virtual network card are configured through an external host and sent to the PCIe module of the network card chip; Converting the configuration of queue resources into internal physical addresses through an address mapping module; and Based on the internal physical address, the queue is managed by a queue management module.

5. The dynamic allocation method according to claim 4, characterized in that: Configuring the queue resources of the virtual network card includes the following steps: Set the number of virtual network cards, the size of the base address register space required by each virtual network card, and the number of queue groups for each virtual network card.

6. The dynamic allocation method according to claim 4, characterized in that: The conversion of the queue resource configuration to an internal physical address consists of the following steps: According to the size of the virtual network card base address register space, the corresponding position of the internal physical address is set to zero; Determine whether the value of the designated bit of the internal physical address is greater than a preset value, wherein the preset value is equal to the size of the resources in the virtual network card base address register space excluding the queue resources: If yes, convert the address of the queue resource according to a preset method; and If not, the addresses of resources other than the queue resources are converted according to a preset method.

7. The dynamic allocation method according to claim 6, characterized in that: Converting the address of a queue resource includes the following steps: Determining the type of the address of the address queue resource, wherein the type includes an event queue address, a send queue address, and a receive queue address; and The event queue address, the sending queue address and the receiving queue address are converted respectively according to the type.

8. The dynamic allocation method according to claim 7, characterized in that: Determining the type of the address of the address queue resource includes: The type is determined according to the value of the designated bit of the address, where if the value of the designated bit is 0, it is the event queue address, if the value of the designated bit is 1, it is the send queue address, and if the value of the designated bit is 2, it is the receive queue address.

9. The dynamic allocation method according to claim 7, characterized in that: The conversion of the event queue address, the sending queue address and the receiving queue address is determined based on the total number of queue groups used by the virtual network card before the current virtual network card and the sequence number of each queue group in all queue groups used by the current virtual network card.