1588 network card device supporting virtualization of synchronous clock resources

By utilizing the clock synchronization mechanism and resource virtualization technology of the 1588 network interface card (NIC) device, the problems of high-precision synchronization clock resource degradation and inflexible resource allocation on the NIC are solved, enabling high-precision time synchronization and flexible resource allocation between heterogeneous systems and improving the adaptability of the NIC device.

CN121150856APending Publication Date: 2025-12-16SANXIA JINSHAJIANG YUNCHUAN HYDROPOWER DEV CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511234966.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-01
Publication Date
2025-12-16

AI Technical Summary

Technical Problem

The timer resources on the network card that rely on a high-precision synchronous clock source are corrupted, and the resources are globally owned and cannot be flexibly allocated among heterogeneous systems.

Method used

By introducing a clock synchronization mechanism that incorporates neighbor rate ratio, delay measurement, time offset, and time convergence state offset, and combining network card resource virtualization and clock virtualization, an independent hardware clock source and a virtual logical clock source are adopted to achieve flexible switching between synchronous and asynchronous modes, supporting high-precision time synchronization of 1588 network card devices.

Benefits of technology

The performance and reliability of the 1588 network interface card (NIC) device in supporting synchronous clock resource virtualization have been improved, enabling high-precision time synchronization and flexible resource allocation between heterogeneous systems, and enhancing the adaptability of the NIC device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121150856A_ABST
    Figure CN121150856A_ABST
Patent Text Reader

Abstract

The invention discloses a 1588 network card device, system, equipment and medium supporting synchronous clock resource virtualization, and belongs to the technical field of power system energy storage equipment, comprising clock synchronization, network card resource virtualization and network card clock virtualization. The clock synchronization comprises neighbor rate ratio, delay measurement, time offset and time convergence state offset; the network card resource virtualization comprises a physical function and a virtual function; the network card clock virtualization comprises a bottom-layer physical clock source, a virtual logic clock source, a PFTIMER and an upper-layer virtual timer, and has the beneficial effects that three core problems of multi-clock domain management, virtual machine clock isolation and high-precision timing in a multi-core heterogeneous system are solved through a hardware clock virtualization layered architecture; the complexity of system software is remarkably reduced, the real-time performance is improved, and a basic clock support is provided for a next-generation intelligent network card.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer networks, and in particular to a 1588 network card device supporting synchronization clock resource virtualization. BACKGROUND

[0002] Virtualization technology can abstract and isolate resources, improve computing efficiency, flexibility and manageability, and we can run multiple non-real-time (linux and Windows) and real-time heterogeneous systems on a platform with rich hardware resources and supporting hardware virtualization.

[0003] Due to the isolation between systems / hardware, the clock synchronization between systems generally uses NTP / SNTP protocol to synchronize through the internal network, which is affected by factors such as task scheduler jitter, network protocol stack processing delay, and the synchronization accuracy is in the order of milliseconds.

[0004] In high-precision motion control, power systems, 5G industrial Internet of Things environments, high-precision time synchronization is required for system coordination. For performance, physical network cards can also be directly taken over by virtual machine systems in a straight-through manner. SR-IOV (Single Root I / O Virtualization) allows physical network cards to be virtualized into multiple virtual functions (VF), each of which can be directly assigned to a virtual machine, bypassing the overhead of the virtualization layer and reducing latency. PTP can provide sub-microsecond time synchronization. Combining the two can significantly improve the time synchronization accuracy of virtual machines. However, generally, PTP-enabled network card VFs do not support hardware timestamps, and only PFs support hardware timestamps. Only a small number of high-end network cards support hardware timestamp functions.

[0005] It is best for a virtual machine to synchronize a high-precision clock from the outside world, and other virtual machines to automatically share this high-precision clock source. The current general approach is: a master VM directly accesses a PTP-enabled PF to synchronize a high-precision clock from the outside world, and the master VM acts as a PTP master clock, while other VMs act as slave clocks: but the network between virtual machines needs to support PTP, and PTP transparent clock function may need to be enabled on the virtual switch, or SR-IOV VF pass-through network cards are used, but as mentioned earlier, VFs may not support hardware timestamps, resulting in insufficient accuracy, and other VMs synchronize to the master VM through NTP: here the master VM needs to be configured as an NTP server, and other VMs as clients. But the accuracy of NTP may be in the order of milliseconds, which cannot meet the high-precision requirement, and time information is delivered through shared memory or virtual devices: for example, a virtual device or shared memory area is used, and the master VM broadcasts an inter-core interrupt message IPI to write the time, and other VMs read it. But it needs to be developed and implemented, and the complexity is high. Due to factors such as interrupt delay jitter, the accuracy is also close to the order of milliseconds.

[0006] Currently, timer resources on network cards that rely on high-precision synchronous clock sources are rampant, and these resources are globally owned and cannot be flexibly allocated among heterogeneous systems. Summary of the Invention

[0007] In view of the above-mentioned problems, the present invention is proposed.

[0008] Therefore, the technical problem solved by this invention is that the timer resources on network cards that rely on high-precision synchronous clock sources are currently rampant, and the resources are globally owned and cannot be flexibly allocated among heterogeneous systems.

