Background technology
Along with the development of data communication technology, the application that multi-channel data is handled also more and more widely.So-called multi-channel data is handled and is meant, goes into passage and receives message from a plurality of, by going out passage message is sent then.In traditional multi-channel data processing logic structure, it is corresponding going into passage and going out passage.Such as, referring to multi-channel data processing logic structural representation shown in Figure 1, entrance side has two data passage RX0 and RX1, and outlet side also has two data passage TX0 and TX1.Wherein, writing cache module WR is used for receiving message from two the data passage RX0 and the RX1 of entrance side, the message of receiving is write in the cache module, as write among the synchronous DRAM SDRAM, and when the message that receives is the bag tail, this package informatin such as packet length, bag buffer address etc. are write queue management module QM; Comprise two package informatin formation FIFO0 and FIFO1 among the QM, the package informatin that is respectively applied for that storage WR module writes from the message of RX0 passage and RX1 passage; Package informatin is read in FIFO0 and FIFO1 formation that read data module RD0 and RD1 are respectively applied for from QM, reads message according to this package informatin from cache module, and respectively the message of reading is sent to sending module TX0 and TX1; TX0 sends the message of receiving with the passage that goes out that TX1 is used for being connected by self.In Fig. 1, cache module need be handled the request arbitration of three ports: the read port of the write port of WR module and two RD modules, the effective bandwidth of cache module is distributed between these three ports.The number of RD module is many more, each RD module is got can the access cache module bandwidth just few more.
Do not allow situation about interweaving for going into the passage message passage message that allows to interweave, promptly can transmit the situation that passage but must send message according to whole bag not according to whole bag from the message of going into passage, above-mentioned multi-channel data processing method can expend more cache resources.Such as, in Fig. 1, suppose that RX0 and RX1 receive data from the SPI4 interface of 10G bandwidth; The XAUI interface of the respectively corresponding 10G bandwidth of TX0 and TX1.If the effective bandwidth of cache module is 20G, then each RD module on average can obtain the access bandwidth of about 7G.But, because TX0 and TX1 are giving out a contract for a project with the speed of 10G, its transmission rate is greater than the RD module is read message from cache module speed 7G, therefore, in order to guarantee that TX0 and TX1 also can once send a complete packet with continuing to flow under worst situation, TX0 and TX1 just need bigger buffer memory to store the message that the RD module is read, and after whole bag all is read out, the speed of the whole bag in the buffer memory according to 10G are once sent again.
As seen, in existing multi-channel data processing method, all corresponding read data module of each package informatin formation, the number of package informatin formation is many more, and the number of read data module is corresponding also just many more.But, because the effective bandwidth of cache module is limited, and the quantity of read data module is many more, each read data module obtainable bandwidth that can the access cache module just few more, therefore, a lot of in the read data module, the read data module reads message from cache module speed does not reach under the situation of speed that sending module sends message, in order to guarantee that sending module can once send a complete packet with continuing to flow, each sending module all needs bigger buffer memory to store the message that the read data module is read from cache module, till whole bag all is read out.For a fairly large number of situation of sending module, this cache resources that can expend a large amount of preciousnesses than the way of big buffer memory that all disposes for each sending module.And,, can consume a large amount of logical resources for each package informatin formation is provided with a read data module and a sending module respectively.
Summary of the invention
In view of this, main purpose of the present invention is to provide a kind of multi-channel data processing method and device, to save resource.
For achieving the above object, multi-channel data processing method provided by the invention is as follows:
Package informatin formation in the queue management module is divided into groups, and be the sending module that every group of package informatin formation is provided with a read data module and a correspondence respectively, wherein, the group number that is divided into is less than the number of package informatin formation;
Described read data module from self read package informatin in turn in each package informatin formation the corresponding group, read message according to the package informatin that reads, and the message of reading sent to corresponding sending module;
After sending module is received the message that the read data module sends, with the message received by with this message go into that passage is corresponding to be gone out passage and send.
Wherein, described package informatin formation in the queue management module is divided into groups to comprise:
All package informatin formations in the queue management module are divided into one group.
Described package informatin formation in the queue management module is divided into groups to comprise:
Package informatin formation in the queue management module is divided into two groups at least, and wherein has at least and comprise at least two package informatin formations in one group.
The package informatin that described basis reads is read message and is comprised:
The read data module is read message according to the package informatin that reads from cache module.
Described read data module sends to corresponding sending module with the message of reading and also comprises: the read data module goes into this message that passage is pairing to be gone out channel information and send to corresponding sending module;
Described sending module with the message received by with this message go into that passage is corresponding to be gone out passage and send and comprise: sending module with the message received by channel information is corresponding to be gone out passage and send with going out of receiving.
When the group number that is divided into greater than 1 the time, each read data module adopts concurrent working mode.
Multi-channel data processing unit provided by the invention comprises: write cache module, cache module, comprise at least one group of package informatin formation and have at least the queue management module that comprises at least two package informatin formations in one group of package informatin formation, with each group package informatin formation one to one the read data module and with each read data module sending module one to one, wherein
Write cache module, be used for and will write cache module, and at the message of receiving during for the bag tail from going into the message that passage receives, with this package informatin write in the queue management module with this bag go into the corresponding package informatin formation of passage;
The read data module, be used for from self read package informatin in turn each package informatin formation of corresponding group, from cache module, read message according to the package informatin that reads, and the message of reading sent to the sending module corresponding with self;
Sending module is used for after receiving the message that the read data module is sent, with the message received by with this message go into that passage is corresponding to be gone out passage and send.
What described read data module was further used for the message that will read goes into that passage is pairing to be gone out channel information and send to sending module;
Described sending module with the message received by channel information is corresponding to be gone out passage and send with going out of receiving.
Described read data number of modules was greater than 1 o'clock, and each read data module adopts the concurrent working mode.
This shows, in technical scheme provided by the present invention, read data module and sending module are corresponding with one group of package informatin formation, rather than corresponding respectively with each package informatin formation, can reduce the number of read data module and sending module like this, thereby save logical resource.And after the quantity of sending module reduced, the needed total buffer memory quantity of all sending modules will reduce, thereby has also saved cache resources.In addition, after the quantity of read data module reduces, each read data module just can obtain the bandwidth of more access cache module, reach the speed that sending module sends message if distribute to the speed that the bandwidth of read data module can make the read data module read message from cache module, so, the message that sending module just can be read the read data module continuously sends, store message that the read data module reads and be read up to whole bag and finish and need not to take cache resources, thereby further reduced taking of cache resources.
Embodiment
For making purpose of the present invention, technical scheme and advantage clearer, the embodiment that develops simultaneously with reference to the accompanying drawings is described in further detail the present invention.
In order to solve the problems of the prior art, the invention provides a kind of multi-channel data processing method, referring to shown in Figure 2, this method mainly may further comprise the steps:
Step 201: the package informatin formation in the queue management module is divided into groups, and for every group of package informatin formation a read data module and a sending module are set respectively, wherein, the group number that is divided into is less than the number of package informatin formation.
In step 201, all the package informatin formations in the queue management module just can be used as one group, perhaps also they can be divided into many groups.Under the situation that is divided into many groups, to have at least to comprise at least two package informatin formations in the group.
Step 202: the read data module to self each package informatin formation in the corresponding group carry out poll, read the package informatin in described each package informatin formation in turn, read message according to the package informatin that reads, and the message of reading sent to corresponding sending module.
Step 203: after sending module is received the message that the read data module sends, with the message received by with this message go into that passage is corresponding to be gone out passage and send.
As seen from Figure 2, in technical scheme provided by the present invention, read data module and sending module are corresponding with one group of package informatin formation, rather than corresponding respectively with each package informatin formation, can reduce the number of read data module and sending module like this, save logical resource.And after the quantity of sending module reduced, the needed total buffer memory quantity of all sending modules will reduce, thereby has also saved cache resources.
For the purpose of clear more, multi-channel data processing method provided by the present invention is elaborated below by two specific embodiments.
Embodiment one
In order to save cache resources and logical resource, can adopt method provided by the present invention that multi-channel data processing logic structure shown in Figure 1 is improved, the multi-channel data processing logic structure after the improvement is referring to shown in Figure 3.
In Fig. 3, two package informatin formations among the QM have been divided into one group, the corresponding RD module of this group and a TX module, and corresponding TX0 of this TX module and two of TX1 go out passage.Wherein, the function of WR module, QM module and cache module is consistent with Fig. 1, give unnecessary details no longer one by one here, below mainly the course of work of RD module among Fig. 3 and TX module is described.
In Fig. 3, still have two package informatin formation FIFO0 and FIFO1 in the QM module, but has only a RD module, at this moment, the RD module can be carried out poll to two package informatin formations among the QM, promptly read the package informatin among FIFO0 and the FIFO1 in turn, from cache module, read message according to package informatin then, the message of reading is sent to the TX module; The TX module after receiving the message that the RD module sends over sends the message of receiving.The RD module is when the TX module sends message, also needs this message gone into that passage is pairing to be gone out channel information and send to the TX module; After the TX module is received, the message of receiving is sent by going out passage accordingly.Such as, for the message of reading according to the package informatin among the FIFO0, the RD module can be carried at TX0 information and send to the TX module in this message, after the TX module is received, this message is sent by the TX0 passage.
In Fig. 3, any time has only one to go out passage in the transmission data, and TX0 and TX1 realize exporting the data processing bandwidth of 10G by time-multiplexed mode.In Fig. 1, though go out the total bandwidth that passage TX0 and TX1 can reach 20G in theory, owing to go into the total bandwidth of passage RX0 and RX1 10G is only arranged, therefore in fact the outlet average bandwidth of TX0 and TX1 also has only 10G.
Compare Fig. 1, Fig. 3 only adopts a RD module and a TX module, so not only can save one times cache resources, and can save one times logical resource.In addition, in Fig. 3, cache module only need be handled the request arbitration of two ports: the read port of the write port of a WR module and a RD module.At this moment, if the effective bandwidth of cache module is 20G, then the RD module on average can obtain the access bandwidth of 10G, and promptly the RD module can read message according to the speed of 10G from cache module.Like this, the TX module just can send the message that the RD module is read continuously according to the speed of 10G, stores message that the RD module reads and all is read up to the message of a complete data packet and finishes and need not to take buffer memory, thereby further saved cache resources.
Embodiment two
Fig. 4 has provided another kind of common multi-channel data processing logic structural representation, and what comprise altogether that 4 bandwidth are 5G goes into passage RX0, RX1, RX2 and RX3, and 4 bandwidth be 10G go out passage TX0, TX1, TX2 and TX3.Wherein, 4 data passage RX0, RX1, RX2 and RX3 that the WR module is used for from entrance side receive message, the message of receiving are write in the cache module, and at the message that receives during for the bag tail, and the information of this bag is write the QM module; Comprise 4 package informatin formation FIFO0, FIFO1, FIFO2 and FIFO3 among the QM, be respectively applied for the package informatin that storage WR writes from the message of RX0, RX1, RX2 and RX3 passage; RD0, RD1, RD2 and RD3 module are respectively applied in FIFO0, FIFO1, FIFO2 and the FIFO3 formation from QM and read package informatin, from cache module, read message according to package informatin, by TX0, TX1, TX2 and TX3 the message of reading is sent then.
Here, in order to save logical resource and cache resources, can adopt method provided by the present invention that multi-channel data processing logic structure shown in Figure 4 is improved, the multi-channel data processing logic structure after the improvement is referring to shown in Figure 5.
In Fig. 5,4 package informatin formations among the QM have been divided into two groups, and first group comprises FIFO0 and these two package informatin formations of FIFO1, and second group comprises FIFO2 and these two package informatin formations of FIFO3; And, also be provided with read data module RD01 and RD23 and sending module TX01 and TX23 respectively for each group.Wherein, the RD01 module is used for reading package informatin from FIFO0 and FIFO1 formation respectively according to the polling dispatching principle, and reads message according to package informatin from cache module, then the message that reads is sent to the TX01 module; The message that the TX01 module is used for receiving sends by going out passage accordingly, is about to send by the TX0 passage from the message of RX0 passage, will send by the TX1 passage from the message of RX1 passage.The RD23 module is used for reading package informatin from FIFO2 and FIFO3 formation respectively according to the polling dispatching principle, and reads message according to package informatin from cache module, then the message that reads is sent to the TX23 module; The message that the TX23 module is used for receiving sends by going out passage accordingly, is about to send by the TX2 passage from the message of RX2 passage, will send by the TX3 passage from the message of RX3 passage.
In Fig. 5, RD01 and RD23 concurrent working, TX0 and TX1 carry out message according to time-multiplexed mode and send, and TX2 and TX3 carry out message according to time-multiplexed mode and send.Wherein, the transmission bandwidth of TX01 can reach 10G, maintains an equal level mutually with the inlet total bandwidth 10G of RX0 and RX1, and therefore the flow from RX0 and RX1 can in time be sent; In like manner, the flow from RX2 and RX3 also can in time be sent.
Certainly, also all the package informatin formations among Fig. 4 can be used as a group, for all package informatin formations only are provided with a read data module and a sending module, by this read data module poll is carried out in all the package informatin formations among the QM, go out passage by TX0, TX1, TX2 and four of TX3 and message is sent by time-multiplexed mode.But, because after TX0, TX1, TX2 and TX3 adopt time-multiplexed mode to carry out the message transmission, the bandwidth of whole outlet can only reach 10G, be far smaller than the port band width of going into of 20G, therefore, all package informatin formations among Fig. 4 are divided into the way of a group, can cause inlet flow rate can not in time obtain sending, and finally cause the generation of unusual packet loss phenomenon.
In addition, the package informatin formation among Fig. 4 can also be divided into following two groups: wherein one group comprises FIFO0, FIFO1 and three package informatin formations of FIFO2, and another group includes only the FIFO3 formation; And be respectively each group read data module and sending module are set.Just be equivalent to, processing and Fig. 4 of FIFO3 formation is consistent, FIFO0, FIFO1 and FIFO2 formation are then adopted schedule policy Combined Input.Concrete processing procedure wherein repeats no more here.
Correspondingly, the present invention also provides a kind of multi-channel data processing unit, this apparatus structure is referring to shown in Figure 6, mainly comprise: write cache module, cache module, comprise at least one group of package informatin formation and have at least the queue management module that comprises at least two package informatin formations in one group of package informatin formation, with each group package informatin formation one to one the read data module and with each read data module sending module one to one, wherein
Write cache module, be used for and will write cache module, and at the message of receiving during for the bag tail from going into the message that passage receives, with this package informatin write in the queue management module with this bag go into the corresponding package informatin formation of passage;
The read data module, be used for from self read package informatin in turn each package informatin formation of corresponding group, from cache module, read message according to the package informatin that reads, and the message of reading sent to the sending module corresponding with self;
Sending module is used for after receiving the message that the read data module is sent, with the message received by with this message go into that passage is corresponding to be gone out passage and send.
What wherein, described read data module was further used for the message that will read goes into that passage is pairing to be gone out channel information and send to sending module;
Described sending module with the message received by channel information is corresponding to be gone out passage and send with going out of receiving.
When described read data number of modules greater than 1 the time, each read data module adopts concurrent working mode.
The above has carried out further detailed description to purpose of the present invention, technical scheme and beneficial effect; institute is understood that; the above is not in order to restriction the present invention; within the spirit and principles in the present invention all; any modification of being made, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.