A PCIe protocol request order preservation processing method, device and medium

By timestamping and classifying the request messages of the PCIe Switch chip, and combining this with a timer mechanism, the scheduling delay problem after the allocation of write and read requests is solved, thus achieving efficient request message scheduling.

CN123115033APending Publication Date: 2026-11-17SHANGHAI YUNMAI XINLIAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611571967.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-12
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

After write request packets and read request packets are assigned to different ports in a PCIe switch chip, the scheduling priority of read request packets is low, which makes it impossible to know whether the write request packets have been scheduled, resulting in delay in request packet scheduling and a decrease in overall queue efficiency.

Method used

By timestamping and classifying request messages, an initial request queue is formed. The classified queues are merged according to the port scheduling rules. A timer is used to ensure that low-priority messages are aware of the scheduling status of high-priority messages, thereby achieving parallel processing and packet splitting scheduling.

Benefits of technology

It reduces the scheduling latency of the request message queue, improves the overall scheduling efficiency, and avoids the impact of a single port blockage on global performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123115033A_ABST
    Figure CN123115033A_ABST
Patent Text Reader

Abstract

This invention provides a PCIe protocol request ordering processing method, device, and medium. The method includes: timestamping the request packets to be processed and placing them in an initial request queue; classifying and merging the request packets to be scheduled in the initial request queue to obtain a scheduling request queue; sending several request packets to be scheduled for each target port in the scheduling request queue to the corresponding port request queue; if there are no first-type request packets in the port request queue, but there are second-type or third-type request packets to be scheduled, then starting the corresponding timer; if the timer expires and there are no first-type request packets to be scheduled in the port request queue, then sending an empty packet of the first-type request packet with the largest timestamp number in the scheduling request queue to the port request queue, thereby reducing the scheduling delay of the request packets and improving the scheduling efficiency of the request packet queue.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of PCIe protocol request processing, and in particular to a PCIe protocol request order preservation processing method, device and medium. Background Technology

[0002] A PCIe switch chip is a hardware device based on the PCIe (Peripheral Component Interconnect express, a high-speed serial computer expansion bus standard) protocol. Its core function is to expand the connectivity of the PCIe bus and efficiently manage data traffic. A PCIe switch chip has several data ports. After the request packets of traffic data enter the PCIe switch chip, the PCIe switch chip parses and processes different types of request packets and sorts them according to the corresponding timestamp number (i.e., packet sequence number). Then, according to the preset algorithm inside the PCIe switch chip, it sends different types of request packets to the corresponding data ports.

[0003] Currently, data ports suffer from scheduling latency issues when scheduling request packets. Specifically, if a PCIe switch chip contains a write request packet and a read request packet, and both request packets pertain to the same transaction, but the default scheduling algorithm assigns the write request packet to port 1 and the read request packet to port 2, and the read request packet has a lower scheduling priority than the write request packet, then the read request packet on port 2 can only be scheduled after the write request packet on port 1 has been processed. Since the read and write request packets belong to two different data ports, the read request packet on port 2 cannot know whether the write request packet on port 1 has been scheduled. This results in the read request packet on port 2 never being scheduled, increasing the scheduling latency and impacting the overall scheduling efficiency of the request queue. Summary of the Invention

[0004] To address the aforementioned technical problems, the technical solution adopted by this invention is as follows:

[0005] According to one aspect of this application, a PCIe protocol request order preservation processing method is provided, applied to a PCIe Switch chip, the method comprising:

[0006] Step S100: In response to receiving a pending request message, according to the message type corresponding to the pending request message, timestamp the pending request message, determine the pending request message as a scheduled request message, and place it in the initial request queue.

[0007] Step S200: According to the message type corresponding to the several scheduled request messages in the initial request queue, classify the several scheduled request messages in the initial request queue to obtain the classified request queue corresponding to each message type.

[0008] Step S300: According to the preset scheduling rules corresponding to each target port, several classified request queues are scheduled and merged to obtain a scheduling request queue;

[0009] Step S400: Send the several scheduled request messages corresponding to each target port in the scheduling request queue to the port request queue corresponding to each target port in the order they are in the scheduling request queue.

[0010] Step S500: During the request scheduling process of any port request queue, if there is no request message of type 1 to be scheduled, but there is a request message of type 2 and / or type 3 to be scheduled, then the timer corresponding to the port request queue is started; the scheduling priority of type 1 is higher than that of type 2 and type 3.

