The processing method of OAM protocol packages is received and dispatched in same thread
Technical field
The present invention relates to configuration management fields of the local side apparatus OLT to terminal device ONU, and especially one kind is in same thread
The processing method of middle transmitting-receiving OAM protocol packages.
Background technology
Local side apparatus OLT configuration management terminal devices ONU is realized by interaction OAM protocol packages.Send OAM protocol packages
The path and direction walked with reception OAM protocol packages are all different.So existing processing method is exactly in different threads
Processing sends the structure of OAM protocol packages and receives the parsing of OAM protocol massages respectively.
Processing is carried out in different threads and there is the competition or conflict accessed resource.To solve the problems, such as that this is just needed
Increase uses synchronization and mutual exclusive resource.Also the consumption of cpu resource will be increased.The complexity of processing is added at the same time, reduces wind
The degree of controllability of danger.
There is stronger causalnexus between OAM protocol packages and received OAM protocol packages that local side apparatus OLT is sent,
Receiving the buffering of OAM protocol packages always has what size limited.Carry out to destroy during asynchronism and concurrency processing in different threads this
Causalnexus, may cause because exceeding buffer size, should received OAM agreements packet loss.Increase retransmits probability and more
Resource consumption, efficiency reduce.Hidden danger increases, risk increase.
Fig. 1 is the schematic diagram handled respectively OAM protocol packages in two different threads.The structure of OAM protocol packages
The structure for being responsible for handling OLT device to OAM protocol packages when ONU equipment progress acquisition of information or configuration management to transmission thread is related
Bag processing work.OAM agreement Packet analyzing threads are responsible for handling the OAM protocol packages from ONU equipment received in OLT device
Context resolution it is relevant bag processing work.It can be seen in the figure from signal.The two threads are all independent operatings, are all individually joined
With obtaining CPU operation chances.Their operation relation is asynchronism and concurrency operation.Do not ensure that they run order and completely
Impartial operation chance.The OAM protocol packages of the two thread process are all on management configuration ONU.So probably deposit
The shown competition to shared resource is, it is necessary to increase synchronization and mutex mechanism to solve the problems, such as competition in Fig. 1.This adds increased
The consumption of system resource.When dealing with improperly, it is also possible to introduce potential unknown problem.Increase potential risks.
The content of the invention
The technical problems to be solved by the invention are:In view of the problems of the existing technology, there is provided one kind is in same thread
The processing method of middle transmitting-receiving OAM protocol packages, it handles all OAM protocol packages in same OAM protocol packages handle thread, including
The OAM protocol packages that structure sends OAM protocol packages and parsing receives, and the processing for parsing received OAM protocol packages is preferentially sent
Structure of OAM protocol packages etc..
The technical solution adopted by the present invention is as follows:
The processing method of OAM protocol packages is received and dispatched in same thread to be included:
Step 1:Thread can be waken up by creating block type signal, and thread is handled as OAM protocol packages;Create and send message queue
With reception message queue, it is respectively used to receive transmission request message and receives request message;
Step 2:Request message is first put into corresponding message queue by message request thread, then at OAM protocol packages
Lineation journey sends signal, wakes up OAM protocol packages processing thread.OAM protocol packages handle thread according to request message, carry out OAM associations
View bag, which creates, sends or receives parsing, and wherein request message refers to sending the message in message queue, for building OAM associations
View wraps and is sent to ONU equipment or receives the message in message queue, they issue the OAM agreements of OLT device for ONU equipment
Bag, request OLT device carry out dissection process.
OAM protocol packages processing thread carries out OAM protocol packages according to request message and creates transmission or reception in the step 3
Parsing specifically includes:
Step 21:When OAM protocol packages processing thread process sends the request message of message queue, first judge to receive message
Whether the OAM protocol package that from ONU equipment receives come is had in queue;If so, then perform step 22;Otherwise, OAM protocol packages are handled
Thread creation simultaneously sends OAM protocol packages to corresponding ONU equipment;When OAM protocol packages processing thread process receives message queue
During request message, then step 22 is performed;The request message for wherein sending message queue is the message produced by transmission information interface;
The request message for receiving message queue is when sending OAM data bag to OLT device by ONU equipment, OLT device bottom layer driving and to connect
The message that mouth produces;
Step 22:All OAM protocol packages that the processing thread parsing of OAM protocol packages receives.
The transmission information interface for producing transmission request message is client.
In conclusion by adopting the above-described technical solution, the beneficial effects of the invention are as follows:
The problem of transmitting-receiving OAM protocol packages are handled in same thread, eliminate the competition and access conflict to resource.Save
The use of synchronization and mutex resource has been gone, has also reduced the loss of cpu resource, the efficiency of system resource can be improved.According to OAM agreements
The sequence arrangement and guarantee that the causalnexus of pack receiving and transmitting handles send and receive packets, can greatly reduce the OAM associations because that should receive
Re-transmission probability caused by discussing packet loss.So as to improve the utilization rate and efficiency of system resource.Hidden danger is reduced, increase risk is controllable
Property.
Fig. 2 is the schematic diagram handled in same thread OAM protocol packages.Because receive and dispatch the processing of OAM bags all
It is in same thread, is not in asking for competition to resource just there is no the situation of two thread asynchronism and concurrencies processing
Topic, does not just have to the synchronization and mutex resource using system yet, eliminates because of the cpu resource using these resource consumptions yet.So as to
The resource utilization and efficiency of system can be improved to a certain extent.It is ensured that processing is different types of in a thread
The order of OAM bags processing:Processing of the received OAM protocol packages prior to transmission OAM protocol packages.The arrangement of this processing sequence is
According to causalnexus existing for transmitting-receiving OAM agreement parlors, an OAM protocol package is sent, a corresponding sound will be received
Answer OAM protocol packages.Suppress to send OAM protocol package excessive velocities, reduce the OAM protocol packages number that receives beyond buffering maximum and
The problem of loss.Improve the utilization rate and efficiency of reliability and system resource.
Brief description of the drawings
Examples of the present invention will be described by way of reference to the accompanying drawings, wherein:
Fig. 1 is the schematic diagram handled respectively OAM protocol packages in two different threads.
Fig. 2 is OAM protocol packages processing schematic diagram when an OLT device corresponds to an ONU equipment in a thread.
Embodiment
All features disclosed in this specification, or disclosed all methods or during the step of, except mutually exclusive
Feature and/or step beyond, can combine in any way.
This specification(Including any accessory claim, summary and attached drawing)Disclosed in any feature, except non-specifically chatting
State, can be replaced by other alternative features that are equivalent or have similar purpose.I.e., unless specifically stated, each feature
It is an example in a series of equivalent or similar characteristics.
Bottom layer driving and interface refer to bsp driver and hardware interface etc..OAM protocol packages processing thread is sent to
The ONU equipment received in the OAM protocol packages and reception message queue of ONU equipment is sent to the OAM protocol packages of OLT device, all
It is that the bottom layer driving interface for needing OLT device participates in.
When one OLT device corresponds to multiple ONU equipments, OAM protocol package processing procedures are identical.
Operation principle:
1st, thread can be waken up by creating block type signal, and thread is handled as OAM protocol packages.Using reception in the thread
The processing of OAM protocol packages always carries out Message processing prior to sending the processing strategy of OAM protocol massages.
2nd, create and send signaling interface, for sending signal to OAM protocol packages processing thread, wake up the thread.
3rd, create and send message queue and receive message queue, be respectively used to receive transmission request message and receive request to disappear
Breath.Processing OAM protocol packages thread obtains message from the two message queues, then carries out corresponding processing.
4th, request message is first put into corresponding message queue by message request thread, then calls transmission signaling interface to call out
OAM protocol packages of waking up processing thread.
Specific embodiment:
Step 1:Thread can be waken up by creating block type signal, and thread is handled as OAM protocol packages;Transmission signal is created to connect
Mouthful, for sending signal to OAM protocol packages processing thread, wake up the thread;Create and send message queue and reception message queue,
It is respectively used to receive and sends request message and reception request message;
Step 2:Request message is first put into corresponding message queue by message request thread, then calls transmission signal to connect
Mouth wakes up OAM protocol packages processing thread;
Step 3:When OAM protocol packages processing thread receives the request message for sending message queue, first judge receiving
Whether the OAM protocol package that from ONU equipment receives come is had in message queue;If so, then the parsing of OAM protocol packages processing thread receives
All OAM protocol packages arrived;Otherwise, OAM protocol packages handle thread creation and send OAM protocol packages to corresponding ONU equipment;When
OAM protocol packages processing thread process receives the request message of message queue, then the institute that the parsing of OAM protocol packages processing thread receives
There are OAM protocol packages.
Wherein OAM protocol packages processing thread detects the OAM data for receiving and having multiple ONU equipments to send in message queue
Bag, then all handled all OAM data bags received, then according to request to create message, creates corresponding OAM associations
View bag, and the protocol package is issued into corresponding ONU equipment.
The invention is not limited in foregoing embodiment.The present invention, which expands to, any in the present specification to be disclosed
New feature or any new combination, and disclose any new method or process the step of or any new combination.