A kind of system and method for realizing the Gigabit passive optical network packaging mode frame reorganization
Technical field
The present invention relates to GPON (gigabit passive optical network) system, relate in particular to the system and method for a kind of GEM of realization (G-PON Encapsulation Mode) frame reorganization.
Background technology
GPON is a kind of Technology of Light Access Network, constitutes by OLT (optical line terminal), ODN (Optical Distribution Network) and ONU (optical network unit) three parts, and between OLT and ONU a kind of network architecture that connects by passive ODN.Adopt the form of GTC (GPONTransmission Convergence, GPON transmission convergence layer) frame to carry out the data transmission between OLT and the ONU, the form of GTC frame as shown in Figure 1, wherein, PLOu, Physical Layer Overhead upstream, upstream physical layer expense; PLOAMu, Physical Layer Operations, Administration andMaintenance upstream, upstream physical layer operation management maintain; PLSu, Power LevelingSequence upstream, uplink power control sequence number; DBRu, Dynamic Bandwidth Reportupstream, up dynamic bandwidth report; PCBd, Physical Control Block downstream, downlink physical controll block.Wherein the payload in the GTC frame can be carried all kinds user data, and main bearing protocol is ATM (Asynchronous Transfer Mode, asynchronous transfer mode) or GEM, and the present invention does not relate to the ATM agreement.The GTC agreement is with transparent mode carrying GEM business, and at down direction, the data from OLT to ONU transmit in the payload (as shown in Figure 2) of GEM frame; At up direction, the business datum from ONU to OLT transmits on the GEM of configuration distribution time slot.
GEM frame head and frame structure are as shown in Figure 2, the GEM frame head is by 12 PLI (Payload LengthIndicator, payload length indicator), 12 Port ID (port identifiers), 3 PTI (PayloadType Indicator, the payload type designator) and 13 HEC (Header Error Control, frame head error control) form.The length of the payload in the PLI indication GEM frame after the frame head is unit with the byte.The bit wide of 12 bits can represent that at most length is the payload fragment of 4095 bytes, if the length of user data surpasses 4095 bytes, must be divided into a plurality of fragments.Port ID is used to provide 4096 different traffic stream identifier among the GPON, and is multiplexing to realize Business Stream.PTI is used to indicate payload type and corresponding processing mode, the implication of coding: 000, and user data fragment, non-postamble; 001, user data fragment, postamble; 100, GEM OAM (Operations, Administration and Maintenance, Operations,Administration And Maintenance), non-postamble; 101, GEM OAM, postamble; Other is worth reservation.HEC provides frame head error detection and calibration function.
Because the frame length of user data at random,, and insert the GEM frame head in each payload fragment front so the GEM agreement is supported the burst of user data frame.PTI in the GEM frame head is used for this purpose exactly.Each user data frame can be divided into a plurality of fragments, additional frame head before each fragment, and PTI indicates in the territory whether this fragment is the postamble of user's frame.
At Ethernet during to GPON system transmissions data, complete Ethernet data seal install to GEM mode as shown in Figure 3.If traffic frame distributes on the time slot and can not completely send at the GEM of configuration, just need carry out burst to Ethernet data., need recombinate to the data behind the burst, when being the GPON system in opposite direction with the Ethernet data that regains one's integrity to Ethernet transmission data.Reorganization is carried out based on Port ID, and each Port ID represents a kind of Business Stream, allows the data of different Port ID to interleave transmission.The reorganization of the GEM frame of 4K Port ID is supported in reorganization: remove the GEM frame head, payload is extracted be reduced into ethernet frame.The payload data of reorganization is buffered among external memory storage DDR2 (Double Data Rate 2, the Double Data transmission mode) SDRAM (Synchronous Dynamicrandom access memory, synchronous DRAM).Because the length of GEM frame is at random, and the data length that burst (the bursting continuously) operating characteristic of DDR2SDRAM (data bit width is 16 bits) requires to write wherein at every turn must be the integral multiple of 8 bytes (64 bit), also to support the GEM frame data of 4K Port ID to interleave simultaneously, so will carry out special processing for not enough 8 byte integer of GEM postamble minister degree data doubly, promptly for the integral multiple of afterbody remainder bytes length if not external memory storage minimum operation unit, then need to preserve at chip internal earlier, the next GEM frame of waiting for same Port ID writes external memory storage again when arriving, because the data of 4K Port ID interleave transmission, all prepare memory space and deposit the afterbody remainder bytes so be necessary for each PORT ID, this just must cause a large amount of storage resources wastes.
Summary of the invention
The invention provides a kind of system and method for realizing the Gigabit passive optical network packaging mode frame reorganization, to solve the problem of using a large amount of storage resources buffer memory GEM postamble portion data.
In order to solve the problems of the technologies described above, the invention provides a kind of system that realizes the Gigabit passive optical network packaging mode frame reorganization, described system comprises Gigabit passive optical network packaging mode GEM frame head processing module, payload reorganization processing module, wherein:
Described GEM frame head processing module, be used to receive the GEM frame after, read described GEM frame head, obtain its port identifiers;
Described payload reorganization processing module, being used for externally, memory is GEM frame application one memory space of same described port identifiers, obtain behind the address of described memory space first GEM frame payload being write the external memory storage designated address space, the afterbody remainder bytes length of described GEM frame payload is if not the integral multiple of described external memory storage minimum operation unit, then add the slack byte polishing and write described external memory storage in the lump, afterbody remainder bytes to the GEM frame payload of follow-up described port identifiers is carried out and the identical processing of described first GEM frame payload afterbody remainder bytes, there is slack byte to write if judge a last GEM postamble portion, after then follow-up GEM frame payload being covered the slack byte of previous GEM postamble portion, payload is write external memory storage subsequent address space successively, to recover complete Ethernet data bag.
System of the present invention, wherein, described system also comprises and looks into reorganization table module,
Described GEM frame head processing module, also be used to read described GEM frame head after, obtain its payload length indicator;
Described payload reorganization processing module also is used for after preserving each GEM frame payload, upgrades the reorganization table according to its payload length indicator, comprises that the bag that upgrades current data packet address stored, current data packet is long;
The described reorganization table module of looking into, when being used for described payload reorganization processing module and carrying out the payload reorganization, begin to search the reorganization table according to described port identifiers, obtain the intermediate variable of current Ethernet data bag, comprise the long and cyclic redundancy check (CRC) of bag of current data packet address stored, packet that current reorganization is good.
Further,
Described GEM frame head processing module, also be used to read described GEM frame head after, obtain its payload type designator;
Described payload reorganization processing module is finished if also be used for judging according to the payload type designator of GEM frame that current data packet has been recombinated, and then identifier corresponding contents in table in described reorganization table in corresponding port is resetted.
System of the present invention, wherein, described payload reorganization processing module is used to adopt the mode of data block operation that GEM frame payload is write external memory storage.
System of the present invention, wherein, described external memory storage is Double Data transmission mode synchronous DRAM DDR2 SDRAM.
The present invention also provides a kind of method that realizes the Gigabit passive optical network packaging mode frame reorganization, comprises the steps:
(1) after GEM frame head processing module is received the GEM frame, reads described GEM frame head, obtain its port identifiers;
(2) payload reorganization processing module is GEM frame application one memory space of same described port identifiers in the memory externally, obtain behind the address of described memory space first GEM frame payload being write the external memory storage designated address space, the afterbody remainder bytes length of described GEM frame payload is if not the integral multiple of described external memory storage minimum operation unit, then add the slack byte polishing and write described external memory storage in the lump, afterbody remainder bytes to the GEM frame payload of follow-up described port identifiers is carried out and the identical processing of described first GEM frame payload afterbody remainder bytes, there is slack byte to write if judge a last GEM postamble portion, after then follow-up GEM frame payload being covered the slack byte of previous GEM postamble portion, payload is write external memory storage subsequent address space successively, to recover complete Ethernet data bag.
Further, in the step (1), after described GEM frame head processing module reads described GEM frame head, also obtain its payload length indicator and payload type designator.
Further, in the step (2), described payload reorganization processing module is upgraded the reorganization table according to its payload length indicator after preserving each GEM frame payload, comprise that the bag that upgrades current data packet address stored, current data packet is long, and carry out cyclic redundancy check (CRC); In GEM frame payload when reorganization of described port identifiers, arranged again, look into reorganization table module and begin to search described reorganization table, obtain adopting after the current data packet address stored mode of data block operation to carry out GEM frame payload and write according to described port identifiers.
Further, in the step (2), finish, then identifier corresponding contents in table in described reorganization table in corresponding port is resetted if described payload reorganization processing module has been recombinated according to the payload type designator judgement current data packet of GEM frame.
Further, described external memory storage is Double Data transmission mode synchronous DRAM DDR2 SDRAM.
Adopt scheme of the present invention, can realize of the reorganization of GEM frame with minimum resource, and support the data of different Port ID to interleave transmission, realized the data fragment of random-length is recombinated, have certain versatility based on Port ID.
Description of drawings
Fig. 1 is the form of GTC frame;
Fig. 2 is GEM frame head and frame structure;
Fig. 3 is that complete Ethernet data is sealed the mode schematic diagram that installs to GEM;
Fig. 4 is the system configuration schematic diagram that the embodiment of the invention realizes the reorganization of GEM frame;
Fig. 5 is the method flow diagram that application example of the present invention is realized the reorganization of GEM frame;
Fig. 6 is the method schematic diagram that the embodiment of the invention realizes the reorganization of GEM frame.
Embodiment
Below in conjunction with the drawings and specific embodiments technical scheme of the present invention is described in detail.
As shown in Figure 4, be the system configuration schematic diagram that the embodiment of the invention realizes the reorganization of GEM frame, described system comprises GEM frame head processing module, payload reorganization processing module, looks into reorganization table module, wherein:
Described GEM frame head processing module, be used to receive the GEM frame after, read described GEM frame head, obtain its port identifiers (Port ID), payload length indicator (PLI) and payload type designator (PTI);
The described reorganization table module of looking into, when being used for described payload reorganization processing module and carrying out the payload reorganization, begin to search reorganization table (as shown in table 1 below) according to described port identifiers, obtain the intermediate variable of current Ethernet data bag, comprise the long and CRC (cyclic redundancy check (CRC)) of bag of current data packet address stored, packet that current reorganization is good;
Table 1 reorganization table
Above-mentioned reorganization table is an index address with Port ID, and address 0 to the corresponding successively Port ID0 in address 4095 is to Port ID4095;
Described payload reorganization processing module, being used for externally, memory is GEM frame application one memory space of same described port identifiers, the mode that obtains adopting data block to operate first GEM frame payload behind the address of described memory space writes the external memory storage designated address space, the afterbody remainder bytes length of described GEM frame payload is if not the integral multiple of described external memory storage minimum operation unit, then add the slack byte polishing and write described external memory storage in the lump, GEM frame payload for follow-up described port identifiers, there is slack byte to write if judge a last GEM postamble portion, after then follow-up GEM frame payload being covered the slack byte of previous GEM postamble portion, payload is write external memory storage subsequent address space successively, to recover complete Ethernet data bag; Also be used for after preserving each GEM frame payload, upgrade the reorganization table, comprise that the bag that upgrades current data packet address stored, current data packet is long according to its payload length indicator; Finish if also be used for judging according to the payload type designator of GEM frame that current data packet has been recombinated, then identifier corresponding contents in table in described reorganization table in corresponding port is resetted.
The said external memory is DDR2 SDRAM.
GEM frame head processing module extracts the GEM frame descriptor after receiving frame head, comprise Port ID, payload length indicator PLI, information such as payload type designator PTI.Look into reorganization table module then and begin to search the reorganization table, obtain the intermediate variable of current bag according to Port ID.Payload reorganization processing module judges whether the length that current bag is recombinated is 0, if be 0, then represent first burst that current GEM frame is a packet, need externally to be new memory space of its application among the memory DDR2 SDRAM, the reorganization that obtains just can carrying out behind the address of memory space payload is handled: adopt the mode of data block operation that payload is write the external memory storage designated address space successively, afterbody remainder bytes length is then added the slack byte polishing and is write external memory storage in the lump if not the integral multiple of external memory storage minimum operation unit; If be not 0, then the length of recombinating according to reality judges whether the previous GEM frame of this packet has slack byte to write, there is not slack byte to write, then as previously described to the payload processing of recombinating, otherwise, when first payload data piece of current GEM frame writes, an overlapping minimum operation unit of face one postamble portion in front of the address, effectively move on to the initial position of slack byte behind the payload data, new slack byte is filled in the front, mask these new slack bytes when writing, the data block of current GEM frame back is handled with first frame, so just the GEM frame payload that belongs to a packet intactly can have been recombinated.Judge according to PTI whether current bag has recombinated and finish,, then corresponding Port ID corresponding contents in table in the reorganization table is resetted if finish.
As shown in Figure 5, be the method flow diagram that application example of the present invention is realized the reorganization of GEM frame, need the reorganization table is done initialization before the reorganization beginning, except that 32 bit initialization in CRC territory are helped " 1 ", other territory all is initialized to " 0 ", and described method comprises the steps:
Step 501, GEM frame head processing module reads the GEM frame head, obtains Port ID, information such as payload length indicator PLI and payload type designator PTI;
Step 502 is looked into reorganization table module and is searched the reorganization table according to Port ID, extracts the content of corresponding list item;
Step 503, payload reorganization processing module is judged reorganization, and whether good length is 0: if be 0, represent that then this GEM frame is first burst of above-mentioned Port ID packet, change step 504; If be not 0, then change step 506;
Step 504, payload reorganization processing module be memory space of packet application among the memory DDR2 SDRAM externally, and the data that reorganization is got well will be buffered in wherein, obtain the address of memory space;
Step 505 writes the external memory storage designated address space according to the data block mode of operation with GEM frame payload, carries out the CRC checking simultaneously and upgrades the reorganization table, changes step 508 then; If the remaining data length of postamble does not satisfy the requirement of the M of external memory storage minimum operation unit (byte) integral multiple, then use the slack byte polishing, all write in the external memory storage, but the slack byte number is not counted in the good length of reorganization;
Step 506 judges according to the length that reorganization is good whether the previous frame afterbody has slack byte to write external memory storage: if do not have, then change step 505; If there be N slack byte to write, N between 0 and the M of minimum operation unit of external memory storage between, then change step 507;
Step 507, cover slack byte with GEM frame payload, press block operations mode stored payload data: as shown in Figure 6, when first payload data piece of current this GEM frame writes external memory storage, add (M-N) individual new slack byte in the valid data front, valid data just move the position of (M-N) individual byte after the meeting like this, write the address of external memory storage and the last address overlap M of a GEM postamble portion byte of this bag, mask the individual slack byte in front (M-N), so just the valid data of adjacent two frames of same packet have been recombinated together, the payload data writing mode of this frame back changes step 508 afterwards as step 505;
Step 508 judges whether it is postamble according to PTI: if then change step 509; If not, then change step 501;
Step 509, postamble is handled, and judges whether needs filling slack byte according to the residue payload length;
Step 510 resets the reorganization list item, and the Ethernet data bag of above-mentioned described Port ID regains one's integrity, and flow process finishes.
The above is the preferred embodiments of the present invention only, is not limited to the present invention, and for a person skilled in the art, the present invention can have various changes and variation.Within the spirit and principles in the present invention all, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.