WO2016074179A1 - 一种数据处理方法及多核处理器*** - Google Patents

一种数据处理方法及多核处理器*** Download PDF

Info

Publication number
WO2016074179A1
WO2016074179A1 PCT/CN2014/090944 CN2014090944W WO2016074179A1 WO 2016074179 A1 WO2016074179 A1 WO 2016074179A1 CN 2014090944 W CN2014090944 W CN 2014090944W WO 2016074179 A1 WO2016074179 A1 WO 2016074179A1
Authority
WO
WIPO (PCT)
Prior art keywords
data packet
network card
network
address
cpu
Prior art date
Application number
PCT/CN2014/090944
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 CN201480038084.6A priority Critical patent/CN105874757B/zh
Priority to PCT/CN2014/090944 priority patent/WO2016074179A1/zh
Publication of WO2016074179A1 publication Critical patent/WO2016074179A1/zh

Links

Images

Definitions

  • the present invention relates to the field of multi-core processors, and in particular, to a data processing method and a multi-core processor system.
  • the technician has proposed the concept of multi-core decoupling, that is, by inputting the memory, input and output in the multi-core computer system (English: Input/Output, referred to as IO)
  • the decoupling of hardware devices forms a network of respective management hardware, thereby effectively improving the high-performance computing capability of the multi-core computer system.
  • a typical multi-core processor system based on many-core decoupling which is commonly used today, is a CPU board integrated with multiple central processing units (CPUs), and a device board integrated with various IO devices. And a separate component such as a resource management center for managing all hardware resources in the system.
  • the above CPU board usually has multiple CPUs (thousands of CPU cores), and can run multiple operating systems (English: Operating System, OS for short), and the IO devices integrated in the above device boards. This includes network cards, disks, and so on.
  • the operating system on the CPU board requires the network card to provide network services
  • the operating system sends a network card allocation request to the resource management center, and the resource management center receives the network card allocation request.
  • the corresponding network card is selected from the idle network card and assigned to the CPU core running the operating system, and the CPU core is bound to the allocated network card, and then the device board
  • the controller in the control controls the assigned network card to establish an IO channel for forwarding data with the CPU controller corresponding to the CPU core.
  • the resource management center needs to be involved in the management, so that the entire NIC resource application step is too long, and some data packets are not processed in time, thereby causing network data interruption.
  • the embodiment of the invention provides a data processing method and a multi-core processor system, which solves the problem that the multi-core processor system based on the many-core decoupling in the prior art cannot process data across network cards and across network segments, and the application steps of the network card resources are Long, and the resulting data packet is interrupted due to untimely processing of network data.
  • a data processing method for a multi-core processor system, the multi-core processor system including a device board and a central processing unit CPU board, the CPU board including a plurality of CPU cores and one for a management office a CPU controller of a CPU core in a CPU board, wherein an operating system is run in a first CPU core of the plurality of CPU cores, the device board includes M physical network cards and is used to manage the M physical
  • the network card controller of the network card includes:
  • the network card controller acquires a first data packet in a queue to be sent, where the first data packet is encapsulated by the CPU controller to data of a process running an operating system on the first CPU core.
  • the first data packet includes a source address, a destination address, and a network parameter of a network service required by the first data packet, where a source address of the first data packet is the first The internal address of the data packet used in the multi-core processor system;
  • the first data packet stored in the to-be-sent queue is sent by the CPU controller in the CPU board by using a predetermined protocol
  • the predetermined agreement includes a mail box mailbox protocol
  • the network parameters of the network service required by the first data packet include a network segment of the network service connection and a bandwidth required by the network service;
  • the internal address of the first data packet includes at least one of the CPU board identification ID, the operating system ID, or the process ID.
  • the source address and the destination address according to the first data packet, and the foregoing A network parameter of a network service required by the data packet, and allocating the network card IP address to the first data packet specifically includes:
  • the information mapping table Searching, in the information mapping table, a network parameter of the network service required by the first data packet, where the information mapping table is used to store a history record of the data packet sent and received by the network card controller through the M physical network cards,
  • the history record includes a destination address of the data packet sent and received by the M physical network cards, a correspondence between the network card IP address and the source address;
  • the method further includes:
  • the destination address of the first data packet is retrieved in the history record matching the network parameter
  • the destination address of the first data packet is retrieved in the history record matching the network parameter, assigning the network card IP address in the history record including the destination address of the first data packet Giving the first data packet.
  • the searching for the After the history of the network parameters of the network service required by the first data packet matches the method further includes:
  • the network card IP in any history record in the history record matching the network parameter The address is assigned to the first data packet.
  • a data processing method for a multi-core processor system, the multi-core processor system including a device board and a central processing unit CPU board, the CPU board including a plurality of CPU cores and one for a management office a CPU controller of a CPU core in a CPU board, wherein an operating system is run in a first CPU core of the plurality of CPU cores, the device board includes M physical network cards and is used to manage the M physical
  • the network card controller of the network card includes:
  • the network card controller receives the first data packet, where the first data packet includes a source address of the first data packet and a network card IP address of a physical network card that receives the first data packet;
  • the second data packet in the queue to be received is sent by the CPU controller in the CPU board by using a predetermined protocol.
  • the predetermined agreement includes a mail box mailbox protocol;
  • the destination address includes an ID of an operating system running in the first CPU core, an ID of a process in the operating system that processes the second data packet, and an ID of a CPU board in which the first CPU core is located. At least one of them.
  • the source address and the network card IP address of the first data packet are The first data packet allocation destination address specifically includes:
  • the information mapping table Retrieving, in the information mapping table, a history of the physical network card corresponding to the network card IP address of the first data packet, where the information mapping table is configured to store the data packet sent and received by the network card controller by using the M physical network cards a history record, where the history record includes a destination address of the data packet sent and received by the M physical network cards, a correspondence between the network card IP address and the source address;
  • the source address of the first data packet is retrieved in the retrieved history record
  • an internal address in a history record including a source address of the first data packet is allocated to the first data packet.
  • the method further includes:
  • the history data of the physical network card corresponding to the network card IP address of the first data packet is in any one of the history records.
  • An internal address is assigned to the first data packet.
  • a network card controller for use in a multi-core processor system, the multi-core processor system including a device board and a central processing unit CPU board, the CPU board including a plurality of CPU cores and one for a management office a CPU controller of a CPU core in a CPU board, wherein an operating system is run in a first CPU core of the plurality of CPU cores, the device board includes M physical network cards and is used to manage the M physical a network card controller of the network card, the network card controller includes:
  • An acquiring module configured to acquire a first data packet in a queue to be sent, where the first data packet is encapsulated by the CPU controller to data of a process running an operating system on the first CPU core
  • the first data packet includes a source address, a destination address, and a network parameter of a network service required by the first data packet, where a source address of the first data packet is the first The internal address of the data packet used in the multi-core processor system;
  • An allocating module configured to allocate a network card IP address to the first data packet according to a source address, a destination address, and a network parameter of a network service required by the first data packet;
  • a conversion module configured to convert the first data packet into a second data packet, where a source address in the second data packet is the network card IP address;
  • a sending module configured to send the second data packet to the external network by using a physical network card corresponding to the network card IP address.
  • the first data packet stored in the to-be-sent queue is sent by the CPU controller in the CPU board by using a predetermined protocol
  • the predetermined agreement includes a mail box mailbox protocol
  • the network parameters of the network service required by the first data packet include a network segment of the network service connection and a bandwidth required by the network service;
  • the internal address of the first data packet includes at least one of the CPU board identification ID, the operating system ID, or the process ID.
  • the information mapping table searchesing, in the information mapping table, a network parameter of the network service required by the first data packet, where the information mapping table is used to store a history record of the data packet sent and received by the network card controller through the M physical network cards,
  • the history record includes a correspondence between a destination address, a network card IP address, and a source address of the data packet sent and received by the M physical network cards;
  • the allocating module retrieves the first data in a history record in an information mapping table After the network parameters of the required network service are packaged, it is also used to:
  • the destination address of the first data packet is retrieved in the history record matching the network parameter
  • the destination address of the first data packet is retrieved in the history record matching the network parameter, assigning the network card IP address in the history record including the destination address of the first data packet Giving the first data packet.
  • the assigning module searches in the historical record that matches the network parameter After the destination address of the first data packet, it is further used for:
  • the network card IP in any history record in the history record matching the network parameter The address is assigned to the first data packet.
  • a network card controller for use in a multi-core processor system, the multi-core processor system including a device board and a central processing unit CPU board, the CPU board including a plurality of CPU cores and one for a management office a CPU controller of a CPU core in a CPU board, wherein an operating system is run in a first CPU core of the plurality of CPU cores, the device board includes M physical network cards and is used to manage the M physical a network card controller of the network card, the network card controller, comprising:
  • a receiving module configured to receive a first data packet, where the first data packet includes a source address of the first data packet and a network card IP address of a network card that receives the first data packet site;
  • An allocating module configured to allocate a destination address to the first data packet according to a source address of the first data packet and the network card IP address, where the destination address is the first data packet in the multi-core The internal address used in the processor system;
  • a conversion module configured to replace the network card IP address in the first data packet with the destination address, to obtain a second data packet
  • a sending module configured to forward the second data packet to the queue to be received, so that the CPU controller instructs the first CPU core corresponding to the destination address of the second data packet to process the second data packet.
  • the second data packet in the queue to be received is sent and received by a CPU controller in the CPU board by using a predetermined protocol, where the predetermined protocol includes a mail box mailbox. protocol;
  • the destination address includes an ID of an operating system running in the first CPU core, an ID of a process in the operating system that processes the second data packet, and an ID of a CPU board in which the first CPU core is located. At least one of them.
  • the information mapping table Retrieving, in the information mapping table, a history of the physical network card corresponding to the network card IP address of the first data packet, where the information mapping table is configured to store the data packet sent and received by the network card controller by using the M physical network cards a history record, where the history record includes a correspondence between a destination address of the data packet sent and received by the M physical network cards, a network card IP address, and a source address;
  • the source address of the first data packet is retrieved in the retrieved history record
  • an internal address in a history record including a source address of the first data packet is allocated to the first data packet.
  • the allocation module is further configured to:
  • the history data of the physical network card corresponding to the network card IP address of the first data packet is in any one of the history records.
  • An internal address is assigned to the first data packet.
  • the data processing method provided by the embodiment of the present invention, after the network card controller obtains the first data packet in the queue to be sent, according to the source address, the destination address of the first data packet, and the network parameter of the network service required by the first data packet, Allocating a network card IP address for the first data packet, and then the network card controller converts the first data packet into a second data packet, and sends the second data packet to the external network by using a physical network card corresponding to the network card IP address; or, the network card control
  • the device allocates a destination address to the first data packet according to the source address of the first data packet and the network card IP address, and then the network card controller replaces the network card IP address in the first data packet with the destination address.
  • the network card controller forwards the second data packet to the to-be-received queue, so that the CPU controller instructs the first CPU core corresponding to the destination address of the second data packet to process the second data packet.
  • the present invention manages all physical network cards and provides network services through the network card controller, and does not require the intervention management of the resource management center, thereby reducing the application procedure of the network card resources and solving the problem that the application process of the entire network card resource is too long.
  • the resulting data packet is interrupted due to untimely processing, and the management load of the CPU board is reduced.
  • the network card controller flexibly allocates the IP address of the network card to the data packet, so that the data packet is not restricted by the network card and the network segment, thereby realizing the multi-core processor system of the multi-core decoupling to process data across the network card and the network segment.
  • FIG. 1 is a schematic structural diagram of a multi-core processor system according to an embodiment of the present invention.
  • FIG. 2 is a schematic flowchart of a data processing method according to an embodiment of the present invention.
  • FIG. 3 is a schematic flowchart diagram of another data processing method according to an embodiment of the present invention.
  • FIG. 4 is a schematic flowchart of still another data processing method according to an embodiment of the present invention.
  • FIG. 5 is a schematic flowchart diagram of a data processing method according to an embodiment of the present disclosure.
  • FIG. 6 is a schematic flowchart diagram of another data processing method according to an embodiment of the present disclosure.
  • FIG. 7 is a schematic structural diagram of a network card controller according to an embodiment of the present disclosure.
  • FIG. 8 is a schematic structural diagram of another network card controller according to an embodiment of the present disclosure.
  • FIG. 9 is a schematic structural diagram of a network card control device according to an embodiment of the present disclosure.
  • FIG. 10 is a schematic structural diagram of another network card control device according to an embodiment of the present invention.
  • FIG. 1 A system architecture of a multi-core processor system based on a many-core decoupling applied in an embodiment of the present invention is shown in FIG.
  • the many-core decoupling architecture refers to the separation of the hardware in the existing computer to form the hardware network of each management, that is, the hardware in the computer can be decoupled into: computing resource pool, input and output (English: Input/Output, Referred to as IO) device pool, memory pool, connection network and resource management center.
  • the computing resource pool of the multi-core processor system 1 corresponding to FIG. 1 is a plurality of central processing units (CPUs) 11 in FIG. 1 (such as the CPU #1 board in FIG.
  • CPUs central processing units
  • each CPU board 11 includes a CPU resource pool composed of a plurality of CPU cores, and these CPU boards 11 include a plurality of CPU cores, and these CPU cores may It is integrated on one CPU board 11, and can also be integrated on a plurality of CPU boards 11.
  • the IO device pool of the multi-core processor system 1 is the device board in FIG. 1 , and the device board integrates multiple IO devices (for example, a disk, a network card, and a video transmission standard (English: Video Graphics Array, VGA for short) display card. Etc), specifically, the device M physical network cards 12 (such as network card 1 of the first embodiment, network card 2, ..., network card M) are integrated in the board.
  • each board in the multi-core processor system 1 is integrated with a controller (for example, a cloud controller) for controlling hardware resources in the board, for example, for A CPU controller that controls each CPU core in the CPU board 11 and a network card controller 14 that controls the physical network card 12 in the device board.
  • the resource management center 13 of the multi-core processor system 1 controls the allocation and interconnection of hardware resources through controllers in each board, and manages all hardware resources in the multi-core processor system 1.
  • the resource management center 13 selects a part of the CPU core from the CPU board, and selects a piece of memory from the memory pool, from the IO. Select some IO devices on the device board, then connect the selected parts through the controllers in each board and isolate them from other parts to form a complete small computer.
  • the resource management center needs to be involved in the management, so that the resource management center according to the existing device information and The management allocation policy allocates corresponding hardware resources to the operating system, so that the entire NIC resource application step is too long, which causes the network data to be interrupted due to untimely processing of some data packets.
  • the resource management center allocates the network card to the operating system
  • the operating system will invoke the network card device driver and network communication protocol of the network card to implement communication, which requires complete network communication protocol software to manage data such as network communication link status. This makes the entire NIC resource application process steps complicated. Therefore, in order to solve the above problems, embodiments of the present invention provide a new data processing method.
  • an embodiment of the present invention provides a data processing method, which can be performed by the network card controller 14 of FIG. As shown in FIG. 2, the method specifically includes the following steps:
  • the network card controller acquires the first data packet in the queue to be sent.
  • the first data packet is obtained by encapsulating, by the CPU controller, data of a process of an operating system running on the first CPU core, where the first data packet includes a source address and a destination address of the first data packet, and The first data packet required network service
  • the network parameter; the source address of the first data packet is an internal address used by the first data packet in the multi-core processor system; the internal address of the first data packet includes a CPU board identifier (English: Identity, referred to as ID) At least one of an operating system ID or a process number.
  • the first data packet stored in the to-be-sent queue is sent and received by a CPU controller in a CPU board, and the predetermined protocol includes a mail box mailbox protocol.
  • the operating system when the process of the operating system running in the first CPU core needs to send data, the operating system first registers with the mail box protocol, applies for a self-mali box, and is to be sent.
  • the data is placed in the send queue of the mail box, and then the CPU controller encapsulates the data to be sent and encapsulates the first data packet carrying the internal data.
  • the network card controller allocates a network card IP address to the first data packet according to the source address, the destination address, and the network parameter of the network service required by the first data packet.
  • the network parameter of the network service required by the first data packet includes a network segment to which the network service is connected and a bandwidth required by the network service.
  • the destination address mentioned above refers to an Internet Protocol Address (IP address) of the final destination Internet gateway used in the data packet to indicate the transmission of the data packet.
  • IP address Internet Protocol Address
  • the network controller may first select a physical medium that satisfies the network service parameter from the M physical network cards according to the network parameter of the network service required by the first data packet.
  • the network card obtains the network card IP addresses corresponding to the physical network cards that meet the network service parameters, and then the network card controller selects one network card IP address from the network card IP addresses to allocate to the first data packet according to the allocation policy.
  • the allocation policy may be a mapping relationship between a source address, a destination address, and a network card IP address of the data packet, where the mapping relationship may be preset by the network card controller, or the network card controller may be configured according to each physical The history of the network card when transmitting packets is set.
  • the network card controller converts the first data packet into a second data packet.
  • the source address in the second data packet is a network card IP address.
  • the NIC IP address is the external NIC IP address of the multi-core processor system.
  • the network card controller may decapsulate the first data packet, obtain data in the first data packet, and then use the data in the first data packet to
  • the assigned network card IP address is re-encapsulated to become a second data packet that can be sent to the external network; the network card controller can also directly use the network address translation (English: Network Address Translation, NAT) method in the first data packet.
  • the source address is replaced with the NIC IP address and becomes a second data packet that can be sent to the external network.
  • the network card controller sends the second data packet to the external network by using a physical network card corresponding to the network card IP address.
  • the CPU controller on the CPU board controls the operating system on the CPU board to complete initialization, and the operating system in the CPU board receives the network service interface provided by the CPU controller through a predetermined protocol, and receives or receives from the sending/receiving queue corresponding to the predetermined protocol. send data.
  • the NIC controller on the device board is responsible for initializing all the NICs, so that the NIC is in a working state, and then the NIC controller collects all NIC device information, such as NIC hardware information, register settings, and network segment bandwidth.
  • the data processing method provided by the embodiment of the present invention, after the network card controller obtains the first data packet in the queue to be sent, according to the source address, the destination address of the first data packet, and the network parameter of the network service required by the first data packet, A network card IP address is allocated for the first data packet, and then the network card controller converts the first data packet into a second data packet, and sends the second data packet to the external network by using a physical network card corresponding to the network card IP address.
  • the present invention manages all physical network cards and provides network services through the network card controller, and does not require the intervention management of the resource management center, thereby reducing the application procedure of the network card resources and solving the problem that the application process of the entire network card resource is too long.
  • the resulting data packet is interrupted due to untimely processing, and the management load of the CPU board is reduced.
  • the network card controller flexibly allocates the IP address of the network card to the data packet.
  • the data packet is transmitted without being restricted by the network card and the network segment, thereby realizing the multi-core processor system of the multi-core decoupling to process data across the network card and across the network segment.
  • an embodiment of the present invention provides a data processing method. As shown in FIG. 3, the method specifically includes the following steps:
  • the network card controller acquires a first data packet in a queue to be sent.
  • step 301 can be referred to the detailed description in step 201 in the corresponding embodiment of FIG. 2, and details are not described herein again.
  • the network card controller allocates a network card IP address to the first data packet according to the source address, the destination address of the first data packet, and the network parameter of the network service required by the first data packet.
  • step 302 specifically includes the following steps:
  • the network card controller retrieves network parameters of the network service required by the first data packet in the information mapping table.
  • the information mapping table is used to store a history record of data packets sent and received by the network card controller through the M physical network cards, where the history record includes a destination address, a network card IP address, and a source address of the data packet sent and received by the M physical network cards. Correspondence.
  • step 302b1 when the network card controller does not retrieve the history record matching the network parameter in the information mapping table, the process proceeds to step 302b1; when the network card controller retrieves the history record matching the network parameter in the information mapping table, Go to step 302c1.
  • the network card controller If the network card controller does not retrieve the history record matching the network parameter in the information mapping table, the network card controller selects the target physical network card that matches the network parameter from the M physical network cards according to the network parameter.
  • the network card controller allocates the network card IP address corresponding to the target physical network card that matches the network parameter to the first data packet.
  • the network card controller retrieves the history record matching the network parameter in the information mapping table, the network card controller retrieves the destination address of the first data packet in a history record matching the network parameter.
  • the network card controller searches the information mapping table for the history record matching the network segment 1. record.
  • the network card controller does not retrieve the history record matching the network segment 1 in the information mapping table, it indicates that the network segment 1 is the first time to send data, and the network card controller selects the network segment number as the network according to the M physical network cards.
  • the physical network card of the segment 1 is used as the target physical network card, and the IP address of the network card corresponding to the target physical network card is allocated to the first data packet, and the correspondence between the destination address of the first data packet, the IP address of the network card, and the source address is stored.
  • the network card controller retrieves the history record matching the network segment 1 in the information mapping table, the network card controller continues to retrieve the first data in the history record matching the network segment 1 The destination address of the packet (202.108.22.5).
  • step 302c1 when the network card controller retrieves the destination address of the first data packet in the history record matching the network parameter, the process proceeds to step a1; when the network card controller matches the history of the network parameter, If the destination address of the first data packet is retrieved, the process proceeds to step b2.
  • the network card controller If the network card controller retrieves the destination address of the first data packet in the history record matching the network parameter, the network card controller allocates the network card IP address in the history record including the destination address of the first data packet to the first data pack.
  • the network card controller If the network card controller does not retrieve the destination address of the first data packet in the history record matching the network parameter, the network card controller will match the network card IP address in any history record in the history record matching the network parameter. The address is assigned to the first data packet.
  • the network card controller retrieves the destination address (202.108.22.5) of the first data packet in the history record matching the network segment 1, it indicates that the process corresponding to the data stored in the first data packet has been sent to the If the destination address sends data, the network card controller allocates the network card IP address in the history record containing the destination address to the first data packet; if the network card controller does not retrieve the destination in the history record matching the network segment 1 The address indicates that the process corresponding to the data stored in the first data packet has not sent data to the destination address, and the network card controller allocates the network card IP address in any history record in the history record matching the network segment 1. Give the first packet.
  • the network card controller converts the first data packet into a second data packet.
  • the network card controller sends the second data packet to the external network by using a physical network card corresponding to the network card IP address.
  • steps 303 and 304 can be referred to the detailed descriptions in steps 203 and 204 in the corresponding embodiment of FIG. 2, and details are not described herein again.
  • the multi-core processor system applied to the embodiment of the present invention shown in FIG. 4 does not.
  • the resource management center is included.
  • the multi-core processor system includes: N central processing unit CPU boards, that is, CPU#1 board, CPU#2 board, ..., CPU#n board, M physical Network card. If the process X of the operating system running on the first CPU core in the CPU #1 board is taken as an example, and the device board includes three network cards: the network card 1, the network card 2, and the network card 3, the method provided by the embodiment of the present invention
  • the specific implementation process is as follows:
  • Process X corresponds to the process of transmitting data.
  • the process X of the operating system running on the first CPU core in the CPU#1 board When the process X of the operating system running on the first CPU core in the CPU#1 board needs to use the network, it will register its own information on the mail box, and then use the sending interface provided by the mail box to send the data in the mail box. On the queue.
  • the CPU controller encapsulates the data into a first packet with an internal address. If the process has other needs for the network, this information will be included in the first packet of the mail box.
  • the network card controller obtains the first data packet in the queue to be sent, parses the first data packet header, and obtains a source address, a destination address, and a network service parameter of the network service required by the stored process X. And searching according to the network segment 1 that the network service required by the process X needs to be connected in the network service parameter, and searching in the information mapping table. If the network card controller retrieves the history record matching the network segment 1 in the information mapping table, the network card controller continues to retrieve the destination address of the first data packet in the history record matching the network segment 1 (202.108.22.5) ).
  • the network card controller retrieves the destination address in the history record matching the network segment 1, the process X has sent data to the destination address, and the network card controller will include the network card IP address in the history record of the destination address. (233.255.14.151) is assigned to the first packet. Then, the network card controller decapsulates the first data packet, and the source address in the first data packet (ie, the process ID of the process X) 1) Repackage with the assigned NIC IP address (233.255.14.151) to get a second packet with a source address of (233.255.14.151).
  • the network card controller sends the second data packet from the network card port of the physical network card (such as network card 1) corresponding to the network card IP address (233.255.14.151) to the external network.
  • the network card port of the physical network card such as network card 1
  • the network card IP address 233.255.14.151
  • the data processing method provided by the embodiment of the present invention, after the network card controller obtains the first data packet in the queue to be sent, according to the source address, the destination address of the first data packet, and the network parameter of the network service required by the first data packet, A network card IP address is allocated for the first data packet, and then the network card controller converts the first data packet into a second data packet, and sends the second data packet to the external network by using a physical network card corresponding to the network card IP address.
  • the present invention manages all physical network cards and provides network services through the network card controller, and does not require the intervention management of the resource management center, thereby reducing the application procedure of the network card resources and solving the problem that the application process of the entire network card resource is too long.
  • the resulting data packet is interrupted due to untimely processing, and the management load of the CPU board is reduced.
  • the network card controller flexibly allocates the IP address of the network card to the data packet, so that the data packet is not restricted by the network card and the network segment, thereby realizing the multi-core processor system of the multi-core decoupling to process data across the network card and the network segment.
  • an embodiment of the present invention provides a data processing method. As shown in FIG. 5, the method specifically includes the following steps:
  • the network card controller receives the first data packet.
  • the first data packet includes a source address of the first data packet and a network card IP address of a physical network card that receives the first data packet.
  • the network card controller allocates a destination address to the first data packet according to the source address of the first data packet and the network card IP address.
  • the source address in the first data packet is the IP address of the Internet gateway that sends the first data packet;
  • the network card IP address refers to the network card IP address of the physical network card that receives the first data packet;
  • the address is an internal address used by the first data packet in the multi-core processor system, the internal address including an ID of an operating system running in the first CPU core, and an ID of a process processing the second data packet in the operating system to And at least one of the IDs of the CPU boards on which the first CPU core is located.
  • the network card controller may allocate the corresponding destination address to the first data packet according to the allocation policy and the network card IP address and the source address of the first data packet.
  • the allocation policy may be a mapping relationship between a source address, a destination address, and a network card IP address of the data packet, where the mapping relationship may be preset by the network card controller, or the network card controller may be configured according to each physical The history of the network card when transmitting packets is set.
  • the network card controller replaces the network card IP address in the first data packet with the destination address to obtain the second data packet.
  • the network card controller may perform decapsulation on the first data packet, acquire data in the first data packet, and then the first data.
  • the data in the packet is repackaged with the assigned destination address to become a second data packet that can be recognized by the CPU controller; the network card controller can also directly replace the source address in the first data packet with the destination address by using the NAT method.
  • the network card controller forwards the second data packet to the queue to be received, so that the CPU controller instructs the first CPU core corresponding to the destination address of the second data packet to process the second data packet.
  • the second data packet in the to-be-received queue is sent and received by a CPU controller in the CPU board by using a predetermined protocol, and the predetermined protocol includes a mail box mailbox protocol.
  • the to-be-received queue triggers an interrupt, and sends the interrupt to the CPU controller, and the CPU controller instructs the second according to the interrupt.
  • the first CPU core corresponding to the destination address of the data packet processes the second data packet.
  • the waiting queue of the mail box receives the second data packet sent by the network card controller, an interrupt is triggered, and the CPU controller forwards the interrupt to the second data packet.
  • the first CPU core corresponding to the address, thereby waking up the process registered in the first CPU core, and letting the process process the second data pack.
  • the network card controller after receiving the first data packet, allocates a destination address to the first data packet according to the source address of the first data packet and the network card IP address, and then the network card controller will be the first
  • the network card IP address in the data packet is replaced with the destination address to obtain the second data packet, and the network card controller forwards the second data packet to the queue to be received, so that the CPU controller indicates the first CPU corresponding to the destination address of the second data packet.
  • the kernel processes the second packet.
  • the present invention manages all physical network cards and provides network services through the network card controller, and does not require the intervention management of the resource management center, thereby reducing the application procedure of the network card resources and solving the problem that the application process of the entire network card resource is too long.
  • the resulting data packet is interrupted due to untimely processing, and the management load of the CPU board is reduced.
  • the network card controller flexibly allocates the IP address of the network card to the data packet, so that the data packet is not restricted by the network card and the network segment, thereby realizing the multi-core processor system of the multi-core decoupling to process data across the network card and the network segment.
  • an embodiment of the present invention provides a data processing method. As shown in FIG. 6, the method specifically includes the following steps:
  • the network card controller receives the first data packet.
  • step 501 can be referred to the detailed description in step 401 in the corresponding embodiment of FIG. 5, and details are not described herein again.
  • the network card controller allocates a destination address to the first data packet according to the source address of the first data packet and the network card IP address.
  • step 502 specifically includes:
  • the network card controller searches, in the information mapping table, a history record of the physical network card corresponding to the network card IP address of the first data packet.
  • the information mapping table is used to store a history record of data packets sent and received by the network card controller through the M physical network cards, where the history record includes a destination address, a network card IP address, and a source address of the data packet sent and received by the M physical network cards. Correspondence.
  • step 502b1 when the network card controller does not retrieve the history record of the physical network card corresponding to the network card IP address of the first data packet in the information mapping table, go to step 502b1; The card controller retrieves the history of the physical network card corresponding to the network card IP address of the first data packet in the information mapping table, and then proceeds to step 502c1.
  • the network card controller If the network card controller does not retrieve the history record of the physical network card corresponding to the network card IP address of the first data packet in the information mapping table, the network card controller discards the first data packet.
  • the network card controller retrieves the history record of the physical network card corresponding to the network card IP address of the first data packet in the information mapping table, the network card controller retrieves the source address of the first data packet in the retrieved history record.
  • the network card controller if the network card controller does not retrieve the history of the physical network card corresponding to the network card IP address (233.255.14.151) of the first data packet in the information mapping table, the first data packet is not the multi-core processor.
  • the network card controller discards the first data packet; if the network card controller retrieves the history record of the physical network card 1 corresponding to the IP address of the network card in the information mapping table, the network card controller retrieves the physical network card The source address of the first packet is retrieved in the history of 1 (202.108.22.5).
  • step 502c1 when the network card controller retrieves the source address of the first data packet in the retrieved history record, the process proceeds to step a1; when the network card controller does not retrieve the first data packet in the retrieved history record The source address is then transferred to step b1.
  • the network card controller retrieves the source address of the first data packet in the retrieved history record, the network card controller allocates the internal address in the history record including the source address of the first data packet to the first data packet.
  • the network card controller if the network card controller does not retrieve the source address of the first data packet in the retrieved history record, the network card controller records any history record in the history record of the physical network card corresponding to the network card IP address of the first data packet. The internal address in is assigned to the first packet.
  • the network card controller retrieves the source address (202.108.22.5) of the first data packet in the retrieved history record, it indicates that the physical network card 1 has received data sent from the source address before, and the network card control
  • the internal address (such as process ID 1 of process X) in the history record containing the source address is allocated to the first data packet; if the network card controller does not retrieve the source address of the first data packet in the retrieved history record , then explain If the physical network card does not receive the data sent by the source address, the network card controller allocates the internal address in any history record of the physical network card 1 corresponding to the network card IP address (233.255.14.151) of the first data packet. Give the first packet.
  • the network card controller replaces the network card IP address in the first data packet with the destination address to obtain the second data packet.
  • the network card controller forwards the second data packet to the to-be-received queue, so that the CPU controller instructs the first CPU core corresponding to the destination address of the second data packet to process the second data packet.
  • steps 503 and 504 can be referred to the detailed description in the steps 403 and 404 in the corresponding embodiment of FIG. 5, and details are not described herein again.
  • the multi-core processor system applied to the embodiment of the present invention shown in FIG. 4 does not.
  • the resource management center is included.
  • the multi-core processor system includes: N central processing unit CPU boards, that is, CPU#1 board, CPU#2 board, ..., CPU#n board, M physical Network card. If the process X of the operating system running on the first CPU core in the CPU #1 board is taken as an example, and the device board includes three network cards: the network card 1, the network card 2, and the network card 3, the method provided by the embodiment of the present invention
  • the specific implementation process is as follows:
  • the network card controller When the network card controller receives the first data packet from the physical network card 1, the network card controller parses the second data packet header to obtain the source address (202.108.22.5) and the network card of the second data packet. IP address (233.255.14.151). Next, the network card controller retrieves the history record of the physical network card 1 corresponding to the network card IP address in the history record in the information mapping table. If the network card controller retrieves the source address in the retrieved history, the network card controller assigns the internal address (ie, process number 1 of process X) in the history record containing the source address to the first data packet. Then, the network card controller replaces the network card IP address (233.255.14.151) in the first data packet with the process number 1 of the process X by using a NAT method, thereby obtaining a second data packet.
  • IP address 233.255.14.151
  • the network card controller sends the second data packet obtained by the foregoing process to the queue to be received, and the to-be-received queue triggers an interrupt after receiving the second data packet, and Transmitting the interrupt to the CPU controller in the CPU board pointed to by the destination address of the second data packet, so that the CPU controller instructs the process X running on the first CPU core in the CPU board to process the second data packet .
  • the network card controller after receiving the first data packet, allocates a destination address to the first data packet according to the source address of the first data packet and the network card IP address, and then the network card controller will be the first
  • the network card IP address in the data packet is replaced with the destination address to obtain the second data packet, and the network card controller forwards the second data packet to the queue to be received, so that the CPU controller indicates the first CPU corresponding to the destination address of the second data packet.
  • the kernel processes the second packet.
  • the present invention manages all physical network cards and provides network services through the network card controller, and does not require the intervention management of the resource management center, thereby reducing the application procedure of the network card resources and solving the problem that the application process of the entire network card resource is too long.
  • the resulting data packet is interrupted due to untimely processing, and the management load of the CPU board is reduced.
  • the network card controller flexibly allocates the IP address of the network card to the data packet, so that the data packet is not restricted by the network card and the network segment, thereby realizing the multi-core processor system of the multi-core decoupling to process data across the network card and the network segment.
  • the embodiment of the present invention provides a network card controller, which is applied to a multi-core processor system, based on the multi-core processor system corresponding to FIG. 1.
  • the network card controller 6 in the multi-core processor system includes : an acquisition module 61, an allocation module 62, a conversion module 63, and a transmission module 64, wherein:
  • the obtaining module 61 is configured to obtain a first data packet in a queue to be sent, where the first data packet is obtained by encapsulating data of a process of an operating system running on the first CPU core by the CPU controller, where The first data packet includes a source address, a destination address, and a network parameter of the network service required by the first data packet, where the source address of the first data packet is the first data packet in the multi-core processor system The internal address used in .
  • the allocating module 62 is configured to allocate a network card IP address to the first data packet according to the source address, the destination address, and the network parameter of the network service required by the first data packet.
  • the conversion module 63 is configured to convert the first data packet into a second data packet, where the source address in the second data packet is a network card IP address.
  • the sending module 64 is configured to send the second data packet to the external network by using the physical network card corresponding to the network card IP address.
  • the first data packet stored in the to-be-sent queue is sent and received by a CPU controller in a CPU board by using a predetermined protocol.
  • the above predetermined agreement includes a mail box mailbox agreement.
  • the network parameters of the network service required by the first data packet include the network segment to which the network service is connected and the bandwidth required by the network service.
  • the internal address of the first data packet includes at least one of a CPU board identification ID, an operating system ID, or a process number.
  • the foregoing allocation module 62 is specifically configured to:
  • the information mapping table Searching, in the information mapping table, a network parameter of the network service required by the first data packet, where the information mapping table is used to store a history record of the data packet sent and received by the network card controller through the M physical network cards, where the history record includes The correspondence between the destination address of the data packet sent and received by the physical network card, the IP address of the network card, and the source address.
  • the target physical network card matching the network parameter is selected from the M physical network cards according to the network parameter.
  • the network card IP address corresponding to the target physical network card matched with the network parameter is allocated to the first data packet.
  • the allocation module 62 retrieves network parameters of the network service required by the first data packet in the history record in the information mapping table, the allocation module 62 is further configured to:
  • the destination address of the first data packet is retrieved in the history record matching the network parameter.
  • the network card IP address in the history record including the destination address of the first data packet is allocated to the first data packet.
  • the allocation module 62 is further configured to:
  • the network card IP address in any one of the history records matching the network parameter is assigned to the first data. package.
  • the network card controller provided by the embodiment of the present invention, after the network card controller obtains the first data packet in the queue to be sent, according to the source address, the destination address of the first data packet, and the network parameter of the network service required by the first data packet, A network card IP address is allocated for the first data packet, and then the network card controller converts the first data packet into a second data packet, and sends the second data packet to the external network by using a physical network card corresponding to the network card IP address.
  • the present invention manages all physical network cards and provides network services through the network card controller, and does not require the intervention management of the resource management center, thereby reducing the application procedure of the network card resources and solving the problem that the application process of the entire network card resource is too long.
  • the resulting data packet is interrupted due to untimely processing, and the management load of the CPU board is reduced.
  • the network card controller flexibly allocates the IP address of the network card to the data packet, so that the data packet is not restricted by the network card and the network segment, thereby realizing the multi-core processor system of the multi-core decoupling to process data across the network card and the network segment.
  • the embodiment of the present invention provides a network card controller, which is applied to a multi-core processor system, based on the multi-core processor system corresponding to FIG. 1.
  • the network card controller 7 in the multi-core processor system includes a receiving module 71, an allocating module 72, a converting module 73, and a transmitting module 74, wherein:
  • the receiving module 71 is configured to receive the first data packet, where the first data packet includes a source address of the first data packet and a network card IP address of the network card that receives the first data packet.
  • the allocating module 72 is configured to allocate a destination address to the first data packet according to a source address of the first data packet and a network card IP address, where the destination address is an internal address used by the first data packet in the multi-core processor system .
  • the converting module 73 is configured to replace the network card IP address in the first data packet with the destination address to obtain the second data packet.
  • the sending module 74 is configured to forward the second data packet to the queue to be received, so that the CPU controller instructs the first CPU core corresponding to the destination address of the second data packet to process the second data packet.
  • the second data packet in the to-be-received queue is sent and received by a CPU controller in the CPU board by using a predetermined protocol, where the predetermined protocol includes a mail box mailbox protocol.
  • the above destination address includes at least one of an ID of an operating system running in the first CPU core, an ID of a process of processing the second data packet in the operating system, and an ID of a CPU board where the first CPU core is located.
  • the allocating module 72 is specifically configured to:
  • the information mapping table Retrieving, in the information mapping table, a history of the physical network card corresponding to the network card IP address of the first data packet, wherein the information mapping table is used to store a history record of the data packet sent and received by the network card controller through the M physical network cards, the history The record includes the correspondence between the destination address of the data packet transmitted and received by the M physical network cards, the IP address of the network card, and the source address.
  • the source address of the first data packet is retrieved in the retrieved history record.
  • the internal address in the history record containing the source address of the first data packet is allocated to the first data packet.
  • the foregoing allocation module 72 is further configured to:
  • the internal address in any one of the history records of the physical network card corresponding to the network card IP address of the first data packet is assigned to the first A packet of data.
  • the network card controller provided by the embodiment of the present invention, after receiving the first data packet, the network card controller allocates a destination address to the first data packet according to the source address of the first data packet and the network card IP address, and then the network card controller will be the first The IP address of the network card in the data packet is replaced with the destination address, and the second data packet is obtained, and the network card controller forwards the second data packet to be received. Queued so that the CPU controller instructs the first CPU core corresponding to the destination address of the second data packet to process the second data packet.
  • the present invention manages all physical network cards and provides network services through the network card controller, and does not require the intervention management of the resource management center, thereby reducing the application procedure of the network card resources and solving the problem that the application process of the entire network card resource is too long.
  • the resulting data packet is interrupted due to untimely processing, and the management load of the CPU board is reduced.
  • the network card controller flexibly allocates the IP address of the network card to the data packet, so that the data packet is not restricted by the network card and the network segment, thereby realizing the multi-core processor system of the multi-core decoupling to process data across the network card and the network segment.
  • An embodiment of the present invention provides a network card control device, which is applied to a multi-core processor system, based on the multi-core processor system corresponding to FIG. 1.
  • the network card control device 8 in the multi-core processor system includes : communication interface 81 and processor 82, wherein:
  • the processor 82 is configured to obtain, by using the communication interface 81, a first data packet in a queue to be sent, where the first data packet is a CPU controller that encapsulates data of a process of an operating system running on the first CPU core. Obtaining, the first data packet includes a source address, a destination address, and a network parameter of the network service required by the first data packet, where the source address of the first data packet is that the first data packet is The internal address used in a multi-core processor system.
  • the processor 82 is further configured to allocate a network card IP address to the first data packet according to the source address, the destination address, and the network parameter of the network service required by the first data packet.
  • the processor 82 is further configured to convert the first data packet into a second data packet, where the source address in the second data packet is a network card IP address.
  • the processor 82 is further configured to send the second data packet to the external network by using the physical network card corresponding to the network card IP address.
  • the first data packet stored in the to-be-sent queue is sent and received by a CPU controller in a CPU board by using a predetermined protocol.
  • the above predetermined agreement includes a mail box mailbox agreement.
  • the network parameters of the network service required by the first data packet include the network segment to which the network service is connected and the bandwidth required by the network service.
  • the internal address of the first data packet includes at least one of a CPU board identification ID, an operating system ID, or a process number.
  • the network card control device 8 further includes: a memory 83, wherein:
  • the processor 82 is specifically configured to: retrieve, in the information mapping table in the memory 83, a network parameter of a network service required by the first data packet, where the information mapping table is used to store and receive the network card controller through the M physical network cards.
  • the history of the data packet including the destination address of the data packet sent and received by the M physical network cards, the correspondence between the network card IP address and the source address.
  • the target physical network card matching the network parameter is selected from the M physical network cards according to the network parameter.
  • the network card IP address corresponding to the target physical network card matched with the network parameter is allocated to the first data packet.
  • the processor 82 retrieves network parameters of the network service required by the first data packet in the history record in the information mapping table in the memory 83, the processor 82 is further configured to:
  • the destination address of the first data packet is retrieved in the history record matching the network parameter described above.
  • the network card IP address in the history record including the destination address of the first data packet is allocated to the first data packet.
  • the processor 82 retrieves the destination address of the first data packet in the historical record matching the network parameter, the processor 82 is further configured to:
  • the network card IP address in any one of the history records matching the network parameter is assigned to the first data. package.
  • the network card control device provided by the embodiment of the present invention, the network card control device acquires to be sent After the first data packet in the queue, the network card IP address is assigned to the first data packet according to the source address, the destination address, and the network parameter of the network service required by the first data packet, and then the network card control device will The first data packet is converted into a second data packet, and the second data packet is sent to the external network through the physical network card corresponding to the network card IP address.
  • the present invention manages all physical network cards and provides network services through the network card controller, and does not require the intervention management of the resource management center, thereby reducing the application procedure of the network card resources and solving the problem that the application process of the entire network card resource is too long.
  • the resulting data packet is interrupted due to untimely processing, and the management load of the CPU board is reduced.
  • the network card controller flexibly allocates the IP address of the network card to the data packet, so that the data packet is not restricted by the network card and the network segment, thereby realizing the multi-core processor system of the multi-core decoupling to process data across the network card and the network segment.
  • An embodiment of the present invention provides a network card control device, which is applied to a multi-core processor system, based on the multi-core processor system corresponding to FIG. 1.
  • the network card control device 9 in the multi-core processor system includes : communication interface 91 and processor 92, wherein:
  • the processor 92 is configured to receive the first data packet by using the communication interface 91, where the first data packet includes a source address of the first data packet and a network card IP address of a physical network card that receives the first data packet.
  • the processor 92 is further configured to allocate a destination address to the first data packet according to a source address of the first data packet and a network card IP address, where the destination address is an internal part of the first data packet used in the multi-core processor system. address.
  • the processor 92 is further configured to replace the network card IP address in the first data packet with the destination address to obtain the second data packet.
  • the processor 92 is further configured to forward the second data packet to the queue to be received through the communication interface 91, so that the CPU controller instructs the first CPU core corresponding to the destination address of the second data packet to process the second data packet.
  • the second data packet in the to-be-received queue is sent and received by a CPU controller in the CPU board by using a predetermined protocol, where the predetermined protocol includes a mail box mailbox protocol.
  • the above destination address includes at least one of an ID of an operating system running in the first CPU core, an ID of a process of processing the second data packet in the operating system, and an ID of a CPU board where the first CPU core is located.
  • the network card control device 9 further includes: a memory 93, wherein:
  • the processor 92 is specifically configured to: in the information mapping table in the memory 93, retrieve a history record of the physical network card corresponding to the network card IP address of the first data packet, where the information mapping table is used to store the network card controller through the M physical The history record of the data packet sent and received by the network card, and the history record includes the correspondence between the destination address of the data packet sent and received by the M physical network cards, the IP address of the network card, and the source address.
  • the source address of the first data packet is retrieved in the retrieved history record.
  • the internal address in the history record containing the source address of the first data packet is allocated to the first data packet.
  • processor 92 is further configured to:
  • the internal address in any one of the history records of the physical network card corresponding to the network card IP address of the first data packet is assigned to the first A packet of data.
  • the network card control device provided by the embodiment of the present invention, after receiving the first data packet, the network card control device allocates a destination address to the first data packet according to the source address of the first data packet and the network card IP address, and then the network card control device is first.
  • the network card IP address in the data packet is replaced with the destination address to obtain the second data packet, and the network card control device forwards the second data packet to the to-be-received queue, so that the CPU controller indicates the first CPU corresponding to the destination address of the second data packet.
  • the kernel processes the second packet.
  • the present invention manages all physical network cards and provides network services through the network card controller, and does not require the intervention management of the resource management center, thereby reducing the application procedure of the network card resources and solving the problem that the application process of the entire network card resource is too long.
  • the resulting data packet is interrupted due to untimely processing, and the management load of the CPU board is reduced.
  • the network card The controller flexibly allocates the IP address of the network card to the data packet, so that the data packet is not restricted by the network card and the network segment, thereby realizing the multi-core processor system of the multi-core decoupling to process data across the network card and across the network segment.
  • the disclosed apparatus and method may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the modules or units is only a logical function division.
  • there may be another division manner for example, multiple units or components may be used. Combinations can be integrated into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit. It should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, and are not limited thereto.

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明提供的一种数据处理方法及多核处理器***,涉及多核处理器领域,解决了现有技术中由于网卡资源申请步骤过长,而造成的部分数据包由于处理不及时所导致的网络数据中断的问题。该方法具体包括:网卡控制器获取待发送队列中的第一数据包(201),网卡控制器根据第一数据包的源地址、目的地址以及该第一数据包所需网络服务的网络参数,为该第一数据包分配网卡互联网协议(IP)地址(202),网卡控制器将第一数据包转换为第二数据包(203),网卡控制器通过网卡IP地址对应的物理网卡将第二数据包发送至外部网络(204)。本发明应用于多核处理器***。