[0009] To solve the above-mentioned technical problems, the present invention provides the following technical solution: a 1588 network card device supporting synchronous clock resource virtualization, comprising,

[0010] Clock synchronization, network interface card (NIC) resource virtualization, and NIC clock virtualization;

[0011] The clock synchronization includes neighbor rate ratio, delay measurement, time offset, and time convergence state offset;

[0012] The network interface card (NIC) resource virtualization includes physical functions and virtual functions;

[0013] The network interface card clock virtualization includes a bottom-level physical clock source, a virtual logical clock source, a PFTIMER, and an upper-level virtual timer.

[0014] As a preferred embodiment of the 1588 network card device supporting synchronous clock resource virtualization according to the present invention, the virtualization function includes:

[0015] Lightweight execution units derived from PF. Each VF appears as an independent PCIe device. VF contains a subset of device functions. When a VF is assigned to a virtual machine, the virtual machine operating system loads a dedicated VF driver, which directly manipulates the hardware queue for data sending and receiving.

[0016] As a preferred embodiment of the 1588 network card device supporting synchronous clock resource virtualization described in this invention, wherein: the neighbor rate ratio includes,

[0017] The formula for calculating the neighbor rate ratio is as follows:

[0018] NBR_RR=(t8-t3) / (t9-t4)

[0019] In the formula, t3 is the time when the master device sends the Pdelay_Resp message, t4 is the time when the slave device receives the Pdelay_Resp message, t8 is the time when the master device sends the Pdelay_Resp_Follow_Up message, and t9 is the time when the slave device receives the Pdelay_Resp_Follow_Up message.

[0020] It should be noted that by introducing the key parameter of neighbor rate ratio, the clock frequency difference between adjacent nodes can be effectively measured. It is calculated based on the time t3 when the master device sends the Pdelay_Resp message, the time t4 when the slave device receives the message, the time t8 when the master device sends the Pdelay_Resp_Follow_Up message, and the time t9 when the slave device receives the message. This can ensure that devices in the network achieve high-precision time synchronization and improve the performance and reliability of the 1588 network card device in terms of supporting virtualization of synchronous clock resources.

[0021] As a preferred embodiment of the 1588 network card device supporting synchronous clock resource virtualization described in this invention, wherein: the delay measurement includes,

[0022] Delay measurement eliminates time deviations introduced by transmission path delays in the network. The calculation formula is as follows:

[0023] Delay=((T4-T1)*NBR_RR–(T3-T2)) / 2

[0024] In the formula, T1 is the precise timestamp recorded by the hardware when the master device sends the Pdelay_Req message, T2 is the precise timestamp recorded by the hardware when the slave device receives the Pdelay_Req message, T3 is the precise timestamp recorded by the hardware when the slave device sends the Pdelay_Resp message, T4 is the precise timestamp recorded by the hardware when the master device receives this Pdelay_Resp message, and NBR_RR is the neighbor rate ratio.

[0025] It should be noted that the time deviation caused by network transmission path delay is eliminated by delay measurement. It is calculated based on the hardware precise timestamp T1 of the Pdelay_Req message sent by the master device, the hardware precise timestamp T2 of the message received by the slave device, the hardware precise timestamp T3 of the Pdelay_Resp message sent by the slave device, the hardware precise timestamp T4 of the message received by the master device, and the neighbor rate ratio. This can effectively ensure the time synchronization accuracy and enhance the 1588 network card device's support for the virtualization of synchronous clock resources.

[0026] As a preferred embodiment of the 1588 network card device supporting synchronous clock resource virtualization described in this invention, wherein: the time offset includes,

[0027] The formula for calculating time offset is as follows:

[0028] Offset = T2 – T1 – Delay

[0029] In the formula, T1 is the precise timestamp recorded by the hardware of the master device when it sends the Sync message, T2 is the precise timestamp recorded by the hardware of the slave device when it receives the Sync message, and Delay is the delay measurement.

[0030] As a preferred embodiment of the 1588 network interface card device supporting synchronous clock resource virtualization described in this invention, the time convergence state offset includes:

[0031] Inputting the offset into the time convergence algorithm returns the following four states:

[0032] UNLOCKED: The deviation from the master clock is too large, and no hardware operation is performed;

[0033] JUMP: Significantly adjusts the second and nanosecond counts;

[0034] LOCKED: Fine-tune the nanosecond count. If it is in this state for 3 consecutive times, switch LOCKED_STABLE.

[0035] LOCKED_STABLE: Fine-tune the nanosecond count.

[0036] As a preferred embodiment of the 1588 network card device supporting synchronous clock resource virtualization described in this invention, the underlying physical clock source includes:

[0037] Independent hardware clock sources, multiple hardware clock sources are deployed and independently calibrated and corrected, enabling heterogeneous network card-based systems to span multiple clock domains;

[0038] The working mode is configurable, supporting synchronous and asynchronous modes;

[0039] In synchronization mode, HWCLOCKSOURCEs are automatically synchronized with priority based on the hardware clock source sequence number, and the entire hardware system uses a single reference clock.

