CN100589449C - Method for implementing timing device of network processor - Google Patents

Method for implementing timing device of network processor Download PDF

Info

Publication number
CN100589449C
CN100589449C CN200710142529A CN200710142529A CN100589449C CN 100589449 C CN100589449 C CN 100589449C CN 200710142529 A CN200710142529 A CN 200710142529A CN 200710142529 A CN200710142529 A CN 200710142529A CN 100589449 C CN100589449 C CN 100589449C
Authority
CN
China
Prior art keywords
timer
processing unit
network processing
list item
thread
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.)
Expired - Fee Related
Application number
CN200710142529A
Other languages
Chinese (zh)
Other versions
CN101132369A (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.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Priority to CN200710142529A priority Critical patent/CN100589449C/en
Publication of CN101132369A publication Critical patent/CN101132369A/en
Application granted granted Critical
Publication of CN100589449C publication Critical patent/CN100589449C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

This invention discloses a method for realizing timer in a network processor including: utilizing a storage region carried by a network processor to set up a timer queue including at least one timer list for storing counter value read from a counter when setting a timer, timed time length and thread ID of a module used in the timer, intializing said timer queue and setting the timer list as unusedin the queue, when the thread of a micro-engine needs said timer, the thread is used to poll said timer queue, reading the counter value of the current counter and writing the timed time length, thethread ID of the module used in the timer and the counter value into said list and feeding back the successful set of the timer.

Description

The implementation method of timer in the network processing unit
Technical field
The present invention relates to the processor technology in a kind of moving communicating field, specifically, relate to the implementation method of timer in a kind of network processing unit.
Background technology
Fast development along with mobile communication technology, need the data traffic handled increasing in the mobile communication system, require the speed of processing more and more higher, the equipment that adopts general processor to realize, can't finish the quick forwarding of mass data message, selecting special-purpose network processing unit to substitute general processor has been industry way commonly used.
Network processing unit is a kind of programmable processor that is exclusively used in communication network field, it is to be used in the quick routing forwarding of finishing message on switch or the router that manufacturer locatees its purposes at first, therefore there is not the hardware timer resource in the majority of network processor, in mobile communication system, network processing unit is that the message that inserts is resolved, filtered to the handling process of most of messages, exception message abandons, and need search corresponding table for normal message and transmit or finalization process.Do not need to use timer when therefore network processing unit is handled most of message.But handling for some messages needs the timer resource, as for the IP fragmentation message, loses and causes recombine resource not to be released and needs are set the overtime timer of recombinating for fear of indivedual IP fragmentations when doing the IP reorganization.Also have, also need to use timer when realizing among the CDMA2000 in the Abis interface protocol stack PPPmux agreement, MultilinkPPP agreement with network processing unit.
If there is not timer, need to use some application of timer will be put into the processing of getting on of an other veneer so, message processing links complexity so not only, and increase the time delay that communication between plates amount and message are handled, the most important thing is to have increased greatly the cost of equipment.
Summary of the invention
Technical problem solved by the invention provides the implementation method of timer in a kind of processor, has expanded the range of application of processor, has improved the mobile device capacity.
Technical scheme is as follows:
The implementation method of timer in a kind of network processing unit, step comprises:
(1) according to the timer number, the memory block that utilizes network processing unit to carry makes up timer queue, and described timer queue comprises at least one timer list item; Described timer list item is used for depositing the Thread Id that the Counter Value, timing length and the timer that read from counter when timer is set use module;
(2) the described timer queue of initialization is changed to timer list item in the described timer queue and is not used;
(3) when the timer thread of micro engine in the described network processing unit need use described timer, call timer interface is set, use the described timer queue of described timer thread poll; Read the timer list item,, read the Counter Value of current counter, use Thread Id, the Counter Value of module to write described timer list item described timing length, timer, and return timer success is set if this timer list item is not used; The Counter Value that current described timer thread is read deducts the Counter Value that described timer uses module to read; If difference, illustrates then that timing does not also arrive for negative; If difference, represents then that described timer is overtime more than or equal to described timing length, notify described timer to use the next timer list item of module poll.
Further, in the step (1), described timer list item is further used for storing the parameter that described timer expiry returns.
Further, in the step (1), described timer queue is the belt formation that utilizes sheet stored district that described network processing unit carries or sheet external memory district to realize.
Further, in the step (1), described network processing unit is the network processing unit that does not have the hardware timer resource.
Further, in the step (2), during initialization, the timer queue side-play amount of described timer queue is 0.
Further, in the step (3),, then continue the next timer list item of poll if described timer list item is used.
Further, in the step (3), described timer thread is responsible for scanning timer queue, judges whether described timer is overtime; If described timer expiry then uses the Thread Id of module to send signal according to timer in the described timer list item, notify described timer to use module, and the parameter that described timer expiry is returned send in the lump.
Further, in the step (3), described Counter Value, timing length, timer use the Thread Id of module to use module to write described timer list item by timer.
Further, in the step (3), it is any thread in the network processing unit that described timer uses module; Use the timer resource if desired, then described timer uses module by timer interface to be set, and the parameter that described timing length, Thread Id and timer expiry returned is put in the described timer list item.
The inventive method not only is applicable to any network processing unit that does not have the hardware timer resource, also is applicable to any processor that does not have the hardware timer resource.
Network processing unit self the invention solves owing to can't not realized the application that some need the timer resource with timer.The present invention utilizes micro engine and hardware counter in the network processing unit to realize the function of timer, so that network processing unit can be realized common protocol processes in the mobile communication system, expand the network processing unit range of application, improved the mobile device capacity, reduced its equipment cost.
Description of drawings
Fig. 1 is the use schematic diagram of timer among the present invention;
Fig. 2 is the visioning procedure figure of bright timer queue in this;
Fig. 3 is the setting up procedure flow chart of timer among the present invention;
Fig. 4 is a timer thread process flow chart among the present invention.
Embodiment
The present invention realizes timer by means of counter that carries in the processor and micro engine thread, and technical solution of the present invention not only is applicable to any network processing unit that does not have the hardware timer resource, also is applicable to any processor that does not have the hardware timer resource.
Select network processing unit below for use, an embodiment of the implementation method of timer in the network processing unit is done further specific descriptions.
1, the memory block that utilizes network processing unit to carry makes up a belt timer queue 101 (Fig. 1), and this memory block can be sheet stored district, also can be sheet external memory district.
2, timer is used Counter Value, timing length, timer that module 104 (Fig. 1) reads use the Thread Id of module 104 self and parameter value that timer expiry returns to put into timer queue 101 (Fig. 1) as timer list item 102 (Fig. 1).The parameter value that timer expiry returns uses the value of module 104 inputs to determine according to timer.
Need use timer if 3 certain micro engine are handled when certain is used, then call timer interface is set, timer is set.
4, use a timer thread 103 (Fig. 1) the poll timer queue 101 of micro engine, the Counter Value that timer uses Counter Value that module 104 reads and current timer thread 103 to read is compared.If difference illustrates then that for negative this timer is not overtime; If difference, represents then that timing arrives more than or equal to timing length, the notice timer uses module 104, continues the next timer list item 102 of poll then.
With reference to shown in Figure 1, making of timer is used as detailed description.
Timer queue 101 is the belt formations that utilize sheet stored district that network processing unit carries or sheet external memory district to realize, timer queue 101 is made of a plurality of timer list items 102, timer uses 104 pairs of timer queues of module 101 to carry out write operation, and 103 pairs of timer queues of timer thread 101 carry out read operation.
Timer list item 102 is to be used for depositing the parameter of returning when the Counter Value that reads from hardware counter when timer is set, timing length, timer use the Thread Id of module 104 and timer expiry.
Timer thread 103 is used for being responsible for scanning timer queue 101, judges whether timer is overtime; If timer expiry then is responsible for the notice timer and is used module 104 and return parameters.
It is any threads in the network processing unit that timer uses module 104, use the timer resource if desired, then interface is set and uses the Thread Id of module 104 and the parameter that needs timer expiry to return to be put in the timer list item 102 timing length, timer by timer.
With reference to shown in Figure 2, the constructive process of timer queue 101 is done detailed description.
System start-up, network processing unit is started working.
Step S201 according to the timer number of pre-defined support, marks an internal memory in sheet stored district or the sheet external memory district in network processing unit, be used for making up belt timer queue 101.
Step S202, initialization timing device formation 101 is not changed to use with the timer list item 102 in the timer queue 101.
Like this, when the timer thread 103 of a certain micro engine in the network processing unit needs to use timer, then call timer interface is set, use the Thread Id of module 104 and parameter that timer expiry returns to import timer into timing length, timer interface is set.
With reference to shown in Figure 3, the setting up procedure of timer is done detailed description.
Step S301, timer are provided with the head that interface macro reads timer queue 101, begin to read timer list item 102 from the head of timer queue 101.
Step S302 judges whether timer list item 102 is used.
If timer list item 102 is used, execution in step S303; Otherwise, execution in step S304.
Step S303, if this timer list item 102 is not used, then read the Counter Value of current hardware counter, use the Thread Id and the parameter of module 104 to write timer list item 102 Counter Value, timing length, timer, return timer success is set, EO.
Step S304 if this timer list item is used, then continues the next timer list item 102 of poll.
Whether step S305, judging has timer list item 102 to use in the timer queue 101.
If there is timer list item 102 to use, then carry out step S303; Otherwise, carry out step S306.
Step S306 returns timer failed message is set, EO.
With reference to shown in Figure 4, timer thread 103 is checked whether overtime detailed process is done detailed description to timer.
Step S401, timer thread 103 is started working, and initialization timing device formation side-play amount is 0.
Step S402 adds side-play amount according to the base address of the timer queue 101 of annular and reads timer queue 101, takes out the content of timer list item 102 in the timer queue 101.
Step S403 reads the hardware counter value V1 that timer uses module 104 to be provided with from timer list item 102, read current Counter Value V2 from the hardware counter that chip carries, and deducts V1 with V2.
Among the step S404, judge whether the difference that V2 deducts V1 is negative.
If for negative, illustrate that timing does not also arrive, then return step S402, continue to read timer list item 102.
Step S405 if V2 deducts the difference of V1 not for negative, judges further that then whether difference is more than or equal to timing length.
Equal timing length if be not more than, then return step 402 and continue to read the timer list item; Otherwise, execution in step S406.
Step S406, if V2 deducts the V1 difference more than or equal to timing length, illustrate that then timer is overtime, then use the Thread Id of module 104 to send signal according to timer in the timer list item 102, the notice timer uses module 104, and the parameter that timer expiry returns is returned in the lump.
Simultaneously, the timer queue side-play amount is increased, return step S402 then, continue to read next timer list item 102.

Claims (9)

1, the implementation method of timer in a kind of network processing unit, step comprises:
(1) according to the timer number, the memory block that utilizes network processing unit to carry makes up timer queue, and described timer queue comprises at least one timer list item; Described timer list item is used for depositing the Thread Id that the Counter Value, timing length and the timer that read from counter when timer is set use module;
(2) the described timer queue of initialization is changed to timer list item in the described timer queue and is not used;
(3) when the timer thread of micro engine in the described network processing unit need use described timer, call timer interface is set, use the described timer queue of described timer thread poll; Read the timer list item,, read the Counter Value of current counter, use Thread Id, the Counter Value of module to write described timer list item described timing length, timer, and return timer success is set if this timer list item is not used; The Counter Value that current described timer thread is read deducts the Counter Value that described timer uses module to read; If difference, illustrates then that timing does not also arrive for negative; If difference, represents then that described timer is overtime more than or equal to described timing length, notify described timer to use the next timer list item of module poll.
2, the implementation method of timer in the network processing unit according to claim 1 is characterized in that, in the step (1), described timer list item is further used for storing the parameter that described timer expiry returns.
3, the implementation method of timer in the network processing unit according to claim 1 is characterized in that, in the step (1), described timer queue is the belt formation that utilizes sheet stored district that described network processing unit carries or sheet external memory district to realize.
4, the implementation method of timer in the network processing unit according to claim 1 is characterized in that, in the step (1), described network processing unit is the network processing unit that does not have the hardware timer resource.
5, the implementation method of timer in the network processing unit according to claim 1 is characterized in that, in the step (2), during initialization, the timer queue side-play amount of described timer queue is 0.
6, the implementation method of timer in the network processing unit according to claim 1 is characterized in that, in the step (3), if described timer list item is used, then continues the next timer list item of poll.
7, the implementation method of timer in the network processing unit according to claim 1 is characterized in that, in the step (3), described timer thread is responsible for scanning timer queue, judges whether described timer is overtime; If described timer expiry then uses the Thread Id of module to send signal according to timer in the described timer list item, notify described timer to use module, and the parameter that described timer expiry is returned send in the lump.
8, the implementation method of timer in the network processing unit according to claim 1 is characterized in that, in the step (3), described Counter Value, timing length, timer use the Thread Id of module to use module to write described timer list item by timer.
9, the implementation method of timer in the network processing unit according to claim 8 is characterized in that, in the step (3), it is any thread in the network processing unit that described timer uses module; Use the timer resource if desired, then described timer uses module by timer interface to be set, and the parameter that described timing length, Thread Id and timer expiry returned is put in the described timer list item.
CN200710142529A 2007-08-15 2007-08-15 Method for implementing timing device of network processor Expired - Fee Related CN100589449C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN200710142529A CN100589449C (en) 2007-08-15 2007-08-15 Method for implementing timing device of network processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN200710142529A CN100589449C (en) 2007-08-15 2007-08-15 Method for implementing timing device of network processor

Publications (2)

Publication Number Publication Date
CN101132369A CN101132369A (en) 2008-02-27
CN100589449C true CN100589449C (en) 2010-02-10

Family

ID=39129498

Family Applications (1)

Application Number Title Priority Date Filing Date
CN200710142529A Expired - Fee Related CN100589449C (en) 2007-08-15 2007-08-15 Method for implementing timing device of network processor

Country Status (1)

Country Link
CN (1) CN100589449C (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101833450A (en) * 2010-04-21 2010-09-15 中兴通讯股份有限公司 Timing method and device

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102546404A (en) * 2011-12-27 2012-07-04 盛科网络(苏州)有限公司 Method and system for optimizing MEP (message exchange pattern) packet sending time in OAM (operation administration and maintenance) chip
CN103064669B (en) * 2012-12-18 2017-03-08 希姆通信息技术(上海)有限公司 The timing wake-up method and system of smart machine
CN109587264A (en) * 2018-12-20 2019-04-05 新华三技术有限公司 Data monitoring method, device and cloud platform server
CN115525402A (en) * 2021-06-25 2022-12-27 中兴通讯股份有限公司 Timer task processing method, software timer and storage medium
CN117171102B (en) * 2023-09-07 2024-01-26 山东九州信泰信息科技股份有限公司 Method for writing files at high speed in multithreading and lock-free mode

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101833450A (en) * 2010-04-21 2010-09-15 中兴通讯股份有限公司 Timing method and device
CN101833450B (en) * 2010-04-21 2015-01-28 中兴通讯股份有限公司 Timing method and device

Also Published As

Publication number Publication date
CN101132369A (en) 2008-02-27

Similar Documents

Publication Publication Date Title
CN100589449C (en) Method for implementing timing device of network processor
CN105306681A (en) Management method and device supporting multiple SIM cards to share RF processor
CN101800699A (en) Method and device for dropping packets
CN108124284B (en) Bluetooth data transmission method and device
CN101883184A (en) Method for controlling application program display on mobile terminal and mobile terminal
EP1895743A1 (en) A method for implementing a wireless personal communication protocol for an IC Card
US11050661B2 (en) Creating an aggregation group
CN109587829B (en) Method and device for simultaneously working as site and hotspot by terminal and terminal
JP2013078065A (en) Radio communication terminal and radio communication method
CN103002489A (en) Neighbor node discovery table item updating method and node device
EP2870745A1 (en) Handling incoming video calls to a hunt list
CN100359891C (en) Method for improving multimedia message central service processing property by buffer storage
CN102006314B (en) Multiserver self-adapting task scheduling method and device
CN101217487A (en) A method to realize link occupying and link port
EP2464062B1 (en) Method for switch device establishing topology structure and switch device
CN104618335A (en) Message exchange method and interface processing platform
CN102368708A (en) Control method and system of data transmission of network conference
CN111064622B (en) Network device, synchronization apparatus, and information transmission method
CN114756229A (en) Development page generation method based on micro front end and related device thereof
CN112383471A (en) Method, device and equipment for managing knife box link and machine readable storage medium
CN113794631B (en) Port redundancy processing method, device, equipment and machine-readable storage medium
CN117278345B (en) Energy saving method and device applied to network equipment
CN110198312B (en) Message processing method and device
CN109862044A (en) A kind of conversion equipment, the network equipment and data transmission method
CN102769538A (en) Port changing method, related device and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20100210

Termination date: 20170815

CF01 Termination of patent right due to non-payment of annual fee