Description

一种数据处理方法及多核处理器*** 技术领域
本发明涉及多核处理器领域,尤其涉及一种数据处理方法及多核处理器***。
背景技术
目前,为了提高多核处理器的并行计算能力以及该多核处理器的性能,技术人员提出了众核解耦的概念,即通过将多核计算机***中的内存、输入输出(英文:Input/Output,简称IO)设备等硬件设备的解耦,形成各自管理硬件的网络,从而使得该多核计算机***的高性能计算能力得到有效的提高。
现在常用的一种典型的基于众核解耦的多核处理器***,是由集成有多个中央处理器(英文:Central Processing Unit,简称CPU)的CPU板、集成了各种IO设备的设备板、以及用于管理该***中的所有硬件资源的资源管理中心等分离部件组成。其中,上述的CPU板上通常接入多个CPU(上千个CPU内核(core)),可以同时运行多个操作***(英文:Operating System,简称OS),而上述设备板中集成的IO设备中包括网卡,磁盘等。现有技术中,在该众核解耦架构下,当CPU板上的操作***需要网卡提供网络服务时,该操作***会向资源管理中心发送网卡分配请求,资源管理中心在接收到网卡分配请求后,会根据现有的设备信息和管理分配策略,从空闲的网卡中选择相应的网卡分配给运行该操作***的CPU内核,并将该CPU内核与该分配的网卡绑定,然后,设备板中的控制器会控制该分配的网卡与该CPU内核对应的CPU控制器建立一个用于转发数据的IO通道。
但是,发明人发现,在众核解耦架构中,资源管理中心在为操作***配置对应的网卡后,该操作***便无法察觉到外部的其他网卡,这样运行该操作***的CPU内核便只能处理与之绑定的网卡对 应网段的数据,而与该CPU内核绑定的网卡便也无法处理其他CPU内核中的数据。同时,CPU板上运行的操作***向资源管理中心申请网卡时,由于需要资源管理中心介入管理,使得整个网卡资源申请步骤过长,从而造成部分数据包处理不及时,进而导致网络数据的中断。
发明内容
本发明的实施例提供一种数据处理方法及多核处理器***,解决了现有技术中基于众核解耦的多核处理器***无法跨网卡、跨网段处理数据,以及由于网卡资源申请步骤过长,而造成的部分数据包由于处理不及时所导致的网络数据中断的问题。
为达到上述目的,本发明的实施例采用如下技术方案:
第一方面,提供一种数据处理方法,应用于多核处理器***,所述多核处理器***包括设备板和中央处理器CPU板,所述CPU板中包括多个CPU内核和一个用于管理所述CPU板中CPU内核的CPU控制器,其中,在所述多个CPU内核的第一CPU内核中运行有操作***,所述设备板中包括M个物理网卡和用于管理所述M个物理网卡的网卡控制器,所述方法包括:
所述网卡控制器获取待发送队列中的第一数据包,其中,所述第一数据包是所述CPU控制器对运行在所述第一CPU内核上的操作***的进程的数据进行封装得到的,所述第一数据包包括所述第一数据包的源地址、目的地址以及所述第一数据包所需网络服务的网络参数,所述第一数据包的源地址为所述第一数据包在所述多核处理器***中使用的内部地址;
根据所述第一数据包的源地址、目的地址以及所述第一数据包所需网络服务的网络参数,为所述第一数据包分配网卡IP地址;
将所述第一数据包转换为第二数据包,其中,所述第二数据包中的源地址为所述网卡IP地址;
通过所述网卡IP地址对应的物理网卡将所述第二数据包发送至外部网络。
在第一方面的第一种可能的实现方式中,所述待发送队列中存储的第一数据包是所述CPU板中的CPU控制器通过预定协议来进行收发的;
所述预定协议包括mail box邮箱协议;
所述第一数据包所需网络服务的网络参数包括所述网络服务连接的网段和所述网络服务所需的带宽;
所述第一数据包的内部地址包括所述CPU板标识ID、所述操作***ID或所述的进程号中的至少一个。
结合第一方面或第一方面的第一种可能的实现方式,在第一方面的第二种可能的实现方式中,所述根据所述第一数据包的源地址和目的地址以及所述第一数据包所需网络服务的网络参数,为所述第一数据包分配网卡IP地址具体包括:
在信息映射表中检索所述第一数据包所需网络服务的网络参数,其中,所述信息映射表用于存储所述网卡控制器通过所述M个物理网卡收发的数据包的历史记录,所述历史记录包括通过所述M个物理网卡收发的数据包的目的地址、网卡IP地址及源地址间的对应关系;
若在所述信息映射表中未检索到与所述网络参数相匹配的历史记录,则根据所述网络参数从所述M个物理网卡中,选择与所述网络参数相匹配的目标物理网卡;
将所述与所述网络参数相匹配的目标物理网卡对应的网卡IP地址分配给所述第一数据包。
结合第一方面或第一方面的第二种可能的实现方式,在第一方面的第三种可能的实现方式中,所述将所述第一数据包所需网络服务的网络参数与网卡数据库中的信息映射表中的历史记录进行匹配之后,所述方法还包括:
若在所述信息映射表中检索到与所述网络参数相匹配的历史记录,则在所述与所述网络参数相匹配的历史记录中检索所述第一数据包的目的地址;
若在所述与所述网络参数相匹配的历史记录中检索到所述第一数据包的目的地址,则将所述包含所述第一数据包的目的地址的历史记录中的网卡IP地址分配给所述第一数据包。
结合第一方面或第一方面的第三种可能的实现方式,在第一方面的第四种可能的实现方式中,所述根据所述第一数据包的目的地址,检索所述与所述第一数据包所需网络服务的网络参数相匹配的历史记录之后,所述方法还包括:
若在所述与所述网络参数相匹配的历史记录中未检索到所述第一数据包的目的地址,则将与所述网络参数相匹配的历史记录中的任一条历史记录中的网卡IP地址分配给所述第一数据包。
第二方面,提供一种数据处理方法,应用于多核处理器***,所述多核处理器***包括设备板和中央处理器CPU板,所述CPU板中包括多个CPU内核和一个用于管理所述CPU板中CPU内核的CPU控制器,其中,在所述多个CPU内核的第一CPU内核中运行有操作***,所述设备板中包括M个物理网卡和用于管理所述M个物理网卡的网卡控制器,所述方法包括:
所述网卡控制器接收第一数据包,其中,所述第一数据包包括所述第一数据包的源地址和接收所述第一数据包的物理网卡的网卡IP地址;
根据所述第一数据包的源地址和所述网卡IP地址,为所述第一数据包分配目的地址,其中,所述目的地址为所述第一数据包在所述多核处理器***中使用的内部地址;
将所述第一数据包中的所述网卡IP地址替换为所述目的地址,以得到第二数据包;
将所述第二数据包转发至待接收队列,以便CPU控制器指示所述第二数据包的目的地址对应的第一CPU内核处理所述第二数据包。
在第二方面的第一种可能的实现方式中,所述待接收队列中的第二数据包是所述CPU板中的CPU控制器通过预定协议进行收发 的,所述预定协议包括mail box邮箱协议;
所述目的地址包括在所述第一CPU内核中运行的操作***的ID、所述操作***中处理所述第二数据包的进程的ID以及所述第一CPU内核所在的CPU板的ID中的至少一个。
结合第二方面或第二方面的第一种可能的实现方式,在第二方面的第二种可能的实现方式中,所述根据所述第一数据包的源地址和网卡IP地址,为所述第一数据包分配目的地址具体包括:
在信息映射表中检索所述第一数据包的网卡IP地址对应的物理网卡的历史记录,其中,所述信息映射表用于存储所述网卡控制器通过所述M个物理网卡收发的数据包的历史记录,所述历史记录包括通过所述M个物理网卡收发的数据包的目的地址、网卡IP地址及源地址间的对应关系;
若在所述信息映射表中检索到所述第一数据包的网卡IP地址对应的物理网卡的历史记录,则在检索到的历史记录中检索所述第一数据包的源地址;
若在所述检索到的历史记录中检索到所述第一数据包的源地址,则将包含所述第一数据包的源地址的历史记录中的内部地址分配给所述第一数据包。
结合第二方面或第二方面的第二种可能的实现方式,在第二方面的第三种可能的实现方式中,所述方法还包括:
若在所述检索到的历史记录中未检索到所述第一数据包的源地址,则将所述第一数据包的网卡IP地址对应的物理网卡的历史记录中的任一条历史记录中的内部地址分配给所述第一数据包。
第三方面,提供一种网卡控制器,应用于多核处理器***,所述多核处理器***包括设备板和中央处理器CPU板,所述CPU板中包括多个CPU内核和一个用于管理所述CPU板中CPU内核的CPU控制器,其中,在所述多个CPU内核的第一CPU内核中运行有操作***,所述设备板中包括M个物理网卡和用于管理所述M个物理网卡的网卡控制器,所述网卡控制器包括:
获取模块,用于获取待发送队列中的第一数据包,其中,所述第一数据包是所述CPU控制器对运行在所述第一CPU内核上的操作***的进程的数据进行封装得到的,所述第一数据包包括所述第一数据包的源地址、目的地址以及所述第一数据包所需网络服务的网络参数,所述第一数据包的源地址为所述第一数据包在所述多核处理器***中使用的内部地址;
分配模块,用于根据所述第一数据包的源地址、目的地址以及所述第一数据包所需网络服务的网络参数,为所述第一数据包分配网卡IP地址;
转换模块,用于将所述第一数据包转换为第二数据包,其中,所述第二数据包中的源地址为所述网卡IP地址;
发送模块,用于通过所述网卡IP地址对应的物理网卡将所述第二数据包发送至外部网络。
在第三方面的第一种可能的实现方式中,所述待发送队列中存储的第一数据包是所述CPU板中的CPU控制器通过预定协议来进行收发的;
所述预定协议包括mail box邮箱协议;
所述第一数据包所需网络服务的网络参数包括所述网络服务连接的网段和所述网络服务所需的带宽;
所述第一数据包的内部地址包括所述CPU板标识ID、所述操作***ID或所述的进程号中的至少一个。
结合第三方面或第三方面的第一种可能的实现方式,在第三方面的第二种可能的实现方式中,所述分配模块具体用于:
在信息映射表中检索所述第一数据包所需网络服务的网络参数,其中,所述信息映射表用于存储所述网卡控制器通过所述M个物理网卡收发的数据包的历史记录,所述历史记录包括所述通过所述M个物理网卡收发的数据包的目的地址、网卡IP地址及源地址间的对应关系;
若在所述信息映射表中未检索到与所述网络参数相匹配的历史 记录,则根据所述网络参数从所述M个物理网卡中,选择与所述网络参数相匹配的目标物理网卡;
将所述与所述网络参数相匹配的目标物理网卡对应的网卡IP地址分配给所述第一数据包。
结合第三方面或第三方面的第二种可能的实现方式,在第三方面的第三种可能的实现方式中,所述分配模块在信息映射表中的历史记录中检索所述第一数据包所需网络服务的网络参数之后,还用于:
若在所述信息映射表中检索到与所述网络参数相匹配的历史记录,则在所述与所述网络参数相匹配的历史记录中检索所述第一数据包的目的地址;
若在所述与所述网络参数相匹配的历史记录中检索到所述第一数据包的目的地址,则将所述包含所述第一数据包的目的地址的历史记录中的网卡IP地址分配给所述第一数据包。
结合第三方面或第三方面的第三种可能的实现方式,在第三方面的第四种可能的实现方式中,所述分配模块在所述与所述网络参数相匹配的历史记录中检索所述第一数据包的目的地址之后,还用于:
若在所述与所述网络参数相匹配的历史记录中未检索到所述第一数据包的目的地址,则将与所述网络参数相匹配的历史记录中的任一条历史记录中的网卡IP地址分配给所述第一数据包。
第四方面,提供一种网卡控制器,应用于多核处理器***,所述多核处理器***包括设备板和中央处理器CPU板,所述CPU板中包括多个CPU内核和一个用于管理所述CPU板中CPU内核的CPU控制器,其中,在所述多个CPU内核的第一CPU内核中运行有操作***,所述设备板中包括M个物理网卡和用于管理所述M个物理网卡的网卡控制器,所述网卡控制器,包括:
接收模块,用于接收第一数据包,其中,所述第一数据包包括所述第一数据包的源地址和接收所述第一数据包的网卡的网卡IP地 址;
分配模块,用于根据所述第一数据包的源地址和所述网卡IP地址,为所述第一数据包分配目的地址,其中,所述目的地址为所述第一数据包在所述多核处理器***中使用的内部地址;
转换模块,用于将所述第一数据包中的网卡IP地址替换为所述目的地址,以得到第二数据包;
发送模块,用于将所述第二数据包转发至待接收队列,以便CPU控制器指示所述第二数据包的目的地址对应的第一CPU内核处理所述第二数据包。
在第四方面的第一种可能的实现方式中,所述待接收队列中的第二数据包是所述CPU板中的CPU控制器通过预定协议进行收发的,所述预定协议包括mail box邮箱协议;
所述目的地址包括在所述第一CPU内核中运行的操作***的ID、所述操作***中处理所述第二数据包的进程的ID以及所述第一CPU内核所在的CPU板的ID中的至少一个。
结合第四方面或第四方面的第一种可能的实现方式,在第四方面的第二种可能的实现方式中,所述分配模块具体用于:
在信息映射表中检索所述第一数据包的网卡IP地址对应的物理网卡的历史记录,其中,所述信息映射表用于存储所述网卡控制器通过所述M个物理网卡收发的数据包的历史记录,所述历史记录包括所述通过所述M个物理网卡收发的数据包的目的地址、网卡IP地址及源地址间的对应关系;
若在所述信息映射表中检索到所述第一数据包的网卡IP地址对应的物理网卡的历史记录,则在检索到的历史记录中检索所述第一数据包的源地址;
若在所述检索到的历史记录中检索到所述第一数据包的源地址,则将包含所述第一数据包的源地址的历史记录中的内部地址分配给所述第一数据包。
结合第四方面或第四方面的第二种可能的实现方式,在第四方 面的第三种可能的实现方式中,所述分配模块还用于:
若在所述检索到的历史记录中未检索到所述第一数据包的源地址,则将所述第一数据包的网卡IP地址对应的物理网卡的历史记录中的任一条历史记录中的内部地址分配给所述第一数据包。
本发明实施例提供的数据处理方法,网卡控制器获取待发送队列中的第一数据包后,根据该第一数据包的源地址、目的地址以及第一数据包所需网络服务的网络参数,为该第一数据包分配网卡IP地址,然后网卡控制器将第一数据包转换为第二数据包,并通过网卡IP地址对应的物理网卡将第二数据包发送至外部网络;或者,网卡控制器接收第一数据包后,根据该第一数据包的源地址和网卡IP地址为该第一数据包分配目的地址,然后网卡控制器将第一数据包中的网卡IP地址替换为目的地址,以得到第二数据包,网卡控制器将第二数据包转发至待接收队列,以便CPU控制器指示第二数据包的目的地址对应的第一CPU内核处理该第二数据包。相比现有技术,本发明通过网卡控制器管理所有物理网卡并提供网络服务,不需要资源管理中心的介入管理,从而减少了网卡资源的申请步骤,解决了由于整个网卡资源申请步骤过长,造成的部分数据包由于处理不及时,而导致的网络数据中断的问题,并降低了CPU板的管理负载。同时,网卡控制器通过为数据包灵活的分配网卡IP地址,使得数据包不受网卡、网段的限制进行发送,从而实现了众核解耦的多核处理器***跨网卡、跨网段处理数据。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例的附图。
图1为本发明的实施例提供的一种多核处理器***的结构示意图;
图2为本发明的实施例提供的一种数据处理方法的流程示意图;
图3为本发明的实施例提供的另一种数据处理方法的流程示意图;
图4为本发明的实施例提供的又一种数据处理方法的流程示意图;
图5为本发明实施例提供的一种数据处理方法的流程示意图;
图6为本发明实施例提供的另一种数据处理方法的流程示意图;
图7为本发明实施例提供的一种网卡控制器的结构示意图;
图8为本发明实施例提供的另一种网卡控制器的结构示意图;
图9为本发明实施例提供的一种网卡控制设备的结构示意图;
图10为本发明实施例提供的另一种网卡控制设备的结构示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。
本发明的实施例所应用的基于众核解耦的多核处理器***的***架构如图1所示。其中,众核解耦构架是指将现有的计算机中的硬件分离,形成各自管理的硬件网络,即可以将计算机中的硬件解耦为:计算资源池、输入输出(英文:Input/Output,简称IO)设备池、内存池、连接网络和资源管理中心等部分。具体的,图1对应的多核处理器***1的计算资源池,即图1中的多个中央处理器(英文:Central Processing Unit,简称CPU)板11(如图1中的CPU#1板、CPU#2板,......,CPU#n板,每个CPU板11中包括多个CPU core)组成的CPU资源池,这些CPU板11内包含多个CPU core,这些CPU core可以集成在一个CPU板11上,也可以集成在多个CPU板11上。该多核处理器***1的IO设备池即图1中的设备板,该设备板中集成有多个IO设备(如,磁盘,网卡、视频传输标准(英文:Video Graphics Array,简称VGA)显示卡等),具体的,该设备 板中集成有M个物理网卡12(如图1的网卡1,网卡2......,网卡M)。需要说明的是,该多核处理器***1中的每个板上都集成有一个用于控制该板中硬件资源的控制器(如,云控制芯片(英文:cloud controller)),例如,用于控制CPU板11中各CPU core的CPU控制器以及用于控制设备板中物理网卡12的网卡控制器14。而该多核处理器***1的资源管理中心13则通过各个板中的控制器来控制硬件资源的分配及互联,管理该多核处理器***1中的所有硬件资源。
在现有技术中,当该多核处理器***1中的某个运行的操作***提出网络服务请求时,资源管理中心13会从CPU板上选择一部分CPU core,从内存池上选择一段内存,从IO设备板上选择一些IO设备,然后通过各个板中的控制器将选定的部分连接起来,并与其它部分相互隔离,即形成一台完备的小型计算机。即CPU板在根据该CPU板中的CPU内核上运行的操作***的网络服务需求向资源管理中心申请相应的网卡设备时,需要资源管理中心介入管理,使得资源管理中心根据现有的设备信息和管理分配策略,为该操作***分配相应的硬件资源,从而使得整个网卡资源申请步骤过长,进而造成了部分数据包由于处理不及时,而导致的网络数据中断的问题。同时资源管理中心在为该操作***分配好网卡后,该操作***会调用该网卡的网卡设备驱动和网络通信协议来实现通信,这需要有完整的网络通信协议软件来管理网络通信链接状态等数据,这样使得整个网卡资源申请过程步骤繁多复杂。因此,为了解决上述问题,本发明的实施例提供了一种新的数据处理方法。
基于图1对应的多核处理器***,本发明的实施例提供一种数据处理方法,该方法可以由图1的网卡控制器14来执行。如图2所示,该方法具体包括如下步骤:
201、网卡控制器获取待发送队列中的第一数据包。
其中,上述的第一数据包是CPU控制器对运行在第一CPU内核上的操作***的进程的数据进行封装得到的,该第一数据包包括该第一数据包的源地址、目的地址以及该第一数据包所需网络服务 的网络参数;上述的第一数据包的源地址为该第一数据包在多核处理器***中使用的内部地址;该第一数据包的内部地址包括CPU板标识(英文:Identity,简称ID)、操作***ID或进程号中的至少一个。
具体的,上述的待发送队列中存储的第一数据包是CPU板中的CPU控制器通过预定协议收发的,该预定协议包括mail box邮箱协议。
示例性的,以mail box协议为例,当第一CPU内核中运行的操作***的进程需要发送数据时,该操作***会先向mail box协议注册,申请一个自己的mali box,并将待发送的数据放到mail box的发送队列中,然后CPU控制器会将该待发送的数据进行封装,封装成携带有内部数据的第一数据包。
202、网卡控制器根据第一数据包的源地址、目的地址以及该第一数据包所需网络服务的网络参数,为该第一数据包分配网卡IP地址。
其中,上述的第一数据包所需网络服务的网络参数包括该网络服务连接的网段和该网络服务所需的带宽。上述的目的地址是指数据包中用于指明该数据包发送的最终目的互联网网关的互联网协议地址(英文:Internet Protocol Address,简称IP地址)。
具体的,网卡控制器在为第一数据包分配网卡IP地址时,可以先根据该第一数据包所需网络服务的网络参数,从M个物理网卡中选出可以满足该网络服务参数的物理网卡,并获取这些满足该网络服务参数的物理网卡对应的网卡IP地址,然后,该网卡控制器根据分配策略从这些网卡IP地址中选择一个网卡IP地址分配给该第一数据包。示例性的,该分配策略可以是数据包的源地址、目的地址和网卡IP地址间的映射关系,该映射关系可以是网卡控制器预先设定的,也可以是该网卡控制器根据每个物理网卡传输数据包时的历史记录进行设置的。
203、网卡控制器将第一数据包转换为第二数据包。
其中,上述的第二数据包中的源地址为网卡IP地址。该网卡IP地址是该多核处理器***对外的网卡IP地址。
具体的,网卡控制器为了将该第一数据包发送至外部网络,可以将该第一数据包进行解封,获取该第一数据包中的数据,然后将该第一数据包中的数据与分配的网卡IP地址重新封装,成为一个可以向外部网络发送的第二数据包;网卡控制器也可以利用网络地址转换(英文:Network Address Translation,简称NAT)的方法直接将第一数据包中的源地址替换为网卡IP地址,成为一个可以向外部网络发送的第二数据包。
204、网卡控制器通过网卡IP地址对应的物理网卡将第二数据包发送至外部网络。
需要说明的是,在实现本实施例中描述的过程之前,还需要对CPU板和设备板进行初始化。
具体的,CPU板上的CPU控制器控制CPU板上的操作***完成初始化,CPU板中的操作***通过预定协议来使用CPU控制器提供的网络服务接口,从该预定协议对应的收发队列接收或发送数据。而设备板上的网卡控制器负责初始化所有的网卡,使网卡处于待工作状态,然后该网卡控制器收集所有的网卡设备信息,例如,网卡硬件信息、寄存器设置和网段带宽等。
本发明实施例提供的数据处理方法,网卡控制器获取待发送队列中的第一数据包后,根据该第一数据包的源地址、目的地址以及第一数据包所需网络服务的网络参数,为该第一数据包分配网卡IP地址,然后网卡控制器将第一数据包转换为第二数据包,并通过网卡IP地址对应的物理网卡将第二数据包发送至外部网络。相比现有技术,本发明通过网卡控制器管理所有物理网卡并提供网络服务,不需要资源管理中心的介入管理,从而减少了网卡资源的申请步骤,解决了由于整个网卡资源申请步骤过长,造成的部分数据包由于处理不及时,而导致的网络数据中断的问题,并降低了CPU板的管理负载。同时,网卡控制器通过为数据包灵活的分配网卡IP地址,使 得数据包不受网卡、网段的限制进行发送,从而实现了众核解耦的多核处理器***跨网卡、跨网段处理数据。
基于图1对应的多核处理器***,本发明的实施例提供一种数据处理方法,如图3所示,该方法具体包括如下步骤:
301、网卡控制器获取待发送队列中的第一数据包。
具体的,步骤301的描述可以参照图2对应实施例中的步骤201中的详细描述,这里不再赘述。
302、网卡控制器根据第一数据包的源地址、目的地址以及该第一数据包所需网络服务的网络参数,为该第一数据包分配网卡IP地址。
可选的,步骤302具体包括如下步骤:
302a、网卡控制器在信息映射表中检索第一数据包所需网络服务的网络参数。
其中,上述的信息映射表用于存储网卡控制器通过M个物理网卡收发的数据包的历史记录,该历史记录包括通过M个物理网卡收发的数据包的目的地址、网卡IP地址及源地址间的对应关系。
具体的,当网卡控制器在信息映射表中未检索到与网络参数相匹配的历史记录,则转向步骤302b1;当网卡控制器在信息映射表中检索到与网络参数相匹配的历史记录,则转向步骤302c1。
302b1、若网卡控制器在信息映射表中未检索到与网络参数相匹配的历史记录,则网卡控制器根据网络参数从M个物理网卡中,选择与该网络参数相匹配的目标物理网卡。
302b2、网卡控制器将与网络参数相匹配的目标物理网卡对应的网卡IP地址分配给第一数据包。
302c1、若网卡控制器在信息映射表中检索到与网络参数相匹配的历史记录,则网卡控制器在与网络参数相匹配的历史记录中检索第一数据包的目的地址。
示例性的,若第一数据包所需网络服务需要连接的网段是网段1,则网卡控制器在信息映射表中检索与该网段1相匹配的历史记 录。当网卡控制器在信息映射表中未检索到与网段1相匹配的历史记录,则说明网段1是第一次发送数据,网卡控制器根据M个物理网卡中选出网段号为网段1的物理网卡作为目标物理网卡,并将该目标物理网卡对应的网卡IP地址分配给第一数据包,将该第一数据包的目的地址、网卡IP地址及源地址间的对应关系存入信息映射表中的历史记录中;当网卡控制器在信息映射表中检索到了与网段1相匹配的历史记录,则网卡控制器在与网段1相匹配的历史记录中继续检索第一数据包的目的地址(202.108.22.5)。
进一步的,基于步骤302c1,当网卡控制器在与网络参数相匹配的历史记录中检索到第一数据包的目的地址,则转向步骤a1;当网卡控制器在与网络参数相匹配的历史记录未检索到第一数据包的目的地址,则转向步骤b2。
a1、若网卡控制器在与网络参数相匹配的历史记录中检索到第一数据包的目的地址,则网卡控制器将包含第一数据包目的地址的历史记录中的网卡IP地址分配给第一数据包。
b1、若网卡控制器在与网络参数相匹配的历史记录中未检索到第一数据包的目的地址,则网卡控制器将与网络参数相匹配的历史记录中的任一条历史记录中的网卡IP地址分配给第一数据包。
示例性的,若网卡控制器在与网段1相匹配的历史记录中检索到第一数据包的目的地址(202.108.22.5),则说明第一数据包中所存的数据对应的进程已经向该目的地址发送过数据,则网卡控制器将包含该目的地址的历史记录中的网卡IP地址分配给第一数据包;若网卡控制器在与网段1相匹配的历史记录中未检索到该目的地址,则说明第一数据包中所存的数据对应的进程没有向该目的地址发送过数据,则网卡控制器将与网段1相匹配的历史记录中的任一条历史记录中的网卡IP地址分配给第一数据包。
303、网卡控制器将第一数据包转换为第二数据包。
304、网卡控制器通过网卡IP地址对应的物理网卡将第二数据包发送至外部网络。
具体的,步骤303、304的描述可以参照图2对应实施例中的步骤203、204中的详细描述,这里不再赘述.
示例性的,由于本发明实施例不需要借助资源管理中心的管理功能,便可实现网卡的分配和数据的处理,因此,参照图4所示本发明的实施例所应用的多核处理器***不包含资源管理中心,具体的,该多核处理器***中包括:N个中央处理器CPU板,即CPU#1板、CPU#2板,......,CPU#n板、M个物理网卡。若以CPU#1板中的第一CPU内核上运行的操作***的进程X为例,且设备板中包含3个网卡:网卡1、网卡2、网卡3时,本发明实施例所提供的方法具体实现过程如下:
(1)、CPU板和设备板进行初始化,具体过程参照图1对应实施例中的描述。
(2)、进程X对应数据的发送过程。
当CPU#1板中的第一CPU内核上运行的操作***的进程X需要使用网络时,会在mail box上注册自己的信息,然后使用mail box提供的发送接口将数据放在mail box的发送队列上。CPU控制器对数据进行封装,成为带有内部地址的第一数据包。如果该进程对于网络有其他需求时,mail box的第一数据包里会附带这些信息。
网卡控制器获取待发送队列中的第一数据包,对该第一数据包包头进行解析,获取该第一数据包的源地址、目的地址以及存储的进程X所需网络服务的网络服务参数,并根据该网络服务参数中该进程X所需网络服务需要连接的网段1,在信息映射表中进行检索。若网卡控制器在该信息映射表中检索到与网段1相匹配的历史记录,则网卡控制器继续在与网段1相匹配的历史记录中检索第一数据包的目的地址(202.108.22.5)。若网卡控制器在与网段1相匹配的历史记录中检索到了该目的地址,则说明进程X已经向该目的地址发送过数据,网卡控制器将包含该目的地址的历史记录中的网卡IP地址(233.255.14.151)分配给第一数据包。然后,网卡控制器将第一数据包解封,将该第一数据包中的源地址(即进程X的进程号 1)替换为分配的网卡IP地址(233.255.14.151)重新封装,从而得到一个源地址为(233.255.14.151)的第二数据包。
最后,网卡控制器将该第二数据包从网卡IP地址(233.255.14.151)对应的物理网卡(如网卡1)的网卡端口发送至外部网络。
本发明实施例提供的数据处理方法,网卡控制器获取待发送队列中的第一数据包后,根据该第一数据包的源地址、目的地址以及第一数据包所需网络服务的网络参数,为该第一数据包分配网卡IP地址,然后网卡控制器将第一数据包转换为第二数据包,并通过网卡IP地址对应的物理网卡将第二数据包发送至外部网络。相比现有技术,本发明通过网卡控制器管理所有物理网卡并提供网络服务,不需要资源管理中心的介入管理,从而减少了网卡资源的申请步骤,解决了由于整个网卡资源申请步骤过长,造成的部分数据包由于处理不及时,而导致的网络数据中断的问题,并降低了CPU板的管理负载。同时,网卡控制器通过为数据包灵活的分配网卡IP地址,使得数据包不受网卡、网段的限制进行发送,从而实现了众核解耦的多核处理器***跨网卡、跨网段处理数据。
基于图1对应的多核处理器***,本发明的实施例提供一种数据处理方法,如图5所示,该方法具体包括如下步骤:
401、网卡控制器接收第一数据包。
其中,上述的第一数据包包括该第一数据包的源地址和接收该第一数据包的物理网卡的网卡IP地址。
402、网卡控制器根据第一数据包的源地址和网卡IP地址,为该第一数据包分配目的地址。
其中,上述的第一数据包中的源地址是发送该第一数据包的互联网网关的IP地址;上述的网卡IP地址是指接收该第一数据包的物理网卡的网卡IP地址;上述的目的地址为该第一数据包在多核处理器***中使用的内部地址,该内部地址包括在第一CPU内核中运行的操作***的ID、操作***中处理该第二数据包的进程的ID以 及第一CPU内核所在的CPU板的ID中的至少一个。
具体的,网卡控制器为第一数据包分配目的地址时,该网卡控制器可以根据分配策略,以及该第一数据包的网卡IP地址和源地址,为该第一数据包分配对应的目的地址(即内部地址)。示例性的,该分配策略可以是数据包的源地址、目的地址以及网卡IP地址间的映射关系,该映射关系可以是网卡控制器预先设定的,也可以是该网卡控制器根据每个物理网卡传输数据包时的历史记录进行设置的。
403、网卡控制器将第一数据包中的网卡IP地址替换为目的地址,以得到第二数据包。
具体的,为了使得CPU板中的CPU控制器可以识别该第一数据包,该网卡控制器可以该第一数据包进行解封,获取该第一数据包中的数据,然后将该第一数据包中的数据与分配的目的地址进行重新封装,成为一个可以被CPU控制器识别的第二数据包;网卡控制器也可以利用NAT的方法直接将第一数据包中的源地址替换为目的地址,成为一个可以被CPU控制器识别的第二数据包。
404、网卡控制器将第二数据包转发至待接收队列,以便CPU控制器指示第二数据包的目的地址对应的第一CPU内核处理该第二数据包。
其中,上述的待接收队列中的第二数据包是CPU板中的CPU控制器通过预定协议进行收发的,该预定协议包括mail box邮箱协议。
具体的,网卡控制器在将第二数据包发送至待接收队列后,该待接收队列会触发一个中断,并将该中断发送至CPU控制器,而该CPU控制器会根据该中断指示第二数据包的目的地址对应的第一CPU内核来处理该第二数据包。
示例性的,以mail box协议为例,当mail box的待接收队列接收到网卡控制器发送的第二数据包时,会触发一个中断,CPU控制器将该中断转发至第二数据包的目的地址对应的第一CPU内核,从而将该第一CPU内核中注册过的进程唤醒,让该进程处理这个第二 数据包。
本发明实施例提供的数据处理方法,网卡控制器接收第一数据包后,根据该第一数据包的源地址和网卡IP地址为该第一数据包分配目的地址,然后网卡控制器将第一数据包中的网卡IP地址替换为目的地址,以得到第二数据包,网卡控制器将第二数据包转发至待接收队列,以便CPU控制器指示第二数据包的目的地址对应的第一CPU内核处理该第二数据包。相比现有技术,本发明通过网卡控制器管理所有物理网卡并提供网络服务,不需要资源管理中心的介入管理,从而减少了网卡资源的申请步骤,解决了由于整个网卡资源申请步骤过长,造成的部分数据包由于处理不及时,而导致的网络数据中断的问题,并降低了CPU板的管理负载。同时,网卡控制器通过为数据包灵活的分配网卡IP地址,使得数据包不受网卡、网段的限制进行发送,从而实现了众核解耦的多核处理器***跨网卡、跨网段处理数据。
基于图1对应的多核处理器***,本发明的实施例提供一种数据处理方法,如图6所示,该方法具体包括如下步骤:
501、网卡控制器接收第一数据包。
具体的,步骤501的描述可以参照图5对应实施例中的步骤401中的详细描述,这里不再赘述。
502、网卡控制器根据第一数据包的源地址和网卡IP地址,为该第一数据包分配目的地址。
可选的,步骤502具体包括:
502a、网卡控制器在信息映射表中检索第一数据包的网卡IP地址对应的物理网卡的历史记录。
其中,上述的信息映射表用于存储网卡控制器通过M个物理网卡收发的数据包的历史记录,该历史记录包括通过M个物理网卡收发的数据包的目的地址、网卡IP地址及源地址间的对应关系。
具体的,当网卡控制器在信息映射表中未检索到第一数据包的网卡IP地址对应的物理网卡的历史记录,则转向步骤502b1;当网 卡控制器在信息映射表中检索到第一数据包的网卡IP地址对应的物理网卡的历史记录,则转向步骤502c1。
502b1、若网卡控制器在信息映射表中未检索到第一数据包的网卡IP地址对应的物理网卡的历史记录,则网卡控制器丢弃该第一数据包。
502c1、若网卡控制器在信息映射表中检索到第一数据包的网卡IP地址对应的物理网卡的历史记录,则网卡控制器在检索到的历史记录中检索第一数据包的源地址。
示例性的,若网卡控制器在信息映射表中未检索到第一数据包的网卡IP地址(233.255.14.151)对应的物理网卡的历史记录,则说明该第一数据包并不是该多核处理器***所请求的数据包,网卡控制器丢弃该第一数据包;若网卡控制器在信息映射表中检索到该网卡IP地址对应的物理网卡1的历史记录,则网卡控制器在检索到物理网卡1的历史记录中检索第一数据包的源地址(202.108.22.5)。
进一步的,基于步骤502c1,当网卡控制器在检索到的历史记录检索到第一数据包的源地址,则转向步骤a1;当网卡控制器在检索到的历史记录中未检索到第一数据包的源地址,则转向步骤b1。
a1、若网卡控制器在检索到的历史记录中检索到第一数据包的源地址,则网卡控制器将包含第一数据包的源地址的历史记录中的内部地址分配给第一数据包。
b1、若网卡控制器在检索到的历史记录中未检索到第一数据包的源地址,则网卡控制器将第一数据包的网卡IP地址对应的物理网卡的历史记录中的任一条历史记录中的内部地址分配给第一数据包。
示例性的,若网卡控制器在检索到的历史记录中检索到第一数据包的源地址(202.108.22.5),则说明该物理网卡1之前接收过从该源地址发送的数据,则网卡控制器将包含该源地址的历史记录中的内部地址(如进程X的进程号1)分配给第一数据包;若网卡控制器在检索到的历史记录中未检索到第一数据包的源地址,则说明 该物理网卡没有接收过该源地址发送的数据,则网卡控制器将第一数据包的网卡IP地址(233.255.14.151)对应的物理网卡1的历史记录中的任一条历史记录中的内部地址分配给第一数据包。
503、网卡控制器将第一数据包中的网卡IP地址替换为目的地址,以得到第二数据包。
504、网卡控制器将第二数据包转发至待接收队列,以便CPU控制器指示第二数据包的目的地址对应的第一CPU内核处理该第二数据包。
具体的,步骤503、504的描述可以参照图5对应实施例中的步骤403、404中的详细描述,这里不再赘述。
示例性的,由于本发明实施例不需要借助资源管理中心的管理功能,便可实现网卡的分配和数据的处理,因此,参照图4所示本发明的实施例所应用的多核处理器***不包含资源管理中心,具体的,该多核处理器***中包括:N个中央处理器CPU板,即CPU#1板、CPU#2板,......,CPU#n板、M个物理网卡。若以CPU#1板中的第一CPU内核上运行的操作***的进程X为例,且设备板中包含3个网卡:网卡1、网卡2、网卡3时,本发明实施例所提供的方法具体实现过程如下:
1)、当网卡控制器从物理网卡1接收到第一数据包时,该网卡控制器会对该第二数据包包头进行解析,获取该第二数据包的源地址(202.108.22.5)及网卡IP地址(233.255.14.151)。接着,网卡控制器在信息映射表中的历史记录中检索上述的网卡IP地址对应的物理网卡1的历史记录。若网卡控制器在检索到的历史记录中检索到该源地址,则网卡控制器将包含该源地址的历史记录中的内部地址(即进程X的进程号1)分配给第一数据包。然后,网卡控制器通过NAT方法将第一数据包中的网卡IP地址(233.255.14.151)替换为该进程X的进程号1,从而得到一个第二数据包。
2)、网卡控制器将上述过程得到的第二数据包发送至待接收队列,而该待接收队列在接收到该第二数据包后会触发一个中断,并 将该中断发送到该第二数据包的目的地址所指向的CPU板中的CPU控制器,以便该CPU控制器指示该CPU板中的第一CPU内核上运行的进程X处理该第二数据包。
本发明实施例提供的数据处理方法,网卡控制器接收第一数据包后,根据该第一数据包的源地址和网卡IP地址为该第一数据包分配目的地址,然后网卡控制器将第一数据包中的网卡IP地址替换为目的地址,以得到第二数据包,网卡控制器将第二数据包转发至待接收队列,以便CPU控制器指示第二数据包的目的地址对应的第一CPU内核处理该第二数据包。相比现有技术,本发明通过网卡控制器管理所有物理网卡并提供网络服务,不需要资源管理中心的介入管理,从而减少了网卡资源的申请步骤,解决了由于整个网卡资源申请步骤过长,造成的部分数据包由于处理不及时,而导致的网络数据中断的问题,并降低了CPU板的管理负载。同时,网卡控制器通过为数据包灵活的分配网卡IP地址,使得数据包不受网卡、网段的限制进行发送,从而实现了众核解耦的多核处理器***跨网卡、跨网段处理数据。
本发明的实施例提供一种网卡控制器,应用于多核处理器***,基于图1对应的多核处理器***,具体的,如图7所示,该多核处理器***中的网卡控制器6包括:获取模块61、分配模块62、转换模块63和发送模块64,其中:
获取模块61,用于获取待发送队列中的第一数据包,其中,上述的第一数据包是CPU控制器对运行在第一CPU内核上的操作***的进程的数据进行封装得到的,该第一数据包包括该第一数据包的源地址、目的地址以及该第一数据包所需网络服务的网络参数,上述的第一数据包的源地址为该第一数据包在多核处理器***中使用的内部地址。
分配模块62,用于根据上述的第一数据包的源地址、目的地址以及该第一数据包所需网络服务的网络参数,为该第一数据包分配网卡IP地址。
转换模块63,用于将上述的第一数据包转换为第二数据包,其中,上述的第二数据包中的源地址为网卡IP地址。
发送模块64,用于通过上述的网卡IP地址对应的物理网卡将第二数据包发送至外部网络。
可选的,上述的待发送队列中存储的第一数据包是CPU板中的CPU控制器通过预定协议来进行收发的。
上述的预定协议包括mail box邮箱协议。
上述的第一数据包所需网络服务的网络参数包括该网络服务连接的网段和该网络服务所需的带宽。
上述的第一数据包的内部地址包括CPU板标识ID、操作***ID或进程号中的至少一个。
可选的,上述的分配模块62具体用于:
在信息映射表中检索第一数据包所需网络服务的网络参数,其中,上述的信息映射表用于存储网卡控制器通过M个物理网卡收发的数据包的历史记录,该历史记录包括通过M个物理网卡收发的数据包的目的地址、网卡IP地址及源地址间的对应关系。
若在信息映射表中未检索到与网络参数相匹配的历史记录,则根据上述的网络参数从M个物理网卡中,选择与该网络参数相匹配的目标物理网卡。
将上述的与网络参数相匹配的目标物理网卡对应的网卡IP地址分配给第一数据包。
可选的,上述的分配模块62在信息映射表中的历史记录中检索第一数据包所需网络服务的网络参数之后,还用于:
若在信息映射表中检索到与网络参数相匹配的历史记录,则在上述的与网络参数相匹配的历史记录中检索第一数据包的目的地址。
若在上述的与网络参数相匹配的历史记录中检索到第一数据包的目的地址,则将包含第一数据包的目的地址的历史记录中的网卡IP地址分配给所述第一数据包。
可选的,分配模块62在上述的与网络参数相匹配的历史记录中检索第一数据包的目的地址之后,还用于:
若在上述的与网络参数相匹配的历史记录中未检索到第一数据包的目的地址,则将与网络参数相匹配的历史记录中的任一条历史记录中的网卡IP地址分配给第一数据包。
本发明实施例提供的网卡控制器,网卡控制器获取待发送队列中的第一数据包后,根据该第一数据包的源地址、目的地址以及第一数据包所需网络服务的网络参数,为该第一数据包分配网卡IP地址,然后网卡控制器将第一数据包转换为第二数据包,并通过网卡IP地址对应的物理网卡将第二数据包发送至外部网络。相比现有技术,本发明通过网卡控制器管理所有物理网卡并提供网络服务,不需要资源管理中心的介入管理,从而减少了网卡资源的申请步骤,解决了由于整个网卡资源申请步骤过长,造成的部分数据包由于处理不及时,而导致的网络数据中断的问题,并降低了CPU板的管理负载。同时,网卡控制器通过为数据包灵活的分配网卡IP地址,使得数据包不受网卡、网段的限制进行发送,从而实现了众核解耦的多核处理器***跨网卡、跨网段处理数据。
本发明的实施例提供一种网卡控制器,应用于多核处理器***,基于图1对应的多核处理器***,具体的,如图8所示,该多核处理器***中的网卡控制器7包括:接收模块71、分配模块72、转换模块73和发送模块74,其中:
接收模块71,用于接收第一数据包,其中,上述的第一数据包包括该第一数据包的源地址和接收该第一数据包的网卡的网卡IP地址。
分配模块72,用于根据第一数据包的源地址和网卡IP地址,为该第一数据包分配目的地址,其中,上述的目的地址为第一数据包在多核处理器***中使用的内部地址。
转换模块73,用于将上述的第一数据包中的网卡IP地址替换为目的地址,以得到第二数据包。
发送模块74,用于将上述的第二数据包转发至待接收队列,以便CPU控制器指示第二数据包的目的地址对应的第一CPU内核处理该第二数据包。
可选的,上述的待接收队列中的第二数据包是CPU板中的CPU控制器通过预定协议进行收发的,该预定协议包括mail box邮箱协议。
上述的目的地址包括在第一CPU内核中运行的操作***的ID、该操作***中处理第二数据包的进程的ID以及第一CPU内核所在的CPU板的ID中的至少一个。
可选的,分配模块72具体用于:
在信息映射表中检索第一数据包的网卡IP地址对应的物理网卡的历史记录,其中,上述的信息映射表用于存储网卡控制器通过M个物理网卡收发的数据包的历史记录,该历史记录包括通过M个物理网卡收发的数据包的目的地址、网卡IP地址及源地址间的对应关系。
若在上述的信息映射表中检索到第一数据包的网卡IP地址对应的物理网卡的历史记录,则在检索到的历史记录中检索第一数据包的源地址。
若在检索到的历史记录中检索到第一数据包的源地址,则将包含该第一数据包的源地址的历史记录中的内部地址分配给该第一数据包。
可选的,上述的分配模块72还用于:
若在检索到的历史记录中未检索到第一数据包的源地址,则将该第一数据包的网卡IP地址对应的物理网卡的历史记录中的任一条历史记录中的内部地址分配给第一数据包。
本发明实施例提供的网卡控制器,网卡控制器接收第一数据包后,根据该第一数据包的源地址和网卡IP地址为该第一数据包分配目的地址,然后网卡控制器将第一数据包中的网卡IP地址替换为目的地址,得到第二数据包,网卡控制器将第二数据包转发至待接收 队列,以便CPU控制器指示第二数据包的目的地址对应的第一CPU内核处理该第二数据包。相比现有技术,本发明通过网卡控制器管理所有物理网卡并提供网络服务,不需要资源管理中心的介入管理,从而减少了网卡资源的申请步骤,解决了由于整个网卡资源申请步骤过长,造成的部分数据包由于处理不及时,而导致的网络数据中断的问题,并降低了CPU板的管理负载。同时,网卡控制器通过为数据包灵活的分配网卡IP地址,使得数据包不受网卡、网段的限制进行发送,从而实现了众核解耦的多核处理器***跨网卡、跨网段处理数据。
本发明的实施例提供一种网卡控制设备,应用于多核处理器***,基于图1对应的多核处理器***,具体的,如图9所示,该多核处理器***中的网卡控制设备8包括:通信接口81和处理器82,其中:
处理器82,用于通过通信接口81获取待发送队列中的第一数据包,其中,上述的第一数据包是CPU控制器对运行在第一CPU内核上的操作***的进程的数据进行封装得到的,该第一数据包包括该第一数据包的源地址、目的地址以及该第一数据包所需网络服务的网络参数,上述的第一数据包的源地址为该第一数据包在多核处理器***中使用的内部地址。
处理器82,还用于根据上述的第一数据包的源地址、目的地址以及该第一数据包所需网络服务的网络参数,为该第一数据包分配网卡IP地址。
处理器82,还用于将上述的第一数据包转换为第二数据包,其中,上述的第二数据包中的源地址为网卡IP地址。
处理器82,还用于通过上述的网卡IP地址对应的物理网卡将第二数据包发送至外部网络。
可选的,上述的待发送队列中存储的第一数据包是CPU板中的CPU控制器通过预定协议来进行收发的。
上述的预定协议包括mail box邮箱协议。
上述的第一数据包所需网络服务的网络参数包括该网络服务连接的网段和该网络服务所需的带宽。
上述的第一数据包的内部地址包括CPU板标识ID、操作***ID或进程号中的至少一个。
可选的,该网卡控制设备8还包括:存储器83,其中:
上述的处理器82具体用于:在存储器83中的信息映射表中检索第一数据包所需网络服务的网络参数,其中,上述的信息映射表用于存储网卡控制器通过M个物理网卡收发的数据包的历史记录,该历史记录包括通过M个物理网卡收发的数据包的目的地址、网卡IP地址及源地址间的对应关系。
若在存储器83中的信息映射表中未检索到与网络参数相匹配的历史记录,则根据上述的网络参数从M个物理网卡中,选择与该网络参数相匹配的目标物理网卡。
将上述的与网络参数相匹配的目标物理网卡对应的网卡IP地址分配给第一数据包。
可选的,上述的处理器82在存储器83中的信息映射表中的历史记录中检索第一数据包所需网络服务的网络参数之后,还用于:
若在存储器83中的信息映射表中检索到与网络参数相匹配的历史记录,则在上述的与网络参数相匹配的历史记录中检索第一数据包的目的地址。
若在上述的与网络参数相匹配的历史记录中检索到第一数据包的目的地址,则将包含第一数据包的目的地址的历史记录中的网卡IP地址分配给所述第一数据包。
可选的,处理器82在上述的与网络参数相匹配的历史记录中检索第一数据包的目的地址之后,还用于:
若在上述的与网络参数相匹配的历史记录中未检索到第一数据包的目的地址,则将与网络参数相匹配的历史记录中的任一条历史记录中的网卡IP地址分配给第一数据包。
本发明实施例提供的网卡控制设备,网卡控制设备获取待发送 队列中的第一数据包后,根据该第一数据包的源地址、目的地址以及第一数据包所需网络服务的网络参数,为该第一数据包分配网卡IP地址,然后网卡控制设备将第一数据包转换为第二数据包,并通过网卡IP地址对应的物理网卡将第二数据包发送至外部网络。相比现有技术,本发明通过网卡控制器管理所有物理网卡并提供网络服务,不需要资源管理中心的介入管理,从而减少了网卡资源的申请步骤,解决了由于整个网卡资源申请步骤过长,造成的部分数据包由于处理不及时,而导致的网络数据中断的问题,并降低了CPU板的管理负载。同时,网卡控制器通过为数据包灵活的分配网卡IP地址,使得数据包不受网卡、网段的限制进行发送,从而实现了众核解耦的多核处理器***跨网卡、跨网段处理数据。
本发明的实施例提供一种网卡控制设备,应用于多核处理器***,基于图1对应的多核处理器***,具体的,如图10所示,该多核处理器***中的网卡控制设备9包括:通信接口91和处理器92,其中:
处理器92,用于通过通信接口91接收第一数据包,其中,上述的第一数据包包括该第一数据包的源地址和接收该第一数据包的物理网卡的网卡IP地址。
处理器92,还用于根据第一数据包的源地址和网卡IP地址,为该第一数据包分配目的地址,其中,上述的目的地址为第一数据包在多核处理器***中使用的内部地址。
处理器92,还用于将上述的第一数据包中的网卡IP地址替换为目的地址,以得到第二数据包。
处理器92,还用于通过通信接口91将上述的第二数据包转发至待接收队列,以便CPU控制器指示第二数据包的目的地址对应的第一CPU内核处理该第二数据包。
可选的,上述的待接收队列中的第二数据包是CPU板中的CPU控制器通过预定协议进行收发的,该预定协议包括mail box邮箱协议。
上述的目的地址包括在第一CPU内核中运行的操作***的ID、该操作***中处理第二数据包的进程的ID以及第一CPU内核所在的CPU板的ID中的至少一个。
可选的,该网卡控制设备9还包括:存储器93,其中:
处理器92具体用于:在存储器93中的信息映射表中检索第一数据包的网卡IP地址对应的物理网卡的历史记录,其中,上述的信息映射表用于存储网卡控制器通过M个物理网卡收发的数据包的历史记录,该历史记录包括通过M个物理网卡收发的数据包的目的地址、网卡IP地址及源地址间的对应关系。
若在上述的存储器93中的信息映射表中检索到第一数据包的网卡IP地址对应的物理网卡的历史记录,则在检索到的历史记录中检索第一数据包的源地址。
若在检索到的历史记录中检索到第一数据包的源地址,则将包含该第一数据包的源地址的历史记录中的内部地址分配给该第一数据包。
可选的,上述的处理器92还用于:
若在检索到的历史记录中未检索到第一数据包的源地址,则将该第一数据包的网卡IP地址对应的物理网卡的历史记录中的任一条历史记录中的内部地址分配给第一数据包。
本发明实施例提供的网卡控制设备,网卡控制设备接收第一数据包后,根据该第一数据包的源地址和网卡IP地址为该第一数据包分配目的地址,然后网卡控制设备将第一数据包中的网卡IP地址替换为目的地址,以得到第二数据包,网卡控制设备将第二数据包转发至待接收队列,以便CPU控制器指示第二数据包的目的地址对应的第一CPU内核处理该第二数据包。相比现有技术,本发明通过网卡控制器管理所有物理网卡并提供网络服务,不需要资源管理中心的介入管理,从而减少了网卡资源的申请步骤,解决了由于整个网卡资源申请步骤过长,造成的部分数据包由于处理不及时,而导致的网络数据中断的问题,并降低了CPU板的管理负载。同时,网卡 控制器通过为数据包灵活的分配网卡IP地址,使得数据包不受网卡、网段的限制进行发送,从而实现了众核解耦的多核处理器***跨网卡、跨网段处理数据。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。上述描述的***,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个***,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。需要说明的是,以上实施例仅用以说明本申请的技术方案,而非对其限制。

