CN1509011A - Method for controlling network port flow - Google Patents

Method for controlling network port flow Download PDF

Info

Publication number
CN1509011A
CN1509011A CNA021580154A CN02158015A CN1509011A CN 1509011 A CN1509011 A CN 1509011A CN A021580154 A CNA021580154 A CN A021580154A CN 02158015 A CN02158015 A CN 02158015A CN 1509011 A CN1509011 A CN 1509011A
Authority
CN
China
Prior art keywords
network interface
interruption
interruption times
interrupt process
packet
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.)
Granted
Application number
CNA021580154A
Other languages
Chinese (zh)
Other versions
CN1266883C (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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN 02158015 priority Critical patent/CN1266883C/en
Publication of CN1509011A publication Critical patent/CN1509011A/en
Application granted granted Critical
Publication of CN1266883C publication Critical patent/CN1266883C/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Small-Scale Networks (AREA)

Abstract

The invention includes following steps. (a) In overall interruption handling for network port, comparison between number of interruption and preestablished threshold of number of interruption is carried out. If number of interruption is larger than or equal to the said threshold, then interruption of network port is shut down, and receiving packet or sending packet is stopped till step (b) is executed; otherwise step(c) is carried out. (b) In timing interruption handling, closed interruption of network port is turned to open, receiving packet or sending packet is continuous. (c) Overall interruption handling for network port is exited. The invention controls flux in network port by controlling number of interruption generated. Further, based on actual need, adjusting flow-controlled granularity is smartly realized. Moreover, process for clearing watchdog is added to interruption handling for network port in order to guarantee that under abnormal condition, the system can work safely.

Description

A kind of method of network interface flow control
Technical field
The present invention relates to the flow control field in the transfer of data, be meant a kind of method of network interface flow control especially.
Background technology
The IEEE802.3x agreement has been stipulated the common architecture framework of control Ethernet medium access controls (MAC), this agreement has autgmentability flexibly, according to its definition, MAC control sublayer receives after the order that sends the Flow Control frame, just constructs the Flow Control frame of standard.
Figure 1 shows that the form of standard Flow Control frame.Purpose hardware address (Mac address), Mac address, source, type codes, control operation sign indicating number, time out and reserve part have been comprised in the Flow Control frame.The byte number in left side is meant above-mentioned each part shared byte number in the Flow Control frame among the figure.Type codes in the Flow Control frame is represented the type of this Frame, and the type of standard ethernet protocol definition Flow Control frame is 0x8808; The control operation sign indicating number is generally 0x0001; Time out in the Flow Control frame is meant the recipient from receiving the Flow Control frame, and transmit leg just suspends the time parameter of sending out Frame, and this parameter is the unsigned int value of 2 bytes, and promptly the recipient asks transmit leg to stop to send the time span of Frame; 46 remaining bytes keep to be used, and the user can freely define use, is generally 00.
In above-mentioned Flow Control scheme, the most important thing is time out, this time measure be with 512 bit times be increment, under normal conditions, the span relative fixed of the bandwidth of network interface and time out, its corresponding relation is as shown in table 1:
The network interface bandwidth The time out span
??10Mb/s 0~3.36s (is increment with 51.2us)
??100Mb/s 0~336ms (is increment with 5.12us)
??1000Mb/s 0~33.6ms (is increment with 512ns)
Table 1
In actual applications, because the restriction of multiple factors such as transmit leg the time from recipient's Flow Control frame of receiving is subjected between the reception buffer empty of transmission rate, MAC chip, transmission medium length, the other side's response time, therefore, the different needed times of device processes Flow Control frame are different.Find that through experiment even when same equipment docks with distinct device, the time that the time out response comes into force also might differ 5-10 doubly.This is because transmit leg is slow more to the message decoding that is received, the message that transmitting terminal sends before the Flow Control frame works is just many more, so for different equipment, the time out that uses should be different, even identical equipment is under different environments for use, the concrete numerical value of this time out also may be different, should determine according to concrete operating position.
Therefore, there is following shortcoming in the flow control technique of prior art:
1) existing fluidics mainly is that dependence is hard-wired, and is very inconvenient in the use.When hardware designs, need open relevant several signals such as Flow Control enable signal, in order to using.If in the Installation and Debugging work in early stage, hardware is not set in advance, and to the later stage demand of using this Flow Control function is arranged, then need to revise single plate hardware.And this Flow Control function also needs the support of opposite equip., if opposite equip. is not supported the Flow Control function of local terminal equipment on hardware designs, promptly opposite equip. can't realize sending or resolving the Flow Control frame at all, then network interface realized just unusual difficulty of Flow Control.
2) accuracy of Flow Control is the bad control of granularity of Flow Control.Because the fluidics of network interface mainly is to rely on hardware to realize in the prior art, if want flow control in a desirable scope, just must select suitable time out for use, and time out and opposite equip., transmission speed, size and the other side's response time etc. are all closely related between the reception buffer empty of MAC chip, therefore with different equipment interconnection the time, need the veteran to debug at the scene this time out is set, and the setting of this time out also do not have rule to follow, and can only debugging repeatedly be set with artificial experience.
Summary of the invention
In view of this, the invention provides a kind of method of network interface flow control, breaking away from dependence, and can control the granularity of Flow Control easily and flexibly opposite equip..
For achieving the above object, technical scheme of the present invention is achieved in that
A kind of method of network interface flow control, this method may further comprise the steps:
A, in the total Interrupt Process of network interface, with interruption times and predefined interruption times threshold, if interruption times is more than or equal to the interruption times threshold value, then closing network interface interrupts, stop to receive packet or send out packet, up to execution in step b, otherwise execution in step c;
B, in the timing Interrupt Process, open buttoned-up network interface and interrupt, continue to receive packet or send out packet;
C, withdraw from the total Interrupt Process of network interface.
Preferably, the described network interface interruption of step a is interrupted for reception, or the transmission interruption, or receives interruption and send interruption.
Preferably, the total Interrupt Process of the described network interface of step a further may further comprise the steps:
A1, read current interrupt status register;
A2, judge and to interrupt the network interface interrupt type if receive, then receive Interrupt Process after, directly execution in step a3 interrupts if send, then send Interrupt Process after, execution in step a3;
A3, whether judge interruption times more than or equal to predefined interruption times threshold value, if execution in step a4, otherwise finish the total Interrupt Process of network interface;
A4, the control register that corresponding network interface chip is set are closed corresponding network interface and are interrupted, and the network interface interrupt flag bit is set is closed condition.
Preferably, the described Interrupt Process that receives further may further comprise the steps:
1), from receive buffering area, takes out the packet that sends;
2), encapsulate this packet after, give link layer process;
3), the reception interruption times that adds up;
4), revise statistical counting.
Preferably, the described Interrupt Process that sends further may further comprise the steps:
1 '), packet to be sent is deposited in the transmission buffering area;
2 '), the transmission control bit of network interface chip is set, packet is sent to physical link layer;
3 '), the transmission interruption times that adds up;
4 '), revise statistical counting.
Preferably, further comprise before the described modification statistical counting: whether judge interruption times more than or equal to clear dog threshold value, if carry out dog processing clearly, otherwise directly revise statistical counting.
Preferably, described clear dog is handled and further comprises: judge whether house dog opens, if carry out once clear dog operation, otherwise directly withdraw from dog treatment step clearly.
Preferably, the described timing of step b interrupts being meant the unit metering time interruption in the system.
Preferably, described step b further comprises: judge network interface interrupt flag bit state, if it is closed condition that network interface interrupts, the control register that corresponding network interface chip then is set interrupts to open buttoned-up network interface, the network interface interrupt flag bit is set to open mode, and add up interruption times again, if the network interface interruption is an open mode, then directly add up interruption times again.
Preferably, this method further comprises: control desk is revised the interruption times threshold values by the control command of revising the interruption times threshold value.
Preferably, this method further comprises: according to the occupancy of CPU, revise the interruption times threshold values.
Use the present invention, control the flow of network interface with the generation number of times that interrupts, the opening and closing that network interface interrupts are controlled in the interruption (TICK interruption) that makes full use of the unit metering time of system simultaneously, make that the modification and the design of software are very simple, by increasing order to change the interruption times threshold value, the Flow Control accuracy can be adjusted flexibly in addition at control desk.Meanwhile, increase clear dog and handle in the Interrupt Process of network interface, the system that guaranteed fully can trouble free service under abnormal conditions, and increases Rule of judgment when carrying out clear dog operation, has fully guaranteed the stability and the robustness of system.Owing to broken away from dependence to opposite equip., the present invention can independent operating, also can cooperate operation with the opposite end.
Description of drawings
Fig. 1 is the form of standard Flow Control frame in the prior art;
Fig. 2 is the flow chart of the total Interrupt Process step of network interface;
Fig. 3 is for receiving the flow chart of Interrupt Process step;
Fig. 4 is the flow chart that clear dog is handled the concrete operations step;
Fig. 5 is the flow chart of the flow control step that increased in the TICK Interrupt Process.
Embodiment
For making purpose of the present invention, technical scheme and advantage clearer, below with reference to the accompanying drawing embodiment that develops simultaneously, the present invention is described in further details.
Usually the transceive data of Ethernet interface all realizes by interrupting, hardware receives a packet and just produces once reception interruption, in the process that receives Interrupt Process, the data that send the opposite end are taken out from receive buffering area, and be recorded in the software interrupting statistical counting; Similarly, when sending data, in case successfully be provided with relevant transmitter register, data just are sent on the physical link, also can produce when sending data once to send to interrupt at every turn, interrupt the statistical counting record simultaneously also in software.It all is characteristics by interrupting realizing that the present invention utilizes the transceive data of Ethernet interface, by the number of times that the control transmitting-receiving is interrupted, controls the switching that transmitting-receiving is interrupted, thus the transmitting-receiving of control data bag, and then realize control to the flow of network interface.Each unit metering time (TICK) in system interrupts, and judges whether that the network interface of closing interrupts, if having, then opens corresponding buttoned-up interruption, continues the transceive data bag, and restarts counting.For example, system is provided with 100 TICK each second, and promptly each TICK is exactly 10 milliseconds; The TICK Interrupt Process is just called once every 10 milliseconds by this expression system, opens buttoned-up network interface and interrupts.
System only restriction receives interruption, realization is to the flow control of local terminal network interface, or only restriction sends interruption, realization is to the flow control of opposite end network interface, the reception that also can limit the local terminal network interface is simultaneously interrupted and sends interrupting, both the local terminal network interface is realized flow control, again the opposite end network interface was realized flow control.Network interface for the statistical counting of transceive data bag is finished by software all is applicable to the present invention.
Present embodiment is the implementation procedure that example is specifically introduced this scheme to receive interruption.
In the total Interrupt Process of network interface, set up and judge that network interface receives interruption times IntTimes whether more than or equal to the step of predefined interruption times threshold value LAN_INT_TIMES, realizes the flow control to the local terminal network interface.The setting principle of interruption times threshold value is: guaranteeing that CPU usage is under the prerequisite of 70%-75%, is provided with the interruption times threshold value.If it is on the low side that this threshold value is provided with, will cause the inefficiency wasting of resources, busy if this threshold value is provided with the higher single board service that will cause, make CPU usage too high, and influence the operation of other task.The adjustment of this threshold value for convenience, can increase a simple threshold value control order such as set flow-ctrl value at control desk, revise the size that threshold value has been set as required, convenient flexible when this just makes this interruption times threshold parameter of each modification.
Figure 2 shows that the flow chart of the Interrupt Process step that network interface is total.
Step 201 reads current interrupt status register;
Step 202 is judged the network interface interrupt type, interrupts if receive, and then execution in step 203, interrupts if send, and then execution in step 204;
Step 203, receive Interrupt Process after, direct execution in step 205;
Step 204, send Interrupt Process after, execution in step 205;
Whether step 205 judges network interface interruption times IntTimes more than or equal to predefined interruption times threshold value LAN_INT_TIMES, if execution in step 206, otherwise execution in step 208;
Step 206 is provided with the control register of network interface chip, closes interruption, the no longer processing interrupted of response;
Step 207, it is closed condition that interrupt flag bit is set, and NetFlag=1 promptly is set, expression is interrupted closing;
Step 208 finishes the total Interrupt Process of network interface.
In the reception Interrupt Process of network interface, the interruption times IntTimes that is provided with and adds up, promptly when the data encapsulation that receives finish give link layer after, make the value of interruption times IntTimes add one.Simultaneously, CPU is handling the interruption of network interface always when preventing single board service busy, makes that CPU usage is too high not freely goes dog clearly, causes that house dog is overtime to make board resetting, so increase the step of clear dog; When veneer occurs needing watchdog reset unusually, the transmitting-receiving of data is constantly arranged because of network interface, and dog operation is clearly constantly carried out, cause house dog can not enter the board resetting state, therefore, in the reception Interrupt Process of network interface, increase and judge that the interruption times threshold value is whether more than or equal to the step of the clear dog threshold value of having set.
Figure 3 shows that the flow chart that receives the Interrupt Process step.
Step 301 is taken out the packet that sends from receive buffering area;
Step 302, encapsulate this packet after, give link layer process;
Step 303, the reception interruption times is provided with and adds up;
Step 304, whether the value of judging this interruption times IntTimes is more than or equal to clear dog threshold value, if execution in step 305, otherwise direct execution in step 306;
Step 305 is carried out dog treatment S etWatchdog () clearly;
Step 306 is revised the receiving and counting counting.
Figure 4 shows that the flow chart of dog processing concrete operations step clearly.In clear dog is handled,
Step 401 judges whether house dog opens, if execution in step 402 is carried out once clear dog operation, otherwise directly withdrawed from dog treatment step clearly.
Because TICK is the unit that is used to the time of measuring in the system, the TICK interruption is just called once every 10 milliseconds by system usually.This interruption is mainly used in the thing that needs Timing Processing in the treatment system, after disposing, just jumps out this interruption.
In the TICK of system Interrupt Process, set up flow control step Lan_Flow_ctrl (), interrupt to open current buttoned-up reception, and, restart counting the value zero clearing of interruption times IntTimes.
Figure 5 shows that the flow chart that increases the flow control step in the TICK Interrupt Process.
Step 501 judges that network interface receives whether interrupt flag bit is closed condition, and promptly whether the value of NetFlag is 1, if execution in step 502, otherwise directly carry out 504;
Step 502 is opened network interface and is received interruption;
Step 503, the value that network interface reception interrupt flag bit is set promptly is provided with NetFlag=0 for opening interrupt status;
Step 504 with the value zero clearing of interruption times, is restarted counting, and IntTimes=0 promptly is set.
The above only is preferred embodiment of the present invention, and is in order to restriction the present invention, within the spirit and principles in the present invention not all, any modification of being done, is equal to replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (11)

