The processing method of OAM protocol package is received and dispatched in same thread
Technical field
The present invention relates to the configuration management field of local side apparatus OLT to terminal equipment ONU, especially a kind of processing method of receiving and dispatching OAM protocol package in same thread.
Background technology
Local side apparatus OLT configuration management terminal equipment ONU is realized by mutual OAM protocol package.The path that transmission OAM protocol package and reception OAM protocol package are walked and direction are all different.So existing processing method is exactly the structure of process transmission OAM protocol package respectively in different threads and the parsing of reception OAM protocol massages.
In different threads, carry out processing the competition or conflict that just exist resource access.Synchronous and Exclusive resource is used for addressing this problem just to need to increase.Also the consumption of cpu resource will be increased.Add the complexity of process simultaneously, reduce the degree of controllability of risk.
Have stronger causalnexus between the OAM protocol package that local side apparatus OLT sends and the OAM protocol package received, the buffering receiving OAM protocol package always has size to limit.Destroying this causalnexus when carrying out asynchronism and concurrency process in different threads, may causing because exceeding buffer size, the OAM protocol package that should receive is lost.Increase and retransmit probability and more multiple resource consumption, efficiency reduces.Hidden danger increases, and risk increases.
Fig. 1 is to the schematic diagram that OAM protocol package processes respectively in two different threads.The structure of OAM protocol package and send the bag that thread is responsible for processing the structure of OAM protocol package when OLT device carries out acquisition of information or configuration management to ONU equipment relevant and deal with the work.The bag work for the treatment of that the Context resolution that OAM protocol package parsing thread is responsible for processing the OAM protocol package from ONU equipment that OLT device receives is correlated with.Can see from schematic diagram.These two threads are all independent operatings, participate in all separately obtaining CPU and run chance.Their operational relation is that asynchronism and concurrency runs.The order that they run and completely impartial operation chance can not be ensured.The OAM protocol package of these two thread process is all about administration configuration ONU.So probably there is the competition to shared resource shown in Fig. 1, need to increase the problem that synchronization and mutex mechanism solves competition.This adds increased the consumption of system resource.When dealing with improperly, also likely introduce potential unknown problem.Increase potential risks.
Summary of the invention
Technical problem to be solved by this invention is: for prior art Problems existing, a kind of processing method of receiving and dispatching OAM protocol package in same thread is provided, it processes all OAM protocol package in same OAM protocol package processing threads, comprise building and send OAM protocol package and resolve the OAM protocol package received, and the process of resolving the OAM protocol package received preferentially sends the structure etc. of OAM protocol package.
The technical solution used in the present invention is as follows:
The processing method of receiving and dispatching OAM protocol package in same thread comprises:
Step 1: create block type signal and can wake thread up, as OAM protocol package processing threads; Create and send message queue and receipt message queue, be respectively used to reception and send a request message and receive request message;
Step 2: request message is first put into corresponding message queue by message request thread, then sends signal to OAM protocol package processing threads, wakes OAM protocol package processing threads up.OAM protocol package processing threads is according to request message, carry out OAM protocol package create transmission or receive parsing, wherein request message refers to the message sent in message queue, for building OAM protocol package and sending to the message in ONU equipment or receipt message queue, they issue the OAM protocol package of OLT device for ONU equipment, and request OLT device carries out dissection process.
In described step 3, OAM protocol package processing threads carries out OAM protocol package establishment transmission or receives to resolve specifically comprising according to request message:
Step 21: when the process of OAM protocol package processing threads sends the request message of message queue, first judge whether there is the OAM protocol package received from ONU equipment in receipt message queue; If have, then perform step 22; Otherwise OAM protocol package processing threads creates and sends OAM protocol package to corresponding ONU equipment; When the request message of OAM protocol package processing threads process receipt message queue, then perform step 22; The request message wherein sending message queue is by the message sending information interface generation; The request message of receipt message queue is when sending OAM data bag to OLT device by ONU equipment, the message that OLT device bottom layer driving and interface produce;
Step 22:OAM protocol package processing threads resolves all OAM protocol package received.
The transmission information interface that described generation sends a request message is client.
In sum, owing to have employed technique scheme, the invention has the beneficial effects as follows:
Process transmitting-receiving OAM protocol package in same thread, eliminates the problem of competition to resource and access conflict.Eliminate the use of synchronization and mutex resource, also reduce the loss of cpu resource, the efficiency of system resource can be improved.Causalnexus according to the transmitting-receiving of OAM protocol package wraps the sequence arrangement and guarantee that process to transmitting-receiving, the OAM protocol package that can reduce greatly because receiving loses the re-transmission probability caused.Thus improve utilance and the efficiency of system resource.Lessen the hidden dangers, increase risk controllability.
Fig. 2 is to the schematic diagram that OAM protocol package processes in same thread.Because the process of transmitting-receiving OAM bag is all in same thread, just there is not the situation of two thread asynchronism and concurrencies process, the problem of the competition to resource can not being there is, also just need not use the synchronization and mutex resource of system, also eliminating the cpu resource because using these resource consumptions.Thus resource utilization and the efficiency of system can be improved to a certain extent.The order processing dissimilar OAM bag process just can be ensured: the OAM protocol package received has precedence over the process sending OAM protocol package in a thread.The arrangement of this processing sequence is the causalnexus according to existing between transmitting-receiving OAM protocol package, sends an OAM protocol package, will receive a corresponding response OAM protocol package.Suppress to send OAM protocol package excessive velocities, the problem that the OAM protocol package number that reduction receives exceeds buffering maximum and loses.Improve utilance and the efficiency of reliability and system resource.
Accompanying drawing explanation
Examples of the present invention will be described by way of reference to the accompanying drawings, wherein:
Fig. 1 is to the schematic diagram that OAM protocol package processes respectively in two different threads.
OAM protocol package process schematic diagram when Fig. 2 is an OLT device correspondence ONU equipment in a thread.
Embodiment
All features disclosed in this specification, or the step in disclosed all methods or process, except mutually exclusive feature and/or step, all can combine by any way.
Arbitrary feature disclosed in this specification (comprising any accessory claim, summary and accompanying drawing), unless specifically stated otherwise, all can be replaced by other equivalences or the alternative features with similar object.That is, unless specifically stated otherwise, each feature is an example in a series of equivalence or similar characteristics.
Bottom layer driving and interface refer to bsp driver and hardware interface etc.OAM protocol package processing threads sends to the ONU equipment received in the OAM protocol package of ONU equipment and receipt message queue to send to the OAM protocol package of OLT device, and being all needs the bottom layer driving interface of OLT device to participate in.
During a multiple ONU equipment of OLT device correspondence, OAM protocol package processing procedure is identical.
Operation principle:
1, create block type signal and can wake thread up, as OAM protocol package processing threads.In this thread, adopt the process of reception OAM protocol package always to have precedence over the processing policy sending OAM protocol massages carry out Message processing.
2, creating transmission signaling interface, for sending signal to OAM protocol package processing threads, waking this thread up.
3, create transmission message queue and receipt message queue, be respectively used to reception and send a request message and receive request message.Process OAM protocol package thread obtains message from these two message queues, then carries out corresponding process.
4, request message is first put into corresponding message queue by message request thread, then calls transmission signaling interface and wakes OAM protocol package processing threads up.
Specific embodiment:
Step 1: create block type signal and can wake thread up, as OAM protocol package processing threads; Creating and send signaling interface, for sending signal to OAM protocol package processing threads, waking this thread up; Create and send message queue and receipt message queue, be respectively used to reception and send a request message and receive request message;
Step 2: request message is first put into corresponding message queue by message request thread, then calls transmission signaling interface and wakes OAM protocol package processing threads up;
Step 3: when OAM protocol package processing threads receives the request message sending message queue, first judge whether there is the OAM protocol package received from ONU equipment in receipt message queue; If have, then OAM protocol package processing threads resolves all OAM protocol package received; Otherwise OAM protocol package processing threads creates and sends OAM protocol package to corresponding ONU equipment; When the request message of OAM protocol package processing threads process receipt message queue, then OAM protocol package processing threads resolves all OAM protocol package received.
Wherein OAM protocol package processing threads detects in receipt message queue the OAM data bag having multiple ONU equipment to send, then all OAM data bags received all are processed, then according to request to create message, create corresponding OAM protocol package, and this protocol package is issued corresponding ONU equipment.
The present invention is not limited to aforesaid embodiment.The present invention expands to any new feature of disclosing in this manual or any combination newly, and the step of the arbitrary new method disclosed or process or any combination newly.