[0011] Step S600: If the timer corresponding to the port request queue does not store a new scheduled request message of type 1 before the time limit is reached, then the empty message with the timestamp number corresponding to the scheduled request message of type 1 with the largest timestamp number in the scheduling request queue is sent to the port request queue.

[0012] According to another aspect of this application, a non-transitory computer-readable storage medium is provided, wherein at least one instruction or at least one program is stored in the storage medium, the at least one instruction or the at least one program being loaded and executed by a processor to implement the aforementioned PCIe protocol request order-keeping processing method.

[0013] According to another aspect of this application, an electronic device is provided, including a processor and the aforementioned non-transitory computer-readable storage medium.

[0014] The present invention has at least the following beneficial effects:

[0015] The PCIe protocol request order preservation processing method of the present invention, when PCIe When the switch chip receives a pending request message, it timestamps the message according to its message type and identifies it as a scheduled request message, placing it in the initial request queue. Then, based on the message types of the pending request messages in the initial queue, it categorizes them into different request queues for each message type. Next, according to the preset scheduling rules for each target port, it merges these categorized request queues to obtain a scheduling request queue. The pending request messages in these queues are then reassembled. For each target port, the pending request messages are sent to its corresponding port request queue in the scheduling request queue, following their order within the queue. The pending request messages in the scheduling request queue are then unpacked according to their target ports, and the port request queues for each target port are processed in parallel. Finally, the pending request messages in any port request queue are scheduled sequentially. During the scheduling process, if there are no pending request messages of type 1, but there are pending request messages of type 2 and / or type 3, it means that the pending request message of type 1 corresponding to the pending request message of type 2 or type 3 is located in the other port request queues. Therefore, in order to schedule the pending request message of type 2 or type 3 as soon as possible, the timer corresponding to the port request queue is started. If the timer corresponding to the port request queue does not store a new pending request message of type 1 before the time limit is reached, an empty message with a timestamp corresponding to the pending request message of type 1 with the largest timestamp number in the scheduling request queue is sent to the port request queue. The timestamp numbers of the empty message and the pending request message of type 2 or type 3 are compared so that the pending request message of type 2 or type 3 knows the scheduling status of its corresponding pending request message of type 1, thereby reducing the scheduling delay of the pending request message of type 2 or type 3 and improving the scheduling efficiency of the request message queue. Attached Figure Description

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

[0017] Figure 1A flowchart of a PCIe protocol request order preservation processing method provided in an embodiment of the present invention;

[0018] Figure 2 This is a schematic diagram of the processing flow of the request message in the PCIe protocol request order preservation processing method provided in this embodiment of the invention. Detailed Implementation

[0019] 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.

[0020] This application proposes a PCIe protocol request order-preserving processing method, applied to PCIe switch chips, such as... Figure 1 As shown, the method includes:

[0021] Step S100: In response to receiving a pending request message, according to the message type corresponding to the pending request message, timestamp the pending request message, determine the pending request message as a scheduled request message, and place it in the initial request queue.

[0022] A pending request message is a request message that needs to be processed. This request message can be a read request message or a write request message.

[0023] Furthermore, step S100 includes steps S110-S180:

[0024] Step S110: In response to receiving a request message to be processed, obtain the message type corresponding to the request message to be processed;

[0025] Step S120: If the message type corresponding to the request message to be processed is the first type, then execute steps S130-S150; if the message type corresponding to the request message to be processed is the second type or the third type, then execute steps S160-S170.

[0026] The first type is the Posted request type, also known as the P request, which is a request that does not require a response. Once the requester sends the request message, the transaction ends and there is no need to wait for any response from the target device (Completer). It is a "fire and forget" request operation and is a write request.

[0027] The second type is the Non-Posted request type, also known as the NP request, which is a request that requires a response. After the requester sends the request message, it must wait for the target device to return a Completion message before the transmission is truly completed. This type of request is either a read request or a write request.

[0028] The third type is the Completion request type, also known as the Cpl request. It is a response message. The Completion message is not initiated by the requester, but is a response message that the target device passively sends back to the original requester after receiving and processing a Non-Posted request. When the NP request is a read request, the Cpl request is the response message returned by the read request.

[0029] The scheduling priority of the first type is higher than that of the second and third types to ensure that write operations precede read operations. That is, in the same request queue, the request message of the first type must be completed before the request messages of the second and third types can be processed.

[0030] Step S130: Determine the scheduled request message of type 1 in the initial request queue as the first request message;

[0031] Step S140: Obtain the timestamp number corresponding to each first request message to obtain a first number list A=(A1,A2,...,A1). i ,...,A j ); where i = 1, 2, ..., j; j is the number of first request messages; A i The timestamp number corresponding to the i-th first request message;

[0032] Step S150: Determine the timestamp number V=MAX(A)+1 corresponding to the request message to be processed, and execute step S180;

[0033] MAX() is a preset function for determining the maximum value;

[0034] Since steps S130-S150 process request messages of the first type, and request messages of the first type have the highest priority and need to be processed first, their timestamp number in the initial request queue is only subject to the condition of "being after the request messages of the same type". That is, the timestamp of the newly enqueued request message to be processed is determined as the timestamp of the first type request message with the largest timestamp in the initial request queue plus one.

[0035] like Figure 2 As shown, Figure 2 The Control IP in this context refers to the initial request queue. Figure 2In this context, p* represents the timestamp of the P request message, np* represents the timestamp of the NP request message, and Cpl request did not occur in [the context of the P request message]. Figure 2 As shown in the diagram, its timestamp assignment is the same as that of the NP request message. When a new request message is enqueued, if the request message is a P request message, since the maximum timestamp of the first type of request message in the initial request queue is p5, the timestamp of the newly enqueued request message is determined to be p6.

[0036] Step S160: Determine the second request message as the message to be scheduled in the initial request queue that is of the first type and corresponds to the request transaction of the request message to be processed;

[0037] Step S170: Determine the timestamp number V=W corresponding to the request message to be processed, and execute step S180;

[0038] Where W is the timestamp number corresponding to the second request message;

[0039] Step S180: Determine the pending request message as the scheduled request message and place it in the initial request queue according to the preset placement rules.

[0040] Steps S160-S170 process request messages of type 2 or type 3. Since request messages of type 2 or type 3 can only be processed after request messages of type 1 are processed, the timestamp of request messages of type 2 or type 3 is limited to "being located after the timestamp of the corresponding request message of type 1".

[0041] like Figure 2 As shown in the initial request queue, when a newly enqueued request message is an NP request message or a Cpl request message, it is necessary to first find the first type of request message corresponding to the request message to be processed. If the first type of request message corresponding to the request message to be processed is the request message corresponding to p5, then the timestamp of the request message to be processed is determined as np5 (when the request message to be processed is an NP request message) or cpl5 (when the request message to be processed is a Cpl request message); if the first type of request message corresponding to the request message to be processed is the request message corresponding to p4, then the timestamp of the request message to be processed is determined as np4 or cpl4.

[0042] By assigning timestamps to the request messages described above, it is easier to queue and process the request messages according to the size of the timestamps when processing them later.

[0043] The preset placement rules for the scheduling request messages are as follows:

[0044] Sort according to the ascending order of timestamp numbers;

[0045] Given the same timestamp number, the first type of scheduling request message precedes the second and third types of scheduling request messages.

[0046] Step S200: According to the message type corresponding to the several scheduled request messages in the initial request queue, classify the several scheduled request messages in the initial request queue to obtain the classified request queue corresponding to each message type.

[0047] Furthermore, step S200 includes step S210:

[0048] Step S210: According to the message type corresponding to each scheduled request message in the initial request queue, classify several scheduled request messages of the same type to obtain the first type of the classified request queue, the second type of the classified request queue, and the third type of the classified request queue.

[0049] Among them, the message type of the request messages to be scheduled in the category request queue corresponding to the first type is all of the first type;

[0050] The message type of the request messages to be scheduled in the category request queue corresponding to the second type is all of the second type;

[0051] The message type of the request messages to be scheduled in the category request queue corresponding to the third type is all of the third type;

[0052] The scheduled request messages in each category request queue are sorted in ascending order according to their corresponding timestamp numbers.

[0053] like Figure 2 As shown, Figure 2 The CAI module (ControllIP Adapter Ingress) is the module that implements the classification of scheduling request messages in step S200. After leaving the initial request queue, it classifies all scheduling request messages in the initial request queue by type, with three separate request queues (due to...). Figure 2 The Cpl request message is not displayed, therefore, the categorized request queues corresponding to the Cpl request message are not displayed. Request messages of the first type are all in the categorized request queue corresponding to the first type, request messages of the second type are all in the categorized request queue corresponding to the second type, and request messages of the third type are all in the categorized request queue corresponding to the third type. This categorization of request messages into three types facilitates the reorganization of queues in subsequent modules.

[0054] Step S300: According to the preset scheduling rules corresponding to each target port, several classified request queues are scheduled and merged to obtain a scheduling request queue;

[0055] Furthermore, step S300 includes steps S310-S350:

[0056] Step S310: Parse several pending request messages in each category request queue to obtain the target port identifier corresponding to each pending request message.

[0057] The target port identifier corresponding to the scheduling request message is the identifier of the target port that performs scheduling processing on the scheduling request message, that is, the identifier of the port that processes the scheduling request message, which is also the identifier of the port to which the scheduling request message is sent. The target port corresponding to each scheduling request message is predetermined, and the information of the target port is written in the scheduling request message.

[0058] Step S320: Perform grouping processing on several scheduling request packets with the same target port identifier to obtain a packet list B1, B2, ..., B corresponding to each target port. m ,...,B n Where m = 1, 2, ..., n; n is the number of target ports; B m This is the list of packets corresponding to the m-th target port;

[0059] B m =(B m1 B m2 ,...,B me ,...,B mf(m) ); e = 1, 2, ..., f(m); f(m) is the number of scheduled request packets corresponding to the m-th target port; B me This refers to the e-th scheduling request message corresponding to the m-th target port;

[0060] Step S330: Obtain the preset scheduling rules corresponding to each target port;

[0061] Step S340: According to the scheduling rule corresponding to the m-th target port, perform scheduling on B. m1 B m2 ,...,B me ,...,B mf(m) Sort the packets to obtain the processed packet list C corresponding to the m-th target port. m =(C m1 C m2 ,...,C me ,...,C mf(m) ); C meTo schedule B according to the scheduling rules corresponding to the m-th target port. m The e-th scheduled request message after sorting;

[0062] Step S350: Merge the processed message lists corresponding to several target ports to obtain the scheduling request queue D=(C1,C2,...,C...). m ,...,C n ).

[0063] Figure 2 The XBI module (Cross Bar Ingress) is the module that implements the grouping process in steps S320-S350. It separates several scheduling request messages according to their corresponding target ports to obtain corresponding scheduling request queues, which are then sent to the corresponding target ports.

[0064] Step S400: Send the several scheduled request messages corresponding to each target port in the scheduling request queue to the port request queue corresponding to each target port in the order they are in the scheduling request queue.

[0065] Furthermore, step S400 includes step S410:

[0066] Step S410: List the processed packets C corresponding to the m-th target port. m Send it to the port request queue corresponding to the m-th target port.

[0067] Figure 2 The QME module (Queue Management Egress) is the scheduling module that implements step S400. Each target port has a port request queue, and each port request queue also has three request sub-queues for three message types, which are used to store request messages of the corresponding message types.

[0068] Step S500: During the request scheduling process of any port request queue, if there is no request message of type 1 to be scheduled, but there is a request message of type 2 and / or type 3 to be scheduled, then start the timer corresponding to the port request queue.

[0069] Furthermore, step S500 includes steps S510-S540:

[0070] Step S510: Determine any port request queue as the target request queue;

[0071] Step S520: According to the message type, classify the several request messages to be scheduled in the target request queue to obtain the request sub-queues corresponding to the first type, the second type, and the third type in the target request queue.

[0072] The order of several pending request messages in each request sub-queue is the ascending order of their corresponding timestamp numbers.

[0073] Step S530: Traverse each request subqueue. If the timestamp number of the request message to be scheduled at the head of the request subqueue corresponding to the first type is less than the timestamp number of the request message to be scheduled at the head of the request subqueue corresponding to the second or third type, then output the request message to be scheduled at the head of the request subqueue corresponding to the first type; otherwise, output the request message to be scheduled at the head of the request subqueue corresponding to the second or third type.

[0074] Step S540: If the request subqueue corresponding to the first type is empty, and the request subqueue corresponding to the second or third type is not empty, then start the timer corresponding to the target request queue.

[0075] Step S600: If the timer corresponding to the port request queue does not store a new scheduled request message of type 1 before the time limit is reached, then send the empty message with the timestamp number corresponding to the scheduled request message of type 1 with the largest timestamp number in the scheduling request queue to the port request queue.

[0076] Furthermore, step S600 includes steps S610-S630:

[0077] Step S610: If a new request message to be scheduled is stored in the request sub-queue corresponding to the first type of the target request queue before the timer corresponding to the target request queue reaches the set time limit, then execute step S530; otherwise, execute step S620.

[0078] Step S620: Determine the scheduling request message with the first message type and the largest timestamp number in the scheduling request queue at the current time as the target request message;

[0079] Step S630: Send the empty message with timestamp number corresponding to the target request message to the request sub-queue corresponding to the first type of the target request queue, and execute step S530.

[0080] like Figure 2As shown, after several pending request packets are located in the port request queue, there are two request packets corresponding to np3. According to the preset processing rules, the np3 packet must be processed after the p3 packet is processed. The two np3 packets are respectively assigned to Figure 2 Of the two target ports, the p3 packet is assigned to the second target port. Therefore, there is a problem: the np3 packet in the second target port knows the processing status of the p3 packet. When the p3 packet in the second target port is processed, the np3 packet in the second target port can be processed. However, the np3 packet in the first target port does not know the processing status of the p3 packet. Since the np3 packet in the first target port does not know when the p3 packet will be processed, it will not know when the np3 packet in the first target port can be dequeued, which will cause the port request queue of the first target port to be blocked.

[0081] Therefore, based on the aforementioned problem that "when a large number of Posted write requests (such as memory writes) are distributed to different target ports, subsequent update operations may be blocked due to the buffer of a certain target port being full or the response being slow," this application adopts the processing method of steps S500-S600, adding a timer. Before the corresponding time limit is reached, if no new scheduled request message is stored in the request sub-queue corresponding to the first type of the target request queue, an empty message of the scheduled request message with the largest timestamp number of the first type at the current moment is added to the request sub-queue of the first type. This serves to prompt the np3 message in the first target port to be dequeued. Then, step S500 is executed, and the timestamp number of the scheduled request message (i.e., the newly added empty message) at the head of the request sub-queue corresponding to the first type and the size of the np3 message are checked to dequeue the np3 message.

[0082] This application employs an architecture of "dispersing" and "independent queuing + scheduling" to decompose, classify, independently queue, and reorder the input mixed message stream based on timestamps. This allows requests destined for different ports to be processed separately. Even if a Posted request on a certain port is blocked, it does not affect the progress of Non-Posted or Complete requests sent to other ports, thereby avoiding system stagnation and achieving controllable out-of-order packet processing. This effectively avoids the problem of global performance being affected by the blocking of a single target port.

[0083] The PCIe protocol request order preservation processing method of the present invention, when PCIe When the switch chip receives a pending request message, it timestamps the message according to its message type and identifies it as a scheduled request message, placing it in the initial request queue. Then, based on the message types of the pending request messages in the initial queue, it categorizes them into different request queues for each message type. Next, according to the preset scheduling rules for each target port, it merges these categorized request queues to obtain a scheduling request queue. The pending request messages in these queues are then reassembled. For each target port, the pending request messages are sent to its corresponding port request queue in the scheduling request queue, following their order within the queue. The pending request messages in the scheduling request queue are then unpacked according to their target ports, and the port request queues for each target port are processed in parallel. Finally, the pending request messages in any port request queue are scheduled sequentially. During the scheduling process, if there are no pending request messages of type 1, but there are pending request messages of type 2 and / or type 3, it means that the pending request message of type 1 corresponding to the pending request message of type 2 or type 3 is located in the other port request queues. Therefore, in order to schedule the pending request message of type 2 or type 3 as soon as possible, the timer corresponding to the port request queue is started. If the timer corresponding to the port request queue does not store a new pending request message of type 1 before the time limit is reached, an empty message with a timestamp corresponding to the pending request message of type 1 with the largest timestamp number in the scheduling request queue is sent to the port request queue. The timestamp numbers of the empty message and the pending request message of type 2 or type 3 are compared so that the pending request message of type 2 or type 3 knows the scheduling status of its corresponding pending request message of type 1, thereby reducing the scheduling delay of the pending request message of type 2 or type 3 and improving the scheduling efficiency of the request message queue.

[0084] Embodiments of the present invention also provide a computer program product including program code, which, when the program product is run on an electronic device, causes the electronic device to perform the steps of the methods described above in various exemplary embodiments of the present invention.

[0085] Furthermore, although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.

[0086] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, mobile terminal, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0087] In an exemplary embodiment of this disclosure, an electronic device capable of implementing the above-described method is also provided.