Claims (18)

  1. 一种数据处理方法,应用于多核处理器***,所述多核处理器***包括设备板和中央处理器CPU板,所述CPU板中包括多个CPU内核和一个用于管理所述CPU板中CPU内核的CPU控制器,其中,在所述多个CPU内核的第一CPU内核中运行有操作***,所述设备板中包括M个物理网卡和用于管理所述M个物理网卡的网卡控制器,其特征在于,所述方法包括:
    所述网卡控制器获取待发送队列中的第一数据包,其中,所述第一数据包是所述CPU控制器对运行在所述第一CPU内核上的操作***的进程的数据进行封装得到的,所述第一数据包包括所述第一数据包的源地址、目的地址以及所述第一数据包所需网络服务的网络参数,所述第一数据包的源地址为所述第一数据包在所述多核处理器***中使用的内部地址;
    根据所述第一数据包的源地址、目的地址以及所述第一数据包所需网络服务的网络参数,为所述第一数据包分配网卡IP地址;
    将所述第一数据包转换为第二数据包,其中,所述第二数据包中的源地址为所述网卡IP地址;
    通过所述网卡IP地址对应的物理网卡将所述第二数据包发送至外部网络。
  2. 根据权利要求1所述的方法,其特征在于:
    所述待发送队列中存储的第一数据包是所述CPU板中的CPU控制器通过预定协议来进行收发的;
    所述预定协议包括mail box邮箱协议;
    所述第一数据包所需网络服务的网络参数包括所述网络服务连接的网段和所述网络服务所需的带宽;
    所述第一数据包的内部地址包括所述CPU板标识ID、所述操作***ID或所述的进程号中的至少一个。
  3. 根据权利要求2所述的方法,其特征在于,所述根据所述第一数据包的源地址和目的地址以及所述第一数据包所需网络服务的 网络参数,为所述第一数据包分配网卡IP地址具体包括:
    在信息映射表中检索所述第一数据包所需网络服务的网络参数,其中,所述信息映射表用于存储所述网卡控制器通过所述M个物理网卡收发的数据包的历史记录,所述历史记录包括通过所述M个物理网卡收发的数据包的目的地址、网卡IP地址及源地址间的对应关系;
    若在所述信息映射表中未检索到与所述网络参数相匹配的历史记录,则根据所述网络参数从所述M个物理网卡中,选择与所述网络参数相匹配的目标物理网卡;
    将所述与所述网络参数相匹配的目标物理网卡对应的网卡IP地址分配给所述第一数据包。
  4. 根据权利要求3所述的方法,其特征在于,所述将所述第一数据包所需网络服务的网络参数与网卡数据库中的信息映射表中的历史记录进行匹配之后,所述方法还包括:
    若在所述信息映射表中检索到与所述网络参数相匹配的历史记录,则在所述与所述网络参数相匹配的历史记录中检索所述第一数据包的目的地址;
    若在所述与所述网络参数相匹配的历史记录中检索到所述第一数据包的目的地址,则将所述包含所述第一数据包的目的地址的历史记录中的网卡IP地址分配给所述第一数据包。
  5. 根据权利要求4所述的方法,其特征在于,所述在所述与所述网络参数相匹配的历史记录中检索所述第一数据包的目的地址之后,所述方法还包括:
    若在所述与所述网络参数相匹配的历史记录中未检索到所述第一数据包的目的地址,则将与所述网络参数相匹配的历史记录中的任一条历史记录中的网卡IP地址分配给所述第一数据包。
  6. 一种数据处理方法,应用于多核处理器***,所述多核处理器***包括设备板和中央处理器CPU板,所述CPU板中包括多个CPU内核和一个用于管理所述CPU板中CPU内核的CPU控制器, 其中,在所述多个CPU内核的第一CPU内核中运行有操作***,所述设备板中包括M个物理网卡和用于管理所述M个物理网卡的网卡控制器,其特征在于,所述方法包括:
    所述网卡控制器接收第一数据包,其中,所述第一数据包包括所述第一数据包的源地址和接收所述第一数据包的物理网卡的网卡IP地址;
    根据所述第一数据包的源地址和所述网卡IP地址,为所述第一数据包分配目的地址,其中,所述目的地址为所述第一数据包在所述多核处理器***中使用的内部地址;
    将所述第一数据包中的所述网卡IP地址替换为所述目的地址,以得到第二数据包;
    将所述第二数据包转发至待接收队列,以便CPU控制器指示所述第二数据包的目的地址对应的第一CPU内核处理所述第二数据包。
  7. 根据权利要求6所述的方法,其特征在于:
    所述待接收队列中的第二数据包是所述CPU板中的CPU控制器通过预定协议进行收发的,所述预定协议包括mail box邮箱协议;
    所述目的地址包括在所述第一CPU内核中运行的操作***的ID、所述操作***中处理所述第二数据包的进程的ID以及所述第一CPU内核所在的CPU板的ID中的至少一个。
  8. 根据权利要求7所述的方法,其特征在于,所述根据所述第一数据包的源地址和网卡IP地址,为所述第一数据包分配目的地址具体包括:
    在信息映射表中检索所述第一数据包的网卡IP地址对应的物理网卡的历史记录,其中,所述信息映射表用于存储所述网卡控制器通过所述M个物理网卡收发的数据包的历史记录,所述历史记录包括通过所述M个物理网卡收发的数据包的目的地址、网卡IP地址及源地址间的对应关系;
    若在所述信息映射表中检索到所述第一数据包的网卡IP地址对应的物理网卡的历史记录,则在检索到的历史记录中检索所述第一数 据包的源地址;
    若在所述检索到的历史记录中检索到所述第一数据包的源地址,则将包含所述第一数据包的源地址的历史记录中的内部地址分配给所述第一数据包。
  9. 根据权利要求8所述的方法,其特征在于,所述方法还包括:
    若在所述检索到的历史记录中未检索到所述第一数据包的源地址,则将所述第一数据包的网卡IP地址对应的物理网卡的历史记录中的任一条历史记录中的内部地址分配给所述第一数据包。
  10. 一种网卡控制器,应用于多核处理器***,所述多核处理器***包括设备板和中央处理器CPU板,所述CPU板中包括多个CPU内核和一个用于管理所述CPU板中CPU内核的CPU控制器,其中,在所述多个CPU内核的第一CPU内核中运行有操作***,所述设备板中包括M个物理网卡和用于管理所述M个物理网卡的网卡控制器,其特征在于,所述网卡控制器包括:
    获取模块,用于获取待发送队列中的第一数据包,其中,所述第一数据包是所述CPU控制器对运行在所述第一CPU内核上的操作***的进程的数据进行封装得到的,所述第一数据包包括所述第一数据包的源地址、目的地址以及所述第一数据包所需网络服务的网络参数,所述第一数据包的源地址为所述第一数据包在所述多核处理器***中使用的内部地址;
    分配模块,用于根据所述第一数据包的源地址、目的地址以及所述第一数据包所需网络服务的网络参数,为所述第一数据包分配网卡IP地址;
    转换模块,用于将所述第一数据包转换为第二数据包,其中,所述第二数据包中的源地址为所述网卡IP地址;
    发送模块,用于通过所述网卡IP地址对应的物理网卡将所述第二数据包发送至外部网络。
  11. 根据权利要求10所述的网卡控制器,其特征在于:
    所述待发送队列中存储的第一数据包是所述CPU板中的CPU控 制器通过预定协议来进行收发的;
    所述预定协议包括mail box邮箱协议;
    所述第一数据包所需网络服务的网络参数包括所述网络服务连接的网段和所述网络服务所需的带宽;
    所述第一数据包的内部地址包括所述CPU板标识ID、所述操作***ID或所述的进程号中的至少一个。
  12. 根据权利要求11所述的网卡控制器,其特征在于,所述分配模块具体用于:
    在信息映射表中检索所述第一数据包所需网络服务的网络参数,其中,所述信息映射表用于存储所述网卡控制器通过所述M个物理网卡收发的数据包的历史记录,所述历史记录包括所述通过所述M个物理网卡收发的数据包的目的地址、网卡IP地址及源地址间的对应关系;
    若在所述信息映射表中未检索到与所述网络参数相匹配的历史记录,则根据所述网络参数从所述M个物理网卡中,选择与所述网络参数相匹配的目标物理网卡;
    将所述与所述网络参数相匹配的目标物理网卡对应的网卡IP地址分配给所述第一数据包。
  13. 根据权利要求12所述的网卡控制器,其特征在于,所述分配模块在信息映射表中的历史记录中检索所述第一数据包所需网络服务的网络参数之后,还用于:
    若在所述信息映射表中检索到与所述网络参数相匹配的历史记录,则在所述与所述网络参数相匹配的历史记录中检索所述第一数据包的目的地址;
    若在所述与所述网络参数相匹配的历史记录中检索到所述第一数据包的目的地址,则将所述包含所述第一数据包的目的地址的历史记录中的网卡IP地址分配给所述第一数据包。
  14. 根据权利要求13所述的网卡控制器,其特征在于,所述分配模块在所述与所述网络参数相匹配的历史记录中检索所述第一数 据包的目的地址之后,还用于:
    若在所述与所述网络参数相匹配的历史记录中未检索到所述第一数据包的目的地址,则将与所述网络参数相匹配的历史记录中的任一条历史记录中的网卡IP地址分配给所述第一数据包。
  15. 一种网卡控制器,应用于多核处理器***,所述多核处理器***包括设备板和中央处理器CPU板,所述CPU板中包括多个CPU内核和一个用于管理所述CPU板中CPU内核的CPU控制器,其中,在所述多个CPU内核的第一CPU内核中运行有操作***,所述设备板中包括M个物理网卡和用于管理所述M个物理网卡的网卡控制器,其特征在于,所述网卡控制器包括:
    接收模块,用于接收第一数据包,其中,所述第一数据包包括所述第一数据包的源地址和接收所述第一数据包的物理网卡的网卡IP地址;
    分配模块,用于根据所述第一数据包的源地址和所述网卡IP地址,为所述第一数据包分配目的地址,其中,所述目的地址为所述第一数据包在所述多核处理器***中使用的内部地址;
    转换模块,用于将所述第一数据包中的所述网卡IP地址替换为所述目的地址,以得到第二数据包;
    发送模块,用于将所述第二数据包转发至待接收队列,以便CPU控制器指示所述第二数据包的目的地址对应的第一CPU内核处理所述第二数据包。
  16. 根据权利要求15所述的网卡控制器,其特征在于:
    所述待接收队列中的第二数据包是所述CPU板中的CPU控制器通过预定协议进行收发的,所述预定协议包括mail box邮箱协议;
    所述目的地址包括在所述第一CPU内核中运行的操作***的ID、所述操作***中处理所述第二数据包的进程的ID以及所述第一CPU内核所在的CPU板的ID中的至少一个。
  17. 根据权利要求16所述的网卡控制器,其特征在于,所述分配模块具体用于:
    在信息映射表中检索所述第一数据包的网卡IP地址对应的物理网卡的历史记录,其中,所述信息映射表用于存储所述网卡控制器通过所述M个物理网卡收发的数据包的历史记录,所述历史记录包括所述通过所述M个物理网卡收发的数据包的目的地址、网卡IP地址及源地址间的对应关系;
    若在所述信息映射表中检索到所述第一数据包的网卡IP地址对应的物理网卡的历史记录,则在检索到的历史记录中检索所述第一数据包的源地址;
    若在所述检索到的历史记录中检索到所述第一数据包的源地址,则将包含所述第一数据包的源地址的历史记录中的内部地址分配给所述第一数据包。
  18. 根据权利要求17所述的网卡控制器,其特征在于,所述分配模块还用于:
    若在所述检索到的历史记录中未检索到所述第一数据包的源地址,则将所述第一数据包的网卡IP地址对应的物理网卡的历史记录中的任一条历史记录中的内部地址分配给所述第一数据包。