1, a kind of method of network interface flow control is characterized in that this method may further comprise the steps:
A, in the total Interrupt Process of network interface, with interruption times and predefined interruption times threshold, if interruption times is more than or equal to the interruption times threshold value, then closing network interface interrupts, stop to receive packet or send out packet, up to execution in step b, otherwise execution in step c;
B, in the timing Interrupt Process, open buttoned-up network interface and interrupt, continue to receive packet or send out packet;
C, withdraw from the total Interrupt Process of network interface.
2, method according to claim 1 is characterized in that the described network interface interruption of step a is the reception interruption, or the transmission interruption, or receives interruption and transmission interruption.
3, method according to claim 2 is characterized in that the total Interrupt Process of the described network interface of step a further may further comprise the steps:
A1, read current interrupt status register;
A2, judge and to interrupt the network interface interrupt type if receive, then receive Interrupt Process after, directly execution in step a3 interrupts if send, then send Interrupt Process after, execution in step a3;
A3, whether judge interruption times more than or equal to predefined interruption times threshold value, if execution in step a4, otherwise finish the total Interrupt Process of network interface;
A4, the control register that corresponding network interface chip is set are closed corresponding network interface and are interrupted, and the network interface interrupt flag bit is set is closed condition.
4, method according to claim 3 is characterized in that the described Interrupt Process that receives further may further comprise the steps:
1), from receive buffering area, takes out the packet that sends;
2), encapsulate this packet after, give link layer process;
3), the reception interruption times that adds up;
4), revise statistical counting.
5, method according to claim 3 is characterized in that the described Interrupt Process that sends further may further comprise the steps:
1 '), packet to be sent is deposited in the transmission buffering area;
2 '), the transmission control bit of network interface chip is set, packet is sent to physical link layer;
3 '), the transmission interruption times that adds up;
4 '), revise statistical counting.
6, according to claim 4 or 5 described methods, it is characterized in that further comprising before the described modification statistical counting: whether judge interruption times more than or equal to clear dog threshold value, if carry out dog processing clearly, otherwise directly revise statistical counting.
7, method according to claim 6 is characterized in that described clear dog processing further comprises: judge whether house dog opens, if carry out once clear dog operation, otherwise directly withdraw from dog treatment step clearly.
8, method according to claim 1 is characterized in that the described timing interruption of step b is meant the unit metering time interruption in the system.
9, method according to claim 8 is characterized in that described step b further comprises:
Judge network interface interrupt flag bit state, if it is closed condition that network interface interrupts, the control register that corresponding network interface chip then is set interrupts to open buttoned-up network interface, the network interface interrupt flag bit is set to open mode, and add up interruption times again, if it is open mode that network interface interrupts, then directly add up interruption times again.
10, method according to claim 1 is characterized in that this method further comprises: control desk is revised the interruption times threshold values by the control command of revising the interruption times threshold value.
11, method according to claim 10 is characterized in that this method further comprises: according to the occupancy of CPU, revise the interruption times threshold values.
CN 02158015 2002-12-20 2002-12-20 Method for controlling network port flow Expired - Fee Related CN1266883C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 02158015 CN1266883C (en) 2002-12-20 2002-12-20 Method for controlling network port flow

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 02158015 CN1266883C (en) 2002-12-20 2002-12-20 Method for controlling network port flow