[0040] In asynchronous mode, each clock source is independently calibrated and corrected according to its different clock domain.

[0041] It should be noted that the underlying physical clock source includes independent hardware clock sources, multiple of which can be deployed and support independent calibration and correction, enabling heterogeneous systems based on this network card to span multiple clock domains. Furthermore, the operating mode of this underlying physical clock source is configurable, compatible with synchronous and asynchronous modes: in synchronous mode, the hardware clock sources automatically synchronize, with synchronization priority based on the hardware clock source sequence number, and the entire hardware system uses a unified reference clock; in asynchronous mode, each hardware clock source performs independent calibration and correction according to its own clock domain. The beneficial effects of the above technical solution are that, through the deployment of multiple hardware clock sources and independent calibration capabilities, it meets the operational requirements of heterogeneous systems across multiple clock domains. Combined with configurable synchronous and asynchronous modes, it ensures hardware system clock consistency during synchronization and provides flexibility for autonomous calibration in asynchronous modes for each clock domain. This adapts to the overall clock resource virtualization architecture of the network card device and provides reliable underlying support for upper-layer system clock synchronization and resource allocation, improving the adaptability and operational stability of the device's clock management.

[0042] As a preferred embodiment of the 1588 network card device supporting synchronous clock resource virtualization described in this invention, the virtual logical clock source includes:

[0043] VFCLOCKSOURCE virtual logic clock source is selected;

[0044] After enabling the VFCLOCKSOURCE feature in HWCLOCKSOURCE, one HWCLOCKSOURCE can abstract five VFCLOCKSOURCE instances, allowing for reading and writing of the HWCLOCKSOURCE.

[0045] VFCLOCKSOURCE is passed directly to the VM via PF and VF bindings;

[0046] Configure the priority attribute separately; the default priority is:

[0047] VFCLOCKSOURCE1>VFCLOCKSOURCE2>VFCLOCKSOURCE3>VFCL OCKSOURCE4>VFCLOCKSOURCE5;

[0048] The highest priority VFCLOCKSOURCE has permission to modify and correct the HWCLOCKSOURCE, while other VFCLOCKSOURCEs only have read permissions.

[0049] It should be noted that by using the VFCLOCKSOURCE virtual logical clock source, after enabling the VFCLOCKSOURCE function in HWCLOCKSOURCE, five VFCLOCKSOURCE instances can be abstracted and read from and written to HWCLOCKSOURCE. These instances are directly transmitted to the VM via PF / VF binding, and each instance is configured with a separate priority (VFCLOCKSOURCE1 to VFCLOCKSOURCE5 by default, decreasing sequentially). The highest priority instance has the right to modify and correct HWCLOCKSOURCE, while the others only have read permissions. This improves the flexibility and controllability of clock resource virtualization and enhances the adaptability of 1588 network card devices.

[0050] As a preferred embodiment of the 1588 network card device supporting synchronous clock resource virtualization described in this invention, wherein: PFTIMER includes,

[0051] PFTIMER1588 timer, PFTIMER1 belongs to the VFCLOCKSOURCE clock source;

[0052] The reference time base is the HWCLOCKSOURCE to which VFCLOCKSOURCE belongs.

[0053] As a preferred embodiment of the 1588 network card device supporting synchronous clock resource virtualization described in this invention, the upper-layer virtual timer includes:

[0054] VFTIMER1588 timer is selected, PFTIMER enables VFTIMER function, one PFTIMER abstracts 8 VFTIMER, VFTIMER is bound to PF, VF is passed directly to VM;

[0055] Internally, VFTIMER employs secondary timer management. It sorts and schedules events based on a PFTIMER, selecting the smallest node and setting its parameters accordingly. The PFTIMER relies on the HWCLOCKSOURCE clock source associated with the VFCLOCKSOURCE for counting. Once a PFTIMER event occurs, it is mapped to the corresponding VFTIMER and then reported to the bound VM system. At the operating system level, specific timed events can be bound to dedicated hardware timers (VFTIMERs) for real-time event processing.

[0056] The beneficial effects of this invention are as follows: Synchronous clock resource virtualization is achieved by integrating clock synchronization, network interface card (NIC) resource virtualization, and NIC clock virtualization functions. Clock synchronization utilizes neighbor rate ratio, latency measurement, time offset, and time convergence state offset to ensure high-precision time calibration. The neighbor rate ratio and latency measurement are calculated based on the Pdelay message timestamp and T1-T4 hardware timestamps, respectively. The time offset is obtained from the Sync message timestamp and latency results. The time convergence algorithm returns four adjustment states—UNLOCKED, JUMP, LOCKED, and LOCKED_STABLE—based on the offset. NIC resource virtualization uses PF-derived V... After F and VF are allocated to virtual machines as independent PCIe devices, the hardware queue for sending and receiving data is directly controlled by a dedicated driver. The network card clock virtualization configuration has an independent and calibrable underlying physical clock source, which is paired with the VFCLOCKSOURCE virtual logical clock source. Through the PFTIMER belonging to the VFCLOCKSOURCE and referencing the corresponding HWCLOCKSOURCE, combined with the 8 VFTIMERs abstracted from it, the VM can bind a dedicated hardware timer to handle timed events. This improves the accuracy, flexibility and hardware utilization efficiency of clock resource virtualization, and enhances the network card's adaptability to clock synchronization of heterogeneous systems and the timing requirements of virtual machines. Attached Figure Description

[0057] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0058] Figure 1 This is a flowchart illustrating the overall process of a 1588 network interface card (NIC) device supporting synchronous clock resource virtualization, as provided in one embodiment of the present invention.

[0059] Figure 2 This is a schematic diagram of the clock synchronization message header of a 1588 network card device that supports synchronous clock resource virtualization, provided as an embodiment of the present invention.

[0060] Figure 3 This is a schematic diagram of the neighbor rate ratio of a 1588 network card device that supports synchronous clock resource virtualization, provided as an embodiment of the present invention.

[0061] Figure 4 This is a schematic diagram of delay measurement for a 1588 network card device that supports synchronous clock resource virtualization, provided as an embodiment of the present invention.

[0062] Figure 5This is a time offset diagram of a 1588 network card device that supports synchronous clock resource virtualization, provided as an embodiment of the present invention.

[0063] Figure 6 This is a schematic diagram of the time convergence state transition of a 1588 network card device that supports synchronous clock resource virtualization, provided as an embodiment of the present invention.

[0064] Figure 7 This is a schematic diagram of network card clock virtualization for a 1588 network card device that supports synchronous clock resource virtualization, provided as an embodiment of the present invention.

[0065] Figure 8 This is a schematic diagram of the hardware resource configuration method of a 1588 network card device that supports synchronous clock resource virtualization, as provided in an embodiment of the present invention.

[0066] Figure 9 This is a schematic diagram illustrating the allocation of network card resources in a single-machine multi-heterogeneous system of a 1588 network card device that supports synchronous clock resource virtualization, as provided in an embodiment of the present invention. Detailed Implementation

[0067] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of the present invention.

[0068] Example 1, referring to Figure 1 This is one embodiment of the present invention, which provides a 1588 network interface card device that supports synchronous clock resource virtualization, comprising:

[0069] Clock synchronization, network interface card (NIC) resource virtualization, and NIC clock virtualization;

[0070] The clock synchronization includes neighbor rate ratio, delay measurement, time offset, and time convergence state offset;

[0071] The network interface card (NIC) resource virtualization includes physical functions and virtual functions;

[0072] The network interface card clock virtualization includes a bottom-level physical clock source, a virtual logical clock source, a PFTIMER, and an upper-level virtual timer.

[0073] Reference Figure 2 The clock synchronization message includes:

[0074] In time-sensitive networks, dedicated time synchronization protocols are needed between device nodes to achieve high-precision clock synchronization. gPTP (Generalized Precision Time Protocol) is a high-precision time synchronization protocol defined in the IEEE 802.1AS standard. It is the core protocol in the TSN ecosystem. Through hardware timestamps, low latency compensation and lightweight design, it is designed specifically for time-sensitive networks (TSN).

[0075] The fields are explained below:

[0076] transportSpecific is a fixed value of 1;

[0077] messageType, message type (0.5 octets = 4 bits), different values ​​represent different PTP messages;

[0078] versionPTP, PTP version (0.5 octets = 4 bits), fixed value is 2;

[0079] domainNumber, PTP domain sequence number (1 octet = 8 bits), for normal clocks and boundary clocks, the value here is the variable defaultDSdomainNumber in the dataset. TC describes the time domain to which the initial message sending device belongs, and its value is equal to transparentClockDefaultDS.primaryDomain. Management message: describes the target time domain to which the message is to be sent;

[0080] flagField, flag field (2 octets = 16 bits), typically, the two-step flag field (twoStepFlag) is 1 to indicate two-step mode, that is, there is a follow-up message after the synchronization message;

[0081] The correction field (8 octets = 64 bits) transmits the dwell time of transparent clocks, the link delay of point-to-point transparent clocks, and asymmetric compensation.

[0082] sourcePortIdentity, the source port number (10 octets = 80 bits), is an attribute of the sending port, typically composed of a MAC address;

[0083] sequenceID, sequence number (2 octets = 16 bits), used to distinguish multiple messages of the same type sent from the same port;

[0084] controlField, control field (1 octet = 8 bits), the value here is determined by the value of the message type field, that is, the value is different according to different message types;

[0085] logMessageInterval, the logarithmic message interval (1 octet = 8 bits), includes the logarithmic interval for sending declaration messages, the logarithmic interval for sending synchronization messages, and the logarithmic interval for sending delayed request response messages. Their values ​​are logarithmic to the base 2.

[0086] Reference Figure 3 The neighbor rate ratio includes:

[0087] Neighbor rate ratio is a key parameter used to measure the clock frequency difference between neighboring nodes, ensuring high-precision time synchronization of devices within the network. Its calculation formula is as follows:

[0088] NBR_RR=(t8-t3) / (t9-t4)

[0089] In the formula, t3 is the time when the master device sends the Pdelay_Resp message, t4 is the time when the slave device receives the Pdelay_Resp message, t8 is the time when the master device sends the Pdelay_Resp_Follow_Up message, and t9 is the time when the slave device receives the Pdelay_Resp_Follow_Up message.