PCT/CN2014/090944 2014-11-12 2014-11-12 一种数据处理方法及多核处理器*** WO2016074179A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201480038084.6A CN105874757B (zh) 2014-11-12 2014-11-12 一种数据处理方法及多核处理器***
PCT/CN2014/090944 WO2016074179A1 (zh) 2014-11-12 2014-11-12 一种数据处理方法及多核处理器***

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2014/090944 WO2016074179A1 (zh) 2014-11-12 2014-11-12 一种数据处理方法及多核处理器***

Publications (1)

Publication Number Publication Date
WO2016074179A1 true WO2016074179A1 (zh) 2016-05-19

Family

ID=55953581

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/090944 WO2016074179A1 (zh) 2014-11-12 2014-11-12 一种数据处理方法及多核处理器***

Country Status (2)

Country Link
CN (1) CN105874757B (zh)
WO (1) WO2016074179A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109714269B (zh) * 2018-12-19 2022-05-17 迈普通信技术股份有限公司 一种数据处理方法及网络设备
CN114968545A (zh) * 2021-02-24 2022-08-30 华为技术有限公司 网卡、计算设备和获取数据的方法

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101610209A (zh) * 2008-11-28 2009-12-23 北京网康科技有限公司 一种多核并行的网络业务流处理方法及设备
CN101964749A (zh) * 2010-09-21 2011-02-02 北京网康科技有限公司 一种基于多核构架的报文转发方法及***
CN102710497A (zh) * 2012-04-24 2012-10-03 汉柏科技有限公司 多核多线程网络设备的报文处理方法及***
CN102984085A (zh) * 2012-11-21 2013-03-20 网神信息技术(北京)股份有限公司 映射方法及装置

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101398772B (zh) * 2008-10-21 2011-04-13 成都市华为赛门铁克科技有限公司 一种网络数据的中断处理方法及装置
US8533382B2 (en) * 2010-01-06 2013-09-10 Vmware, Inc. Method and system for frequent checkpointing
CN104008013B (zh) * 2013-02-26 2018-02-09 华为技术有限公司 一种核资源分配方法、装置及众核***

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101610209A (zh) * 2008-11-28 2009-12-23 北京网康科技有限公司 一种多核并行的网络业务流处理方法及设备
CN101964749A (zh) * 2010-09-21 2011-02-02 北京网康科技有限公司 一种基于多核构架的报文转发方法及***
CN102710497A (zh) * 2012-04-24 2012-10-03 汉柏科技有限公司 多核多线程网络设备的报文处理方法及***
CN102984085A (zh) * 2012-11-21 2013-03-20 网神信息技术(北京)股份有限公司 映射方法及装置

