Multi-port network card configuration atomic commit rollback method and system
Patent Information
- Application Number
- CN202611166137.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-03
- Publication Date
- 2026-10-30
AI Technical Summary
[0003]当多端口之间存在通信依赖关系时,一次过提交所有配置可能导致依赖链路中断,若某一端口配置失败,已配置成功的端口可能已处于错误工作状态,且难以精准定位失败根源,必须回滚全部配置才能恢复系统稳定
[0016]本发明的多端口网卡配置原子提交回滚方法显著提升了网络设备配置变更的可靠性与执行效率。通过分析端口间的通信依赖关系构建拓扑模型,并生成包含并行层与串行层的分层配置方案,能够将无关端口配置并发处理,大幅缩短整体配置耗时,同时确保存在依赖关系的端口配置按顺序执行,避免因配置顺序错误导致的网络中断或端口冲突。在每个配置层设置检查点并记录全局端口状态,使得配置过程具备精确的状态追溯能力,有效降低了配置失败后的人工排查难度。
Smart Images

Figure CN123020344A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of network communication technology, and in particular to a method and system for atomic commit and rollback of multi-port network interface card (NIC) configuration. Background Technology
[0002] In the field of multi-port network interface card (NIC) configuration management, configuration changes are typically achieved through either a single full commit or sequential port-by-port configuration. A common approach is for the administrator or automated script to send complete configuration parameters to all ports to be configured at once, and then check the overall status to ensure it matches expectations after all ports are configured. Another common approach is to execute configuration operations sequentially according to port numbers or a preset order, performing partial verification after each port is configured, until all ports are configured.
[0003] When communication dependencies exist between multiple ports, committing all configurations at once may disrupt the dependency chain. If the configuration of a port fails, the successfully configured ports may already be in an erroneous state, and it is difficult to accurately pinpoint the root cause of the failure. A complete rollback of the configuration is necessary to restore system stability. While sequential port configuration can track the status of individual ports, if the backend configuration dependencies are complex, sequential operations cannot process independent ports in parallel, leading to low configuration efficiency. Furthermore, rollback requires reverse port-by-port recovery, making it impossible to skip successful and independent configuration steps, causing unnecessary configuration disturbances and performance overhead.
[0004] Furthermore, existing technologies generally lack structured modeling of dependencies between ports and cannot impose hierarchical constraints on configuration operations according to dependency levels. As a result, if a partial failure occurs during the configuration process, the system often adopts a full rollback or a partial rollback based on a simple sequence. The rollback scope is poorly controlled, and the recovery time is significantly extended. These limitations restrict the flexibility and reliability of network card configuration in data centers or high-availability networks. Summary of the Invention
[0005] This invention provides a method and system for atomic commit and rollback of multi-port network interface card configuration, which can solve the problems in the prior art.
[0006] A first aspect of this invention provides a method for atomic commit and rollback of multi-port network interface card (NIC) configuration, comprising: Obtain the configuration change request of the multi-port network card, parse the configuration change request to identify the set of ports to be changed and the corresponding configuration parameters, and construct a port topology model based on the communication dependencies between the port sets; A hierarchical configuration scheme is generated based on the port topology model. The hierarchical configuration scheme divides the configuration operation into a parallel layer that is independent of each other and a serial layer that is dependent on each other. A checkpoint is set for each configuration layer. The checkpoint records the global port state before each configuration layer is executed. The configuration operations are executed in the hierarchical order of the hierarchical configuration scheme. After all configuration operations in each configuration layer are completed, a consistency verification is performed. The consistency verification determines whether each configuration layer is successful by comparing the actual configuration results with the expected configuration results. When consistency verification of any configuration layer fails, the layered rollback mechanism is immediately triggered. The global port status is obtained from the checkpoint corresponding to the failed configuration layer, and state recovery is performed only on the ports involved in the failed configuration layer and its subsequent configuration layers. After the state recovery is complete, the storage space occupied by the checkpoint is released, and a rollback report containing the failure configuration layer identifier and port state differences is generated.
[0007] Parse the configuration change request to identify the set of ports to be changed and their corresponding configuration parameters, and construct a port topology model based on the communication dependencies between the port sets, including: Extract port identifiers and configuration parameters from the configuration change request, classify the configuration parameters into flow control parameters and link status parameters according to port functions, and establish a mapping relationship between port identifiers and configuration parameters; The port set is traversed to extract the packet forwarding rules between each network port. Based on the packet forwarding rules, the upstream and downstream relationships between ports are identified. The upstream and downstream relationship is defined as the output traffic of the upstream port being used as the input traffic of the downstream port. A directed dependency chain between ports is constructed based on the upstream and downstream relationship. The system analyzes whether the configuration parameters contain an aggregation configuration identifier. When an aggregation configuration identifier is detected, the ports within the aggregation group are marked as collaborative ports, and a synchronization dependency is established between the collaborative ports. The port set is mapped to the topology node set, the directed dependency chain is mapped to the topology path, and the synchronization dependency relationship is mapped to the topology cluster. The topology nodes in the topology cluster share the configuration execution sequence, forming a port topology model that includes the topology node set, topology path and topology cluster.
[0008] A hierarchical configuration scheme is generated based on the port topology model. This scheme divides configuration operations into independent parallel layers and dependent serial layers, and sets checkpoints for each configuration layer. These checkpoints record the global port state before each configuration layer is executed, including: Extract the topology path from the port topology model, trace the reachability relationship of each topology node along the topology path, and assign a propagation distance to each topology node according to the reachability relationship. The propagation distance represents the topology span required for a configuration change to propagate from the source node to each topology node. Identify the topology clusters in the port topology model, treat the topology clusters as single configuration units, take the maximum value of the propagation distance of each node in the cluster, and establish configuration synchronization markers in the topology clusters to constrain the nodes in the clusters to complete the configuration at the same configuration layer. Topology nodes are layered according to propagation distance. Topology nodes with the same propagation distance are grouped into the same configuration layer, and dependency depth relationships are established based on the difference in propagation distance between configuration layers. Analyze the topological path connectivity between each configuration layer. If there is a direct connection, establish a direct serial relationship. If there is a connection through an intermediate layer, establish a transit serial relationship. If there is no connection, mark it as an independent parallel relationship. Organize the configuration layers in ascending order of propagation distance to form a layered configuration scheme containing three types of execution relationships. Create hierarchical checkpoints for each configuration layer. Each hierarchical checkpoint records a snapshot of the port status of each configuration layer and its reference relationship with the checkpoints of its predecessor configuration layers, forming a checkpoint dependency chain across configuration layers.
[0009] Hierarchical checkpoints are created for each configuration layer. These checkpoints record port status snapshots of each configuration layer and their references to checkpoints in preceding configuration layers, forming a cross-configuration-layer checkpoint dependency chain, including: Traverse each configuration layer in the hierarchical configuration scheme, extract the topology nodes contained in each configuration layer, collect the configuration parameters and link status of the corresponding ports of each topology node, and generate a port status snapshot. The dependency depth relationship is queried to identify the preceding configuration layer of each configuration layer. It is then checked whether there is a direct topological path connection between each configuration layer and each preceding configuration layer. If there is a direct connection, it is marked as a direct dependency layer, and if there is a connection through an intermediate configuration layer, it is marked as an indirect dependency layer. Establish direct reference relationships between checkpoints in each configuration layer and checkpoints in each directly dependent layer. The direct reference relationship records the checkpoint identifier and connection topology path of the directly dependent layer. Establish indirect reference relationships between checkpoints in each configuration layer and checkpoints in each indirect dependency layer. The indirect reference relationship records the checkpoint identifiers of the indirect dependency layers and the checkpoint identifier sequence of the intermediate configuration layers. Port state snapshots, direct references, and indirect references are encapsulated as hierarchical checkpoints. Hierarchical checkpoints for each configuration layer are created in ascending order of propagation distance, and checkpoint dependency chains are formed through direct and indirect references.
[0010] Configuration operations are executed according to the hierarchical order of the layered configuration scheme. After all configuration operations at each configuration layer are completed, consistency verification is performed. The consistency verification determines whether each configuration layer is successful by comparing the actual configuration result with the expected configuration result, including: Select the current configuration layer in hierarchical order and issue configuration instructions to each topology node. After the configuration instructions are executed, collect the configuration parameters and link status of the corresponding ports of each topology node, establish the actual mapping relationship between port identifiers and configuration parameters as the actual configuration result, and extract the expected port configuration parameters and expected link status from the hierarchical configuration scheme to establish the expected mapping relationship as the expected configuration result. Iterate through the actual mapping relationship and compare the configuration parameters corresponding to the same port identifier in the expected mapping relationship. Record the port identifiers that do not match as abnormal ports and build an abnormal port set. At the same time, record the actual configuration parameters and expected configuration parameters corresponding to the abnormal ports to form a configuration difference record. Based on the port topology model, trace the topological position of each port in the abnormal port set before the configuration layer is executed, read the port state of each abnormal port before the configuration is executed from the corresponding checkpoint, and compare the port state before the configuration is executed with the current port state to extract the state change amount. When the set of abnormal ports is empty, the current configuration layer is marked as successful and the next configuration layer is executed. When the set of abnormal ports is not empty, the current configuration layer is marked as failed and the set of abnormal ports and the state change are passed to the layered rollback mechanism.
[0011] When consistency verification at any configuration layer fails, a layered rollback mechanism is immediately triggered. The global port state is retrieved from the checkpoint corresponding to the failed configuration layer, and state recovery is performed only on the ports involved in the failed configuration layer and its subsequent configuration layers, including: Receive the set of abnormal ports and the amount of state change transmitted by the consistency verification, read the global port status from the checkpoint corresponding to the failed configuration layer, and determine the rollback target status of each port in the set of abnormal ports based on the amount of state change. According to the hierarchical order of the hierarchical configuration scheme, identify the subsequent configuration layers of the failed configuration layer, trace the ports involved in the subsequent configuration layers downstream from the abnormal port set along the topological path of the port topology model, and construct a hierarchical rollback set by hierarchically grouping the abnormal port set and the ports involved in the subsequent configuration layers according to the hierarchical order. Iterate through each port in the layered rollback set to extract the current configuration parameters and link status. For ports in the abnormal port set, directly use the rollback target status. For ports involved in subsequent configuration layers, extract historical status from the global port status and compare them. Classify the comparison results according to the differences in configuration parameters and link status, and construct parameter rollback instructions and link reset instructions respectively. Process each layer group in the layered rollback set in reverse order of hierarchical order. Within each layer group, first issue the parameter rollback command and then issue the link reset command. The state recovery is completed when the state of all ports in the layered rollback set is restored.
[0012] Process each layer group in the layered rollback set in reverse order of hierarchical sequence. Within each layer group, first issue the parameter rollback command, then issue the link reset command. State recovery is completed once the state of all ports in the layered rollback set has been restored, including: The hierarchical rollback set is arranged in reverse order of hierarchical number to form a processing queue. Hierarchical groups are extracted from the processing queue in sequence to restore their execution status. Subsequent hierarchical groups are blocked until the current hierarchical group is completed. The current hierarchical group enters the parameter rollback phase. The parameter rollback instructions of each port in the current hierarchical group are extracted and sent out in sequence according to the priority of the configuration items. The actual configuration status of the port is read and verified against the target configuration status in the parameter rollback instructions. If the verification fails, the current hierarchical group status recovery is terminated. After all ports in the current hierarchical group pass the verification, the link reset phase is entered. During the link reset phase, the link reset commands of each port in the current hierarchical group are extracted, sorted according to the position of the port in the topology path, and then sent out in sequence. The actual link status of the port is read and verified against the target link status in the link reset command. If the verification fails, the current hierarchical group status recovery is terminated. After all ports in the current hierarchical group pass the verification, the blocking is lifted and the next hierarchical group status recovery is triggered until all hierarchical groups in the processing queue have completed status recovery.
[0013] A second aspect of this invention provides a multi-port network interface card (NIC) configuration atomic commit rollback system, comprising: The topology modeling unit is used to obtain configuration change requests for multi-port network cards, parse the configuration change requests to identify the set of ports to be changed and the corresponding configuration parameters, and construct a port topology model based on the communication dependencies between the port sets. A hierarchical configuration unit is used to generate a hierarchical configuration scheme based on the port topology model. The hierarchical configuration scheme divides the configuration operation into a parallel layer that is independent of each other and a serial layer that is dependent on each other. A checkpoint is set for each configuration layer. The checkpoint records the global port state before each configuration layer is executed. The consistency verification unit is used to execute configuration operations according to the hierarchical order of the layered configuration scheme. After all configuration operations of each configuration layer are completed, consistency verification is performed. The consistency verification determines whether each configuration layer is successful by comparing the actual configuration result with the expected configuration result. The rollback recovery unit is used to immediately trigger the layered rollback mechanism when the consistency verification of any configuration layer fails. It obtains the global port status from the checkpoint corresponding to the failed configuration layer and performs state recovery only on the ports involved in the failed configuration layer and its subsequent configuration layers. The rollback report unit is used to release the storage space occupied by the checkpoint after the state recovery is completed, and to generate a rollback report containing the failure configuration layer identifier and the port state difference.
[0014] A third aspect of the present invention provides an electronic device, comprising: processor; Memory used to store processor-executable instructions; The processor is configured to invoke instructions stored in the memory to execute the aforementioned method.
[0015] A fourth aspect of the present invention provides a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the aforementioned method.
[0016] The multi-port network interface card (NIC) configuration atomic commit and rollback method of this invention significantly improves the reliability and execution efficiency of network device configuration changes. By analyzing the communication dependencies between ports to construct a topology model and generating a layered configuration scheme including parallel and serial layers, it can process unrelated port configurations concurrently, greatly reducing the overall configuration time. Simultaneously, it ensures that port configurations with dependencies are executed sequentially, avoiding network interruptions or port conflicts caused by incorrect configuration order. Setting checkpoints at each configuration layer and recording the global port status enables precise state traceability during the configuration process, effectively reducing the difficulty of manual troubleshooting after configuration failures.
[0017] The consistency verification mechanism compares the actual and expected results immediately after each layer of configuration is completed. This allows for precise identification of the failed layer in the early stages of configuration failure, preventing the failure from spreading to subsequent unexecuted configuration layers. The layered rollback mechanism uses checkpoints to restore only the port states involved in the failed layer and its subsequent layers, without needing to roll back the entire configuration process. This significantly reduces the impact of rollback operations on normal service ports.
[0018] After a configuration change fails, a rollback report containing the failure layer identifier and port status differences is automatically generated, providing operations and maintenance personnel with a clear basis for fault location. Abnormal port sets can be quickly identified without manually comparing configuration logs. This method improves the success rate of configuration operations while reducing the risk of production accidents caused by configuration errors. Attached Figure Description
[0019] Figure 1 This is a flowchart illustrating the atomic commit rollback method for configuring multi-port network interface cards according to an embodiment of the present invention. Figure 2 A flowchart illustrating the method for constructing a port topology model according to an embodiment of the present invention; Figure 3 A bar chart showing the distribution of port propagation distance; Figure 4 This is a progress curve diagram for the layered rollback. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0021] The technical solution of the present invention will be described in detail below with reference to specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0022] Figure 1 This is a flowchart illustrating the atomic commit and rollback method for multi-port network interface card (NIC) configuration according to an embodiment of the present invention. The multi-port NIC configuration atomic commit and rollback method provided in this embodiment includes: Obtain the configuration change request of the multi-port network card, parse the configuration change request to identify the set of ports to be changed and the corresponding configuration parameters, and construct a port topology model based on the communication dependencies between the port sets; A hierarchical configuration scheme is generated based on the port topology model. The hierarchical configuration scheme divides the configuration operation into a parallel layer that is independent of each other and a serial layer that is dependent on each other. A checkpoint is set for each configuration layer. The checkpoint records the global port state before each configuration layer is executed. The configuration operations are executed in the hierarchical order of the hierarchical configuration scheme. After all configuration operations in each configuration layer are completed, a consistency verification is performed. The consistency verification determines whether each configuration layer is successful by comparing the actual configuration results with the expected configuration results. When consistency verification of any configuration layer fails, the layered rollback mechanism is immediately triggered. The global port status is obtained from the checkpoint corresponding to the failed configuration layer, and state recovery is performed only on the ports involved in the failed configuration layer and its subsequent configuration layers. After the state recovery is complete, the storage space occupied by the checkpoint is released, and a rollback report containing the failure configuration layer identifier and port state differences is generated.
[0023] Figure 2 This is a flowchart illustrating the method for constructing a port topology model according to an embodiment of the present invention. The method involves parsing the configuration change request to identify the set of ports to be changed and their corresponding configuration parameters, and constructing a port topology model based on the communication dependencies between the port sets, including: Extract port identifiers and configuration parameters from the configuration change request, classify the configuration parameters into flow control parameters and link status parameters according to port functions, and establish a mapping relationship between port identifiers and configuration parameters; The port set is traversed to extract the packet forwarding rules between each network port. Based on the packet forwarding rules, the upstream and downstream relationships between ports are identified. The upstream and downstream relationship is defined as the output traffic of the upstream port being used as the input traffic of the downstream port. A directed dependency chain between ports is constructed based on the upstream and downstream relationship. The system analyzes whether the configuration parameters contain an aggregation configuration identifier. When an aggregation configuration identifier is detected, the ports within the aggregation group are marked as collaborative ports, and a synchronization dependency is established between the collaborative ports. The port set is mapped to the topology node set, the directed dependency chain is mapped to the topology path, and the synchronization dependency relationship is mapped to the topology cluster. The topology nodes in the topology cluster share the configuration execution sequence, forming a port topology model that includes the topology node set, topology path and topology cluster.
[0024] When extracting port identifiers and configuration parameters from configuration change requests, the field structure of the request message needs to be parsed layer by layer. Configuration change requests are typically passed in as structured data, including port number, parameter type, and parameter value fields. The port identifier extraction process requires normalization of the port number field, mapping physical port numbers, logical port numbers, and aggregated port numbers to an internal port identifier system to ensure the uniqueness and consistency of port identifiers in subsequent processing. Configuration parameter extraction requires classifying all parameters into two main categories based on the parameter type field: flow control parameters and link status parameters. Flow control parameters cover configuration items related to data flow rate and priority management, such as bandwidth limiting, queue scheduling policies, and congestion window thresholds; link status parameters cover configuration items that directly affect physical or logical link connectivity, such as port enable status, auto-negotiation mode, duplex mode, link rate, and MTU value. When establishing the mapping relationship between port identifiers and configuration parameters, a mapping table structure is constructed using the port identifier as the key and the full set of configuration parameters corresponding to that port as the value. This mapping table is continuously referenced as a core data structure in subsequent dependency analysis and hierarchical configuration scheme generation.
[0025] When traversing a port set to extract packet forwarding rules between network ports, it is necessary to read forwarding entries related to the port set from the current network interface card's forwarding table, routing table, or policy routing rules. Each forwarding entry describes which ingress port a packet is forwarded from, via the internal switching path, to, and which egress port, under specific matching conditions. By analyzing each forwarding entry, the upstream and downstream relationships between ports can be identified: when a port... The outgoing traffic is specified as port in the forwarding rule. When the input flow is defined, then define for The upstream port, for The downstream port, between the two is a... point to The directed dependency edges between all ports are expanded according to the transitivity principle. point to and point to This forms a path from through to The directed dependency chain. The construction process of the directed dependency chain requires loop detection. When a loop is detected in the directed dependency chain, it means that there is a circular forwarding configuration between the ports. In such cases, the exception needs to be logged and the processing of the current configuration change request needs to be stopped. An error report should be returned to the upper layer to avoid executing unreliable hierarchical configurations on topologies with circular dependencies.
[0026] After constructing the directed dependency chain, further analysis is performed to determine if the configuration parameters contain an aggregation configuration identifier. The aggregation configuration identifier is a field in the configuration parameters that explicitly declares that the current port belongs to a certain Link Aggregation Group (LAG). Its value is typically the aggregation group number or name. When an aggregation configuration identifier is detected in the configuration parameters of a port, the port set is traversed to find all ports that declare belonging to the same aggregation group, and these ports are uniformly marked as collaborative ports. Establishing a synchronous dependency relationship between collaborative ports means that all collaborative ports within the same aggregation group must complete their configuration operations within the same configuration execution window. It is not permissible for some ports to have completed new configurations while others remain in an intermediate state of old configurations, as this intermediate state would cause inconsistencies in the hash distribution logic of the aggregation group, leading to traffic loss or out-of-order delivery. Synchronous dependencies differ semantically from directed dependency chains: directed dependency chains describe sequential execution constraints between upstream and downstream ports, while synchronous dependencies describe concurrent execution constraints between collaborative ports, meaning that the configuration operations of collaborative ports must be submitted and take effect simultaneously.
[0027] When mapping a port set to a topology node set, each port identifier in the port set corresponds to a topology node in the topology model. The topology node carries the configuration parameter set and port type information for that port. When mapping a directed dependency chain to a topology path, each directed dependency edge in the directed dependency chain corresponds to a topology path in the topology model. The direction of the topology path is consistent with the direction of the directed dependency edge, indicating that there is a sequential constraint on the configuration operations in that path direction. That is, the configuration operation of the upstream topology node must be completed and verified before the configuration operation of the downstream topology node begins. When mapping synchronization dependencies to topology clusters, the topology nodes corresponding to all cooperating ports belonging to the same aggregation group are grouped into the same topology cluster. The topology nodes within the topology cluster share the configuration execution sequence. That is, the topology cluster participates in the hierarchical division of the hierarchical configuration scheme as a whole, and all nodes within the topology cluster execute configuration operations in parallel within the same configuration layer.
[0028] The final port topology model consists of three types of elements: a set of topology nodes, topology paths, and topology clusters. The set of topology nodes fully describes all ports involved in this configuration change and their configuration parameters; the set of topology paths describes the directed dependency constraints between ports derived from packet forwarding rules, providing a basis for the division of the serial layer in the subsequent hierarchical configuration scheme; the set of topology clusters describes the synchronous execution constraints derived from aggregated configuration identifiers, providing a basis for the division of the parallel layer. After the port topology model is built, it will be passed to the generation phase of the hierarchical configuration scheme. The generation phase identifies the order of the serial layer based on the topology paths and the execution boundaries of the parallel layer based on the shared timing of nodes within the topology clusters, thereby generating a hierarchical configuration scheme that balances dependency order and concurrency efficiency. The entire port topology model construction process must ensure idempotency, meaning that for the same configuration change request, the port topology model obtained by repeatedly executing the construction process is completely consistent in structure and content, ensuring the reproducibility of configuration operations and the reliability of the rollback mechanism.
[0029] A hierarchical configuration scheme is generated based on the port topology model. This scheme divides configuration operations into independent parallel layers and dependent serial layers, and sets checkpoints for each configuration layer. These checkpoints record the global port state before each configuration layer is executed, including: Extract the topology path from the port topology model, trace the reachability relationship of each topology node along the topology path, and assign a propagation distance to each topology node according to the reachability relationship. The propagation distance represents the topology span required for a configuration change to propagate from the source node to each topology node. Identify the topology clusters in the port topology model, treat the topology clusters as single configuration units, take the maximum value of the propagation distance of each node in the cluster, and establish configuration synchronization markers in the topology clusters to constrain the nodes in the clusters to complete the configuration at the same configuration layer. Topology nodes are layered according to propagation distance. Topology nodes with the same propagation distance are grouped into the same configuration layer, and dependency depth relationships are established based on the difference in propagation distance between configuration layers. Analyze the topological path connectivity between each configuration layer. If there is a direct connection, establish a direct serial relationship. If there is a connection through an intermediate layer, establish a transit serial relationship. If there is no connection, mark it as an independent parallel relationship. Organize the configuration layers in ascending order of propagation distance to form a layered configuration scheme containing three types of execution relationships. Create hierarchical checkpoints for each configuration layer. Each hierarchical checkpoint records a snapshot of the port status of each configuration layer and its reference relationship with the checkpoints of its predecessor configuration layers, forming a checkpoint dependency chain across configuration layers.
[0030] After obtaining the port topology model, it needs to be transformed into an executable hierarchical configuration scheme. The first step in this process is to extract the topology path from the port topology model and trace the reachability relationships of each topology node along the topology path. Specifically, starting from the originating node of the configuration change, a breadth-first traversal is used to expand level by level along the directed edges, recording the minimum topology span required to reach each topology node from the source node. This span is defined as the propagation distance of that node. The propagation distance characterizes the diffusion depth of the configuration change signal in the port dependency chain, rather than the physical link length. Let a certain topology node be... Its propagation distance is denoted as The propagation distance of the source node For nodes that are direct dependencies of the source node, the propagation distance is And so on. If a node can be reached by multiple topology paths, the maximum value of the corresponding propagation distance among all paths is taken to ensure that all prerequisites for the node are configured before processing the node, avoiding the situation where configuration begins before the prerequisites are ready.
[0031] like Figure 3As shown, the horizontal axis of the graph lists eight network port identifiers: eth0, eth1, eth3, eth2, eth4, eth5, eth6, and eth7. The vertical axis represents the propagation distance *d* for each port. The height of the bars directly reflects the propagation distance: eth0, eth1, and eth3 have bars of 0, indicating they are source nodes with no upstream ports in the topology dependency; configuration changes originate from these ports. eth2 has a bar of 1, indicating it directly depends on one or more source nodes; configuration operations must be performed after the source nodes have completed their operations. eth4 and eth5 have bars of 2 and belong to the same aggregation group LAG1, reflecting the shared execution order within the topology cluster. eth6 and eth7 have bars of 3, also belonging to aggregation group LAG2, and are at the end of the dependency chain. This bar chart comprehensively shows the hierarchical position of all ports in the topology model; a larger propagation distance indicates a later configuration order for the port, providing a quantitative basis for subsequently dividing the parallel and serial layers.
[0032] Identifying topology clusters in the port topology model is a crucial step in generating a hierarchical configuration scheme. A topology cluster refers to a set of topology nodes in the port topology model that have strong coupling or bidirectional dependencies. These nodes are functionally indivisible and must be configured as a whole; otherwise, inconsistencies will arise. Topology clusters can be identified by analyzing the directed graph of the port topology model using a strongly connected component algorithm. All nodes belonging to the same strongly connected component are grouped into a topology cluster, which is then treated as a single configuration unit for subsequent hierarchical calculations. The propagation distance of a topology cluster is the maximum propagation distance of all nodes within the cluster. This ensures that all external dependencies of nodes within the cluster are ready. Simultaneously, a configuration synchronization flag is established within the topology cluster. This flag constrains all nodes within the cluster to complete their configuration at the same configuration layer, preventing the splitting of cluster nodes to different configuration layers for batch processing, thus guaranteeing the atomicity of cluster configuration within each layer.
[0033] After calculating the propagation distance and identifying the topology clusters, the topology nodes are layered according to their propagation distance. Topology nodes with the same propagation distance—including topology clusters considered as single configuration units—are grouped into the same configuration layer. Let the configuration layer set be arranged in ascending order of propagation distance as follows: ,in Includes all propagation distances equal to The nodes or topology clusters. The difference in propagation distance between adjacent configuration layers is called the dependency depth. A dependency depth of 1 indicates a direct dependency, while a dependency depth greater than 1 indicates an indirect dependency with an intermediate transition layer. The dependency depth relationship is used to subsequently establish serial and parallel execution constraints between configuration layers, enabling the scheduling engine to accurately determine which configuration layers must maintain sequential execution and which configuration layers can proceed concurrently.
[0034] After determining the hierarchical affiliation of each configuration layer, the topological path connectivity between each configuration layer is further analyzed, and three types of execution relationships are established accordingly. If two configuration layers... and ( There are direct directed topological edges between them—that is... A certain node and There are direct dependency edges between certain nodes in the equation. and To establish a direct serial relationship between them, it is required Only after all configuration operations are completed and pass consistency verification can the system be started. Configuration operations. If and There is no direct edge between them, but they are connected through one or more intermediate configuration layers. ( If an indirect connection path can be established, then in and A transitive serial relationship is established between configuration layers, implicitly contained within the transitive closure of the direct serial relationship, and automatically satisfied during scheduling through dependency propagation. If there is neither a direct connection nor an indirect path between two configuration layers, they are marked as independent parallel relationships, allowing configuration operations in these two layers to be executed concurrently without affecting each other. Finally, all configuration layers are organized in ascending order of propagation distance, forming a hierarchical configuration scheme that includes three execution relationships: direct serial relationships, transitive serial relationships, and independent parallel relationships. This scheme fully utilizes the concurrent execution advantages of independent parallel relationships while ensuring the orderliness of dependencies through serial constraints.
[0035] Creating hierarchical checkpoints for each configuration layer is the core mechanism for ensuring rollback capabilities in a layered configuration scheme. A hierarchical checkpoint is triggered before any configuration operation is executed for the corresponding configuration layer. It takes a complete snapshot of the current state of all ports involved in that configuration layer, including the port's link status, rate settings, VLAN binding relationships, flow control parameters, queue priority policies, and all other configuration items. Let's assume the configuration layer... The corresponding level checkpoint is denoted as , Not only preserve The snapshots of the port's state also store pointers to its front-end configuration layer checkpoints. The reference relationships between these checkpoints create a logical cross-layer checkpoint dependency chain. The purpose of this dependency chain is to allow for precise location of the state baseline that needs to be restored when a consistency verification failure occurs in a configuration layer and a rollback is triggered, by tracing back along the checkpoint dependency chain, without having to perform a full rollback on all ports. This limits the impact of the rollback operation to the set of ports involved in the failed configuration layer and its subsequent layers.
[0036] The checkpoint storage employs a strategy combining incremental recording and full snapshots. For ports involved in configuration changes, a full state snapshot is recorded to ensure recovery accuracy. For ports within the same configuration layer that have not changed, only the state differences between them and the preceding checkpoint are recorded (if there are no differences, they are not stored repeatedly) to reduce the storage space occupied by checkpoints. The reference relationship in the checkpoint dependency chain is implemented using lightweight pointers, which point to the physical offset of the preceding checkpoint in the storage structure, making the time cost of traversing the chain linearly related to the chain length. After the configuration layer successfully completes and passes consistency verification, its corresponding level checkpoint can be retained or released depending on the storage resource situation. If a rollback occurs, starting from the checkpoint of the failed configuration layer, the storage space occupied by that checkpoint and its subsequent checkpoints is released sequentially, and the lifecycle of the entire storage space strictly corresponds to the lifecycle of the configuration transaction.
[0037] Hierarchical checkpoints are created for each configuration layer. These checkpoints record port status snapshots of each configuration layer and their references to checkpoints in preceding configuration layers, forming a cross-configuration-layer checkpoint dependency chain, including: Traverse each configuration layer in the hierarchical configuration scheme, extract the topology nodes contained in each configuration layer, collect the configuration parameters and link status of the corresponding ports of each topology node, and generate a port status snapshot. The dependency depth relationship is queried to identify the preceding configuration layer of each configuration layer. It is then checked whether there is a direct topological path connection between each configuration layer and each preceding configuration layer. If there is a direct connection, it is marked as a direct dependency layer, and if there is a connection through an intermediate configuration layer, it is marked as an indirect dependency layer. Establish direct reference relationships between checkpoints in each configuration layer and checkpoints in each directly dependent layer. The direct reference relationship records the checkpoint identifier and connection topology path of the directly dependent layer. Establish indirect reference relationships between checkpoints in each configuration layer and checkpoints in each indirect dependency layer. The indirect reference relationship records the checkpoint identifiers of the indirect dependency layers and the checkpoint identifier sequence of the intermediate configuration layers. Port state snapshots, direct references, and indirect references are encapsulated as hierarchical checkpoints. Hierarchical checkpoints for each configuration layer are created in ascending order of propagation distance, and checkpoint dependency chains are formed through direct and indirect references.
[0038] When creating hierarchical checkpoints for each configuration layer, it is necessary to systematically traverse each configuration layer in the hierarchical configuration scheme, extract all topology nodes contained in that layer, and collect status information for the physical ports corresponding to each topology node. The collected data includes the port's currently effective configuration parameters (including speed, duplex mode, VLAN affiliation, flow control policy, MTU value, etc.) and the port's link layer status (including link up status, negotiation results, error count, etc.). This collected data is organized by port identifier to form a snapshot of the port status of that configuration layer before the change operation. The generation of the port status snapshot must be strictly locked before any write operation of the corresponding configuration layer is issued to ensure that the snapshot content truly reflects the stable state before the change, rather than an intermediate transitional state. In concurrent access scenarios, the snapshot collection process must hold a port-level read lock to prevent other operations from interfering with the port status during the collection process, thereby ensuring the consistency and integrity of the snapshot data.
[0039] After generating port state snapshots, it's necessary to identify the set of preceding configuration layers for each configuration layer based on the dependency depth relationships recorded in the hierarchical configuration scheme. A preceding configuration layer refers to a configuration layer that has been executed before the current configuration layer, and whose ports in the current configuration layer have topological path connections to it. After identifying the set of preceding configuration layers, the topological connection type between the current configuration layer and each preceding configuration layer is further detected. If a topological node in the current configuration layer has a direct directed edge with a topological node in a preceding configuration layer that doesn't require traversing other configuration layer nodes, then the preceding configuration layer is marked as a direct dependency layer; if the path between them requires traversing at least one intermediate node belonging to another configuration layer, then the preceding configuration layer is marked as an indirect dependency layer. This distinction method ensures that checkpoint references accurately reflect the true topological coupling degree between configuration layers, providing a basis for selecting the state recovery path during subsequent rollbacks.
[0040] For a preceding configuration layer marked as a direct dependency layer, a direct reference relationship is established between the checkpoint of the current configuration layer and the checkpoint of that direct dependency layer. This direct reference relationship records two core elements at the data structure level: first, the checkpoint identifier of the direct dependency layer, which is composed of the configuration layer number and the checkpoint creation timestamp, ensuring global uniqueness; second, the connection topology path, i.e., the sequence of endpoint node identifiers of the direct directed edges between the current configuration layer and the direct dependency layer, used to accurately locate the set of ports and the order of operations to be restored during rollback. The direct reference relationship is embedded in the checkpoint data structure of the current configuration layer in the form of a reference record, allowing immediate location of its direct preceding checkpoint when retrieving the current checkpoint, without requiring additional graph traversal operations.
[0041] For a preceding configuration layer marked as an indirect dependency layer, an indirect reference relationship is established between the checkpoint of the current configuration layer and the checkpoint of that indirect dependency layer. This indirect reference relationship also records two core pieces of information: first, the checkpoint identifier of the indirect dependency layer, with the same identifier rules as the direct dependency layer; second, a sequence of checkpoint identifiers for all intermediate configuration layers along the connection path. This sequence is arranged according to the topology propagation direction from the indirect dependency layer to the current layer, completely describing the propagation path across multiple configuration layers. The checkpoint identifier sequence of the intermediate configuration layers not only marks the path nodes but also associates them with port state snapshot references for each intermediate layer checkpoint. This ensures that during rollback, the port states of intermediate layers can be restored layer by layer according to the path order, avoiding inconsistencies in port states caused by skipping intermediate layers during restoration.
[0042] After encapsulating the port state snapshot, the set of direct references, and the set of indirect references into a complete hierarchical checkpoint data object, hierarchical checkpoints for each configuration layer are created and persistently stored in ascending order of propagation distance. The configuration layer with the shortest propagation distance (i.e., the configuration layer closest to the source node) is created first, followed by configuration layers with larger propagation distances. This creation order ensures that when establishing checkpoint references for a configuration layer, all checkpoints of its preceding configuration layers already exist, and the references can directly point to valid checkpoint objects, avoiding dangling references. Through the combination of direct and indirect references, the checkpoints of each configuration layer are linked together, forming a checkpoint dependency chain isomorphic to the port topology model structure.
[0043] The checkpoint dependency chain is implemented at the storage layer using a chained node structure. Each node stores a snapshot of the port state data for its current layer, as well as a set of references pointing to the preceding checkpoint nodes. When a consistency verification at a certain configuration layer fails and triggers a layered rollback, the checkpoint dependency chain is started from the checkpoint node of the failed layer, and the data can be retrieved through direct references. The time complexity directly locates checkpoints in directly dependent layers, quickly obtaining the preceding state of the failed layer. Through indirect references, it traverses the checkpoint identifier sequence of intermediate configuration layers, restoring the intermediate layer port states layer by layer in sequence, ultimately restoring the port states along the entire affected propagation path to a consistent state before the execution of the failed configuration layer. After state restoration, the storage space occupied by nodes corresponding to the failed layer and its subsequent layers in the checkpoint dependency chain is released, while checkpoint nodes before the failed layer are retained for potential retry operations.
[0044] The correctness of the checkpoint dependency chain relies on the idempotency guarantee of the checkpoint creation process. If the creation of a checkpoint in a configuration layer is interrupted for any reason, when creation is triggered again, it is necessary to first check whether some written checkpoint data already exists in that layer. If it does, it is cleared and then rebuilt to ensure the integrity of the checkpoint data. The checkpoint reference relationships are written using a two-phase commit method: first, the snapshot data is written, and then the reference relationship is written. This avoids inconsistencies where snapshot data is missing but the reference relationship has been established. Through this mechanism, the checkpoint dependency chain maintains structural integrity and data consistency throughout the entire lifecycle of multi-port network interface card configuration changes, providing a reliable foundation for state recovery for atomic commits and hierarchical rollbacks.
[0045] Configuration operations are executed according to the hierarchical order of the layered configuration scheme. After all configuration operations at each configuration layer are completed, consistency verification is performed. The consistency verification determines whether each configuration layer is successful by comparing the actual configuration result with the expected configuration result, including: Select the current configuration layer in hierarchical order and issue configuration instructions to each topology node. After the configuration instructions are executed, collect the configuration parameters and link status of the corresponding ports of each topology node, establish the actual mapping relationship between port identifiers and configuration parameters as the actual configuration result, and extract the expected port configuration parameters and expected link status from the hierarchical configuration scheme to establish the expected mapping relationship as the expected configuration result. Iterate through the actual mapping relationship and compare the configuration parameters corresponding to the same port identifier in the expected mapping relationship. Record the port identifiers that do not match as abnormal ports and build an abnormal port set. At the same time, record the actual configuration parameters and expected configuration parameters corresponding to the abnormal ports to form a configuration difference record. Based on the port topology model, trace the topological position of each port in the abnormal port set before the configuration layer is executed, read the port state of each abnormal port before the configuration is executed from the corresponding checkpoint, and compare the port state before the configuration is executed with the current port state to extract the state change amount. When the set of abnormal ports is empty, the current configuration layer is marked as successful and the next configuration layer is executed. When the set of abnormal ports is not empty, the current configuration layer is marked as failed and the set of abnormal ports and the state change are passed to the layered rollback mechanism.
[0046] After selecting the current configuration layer in hierarchical order, configuration commands are sent to all topology nodes within that layer. The sending of configuration commands utilizes a unified command distribution interface, pushing the set of pre-set configuration parameters for the current configuration layer in the hierarchical configuration scheme to the corresponding port controllers item by item. Configuration commands cover various configuration items such as port speed, duplex mode, VLAN binding, traffic policies, and physical link parameters. Each configuration command carries a port identifier and target parameter value, ensuring that the port controller can accurately locate and execute the corresponding operation. Once the configuration commands reach the port controller, the port controller sequentially completes the writing of each configuration item and sends an execution completion signal back to the upper layer. After all topology nodes in the current configuration layer have returned execution completion signals, the configuration result collection phase begins.
[0047] During the data acquisition phase, a full read of the configuration parameters and link status of the ports corresponding to each topology node in the current configuration layer is performed. Configuration parameters are read by querying the port controller's registers or management interface to obtain parameters such as the port's currently effective speed value, duplex mode flag, VLAN tag set, and queue scheduling policy. Link status acquisition includes real-time information such as the port's physical link connectivity, negotiation status, and error count. The collected port configuration parameters and link status are organized by port identifier, establishing an actual mapping relationship between port identifiers and configuration parameters and link status. This mapping relationship serves as the actual configuration result of the current configuration layer. Simultaneously, the expected port configuration parameters and expected link status corresponding to the current configuration layer are extracted from the hierarchical configuration scheme. Again, an expected mapping relationship is constructed using the port identifier as the key, serving as the reference benchmark for consistency verification, i.e., the expected configuration result.
[0048] The core operation of consistency verification is to compare the actual mapping relationship with the expected mapping relationship item by item. It iterates through all port identifiers in the expected mapping relationship, and for each port identifier, extracts the corresponding configuration parameter items in the actual mapping relationship and compares them with the expected configuration parameter items numerically or in terms of status. For numerical parameters (such as rate and queue weight), exact matching is used; for status parameters (such as link connectivity status), enumerated value matching is used. If the actual value of a port identifier for a certain configuration item is inconsistent with the expected value, the port identifier is determined to be abnormal and recorded in the abnormal port set. The abnormal port set is maintained as a list of port identifiers to avoid the same port being counted repeatedly due to multiple abnormal configuration items. For each port entering the abnormal port set, the actual value and expected value of each configuration item with deviation are recorded synchronously, forming a configuration difference record. The configuration difference record uses the port identifier as an index to store the "actual value - expected value" pairs for each abnormal configuration item, which are used for the generation of subsequent rollback reports and problem localization.
[0049] After identifying the abnormal port set, it is necessary to further quantify the offset degree of each abnormal port from the perspective of state changes. Based on the port topology model, the topological position of each port in the abnormal port set before the execution of the current configuration layer is traced to confirm the configuration layer to which each abnormal port belongs and its node position in the topology model. Before the execution of the current configuration layer, checkpoints have been set for that configuration layer, and the checkpoints store a complete state snapshot of each port before the execution of the current configuration layer. The port state of each port in the abnormal port set before configuration execution is read from the corresponding checkpoint, that is, all configuration parameters and link states of that port at the time of the checkpoint recording. The port state before configuration execution is compared item by item with the currently actually collected port state, and the differences between the two are extracted to obtain the state change amount. The state change amount reflects the actual state changes that occurred to each abnormal port during the execution of the current configuration layer, including both expected changes and potentially unexpected additional changes. This information is of great guiding significance for the subsequent layered rollback mechanism to accurately restore the port state.
[0050] The extraction of state change quantities is performed using a field-by-field differencing method. Let the value of a certain configuration field of a port in the abnormal port set at the checkpoint recording time be... The actual value of this field at the current acquisition time is ,when At that time, the field is marked as a changed field, and... and Both are recorded in the state change variables so that they can be directly used during rollback. cover This restores the data to its state at the checkpoint. For numeric fields, it can also record the magnitude of change. The system assists in analyzing the configuration offset direction, but the actual rollback operation involves directly writing back the data. As the standard, not relying on Perform calculations to restore the original state.
[0051] After constructing the abnormal port set and extracting the state change variables, different subsequent processes are executed depending on whether the abnormal port set is empty. When the abnormal port set is empty, it means that the actual configuration results of all ports in the current configuration layer are consistent with the expected configuration results. The current configuration layer is marked as successful, and the process continues to the next configuration layer. The above configuration command issuance, result collection, and consistency verification process is repeated according to the hierarchical order of the layered configuration scheme until all configuration layers have been executed. When the abnormal port set is not empty, it means that at least one port configuration in the current configuration layer fails to meet expectations. The current configuration layer is marked as failed, the execution of subsequent configuration layers is stopped, and the abnormal port set and state change variables are immediately passed to the layered rollback mechanism. After receiving these two inputs, the layered rollback mechanism, combined with the global port state saved in the corresponding checkpoint, performs precise state recovery operations on the ports involved in the failed configuration layer and its subsequent configuration layers, ensuring that the configuration state of the entire multi-port network interface card is rolled back to the stable state before the start of this change operation.
[0052] The aforementioned consistency verification process identifies configuration deviations with granularity down to a single configuration field on a single port. This enables rapid location of specific abnormal ports and their abnormal configuration items in large-scale multi-port network interface card (NIC) scenarios, avoiding unnecessary full rollbacks caused by a general judgment that the entire configuration layer has failed. At the same time, the precise recording of state changes provides a minimized and accurate recovery basis for the layered rollback mechanism, effectively reducing the interference of rollback operations on non-abnormal ports and improving the reliability and efficiency of overall configuration changes.
[0053] When consistency verification at any configuration layer fails, a layered rollback mechanism is immediately triggered. The global port state is retrieved from the checkpoint corresponding to the failed configuration layer, and state recovery is performed only on the ports involved in the failed configuration layer and its subsequent configuration layers, including: Receive the set of abnormal ports and the amount of state change transmitted by the consistency verification, read the global port status from the checkpoint corresponding to the failed configuration layer, and determine the rollback target status of each port in the set of abnormal ports based on the amount of state change. According to the hierarchical order of the hierarchical configuration scheme, identify the subsequent configuration layers of the failed configuration layer, trace the ports involved in the subsequent configuration layers downstream from the abnormal port set along the topological path of the port topology model, and construct a hierarchical rollback set by hierarchically grouping the abnormal port set and the ports involved in the subsequent configuration layers according to the hierarchical order. Iterate through each port in the layered rollback set to extract the current configuration parameters and link status. For ports in the abnormal port set, directly use the rollback target status. For ports involved in subsequent configuration layers, extract historical status from the global port status and compare them. Classify the comparison results according to the differences in configuration parameters and link status, and construct parameter rollback instructions and link reset instructions respectively. Process each layer group in the layered rollback set in reverse order of hierarchical order. Within each layer group, first issue the parameter rollback command and then issue the link reset command. The state recovery is completed when the state of all ports in the layered rollback set is restored.
[0054] When consistency verification fails at any configuration layer, the layered rollback mechanism is immediately triggered. At the trigger moment, the consistency verification module transmits the set of abnormal ports and the corresponding state changes for each abnormal port to the rollback process. The set of abnormal ports contains the identifiers of all ports that failed consistency verification, and the state changes for each abnormal port describe the numerical offsets of the configuration fields before and after the configuration operation. The global port state is read from the checkpoint corresponding to the failed configuration layer. This global port state is a snapshot of the configuration parameters and link states of all ports completely recorded before the execution of that configuration layer, possessing completeness and consistency.
[0055] For each port in the abnormal port set, the rollback target state for each port is calculated backwards based on the state change amount and the historical state recorded in the checkpoint. Specifically, the checkpoint stores the port state before the configuration operation was executed, and the state change amount reflects the actual offset generated by the configuration operation on each configuration field. Therefore, by comparing the checkpoint state with the state change amount, the target value that each abnormal port needs to be restored to in each configuration field can be accurately determined without performing a full state restoration on all ports of the entire network interface card, thereby significantly reducing unnecessary operational overhead.
[0056] After determining the rollback target state for the set of anomalous ports, it is necessary to identify the subsequent configuration layers of the failed configuration layer and trace downstream from the set of anomalous ports along the topological path of the port topology model. The port topology model records the directed dependencies between ports. Starting from the anomalous port, downstream ports are visited hop by hop along this directed relationship, and the ports traversed are categorized according to their respective configuration layers. During the tracing process, each downstream port visited is checked to see if it belongs to a subsequent configuration layer. If the port has already performed configuration operations in a configuration layer after the failed configuration layer, it is included in the corresponding layer group in the layered rollback set. The tracing continues along the topological path until there are no more ports involved in configuration operations downstream.
[0057] Following the hierarchical order of the configuration layers, the abnormal port set and the ports involved in subsequent configuration layers are respectively assigned to their respective hierarchical groups, constructing a complete hierarchical rollback set. All abnormal ports of the failed configuration layer form the first hierarchical group of the hierarchical rollback set, and the ports involved in each subsequent configuration layer constitute their corresponding subsequent hierarchical groups. Each hierarchical group corresponds to a specific configuration layer number, and the number of hierarchical groups in the hierarchical rollback set is equal to the hierarchical span between the failed configuration layer and the last executed configuration layer plus one. This hierarchical grouping organization ensures that subsequent rollback instructions can be processed strictly in reverse hierarchical order, avoiding intermediate dependency conflicts in port states due to disordered order.
[0058] Iterate through each port in each layer of the rollback set, extracting the current configuration parameters and link status of that port. For ports in the abnormal port set, directly use the previously calculated rollback target status as the expected value, comparing the current configuration parameters with each configuration field in the rollback target status to identify discrepancies; compare the current link status with the link flags in the rollback target status to identify the link items that need to be reset. For ports involved in subsequent configuration layers, extract the historical state of the port before the configuration operation was executed from the global port status, using the historical state as the expected value for recovery, and compare the current state with the historical state field by field.
[0059] The comparison results are categorized into two types based on the type of difference: configuration parameter differences and link state differences. Configuration parameter differences refer to inconsistencies between the current and expected values of configurable parameter fields such as rate, MTU, VLAN tagging, and flow control policies. Link state differences refer to inconsistencies between the current and expected states of link attributes such as link enable flags, negotiation status, and binding relationships at the physical or logical layer. For configuration parameter differences, a parameter rollback command is constructed for each differing field. This command carries the port identifier, field name, and target value, and its execution restores the field to the expected state. For link state differences, a link reset command is constructed. This command carries the port identifier and the set of link attributes to be reset, and its execution restores the link to the expected topology connection state.
[0060] The hierarchical rollback set is processed sequentially in reverse order of hierarchical sequence. Reverse order means prioritizing the hierarchical group corresponding to the next configuration layer with the highest hierarchical number, then tracing back level by level, and finally processing the abnormal port groups of the failed configuration layer. The reason for this reverse processing is that ports in subsequent configuration layers are often downstream in the topology dependency. If the state of upstream ports is restored first, it may affect the link negotiation process of downstream ports; however, restoring downstream ports to their historical state first, and then gradually restoring upstream ports, can effectively avoid the risk of state conflicts in dependent links.
[0061] Within each hierarchical group, the execution strictly follows the order of issuing parameter rollback commands first, followed by link reset commands. Prioritizing parameter rollback commands ensures that the configurable parameters of each port have been restored to historical values before a link reset occurs. This ensures that the link negotiation process after the reset occurs under the correct parameters, preventing unexpected negotiation results during link re-establishment due to parameter lag. After issuing parameter rollback commands, the execution results of each command are confirmed individually. Link reset commands are only issued after confirmation. Similarly, the execution results of each link reset command are confirmed individually to ensure that the parameters and links of all ports within the hierarchical group have been restored to their historical states before proceeding to the next hierarchical group (with a lower hierarchical number).
[0062] The state recovery process is complete when all layered groups in the layered rollback set have been processed, and the configuration parameters and link states of all ports have been restored to the historical states recorded at the corresponding checkpoints. At this point, the ports involved in the failed configuration layer and all subsequent configuration layers are in a stable state before the configuration operation was executed, and the configuration consistency of the entire multi-port network interface card is restored. Subsequently, the original configuration change request can be corrected and the configuration process can be re-initiated based on the failed configuration layer identifier and port state difference information in the rollback report.
[0063] Process each layer group in the layered rollback set in reverse order of hierarchical sequence. Within each layer group, first issue the parameter rollback command, then issue the link reset command. State recovery is completed once the state of all ports in the layered rollback set has been restored, including: The hierarchical rollback set is arranged in reverse order of hierarchical number to form a processing queue. Hierarchical groups are extracted from the processing queue in sequence to restore their execution status. Subsequent hierarchical groups are blocked until the current hierarchical group is completed. The current hierarchical group enters the parameter rollback phase. The parameter rollback instructions of each port in the current hierarchical group are extracted and sent out in sequence according to the priority of the configuration items. The actual configuration status of the port is read and verified against the target configuration status in the parameter rollback instructions. If the verification fails, the current hierarchical group status recovery is terminated. After all ports in the current hierarchical group pass the verification, the link reset phase is entered. During the link reset phase, the link reset commands of each port in the current hierarchical group are extracted, sorted according to the position of the port in the topology path, and then sent out in sequence. The actual link status of the port is read and verified against the target link status in the link reset command. If the verification fails, the current hierarchical group status recovery is terminated. After all ports in the current hierarchical group pass the verification, the blocking is lifted and the next hierarchical group status recovery is triggered until all hierarchical groups in the processing queue have completed status recovery.
[0064] After triggering the tiered rollback mechanism, the tiered groups in the tiered rollback set need to be arranged in reverse order according to their tier numbers to construct a processing queue. The reason for this reverse arrangement is that configuration operations are executed sequentially from lowest to highest tier, and higher-level configurations depend on the configuration results of lower-level ones. Therefore, during rollback, higher-level configurations must be undone first, and then lower-level configurations restored, to ensure that port topology dependencies remain consistent throughout the state recovery process. Arranging the tiered groups in descending order of their tier numbers forms an ordered processing queue, and subsequent state recovery operations are strictly performed in the order of this queue.
[0065] Once the processing queue is established, hierarchical groups are retrieved sequentially from the head of the queue. Only one hierarchical group is retrieved for processing at a time. While the current hierarchical group has not yet completed its state recovery, subsequent hierarchical groups in the processing queue are blocked and cannot enter the processing flow prematurely. The blocking mechanism is designed to prevent inconsistencies in port states caused by errors in dependency handling when multiple hierarchical groups concurrently perform state recovery. Only after the state recovery of all ports within the current hierarchical group has passed verification will the blocking of subsequent hierarchical groups be lifted, allowing the next hierarchical group to enter the processing flow.
[0066] After extracting the current hierarchical group, the parameter rollback phase begins. During this phase, parameter rollback instructions for each port within the current hierarchical group are extracted. These instructions record the target configuration parameters for each port in the checkpoint state, including rate parameters, flow control parameters, MTU parameters, VLAN tag configurations, and other configuration items related to the port's service logic. Since different configuration items have dependencies on their effectiveness within a port—for example, VLAN tag configuration can only be correctly bound after the interface rate parameters take effect—the extracted parameter rollback instructions are sorted according to the priority of the configuration items. The priority of configuration items is determined by both the port type and the network plane it resides in; higher-priority configuration items are listed first, and lower-priority items are listed later, ensuring that the order in which the parameter rollback instructions are issued satisfies the internal configuration effectiveness dependencies of the port.
[0067] After prioritization, parameter rollback commands are sent to each port sequentially. After each rollback command is sent, the port's current actual configuration status is read and compared field-by-field with the target configuration status recorded in the command. If the port's actual configuration status matches the target status, the parameter rollback verification for that port's corresponding configuration item passes; otherwise, the verification fails. Upon verification failure, the current hierarchical group's state recovery process is immediately terminated, and no further parameter rollback commands are sent to subsequent ports. The port identifier and failed configuration field information are recorded in the rollback report for subsequent manual investigation or upper-level management processing. The link reset phase is only permitted after all parameter rollback commands for all ports within the current hierarchical group have passed verification.
[0068] Upon entering the link reset phase, the link reset commands corresponding to each port within the current hierarchical group are extracted. These commands restore the port's physical link status and link negotiation parameters to the state recorded at the checkpoint, including link layer configuration information such as port link enable status, auto-negotiation mode, duplex mode, and link aggregation membership. The order in which link reset commands are issued is no longer based on configuration item priority, but rather on the position of each port in the topology path. Specifically, ports at the end of the topology path (i.e., downstream positions) are reset first, followed by ports at the upstream positions. This order is chosen because resetting upstream ports first might trigger upstream port renegotiation before downstream ports recover, leading to brief oscillations in the link status or even negotiation failure. Issuing link reset commands sequentially from downstream to upstream effectively avoids cascading jitter during link status recovery.
[0069] After link reset commands are issued sequentially, each command needs to undergo status verification. The current actual link status of the port is read and compared with the target link status recorded in the link reset command. If the port's actual link status matches the target link status, the link reset verification for that port passes; otherwise, the verification fails. If verification fails, the current hierarchical group's status recovery process is immediately terminated, no more link reset commands are issued to subsequent ports, and the failure information is recorded in the rollback report. The status recovery of the current hierarchical group is considered complete only after all link reset commands for all ports within the current hierarchical group have passed verification.
[0070] Once the current hierarchical group completes its state recovery, it releases the block on the next hierarchical group in the processing queue, triggering the next hierarchical group to perform state recovery according to the same parameter rollback and link reset phases. This process continues in a loop until all hierarchical groups in the processing queue have completed their state recovery. When all ports in the hierarchical rollback set have recovered to the state recorded at the checkpoint, the overall state recovery process is complete, and the subsequent steps involve checkpoint release and rollback report generation.
[0071] Throughout the entire layered rollback execution process, the blocking mechanism, the priority sorting during the parameter rollback phase, and the topology position sorting during the link reset phase work together to ensure that when a multi-port network card experiences a configuration failure, it can restore the port status layer by layer in the correct order and in a verifiable manner. This avoids introducing new port status inconsistencies due to the rollback operation itself, thereby ensuring the atomicity and reliability of the layered rollback.
[0072] like Figure 4 As shown, the horizontal axis of the graph marks the key steps of the rollback operation sequence: "Start," "L3 Parameter Rollback," "L3 Link Reset," "L2 Parameter Rollback," "L2 Link Reset," and "Completion." The vertical axis represents the cumulative percentage of state recovery, ranging from 0% to 100%. The completion rates corresponding to each data point on the curve are 0%, 25%, 50%, 75%, 95%, and 100%, respectively, connected by a smooth line, showing a monotonically increasing trend. The curve trend indicates that the rollback first processes the last configuration layer, Layer 3, performing parameter rollback and link reset sequentially. After this layer is fully recovered, it rolls back in reverse to the failed layer, Layer 2, again performing parameter rollback first and then link reset. The final step reaching 100% indicates that the state of all ports in the layered rollback set has been restored to the historical state recorded at the checkpoint. This progress curve visually demonstrates the core operational order of "reverse layer-by-layer processing" and "parameter-first, link-second within a layer" in the layered rollback mechanism, highlighting the technical effect of accurately restoring only the affected layer and subsequent layers.
[0073] A second aspect of this invention provides a multi-port network interface card (NIC) configuration atomic commit rollback system, comprising: The topology modeling unit is used to obtain configuration change requests for multi-port network cards, parse the configuration change requests to identify the set of ports to be changed and the corresponding configuration parameters, and construct a port topology model based on the communication dependencies between the port sets. A hierarchical configuration unit is used to generate a hierarchical configuration scheme based on the port topology model. The hierarchical configuration scheme divides the configuration operation into a parallel layer that is independent of each other and a serial layer that is dependent on each other. A checkpoint is set for each configuration layer. The checkpoint records the global port state before each configuration layer is executed. The consistency verification unit is used to execute configuration operations according to the hierarchical order of the layered configuration scheme. After all configuration operations of each configuration layer are completed, consistency verification is performed. The consistency verification determines whether each configuration layer is successful by comparing the actual configuration result with the expected configuration result. The rollback recovery unit is used to immediately trigger the layered rollback mechanism when the consistency verification of any configuration layer fails. It obtains the global port status from the checkpoint corresponding to the failed configuration layer and performs state recovery only on the ports involved in the failed configuration layer and its subsequent configuration layers. The rollback report unit is used to release the storage space occupied by the checkpoint after the state recovery is completed, and to generate a rollback report containing the failure configuration layer identifier and the port state difference.
[0074] A third aspect of the present invention provides an electronic device, comprising: processor; Memory used to store processor-executable instructions; The processor is configured to invoke instructions stored in the memory to execute the aforementioned method.
[0075] A fourth aspect of the present invention provides a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the aforementioned method.
[0076] This invention can be a method, apparatus, system, and / or computer program product. The computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for performing various aspects of the invention.
[0077] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention 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 or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A multi-port network interface card (NIC) configuration atomic commit rollback method, characterized in that, include: Obtain the configuration change request of the multi-port network card, parse the configuration change request to identify the set of ports to be changed and the corresponding configuration parameters, and construct a port topology model based on the communication dependencies between the port sets; A hierarchical configuration scheme is generated based on the port topology model. The hierarchical configuration scheme divides the configuration operation into a parallel layer that is independent of each other and a serial layer that is dependent on each other. A checkpoint is set for each configuration layer. The checkpoint records the global port state before each configuration layer is executed. The configuration operations are executed in the hierarchical order of the hierarchical configuration scheme. After all configuration operations in each configuration layer are completed, a consistency verification is performed. The consistency verification determines whether each configuration layer is successful by comparing the actual configuration results with the expected configuration results. When consistency verification of any configuration layer fails, the layered rollback mechanism is immediately triggered. The global port status is obtained from the checkpoint corresponding to the failed configuration layer, and state recovery is performed only on the ports involved in the failed configuration layer and its subsequent configuration layers. After the state recovery is complete, the storage space occupied by the checkpoint is released, and a rollback report containing the failure configuration layer identifier and port state differences is generated.
2. The method according to claim 1, characterized in that, Parse the configuration change request to identify the set of ports to be changed and their corresponding configuration parameters, and construct a port topology model based on the communication dependencies between the port sets, including: Extract port identifiers and configuration parameters from the configuration change request, classify the configuration parameters into flow control parameters and link status parameters according to port functions, and establish a mapping relationship between port identifiers and configuration parameters; The port set is traversed to extract the packet forwarding rules between each network port. Based on the packet forwarding rules, the upstream and downstream relationships between ports are identified. The upstream and downstream relationship is defined as the output traffic of the upstream port being used as the input traffic of the downstream port. A directed dependency chain between ports is constructed based on the upstream and downstream relationship. The system analyzes whether the configuration parameters contain an aggregation configuration identifier. When an aggregation configuration identifier is detected, the ports within the aggregation group are marked as collaborative ports, and a synchronization dependency is established between the collaborative ports. The port set is mapped to the topology node set, the directed dependency chain is mapped to the topology path, and the synchronization dependency relationship is mapped to the topology cluster. The topology nodes in the topology cluster share the configuration execution sequence, forming a port topology model that includes the topology node set, topology path and topology cluster.
3. The method according to claim 1, characterized in that, A hierarchical configuration scheme is generated based on the port topology model. This scheme divides configuration operations into independent parallel layers and dependent serial layers, and sets checkpoints for each configuration layer. These checkpoints record the global port state before each configuration layer is executed, including: Extract the topology path from the port topology model, trace the reachability relationship of each topology node along the topology path, and assign a propagation distance to each topology node according to the reachability relationship. The propagation distance represents the topology span required for a configuration change to propagate from the source node to each topology node. Identify the topology clusters in the port topology model, treat the topology clusters as single configuration units, take the maximum value of the propagation distance of each node in the cluster, and establish configuration synchronization markers in the topology clusters to constrain the nodes in the clusters to complete the configuration at the same configuration layer. Topology nodes are layered according to propagation distance. Topology nodes with the same propagation distance are grouped into the same configuration layer, and dependency depth relationships are established based on the difference in propagation distance between configuration layers. Analyze the topological path connectivity between each configuration layer. If there is a direct connection, establish a direct serial relationship. If there is a connection through an intermediate layer, establish a transit serial relationship. If there is no connection, mark it as an independent parallel relationship. Organize the configuration layers in ascending order of propagation distance to form a layered configuration scheme containing three types of execution relationships. Create hierarchical checkpoints for each configuration layer. Each hierarchical checkpoint records a snapshot of the port status of each configuration layer and its reference relationship with the checkpoints of its predecessor configuration layers, forming a checkpoint dependency chain across configuration layers.
4. The method according to claim 3, characterized in that, Hierarchical checkpoints are created for each configuration layer. These checkpoints record port status snapshots of each configuration layer and their references to checkpoints in preceding configuration layers, forming a cross-configuration-layer checkpoint dependency chain, including: Traverse each configuration layer in the hierarchical configuration scheme, extract the topology nodes contained in each configuration layer, collect the configuration parameters and link status of the corresponding ports of each topology node, and generate a port status snapshot. The dependency depth relationship is queried to identify the preceding configuration layer of each configuration layer. It is then checked whether there is a direct topological path connection between each configuration layer and each preceding configuration layer. If there is a direct connection, it is marked as a direct dependency layer, and if there is a connection through an intermediate configuration layer, it is marked as an indirect dependency layer. Establish direct reference relationships between checkpoints in each configuration layer and checkpoints in each directly dependent layer. The direct reference relationship records the checkpoint identifier and connection topology path of the directly dependent layer. Establish indirect reference relationships between checkpoints in each configuration layer and checkpoints in each indirect dependency layer. The indirect reference relationship records the checkpoint identifiers of the indirect dependency layers and the checkpoint identifier sequence of the intermediate configuration layers. Port state snapshots, direct references, and indirect references are encapsulated as hierarchical checkpoints. Hierarchical checkpoints for each configuration layer are created in ascending order of propagation distance, and checkpoint dependency chains are formed through direct and indirect references.
5. The method according to claim 1, characterized in that, Configuration operations are executed according to the hierarchical order of the layered configuration scheme. After all configuration operations at each configuration layer are completed, consistency verification is performed. The consistency verification determines whether each configuration layer is successful by comparing the actual configuration result with the expected configuration result, including: Select the current configuration layer in hierarchical order and issue configuration instructions to each topology node. After the configuration instructions are executed, collect the configuration parameters and link status of the corresponding ports of each topology node, establish the actual mapping relationship between port identifiers and configuration parameters as the actual configuration result, and extract the expected port configuration parameters and expected link status from the hierarchical configuration scheme to establish the expected mapping relationship as the expected configuration result. Iterate through the actual mapping relationship and compare the configuration parameters corresponding to the same port identifier in the expected mapping relationship. Record the port identifiers that do not match as abnormal ports and build an abnormal port set. At the same time, record the actual configuration parameters and expected configuration parameters corresponding to the abnormal ports to form a configuration difference record. Based on the port topology model, trace the topological position of each port in the abnormal port set before the configuration layer is executed, read the port state of each abnormal port before the configuration is executed from the corresponding checkpoint, and compare the port state before the configuration is executed with the current port state to extract the state change amount. When the set of abnormal ports is empty, the current configuration layer is marked as successful and the next configuration layer is executed. When the set of abnormal ports is not empty, the current configuration layer is marked as failed and the set of abnormal ports and the state change are passed to the layered rollback mechanism.
6. The method according to claim 1, characterized in that, When consistency verification at any configuration layer fails, a layered rollback mechanism is immediately triggered. The global port state is retrieved from the checkpoint corresponding to the failed configuration layer, and state recovery is performed only on the ports involved in the failed configuration layer and its subsequent configuration layers, including: Receive the set of abnormal ports and the amount of state change transmitted by the consistency verification, read the global port status from the checkpoint corresponding to the failed configuration layer, and determine the rollback target status of each port in the set of abnormal ports based on the amount of state change. According to the hierarchical order of the hierarchical configuration scheme, identify the subsequent configuration layers of the failed configuration layer, trace the ports involved in the subsequent configuration layers downstream from the abnormal port set along the topological path of the port topology model, and construct a hierarchical rollback set by hierarchically grouping the abnormal port set and the ports involved in the subsequent configuration layers according to the hierarchical order. Iterate through each port in the layered rollback set to extract the current configuration parameters and link status. For ports in the abnormal port set, directly use the rollback target status. For ports involved in subsequent configuration layers, extract historical status from the global port status and compare them. Classify the comparison results according to the differences in configuration parameters and link status, and construct parameter rollback instructions and link reset instructions respectively. Process each layer group in the layered rollback set in reverse order of hierarchical order. Within each layer group, first issue the parameter rollback command and then issue the link reset command. The state recovery is completed when the state of all ports in the layered rollback set is restored.
7. The method according to claim 6, characterized in that, Process each layer group in the layered rollback set in reverse order of hierarchical sequence. Within each layer group, first issue the parameter rollback command, then issue the link reset command. State recovery is completed once the state of all ports in the layered rollback set has been restored, including: The hierarchical rollback set is arranged in reverse order of hierarchical number to form a processing queue. Hierarchical groups are extracted from the processing queue in sequence to restore their execution status. Subsequent hierarchical groups are blocked until the current hierarchical group is completed. The current hierarchical group enters the parameter rollback phase. The parameter rollback instructions of each port in the current hierarchical group are extracted and sent out in sequence according to the priority of the configuration items. The actual configuration status of the port is read and verified against the target configuration status in the parameter rollback instructions. If the verification fails, the current hierarchical group status recovery is terminated. After all ports in the current hierarchical group pass the verification, the link reset phase is entered. During the link reset phase, the link reset commands of each port in the current hierarchical group are extracted, sorted according to the position of the port in the topology path, and then sent out in sequence. The actual link status of the port is read and verified against the target link status in the link reset command. If the verification fails, the current hierarchical group status recovery is terminated. After all ports in the current hierarchical group pass the verification, the blocking is lifted and the next hierarchical group status recovery is triggered until all hierarchical groups in the processing queue have completed status recovery.
8. A multi-port network interface card (NIC) configuration atomic commit rollback system, used to implement the method as described in any one of claims 1-7, characterized in that, include: The topology modeling unit is used to obtain configuration change requests for multi-port network cards, parse the configuration change requests to identify the set of ports to be changed and the corresponding configuration parameters, and construct a port topology model based on the communication dependencies between the port sets. A hierarchical configuration unit is used to generate a hierarchical configuration scheme based on the port topology model. The hierarchical configuration scheme divides the configuration operation into a parallel layer that is independent of each other and a serial layer that is dependent on each other. A checkpoint is set for each configuration layer. The checkpoint records the global port state before each configuration layer is executed. The consistency verification unit is used to execute configuration operations according to the hierarchical order of the layered configuration scheme. After all configuration operations of each configuration layer are completed, consistency verification is performed. The consistency verification determines whether each configuration layer is successful by comparing the actual configuration result with the expected configuration result. The rollback recovery unit is used to immediately trigger the layered rollback mechanism when the consistency verification of any configuration layer fails. It obtains the global port status from the checkpoint corresponding to the failed configuration layer and performs state recovery only on the ports involved in the failed configuration layer and its subsequent configuration layers. The rollback report unit is used to release the storage space occupied by the checkpoint after the state recovery is completed, and to generate a rollback report containing the failure configuration layer identifier and the port state difference.
9. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to invoke instructions stored in the memory to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, When the computer program instructions are executed by the processor, they implement the method described in any one of claims 1 to 7.