Publications (2)

Publication Number Publication Date
CN1509011A true CN1509011A (en) 2004-06-30
CN1266883C CN1266883C (en) 2006-07-26

Family

ID=34236815

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 02158015 Expired - Fee Related CN1266883C (en) 2002-12-20 2002-12-20 Method for controlling network port flow

Country Status (1)

Country Link
CN (1) CN1266883C (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102006615A (en) * 2010-11-25 2011-04-06 中兴通讯股份有限公司 Method and device for processing massage
CN102833087A (en) * 2011-06-17 2012-12-19 中兴通讯股份有限公司 Method and device for processing unstable-quality link in IMA transmission
CN102945197A (en) * 2012-10-17 2013-02-27 上海华兴数字科技有限公司 Communication method between control module and display module and industrial control display device
CN109525446A (en) * 2018-12-29 2019-03-26 联想(北京)有限公司 A kind of processing method and electronic equipment
CN112356021A (en) * 2020-10-15 2021-02-12 武汉市新攀登科技有限公司 Signal sending and receiving method, controller and manipulator

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102006615A (en) * 2010-11-25 2011-04-06 中兴通讯股份有限公司 Method and device for processing massage
WO2012068804A1 (en) * 2010-11-25 2012-05-31 中兴通讯股份有限公司 Message processing method and device
CN102833087A (en) * 2011-06-17 2012-12-19 中兴通讯股份有限公司 Method and device for processing unstable-quality link in IMA transmission
CN102945197A (en) * 2012-10-17 2013-02-27 上海华兴数字科技有限公司 Communication method between control module and display module and industrial control display device
CN102945197B (en) * 2012-10-17 2016-05-11 上海华兴数字科技有限公司 Communication means between a kind of control module and display module and industry control display unit
CN109525446A (en) * 2018-12-29 2019-03-26 联想(北京)有限公司 A kind of processing method and electronic equipment
CN109525446B (en) * 2018-12-29 2021-09-14 联想(北京)有限公司 Processing method and electronic equipment
CN112356021A (en) * 2020-10-15 2021-02-12 武汉市新攀登科技有限公司 Signal sending and receiving method, controller and manipulator

Also Published As

Publication number Publication date
CN1266883C (en) 2006-07-26

Similar Documents

Publication Publication Date Title
US7228409B2 (en) Networking interface sharing methods and apparatuses that support kernel mode data traffic and user mode data traffic
CN1725732A (en) Message speed limit method
US7596644B2 (en) Transmit rate pacing system and method
US7551638B2 (en) Network interface with transmit frame descriptor reuse
US20060203730A1 (en) Method and system for reducing end station latency in response to network congestion
EP1280301A2 (en) Flow based congestion control
WO2006026438A2 (en) Device and method for managing oversubscription in a network
CN103997465A (en) Method and device for generating CNM
CN1295633C (en) Method for multiple CPU communication
CN108304335A (en) A method of the indefinite long message of serial ports is received by DMA
CN1742469A (en) Methods and devices for transmitting data between storage area networks
CN1276635C (en) Priority enhanced information transfer device and its method
CN1266883C (en) Method for controlling network port flow
CN101052938A (en) Low latency data packet reception and processing
EP0657824A1 (en) Apparatus for Ethernet packet reception
CN111600809B (en) Gigabit single optical port server adapter
CN102340442B (en) Method for adjusting interface receiving queue length and apparatus thereof
CN101631353B (en) Method and device for managing status packet data unit
EP1966950A2 (en) Processing received data
CN1848795A (en) Method for realizing large data packet quick retransmission in real-time communication system
CN100345422C (en) Packet communicate terminal
CN1901492A (en) Communication method via bus interface in network and and system thereof
CN101052937A (en) Discarding a partially received message from a data queue
CN1347062A (en) Gigabit IP network card
US20040249933A1 (en) Network interface parameters

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: 20060726

Termination date: 20151220

EXPY Termination of patent right or utility model