Also Published As

Publication number Publication date
CN105874757A (zh) 2016-08-17
CN105874757B (zh) 2019-04-26

Similar Documents

Publication Publication Date Title
US10986171B2 (en) Method for unified communication of server, baseboard management controller, and server
US10305823B2 (en) Network interface card configuration method and resource management center
US10698717B2 (en) Accelerator virtualization method and apparatus, and centralized resource manager
US8180949B1 (en) Resource virtualization switch
US7849265B2 (en) Avoiding use of an inter-unit network in a storage system having multiple storage control units
US9813283B2 (en) Efficient data transfer between servers and remote peripherals
CN110071900B (zh) 数据发送的方法及设备
WO2018023498A1 (zh) 网络接口卡、计算设备以及数据包处理方法
US11750418B2 (en) Cross network bridging
US10609125B2 (en) Method and system for transmitting communication data
WO2016119469A1 (zh) 业务上下文管理方法、物理主机、pcie设备及迁移管理设备
WO2015081515A1 (zh) 数据处理方法、装置、存储控制器和机柜
US8527661B1 (en) Gateway for connecting clients and servers utilizing remote direct memory access controls to separate data path from control path
WO2018113622A1 (zh) 基于虚拟机的数据包发送和接收方法及装置
JP5091121B2 (ja) 埋め込み型システムのための高速データ処理・通信方法及び装置
US20200244623A1 (en) Data transmission method, server and offload card
WO2016074179A1 (zh) 一种数据处理方法及多核处理器***
US10897488B1 (en) Multiplexing traffic from multiple network namespaces to a single listener in a stream-based server application
CN117041147B (zh) 智能网卡设备、主机设备和方法及***
US20230171189A1 (en) Virtual network interfaces for managed layer-2 connectivity at computing service extension locations
CN118266195A (zh) 用于计算服务扩展位置处的受管第2层连接的虚拟网络接口
US10397029B2 (en) Relay apparatus

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

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14905930

Country of ref document: EP

Kind code of ref document: A1