[0090] Reference Figure 4 The delay measurement includes:

[0091] Delay measurement is a core component in ensuring high-precision time synchronization. It aims to eliminate time deviations introduced by transmission path delays in the network. The calculation formula is as follows:

[0092] Delay=((T4-T1)*NBR_RR–(T3-T2)) / 2

[0093] In the formula, T1 is the precise timestamp recorded by the hardware when the master device sends the Pdelay_Req message, T2 is the precise timestamp recorded by the hardware when the slave device receives the Pdelay_Req message, T3 is the precise timestamp recorded by the hardware when the slave device sends the Pdelay_Resp message, T4 is the precise timestamp recorded by the hardware when the master device receives this Pdelay_Resp message, and NBR_RR is the neighbor rate ratio.

[0094] Reference Figure 5 The time offset includes:

[0095] The clock time difference between the slave node and the master node. Eliminating time skew is one of the core objectives of achieving high-precision time synchronization, and its calculation formula is as follows:

[0096] Offset = T2 – T1 – Delay

[0097] In the formula, T1 is the precise timestamp recorded by the hardware of the master device when it sends the Sync message, T2 is the precise timestamp recorded by the hardware of the slave device when it receives the Sync message, and Delay is the delay measurement.

[0098] Reference Figure 6 The time convergence state offset includes:

[0099] Inputting the offset into the time convergence algorithm returns the following four states:

[0100] UNLOCKED: The deviation from the master clock is too large, and no hardware operation is performed;

[0101] JUMP: Significantly adjusts the second and nanosecond counts;

[0102] LOCKED: Fine-tune the nanosecond count. If it is in this state for 3 consecutive times, switch LOCKED_STABLE.

[0103] LOCKED_STABLE: Fine-tune the nanosecond count.

[0104] It should be noted that in Time-Sensitive Networks (TSNs), each device node relies on gPTP to achieve high-precision clock synchronization, which adapts to TSN requirements through hardware timestamps, low-latency compensation, and lightweight design. The neighbor rate ratio is a key parameter for measuring the difference in clock frequencies between adjacent nodes. The calculation formula involves the time it takes for the master device to send Pdelay_Resp(t3) and Pdelay_Resp_Follow_Up(t8), and for the slave device to receive the corresponding messages (t4, t9). Delay measurement is the core step in eliminating transmission path delay deviations. The formula involves the hardware timestamps and neighbor rate ratios of the master device sending (T1) and the slave device receiving (T2) Pdelay_Req, and the slave device sending (T3) and the master device receiving (T4) Pdelay_Resp. Time offset refers to the time difference between the slave node and the master node. Clock discrepancy is the core objective of synchronization. The formula involves the hardware timestamps and delay measurements of the master device sending Sync(T1) and the slave device receiving Sync(T2). The time convergence state offset is generated by the Offset input convergence algorithm and includes four states: UNLOCKED (no hardware operation due to excessive deviation), JUMP, LOCKED (fine-tuning nanosecond count), and LOCKED_STABLE. By clarifying the gPTP message structure, key parameter calculation, and state judgment criteria, a complete high-precision clock synchronization mechanism is constructed to ensure the clock consistency of TSN devices and support the stable operation of time-sensitive services.

[0105] The physical functions include:

[0106] SR-IOV is a hardware-assisted I / O virtualization technology standard that allows a single physical network interface card (NIC) to be divided into multiple independent virtual devices. Its core value lies in solving the performance bottleneck problem in traditional software virtualization. In traditional virtualization environments, when multiple virtual machines share a physical NIC, all network data needs to be processed through the hypervisor's software switch, which leads to significant CPU overhead and network latency. SR-IOV, by implementing virtualization at the hardware level, enables each virtual machine to achieve network performance close to that of a native physical device.

[0107] The Physical Function (PF) is the core control entity in the SR-IOV architecture, representing the complete set of functions of a physical device. The PF not only possesses all the capabilities of a standard PCIe device but also shoulders the crucial responsibility of virtualization resource management. Currently, the hardware clock resources of most network interface cards (NICs) are managed by the PF and cannot be flexibly configured as needed.

[0108] The virtual functions include:

[0109] Virtual Functions (VFs) are lightweight execution units derived from Power Processors (PFs), with each VF appearing as an independent PCIe device. Unlike PFs, VFs contain only a subset of device functionality, primarily focusing on data plane processing capabilities. When a VF is assigned to a virtual machine, the virtual machine's operating system loads a dedicated VF driver (such as Intel's iavf driver), which directly manipulates hardware queues for data transmission and reception. This architecture achieves revolutionary performance breakthroughs: network latency is reduced from the 100 microseconds of traditional virtualization to around 5 microseconds, CPU overhead is reduced by more than 70%, and throughput can reach over 95% of that of physical network cards.

[0110] Reference Figure 7 The underlying physical clock source includes:

[0111] Independent hardware clock sources allow for the deployment of multiple hardware clock sources, each calibrated and corrected independently. This enables heterogeneous network interface card-based systems to span multiple clock domains.

