CN106788842B - A kind of processing method and SOC of PTP message - Google Patents

A kind of processing method and SOC of PTP message Download PDF

Info

Publication number
CN106788842B
CN106788842B CN201611089878.2A CN201611089878A CN106788842B CN 106788842 B CN106788842 B CN 106788842B CN 201611089878 A CN201611089878 A CN 201611089878A CN 106788842 B CN106788842 B CN 106788842B
Authority
CN
China
Prior art keywords
ptp
message
ptp message
time stamp
storage
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201611089878.2A
Other languages
Chinese (zh)
Other versions
CN106788842A (en
Inventor
毛伟
王德明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Raisecom Technology Co Ltd
Original Assignee
Raisecom Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Raisecom Technology Co Ltd filed Critical Raisecom Technology Co Ltd
Priority to CN201611089878.2A priority Critical patent/CN106788842B/en
Publication of CN106788842A publication Critical patent/CN106788842A/en
Application granted granted Critical
Publication of CN106788842B publication Critical patent/CN106788842B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation

Abstract

The invention discloses the processing methods and SOC of a kind of PTP message, and to solve the problems, such as the prior art, there are low efficiency, resource occupation amount are big.This method are as follows: when receiving message, be based on current time, add receiving time stamp for the message;It when determining that the message is PTP message, stores and identifies for the PTP message application, storage mark is added to PTP packet storage queue, receiving time stamp and sending time stamp based on the PTP message are completed synchronous with the clock of the PTP message source.In this way, by the way that the queue of PTP packet storage is added in PTP message, PTP message and non-PTP message can be distinguished, PTP message is handled without the method for calling processing function, directly the PTP message in PTP packet storage queue can be handled, the processing links for reducing PTP message improve the treatment effeciency of PTP message, save the calling processing occupied resource of function.

Description

A kind of processing method and SOC of PTP message
Technical field
The present invention relates to technical field of information processing more particularly to a kind of processing methods and SOC of PTP message.
Background technique
Accurate clock synchronization protocol (Precision Time Protocol, PTP) is that a kind of pair of standard ethernet terminal is set The standby agreement for carrying out time and Frequency Synchronization, also referred to as IEEE 1588, referred to as 1588.PTP clock system (i.e. The domain PTP) in, have and only one synchronised clock, all terminal devices in the domain PTP are all synchronous with clock holding.Wherein, The node that synchronised clock is issued in the domain PTP is host node, and the node for receiving synchronised clock is from node.Host node with can from node Pass through interaction PTP message using 1588 clock synchronization algorithms and realizes that clock is synchronous.
In the prior art, the node in the domain PTP is when receiving PTP message, when being received by software for PTP message addition Between stab.For non real-time nature system as Linux, since there are certain delays for software processing PTP message, so, PTP report The practical receiving time and software of text are can have biggish error between the receiving time of PTP message addition is stabbed, to lead Clock is caused to synchronize inaccuracy.
In addition, physical layer receives message, and (message can be PTP message, be also possible in existing linux system Non- PTP message) after, which is uploaded to the protocol stack part of system layer, the protocol stack part by network interface card and upper layer driving By calling corresponding processing function, application layer is reported to after carrying out respective handling to the message.If the message is PTP report Text, then application layer is that the PP message adds receiving time stamp, and uses related algorithm with software mode, realizes the PTP message Clock between receiving end and transmitting terminal is synchronous.In above process, system layer is when handling PTP message, use Processing method is identical as the processing method used when handling non-PTP message, is in netif_receive_skb function In, according to the type of message that header carries, call at pre-registered processing function corresponding with the type of message Reason.Under the enabled environment of virtual LAN (Virtual Local Area Network, VLAN), it is understood that there may be carry more The PTP of a different virtual local area network tags protocol-identifier (VLAN Tag Protocol Identifier, VLAN TPID) is reported Text carries the PTP message of multiple and different VLAN TPID for these, can register respectively at one for every kind of VLAN TPID Function is managed, and handles this by these processing functions and carries the PTP message of multiple VLAN TPID, in this way, not only occupying big The memory space of amount and processing time, also reduce the treatment effeciency of PTP message.
Summary of the invention
The embodiment of the invention provides the processing methods and SOC of a kind of PTP message, to solve PTP in the prior art That there are treatment effeciencies is lower for message processing method, memory space occupancy is larger, for the receiving time stamp of PTP message addition The lower problem of accuracy.
Specific technical solution provided in an embodiment of the present invention is as follows:
A kind of processing method of PTP message is applied to SOC, for handling PTP message, and completes above-mentioned PTP report Clock between the transmitting terminal and receiving end of text is synchronous, and above-mentioned processing method includes:
Physical layer is based on current time in the case where receiving message, adds receiving time for above-mentioned message and stabs, and In the case where determining that above-mentioned message is PTP message, the sending time stamp and report above-mentioned PTP that above-mentioned PTP message carries are obtained Text is sent to driving layer;
It drives layer after storing above-mentioned PTP message, is identified for above-mentioned PTP message application storage, and above-mentioned storage is identified It is added to PTP packet storage queue, and in the case where determining that meeting preset clock synchronizes trigger condition, triggers application layer Storage mark based on above-mentioned PTP packet storage queue record, obtains above-mentioned PTP message;
Application layer is after the transmitting terminal for determining above-mentioned PTP message, when the receiving time based on above-mentioned PTP message is stabbed and sent Between stab, complete it is synchronous with the clock of above-mentioned transmitting terminal.
Preferably, obtaining the sending time stamp of above-mentioned PTP message in physical layer and above-mentioned PTP message being sent to driving After layer, before driving layer stores above-mentioned PTP message, further comprise:
Physical layer stores the receiving time stamp of above-mentioned PTP message and sending time stamp to the first specified region.
Preferably, after driving layer stores above-mentioned PTP message, for above-mentioned PTP message application storage mark, and by above-mentioned storage Mark is added to PTP packet storage queue, comprising:
Driving layer will after above-mentioned PTP packet storage to the second specified region, be that one characterization of above-mentioned PTP message application is above-mentioned The storage of PTP start of message (SOM) storage address identifies;
Driving layer judges whether above-mentioned PTP message is the first PTP message received;
If so, driving layer identifies below on the head of preset above-mentioned PTP packet storage queue, it is inserted into above-mentioned PTP report The storage mark of text;Otherwise, driving layer identifies below in the last one storage of above-mentioned PTP packet storage queue current record, It is inserted into the storage mark of above-mentioned PTP message.
Preferably, determining above-mentioned PTP message if driving layer receives the PTP message access request of application layer initiation In the case that storage queue is empty, process waiting list is added in the process for accessing PTP message.
Preferably, driving layer, in the case where determining that meeting preset clock synchronizes trigger condition, triggering application layer is based on The storage of above-mentioned PTP packet storage queue record identifies, and obtains above-mentioned PTP message, comprising:
Layer is driven to there is the process for accessing PTP message and above-mentioned PTP packet storage in determining above-mentioned process waiting list In the case that queue is non-empty, identification meets the synchronous trigger condition of above-mentioned clock, and wakes up above-mentioned process, triggers above-mentioned process base Above-mentioned PTP message is obtained in the storage mark of above-mentioned PTP packet storage queue record.
Preferably, application layer, after the transmitting terminal for determining above-mentioned PTP message, the receiving time based on above-mentioned PTP message is stabbed It stabs, completes synchronous with the clock of above-mentioned transmitting terminal with sending time, comprising:
The virtual LAN VLAN mark that application layer is carried based on above-mentioned PTP message, determines the transmission of above-mentioned PTP message End obtains the receiving time stamp and sending time stamp of above-mentioned PTP message and from the above-mentioned first specified region, and based on obtaining The receiving time stamp and sending time stamp for the above-mentioned PTP message got are completed and above-mentioned hair using preset clock synchronization algorithm The time synchronization and Frequency Synchronization of sending end.
A kind of SOC, for handling PTP message, and the clock completed between the transmitting terminal and receiving end of above-mentioned PTP message is same Step, above-mentioned SOC includes: logic processing module, trawl performance module and application processing module, wherein
Above-mentioned logic processing module is added for being based on current time in the case where receiving message for above-mentioned message Receiving time stamp, and in the case where determining above-mentioned message is PTP message, obtain the sending time stamp that above-mentioned PTP message carries And above-mentioned PTP message is sent to above-mentioned trawl performance module;
Above-mentioned trawl performance module, for being identified for above-mentioned PTP message application storage after storing above-mentioned PTP message, and Above-mentioned storage mark is added to PTP packet storage queue, and is determining the feelings for meeting the synchronous trigger condition of preset clock It under condition, triggers above-mentioned application processing module and is identified based on the storage of above-mentioned PTP packet storage queue record, obtain above-mentioned PTP report Text;
Above-mentioned application processing module, for after the transmitting terminal for determining above-mentioned PTP message, based on connecing for above-mentioned PTP message Timestamp and sending time stamp are received, is completed synchronous with the clock of above-mentioned transmitting terminal.
Preferably, obtaining the sending time stamp of above-mentioned PTP message in above-mentioned logic processing module and by above-mentioned PTP message It is sent to after above-mentioned trawl performance module, before above-mentioned trawl performance module stores above-mentioned PTP message, above-mentioned logical process Module is also used to: the receiving time stamp of above-mentioned PTP message and sending time stamp are stored to the first specified region.
Preferably, being identified after storing above-mentioned PTP message for above-mentioned PTP message application storage, and above-mentioned storage is identified It is added to when PTP packet storage queue, above-mentioned trawl performance module is specifically used for:
After above-mentioned PTP packet storage to the second specified region, for the above-mentioned PTP report of above-mentioned application of PTP message one characterization The storage of literary initial memory address identifies;
Judge whether above-mentioned PTP message is the first PTP message received;
If so, identifying below on the head of preset above-mentioned PTP packet storage queue, it is inserted into depositing for above-mentioned PTP message Storage mark;Otherwise, behind the last one storage mark of above-mentioned PTP packet storage queue current record, it is inserted into above-mentioned PTP report The storage mark of text.
Preferably, above-mentioned SOC further include: interface driver module, wherein
Above-mentioned interface driver module, if the PTP message access request initiated for receiving above-mentioned application processing module, In the case where it is empty for determining above-mentioned PTP packet storage queue, process waiting list is added in the process for accessing PTP message.
Preferably, triggering above-mentioned application processing module base in the case where determining that meeting preset clock synchronizes trigger condition When the storage mark of above-mentioned PTP packet storage queue record obtains above-mentioned PTP message, above-mentioned trawl performance module is specifically used In:
Determine that it is non-for there is the process for accessing PTP message and above-mentioned PTP packet storage queue in above-mentioned process waiting list In the case where sky, identification meets the synchronous trigger condition of above-mentioned clock, and wakes up above-mentioned process, triggers above-mentioned process based on above-mentioned The storage mark of PTP packet storage queue record obtains above-mentioned PTP message.
Preferably, after the transmitting terminal for determining above-mentioned PTP message, it is above-mentioned based on being got from above-mentioned logic processing module The receiving time stamp and sending time stamp of PTP message, when completing synchronous with the clock of above-mentioned transmitting terminal, above-mentioned application processing module It is specifically used for:
Based on the VLAN mark that above-mentioned PTP message carries, the transmitting terminal of above-mentioned PTP message is determined, and refer to from above-mentioned first Determine in region, obtains the receiving time stamp and sending time stamp of above-mentioned PTP message, and based on the above-mentioned PTP message got Receiving time stamp and sending time stamp, using preset clock synchronization algorithm, complete with the time synchronization of above-mentioned transmitting terminal and Frequency Synchronization.
The embodiment of the present invention has the beneficial effect that:
In the embodiment of the present invention, by by PTP message be added the queue of PTP packet storage, so that it may by PTP message with it is non- PTP message distinguishes, and handles PTP message without the method for calling processing function, can be directly against PTP packet storage Each PTP message in queue carries out clock synchronization process, not only reduces the processing links of PTP message, improves PTP message Treatment effeciency, moreover, also saving the calling occupied memory space of processing function and process resource.In addition to this, pass through Physical layer avoids since software processing PTP message has certain prolong the PTP message addition receiving time stamp received Late, cause to be that the receiving time that PTP message adds is stabbed there are large error by software, synchronize inaccuracy so as to cause clock Problem.
Detailed description of the invention
Figure 1A is the structural schematic diagram of SOC in the embodiment of the present invention;
Figure 1B is the concrete structure schematic diagram of SOC in the embodiment of the present invention;
Fig. 2 is one of the overview schematic diagram of PTP message processing method in the embodiment of the present invention;
Fig. 3 is the structural schematic diagram of PTP packet storage queue (i.e. doubly linked list) in the embodiment of the present invention;
Fig. 4 A is two of the overview schematic diagram of PTP message processing method in the embodiment of the present invention;
Fig. 4 B is the specific processing flow schematic diagram of logic processing module 100 in the embodiment of the present invention;
Fig. 4 C is the specific processing flow schematic diagram of trawl performance module 110 in the embodiment of the present invention;
Fig. 4 D is the specific processing flow schematic diagram of application processing module 120 in the embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, is not whole embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.
There are treatment effeciencies in order to solve PTP message processing method in the prior art lower, process resource occupancy compared with It greatly, is the lower problem of accuracy of the receiving time stamp of PTP message addition, it is all by what is received in the embodiment of the present invention Message is classified: being directed to non-PTP message, is handled using the method in the prior art for calling processing function;For PTP Message is handled using PTP message dedicated processes process, as one storage mark of PTP message application, and the storage is marked Know and the queue of PTP packet storage is added, when determining that meeting preset clock synchronizes trigger condition, based in the queue of PTP packet storage The storage of record identifies, and obtains PTP message, and in turn, receiving time stamp and sending time stamp based on the PTP message, completing should Clock between the transmitting terminal and receiving end of PTP message is synchronous.
With reference to the accompanying drawing, the present invention program is described in detail by specific embodiment, certainly, the present invention is simultaneously unlimited In following embodiment.
The embodiment of the invention provides a kind of systems on chip (System-on-a-chip, SOC) as shown in Figure 1A, should The host node that SOC can be applied in the domain PTP can also be applied to from node, which includes at least: logic processing module 100 (is located at Physical layer), trawl performance module 110 (be located at driving layer) and application processing module 120 (positioned at application layer), wherein
Above-mentioned logic processing module 100 is above-mentioned message for being based on current time in the case where receiving message Receiving time stamp is added, and in the case where determining above-mentioned message is PTP message, when obtaining the transmission that above-mentioned PTP message carries Between stab and above-mentioned PTP message is sent to above-mentioned trawl performance module 110;
Above-mentioned trawl performance module 110, for being marked for above-mentioned PTP message application storage after storing above-mentioned PTP message Know, and above-mentioned storage mark is added to PTP packet storage queue, and meets the synchronous trigger condition of preset clock determining In the case where, it triggers above-mentioned application processing module 120 and is obtained based on the storage mark of above-mentioned PTP packet storage queue record State PTP message;
Above-mentioned application processing module 120, for being based on above-mentioned PTP message after the transmitting terminal for determining above-mentioned PTP message Receiving time stamp and sending time stamp, complete it is synchronous with the clock of above-mentioned transmitting terminal.
Preferably, obtaining the sending time stamp of above-mentioned PTP message in above-mentioned logic processing module 100 and by the PTP Message is sent to after the trawl performance module 110, before above-mentioned trawl performance module 110 stores above-mentioned PTP message, on It states logic processing module 100 to be also used to: the receiving time stamp of above-mentioned PTP message and sending time stamp is stored to the first specified area Domain.
Preferably, being identified after storing above-mentioned PTP message for above-mentioned PTP message application storage, and above-mentioned storage is identified It is added to when PTP packet storage queue, above-mentioned trawl performance module 110 is specifically used for:
After above-mentioned PTP packet storage to the second specified region, for the above-mentioned PTP report of above-mentioned application of PTP message one characterization The storage of literary initial memory address identifies;
Judge whether above-mentioned PTP message is the first PTP message received;
If so, identifying below on the head of preset above-mentioned PTP packet storage queue, it is inserted into depositing for above-mentioned PTP message Storage mark;Otherwise, behind the last one storage mark of above-mentioned PTP packet storage queue current record, it is inserted into above-mentioned PTP report The storage mark of text.
Preferably, above-mentioned SOC provided in an embodiment of the present invention further include: interface driver module 130 (is located at driving layer), In,
Above-mentioned interface driver module 130, if the PTP message access initiated for receiving above-mentioned application processing module 120 The process for accessing PTP message is added process and waited by request then in the case where it is empty for determining above-mentioned PTP packet storage queue Queue.
Preferably, triggering above-mentioned application processing module in the case where determining that meeting preset clock synchronizes trigger condition When storage mark based on above-mentioned PTP packet storage queue record obtains above-mentioned PTP message, above-mentioned trawl performance module 110 has Body is used for: determining there is the process of access PTP message and above-mentioned PTP packet storage queue in process waiting list for the feelings of non-empty Under condition, identification meets the synchronous trigger condition of preset clock, and wakes up above-mentioned process, triggers above-mentioned process and is reported based on above-mentioned PTP The storage mark of literary storage queue record, obtains above-mentioned PTP message.
Preferably, after the transmitting terminal for determining above-mentioned PTP message, receiving time stamp and transmission based on above-mentioned PTP message Timestamp, when completing synchronous with the clock of above-mentioned transmitting terminal, above-mentioned application processing module 120 is specifically used for:
Based on the VLAN mark that above-mentioned PTP message carries, the transmitting terminal of above-mentioned PTP message is determined, and refer to from above-mentioned first Determine in region, obtains the receiving time stamp and sending time stamp of above-mentioned PTP message, and based on the above-mentioned PTP message got Receiving time stamp and sending time stamp, using preset clock synchronization algorithm, complete with the time synchronization of above-mentioned transmitting terminal and Frequency Synchronization.
It is tellable to be, in practical applications, above-mentioned SOC provided in an embodiment of the present invention further include: at non-PTP message Manage module 140 (being located at protocol layer), wherein above-mentioned non-PTP message processing module (MPM) 140, for using calling in the prior art The method for handling function handles non-PTP message (specifically, the processing method Yu processing method in the prior art of non-PTP message Identical, details are not described herein).
Based on this, the embodiment of the invention provides a kind of processing method of PTP message, be applied to above-mentioned SOC, for pair PTP message is handled, and the clock completed between the transmitting terminal of the PTP message and receiving end is synchronous, below with reference to such as Figure 1B Shown in SOC, PTP message processing method provided in an embodiment of the present invention is described in detail, as shown in fig.2, the PTP report The process of literary processing method is as follows:
Step 200: physical layer is based on current time in the case where receiving message, when receiving for the addition of above-mentioned message Between stab, and in the case where determining above-mentioned message is PTP message, obtain sending time stamp that above-mentioned PTP message carries and will Above-mentioned PTP message is sent to driving layer.Wherein, above-mentioned PTP message can be but not limited to: SYNC message, Delay req report Text, Delay resp message, etc.;The sending time stamp that above-mentioned PTP message carries is that the transmitting terminal of above-mentioned PTP message is being sent out It serves when stating PTP message as the addition of above-mentioned PTP message.
In practical applications, step 200 is carried out (wherein, at logic in the logic processing module 100 of above-mentioned SOC Reason module 100 includes at least: the first converting unit 101, local clock unit 102, the first cache unit 103, packet parsing list Member 104, information acquisition unit 105, timestamp storage unit 106, the second cache unit 107, response message generation unit 108, Second converting unit 109), specifically, logic processing module 100 is each in logic processing module 100 when executing step 200 A unit is mainly used for completing following operate:
A1: the first converting unit 101 receives message by message input port MAC_rx, and passes through local clock unit The current time of 102 maintenances adds receiving time stamp for the message, and the message added with receiving time stamp is divided into two Road is cached all the way to the first cache unit 103, is exported all the way to packet parsing unit 104.Wherein, above-mentioned message input port MAC_rx can be but not limited to: Gigabit Media separate port (Gigabit Media Independent Interface, GMII)。
Tellable to be, according to the current time of local maintenance, the message to receive adds to be connect logic processing module 100 Timestamp is received, as long as in this way, receiving message, so that it may add receiving time stamp for the message, avoid due to software processing There is delay in message, cause the receiving time stamp added for the message to there are problems that error, improve the essence of receiving time stamp Degree, and then ensure that the synchronous accuracy of clock.
A2: the first cache unit 103 determine the packet buffer complete in the case where, by the buffer address of the message export to Information acquisition unit 105.At the same time, packet parsing unit 104 parses the message, determines the message class of the message Type, and definitive result is exported to information acquisition unit 105.Wherein, above-mentioned type of message includes at least following two type: PTP message and non-PTP message.
A3: information acquisition unit 105 obtains the message from the first cache unit 103 based on the buffer address received, And based on the determination received as a result, in the case where determining that the message is PTP message, when obtaining the transmission of PTP message carrying Between stab, and by the data information memories such as the PTP message corresponding sending time stamp and receiving time stamp to timestamp storage unit 106 (the i.e. first specified regions), and the PTP message is exported to the second cache unit 107, it is real by the second cache unit 107 Now to the scheduling of the PTP message;In the case where determining that the message is non-PTP message, the reception added for the non-PTP message is deleted Timestamp, and the non-PTP message is exported to the second cache unit 107, it is realized by the second cache unit 107 and the non-PTP is reported The scheduling, etc. of text.
It is tellable to be, under certain special scenes in practical applications, possibly it can not be respectively configured for each equipment One for receiving the message input port of PTP message, i.e., can not be received respectively from difference by multiple message input ports The PTP message of the transmitting terminal of virtual LAN can only be received by a message input port from different virtual LAN The PTP message of transmitting terminal.In this way, can not just identify the transmitting terminal of PTP message using the port numbers of message input port, it is based on This, in the embodiment of the present invention, can be arranged multiple and different virtual port numbers in advance for message input port, and establish multiple virtual One-to-one mapping relations between LAN ID (such as: VLAN mark) and multiple virtual port numbers.In this way, receiving PTP After message, so that it may the one-to-one mapping relations between multiple virtual port numbers are identified based on the multiple VLAN pre-established, Determine virtual port number associated with the VLAN mark that the PTP message that receives carries, in turn, so that it may according to determining Virtual port number, determine the transmitting terminal of the PTP message.
Preferably, in order to guarantee subsequent can rapidly and accurately get PTP message from timestamp storage unit 106 Corresponding sending time stamp and receiving time stamp are believed by data such as the corresponding sending time stamp of PTP message and receiving time stamps During breath is stored to timestamp storage unit 106, the VLAN that can be carried according to the PTP message is identified, to PTP message The data informations such as corresponding sending time stamp and receiving time stamp are stored.In this way, subsequent need from timestamp storage unit In 106, when obtaining the corresponding sending time stamp of PTP message and receiving time stamp, so that it may the VLAN carried by the PTP message Mark is obtained.
A4: the second cache unit 107 is scheduled message, that is, in the case where determining that message needs report, by the report Text is exported to the second converting unit 109;In the case where determining that the message needs to respond (Reply), which is exported to response Message generation unit 108, etc..
A5: the second converting unit 109 configures message according to the receivable message format of trawl performance module 110, And will export with the message postponed to trawl performance module 110, subsequent processing is carried out to the message by trawl performance module 110.
A6: response message generation unit 108 generates corresponding response message based on the message for needing Reply, and by the sound It answers packet buffer to the second cache unit 107, the response is exported by message output port MAC_tx by the second cache unit 107 Message, wherein above-mentioned message output port MAC_tx can be but not limited to: the port GMII.
Step 210: driving layer identifies after storing above-mentioned PTP message for above-mentioned PTP message application storage, and will be above-mentioned Storage mark is added to PTP packet storage queue, and in the case where determining that meeting preset clock synchronizes trigger condition, touching It sends out application layer to identify based on the storage of above-mentioned PTP packet storage queue record, obtains above-mentioned PTP message.
In practical applications, it " after storing above-mentioned PTP message, is identified for above-mentioned PTP message application storage, and will be above-mentioned Storage mark is added to the queue of PTP packet storage " operation be (its carried out in the trawl performance module 110 of above-mentioned SOC In, trawl performance module 110 includes at least: registering unit 111, judging unit 112, PTP packet storage unit 113, chained list dimension Protect unit 114, wakeup unit 115), specifically, trawl performance module 110 " is upper after storing above-mentioned PTP message in execution State PTP message application storage mark, and above-mentioned storage mark be added to the queue of PTP packet storage " operation in the case where, net Each unit in card drive module 110 is mainly used for completing following operate:
B1: after registering unit 111 receives the message of the output of logic processing module 100, an interrupt processing letter can be registered Number is based on the interrupt processing function, calls traps process flow (calling following process flow).
B2: judging unit 112 parses the message, determine the message be non-PTP message (such as: address resolution association Discuss (Address Resolution Protocol, ARP) message etc.) in the case where, which is exported to non-PTP and is reported Literary processing module 140, it is non-using the method processing in the prior art for calling processing function by non-PTP message processing module (MPM) 140 PTP message (specifically, the processing method of non-PTP message is identical as processing method in the prior art, and details are not described herein);Really In the case that the fixed message is PTP message, by the PTP packet storage to (the i.e. second specified area of PTP packet storage unit 113 Domain).
B3: linked list maintenance unit 114 is the storage that the PTP message application one characterizes PTP start of message (SOM) storage address Mark, in the specific implementation, storage mark can be but not limited to: vlan_list_cache structural body, the vlan_ List_cache structural body includes at least two parts: for identifying the first structure body struct list_ of the PTP message Head list, and the second structural body pointer struct sk_buff*sk for characterizing the PTP packet storage space.
Wherein, list is that chained list node (includes at least two members: forwarding pointer list- > pre and backwarding pointer list- >next);* sk is the pointer for being directed toward the second structural body struct sk_buff initial memory address;In struct sk_buff Message length variables L can be assigned a value of the length of the PTP message, and the pointer * ptr in struct sk_buff is directed toward PTP report The initial memory address of text.In this way, when the subsequent access PTP message, so that it may according in vlan_list_cache structural body Pointer * sk, determines the initial memory address of struct sk_buff, further according to the pointer * in struct sk_buff Ptr determines the initial memory address of the PTP message.
Linked list maintenance unit 114 be the PTP message application vlan_list_cache structural body after, if the PTP message is The first PTP message received, then linked list maintenance unit 114 can be by the corresponding vlan_list_cache structure of the PTP message Member list is as first chained list Knots inserting to preset linked list head node struct list_head sb_ in body Behind list (i.e. head mark), specific insertion operation are as follows: by the corresponding vlan_list_cache structural body of the PTP message Pointer list- > pre of middle member list is directed toward member sb_list in linked list head node struct list_head sb_list Initial memory address, by the pointer sb_ of member sb_list in linked list head node struct list_head sb_list List- > next is directed toward the initial memory address of member list in the corresponding vlan_list_cache structural body of the PTP message; If the PTP message is not the first PTP message received, linked list maintenance unit 114 can be corresponding by the PTP message The vlan_list_ that pointer list- > pre of member list once applies before being directed toward in vlan_list_cache structural body The starting storage address of member list in cache structural body (the i.e. last corresponding structural body of PTP message received), and will Pointer list- > next of member list is directed toward this application in the preceding vlan_list_cache structural body once applied The starting storage address of member list in vlan_list_cache structural body.In this way, linked list maintenance unit 114 can be based on The corresponding vlan_list_cache structural body of each PTP message, generates a doubly linked list as shown in Figure 3, i.e. generation PTP Packet storage queue.
Wherein, the linked list head node struct list_head sb_list of doubly linked list is that linked list maintenance unit 114 exists (wherein, struct net_device structural body is for describing in trawl performance module 110 for struct net_device structural body Network interface card eth1 where equipment attribute information) the privately owned member struct net_local of the overall situation in it is preset, initially When change, the pointer sb_list- > pre and pointer of member sb_list in linked list head node struct list_head sb_list Sb_list- > next is directed to the initial memory address of member sb_list, when applying for vlan_list_cache structural body for the first time, The direction of pointer sb_list- > next of member sb_list can be more in linked list head node struct list_head sb_list It is changed to the initial memory address of member list in vlan_list_cache structural body.In this way, when subsequent access doubly linked list, just It can be according to the privately owned member struct net_local of the overall situation of struct net_device structural body, quickly and accurately really The linked list head node struct list_head sb_list of doubly linked list is made, in turn, so that it may determine the doubly linked list In the initial memory address of PTP message that is respectively directed toward of each chained list node.
B4: the corresponding vlan_list_cache structural body of the PTP message is inserted into Two-way Chain in linked list maintenance unit 114 After table, in the case that wakeup unit 115 determines the process that there is access PTP message in process waiting list, i.e. determination has access In the case that the process of PTP message is slept in process waiting list, the process can be waken up, the process is triggered and is based on doubly linked list In the corresponding vlan_list_cache structural body of the PTP message, access the PTP message.So far, traps process flow terminates.
It is tellable to be, the process of above-mentioned access PTP message be in above-mentioned SOC interface driver module 130 receive it is above-mentioned After the PTP message access request that application processing module 120 is initiated in SOC, determine that doubly linked list (i.e. PTP packet storage queue) is In the case where sky, the process of access PTP message is added to above-mentioned process waiting list.Specifically, interface driver module After 130 receive the PTP message access request of the initiation of application processing module 120, which can be forwarded to Trawl performance module 110, and the response message for waiting trawl performance module 110 to return, and receiving trawl performance module In the case where 110 response messages returned, based on the response message that trawl performance module 110 returns, determine doubly linked list (i.e. The queue of PTP packet storage) be empty after, the process of access PTP message is added to above-mentioned process waiting list, and should determining The process of PTP message is accessed by the wake-up of wakeup unit 115 in trawl performance module 110 and doubly linked list (i.e. PTP packet storage Queue) be non-empty in the case where, call MMAP function, so that the process of access PTP message is directly accessed trawl performance mould The doubly linked list (i.e. PTP packet storage queue) safeguarded in block 110;Interface driver module 130 is based on trawl performance module 110 The response message of return calls directly MMAP letter in the case where determining that doubly linked list (i.e. PTP packet storage queue) is non-empty Number allows the process of access PTP message directly to access doubly linked list (the i.e. PTP report safeguarded in trawl performance module 110 Literary storage queue).
Preferably, being tieed up to guarantee that the process of access PTP message can be quickly found in trawl performance module 110 The doubly linked list (i.e. PTP packet storage queue) of shield, interface driver module 130 can also utilize dev_get_by_ in initialization Name (&init_net, " eth1 ") function, return to the characterization network interface card eth1 attribute information in trawl performance module 110 Struct net_device structural body pointer, and the struct net_device structural body pointer is stored in global variable In, it can rapidly and accurately be found based on the struct net_device structural body pointer to access the process of PTP message Struct net_device structural body in trawl performance module 110, and according to the complete of struct net_device structural body The privately owned member struct net_local of office, finds the linked list head node struct list_head sb_list of doubly linked list, In turn, so that it may according to the vlan_list_cache structural body in doubly linked list, find out the vlan_list_cache structural body The initial memory address of the PTP message of direction realizes the access to PTP message.
Further, in practical applications, it " in the case where determining that meeting preset clock synchronizes trigger condition, is based on The storage of above-mentioned PTP packet storage queue record identifies, and obtains above-mentioned PTP message " operation be application processing in above-mentioned SOC (wherein, application processing module 120 includes at least: processing unit 121 and interface adaptation unit 122) carried out in module 120, tool Body, application processing module 120 is in execution " in the case where determining that meeting preset clock synchronizes trigger condition, based on above-mentioned The storage of PTP packet storage queue record identifies, and obtains above-mentioned PTP message " operation in the case where, application processing module 120 In each unit be mainly used for completing following operate:
C1:, can be according to maximum message size application one in the case that the determination of processing unit 121 needs to read PTP message User's space, and IOCTL function is called using the corresponding user's space address of the user's space as parameter, pass through IOCTL function Control interface adaptation unit 122 initiates PTP message access request to interface driver module 130.
C2:, can be to interface driver after interface adaptation unit 122 receives IOCTL function and parses to IOCTL function Module 130 initiates PTP message access request, and (response message can be with for the response message for waiting interface driver module 130 to return It is the response message that trawl performance module 110 is back to interface driver module 130), receive the return of interface driver module 130 In the case where response message, it is based on the response message, in the case where determining that doubly linked list (i.e. PTP packet storage queue) is empty, The process for waiting trawl performance module 110 that will access PTP message wakes up, and in the case where being waken up, based on being stored in interface Struct net_device structural body pointer in 130 global variable of drive module, it is corresponding to find trawl performance module 110 Struct net_device structural body, and according to the privately owned member struct of the overall situation of struct net_device structural body Net_local finds the linked list head node struct list_head sb_list of doubly linked list, in turn, according to linked list head knot Pointer sb_list- > next of member sb_list in point struct list_head sb_list finds in doubly linked list Member list in one vlan_list_cache structural body, and the storage address based on member list and struct sk_ Offset between the storage address of buff finds pointer * sk, Yi Jiji in first vlan_list_cache structural body Pointer * sk in vlan_list_cache structural body finds struct sk_buff, further according to the finger in sk_buff Needle * ptr finds the initial memory address of first PTP message of pointer * ptr direction, and first PTP message is replicated In the user's space applied to processing unit 121.
Further, PTP message is copied to 121 Shen of processing unit by interface adaptation unit 122 in application processing module 120 After user's space please, processing unit 121 continues to execute following steps in application processing module 120:
Step 220: application layer is after the transmitting terminal for determining above-mentioned PTP message, the receiving time stamp based on above-mentioned PTP message It stabs, completes synchronous with the clock of above-mentioned transmitting terminal with sending time.
Specifically, the processing unit 121 in application processing module 120 can be used but be not limited to when executing step 230 Following manner:
C3: processing unit 121 parses the PTP message in user's space, obtains the VLAN mark of PTP message carrying Know, and identified based on the VLAN, determines the transmitting terminal of the PTP message, and VLAN mark is carried and is asked in timestamp acquisition In asking, interface driver module 130 is sent to by interface adaptation unit 122, and wait taking for the return of interface driver module 130 The timestamp of receiving time stamp and sending time stamp with the PTP message obtains response.
It is tellable to be, it, can be by the timestamp acquisition request after interface driver module 130 receives timestamp acquisition request It is forwarded to logic processing module 100;After logic processing module 100 receives the timestamp acquisition request, the timestamp can be based on Carried in acquisition request VLAN mark, obtained from timestamp storage unit 106 corresponding PTP message receiving time stamp and Sending time stamp, and the receiving time of PTP message stamp and sending time stamp are carried to obtain in response in timestamp and are back to Interface driver module 130;After interface driver module 130 receives timestamp acquisition response, which can be obtained response and turned The interface adaptation unit 122 being sent in application processing module 120, it is by interface adaptation unit 122 that timestamp acquisition response is defeated Out to processing unit 121.
C4: 121 receiving time of processing unit stamp obtains response, and obtains the receiving time that response carries based on the timestamp Stamp and sending time stamp, (can be but not limited to: 1588 algorithms) using preset clock synchronization algorithm, be completed and PTP message The time synchronization and Frequency Synchronization of transmitting terminal.
Receiving PTP message for the first time after only powering below using host node or from node is concrete application scene to above-mentioned Embodiment is described in further detail, and refering to shown in Fig. 4 A, in the embodiment of the present invention, PTP message processing method process is as follows:
Step 400: when physical layer logic processing module 100 receives message, being based on current time, connect for message addition Timestamp is received, and when determining the message is PTP message, obtains the sending time stamp of PTP message carrying, and being based on should The VLAN mark that PTP message carries reports the PTP message after the sending time stamp and receiving time for storing the PTP message stab To driving layer trawl performance module 110.
Step 410: after driving layer trawl performance module 110 receives the message that physical layer logic processing module 100 reports, When determining that the message is non-PTP message, which is exported to the non-PTP message processing module (MPM) 140 of protocol layer, by the association The view non-PTP message processing module (MPM) 140 of layer continues to execute step 440;When determining that the message is PTP message, for the PTP message application One vlan_list_cache structural body, and (i.e. PTP message is deposited by vlan_list_cache structural body insertion doubly linked list Store up queue) and wakeup process waiting list in access PTP message process.
Step 420: driving layer interface drive module 130 determines the process of access PTP message by driving layer trawl performance When module 110 wakes up, MMAP function is called, accesses the process of access PTP message directly in trawl performance module 110 The doubly linked list (i.e. PTP packet storage queue) of maintenance.
Step 430: application layer applications processing module 120 accesses trawl performance mould by driving layer interface drive module 130 The doubly linked list (i.e. PTP packet storage queue) safeguarded in block 110, and based on the vlan_list_cache knot in doubly linked list Structure body obtains corresponding PTP message, and based on the PTP message receiving time stamp and sending time stamp, using it is preset when Clock synchronized algorithm completes time synchronization and Frequency Synchronization with PTP message source.
Step 440: the non-PTP message processing module (MPM) 140 of protocol layer is using the method in the prior art for calling processing function The non-PTP message received is handled, specific processing method is identical as processing method in the prior art, and details are not described herein.
With reference to the accompanying drawing, it is described in detail for the specific processing mode of each module in SOC.
Refering to shown in Fig. 4 B, in the embodiment of the present invention, the specific process flow of physical layer logic processing module 100 is as follows:
Step 401: the first converting unit 101 receives message by message input port MAC_rx, and passes through local clock The current time that unit 102 is safeguarded adds receiving time stamp, and the message point that will be stabbed added with receiving time for the message It at two-way, is cached all the way to the first cache unit 103, is exported all the way to packet parsing unit 104.
Step 402: the first cache unit 103 determine the packet buffer complete when, by the buffer address of the message export to Information acquisition unit 105.
Step 403: packet parsing unit 104 parses the message, determines the type of message of the message, and will determine As a result it exports to information acquisition unit 105.
Step 404: information acquisition unit 105 is obtained from the first cache unit 103 based on the buffer address received The message, and based on the determination received as a result, obtaining the transmission of the PTP message carrying when determining that the message is PTP message Timestamp.
Step 405: the VLAN mark that information acquisition unit 105 is carried based on the PTP message, by the transmission of the PTP message After the data information memories to timestamp storage unit 106 such as timestamp and receiving time stamp, which is exported to second Cache unit 107 is exported the PTP message to the second converting unit 109 by the second cache unit 107.
Step 406: the second converting unit 109 is according to the receivable message format of trawl performance module 110 to the PTP message It is configured, and will be exported with the PTP message postponed to trawl performance module 110.
So far, the process flow of physical layer logic processing module 100 terminates.
Refering to shown in Fig. 4 C, in the embodiment of the present invention, drive the specific process flow of layer trawl performance module 110 as follows:
Step 411: after registering unit 111 receives the message of the output of logic processing module 100, registering an interrupt processing Function is based on the interrupt processing function, calls traps process flow (calling following process flow).
Step 412: judging unit 112 parses the message, judges whether the message is PTP message, if so, holding Row step 414;Otherwise, step 413 is executed.
Step 413: judging unit 112 exports the non-PTP message to non-PTP message processing module (MPM) 140, is reported by non-PTP Literary processing module 140 handles non-PTP message using the method in the prior art for calling processing function.
Step 414: the PTP packet storage to PTP packet storage unit 113 is triggered linked list maintenance list by judging unit 112 Member 114 is one vlan_list_cache structural body of PTP message application.
Step 415: linked list maintenance unit 114 is one vlan_list_cache structural body of PTP message application, and will The vlan_list_cache structural body is inserted into the linked list head node struct list_head sb_list of doubly linked list, touching Hair wakeup unit 115 judges in process waiting list with the presence or absence of the process of access PTP message.
Specifically, linked list maintenance unit 114 is by the pointer list- of member list in the vlan_list_cache structural body > pre is directed toward the initial memory address of member sb_list in linked list head node struct list_head sb_list, and will Pointer sb_list- > next of member sb_list, which is directed toward, in linked list head node struct list_head sb_list is somebody's turn to do The initial memory address of member list in the corresponding vlan_list_cache structural body of PTP message.Wherein, linked list head node The struct net_device of device attribute information where struct list_head sb_list is stored in characterization network interface card eth1 In the privately owned member struct net_local of the overall situation of structural body.
Step 416: when wakeup unit 115 determines the process that there is access PTP message in process waiting list, i.e. determination has When the process of access PTP message is slept in process waiting list, the process is waken up, the process is triggered and is based on being somebody's turn to do in doubly linked list The corresponding vlan_list_cache structural body of PTP message, accesses the PTP message.
So far, traps process flow terminates, and exits traps process flow, that is, drives layer trawl performance module 110 Process flow terminates.
Further, in the embodiment of the present invention, driving layer further includes interface driver module 130, the interface driver module 130 It is mainly used for forwarding logic processing module 100 and application processing module 120 and trawl performance module 110 and application processing mould Data information between block 120, and access doubly linked list (i.e. PTP packet storage queue) is provided for application processing module 120 Access approach, 130 concrete operations of interface driver module are as follows:
(1) the access approach of doubly linked list (i.e. PTP packet storage queue) is provided:
Interface driver module 130 calls dev_get_by_name (&init_net, " eth1 " in initialization) function, The struct net_device structural body pointer of the characterization network interface card eth1 attribute information in trawl performance module 110 is returned, and The struct net_device structural body pointer is stored in global variable.
(2) data information between trawl performance module 110 and application processing module 120 is forwarded:
When interface driver module 130 receives the PTP message access request of the transmission of application processing module 120, which is reported Literary access request is forwarded to trawl performance module 110, and the response message for waiting trawl performance module 110 to return.
When interface driver module 130 receives the response message of the return of trawl performance module 110, if being disappeared based on the response Breath determines that the process of access PTP message for sky, is then added to process and waits by doubly linked list (i.e. PTP packet storage queue) Queue, and when the process for determining access PTP message is waken up by the wakeup unit 115 in trawl performance module 110, it calls MMAP function allows the process of access PTP message directly to access the doubly linked list safeguarded in trawl performance module 110 (i.e. PTP packet storage queue);If being based on the response message, determining doubly linked list (i.e. PTP packet storage queue) not is sky, then directly It connects and calls MMAP function, the process of access PTP message is allow directly to access the Two-way Chain safeguarded in trawl performance module 110 Table (i.e. PTP packet storage queue).
(3) data information between forwarding logic processing module 100 and application processing module 120:
When interface driver module 130 receives the timestamp acquisition request of the transmission of application processing module 120, by the timestamp Acquisition request is forwarded to logic processing module 100, by logic processing module 100 based on carrying in the timestamp acquisition request VLAN mark, obtains the receiving time stamp and sending time stamp of corresponding PTP message from timestamp storage unit 106, and waits The timestamp acquisition for collecting the receiving time stamp for carrying corresponding PTP message and sending time stamp that processing module 100 returns is rung It answers.
When the timestamp that interface driver module 130 receives the return of logic processing module 100 obtains response, by the timestamp The interface adaptation unit 122 that is forwarded in application processing module 120 of response is obtained, by interface adaptation unit 122 by the timestamp Response output is obtained to processing unit 121.
So far, the primary operational process of layer interface drive module 130 is driven to terminate.
Refering to shown in Fig. 4 D, in the embodiment of the present invention, the specific process flow of application layer applications processing module 120 is as follows:
Step 431: when the determination of processing unit 121 needs to read PTP message, according to one user of maximum message size application Space, and IOCTL function is called using the corresponding user's space address of the user's space as parameter, pass through the IOCTL function control Interface adaptation unit 122 processed initiates PTP message access request to the interface driver module 130 of driving layer.
Step 432: after interface adaptation unit 122 receives the IOCTL function and parses to the IOCTL function, to Interface driver module 130 initiates PTP message access request, and the response message for waiting interface driver module 130 to return.
Step 433: when interface adaptation unit 122 receives the response message of the return of interface driver module 130, being based on the sound Message is answered, when determining that doubly linked list (i.e. PTP packet storage queue) is empty, waits trawl performance module 110 that will access PTP message Process wake up.
Step 434: interface adaptation unit 122 determines the process of access PTP message when being waken up, based on being stored in interface Struct net_device structural body pointer in 130 global variable of drive module, it is corresponding to find trawl performance module 110 Struct net_device structural body.
Step 435: interface adaptation unit 122 is according to the privately owned member of the overall situation of struct net_device structural body Struct net_local finds the linked list head node struct list_head sb_list of doubly linked list, and according to chained list Pointer sb_list- > next of member sb_list, finds in doubly linked list in head node struct list_head sb_list First vlan_list_cache structural body in member list.
Step 436: the storage of storage address of the interface adaptation unit 122 based on member list and struct sk_buff Offset between location finds the pointer * sk in first vlan_list_cache structural body, and is based on vlan_list_ Pointer * sk in cache structural body finds struct sk_buff, and according to the pointer * ptr in sk_buff, finds finger The initial memory address for first PTP message that needle * ptr is directed toward, and first PTP message is copied into processing unit 121 In the user's space of application.
Step 437: processing unit 121 parses the PTP message in user's space, obtains PTP message carrying VLAN mark, and identified based on the VLAN, determine the transmitting terminal of the PTP message.
Step 438: processing unit 121 carries VLAN mark in timestamp acquisition request, is adapted to by interface single Member 122 is sent to interface driver module 130, and the timestamp for waiting interface driver module 130 to return obtains response.
Step 439: 121 receiving interface drive module 130 of processing unit return timestamp obtain response, and be based on this when Between stamp obtain receiving time stamp that response carries and sending time stamp is completed and PTP message using preset clock synchronization algorithm The time synchronization and Frequency Synchronization of transmitting terminal.
So far, the process flow of application layer applications processing module 120 terminates.
In conclusion physical layer is based on current time, is upper in the case where receiving message in the embodiment of the present invention Message addition receiving time stamp is stated, and in the case where determining above-mentioned message is PTP message, obtains what above-mentioned PTP message carried Sending time stabs and above-mentioned PTP message is sent to driving layer;It drives layer after storing above-mentioned PTP message, is reported for above-mentioned PTP Text application storage mark, and above-mentioned storage mark is added to PTP packet storage queue, and meet preset clock in determination In the case where synchronous trigger condition, triggering application layer is identified based on the storage of above-mentioned PTP packet storage queue record, is obtained above-mentioned PTP message;Application layer is after the transmitting terminal for determining above-mentioned PTP message, receiving time stamp and transmission based on above-mentioned PTP message Timestamp is completed synchronous with the clock of above-mentioned transmitting terminal.In this way, by the way that the queue of PTP packet storage is added in PTP message, so that it may To distinguish PTP message and non-PTP message, PTP message is handled without the method for calling processing function, it can be direct Clock synchronization process is carried out for each PTP message in PTP packet storage queue, not only reduces the processing ring of PTP message Section, improves the treatment effeciency of PTP message, moreover, also saving the calling processing occupied memory space of function and processing money Source.In addition to this, receiving time stamp is added to the PTP message received by physical layer, reduces the complexity of software processing, It avoids since software processing PTP message is there are certain delay, causes to be that the receiving time that PTP message adds is stabbed by software There are large errors, and the problem of inaccuracy is synchronized so as to cause clock.
Further, in the embodiment of the present invention, it is only necessary in the privately owned member of the overall situation of struct net_device structural body The linked list head node struct list_head sb_list of doubly linked list is preset in struct net_local, interface drives Dynamic model block can be according to the privately owned member struct net_local of the overall situation of struct net_device structural body, from network interface card In drive module, the linked list head node struct list_head sb_list of doubly linked list is quickly and accurately determined, into And, so that it may the initial memory address for the PTP message that each chained list node is respectively directed toward in the doubly linked list is determined, so that net Information transmitting between card drive module and interface driver module is succinct efficient, further accelerates the processing effect of PTP message Rate.
It should be understood by those skilled in the art that, the embodiment of the present invention can provide as method, system or computer program Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the present invention Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the present invention, which can be used in one or more, The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces The form of product.
The present invention be referring to according to the method for the embodiment of the present invention, the process of equipment (system) and computer program product Figure and/or block diagram describe.It should be understood that can be realized by computer program instructions each in flowchart and/or the block diagram The combination of process and/or box in process and/or box and flowchart and/or the block diagram.It can provide these computers Processor of the program instruction to general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices To generate a machine, so that generating use by the instruction that computer or the processor of other programmable data processing devices execute In the dress for realizing the function of specifying in one or more flows of the flowchart and/or one or more blocks of the block diagram It sets.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates, Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one The step of function of being specified in a box or multiple boxes.
Although preferred embodiments of the present invention have been described, it is created once a person skilled in the art knows basic Property concept, then additional changes and modifications may be made to these embodiments.So it includes excellent that the following claims are intended to be interpreted as It selects embodiment and falls into all change and modification of the scope of the invention.
Obviously, those skilled in the art can carry out various modification and variations without departing from this hair to the embodiment of the present invention The spirit and scope of bright embodiment.In this way, if these modifications and variations of the embodiment of the present invention belong to the claims in the present invention And its within the scope of equivalent technologies, then the present invention is also intended to include these modifications and variations.

Claims (12)

1. a kind of processing method of accurate clock synchronization protocol PTP message, which is characterized in that be applied to system on chip SOC, be used for PTP message is handled, and the clock completed between the transmitting terminal and receiving end of the PTP message is synchronous, the processing side Method includes:
Physical layer is based on current time in the case where receiving message, adds receiving time stamp for the message, and, In the case where determining that the message is non-PTP message, the non-PTP message is sent to driving layer;Determining that the message is In the case where PTP message, the sending time stamp and the PTP message is sent to driving layer that the PTP message carries are obtained;
Driving layer determine receive be non-PTP message in the case where, the non-PTP message is sent to protocol layer, trigger The protocol layer is by calling processing function to handle the non-PTP message;Determine receive be PTP message feelings Under condition, after storing the PTP message, identified for PTP message application storage, and storage mark is added to PTP Packet storage queue, and in the case where determining that meeting preset clock synchronizes trigger condition, triggering application layer is based on described The storage of PTP packet storage queue record identifies, and obtains the PTP message;
Application layer is after the transmitting terminal for determining the PTP message, receiving time stamp and sending time based on the PTP message Stamp is completed synchronous with the clock of the transmitting terminal.
2. processing method as described in claim 1, which is characterized in that obtain the sending time of the PTP message in physical layer After stabbing and the PTP message being sent to driving layer, before driving layer stores the PTP message, further comprise:
Physical layer stores the receiving time stamp of the PTP message and sending time stamp to the first specified region.
3. processing method as described in claim 1, which is characterized in that be the PTP after driving layer stores the PTP message Message application storage mark, and storage mark is added to PTP packet storage queue, comprising:
It drives layer by after the PTP packet storage to the second specified region, characterizes the PTP for described the application of PTP message one The storage of start of message (SOM) storage address identifies;
Driving layer judges whether the PTP message is the first PTP message received;
If so, driving layer identifies below on the head of the preset PTP packet storage queue, it is inserted into the PTP message Storage mark;Otherwise, driving layer is behind the last one storage mark of the PTP packet storage queue current record, insertion The storage of the PTP message identifies.
4. processing method as described in any one of claims 1-3, which is characterized in that if driving layer receives application layer initiation PTP message access request adds the process for accessing PTP message then in the case where it is empty for determining the PTP packet storage queue Enter process waiting list.
5. processing method as claimed in claim 4, which is characterized in that driving layer is determining that meeting preset clock synchronizes triggering In the case where condition, triggering application layer is identified based on the storage of the PTP packet storage queue record, obtains the PTP message, Include:
Layer is driven to there is the process for accessing PTP message and the PTP packet storage queue in determining the process waiting list In the case where non-empty, identification meets the synchronous trigger condition of the clock, and wakes up the process, triggers the process and is based on institute The storage mark for stating PTP packet storage queue record obtains the PTP message.
6. processing method as claimed in claim 2, which is characterized in that application layer after the transmitting terminal for determining the PTP message, Receiving time stamp and sending time stamp based on the PTP message, are completed synchronous with the clock of the transmitting terminal, comprising:
The virtual LAN VLAN mark that application layer is carried based on the PTP message, determines the transmitting terminal of the PTP message, and From the described first specified region, the receiving time stamp and sending time stamp of the PTP message are obtained, and based on getting The receiving time stamp and sending time stamp of the PTP message are completed and the transmitting terminal using preset clock synchronization algorithm Time synchronization and Frequency Synchronization.
7. a kind of system on chip SOC, which is characterized in that for handling accurate clock synchronization protocol PTP message, and described in completion Clock between the transmitting terminal of PTP message and receiving end is synchronous, the SOC include: logic processing module, trawl performance module, Application processing module and non-PTP message processing module (MPM), wherein
The logic processing module is received for being based on current time in the case where receiving message for message addition Timestamp, and, in the case where determining the message is non-PTP message, the non-PTP message is sent to the network interface card and is driven Dynamic model block;In the case where determining the message is PTP message, the sending time for obtaining the PTP message carrying stabs and will The PTP message is sent to the trawl performance module;
The trawl performance module, for determine receive be non-PTP message in the case where, will the non-PTP message hair It send to the non-PTP message processing module (MPM), triggers the non-PTP message processing module (MPM) by calling processing function to described non- PTP message is handled;Determine receive be PTP message in the case where, be the PTP after storing the PTP message Message application storage mark, and storage mark is added to PTP packet storage queue, and it is determining meet preset when In the case where the synchronous trigger condition of clock, storage of the application processing module based on the PTP packet storage queue record is triggered Mark, obtains the PTP message;
The application processing module, for after the transmitting terminal for determining the PTP message, when reception based on the PTP message Between stamp and sending time stamp, complete it is synchronous with the clock of the transmitting terminal.
8. SOC as claimed in claim 7, which is characterized in that obtain the transmission of the PTP message in the logic processing module Timestamp and after the PTP message is sent to the trawl performance module, described in trawl performance module storage Before PTP message, the logic processing module is also used to: by the receiving time stamp of the PTP message and sending time stamp storage To the first specified region.
9. SOC as claimed in claim 7, which is characterized in that after storing the PTP message, deposited for the PTP message application Storage mark, and storage mark is added to when PTP packet storage queue, the trawl performance module is specifically used for:
After the PTP packet storage to the second specified region, risen for described the application of the PTP message one characterization PTP message The storage of beginning storage address identifies;
Judge whether the PTP message is the first PTP message received;
If so, identifying below on the head of the preset PTP packet storage queue, it is inserted into the storage mark of the PTP message Know;Otherwise, behind the last one storage mark of the PTP packet storage queue current record, it is inserted into the PTP message Storage mark.
10. SOC as claimed in claim 7, which is characterized in that further include: interface driver module, wherein
The interface driver module, if the PTP message access request initiated for receiving the application processing module, true In the case that the fixed PTP packet storage queue is empty, process waiting list is added in the process for accessing PTP message.
11. SOC as claimed in claim 10, which is characterized in that determining the feelings for meeting the synchronous trigger condition of preset clock Under condition, the application processing module is triggered based on the storage mark of the PTP packet storage queue record and obtains the PTP message When, the trawl performance module is specifically used for:
Determine there is the process of access PTP message and the PTP packet storage queue in the process waiting list for non-empty In the case of, identification meets the synchronous trigger condition of the clock, and wakes up the process, triggers the process and is reported based on the PTP The storage mark of literary storage queue record obtains the PTP message.
12. SOC as claimed in claim 8, which is characterized in that after the transmitting terminal for determining the PTP message, based on described The receiving time stamp and sending time stamp of PTP message, when completing synchronous with the clock of the transmitting terminal, the application processing module It is specifically used for:
Based on the virtual LAN VLAN mark that the PTP message carries, the transmitting terminal of the PTP message is determined, and from described In first specified region, the receiving time stamp and sending time stamp of the PTP message are obtained, and based on described in getting The receiving time stamp and sending time stamp of PTP message complete the time with the transmitting terminal using preset clock synchronization algorithm Synchronous and Frequency Synchronization.
CN201611089878.2A 2016-11-30 2016-11-30 A kind of processing method and SOC of PTP message Active CN106788842B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611089878.2A CN106788842B (en) 2016-11-30 2016-11-30 A kind of processing method and SOC of PTP message

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611089878.2A CN106788842B (en) 2016-11-30 2016-11-30 A kind of processing method and SOC of PTP message

Publications (2)

Publication Number Publication Date
CN106788842A CN106788842A (en) 2017-05-31
CN106788842B true CN106788842B (en) 2019-03-26

Family

ID=58915487

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611089878.2A Active CN106788842B (en) 2016-11-30 2016-11-30 A kind of processing method and SOC of PTP message

Country Status (1)

Country Link
CN (1) CN106788842B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113228564B (en) * 2018-12-24 2022-12-30 华为技术有限公司 Stamping processing method and device
CN110232139B (en) * 2019-06-13 2021-07-27 山东华翼微电子技术股份有限公司 SOC data management method suitable for embedded software
CN112436948B (en) * 2020-11-12 2023-04-18 中国铁道科学研究院集团有限公司 Train Ethernet card based on TSN and data receiving and transmitting method

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101729180A (en) * 2008-10-21 2010-06-09 华为技术有限公司 Method and system for synchronizing precision clocks, and precision clock frequency/time synchronizing device
CN103138887B (en) * 2011-12-05 2018-01-30 中兴通讯股份有限公司 A kind of processing method and system of 1588 event message
CN105703892A (en) * 2014-11-24 2016-06-22 管晓权 Method of realizing PTP nanosecond precision based on hardware time stamp
CN104660360B (en) * 2015-02-03 2017-05-03 电信科学技术第五研究所 Ethernet data and multi-channel E1 data processing method and system

Also Published As

Publication number Publication date
CN106788842A (en) 2017-05-31

Similar Documents

Publication Publication Date Title
WO2017067391A1 (en) Data sharing method and device for virtual machines
CN106330769A (en) Business processing method and server
CN105024942B (en) A kind of dynamic flow monitoring method
CN107276711B (en) EtherCAT master station device
CN106788842B (en) A kind of processing method and SOC of PTP message
US20110205904A1 (en) Relay apparatus, virtual machine system, and relay method
JP5793690B2 (en) Interface device and memory bus system
CN105511954A (en) Method and device for message processing
US20170329632A1 (en) Device scheduling method, task manager and storage medium
WO2007115477A1 (en) Data synchronization method und system
JP2008507201A5 (en)
WO2015196685A1 (en) Clock synchronization method and apparatus
CN104639385B (en) Detect the method and apparatus of L2VPN network user's side interface connectivity
CN106462474A (en) Network timeouts using intentionally delayed transmissions
WO2022040847A1 (en) Communication data processing method and apparatus
CN103885840A (en) FCoE protocol acceleration engine IP core based on AXI4 bus
US10142228B2 (en) Device and method for retransmitting data in a network switch
WO2016202158A1 (en) Message transmission method and device, and computer-readable storage medium
CN114285695B (en) Communication method, device, apparatus, system and storage medium
CN110351208A (en) A kind of message forwarding method, device, equipment and computer readable storage medium
CN107135189A (en) A kind of file transmitting method and physical machine
CN109417507A (en) The message of section retards accesses
CN108462653B (en) TTE-based rapid protocol control frame sending method
WO2013078873A1 (en) Method and device for identifying response message
CN114095901A (en) Communication data processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant