A kind of PCIe retry buffering area and its implementation
Technical field
The present invention relates to the computer bus technical field, particularly relate to a kind of PCIe retry buffering area and its implementation.
Background technology
In order to adapt to the development of computer technology; The 3rd generation Computer I/O technology has been proposed; Be the PCIe bussing technique, with respect to traditional P CI bussing technique, the PCIe bus all has the performance boost of different brackets at aspects such as bandwidth, time delay, simplification I/O; As aspect the band merit, PCIe can promote several times to hundreds of times with respect to PCI.PCIe has adopted the software architecture that PCI set up, and can adopt PCI Express new technology on the basis of original PCI testing system software framework need not to change, can with the compatibility of operating system, BIOS maintenance 100%.
In the PCIe agreement, comprise PCIe physical layer, PCIe data link layer and PCIe transaction layer.Wherein, the PCIe data link layer has the data re-transmitting function: when the PCIe transaction layer is submitted to PCIe data link layer message, when detecting message and successfully be not sent to data link layer, carry out retransmitting function.But, also do not have open file to disclose at present and how to realize this function easily.
Summary of the invention
In view of this; The invention provides the retry buffering area in a kind of PCIe EBI; When can successfully not be sent to data link layer at the message that the PCIe transaction layer is submitted to the PCIe data link layer; Realize the message retransmitting function, thereby guarantee the integrality of PCIe data in link layer message transmissions.
This scheme is achieved in that
A kind of implementation method of PCIe retry buffering area comprises:
Open up two independently the memory block as data buffer zone and index buffering area; The data buffer zone is used to store the message that the PCIe transaction layer is submitted to the PCIe data link layer; The index buffering area is divided into the identical zone of a plurality of length, and each zone is as the index information of an indexing units store data buffer message, and a plurality of indexing units adopt the chained list mode to organize;
Said index information comprises:
Take mark: represent whether this indexing units is occupied;
Chained list head mark: represent whether the corresponding message of this index information is positioned at the chained list head;
Chain list index: write down the corresponding initial address of indexing units in the index buffering area of next packet voice;
Start of message (SOM) address: the initial address of message in the data buffer zone that the minute book index information is corresponding;
Message length: the message length that the minute book index information is corresponding;
When detecting PCIe transaction layer message transmission incident, deposit message in data buffer zone, set up respective index information and deposit a unappropriated indexing units in; When detecting the ACK incident of data link layer, search the corresponding message of ACK message according to index information, the indexing units that this message is corresponding is changed to chained list head mark and chain list index unoccupied and renewal relative index unit; When detecting the NAK incident of data link layer, search the corresponding message of NAK message and resend according to index information.
Wherein, saidly when detecting PCIe transaction layer message and send incident, deposit message in data buffer zone, set up the step that respective index information deposits a unappropriated indexing units in and comprise:
When detecting the PCIe transaction layer and send to the message of PCIe data link layer; Institute is sent message to be stored in the data buffer zone; In the index buffering area, searching one takies and is labeled as unappropriated indexing units; Upgrade the field contents in this indexing units that finds, make the next unappropriated indexing units of chained list pointed.
Wherein, said when detecting the ACK incident of data link layer, search the corresponding message of ACK message according to index information, the indexing units that this message is corresponding is changed to unoccupied and upgrades the chained list head mark of relative index unit and the step of chain list index is:
When the confirmation of receipt ACK message received from data link layer; From ACK message, obtain sequence of message number; According to said chained list head mark and said chain list index; Begin to search successively the corresponding message of each index information from the linked list head location and whether meet the sequence of message that obtains number, the sequence of message number identical corresponding indexing units of message is updated to unoccupied, and upgrade the content of relative index unit medium chain table header mark and chain list index.
Wherein, said when detecting the NAK incident of data link layer, search the corresponding message of NAK message and the step that resends is according to index information:
When receive from data link layer do not receive NAK message the time; From NAK message, obtain sequence of message number; According to said chained list head mark and said chain list index; Begin to search successively the corresponding message of each index information from the linked list head location and whether meet the sequence of message that obtains number, sequence of message number identical message is resend.
Preferably, said with the transmission message store in the data buffer zone by: with the transmission message store the data trailer in the data buffer zone into, after the data buffer zone is filled with, begins stored messages from the head of data buffer zone, and cover legacy data.
The invention also discloses a kind of PCIe retry buffering area, comprising: data buffer zone, index buffering area and administrative unit; Data buffer zone and index buffering area are two independently memory blocks;
The data buffer zone is used to store the message that the PCIe transaction layer is submitted to the PCIe data link layer;
The index buffering area is divided into the identical zone of a plurality of length, and each zone is as the index information of an indexing units store data buffer message, and a plurality of indexing units adopt the chained list mode to organize; Said index information comprises:
Take mark: represent whether this indexing units is occupied;
Chained list head mark: represent whether the corresponding message of this index information is positioned at the chained list head;
Chain list index: write down the corresponding initial address of indexing units in the index buffering area of next packet voice;
Start of message (SOM) address: the initial address of message in the data buffer zone that the minute book index information is corresponding;
Message length: the message length that the minute book index information is corresponding;
Said administrative unit; Be used for poll detect PCIe transaction layer message send incident, from the ACK incident of data link layer with from the NAK incident of data link layer; When detecting PCIe transaction layer message transmission incident; Deposit message in data buffer zone, set up respective index information and deposit unappropriated indexing units in; When detecting the ACK incident of data link layer, search the corresponding message of ACK message according to index information, the indexing units that this message is corresponding is changed to chained list head mark and chain list index unoccupied and renewal relative index unit; When detecting the NAK incident of data link layer, search the corresponding message of NAK message and resend according to index information.
Wherein, said administrative unit comprises that interface adaptation module, message add administration module, message resends administration module and message deletion administration module;
Said interface adaptation module, be used for poll detect PCIe transaction layer message send incident, from the ACK incident of data link layer with from the NAK incident of data link layer; If detect PCIe transaction layer message transmission incident then start message and add administration module; If receive ACK message from data link layer; Then start message deletion administration module,, then start message and resend administration module if receive NAK message from data link layer;
Said message adds administration module and comprises that idle indexing units retrieval submodule, data space retrieval submodule, index information interpolation submodule and data write submodule; Said idle indexing units retrieval submodule is searched one and is taken and be labeled as unappropriated indexing units in the index buffering area, the address of the indexing units that finds is informed that index information adds submodule; Data space retrieval submodule is searched allocatable space in the data buffer zone, the allocatable space address is informed that index information adds submodule and data write submodule; Index information adds submodule according to being apprised of the index information in the unappropriated indexing units of information updating, makes the next unappropriated indexing units of chained list pointed; Data write submodule PCIe transaction layer message are write the address of being apprised of;
Said message deletion administration module comprises indexing units retrieval submodule 1, sequence of message comparer module 1 and index information updating submodule; Said indexing units retrieval submodule 1 is used for beginning to search successively each indexing units according to said chained list head mark and said chain list index from the linked list head location; Sequence of message comparer module 1 is used for contrasting the sequence of message number of the corresponding sequence number of message of indexing units that indexing units retrieval submodule 1 finds and ACK message, when sequence number is identical, notifies the index information updating submodule; Said index information updating submodule is updated to current indexing units unoccupied when notified, and upgrades the content of relative index unit medium chain table header mark and chain list index;
Said message resends administration module and comprises indexing units retrieval submodule 2, sequence of message comparer module 2 and message retransmission subpacket module; Said indexing units retrieval submodule 2 is used for beginning to search successively each indexing units according to said chained list head mark and said chain list index from the linked list head location; Sequence of message comparer module 2 is used for contrasting the sequence of message number of the corresponding sequence of message table of indexing units that indexing units retrieval submodule 2 finds and NAK message, when sequence number is identical, notifies message retransmission subpacket module; Said message retransmission subpacket module is when notified, and the message that sequence number is identical resends.
Beneficial effect of the present invention is following:
The PCIe retry buffering area implementation method that the present invention proposes provides a kind of good retry buffering area to realize framework; It is important key technology of PCIe data link layer; Can solve PCIe data in link layer message transmissions integrity issue; And the index buffering area in this framework is made up of the indexing units of a plurality of equal length, and index information is reasonable in design, is convenient to Project Realization and engineering maintenance.
In addition, the data buffer zone in this method in use, new data are increased to the data buffer zone afterbody and get final product; After the data buffer zone is filled with; Begin stored messages from the head of data buffer zone, and cover legacy data, so need be from the data buffer zone deleted data; Save operation, and supported variable message length can effectively utilize memory space.
Description of drawings
Fig. 1 is the structural representation of a kind of PCIe retry buffering area implementation method of the embodiment of the invention.
Fig. 2 is the structural representation of administrative unit in the PCIe retry buffering area of the present invention.
Embodiment
Below in conjunction with accompanying drawing and embodiment, specific embodiments of the invention describes in further detail.
A kind of PCIe retry buffering area implementation method of the embodiment of the invention is as shown in Figure 1, and this method is based on data buffer zone, index buffering area and an administrative unit.Data buffer zone and index buffering area are two independently memory blocks; Data buffer zone storage PCIe transaction layer is submitted to the message of PCIe data link layer; The index information of index buffer stores data buffer zone message; The index buffering area is divided into the identical zone of a plurality of length, and a plurality of indexing units adopt the chained list mode to organize, and the user can confirm the size of index buffering area according to retry message number.
The index information size of storing in the indexing units is identical, comprises following field:
Take mark: represent whether this indexing units is occupied;
Chained list head mark: represent whether the corresponding message of this index information is positioned at the chained list head;
Chain list index: write down the corresponding initial address of indexing units in the index buffering area of next packet voice;
Start of message (SOM) address: the initial address of message in the data buffer zone that the minute book index information is corresponding; And the physical location of message has been embodied in the start of message (SOM) address, and chained list has embodied the logical order of message;
Message length: the message length that the minute book index information is corresponding;
Reservation information: write down some additional informations.
Administrative unit realizes the dynamic management of data buffer zone and index buffering area.Specifically, as shown in Figure 2, administrative unit comprises that interface adaptation module, message add administration module, message resends administration module and message deletion administration module.
The interface adaptation module, be used for poll detect PCIe transaction layer message send incident, from the ACK incident of data link layer with from the NAK incident of data link layer; If detect PCIe transaction layer message transmission incident then start message and add administration module; If receive ACK message from data link layer; Then start message deletion administration module,, then start message and resend administration module if receive NAK message from data link layer.
Message adds administration module and comprises that idle indexing units retrieval submodule, data space retrieval submodule, index information interpolation submodule and data write submodule.Idle indexing units retrieval submodule is searched one and is taken and be labeled as unappropriated indexing units in the index buffering area, the address of the indexing units that finds is informed that index information adds submodule.Data space retrieval submodule is searched allocatable space in the data buffer zone, the allocatable space address is informed that index information adds submodule and data write submodule.Index information adds submodule according to being apprised of the index information in the unappropriated indexing units of information updating, makes the next unappropriated indexing units of chained list pointed.Data write submodule PCIe transaction layer message are write the address of being apprised of.
Message deletion administration module comprises indexing units retrieval submodule 1, sequence of message comparer module 1 and index information updating submodule.Indexing units retrieval submodule 1 is used for chained list head mark and chain list index according to index information, begins to search successively each indexing units from the linked list head location; Sequence of message comparer module 1 is used for contrasting the sequence of message number of the corresponding sequence number of message of indexing units that indexing units retrieval submodule 1 finds and ACK message, when sequence number is identical, notifies the index information updating submodule.The index information updating submodule is updated to current indexing units unoccupied when notified, and upgrades the content of relative index unit medium chain table header mark and chain list index.
Message resends administration module and comprises indexing units retrieval submodule 2, sequence of message comparer module 2 and message retransmission subpacket module.Indexing units retrieval submodule 2 is used for chained list head mark and chain list index according to indexing units, begins to search successively each indexing units from the linked list head location; The sequence table that sequence of message comparer module 2 is used for contrasting the corresponding message of indexing units that indexing units retrieval submodule 2 finds and the sequence of message of NAK message number when sequence number is identical, are notified message retransmission subpacket module; Said message retransmission subpacket module is when notified, and the message that sequence number is identical resends.
Describe for example to the dynamic management of administrative unit below.
When administrative unit is started working, poll detect PCIe transaction layer message send incident, from the ACK incident of data link layer with from the NAK incident of data link layer.
When supposing at first to detect the PCIe transaction layer and sending to the message of PCIe data link layer; Sending message length like first is 64 bytes; Administrative unit is searched one and is taken and be labeled as unappropriated indexing units in the index buffering area; Owing to be just to start working, all indexing units are all idle, therefore insert following information successively to index buffer zone address 0 place:
Take mark=1, represent that current indexing units is occupied;
Chained list head mark=1 representes that the corresponding message of current indexing units is the message of the sequence of message minimum of index buffer stores, and therefore current indexing units is in the linked list head location;
Chain list index=6, the initial address of representing the idle indexing units of current indexing units back is 6, this free time indexing units will be the corresponding indexing units of next packet voice; If the adjacent indexing units after the current indexing units is occupied, chain list index=12 or 18 or the like then;
The initial address of message in the data buffer zone that this indexing units is corresponding represented in start of message (SOM) address=0;
Message length=64;
Reservation information=0;
After adding index information, administrative unit writes message data successively to 0 place, address of data buffer zone, thereby has accomplished the record of first message.
Multiple situation possibly take place in following a period of time, comprises that the message correctly confirmation of receipt information that continues to receive PCIe transaction layer transmission message, receive from data link layer is ACK, does not receive that the message correctly confirmation of receipt information from data link layer is NAK within a certain period of time.
If receive the message that the PCIe transaction layer sends, administrative unit begins from first indexing units of index buffering area, searches for idle indexing units, hitherward inserts the current index information that receives message after finding.Message length like second transmission is 32; Then insert 1 (taking mark), 2 (the non-head position of chained list), 12 (initial addresses of next idle indexing units), 64 (start of message (SOM) addresses), 32 (message lengths), 0 (reservation information) successively at 6 places, address of index buffering area; Then administrative unit writes message data successively to 64 places, address of data buffer zone, thereby has accomplished the record of second message.
If receive ACK message from data link layer; Then administrative unit is obtained sequence of message number from ACK message; Search the index information of chained list head mark and search the index information of the non-head position of chained list successively according to " chain list index " field; Therefrom find out the initial address of corresponding message in the data buffer zone, corresponding message is read sequence of message number from the initial address respective offsets; Whether check sequence of message number and the sequence of message that obtains from ACK number identical; If identical then this indexing units in the index buffering area is become invalid index (be about to take mark and be changed to 0) and changes the chained list pointer information, comprise the value that the chain list index of previous indexing units in the chained list is updated to current indexing units medium chain list index, if the corresponding message of current ACK is a chained list head message; Then need the chained list head mark of next indexing units be revised as 1), continue retrieval if sequence of message is number different with the ACK sequence number until sequence of message number identical with the ACK sequence number till.
If receive NAK message from data link layer; Then administrative unit is obtained sequence of message number from NAK message, searches chained list head mark and chain list index, begins to search successively each index information from the linked list head location; Therefrom find out the initial address of corresponding message in the data buffer zone; Whether read sequence of message number from the initial address respective offsets, it is number identical with the sequence number that from NAK, extracts to check sequence of message, if identical then this message is resend; If sequence of message is number different with the sequence number that from NAK, extracts, then continue retrieval until sequence of message also sends this message till number identical with the NAK sequence number.
In sum, more than being merely preferred embodiment of the present invention, is not to be used to limit protection scope of the present invention.All within spirit of the present invention and principle, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.