[0112] The working mode is configurable, supporting synchronous and asynchronous modes:

[0113] In synchronization mode, HWCLOCKSOURCEs are automatically synchronized with priority based on the hardware clock source sequence number, and the entire hardware system uses a single reference clock.

[0114] In asynchronous mode, each clock source is independently calibrated and corrected according to its different clock domain.

[0115] It should be noted that the underlying physical clock source includes independent hardware clock sources. These clock sources support multi-node deployment and independent calibration, enabling NIC-based heterogeneous systems to smoothly span multiple clock domains. Their operating mode is configurable, allowing flexible switching between synchronous and asynchronous modes: in synchronous mode, each hardware clock source automatically synchronizes, prioritizing each other based on its clock source number, ultimately ensuring the entire hardware system uses a single reference clock; in asynchronous mode, each clock source performs independent calibration based on its respective clock domain. The advantages of this technical solution are that, through the design of independent and multi-deployable hardware clock sources, combined with flexible and configurable synchronous and asynchronous operating modes, it not only meets the needs of NIC-based heterogeneous systems operating across multiple clock domains but also allows for the selection of appropriate clock synchronization strategies based on actual application scenarios. Synchronous mode ensures the consistency and stability of the entire hardware system clock, while asynchronous mode provides the flexibility for autonomous calibration across different clock domains, effectively improving the adaptability and operational reliability of the underlying physical clock source and providing a solid clock foundation for efficient collaboration of heterogeneous systems.

[0116] Reference Figure 7 The virtual logical clock source includes:

[0117] VFCLOCKSOURCE virtual logic clock source is selected;

[0118] After enabling the VFCLOCKSOURCE feature in HWCLOCKSOURCE, one HWCLOCKSOURCE can abstract five VFCLOCKSOURCE instances, which can be used to read and write HWCLOCKSOURCE.

[0119] VFCLOCKSOURCE passes directly to the VM via PF / VF binding;

[0120] Configure the priority attribute separately; the default priority is:

[0121] VFCLOCKSOURCE1>VFCLOCKSOURCE2>VFCLOCKSOURCE3>VFCL OCKSOURCE4>VFCLOCKSOURCE5;

[0122] The highest priority VFCLOCKSOURCE has permission to modify and correct the HWCLOCKSOURCE, while other VFCLOCKSOURCEs only have read permissions.

[0123] Reference Figure 7 The PFTIMER includes:

[0124] PFTIMER1588 timer, PFTIMER1 belongs to the VFCLOCKSOURCE clock source;

[0125] The reference time base is the HWCLOCKSOURCE to which VFCLOCKSOURCE belongs.

[0126] Reference Figure 7 The upper-layer virtual timer includes:

[0127] VFTIMER1588 timer is selected, PFTIMER enables VFTIMER function, one PFTIMER abstracts 8 VFTIMER, and VFTIMER is bound to PF / VF and passed through to VM;

[0128] Internally, VFTIMER employs secondary timer management, sorting and scheduling based on a PFTIMER. The smallest node is selected, and its parameter attributes are set accordingly. The PFTIMER relies on the HWCLOCKSOURCE clock source associated with the VFCLOCKSOURCE for counting. Once a PFTIMER event occurs, it is mapped to the corresponding VFTIMER and then reported to the bound VM system. At the operating system level, specific timed events can be bound to dedicated hardware timers for real-time event processing.

[0129] It should be noted that when VFCLOCKSOURCE is selected and HWCLOCKSOURCE is enabled, a single instance can abstract up to 5 VFCLOCKSOURCE instances, which pass directly to the VM via PF / VF. The order is VFCLOCKSOURCE1 > VFCLOCKSOURCE2 > VFCLOCKSOURCE3 > VFCLOCKSOURCE4 > VFCLOCKSOURCE5. Only the highest priority instance has the right to modify and correct HWCLOCKSOURCE; the others are read-only. The PFTIMER includes a PFTIMER1588 timer. PFTIMER1 belongs to a VFCLOCKSOURCE, and its reference time base is the HWCLOCKSOURCE to which the VFCLOCKSOURCE belongs. The upper-layer virtual timer selected is VFTIMER1588. After enabling this function, a single PFTIMER can abstract up to eight VFTIMERs and pass directly to the VM through PF / VF. VFTIMER has a built-in secondary management mechanism, which selects the smallest node to configure PFTIMER based on PFTIMER sorting and scheduling. PFTIMER relies on the corresponding HWCLOCKSOURCE for counting. After an event is generated, it is mapped to VFTIMER and then reported to the VM. The operating system can bind specific timed events with dedicated VFTIMERs to achieve real-time processing. The above solution improves the utilization of HWCLOCKSOURCE and ensures security through multi-instance abstraction and permission control of VFCLOCKSOURCE, and meets the VM requirements with PF / VF direct pass-through. PFTIMER ensures the accuracy of the timer reference. VFTIMER realizes efficient resource allocation and real-time event processing, and builds a complete link from the underlying hardware clock to the upper-layer virtual timer. It adapts to the flexible deployment, precise control and efficient response requirements of clocks and timers in VM scenarios, and provides reliable support for virtualization time management.