[0088] Those skilled in the art will understand that various aspects of the present invention can be implemented as systems, methods, or program products. Therefore, various aspects of the present invention can be specifically implemented in the following forms: entirely in hardware, entirely in software (including firmware, microcode, etc.), or in a combination of hardware and software, collectively referred to herein as “circuit,” “module,” or “system.”

[0089] An electronic device according to this embodiment of the invention. The electronic device is merely an example and should not be construed as limiting the functionality or scope of the embodiments of the invention.

[0090] Electronic devices are manifested in the form of general-purpose computing devices. Components of an electronic device may include, but are not limited to: at least one processor, at least one memory, and buses connecting different system components (including memory and processor).

[0091] The storage device stores program code that can be executed by the processor to perform the steps described in the "Exemplary Methods" section above, according to various exemplary embodiments of the present invention.

[0092] The storage may include readable media in the form of volatile storage, such as random access memory (RAM) and / or cache memory, and may further include read-only memory (ROM).

[0093] The storage may also include programs / utilities having a set (at least one) of program modules, including but not limited to: an operating system, one or more applications, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.

[0094] A bus can represent one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus that uses any of the various bus architectures.

[0095] Electronic devices can also communicate with one or more external devices (such as keyboards, pointing devices, Bluetooth devices, etc.), one or more devices that enable users to interact with the electronic device, and / or any device that enables the electronic device to communicate with one or more other computing devices (such as routers, modems, etc.). This communication can be performed through input / output (I / O) interfaces. Furthermore, electronic devices can also communicate with one or more networks (such as local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via network adapters.

[0096] In exemplary embodiments of this disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the methods described above is stored. In some possible embodiments, various aspects of the invention may also be implemented as a program product comprising program code that, when the program product is run on a terminal device, causes the terminal device to perform the steps of the various exemplary embodiments of the invention described in the "Exemplary Methods" section of this specification.

[0097] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0098] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.

[0099] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0100] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0101] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of the present invention, and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.

[0102] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0103] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A PCIe protocol request order preservation processing method, applied to a PCIe switch chip, characterized in that, The method includes: Step S100: In response to receiving a pending request message, according to the message type corresponding to the pending request message, the pending request message is timestamped, the pending request message is determined as a scheduled request message, and placed in the initial request queue. Step S200: According to the message type corresponding to the message type of the message type in the initial request queue, classify the message type in the initial request queue to obtain the classification request queue corresponding to each message type. Step S300: According to the preset scheduling rules corresponding to each target port, several classified request queues are scheduled and merged to obtain a scheduling request queue; Step S400: Send the several scheduled request messages corresponding to each target port in the scheduling request queue to the port request queue corresponding to each target port in the order of their order in the scheduling request queue. Step S500: During the request scheduling process of any of the port request queues, if there are no scheduled request messages of type 1, but there are scheduled request messages of type 2 and / or type 3, then the timer corresponding to the port request queue is started; the scheduling priority of type 1 is higher than that of type 2 and type 3. Step S600: If the timer corresponding to the port request queue does not store a new scheduled request message of type 1 before the time limit is reached, then the empty message with the timestamp number corresponding to the scheduled request message of type 1 with the largest timestamp number in the scheduling request queue is sent to the port request queue.

2. The method according to claim 1, characterized in that, Step S100 includes: Step S110: In response to receiving a request message to be processed, obtain the message type corresponding to the request message to be processed; Step S120: If the message type corresponding to the request message to be processed is the first type, then execute steps S130-S150; if the message type corresponding to the request message to be processed is the second type or the third type, then execute steps S160-S170. Wherein, the first type is a Posted request type; the second type is a Non-Posted request type; and the third type is a Completion request type. Step S130: Determine the scheduled request message of the first type in the initial request queue as the first request message; Step S140: Obtain the timestamp number corresponding to each of the first request messages to obtain a first number list A=(A1,A2,...,A1). i ,...,A j ); where i = 1, 2, ..., j; j is the number of the first request messages; A i The timestamp number corresponding to the i-th first request message; Step S150: Determine the timestamp number V=MAX(A)+1 corresponding to the request message to be processed, and execute step S180; MAX() is a preset function for determining the maximum value; Step S160: Determine the second request message as the message to be scheduled in the initial request queue that is of the first type and corresponds to the request transaction of the request message to be processed; Step S170: Determine the timestamp number V=W corresponding to the request message to be processed, and execute step S180; Wherein, W is the timestamp number corresponding to the second request message; Step S180: Determine the pending request message as a scheduled request message and place it in the initial request queue according to the preset placement rules.

