A method and apparatus for acquiring information
By sharing a statistical counter service between the sending and receiving ends of a virtual network interface card (NIC), the sending end transmits data and updates the statistical counter, while the receiving end queries event information. This solves the problem of insufficient information at the receiving end of the virtual NIC and enables more comprehensive information acquisition.
Patent Information
- Application Number
- CN202111319188.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-09
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2041-11-09
AI Technical Summary
In existing technologies, the receiving end of a virtual network interface card (NIC) cannot receive event information from the sending end in a timely manner during data transmission, which leads to the inability to detect and optimize processing bottlenecks at the receiving end in a timely manner, resulting in insufficient information.
By sharing a statistical counter service between the sending and receiving ends, the sending end transmits data and determines whether there is an event notification, updates the statistical counter according to the event type, and the receiving end queries the statistical counter service to obtain event information.
This technology enables the receiving end to receive additional event information provided by the sending end in addition to the data itself, thus avoiding data loss due to processing problems and improving the integrity and reliability of information transmission.
Smart Images

Figure CN114237923B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computer, and particularly relates to a method and device for obtaining information. BACKGROUND
[0002] In the prior technical scheme for transmitting data by a sending end and a receiving end of a virtual network card, a Virtio Ring of shared memory is generally used for communication between the sending end and the receiving end. However, in the transmission process, the sending end only transmits data packets to the receiving end and cannot carry more information of the sending end. For example, when the sending end transmits data packets to the receiving end, the sending end needs to send the data packets to the Virtio Ring. Due to the bottleneck in processing of the receiving end, the receiving end cannot receive the data packets in time, so that the Virtio Ring is full and can only discard the packets. The packet loss occurs at the sending end, and the receiving end does not obtain the information of the packet loss. Therefore, the receiving end cannot discover the bottleneck in receiving in time, and cannot discover the problem and optimize and adjust in time, resulting in the defect of insufficient information provided. SUMMARY
[0003] The present disclosure provides a method and device for obtaining information, which solves the defect of insufficient information received by the receiving end of the virtual network card in the prior art, and realizes that the receiving end can receive not only the transmitted data but also the additional event information provided by the sending end.
[0004] In a first aspect, the present disclosure provides a method for obtaining information, applied to a virtual network card, the virtual network card comprising a sending end and a receiving end, the sending end and the receiving end being connected through a data transmission channel and sharing a statistical counter service, and the method specifically comprising:
[0005] transmitting data by the sending end through the data transmission channel, and determining whether there is an event for notifying the receiving end;
[0006] in the case that there is an event for notifying the receiving end, updating a corresponding statistical counter in the statistical counter service according to a type of the event;
[0007] querying the receiving end in the statistical counter service to obtain information corresponding to the event.
[0008] According to the method for obtaining information provided by the present disclosure, the querying the receiving end in the statistical counter service to obtain information corresponding to the event comprises:
[0009] querying the receiving end in the statistical counter service according to a query command to obtain the statistical counter updated by the sending end;
[0010] The receiving end is called to obtain information corresponding to the event according to the updated statistical counter.
[0011] According to the method for obtaining information provided in the present disclosure, the sending end is one of a virtual network card driver and a virtual network card device, and the receiving end is the other one of the virtual network card driver and the virtual network card device.
[0012] According to the method for obtaining information provided in the present disclosure, before the sending end is called to transmit data through the data transmission channel, the method comprises:
[0013] The virtual network card driver is called to set a virtual frame buffer in the data transmission channel.
[0014] The sending end is called to transmit data through the virtual frame buffer.
[0015] According to the method for obtaining information provided in the present disclosure, before the statistical counter corresponding to the statistical counter service is updated, the method comprises:
[0016] The virtual network card driver is called to create a statistical counter service in the virtual network card.
[0017] The virtual network card device is called to determine a label corresponding to a supported statistical counter in the statistical counter service, and determine a memory mapping area of the statistical counter through a memory mapping parameter.
[0018] The virtual network card device is called to identify the label corresponding to the statistical counter, and in a case where the identification is successful, map the memory mapping area of the statistical counter to establish a connection between the virtual network card device and the statistical counter service.
[0019] According to the method for obtaining information provided in the present disclosure, after the virtual network card device is called to identify the statistical counter label, the method further comprises:
[0020] In a case where the identification fails, the virtual network card device is called to display the identification failure.
[0021] According to the method for obtaining information provided in the present disclosure, the type of the event comprises at least one of the following, specifically:
[0022] A packet loss event caused by a full queue of the sending end or the receiving end, a packet loss event caused by a full connection table of the sending end or the receiving end, a packet loss event caused by an out-bandwidth limit of the sending end or the receiving end, and a packet loss event caused by an in-bandwidth limit of the sending end or the receiving end.
[0023] Secondly, this disclosure provides an information acquisition device, configured in a virtual network interface card (NIC), the virtual NIC including a transmitter and a receiver, the receiver and the transmitter being connected via a data transmission channel and sharing a statistical counter service, the device specifically including:
[0024] The judgment module is used to call the sending end to transmit data through the data transmission channel and to determine whether there is an event that notifies the receiving end;
[0025] The update module is used to update the corresponding statistical counter in the statistical counter service according to the type of the event when there is an event that notifies the receiving end.
[0026] The acquisition module is used to call the receiving end to query the statistical counter service and obtain the information corresponding to the event.
[0027] Thirdly, this disclosure provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the method for acquiring information as described in any of the preceding claims.
[0028] Fourthly, this disclosure provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method for acquiring information as described in any of the preceding claims.
[0029] Fifthly, this disclosure provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the method for acquiring information as described in any of the preceding claims.
[0030] This disclosure provides a method and apparatus for acquiring information. By invoking the sending end to transmit data through the data transmission channel and determining whether there is an event to notify the receiving end, this determination effectively avoids the phenomenon of data not being sent to the receiving end due to processing problems at the sending end. Since different event types correspond to different statistical counters, when an event to notify the receiving end occurs, the corresponding statistical counter in the statistical counter service is updated according to the event type. The receiving end then queries the statistical counter service to obtain the information corresponding to the event. This enables the receiving end to receive not only transmitted data but also additional event information provided by the sending end. Attached Figure Description
[0031] To more clearly illustrate the technical solutions in this disclosure or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0032] Figure 1 This is a schematic diagram of the structure and flow of a virtual network interface card (NIC) in the prior art provided in this disclosure embodiment;
[0033] Figure 2 This is a schematic diagram of the architecture of the virtual network interface card provided in this publication;
[0034] Figure 3 This is a flowchart illustrating a method for obtaining information provided in this disclosure;
[0035] Figure 4 This is a schematic diagram of the structure and flow of a virtual network interface card provided in an embodiment of this disclosure;
[0036] Figure 5 This is a schematic diagram of the process before the corresponding statistical counter in the update statistical counter service provided in this embodiment of the disclosure;
[0037] Figure 6 This is a schematic diagram illustrating the specific process of creating a statistical counter service provided in this embodiment of the disclosure;
[0038] Figure 7 This is a schematic diagram of the information acquisition process provided in an embodiment of this disclosure;
[0039] Figure 8 This is a schematic diagram of the structure of an information acquisition device provided in an embodiment of the present disclosure;
[0040] Figure 9 This is a schematic diagram of the structure of the electronic device provided in this disclosure. Detailed Implementation
[0041] To make the objectives, technical solutions, and advantages of this disclosure clearer, the technical solutions of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0042] Reference Figure 1The diagram illustrates the structure and flow of a virtual network interface card (NIC) in the prior art provided in this disclosure. It shows three parts: a Virtio Driver 110, a Virtio Ring 120, and a Virtio Device 130. Taking the Virtio Driver 110 as the front-end and the Virtio Device 130 as the back-end of the virtual NIC as an example, the front-end and back-end of the virtual NIC typically use Virtio technology to implement communication. The front-end refers to the virtual NIC driver in the virtual machine, and the back-end is the virtual NIC device. When the Virtio Driver and the Virtio Device communicate using the shared memory Virtio Ring, one end of the Virtio Driver and the Virtio Device sequentially writes data to the Virtio Ring, while the other end reads data from the Virtio Ring in a first-in, first-out manner. In the process of communication between the Virtio Driver and the Virtio Device through the Virtio Ring, the Virtio Driver only transmits data to the Virtio Device and cannot carry other information (such as packet loss due to a full queue). As a result, the Virtio Device is missing a lot of other information when receiving the information, leading to a deficiency in providing sufficient information.
[0043] Specifically, Virtio is an I / O para-virtualization technology with performance between software and hardware virtualization. Essentially, Virtio is a device driver interface. Based on Virtio, different device types such as Virtio-net, Virtio-blk, and Virtio-console are implemented. Virtio is widely used in virtualization scenarios, becoming a de facto standard virtual machine I / O device interface, reducing compatibility issues caused by cross-platform compatibility and significantly improving driver development efficiency.
[0044] Reference Figure 2 The diagram shown illustrates the architecture of a virtual network interface card (NIC) provided in this embodiment. The virtual NIC comprises four parts: a transmitter 210, a data transmission channel 220, a statistics counter service 230, and a receiver 240. The transmitter 210 and the receiver 240 are connected via the data transmission channel 220 and share the statistics counter service 230. (Refer to...) Figure 3The diagram shown is a flowchart illustrating a method for obtaining information according to an embodiment of this disclosure, specifically including:
[0045] 310. Call the sending end to transmit data through the data transmission channel and determine whether there is an event to notify the receiving end.
[0046] In this step, the sending end can be either a front-end or a back-end, and the corresponding receiving end can be either a back-end or a front-end. The data transmission channel refers to the data path through which data information is transmitted, providing the function of data transmission. An event refers to any event other than data transmission through the data transmission channel, such as packet loss events.
[0047] Specifically, when the sending end is called to transmit data through the data transmission channel, it is determined whether the sending end has notified the receiving end of any other events besides transmitting data.
[0048] 320. In the case of an event with a notification receiver, update the corresponding statistical counter in the statistical counter service according to the type of the event.
[0049] In this step, the statistical counter service contains various types of statistical counters. In addition to representing the data sent and received, the statistical counters in the statistical counter service can also provide additional information, such as information indicating that the virtual network card's receive buffer is exhausted or that the front end of the virtual network card is losing packets due to a full queue.
[0050] The event type can be either the sender's or receiver's packet loss event type.
[0051] The updated statistical counter in the statistical counter service represents the statistical counter corresponding to the event that notifies the receiver.
[0052] 330. The receiving end is called to query the statistics counter service to obtain the information corresponding to the event.
[0053] In this step, querying refers to finding the statistical counter that was updated in step 320 in the statistical counter service, thereby obtaining the information corresponding to the event.
[0054] Specifically, obtaining information corresponding to an event can be based on the event type. For example, this information could be related to a packet loss event or a virtual network interface card (NIC) receive buffer exhaustion event.
[0055] Based on any of the above embodiments, step 330 includes the following steps S331 to S332:
[0056] S331. The receiving end is called to query the statistical counter service according to the query command to obtain the statistical counter updated by the sending end.
[0057] In this step, the receiving end queries the statistical counter service according to the query command to obtain the statistical counter updated by the sending end. At this time, both the sending end and the receiving end have established a connection with the updated statistical counter.
[0058] S332, Call the receiving end to obtain the information corresponding to the event based on the updated statistical counter.
[0059] In this step, the receiving end obtains the information corresponding to the event based on the updated statistical counter, thus enabling the sending end to send the information corresponding to the event to the receiving end through the statistical counter.
[0060] Based on any of the above embodiments, the sending end is one of the virtual network interface card (NIC) driver and the virtual NIC device, and the receiving end is the other of the virtual NIC driver and the virtual NIC device.
[0061] Specifically, when the sending end is a virtual network interface card (NIC) driver, the corresponding receiving end is a virtual NIC device; when the sending end is a virtual NIC device, the corresponding receiving end is a virtual NIC driver. A virtual NIC driver can be represented as a Virtio Driver, and a virtual NIC device can be represented as a Virtio Device. This disclosure provides a schematic diagram of the structure and flow of a virtual NIC, which can be referred to in detail below. Figure 4 As shown in the figure, the structure of the virtual network card consists of four parts: Virtio Driver 410, Virtio Ring 420, statistics counter service 430, and VirtioDevice 440.
[0062] Based on any of the above embodiments, before step 310, the following steps S311 to S312 are included:
[0063] S311. Call the virtual network card driver to set up a virtual frame buffer in the data transmission channel.
[0064] In this step, the data transmission channel is a path used to transmit data. A virtual frame buffer is set up within this path. The virtual frame buffer can be a Virtio-Ring. The corresponding Virtio-Ring is used to store information about the execution of the sending end driver and the receiving end device program, thus implementing the specific communication mechanism and data flow.
[0065] S312, Invoke the sending end to transmit data through the virtual frame buffer.
[0066] In this step, the sending end is invoked to transmit data via Virtio-Ring.
[0067] Reference Figure 5The diagram shown illustrates the process preceding the corresponding statistical counter in the update statistical counter service provided in this embodiment of the disclosure, specifically including:
[0068] 510, invoke the virtual network card driver to create a statistics counter service in the virtual network card.
[0069] In this step, the virtual network card refers to a virtual network adapter, which is a network environment simulated by software to create a local area network between remote computers.
[0070] The statistical counter service includes various types of statistical counters, and the corresponding statistical counter for an event can be determined based on different event types.
[0071] 520. Call the virtual network card device to determine the label corresponding to the statistical counter supported in the statistical counter service, and determine the memory mapping area of the statistical counter through the memory mapping parameters.
[0072] In this step, the statistical counter service has various types of statistical counters. Different statistical counters correspond to different statistical counter labels. Statistical counter labels can be used to identify the statistical counters corresponding to different event types. For example, a packet loss event corresponds to a packet loss statistical counter and a packet loss statistical counter label.
[0073] The memory-mapped region refers to a region allocated by the virtual network card driver and determined by the virtual network card device in the corresponding statistical counter through memory mapping parameters.
[0074] 530. Call the virtual network card device to identify the tag corresponding to the statistical counter. If the identification is successful, map the memory mapping area of the statistical counter to establish a connection between the virtual network card device and the statistical counter service.
[0075] In this step, mapping can be understood as the virtual network interface card (NIC) driver allocating memory, and the virtual NIC device incorporating the memory allocated by the front end into its own operable address space through mapping, thereby establishing a connection between the virtual NIC device and the statistics counter service.
[0076] The virtual network interface card (NIC) device identifies the tags corresponding to the statistical counters to determine which statistical counters it supports. If identification is successful, it means the virtual NIC device also supports the corresponding statistical counter. The virtual NIC device then maps the memory-mapped region of the statistical counter to establish a connection between itself and the statistical counter service. At this point, both the virtual NIC driver and the virtual NIC device are associated with the statistical counter service, and both support the corresponding statistical counters.
[0077] In one embodiment provided in this disclosure, after invoking the virtual network interface card device to identify the statistical counter label, the method further includes:
[0078] If identification fails, the virtual network card device will display an "Identification Failure" message.
[0079] In this step, recognition failure means that the virtual network interface card device does not support the corresponding statistical counter, and the virtual network interface card device cannot establish a connection with the statistical counter service. In this case, the virtual network interface card device displays recognition failure, and no further operations will be performed.
[0080] Based on any of the above embodiments, the type of event includes at least one of the following:
[0081] Packet loss events caused by the sender or receiver being full, packet loss events caused by the sender or receiver being full due to the connection table being full, packet loss events caused by the sender or receiver being limited by the outgoing bandwidth, and packet loss events caused by the sender or receiver being limited by the incoming bandwidth.
[0082] Correspondingly, the sending end can be either the front-end or the back-end, and the receiving end can be either the front-end or the back-end. Packet loss events caused by the sending end or the receiving end being full can be either front-end packet loss events caused by the queue being full or back-end packet loss events caused by the queue being full.
[0083] The type of the event can be specifically represented in the corresponding statistical counter as follows:
[0084] The event of packet loss due to a full queue at the front end is represented by Driver.out_of_buffer;
[0085] Packet loss events caused by a full queue in the backend are represented by Device.out_of_buffer;
[0086] Packet loss events caused by a full connection table in the backend are represented by Device.conntrack_full;
[0087] Packet loss events caused by backend outgoing bandwidth throttling are represented by Device.out_bw_drop;
[0088] Packet loss events caused by inbound bandwidth throttling in the backend are represented by Device.in_bw_drop.
[0089] Furthermore, the embodiments of this disclosure are further described in detail:
[0090] Taking an event type of packet loss due to queue full at the front end as an example, with the corresponding statistical counter represented by Driver.out_of_buffer, and setting the sender as the front end and the receiver as the back end, using the Virtio Driver as the front end of the virtual network interface card (NIC) and the Virtio Device as the back end, the following explanation is provided. First, a statistical counter service needs to be created in the virtual NIC, referring to... Figure 6 The diagram shown illustrates the specific process of creating a statistical counter service according to an embodiment of this disclosure. The specific steps include:
[0091] 610. The Virtio Driver is invoked to create a statistics counter service in the virtual network interface card (NIC). This statistics counter service, in addition to representing transmitted data, provides extra information, such as indications that packet loss occurred due to a full queue at the virtual NIC's front end. Since the front end is the Virtio Driver, the event type is "Passive driver packet loss due to a full queue."
[0092] 620. Call the Virtio Driver to determine the labels corresponding to the statistical counters supported in the statistical counter service, and determine the memory mapping region of the statistical counters through memory mapping parameters.
[0093] Specifically, since the event type is a packet loss event caused by the Virtio Driver being full, the Virtio Driver is called to determine the statistical counter and corresponding statistical counter label in the statistical counter service corresponding to the packet loss event caused by the Virtio Driver being full. The memory mapping parameters are used to determine the memory mapping area in the statistical counter corresponding to the packet loss event caused by the Virtio Driver being full, so as to provide an area for the Virtio Device to perform mapping in the statistical counter.
[0094] 630. Call the Virtio Device to identify the tag corresponding to the statistical counter.
[0095] Specifically, the Virtio Device identifies the tags corresponding to the statistical counters in order to identify the statistical counters corresponding to packet loss events caused by the Virtio Driver being full.
[0096] 640. If identification is successful, the memory-mapped region of the statistical counter is mapped to establish a connection between the Virtio Device and the statistical counter service.
[0097] Specifically, mapping refers to using a memory-mapped file to map a Virtio Device to a region provided by a statistics counter. The Virtio Device is mapped into this region to establish an association between the Virtio Device and the statistics counter. The provided region is the memory-mapped region.
[0098] If the identification is successful, it means that the Virtio Device supports the statistical counter. The Virtio Device will then map the memory-mapped region of the statistical counter to establish a connection between the Virtio Device and the statistical counter service. At this point, both the Virtio Driver and the Virtio Device support the statistical counter, and both have established a connection with the statistical counter service.
[0099] 650. In the event of recognition failure, the Virtio Device will display a recognition failure message. Recognition failure means that the Virtio Device does not support the statistical counter corresponding to the packet loss event caused by the Virtio Driver being full. A connection cannot be established between the Virtio Device and the statistical counter service, so the Virtio Device will display a recognition failure message, and no further operations will be performed.
[0100] After completing the steps to create the statistical counter service described above, the virtual network interface card (NIC) now consists of four parts: the Virtio Driver, the Virtio Ring, the statistical counter service, and the VirtioDevice device. The Virtio Driver and the VirtioDevice device are connected via the Virtio Ring, sharing the statistical counter service and enabling communication between them. (Refer to...) Figure 7 The diagram shown is a flowchart illustrating the information acquisition process provided in this embodiment of the disclosure. Specific steps include:
[0101] 710. Call the Virtio Driver to set up a virtual frame buffer in the data transmission channel, transmit data through the virtual frame buffer, and determine whether there is an event that notifies the Virtio Device.
[0102] In this step, the virtual frame buffer refers to the Virtio Ring.
[0103] Correspondingly, this can be understood as calling the Virtio Driver to set up the VirtioRing within the data transmission channel, transmitting data through the Virtio Ring, and determining whether there is an event that notifies the Virtio Device.
[0104] 720. In the event that a notification is received from the Virtio Device, determine the type of event and update the corresponding statistical counter in the statistical counter service.
[0105] Specifically, the event type is Virtio Driver packet loss event due to queue full. Based on this event type, the corresponding statistical counter in the statistical counter service is updated, that is, Driver.out_of_buffer is updated.
[0106] 730. Call the Virtio Device to query the statistics counter service to obtain information corresponding to the packet loss event caused by the Virtio Driver being full.
[0107] Specifically, the Virtio Device is invoked to query the statistics counter service according to the query command to obtain the statistics counter updated by the Virtio Driver. The Virtio Device is then invoked to obtain the information corresponding to the packet loss event caused by the Virtio Driver being full due to the queue being full based on the updated statistics counter. That is, this information is the packet loss information caused by the Virtio Driver being full due to the queue being full.
[0108] Specifically, the query refers to finding the statistical counter updated in step 720 in the statistical counter service, thereby obtaining information corresponding to the packet loss event caused by the Virtio Driver being full.
[0109] The Virtio Device queries the statistics counter service according to the query command to obtain the statistics counter updated by the Virtio Driver. At this time, both the Virtio Driver and the Virtio Device establish a connection with the updated statistics counter. The updated statistics counter is the statistics counter corresponding to the packet loss event caused by the Virtio Driver's queue being full. Therefore, the Virtio Device can obtain the information corresponding to the event by using the statistics counter corresponding to the packet loss event caused by the Virtio Driver's queue being full.
[0110] Based on any of the above embodiments Figure 8This is a schematic diagram of a device for acquiring information according to an embodiment of the present disclosure. The device is located on a virtual network interface card (NIC), which includes a transmitter and a receiver. The transmitter and receiver are connected via a data transmission channel and share a statistical counter service. The device specifically includes:
[0111] The judgment module 810 is used to call the sending end to transmit data through the data transmission channel and to determine whether there is an event that notifies the receiving end.
[0112] In this step, the sending end can be either a front-end or a back-end, and the corresponding receiving end can be either a back-end or a front-end. The data transmission channel refers to the data path through which data information is transmitted, providing the function of data transmission. An event refers to any event other than data transmission through the data transmission channel, such as packet loss events.
[0113] Specifically, when the sending end is called to transmit data through the data transmission channel, it is determined whether the sending end has notified the receiving end of any other events besides transmitting data.
[0114] The update module 820 is used to update the corresponding statistical counter in the statistical counter service according to the type of the event when there is an event that notifies the receiving end.
[0115] In this step, the statistical counter service contains various types of statistical counters. In addition to representing the data sent and received, the statistical counters in the statistical counter service can also provide additional information, such as information indicating that the virtual network card's receive buffer is exhausted or that the front end of the virtual network card is losing packets due to a full queue.
[0116] The event type can be either the sender's or receiver's packet loss event type.
[0117] The updated statistical counter in the statistical counter service represents the statistical counter corresponding to the event that notifies the receiver.
[0118] The acquisition module 830 is used to call the receiving end to query the statistical counter service and obtain the information corresponding to the event.
[0119] In this step, querying refers to finding the statistical counter that was updated in step 320 in the statistical counter service, thereby obtaining the information corresponding to the event.
[0120] Specifically, obtaining information corresponding to an event can be based on the event type. For example, this information could be related to a packet loss event or a virtual network interface card (NIC) receive buffer exhaustion event.
[0121] This disclosure provides an information acquisition device that, by invoking the sending end to transmit data through the data transmission channel, determines whether there is an event to notify the receiving end. This determination effectively avoids situations where data cannot be sent to the receiving end due to processing problems at the sending end. Since different event types correspond to different statistical counters, when an event to notify the receiving end occurs, the corresponding statistical counter in the statistical counter service is updated according to the event type. The receiving end then queries the statistical counter service to obtain the information corresponding to the event. This enables the receiving end to receive not only transmitted data but also additional event information provided by the sending end.
[0122] Based on any of the above embodiments, the acquisition module 830 is specifically used for:
[0123] The receiving end is invoked to query the statistical counter service according to the query command to obtain the statistical counter updated by the sending end.
[0124] The receiving end is invoked to obtain the information corresponding to the event based on the updated statistical counter.
[0125] Based on any of the above embodiments, the sending end is one of the virtual network card driver and the virtual network card device, and the receiving end is the other of the virtual network card driver and the virtual network card device.
[0126] Based on any of the above embodiments, before the determination module 810, the following specific functions are performed:
[0127] The virtual network card driver is invoked to set up a virtual frame buffer within the data transmission channel.
[0128] The sending end is invoked to transmit data through the virtual frame buffer.
[0129] Based on any of the above embodiments, before updating the corresponding statistical counter in the statistical counter service in the update module 820, the following steps are included:
[0130] A creation unit is used to call the virtual network card driver to create a statistical counter service in the virtual network card.
[0131] The calling unit is used to call the virtual network card device to determine the label corresponding to the statistical counter supported in the statistical counter service, and to determine the memory mapping area of the statistical counter through memory mapping parameters.
[0132] The identification unit is used to call the virtual network interface card device to identify the tag corresponding to the statistical counter. If the identification is successful, the memory mapping area of the statistical counter is mapped to establish a connection between the virtual network interface card device and the statistical counter service.
[0133] Based on any of the above embodiments, after the identification unit calls the virtual network card device to identify the statistical counter tag, it further includes:
[0134] The display unit is used to call the virtual network card device to display the recognition failure in the event of recognition failure.
[0135] Based on any of the above embodiments, the type of the event includes at least one of the following, specifically:
[0136] Packet loss events caused by the sender or receiver being full, packet loss events caused by the sender or receiver being full due to the connection table being full, packet loss events caused by the sender or receiver being limited by the outgoing bandwidth, and packet loss events caused by the sender or receiver being limited by the incoming bandwidth.
[0137] Figure 9 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 9 As shown, the electronic device may include a processor 910, a communications interface 920, a memory 930, and a communication bus 940. The processor 910, communications interface 920, and memory 930 communicate with each other via the communication bus 940. The processor 910 can call logical instructions in the memory 930 to execute a method for acquiring information, applied to a virtual network interface card (NIC). The virtual NIC includes a transmitter and a receiver, which are connected via a data transmission channel and share a statistical counter service. The method specifically includes: calling the transmitter to transmit data through the data transmission channel and determining whether there is an event notifying the receiver; if there is an event notifying the receiver, updating the corresponding statistical counter in the statistical counter service according to the type of the event; and calling the receiver to query the statistical counter service to obtain information corresponding to the event.
[0138] Furthermore, the logical instructions in the aforementioned memory 930 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0139] On the other hand, this disclosure also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute a method for obtaining information provided by the above methods, applied to a virtual network interface card (NIC). The virtual NIC includes a sending end and a receiving end, which are connected through a data transmission channel and share a statistical counter service. The method specifically includes: calling the sending end to transmit data through the data transmission channel and determining whether there is an event that notifies the receiving end; if there is an event that notifies the receiving end, updating the corresponding statistical counter in the statistical counter service according to the type of the event; and calling the receiving end to query the statistical counter service to obtain information corresponding to the event.
[0140] In another aspect, this disclosure also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements a method for acquiring information provided by the methods described above, applied to a virtual network interface card (NIC). The virtual NIC includes a sending end and a receiving end, which are connected via a data transmission channel and share a statistical counter service. The method specifically includes: calling the sending end to transmit data through the data transmission channel and determining whether there is an event that notifies the receiving end; if there is an event that notifies the receiving end, updating the corresponding statistical counter in the statistical counter service according to the type of the event; and calling the receiving end to query the statistical counter service to obtain information corresponding to the event.
[0141] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0142] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0143] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this disclosure, and are not intended to limit them. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure.
Claims
1. A method for acquiring information, characterized in that, This is applied to a virtual network interface card (NIC), which includes a transmitter and a receiver. The transmitter and receiver are connected via a data transmission channel and share a statistical counter service, specifically including: The sending end is invoked to transmit data through the data transmission channel, and it is determined whether there is an event that notifies the receiving end; In the event that notifies the receiving end, the corresponding statistical counter in the statistical counter service is updated according to the type of the event; The receiving end is invoked to query the statistical counter service to obtain information corresponding to the event; The sending end is one of the virtual network interface card (NIC) driver and the virtual NIC device, and the receiving end is the other of the virtual NIC driver and the virtual NIC device; Before updating the corresponding statistical counter in the statistical counter service, the following steps are included: The virtual network interface driver is invoked to create a statistical counter service in the virtual network interface. The virtual network interface card device is invoked to determine the label corresponding to the statistical counter supported in the statistical counter service, and the memory mapping area of the statistical counter is determined through the memory mapping parameters; The virtual network interface card (NIC) device is invoked to identify the tag corresponding to the statistical counter. If the identification is successful, the memory mapping area of the statistical counter is mapped to establish a connection between the virtual NIC device and the statistical counter service.
2. The method for acquiring information according to claim 1, characterized in that, The process of calling the receiving end to query the statistical counter service and obtain information corresponding to the event includes: The receiving end is invoked to query the statistical counter service according to the query command to obtain the statistical counter updated by the sending end; The receiving end is invoked to obtain the information corresponding to the event based on the updated statistical counter.
3. The method for acquiring information according to claim 1, characterized in that, Before invoking the sending end to transmit data through the data transmission channel, the following steps are included: The virtual network card driver is invoked to set up a virtual frame buffer within the data transmission channel; The sending end is invoked to transmit data through the virtual frame buffer.
4. The method for acquiring information according to claim 1, characterized in that, After the virtual network interface card device is invoked to identify the statistical counter label, the method further includes: If identification fails, the virtual network card device will display an error message indicating identification failure.
5. The method for acquiring information according to claim 1, characterized in that, The types of events include at least one of the following, specifically: Packet loss events caused by the sender or receiver being full, packet loss events caused by the sender or receiver being full due to the connection table being full, packet loss events caused by the sender or receiver being limited by the outgoing bandwidth, and packet loss events caused by the sender or receiver being limited by the incoming bandwidth.
6. An apparatus for acquiring information, characterized in that, The device is configured in a virtual network interface card (NIC), which includes a transmitter and a receiver. The transmitter and receiver are connected via a data transmission channel and share a statistical counter service. Specifically, the device includes: The judgment module is used to call the sending end to transmit data through the data transmission channel and to determine whether there is an event that notifies the receiving end; The update module is used to update the corresponding statistical counter in the statistical counter service according to the type of the event when there is an event that notifies the receiving end. The acquisition module is used to call the receiving end to query the statistical counter service and obtain the information corresponding to the event; The sending end is one of the virtual network interface card (NIC) driver and the virtual NIC device, and the receiving end is the other of the virtual NIC driver and the virtual NIC device; Before updating the corresponding statistical counter in the statistical counter service in the update module, the following steps are included: A creation unit is used to call the virtual network card driver to create a statistical counter service in the virtual network card; The calling unit is used to call the virtual network card device to determine the label corresponding to the statistical counter supported in the statistical counter service, and to determine the memory mapping area of the statistical counter through the memory mapping parameters; The identification unit is used to call the virtual network interface card device to identify the tag corresponding to the statistical counter. If the identification is successful, the memory mapping area of the statistical counter is mapped to establish a connection between the virtual network interface card device and the statistical counter service.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method for acquiring information as described in any one of claims 1 to 5.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method for acquiring information as described in any one of claims 1 to 5.
9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method for acquiring information as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Network card error event collection method and system for Linux system
CN106161087A
Method and device for achieving SR-IOV network card, and method and device for achieving live migration
CN106557444A