[0130] Example 2, refer to Figures 8-9 As an embodiment of the present invention, based on the previous embodiment, a 1588 network interface card device supporting synchronous clock resource virtualization is provided, comprising:

[0131] Reference Figure 8 The following is one method of hardware resource configuration:

[0132] 1. Network port PF4 instantiates 4 VF interfaces: VF1, VF2, VF3, and VF4.

[0133] 2. The PF1 network port is associated with the clock source VFCLOCKSOURCE1, and the timers PFTIMER1 and PFTIMER2 are also associated with VFCLOCKSOURCE1.

[0134] The PF3 network port is associated with the clock source VFCLOCKSOURCE6. The timer PFTIMER3 is associated with VFCLOCKSOURCE6.

[0135] The VF2 network port is associated with the clock source VFCLOCKSOURCE5. Timers VFTIMER1 and VFTIMER2 are also associated with the clock source VFCLOCKSOURCE5.

[0136] Reference Figure 9 For example, the allocation of network card resources in a single-machine multi-heterogeneous system;

[0137] 1588 network card resource allocation in multi-heterogeneous systems:

[0138] Non-real-time system 1: Network ports PF1, PF2, timers PFTIMER1, PFTIMER2.

[0139] Non-real-time system 2: Network port PF, VF1, timer PFTIMER3.

[0140] Real-time system 1: Network port VF2, timers VFTIMER1 and VFTIMER2.

[0141] From the perspective of hardware resource configuration:

[0142] Clock sources VFCLOCKSOURCE1 and VFCLOCKSOURCE5 correspond to one HWCLOCKSOURCE clock source, so the 1588 clocks between non-real-time system 1 and real-time system 1 are naturally synchronized. The 1588 timers of the two systems are also naturally synchronized.

[0143] Clock source VFCLOCKSOURCE6 corresponds to another clock source, HWCLOCKSOURCE. When operating in synchronous mode, the 1588 clocks between non-real-time system 2 and real-time system 1 are naturally synchronized. The 1588 timers of the two systems are also naturally synchronized. When operating in asynchronous mode, they are not synchronized.

[0144] The synchronization method for a high-precision clock: A PTP protocol stack can be run on the non-real-time system 1. Relying on the 1588 hard timestamp function supported by the PF1 interface, it adjusts and corrects the HWCLOCKSOURCE1 clock source after synchronizing with an external high-precision clock. The real-time system 1 automatically obtains the synchronized high-precision clock.

[0145] It should be noted that in the hardware resource configuration, network port PF4 instantiates 4 VF interfaces (VF1-VF4), PF1 is associated with VFCLOCKSOURCE1 and PFTIMER1, PFTIMER2 (the latter two are also associated with VFCLOCKSOURCE1), PF3 is associated with VFCLOCKSOURCE6 and PFTIMER3, and VF2 is associated with VFCLOCKSOURCE5 and VFTIMER1, VFTIMER2; the resource allocation of 1588 network cards in a single-machine multi-heterogeneous system is as follows: non-real-time system 1 occupies network ports PF1, PF2 and timers PFTIMER1, PFTIMER2, non-real-time system 2 occupies network ports PF3, VF1 and timer PFTIMER3, and real-time system 1 occupies network port VF2 and timers VFTIMER1, VFTIMER2. From a hardware configuration perspective, VFCLOCKSOURCE1 and VFCLOCKSOURCE5 correspond to the same HWCLOCKSOURCE, thus the 1588 clock and timers of non-real-time system 1 and real-time system 1 are naturally synchronized. VFCLOCKSOURCE6 corresponds to another HWCLOCKSOURCE. When operating in synchronous mode, the 1588 clock and timers of non-real-time system 2 and real-time system 1 are naturally synchronized; however, they are not synchronized in asynchronous mode. High-precision clock synchronization can be achieved by running a PTP protocol stack on non-real-time system 1. This protocol stack relies on the 1588 hard timestamp function of the PF1 interface to adjust and correct HWCLOCKSOURCE1 after synchronizing with an external high-precision clock. Real-time system 1 can automatically obtain the synchronized high-precision clock. The above solution enables the corresponding system to naturally synchronize the clock and timer through reasonable association and allocation of network cards, clock sources and timers. The synchronous and asynchronous modes can be switched to meet the needs of different scenarios. Combined with the PTP protocol stack and hard timestamp function, it achieves high-precision clock synchronization, which not only ensures the time consistency between systems, but also improves the efficiency and flexibility of clock synchronization, and provides support for the accurate time management of multiple heterogeneous systems.

[0146] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A 1588 network card device supporting synchronous clock resource virtualization, characterized in that, The term includes: including, Clock synchronization, network interface card (NIC) resource virtualization, and NIC clock virtualization; The clock synchronization includes neighbor rate ratio, delay measurement, time offset, and time convergence state offset; The network interface card (NIC) resource virtualization includes physical functions and virtual functions; The network interface card clock virtualization includes a lower-level physical clock source, a virtual logical clock source, a PFTIMER, and an upper-level virtual timer.

2. The 1588 network card device supporting synchronous clock resource virtualization as described in claim 1, characterized in that, The virtual functions include: Lightweight execution units derived from PF. Each VF appears as an independent PCIe device. VF contains a subset of device functions. When a VF is assigned to a virtual machine, the virtual machine operating system loads a dedicated VF driver, which directly manipulates the hardware queue for data sending and receiving.

3. A 1588 network card device supporting synchronous clock resource virtualization as described in claim 2, characterized in that, The neighbor rate ratio includes: The formula for calculating the neighbor rate ratio is as follows: NBR_RR=(t8-t3) / (t9-t4) In the formula, t3 is the time when the master device sends the Pdelay_Resp message, t4 is the time when the slave device receives the Pdelay_Resp message, t8 is the time when the master device sends the Pdelay_Resp_Follow_Up message, and t9 is the time when the slave device receives the Pdelay_Resp_Follow_Up message.

4. A 1588 network card device supporting synchronous clock resource virtualization as described in claim 3, characterized in that, The delay measurement includes: Delay measurement eliminates time deviations introduced by transmission path delays in the network. The calculation formula is as follows: Delay=((T4-T1)*NBR_RR–(T3-T2)) / 2 In the formula, T1 is the precise timestamp recorded by the hardware when the master device sends the Pdelay_Req message, T2 is the precise timestamp recorded by the hardware when the slave device receives the Pdelay_Req message, T3 is the precise timestamp recorded by the hardware when the slave device sends the Pdelay_Resp message, T4 is the precise timestamp recorded by the hardware when the master device receives the Pdelay_Resp message, and NBR_RR is the neighbor rate ratio.

5. A 1588 network card device supporting synchronous clock resource virtualization as described in claim 4, characterized in that, The time offset includes: The formula for calculating time offset is as follows: Offset = T2 – T1 – Delay In the formula, T1 is the precise timestamp recorded by the hardware of the master device when it sends the Sync message, T2 is the precise timestamp recorded by the hardware of the slave device when it receives the Sync message, and Delay is the delay measurement.

6. A 1588 network card device supporting synchronous clock resource virtualization as described in claim 5, characterized in that, The time convergence state offset includes: Inputting the offset into the time convergence algorithm returns the following four states: UNLOCKED: The deviation from the master clock is too large, and no hardware operation is performed; JUMP: Significantly adjusts the second and nanosecond counts; LOCKED: Fine-tune the nanosecond count. If it is in this state for 3 consecutive times, switch LOCKED_STABLE. LOCKED_STABLE: Fine-tune the nanosecond count.

7. A 1588 network card device supporting synchronous clock resource virtualization as described in claim 6, characterized in that, The underlying physical clock source includes: Independent hardware clock sources, multiple hardware clock sources are deployed and independently calibrated and corrected, enabling heterogeneous network card-based systems to span multiple clock domains; The working mode is configurable, supporting synchronous and asynchronous modes; In synchronization mode, HWCLOCKSOURCEs are automatically synchronized with priority based on the hardware clock source sequence number, and the entire hardware system uses a single reference clock. In asynchronous mode, each clock source is independently calibrated and corrected according to its different clock domain.

8. A 1588 network card device supporting synchronous clock resource virtualization as described in claim 7, characterized in that, The virtual logical clock source includes: VFCLOCKSOURCE virtual logic clock source is selected; After enabling the VFCLOCKSOURCE feature in HWCLOCKSOURCE, one HWCLOCKSOURCE can abstract five VFCLOCKSOURCE instances, allowing for reading and writing of the HWCLOCKSOURCE. VFCLOCKSOURCE is passed directly to the VM via PF and VF bindings; Configure the priority attribute separately; the default priority is: VFCLOCKSOURCE1>VFCLOCKSOURCE2>VFCLOCKSOURCE3>VFCL OCKSOURCE4>VFCLOCKSOURCE5; The highest priority VFCLOCKSOURCE has permission to modify and correct the HWCLOCKSOURCE, while other VFCLOCKSOURCEs only have read permissions.

9. A 1588 network card device supporting synchronous clock resource virtualization as described in claim 8, characterized in that, The PFTIMER includes: PFTIMER1588 timer, PFTIMER1 belongs to the VFCLOCKSOURCE clock source; The reference time base is the HWCLOCKSOURCE to which VFCLOCKSOURCE belongs.

10. A 1588 network card device supporting synchronous clock resource virtualization as described in claim 9, characterized in that, The upper-layer virtual timer includes: VFTIMER1588 timer is selected, PFTIMER enables VFTIMER function, one PFTIMER abstracts 8 VFTIMER, VFTIMER is bound to PF, VF is passed directly to VM; VFTIMER has a secondary timer management system. It sorts and schedules based on a PFTIMER, selects the smallest node, and sets the PFTIMER with the smallest node's parameter attributes. The PFTIMER relies on the HWCLOCKSOURCE clock source to which VFCLOCKSOURCE belongs for counting. After a PFTIMER event is generated, it is mapped to the corresponding VFTIMER and then reported to the bound VM system. At the operating system level, specific timed events are bound to dedicated hardware timers for real-time event processing.