3. The method according to claim 2, characterized in that, The preset placement rule for the scheduled request message is as follows: Sort according to the ascending order of timestamp numbers; Given the same timestamp number, the first type of scheduling request message precedes the second and third types of scheduling request messages.

4. The method according to claim 3, characterized in that, Step S200 includes: Step S210: According to the message type corresponding to each of the scheduled request messages in the initial request queue, classify the several scheduled request messages into the same type to obtain the first type of the classified request queue, the second type of the classified request queue, and the third type of the classified request queue. Among them, the message type of the request messages to be scheduled in the category request queue corresponding to the first type is all of the first type; The message type of the request messages to be scheduled in the category request queue corresponding to the second type is all of the second type; The message type of the request messages to be scheduled in the category request queue corresponding to the third type is all of the third type; The scheduled request messages in each of the classification request queues are sorted in ascending order according to their corresponding timestamp numbers.

5. The method according to claim 4, characterized in that, Step S300 includes: Step S310: Parse several of the scheduled request messages in each of the classified request queues to obtain the target port identifier corresponding to each scheduled request message. The target port identifier corresponding to the request message to be scheduled is the identifier of the target port for scheduling the request message to be scheduled; Step S320: Perform grouping processing on several scheduling request packets with the same target port identifier to obtain a packet list B1, B2, ..., B corresponding to each target port. m ,...,B n Where m = 1, 2, ..., n; n is the number of target ports; B m This is the list of packets corresponding to the m-th target port; B m =(B m1 B m2 ,...,B me ,...,B mf(m) ); e = 1, 2, ..., f(m); f(m) is the number of scheduled request packets corresponding to the m-th target port; B me This refers to the e-th scheduling request message corresponding to the m-th target port. Step S330: Obtain the preset scheduling rules corresponding to each target port; Step S340: According to the scheduling rule corresponding to the m-th target port, perform scheduling on B. m1 B m2 ,...,B me ,...,B mf(m) Sort the packets to obtain the processed packet list C corresponding to the m-th target port. m =(C m1 C m2 ,...,C me ,...,C mf(m) ); C me To schedule B according to the scheduling rule corresponding to the m-th target port. m The e-th scheduled request message after sorting; Step S350: Merge the processed message lists corresponding to several target ports to obtain a scheduling request queue D=(C1,C2,...,C...). m ,...,C n ).

6. The method according to claim 5, characterized in that, Step S400 includes: Step S410: List the processed packets C corresponding to the m-th target port. m Send it to the port request queue corresponding to the m-th target port.

7. The method according to claim 6, characterized in that, Step S500 includes: Step S510: Determine any of the port request queues as the target request queue; Step S520: According to the message type, classify the several request messages to be scheduled in the target request queue to obtain the request sub-queues corresponding to the first type, the second type, and the third type in the target request queue; the order of the several request messages to be scheduled in each request sub-queue is the ascending order of the corresponding timestamp numbers; Step S530: Traverse each of the request sub-queues. If the timestamp number of the request message to be scheduled at the head of the request sub-queue corresponding to the first type is less than the timestamp number of the request message to be scheduled at the head of the request sub-queue corresponding to the second or third type, then output the request message to be scheduled at the head of the request sub-queue corresponding to the first type; otherwise, output the request message to be scheduled at the head of the request sub-queue corresponding to the second or third type. Step S540: If the request sub-queue corresponding to the first type is empty, and the request sub-queue corresponding to the second or third type is not empty, then start the timer corresponding to the target request queue.

8. The method according to claim 7, characterized in that, Step S600 includes: Step S610: If a new request message to be scheduled is stored in the request sub-queue corresponding to the first type of the target request queue before the timer corresponding to the target request queue reaches the set time limit, then execute step S530; otherwise, execute step S620. Step S620: Determine the scheduling request message with the first message type and the largest timestamp number in the scheduling request queue at the current time as the target request message; Step S630: Send the empty message with timestamp number corresponding to the target request message to the request sub-queue corresponding to the first type of the target request queue, and execute step S530.

9. A non-transitory computer-readable storage medium, characterized in that, The storage medium stores at least one instruction or at least one program segment, which is loaded and executed by a processor to implement the method as described in any one of claims 1-8.

10. An electronic device, characterized in that, Includes a processor and the non-transitory computer-readable storage medium as described in claim 9.