PCIe switch port relay forwarding and congestion control method and system
Patent Information
- Application Number
- CN202610890859.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-18
- Publication Date
- 2026-09-11
AI Technical Summary
[0006]针对以上问题,本申请提供一种PCIe Switch端口中继转发与拥塞控制方法及系统,用于解决如何在突发拥塞时实时改变内部物理连线、将受阻数据流引导至空闲路径,同时确保各端口路由转发表的精准同步并维持数据包序列号连续的问题
将拥塞触发、动态选路、转发表同步写入与序列号时序补偿编排为闭环流程,在改变内部物理连线的同时保证序列号连续,避免改道乱序与重传;
Smart Images

Figure CN122741444A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of computer data transmission technology, specifically a PCIe Switch port relay forwarding and congestion control method and system. Background Technology
[0002] Port relay forwarding and congestion control of high-speed serial bus switches are core components for ensuring the massive data throughput of modern computing systems. The smoothness of data flow within the switch directly affects the operating efficiency of the entire system.
[0003] In related technologies, handling port congestion often relies on backpressure mechanisms, which notify the sender to reduce the transmission rate or directly discard data packets exceeding processing capacity after congestion occurs. This approach is essentially a passive and costly compromise. While it can alleviate local backlog pressure, it is prone to causing drastic fluctuations in overall transmission latency and may even trigger large-scale retransmissions due to the loss of critical data, causing a secondary impact on the overall system performance.
[0004] The crux of the problem with passive handling lies in the contradiction between the physical connection mapping mechanism of the cross-connect matrix inside the switch and the timing requirements of data packets. The switch relies on the cross-connect matrix to establish the physical connection between input and output ports. When a cross-connect path becomes congested due to a sudden backlog of large numbers of data packets, changing the path can easily lead to out-of-order delivery. For example, if a complete file is split into consecutively numbered data packets and sent sequentially, and the original transmission channel becomes congested, if subsequent data packets are forcibly diverted to other idle channels, these diverted packets often arrive at their destination earlier than the packets remaining on the original channel, thus disrupting the continuity of the data packet sequence numbers. This causes the receiving end to be unable to correctly reassemble the packets and request a full retransmission. Furthermore, changes to internal physical connections require the routing tables of each port to be synchronized within a very short time; otherwise, subsequent data packets may be incorrectly delivered within the switch.
[0005] Therefore, how to change the internal physical connections in real time during sudden congestion, guide the blocked data flow to an idle path, and at the same time ensure the accurate synchronization of the routing and forwarding tables of each port and maintain the continuity of the data packet sequence number are the technical problems that need to be solved to overcome the bottleneck of non-blocking transmission in high-speed bus switches. Summary of the Invention
[0006] To address the above problems, this application provides a PCIe Switch port relay forwarding and congestion control method and system, which solves the problem of how to change internal physical connections in real time during sudden congestion, guide blocked data flows to idle paths, and simultaneously ensure accurate synchronization of routing tables on each port and maintain continuous packet sequence numbers. To achieve the above objectives, the technical solution adopted in this application is: According to a first aspect of this application, a PCIe Switch port relay forwarding and congestion control method is provided, comprising: S101, obtain the real-time queue depth value of the input port, and when the real-time queue depth value exceeds the preset queue depth threshold, extract the set of identifiers of the data packets to be forwarded, and group and classify them according to the destination address field to obtain the backlog data packet queue group. S102, parse the backlogged data packet queue group to obtain the target output port identifier, query the bandwidth ratio of each physical connection in the cross matrix maintained by the cross matrix controller inside the PCIe Switch, evaluate the minimum hop number path cost of physical connections below the preset idle threshold to obtain candidate physical connections, and map the candidate physical connections to the target output port identifier to obtain a mapping table entry. S103, based on the number of the candidate physical connection in the mapping table, reallocate the path of the unsent data packets in the backlog data packet queue group to obtain the rerouted data packet set, and generate a routing forwarding table update instruction containing version number and change timestamp; S104, broadcast the routing table update instruction to each port node via the multicast distribution tree, parse the timestamp of each local hardware from the received acknowledgment signal returned by each port node, and when the deviation between the maximum and minimum values in the timestamp is less than the preset clock synchronization threshold, trigger each port node to synchronously write the routing table update instruction to obtain the target routing table. S105, based on the target routing forwarding table, forward the rerouted data packet set, calculate the difference between the last sequence number of the original sending queue of the backlogged data packet queue group and the first sequence number of the rerouted queue, and when the difference is greater than a preset continuity threshold, insert a virtual waiting period identifier field at the beginning of the rerouted data packet set to obtain the adjusted data packet set; S106, calculate the dwell delay duration based on the virtual wait period identifier field, and correct the hardware clock timestamp of the set arriving at the output port according to the dwell delay duration. Control the release timing of the adjusted data packet set according to the corrected timestamp, and output the final data stream with continuous sequence numbers.
[0007] Preferably, step S101 includes: reading the register status of the input port at a preset polling period to obtain the real-time queue depth value; When the real-time queue depth value exceeds the preset queue depth threshold, the destination address field associated with each identifier in the set of identifiers of the data packets to be forwarded is extracted, and the longest prefix matching is performed on the destination address field to obtain the target output port identifier of each data packet to be forwarded. The target output port identifier is classified using a decision tree algorithm, and data packets with the same target output port identifier are grouped into the same queue to obtain the backlog data packet queue group.
[0008] Preferably, the method further includes: counting the number of backlogged packets in each queue of the backlogged data packet queue group; generating a congestion alarm signal when the number of backlogged packets exceeds a preset threshold; and triggering a routing mapping step based on the congestion alarm signal.
[0009] Preferably, S102 includes: parsing the backlogged data packet queue group to obtain the target output port identifier, calling the cross-connect matrix controller inside the corresponding PCIe Switch, and using the ratio of the current number of transmitted bytes of each physical connection in the cross-connect matrix to the total link capacity of the physical connection as the occupied bandwidth ratio; Physical connections whose bandwidth usage ratio is lower than the preset idle threshold are included in the set of idle physical connections; starting from the congested input port, the topology of the cross matrix is traversed by breadth-first search, and the number of connection hops to reach the target output port is used as the path cost. The physical connection with the lowest path cost is selected as the candidate physical connection, and the source port identifier, the target output port identifier, and the number of the physical connection are combined to obtain the mapping table entry.
[0010] Preferably, S103 includes: parsing the transmission status of each data packet in the corresponding backlog data packet queue group according to the number of the candidate physical connection in the mapping table entry, and extracting the data packets with the transmission status of "not sent" as the target data packets; By comparing the old path of the target data packet with the mapping table entry, a candidate physical connection that does not overlap with the old path is determined, and the routing jump field of the target data packet is modified to point to the candidate physical connection, thereby obtaining the set of redirected data packets; The physical connection number, port identifier, old path identifier, and new path identifier involved in the rerouting data packet set are combined to generate a path change record table; a secure hash algorithm is used to calculate a checksum for the path change record table, version number, and change timestamp, and then the checksum is encapsulated to obtain the routing forwarding table update instruction.
[0011] Preferably, step S104 includes: constructing the multicast distribution tree using a shortest path tree algorithm based on the topology data of the switching network; The timestamps in the received acknowledgment signals returned by each port node are aligned according to the node identifier. The isolated forest algorithm is used to detect anomalies in the aligned timestamps and remove abnormal timestamps. Calculate the maximum deviation of the remaining timestamps, and generate a synchronization trigger signal when the maximum deviation is less than the preset clock synchronization threshold.
[0012] Preferably, the method further includes: controlling each port node to align to the same write time according to the synchronization trigger signal, and simultaneously performing a routing table write operation; verifying the version number of each port node after writing, and determining that the target routing table is obtained when the version numbers of each port node are consistent.
[0013] Preferably, step S105 includes: calculating a hash index for the target node number of the data packets in the redirected data packet set using a division remainder hash algorithm, and matching the path mapping relationship in the target routing forwarding table according to the hash index to complete forwarding addressing; Calculate the difference between the last sequence number of the original sending queue of the backlogged data packet queue group and the first sequence number of the rerouting queue. When the difference is greater than the preset continuity threshold, encode the difference as a virtual waiting period identifier field and insert it into the header of the rerouting data packet set to obtain the adjusted data packet set.
[0014] Preferably, step S106 includes: multiplying the number of cycles represented by the virtual waiting cycle identifier field by a preset base waiting cycle to obtain the dwell delay duration; The corrected timestamp is obtained by adding the hardware clock timestamp to the dwell delay duration. When the system real-time time reaches the corrected timestamp, the adjusted data packet set is released from the output port buffer to the physical link, and a final output data stream with consecutive output sequence numbers is output.
[0015] According to a second aspect of this application, a PCIe Switch port relay forwarding and congestion control system is provided, comprising: The congestion detection grouping module is configured to obtain the real-time queue depth value of the input port, and when the real-time queue depth value exceeds the preset queue depth threshold, extract the set of identifiers of the data packets to be forwarded, and group and classify them according to the destination address field to obtain the backlog data packet queue group. The routing mapping module is configured to parse the backlogged data packet queue group to obtain the target output port identifier, query the bandwidth ratio of each physical connection in the cross matrix maintained by the cross matrix controller inside the PCIe Switch, evaluate the minimum hop number path cost of physical connections below the preset idle threshold to obtain candidate physical connections, and map the candidate physical connections to the target output port identifier to obtain a mapping table entry. The path reassignment module is configured to reassign paths to the backlog of packets in the queue group of unsent packets based on the number of the candidate physical connection in the mapping table entry, and generate a routing table update instruction containing version number and change timestamp. The forwarding table synchronization module is configured to broadcast the routing forwarding table update instruction to each port node via a multicast distribution tree, collect the timestamp of the reception confirmation signal returned by each port node, and trigger each port node to synchronously write the routing forwarding table update instruction when the maximum deviation of the timestamp is less than a preset clock synchronization threshold, thereby obtaining the target routing forwarding table. The timing compensation module is configured to forward and address the rerouted data packet set according to the target routing forwarding table, calculate the difference between the last sequence number of the original sending queue of the backlogged data packet queue group and the first sequence number of the rerouted queue, and insert a virtual waiting period identifier field at the beginning of the rerouted data packet set when the difference is greater than a preset continuity threshold, so as to obtain the adjusted data packet set. The release control module is configured to calculate the dwell delay duration based on the virtual wait period identifier field, correct the hardware clock timestamp of the set arriving at the output port based on the dwell delay duration, control the release timing of the adjusted data packet set based on the corrected timestamp, and output a final output data stream with continuous sequence numbers.
[0016] The beneficial effects of this application include: The congestion triggering, dynamic routing, synchronous writing of forwarding table and sequence number timing compensation are arranged into a closed loop process, which ensures the continuity of sequence numbers while changing internal physical connections, and avoids rerouting and retransmission. Minimum hop routing is performed based on the measurement of the bandwidth occupied by physical connections in the cross-connect matrix, so that blocked data flows are guided to idle paths and port congestion is alleviated. Update commands are broadcast via multicast distribution tree and the timing of writes is constrained by clock synchronization thresholds to ensure that the routing table versions of each port are consistent and to avoid erroneous delivery. By offsetting and correcting the hardware clock timestamp through the virtual wait period identifier field and dwell delay, the release timing can be precisely controlled at the output port, thereby improving the overall throughput performance of the switching network. Attached Figure Description
[0017] Figure 1 This is a flowchart illustrating the PCIe Switch port relay forwarding and congestion control method according to an embodiment of this application; Figure 2 This is a block diagram of the PCIe Switch port relay forwarding and congestion control system according to an embodiment of this application. Detailed Implementation
[0018] To enable those skilled in the art to better understand the technical solution, the present application will be described in detail below with reference to the embodiments. The description in this section is only exemplary and explanatory, and should not be used to limit the scope of protection of the present application in any way.
[0019] The method provided in this embodiment is applied to high-speed serial bus switching devices such as PCIe switches with cross-matrix interfaces. Its port relay forwarding and congestion control logic can be implemented by a smart chip in the switching device. The smart chip includes a processing unit, a buffer static random access memory, a direct memory access controller, a hardware clock oscillator, and a forwarding engine register, etc. See below for reference. Figure 1 The steps S101 to S106 of the method will be described in detail with reference to a preferred embodiment.
[0020] S101. Obtain the real-time queue depth value of the input port. When the real-time queue depth value exceeds a preset queue depth threshold, extract the set of packet identifiers to be forwarded, and group them according to the destination address field to obtain a backlogged packet queue group. In this step, the system polls the register status of the switch input port at a preset polling period through the underlying hardware abstraction layer interface to obtain the current real-time queue depth value. Then, the real-time queue depth value is compared with the preset queue depth threshold stored in non-volatile memory. When the real-time queue depth value exceeds the preset queue depth threshold, it is determined that the input port has a risk of causing micro-burst congestion, thereby triggering the direct memory access controller to bypass the central processing unit and directly read the packet header metadata in batches from the port's buffer static random access memory to extract the set of packet identifiers to be forwarded.
[0021] The preset queue depth threshold is used to determine whether there is a risk of congestion at the input port. Its value is based on the total capacity of the buffer and the expected safety margin, and is generally set to 60% to 80% of the total buffer capacity. If the threshold is too low, it will cause frequent false triggers, while if the threshold is too high, it will only trigger diversion after congestion has actually occurred.
[0022] For each identifier in the set of identifiers for data packets to be forwarded, the system extracts its associated destination address field and performs longest prefix matching on the destination address field, mapping the destination address to a target output port identifier. The longest prefix matching refers to comparing the destination address with each entry's prefix bit by bit in a pre-established routing table, and selecting the target output port identifier corresponding to the entry with the longest matching bit length.
[0023] The preset polling period is used to balance the real-time performance of congestion detection with the overhead of register reading. Its value is based on the maximum burst rate of the input port and the tolerable detection latency, and is usually on the order of microseconds to milliseconds. The shorter the polling period, the more timely the detection, but the greater the reading overhead. In engineering, a value that makes the detection latency less than half the time it takes for a single buffer to fill can be selected.
[0024] Furthermore, the system employs a decision tree algorithm from machine learning to classify the target output port identifiers, grouping data packets with the same target output port identifier into the same queue, thereby generating backlogged data packet queues in memory space divided by target output port. The decision tree algorithm uses information gain as the node partitioning criterion; for a sample set D and a candidate partitioning attribute a, the information gain... The calculation method is as follows: Where Ent(D) is the information entropy of the sample set D, V is the number of values for attribute a, and D v Let |·| be a subset of the sample set D that takes the v-th value on attribute a, and |·| represent the number of samples in the set. The information entropy is calculated as follows: Where K is the total number of categories, p k Let represent the proportion of samples of class k in the sample set D. The system selects the attribute with the largest information gain as the splitting node to construct a decision tree layer by layer. Based on historical forwarding records, the decision tree is trained and pruned through big data analysis to improve the accuracy and stability of classification. Finally, the number of backlogged packets in each queue is counted. When the number of backlogged packets exceeds a preset threshold, a congestion alarm signal is generated, triggering subsequent routing mapping steps. The preset threshold is used to determine whether a queue enters an alarm state, and its value is based on the maximum number of data packets the buffer can carry and the alarm lead time.
[0025] Specifically, when generating the backlogged data packet queue group, the system constructs a hash table in main memory with the target output port identifier as the key. Each data packet identifier to be forwarded is attached to a linked list node corresponding to its target output port, thus forming an ordered queue of data packets with the same target output port in memory. This organized backlogged data packet queue group facilitates fast retrieval by target output port and also allows for path reallocation by queue as a whole in subsequent step S103, avoiding the additional overhead of searching packet by packet.
[0026] In this step, the decision tree model used for target output port classification is trained offline using machine learning. During the training phase, the system collects a large number of forwarding logs generated by the switching equipment during its historical operation, including the destination address field of each data packet, the actual target output port hit, the historical bandwidth occupancy ratio of each physical connection, and the historical receiving timestamp of each port node, forming a training sample set. The training sample set is then statistically analyzed and its features are filtered through big data analysis to remove noise samples and extract several features that are most relevant to the classification results and anomaly detection.
[0027] The decision tree model is trained using the prefix segmentation of the destination address field and the bandwidth ratio of each physical connection as features, and the final target output port as the label; the trained model parameters are solidified and written into the read-only storage area of the smart chip.
[0028] S102. Parse the backlogged data packet queue group to obtain the target output port identifier, query the bandwidth ratio of each physical connection in the cross matrix maintained by the cross matrix controller inside the PCIe Switch, evaluate the minimum hop count path cost of physical connections below the preset idle threshold to obtain candidate physical connections, and map the candidate physical connections to the target output port identifier to obtain a mapping table entry.
[0029] The system reads data packets from the backlogged data packet queue, extracts their network layer headers, parses them to obtain the target output port identifier, and then sends a status query command to the cross-connect matrix controller to obtain the traffic statistics register values for each physical connection. For the i-th physical connection, its bandwidth usage percentage is calculated as follows: Among them, b i Let c be the current number of bytes transmitted for the i-th physical connection. i This represents the total link capacity of the physical connection. The system compares the bandwidth usage ratio of each physical connection with a preset idle threshold one by one, and includes physical connections with bandwidth usage ratios lower than the preset idle threshold into the set of idle physical connections.
[0030] For the set of idle physical connections, the system starts from the congested input port and uses the minimum hop count path calculation method, namely the breadth-first search algorithm, to traverse the topology of the cross matrix, expanding outward layer by layer, and using the number of connections traversed to reach the target output port as the path cost.
[0031] When evaluating the path cost with the minimum hop count, the topology information of the next-hop target node connected to each idle physical connection is first obtained. Then, starting from the current input port and ending at the target output port, a breadth-first search algorithm is used to traverse all reachable intermediate relay nodes in the topology, accumulating the number of switching nodes along the way as the hop count. During the traversal, the total hop count of each idle physical connection is compared horizontally, and redundant paths exceeding a preset maximum span limit are eliminated. Finally, the complete communication path with the smallest absolute total hop count is selected, and its corresponding first idle physical connection is identified as a candidate physical connection, serving as the preferred channel for rerouting subsequent backlogged data packets.
[0032] For a candidate path p consisting of several physical connections, its path cost is calculated as follows: Among them, w e The cost weight of the e-th physical connection traversed by path p is set to one in the case of equal weighting, where the path cost equals the number of hops. The system selects the physical connection that minimizes the path cost as the candidate physical connection and combines the source port identifier, the destination output port identifier, and the number of the physical connection into a mapping table entry, which is written into the forwarding engine register for subsequent forwarding calls.
[0033] S103. Based on the candidate physical connection numbers in the mapping table entries, reallocate paths for unsent data packets in the backlog data packet queue group to obtain a set of redirected data packets, and generate a routing forwarding table update instruction containing version numbers and change timestamps.
[0034] In this step, the system obtains the physical connection numbers and backlogged data packet queue groups from the mapping table entries, parses the transmission status of each data packet, and extracts data packets with a transmission status of "not sent" as target data packets. The system compares the old path of the target data packet with the mapping table entries, determines alternative physical connections that do not overlap with the old path, and uses bitmasking operations to overwrite the routing hop field inside the target data packet that originally pointed to the old path with the number of the alternative physical connection, thereby obtaining a set of rerouted data packets whose paths have been changed.
[0035] Subsequently, the system parses the set of redirected data packets, extracting the physical connection numbers, port identifiers, old path identifiers, and new path identifiers involved. After aligning these values, a path change record table is generated. The system further extracts the global incrementing version number and change timestamp of the current operating environment, and uses a secure hash algorithm to calculate an anti-tampering checksum for the path change record table, version number, and change timestamp. The above content is then encapsulated in a fixed-byte length to obtain the routing table update instruction, which is written to the instruction register of the forwarding chip.
[0036] When encapsulating route forwarding table update commands, the system arranges the version number field, change timestamp field, path change record table body, and checksum field in a fixed byte length. The version number field is globally incremented with each update and is used to verify the consistency of the write results of each port node in S104. The change timestamp field records the generation time of this change and is used to determine the order of update commands when multiple updates arrive concurrently, thereby avoiding old commands from overwriting new commands.
[0037] S104. Broadcast the routing table update instruction to each port node via the multicast distribution tree, parse the timestamp of the local hardware attached by each port node from the received confirmation signal returned by each port node, and when the deviation between the maximum and minimum values of the timestamp is less than the preset clock synchronization threshold, trigger each port node to synchronously write the routing table update instruction to obtain the target routing table.
[0038] In this step, the system constructs a multicast distribution tree using the shortest path tree algorithm based on the topology data of the switching network, and broadcasts routing table update instructions to each port node along the multicast distribution tree. After receiving the update instructions, each port node extracts its own node identifier and uses its local hardware clock to obtain the timestamp of the current reception time. It then packages the node identifier and timestamp into a reception acknowledgment signal and sends it back to the master node along the original path.
[0039] The master control node aligns the timestamps in each received acknowledgment signal according to the node identifier, and uses the Isolation Forest algorithm from machine learning to detect anomalies in the aligned timestamps, removing abnormal timestamps caused by link jitter, etc. The Isolation Forest algorithm calculates the anomaly score for timestamp sample x as follows: Where h(x) is the path length of sample x in a randomly constructed isolation tree, E(h(x)) is the expected path length of sample x across multiple isolation trees, n is the number of samples used to construct the isolation trees, and c(n) is the average path length normalized to the path length, which is calculated as follows: Where H(i) is the harmonic number, which can be approximated as H(i) = ln(i) + γ, where γ is Euler's constant. The closer the anomaly score is to one, the more likely the timestamp is to be an anomaly and should be removed. The system calculates the maximum deviation value of the remaining timestamps after removing anomalies. The maximum deviation value is obtained using the range calculation method, which is as follows: Among them, t i This is the timestamp after alignment of the i-th port node. When the maximum deviation is less than the preset clock synchronization threshold, the system determines that the network is in a high-precision synchronization state and generates a synchronization trigger signal; each port node aligns to the same write time according to the synchronization trigger signal and performs a routing table write operation simultaneously; the system verifies the version number of each port node after writing, and when the version numbers of each port node are consistent, it determines that the target routing table with the same version number has been obtained.
[0040] The preset clock synchronization threshold is used to constrain the timing of writing to the routing table of each port node. Its value is based on the upper limit of the drift of the local clock of each node, and is generally taken as 1.5 to 2 times the upper limit of the drift. If the threshold is too small, the synchronization condition will be difficult to meet and the writing will be delayed. If the threshold is too large, the synchronization accuracy will be relaxed and the delivery risk will be introduced.
[0041] During the broadcast phase, the master node encapsulates the routing table update command into a multicast packet and forwards it layer by layer along the tree topology of the multicast distribution tree to each port node, ensuring that any port node receives at most one update command and avoiding broadcast storms. During the synchronous write phase, each port node aligns its write actions to the same moment based on the synchronization trigger signal, simultaneously initiating memory writes. After the write is complete, the old version of the routing data is completely overwritten by the new version and uniformly assigned a consistent version number, thus constructing a target routing table with completely consistent version numbers throughout the entire switching network.
[0042] The aforementioned routing table and destination routing table are both correspondence tables stored in the forwarding engine. They are established by assigning a destination output port identifier and physical connection number to each destination address prefix based on the topology data during the initialization phase of the switching network, and then performing a synchronized update to ensure version consistency based on the routing table update command.
[0043] The isolated forest model used for timestamp anomaly detection in this step was trained offline using machine learning. During the training phase, the system collected a large number of forwarding logs generated by the switching equipment during its historical operation, including the destination address field of each data packet, the actual target output port hit, the historical bandwidth occupancy ratio of each physical connection, and the historical receiving timestamps of each port node. This constituted a training sample set. The training sample set was then statistically analyzed and its features were filtered through big data analysis to remove noise samples and extract the features that were most relevant to the classification results and anomaly determination.
[0044] The Isolation Forest model takes aligned timestamp sequences as input and learns the distribution of normal timestamps in an unsupervised manner to identify outliers. The trained model parameters are permanently written to the read-only storage area of the smart chip for online access. The system also incrementally retrains the model with newly added forwarding logs at preset intervals and writes the updated model parameters back to the read-only storage area, thus enabling the model to continuously adapt to changes in business traffic distribution through process control feedback.
[0045] S105. Forward addressing of the rerouted data packet set according to the target routing forwarding table, calculate the difference between the last sequence number of the original sending queue of the backlogged data packet queue group and the first sequence number of the rerouted data packet set. When the difference is greater than a preset continuity threshold, insert a virtual waiting period identifier field at the beginning of the rerouted data packet set to obtain the adjusted data packet set.
[0046] When calculating the sequence number difference, the last successfully transmitted and acknowledged data packet in the original transmission queue of the current congested channel is first read in real time through the hardware register of the output port, and its message sequence number is extracted. Then, the first data packet to be transmitted in the rerouted data packet set due to the path change is located, and its header is parsed to extract its initial sequence number. Finally, the subtractor logic in the control unit is called to subtract the sequence number of the last transmitted data packet in the original transmission queue from the initial sequence number of the first rerouted data packet. This yields the sequence number difference, which reflects the potential out-of-order span caused by the rerouting and is used to assess whether a virtual waiting period needs to be inserted.
[0047] The system performs forwarding addressing on the set of redirected data packets, and uses the division remainder hash algorithm to calculate the hash index of the target node number of the data packet. The calculation method is as follows: Where ID is the target node number, M is the number of hash buckets, and mod is the modulo operation. It uses a hash index. The system matches the corresponding path mapping in the target routing table based on the hash index, thereby forwarding the rerouted packet set to the corresponding output port.
[0048] The number of hash buckets M is used to balance the hash collision rate and the table lookup cost. Its value is based on the size of the target node and is generally taken as the least power of the total number of nodes.
[0049] To compensate for the discontinuity of sequence numbers caused by rerouting, the system reads the sequence number of the last sent data packet from the tail of the original sending queue of the backlogged data packet queue group, extracts the sequence number of the first data packet in the rerouting data packet set, and calculates the difference between the two. The calculation method is as follows: in, The sequence number of the first packet in the rerouting packet set. δ is the sequence number of the last transmitted data packet in the original transmission queue, and δ is the sequence number difference. When the difference δ is greater than a preset continuity threshold, the system encodes the difference as a virtual waiting period identifier field and inserts it into the header of the rerouted data packet set to obtain the adjusted data packet set carrying timing compensation information.
[0050] A preset continuity threshold is used to determine whether timing compensation is needed. Its value is based on the size of the out-of-order window that the receiver can tolerate, and is generally taken as the sequence number span corresponding to the lower boundary of the out-of-order window. If the threshold is too large, it will cause missed compensation and out-of-order events. If the threshold is too small, it will frequently insert virtual waiting period identifier fields, thereby increasing the latency.
[0051] When inserting the virtual wait period identifier field, the system allocates a contiguous memory space, converts the sequence number difference into a fixed-length binary code, and uses a memory copy instruction to shift the original rerouted data packet set backward by the corresponding number of bytes. The code is then written into the freed-up header space as the virtual wait period identifier field, thus carrying timing compensation information without destroying the original data packet content.
[0052] S106. Calculate the dwell delay duration based on the virtual wait period identifier field, offset and correct the hardware clock timestamp of the set arriving at the output port, control the release timing of the adjusted data packet set based on the corrected timestamp, and output the final data stream with continuous sequence numbers.
[0053] When the adjusted data packet set arrives at the target output port, the system triggers a hardware interrupt mechanism to read the current count value of the hardware clock oscillator, obtains the hardware clock timestamp of the arrival of the set, and reads the number of cycles represented by the virtual wait cycle identifier field in the header of the set. The system multiplies this number of cycles by the preset base wait cycle to obtain the dwell delay duration, which is calculated as follows: Where N is the number of periods represented by the virtual waiting period identifier field, and T0 is the preset base waiting period. The dwell time delay duration. The system further adds the hardware clock timestamp to the dwell time delay duration to obtain the corrected timestamp, which is calculated as follows: in, For hardware clock timestamps, The corrected timestamp is used. The system stores the adjusted set of data packets in the output port buffer. The scheduler continuously compares the system real-time time with the corrected timestamp. When the system real-time time reaches the corrected timestamp, the direct memory access controller is triggered to release the set from the output port buffer to the physical link. As a result, all out-of-order data packets are reassembled according to the incremental waiting period assigned to their original sequence numbers, ultimately forming a continuous output data stream on the physical link.
[0054] The preset base wait period is used to convert the virtual wait period identifier field into the dwell delay duration. Its value is based on the transmission time of a single data packet on the physical link, and can be the transmission time or an integer fraction thereof.
[0055] When controlling the release timing, the output port buffer is organized as a priority queue. The scheduler continuously compares the system real-time with the corrected timestamp of each data packet set with a preset polling precision. Only when the system real-time reaches the corrected timestamp of a data packet set is the data packet set allowed to be released to the physical link. This allows data packets that arrive earlier but have later sequence numbers to wait in the buffer for the corresponding dwell time, while data packets with earlier sequence numbers are output first, and finally the continuous increment of sequence numbers is restored on the physical link.
[0056] In a specific example, suppose an input port becomes congested, and a batch of data packets is diverted to an idle path. The last data packet sent from the original transmission queue has a sequence number of 100, while the first data packet in the diverted packet set has a sequence number of 105, a difference of 5, exceeding a preset continuity threshold. Therefore, the system inserts a virtual wait period identifier at the beginning of the diverted packet set, representing a wait of 5 periods. Each basic wait period is 10 nanoseconds, thus calculating a total dwell time of 50 nanoseconds. When the diverted packet set arrives at the output port, the hardware clock timestamp is recorded, and 50 nanoseconds are added to this timestamp as the corrected release time. The output port scheduler continuously compares the system's real-time time, and only allows the set to be sent to the physical link when the corrected release time has been reached. During this 50-nanosecond wait, data packets with sequence numbers 101 to 104, originally stuck in the original channel, are prioritized for transmission. Finally, the output end sends out a continuous stream of data with sequence numbers 100, 101, 102, 103, 104, 105... in sequence, which effectively avoids out-of-order retransmission and improves the overall throughput performance of the switching network while alleviating congestion.
[0057] To improve the robustness of the solution, this application sets up an exception handling mechanism in each step. In S102, if there are no physical connections in the cross-connect matrix with a bandwidth ratio lower than the preset idle threshold, the system continues to forward data packets along the original path and marks the input port as continuously congested, waiting for reassessment in the next polling cycle, thus avoiding secondary congestion caused by forced rerouting due to the lack of available idle connections.
[0058] The preset idle threshold is used to filter idle physical connections that can be rerouted. The value is based on the rated carrying capacity of the link and the new load after rerouting, and is generally set to 40% to 60%. If the threshold is too high, it will misjudge the critical load connection as idle and cause secondary congestion. If the threshold is too low, there will be too few available connections.
[0059] In S104, if the maximum deviation of the acknowledgment signal timestamps of each port node is not less than the preset clock synchronization threshold within the preset waiting time, the system abandons the current synchronization write and retains the original target route forwarding table. The write will proceed only after the clock is resynchronized, thus avoiding the writing of inconsistent routing data during clock out-of-sync conditions. In S106, if the corrected timestamp of a packet set is earlier than the system real-time due to clock drift, the packet set is immediately released and no longer resides there, to avoid unnecessary delay accumulation.
[0060] When generating the routing table update command in S103, a secure hash algorithm is used to calculate the checksum of the path change record table, version number, and change timestamp. After receiving the update command in S104, each port node recalculates the checksum of the received content using the same secure hash algorithm and compares it bit by bit with the checksum carried in the command. Only when the two match is the write operation performed; otherwise, the command is discarded and a retransmission is requested. This prevents the update command from being incorrectly written due to bit flipping or truncation during multicast transmission, ensuring the integrity and consistency of the routing data across the entire network.
[0061] The training samples for machine learning models such as decision trees and isolated forests in the above steps are derived from historical forwarding records and historical timestamp records, and the model parameters can be periodically updated through offline big data analysis.
[0062] Furthermore, the preset queue depth threshold, preset idle threshold, preset clock synchronization threshold, preset continuity threshold, and preset basic waiting period in this application can all be adaptively adjusted during operation using process control. Specifically, the system uses a sliding time window to statistically analyze the number of congestion triggers, rerouting success rate, and output out-of-order rate per unit time, forming a feedback quantity. When the number of congestion triggers remains high, the preset queue depth threshold is appropriately lowered to intervene and alleviate congestion earlier. When the rerouting success rate is low, the preset idle threshold is appropriately raised to expand the range of available idle connections. When the output out-of-order rate is high, the preset basic waiting period is appropriately raised to enhance the timing compensation intensity. The above adjustments are made gradually in a closed-loop feedback manner between adjacent statistical periods, avoiding the introduction of new instabilities due to drastic threshold jumps.
[0063] For ease of understanding, the main data structures involved in this application are further explained below. The mapping table entry includes at least three fields: source port identifier, destination output port identifier, and physical connection number, used to uniquely describe a rerouting path. Each record in the path change record table includes at least the old physical connection number, old port identifier, new physical connection number, and new port identifier, used to completely depict a path change. The virtual wait period identifier field is a fixed-length field inserted at the beginning of the data packet set; its value represents the number of wait periods required to compensate for the data packet set relative to the original transmission order. All the above data structures are stored in fixed-length field alignment for easy hardware bit-by-bit extraction and writing.
[0064] In a specific example of this application, when the physical connections of the cross-connect matrix have different transmission capabilities, in step S102, the cost weight of each physical connection is set to be inversely proportional to the remaining available bandwidth of that physical connection. This causes the path cost evaluation to further favor physical connections with larger remaining available bandwidth when the number of hops is the same. The selected alternative physical connections at this time have more ample carrying capacity while reducing the number of hops, further reducing the probability of secondary congestion after rerouting. The remaining steps of this embodiment are the same as in embodiment one.
[0065] In another specific example of this application, when the set of redirected data packets is large, in S105, instead of uniformly inserting a single virtual waiting period identifier field at the beginning of the set, the virtual waiting period identifier field is calculated and written for each data packet based on the sequence number difference of each data packet relative to the original sending queue. Correspondingly, in S106, the dwell delay duration is calculated based on the virtual waiting period identifier field of each data packet, and the release timing is controlled. Thus, even when there are multiple out-of-order segments within the set of redirected data packets, the sequence number continuity can still be restored packet by packet. The remaining steps of this embodiment are the same as in Embodiment 1.
[0066] This application also provides a PCIe Switch port relay forwarding and congestion control system, referring to... Figure 2 The system includes a congestion detection grouping module, a route selection mapping module, a path reallocation module, a forwarding table synchronization module, a timing compensation module, and a release control module. Among them: The congestion detection grouping module is configured to obtain the real-time queue depth value of the input port, and when the real-time queue depth value exceeds the preset queue depth threshold, extract the set of identifiers of the data packets to be forwarded, and group and classify them according to the destination address field to obtain the backlog data packet queue group. The routing mapping module is configured to parse the backlogged data packet queue group to obtain the target output port identifier, query the bandwidth ratio of each physical connection in the cross matrix maintained by the cross matrix controller inside the PCIe Switch, evaluate the minimum hop number path cost of physical connections below the preset idle threshold to obtain candidate physical connections, and map the candidate physical connections to the target output port identifier to obtain a mapping table entry. The path reassignment module is configured to reassign paths to the backlog of packets in the queue group of unsent packets based on the number of the candidate physical connection in the mapping table entry, and generate a routing table update instruction containing version number and change timestamp. The forwarding table synchronization module is configured to broadcast the routing forwarding table update instruction to each port node via a multicast distribution tree, collect the timestamp of the reception confirmation signal returned by each port node, and trigger each port node to synchronously write the routing forwarding table update instruction when the maximum deviation of the timestamp is less than a preset clock synchronization threshold, thereby obtaining the target routing forwarding table. The timing compensation module is configured to forward and address the rerouted data packet set according to the target routing forwarding table, calculate the difference between the last sequence number of the original sending queue of the backlogged data packet queue group and the first sequence number of the rerouted queue, and insert a virtual waiting period identifier field at the beginning of the rerouted data packet set when the difference is greater than a preset continuity threshold, so as to obtain the adjusted data packet set. The release control module is configured to calculate the dwell delay duration based on the virtual wait period identifier field, offset and correct the hardware clock timestamp of the set arriving at the output port, control the release timing of the adjusted data packet set based on the corrected timestamp, and output a final output data stream with continuous sequence numbers.
[0067] The modules sequentially transmit the backlogged data packet queue group, mapping table entries, rerouting data packet set and routing table update instructions, destination routing table, and adjusted data packet set in the execution order of S101 to S106, thereby collaboratively achieving port relay forwarding and congestion control. The specific implementation of the above system embodiment corresponds to the above method embodiment.
[0068] It should be noted that, in this document, the terms "comprising," "including," and any other variations are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Specific examples have been used in this document to illustrate the principles and implementation methods of the technical solutions of this application. The above examples are only for the purpose of helping to understand the methods and core ideas of this application. The above descriptions are merely preferred embodiments of this application. It should be pointed out that, due to the limitations of written expression and the objective existence of infinite specific structures, those skilled in the art can make several improvements, modifications, or changes without departing from the principles of this application, and can also combine the above technical features in an appropriate manner; these improvements, modifications, changes, or combinations, or the direct application of the concept and technical solutions of this application to other situations without modification, should all be considered within the scope of protection of this application.
Claims
1. A PCIe Switch port relay forwarding and congestion control method, characterized in that, include: S101, obtain the real-time queue depth value of the input port, and when the real-time queue depth value exceeds the preset queue depth threshold, extract the set of identifiers of the data packets to be forwarded, and group and classify them according to the destination address field to obtain the backlog data packet queue group. S102, parse the backlogged data packet queue group to obtain the target output port identifier, query the bandwidth ratio of each physical connection in the cross matrix maintained by the cross matrix controller inside the PCIe Switch, evaluate the minimum hop number path cost of physical connections below the preset idle threshold to obtain candidate physical connections, and map the candidate physical connections to the target output port identifier to obtain a mapping table entry. S103, based on the number of the candidate physical connection in the mapping table, reallocate the path of the unsent data packets in the backlog data packet queue group to obtain the rerouted data packet set, and generate a routing forwarding table update instruction containing version number and change timestamp; S104, broadcast the routing table update instruction to each port node via the multicast distribution tree, parse the timestamp of each local hardware from the received acknowledgment signal returned by each port node, and when the deviation between the maximum and minimum values in the timestamp is less than the preset clock synchronization threshold, trigger each port node to synchronously write the routing table update instruction to obtain the target routing table. S105, based on the target routing forwarding table, forward the rerouted data packet set, calculate the difference between the last sequence number of the original sending queue of the backlogged data packet queue group and the first sequence number of the rerouted queue, and when the difference is greater than a preset continuity threshold, insert a virtual waiting period identifier field at the beginning of the rerouted data packet set to obtain the adjusted data packet set; S106, calculate the dwell delay duration based on the virtual wait period identifier field, and correct the hardware clock timestamp of the set arriving at the output port according to the dwell delay duration. Control the release timing of the adjusted data packet set according to the corrected timestamp, and output the final data stream with continuous sequence numbers.
2. The PCIe Switch port relay forwarding and congestion control method according to claim 1, characterized in that, S101 includes: reading the register status of the input port at a preset polling period to obtain the real-time queue depth value; When the real-time queue depth value exceeds the preset queue depth threshold, the destination address field associated with each identifier in the set of identifiers of the data packets to be forwarded is extracted, and the longest prefix matching is performed on the destination address field to obtain the target output port identifier of each data packet to be forwarded. The target output port identifier is classified using a decision tree algorithm, and data packets with the same target output port identifier are grouped into the same queue to obtain the backlog data packet queue group.
3. The PCIe Switch port relay forwarding and congestion control method according to claim 2, characterized in that, Also includes: The number of backlogged packets in each queue of the backlogged data packet queue group is counted, and a congestion alarm signal is generated when the number of backlogged packets exceeds a preset threshold. The routing mapping step is triggered based on the congestion alarm signal.
4. The PCIe Switch port relay forwarding and congestion control method according to claim 1, characterized in that, S102 includes: parsing the backlogged data packet queue group to obtain the target output port identifier, calling the cross-connect matrix controller inside the corresponding PCIe Switch, and using the ratio of the current number of transmitted bytes of each physical connection in the cross-connect matrix to the total link capacity of the physical connection as the occupied bandwidth ratio. Physical connections whose bandwidth usage ratio is lower than the preset idle threshold are included in the set of idle physical connections; starting from the congested input port, the topology of the cross matrix is traversed by breadth-first search, and the number of connection hops to reach the target output port is used as the path cost. The physical connection with the lowest path cost is selected as the candidate physical connection, and the source port identifier, the target output port identifier, and the number of the physical connection are combined to obtain the mapping table entry.
5. The PCIe Switch port relay forwarding and congestion control method according to claim 1, characterized in that, S103 includes: based on the number of the candidate physical connection in the mapping table, parsing the transmission status of each data packet in the corresponding backlog data packet queue group, and extracting the data packets with the transmission status of "not sent" as the target data packets; By comparing the old path of the target data packet with the mapping table entry, a candidate physical connection that does not overlap with the old path is determined, and the routing jump field of the target data packet is modified to point to the candidate physical connection, thereby obtaining the set of redirected data packets; The physical connection number, port identifier, old path identifier, and new path identifier involved in the rerouting data packet set are combined to generate a path change record table; a secure hash algorithm is used to calculate a checksum for the path change record table, version number, and change timestamp, and then the checksum is encapsulated to obtain the routing forwarding table update instruction.
6. The PCIe Switch port relay forwarding and congestion control method according to claim 1, characterized in that, S104 includes: constructing the multicast distribution tree using the shortest path tree algorithm based on the topology data of the switching network; The timestamps in the received acknowledgment signals returned by each port node are aligned according to the node identifier. The isolated forest algorithm is used to detect anomalies in the aligned timestamps and remove abnormal timestamps. Calculate the deviation between the maximum and minimum values in the timestamps, and generate a synchronization trigger signal when the maximum deviation is less than the preset clock synchronization threshold.
7. The PCIe Switch port relay forwarding and congestion control method according to claim 6, characterized in that, Also includes: Based on the aforementioned synchronization trigger signal, each port node is controlled to align to the same write time, and the routing forwarding table write operation is performed simultaneously. Verify the version number written to each port node. When the version numbers of each port node are consistent, the target routing table is obtained.
8. The PCIe Switch port relay forwarding and congestion control method according to claim 1, characterized in that, S105 includes: using a division remainder hash algorithm to calculate a hash index for the target node number of the data packets in the redirected data packet set, and matching the path mapping relationship in the target routing forwarding table according to the hash index to complete the forwarding address; Calculate the difference between the last sequence number of the original sending queue of the backlogged data packet queue group and the first sequence number of the rerouting queue. When the difference is greater than the preset continuity threshold, encode the difference as a virtual waiting period identifier field and insert it into the header of the rerouting data packet set to obtain the adjusted data packet set.
9. The PCIe Switch port relay forwarding and congestion control method according to claim 1, characterized in that, S106 includes: multiplying the number of cycles represented by the virtual waiting cycle identifier field by a preset basic waiting cycle to obtain the dwell delay duration; The corrected timestamp is obtained by adding the hardware clock timestamp to the dwell delay duration. When the system real-time time reaches the corrected timestamp, the adjusted data packet set is released from the output port buffer to the physical link, and the final data stream with continuous sequence numbers is output.
10. A PCIe Switch port relay forwarding and congestion control system, characterized in that, include: The congestion detection grouping module is configured to obtain the real-time queue depth value of the input port, and when the real-time queue depth value exceeds the preset queue depth threshold, extract the set of identifiers of the data packets to be forwarded, and group and classify them according to the destination address field to obtain the backlog data packet queue group. The routing mapping module is configured to parse the backlogged data packet queue group to obtain the target output port identifier, query the bandwidth ratio of each physical connection in the cross matrix maintained by the cross matrix controller inside the PCIeSwitch, evaluate the minimum hop number path cost of physical connections below the preset idle threshold to obtain candidate physical connections, and map the candidate physical connections to the target output port identifier to obtain mapping table entries. The path reassignment module is configured to reassign paths to the backlog of packets in the queue group of unsent packets based on the number of the candidate physical connection in the mapping table entry, and generate a routing table update instruction containing version number and change timestamp. The forwarding table synchronization module is configured to broadcast the routing forwarding table update instruction to each port node via a multicast distribution tree, parse the timestamp of the local hardware attached by each port node from the received acknowledgment signal returned by each port node, and trigger each port node to synchronously write the routing forwarding table update instruction when the maximum deviation of the timestamp is less than a preset clock synchronization threshold, thereby obtaining the target routing forwarding table. The timing compensation module is configured to forward and address the rerouted data packet set according to the target routing forwarding table, calculate the difference between the last sequence number of the original sending queue of the backlogged data packet queue group and the first sequence number of the rerouted queue, and insert a virtual waiting period identifier field at the beginning of the rerouted data packet set when the difference is greater than a preset continuity threshold, so as to obtain the adjusted data packet set. The release control module is configured to calculate the dwell delay duration based on the virtual wait period identifier field, correct the hardware clock timestamp of the set arriving at the output port based on the dwell delay duration, control the release timing of the adjusted data packet set based on the corrected timestamp, and output a final output data stream with continuous sequence numbers.