[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN109936502B - Data receiving method and data transmission equipment - Google Patents

Data receiving method and data transmission equipment Download PDF

Info

Publication number
CN109936502B
CN109936502B CN201711361285.1A CN201711361285A CN109936502B CN 109936502 B CN109936502 B CN 109936502B CN 201711361285 A CN201711361285 A CN 201711361285A CN 109936502 B CN109936502 B CN 109936502B
Authority
CN
China
Prior art keywords
data
current
receiving
frequency
preset
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
CN201711361285.1A
Other languages
Chinese (zh)
Other versions
CN109936502A (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.)
Maipu Communication Technology Co Ltd
Original Assignee
Maipu Communication 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 Maipu Communication Technology Co Ltd filed Critical Maipu Communication Technology Co Ltd
Priority to CN201711361285.1A priority Critical patent/CN109936502B/en
Publication of CN109936502A publication Critical patent/CN109936502A/en
Application granted granted Critical
Publication of CN109936502B publication Critical patent/CN109936502B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Communication Control (AREA)

Abstract

The embodiment of the invention provides a data receiving method and data transmission equipment, and relates to the technical field of data communication. The method comprises the steps that when a current receiving mechanism is an interrupt mechanism, in the process that a control plane of data transmission equipment receives data from a data plane of the data transmission equipment based on the interrupt mechanism, a first current data arrival frequency is obtained, and then when the first current data arrival frequency meets a preset condition, the current receiving mechanism is switched to a polling mechanism. In the embodiment of the application, based on the current data arrival frequency, the current receiving mechanism can be switched to the polling mechanism at a proper time, so that the processing load of the processor is prevented from being increased due to frequent data interruption, and the running stability of the control surface of the data transmission equipment is improved.

Description

Data receiving method and data transmission equipment
Technical Field
The present invention relates to the field of data communication technologies, and in particular, to a data receiving method and a data transmission device.
Background
With the change of life style caused by the continuous development of economy, the current network becomes a necessary part of daily life, and the requirement of massive network data on the data throughput of network communication equipment is more strict. The router is used as an essential important device in a communication network, the data transceiving performance of the router directly determines the reliability of data communication of the network, and the router plays a role in supporting and limiting the normal operation of services carried in the network. The current high-end routing equipment adopts a distributed architecture, and a control plane and a data plane are separated. The control plane is used for completing the interaction of the protocol messages, so when the protocol messages are handed over from the data plane to the control plane, the control plane must ensure the rapid receiving and processing of the protocol messages, so as to ensure the stability of the routing link and further ensure the reliability of the device communication.
Disclosure of Invention
The embodiment of the invention provides a data receiving method and data transmission equipment. The technical scheme adopted by the embodiment of the invention is as follows:
in a first aspect, an embodiment of the present invention provides a data receiving method, where the method includes: when a current receiving mechanism is an interruption mechanism, and a control plane of data transmission equipment receives data from a data plane of the data transmission equipment based on the interruption mechanism, obtaining a first current data arrival frequency; and when the arrival frequency of the first current data meets a preset condition, switching the current receiving mechanism into a polling mechanism. In the embodiment of the application, based on the current data arrival frequency, the current receiving mechanism can be switched to the polling mechanism at a proper time, so that the processing load of the processor is prevented from being increased by frequent data interruption, and the running stability of the control plane of the data transmission equipment is improved.
Further, before obtaining the first current data arrival frequency, the method further comprises: acquiring a return value triggered by the current interruption; when the return value is judged to be a first preset value, judging whether the number of the currently received data is not less than a preset data receiving number threshold value; when the number of the currently received data is not less than the preset data receiving number threshold, executing the following steps: a first current data arrival frequency is obtained. In the embodiment of the application, the first current data arrival frequency is obtained only when the number of the currently received data is not less than the preset data receiving number threshold, so that the first current data arrival frequency can be prevented from being obtained too frequently, and the processing resource of the equipment is saved.
Further, when the first current data arrival frequency meets a preset condition, switching the current receiving mechanism to a polling mechanism includes: when the first current data arrival frequency is not less than a preset arrival frequency threshold value, judging whether a data frequency receiving mark is a first preset mark or not; and when the data frequency receiving mark is the first preset mark, switching the current receiving mechanism to a polling mechanism so as to receive data based on the polling mechanism and accumulate the current data receiving frequency value. In the embodiment of the application, when the first current data arrival frequency is not less than the preset arrival frequency threshold and the data frequency receiving flag is the first preset flag, the current receiving mechanism is switched to the polling mechanism, so that the influence on data receiving and processing due to switching can be avoided, and the technical effect of ensuring timely data receiving and processing is achieved.
Further, when the return value is judged to be the first preset value, after judging whether the number of currently received data is not less than a preset threshold value of the number of received data, the method further includes: when the number of the currently received data is smaller than the threshold value of the number of the received data, acquiring a second current data arrival frequency; when the arrival frequency of the second current data is smaller than the arrival frequency threshold, judging whether the data frequency receiving mark is a second preset mark; when the data frequency receiving mark is the second preset mark, comparing the current data receiving frequency value with a preset data receiving frequency threshold value; when the current data receiving frequency value is larger than the data receiving frequency threshold value according to the comparison result, assigning the current data receiving frequency value to the data receiving frequency threshold value and resetting the current data receiving frequency value to be zero; the current receiving mechanism is switched to the interrupt mechanism. In the embodiment of the present application, a data receiving frequency threshold, that is, a maximum data receiving frequency value in history, is obtained by comparing the current data receiving frequency value with a preset data receiving frequency threshold, so as to ensure reliable data receiving.
Further, after obtaining the return value triggered by the current interrupt, the method further includes: when the return value is a second preset value, resetting the data frequency receiving flag to be the second preset flag, and resetting the current data receiving frequency value to be zero; the current reception mechanism is switched to the interrupt mechanism. In the embodiment of the invention, when the return value is the second preset value, the current receiving mechanism is switched to the interrupt mechanism so as to ensure the timely receiving of the data.
Further, obtaining a return value triggered by the current interrupt includes: when the data transmission equipment is in a user mode, a data receiving task is established; and when the data receiving task acquires the semaphore triggered and released by the current interrupt within a preset time span through a preset character device, acquiring a return value corresponding to the semaphore. In the embodiment of the application, the return value corresponding to the semaphore is acquired within a preset time span in the user mode, so that the data can be timely received.
Further, when the data receiving task obtains the semaphore triggered and released by the current interrupt within a preset time length through a preset character device, before obtaining a return value corresponding to the semaphore, the method further includes: when the data transmission device is in a kernel mode, a character device is created for a data receiving chip included in the data transmission device. That is, in the embodiment of the present application, by creating the character device, it is possible to access the semaphore in the kernel mode through the character device in the user mode, thereby ensuring timely reception of data.
In a second aspect, an embodiment of the present invention provides a data transmission device, including an obtaining unit and a switching unit. The acquisition unit is used for acquiring a first current data arrival frequency when the current receiving mechanism is an interrupt mechanism and the control plane of the data transmission equipment receives data from the data plane of the data transmission equipment based on the interrupt mechanism. And the switching unit is used for switching the current receiving mechanism into a polling mechanism when the arrival frequency of the first current data meets a preset condition. In the embodiment of the application, based on the current data arrival frequency, the current receiving mechanism can be switched to the polling mechanism at a proper time, so that the processing load of the processor is prevented from being increased due to frequent data interruption, and the running stability of the control surface of the data transmission equipment is improved.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the embodiments of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 is a schematic diagram of a routing distributed architecture according to an embodiment of the present invention;
fig. 2 is a flowchart of a data receiving method according to an embodiment of the present invention;
fig. 3 is a block diagram of a data transmission device according to an embodiment of the present invention;
fig. 4 is a block diagram of another data transmission device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present invention, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
Before the inventor of the present application proposes the technical solution in the embodiment of the present application, for the current requirements of stable, reliable, and fast transmission of a packet, the overall architecture adopts a distributed architecture, that is, a control plane is separated from a data plane. The data plane is mainly used for fast forwarding of messages and is not responsible for processing services such as a routing protocol, the control plane is mainly used for managing equipment and processing services such as a routing protocol, a routing distributed architecture is shown in fig. 1, the routing distributed architecture comprises a routing device I and a routing device II in fig. 1, and the data plane needs to reliably and fast forward messages such as a routing protocol and the like which need to be processed by the control plane to the control plane for processing; the control plane runs a large number of tasks for managing the equipment and simultaneously runs a large number of tasks related to protocol processing, and services in charge of the tasks have higher real-time processing requirements. According to the working characteristics of the routing equipment, the message flow which is handed to the control plane in the running process of the equipment has burst property.
During the continuous operation of the router in the network environment, the size of the protocol message flow which is handed over to the control plane through the data plane for processing has randomness, that is, the change situation of the message flow along with time has unpredictability. There are two variations: 1. when a large amount of messages are continuously submitted to the control plane for a long time (or a short time), if the software layer cannot read the messages in time for forwarding, data packet loss at the network chip side is caused. 2. Software and hardware resources are in a relatively idle state when no or little message traffic enters the network interface for a long time (or a short time). The two message flow states exist singly or are combined alternately at random, and the message flow state on a network interface cannot be estimated in advance.
The current packet receiving scheme of the control plane comprises a single sampling interrupt triggering mode and a software polling mode. In view of the above solutions, the inventor finds, in the process of implementing the technical solution of the embodiment of the present application, that an interrupt trigger mode is singly used for receiving a packet of a current control plane, and when a large number of packets need to be handed over to the control plane for processing, a continuous interrupt continuously preempts the running time of a processor, which causes frequent interrupts, reduces the service processing capability of the processor, reduces the packet processing efficiency, and causes a long convergence time for a stable link for a processing delay of a routing protocol packet. For the method of performing message reception by closing interruption after interruption triggering, message reception is performed in the interruption closing process, if the message is not completely received before interruption is reopened and no new message comes after interruption is opened to trigger interruption, part of the message cannot be received and processed by software, so that the part of the message is temporarily lost or delayed in processing, the reliability of control plane operation is affected, and the normal operation of tasks of monitoring and controlling equipment on the control plane cannot be guaranteed, so that the equipment is abnormal. If the message is received in a software polling manner, the specific polling period cannot be determined due to the traffic size described above. If the polling period is too large, the delay time of protocol message processing will be lengthened, and message packet loss will also occur under the condition of large flow; if the polling period is too short, the message receiving task occupies too much time of the processor under the condition of relatively small message flow, which affects the operation of tasks such as managing the equipment on the control plane.
The defects existing in the above solutions are the results obtained after the inventor has practiced and studied carefully, so the discovery process of the above problems and the solutions proposed by the following embodiments of the present invention to the above problems should be the contribution of the inventor to the present invention in the process of the present invention.
Referring to fig. 2, an embodiment of the present invention provides a data receiving method, which may include step S200 and step S210.
Step S200: and when the current receiving mechanism is an interruption mechanism, and in the process that the control plane of the data transmission equipment receives data from the data plane of the data transmission equipment based on the interruption mechanism, obtaining a first current data arrival frequency.
In this embodiment, the data transmission device may be a routing device, and accordingly, in the process of receiving data from the data plane of the data transmission device by the control plane of the data transmission device based on the interrupt mechanism, the process of receiving a packet from the data plane of the routing device by the control plane of the routing device based on the interrupt mechanism may be. For example, the routing device may be a router.
Further, before step S200, the method may further include:
acquiring a return value triggered by the current interruption; when the return value is judged to be a first preset value, judging whether the number of the currently received data is not less than a preset data receiving number threshold value; when the number of the currently received data is not less than the preset data receiving number threshold, executing the following steps: a first current data arrival frequency is obtained.
Further, when the data transmission device is in a kernel mode, a character device is created for a data receiving chip included in the data transmission device; when the data transmission equipment is in a user mode, a data receiving task is established; and when the data receiving task acquires the semaphore triggered and released by the current interrupt within a preset time length through preset character equipment, acquiring a return value corresponding to the semaphore.
That is, in the embodiment of the present application, by creating the character device, it is possible to access the semaphore in the kernel mode through the character device in the user mode, thereby ensuring timely reception of data.
In this embodiment, for convenience of description, a data transmission device is taken as a routing device, and accordingly, received data is taken as a received message for example. The routing device comprises a processor and a message receiving chip. The message receiving chip is electrically connected with the processor. In the process of initializing the routing device, a character device is created for a message receiving chip in a kernel mode, the character device is recorded as r xDev, the reception of a register message is interrupted, a message receiving terminal is recorded as rxIntr, a semaphore is created at the same time, the semaphore is recorded as rxSem, the semaphore rxSem is released in an interrupt processing function, namely rxIntrFunc, and the interrupt processing function is used for notifying a message receiving task in a user mode to read the message.
Specifically, in the process of initializing the routing device, in the user mode, the character device r xDev created in the kernel mode is opened, and a message receiving task is created, where the message receiving task is marked as rxTask, and meanwhile, a data receiving number threshold, that is, the number of messages that can be read by the message receiving task at most each time, is set, the message receiving number threshold is marked as rxPktLimit, the initialized message frequency receiving flag is 0, the message frequency receiving flag is marked as rxpktflag, the current message receiving frequency value is initialized to 0, the current message receiving frequency value is marked as rxPktCurFre, the initialized message receiving frequency threshold is 0, the message receiving frequency threshold is the maximum message receiving frequency, and the message receiving frequency threshold is marked as rxpktmaxf. And a preset time length, namely the semaphore acquisition timeout time length, is set, and the preset time length is recorded as rxTimeOut. A message receiving task rxTask sinks into a kernel through character equipment to wait for obtaining a created semaphore rxSem; if the semaphore is successfully acquired within the preset time period, the return value corresponding to the acquired semaphore is the first preset value, namely the first preset value is recorded as RX _ SEM _ SUCCESS. If the semaphore is not successfully acquired within the preset time span, the acquired return value is a second preset value, and the second preset value is recorded as RX _ SEM _ FAILED.
Step S210: and when the first current data arrival frequency meets a preset condition, switching the current receiving mechanism into a polling mechanism.
As a specific embodiment of the present invention, further, based on step S210, when the first current data arrival frequency is not less than a preset arrival frequency threshold, determining whether a data frequency receiving flag is a first preset flag; and when the data frequency receiving mark is the first preset mark, switching the current receiving mechanism to a polling mechanism so as to receive data based on the polling mechanism and accumulate the current data receiving frequency value.
In the embodiment of the application, when the first current data arrival frequency is not less than the preset arrival frequency threshold and the data frequency receiving sign is the first preset sign, the current receiving mechanism is switched to the polling mechanism, so that the influence on data receiving and processing due to switching can be avoided, and the technical effect of ensuring the timeliness of data receiving and processing is achieved.
As another specific embodiment of the present invention, further, the method may further include: when the number of the currently received data is smaller than the threshold value of the number of the received data, acquiring a second current data arrival frequency; when the arrival frequency of the second current data is smaller than the arrival frequency threshold, judging whether the data frequency receiving mark is a second preset mark; when the data frequency receiving mark is the second preset mark, comparing the current data receiving frequency value with a preset data receiving frequency threshold value; when the current data receiving frequency value is larger than the data receiving frequency threshold value according to the comparison result, assigning the current data receiving frequency value to the data receiving frequency threshold value and resetting the current data receiving frequency value to be zero; the current reception mechanism is switched to the interrupt mechanism.
In the embodiment of the present application, a data receiving frequency threshold, that is, a maximum data receiving frequency value in history, is obtained by comparing the current data receiving frequency value with a preset data receiving frequency threshold, so as to ensure reliable data receiving.
In this embodiment, the first preset flag may be 1, and the second preset flag may be 0.
If the return value of the waiting interrupt is the first preset value RX _ SEM _ SUCCESS, the message comes, at this moment, the message receiving interrupt is closed, and the message reading is started. And recording the number of the currently received data, namely the number of the messages successfully read at this time, and recording the number of the currently received data as rxPktNUm. This time is divided into two cases.
Under the first condition, when the number rxPktNUm of the currently received data is not less than the threshold rxPktLimit of the number of received messages, the message is not completely read, and a first current data arrival frequency is obtained, when the arrival frequency of the first current data is not less than the preset arrival frequency threshold, the arrival frequency of the message is larger at the moment, the message receiving task rxTask firstly judges the value of a message frequency receiving mark rxpktflag, if the message frequency receiving mark rxpktflag is the first preset mark, namely 1, and is not equal to 0, the current message volume is not completely processed, the current receiving mechanism is switched to be a polling mechanism, the message is directly read for processing at the moment, and the polling frequency value of the current message receiving rxpktcurf is accumulated.
Under the second condition, when the number rxPktNUm of the currently received data is smaller than the threshold rxPktLimit of the number of received messages, obtaining a second current data arrival frequency; when the arrival frequency of the second current message is smaller than the arrival frequency threshold, the message is read completely, the number of the messages can be processed by software in time, a message frequency receiving mark rxpktflag is set to 0, and the message receiving task rxTask needs to restart message receiving interruption and wait for the next interruption. If the data frequency receiving flag rxpktFreflag is equal to 0, indicating that no message is waiting for processing currently, comparing a current message receiving frequency value rxpktCurFre with a message receiving frequency threshold rxptMaxFre, and assigning the current message receiving frequency value to the message receiving frequency threshold and resetting the current message receiving frequency value to zero when the current message receiving frequency value obtained according to the comparison result is greater than the message receiving frequency threshold; the current reception mechanism is switched to the interrupt mechanism. And the message receiving task waits for the interrupt to arrive. And comparing the number of the messages which are successfully read when the interruption is triggered every time with a preset message receiving number threshold value to obtain the arrival frequency of the current message, and dynamically adjusting the receiving frequency of the message according to the arrival frequency of the current message to realize the reliable receiving of the message. Meanwhile, the maximum message receiving frequency in the message receiving process is recorded, so that the message receiving frequency value with the maximum history is recorded, and the maximum burst flow of the message can be obtained and used as a basis for measuring the maximum throughput capacity of the system. The receiving capability of burst flow is improved under the condition of not reducing the message receiving performance.
Further, after obtaining the return value triggered by the current interrupt, the method further includes: when the return value is a second preset value, resetting the data frequency receiving flag to be the second preset flag, and resetting the current data receiving frequency value to be zero; the current reception mechanism is switched to the interrupt mechanism.
If the return value of the waiting interrupt is the second preset value RX _ SEM _ FAILED, no message is shown, at this time, a message frequency receiving mark rxPktFreflag is set to be 0, the current message receiving frequency value rxPktCurFre is cleared, then the interrupt is opened again, and the interrupt is waited. To ensure timely receipt of data.
The embodiment of the invention provides a data receiving method, wherein when a current receiving mechanism is an interrupt mechanism and a control plane of data transmission equipment receives data from a data plane of the data transmission equipment based on the interrupt mechanism, a first current data arrival frequency is obtained, and then when the first current data arrival frequency meets a preset condition, the current receiving mechanism is switched to a polling mechanism. In the embodiment of the application, based on the current data arrival frequency, the current receiving mechanism can be switched to the polling mechanism at a proper time, so that the processing load of the processor is prevented from being increased due to frequent data interruption, and the running stability of the control surface of the data transmission equipment is improved. The applicability and the expansibility are stronger.
Referring to fig. 3, an embodiment of the present invention provides a data transmission apparatus 300, which includes an obtaining unit 320 and a switching unit 330.
An obtaining unit 320, configured to obtain a first current data arrival frequency when a current receiving mechanism is an interrupt mechanism and a control plane of a data transmission device receives data from a data plane of the data transmission device based on the interrupt mechanism.
As an embodiment, the data transmission device 300 may further include a first processing unit 310.
A first processing unit 310, configured to obtain a return value triggered by a current interrupt; when the return value is judged to be a first preset value, judging whether the number of the currently received data is not less than a preset data receiving number threshold value; when the number of the currently received data is not less than the preset data receiving number threshold, executing the following steps: a first current data arrival frequency is obtained.
The first processing unit 310 may comprise a first processing subunit 311.
A first processing subunit 311, configured to create a data receiving task when the data transmission apparatus is in a user mode; and when the data receiving task acquires the semaphore triggered and released by the current interrupt within a preset time length through preset character equipment, acquiring a return value corresponding to the semaphore.
The first processing subunit 311 is further configured to, when the data transmission device is in a kernel mode, create a character device for a data receiving chip included in the data transmission device.
A switching unit 330, configured to switch the current receiving mechanism to a polling mechanism when the first current data arrival frequency meets a preset condition.
The switching unit 330 may include a switching sub-unit 331.
The switching subunit 331, configured to determine whether the data frequency receiving flag is a first preset flag when the first current data arrival frequency is not less than a preset arrival frequency threshold; and when the data frequency receiving mark is the first preset mark, switching the current receiving mechanism to a polling mechanism so as to receive data based on the polling mechanism and accumulate the current data receiving frequency value.
The data transmission device 300 may further comprise a second processing unit 340.
A second processing unit 340, configured to obtain a second current data arrival frequency when the number of currently received data is smaller than the data receiving number threshold; when the arrival frequency of the second current data is smaller than the arrival frequency threshold, judging whether the data frequency receiving mark is a second preset mark; when the data frequency receiving mark is the second preset mark, comparing the current data receiving frequency value with a preset data receiving frequency threshold value; when the current data receiving frequency value is larger than the data receiving frequency threshold value according to the comparison result, assigning the current data receiving frequency value to the data receiving frequency threshold value and resetting the current data receiving frequency value to be zero; the current reception mechanism is switched to the interrupt mechanism.
Referring to fig. 4, the data transmission apparatus 300 may further include a third processing unit 350.
A third processing unit 350, configured to, when the return value is a second preset value, reset the data frequency receiving flag to the second preset flag, and reset the current data receiving frequency value to zero; the current reception mechanism is switched to the interrupt mechanism.
The above units may be implemented by software codes, and in this case, the units may be stored in a memory of the data transmission device. The above units may also be implemented by hardware, for example, an integrated circuit chip.
The data transmission apparatus 300 according to the embodiment of the present invention has the same implementation principle and technical effect as the foregoing method embodiments, and for the sake of brief description, no mention is made in the device embodiment, and reference may be made to the corresponding contents in the foregoing method embodiments.
An embodiment of the present invention provides a storage medium, which stores a program code, and when the program code is read and executed by a processor, the program code performs the above method.
An embodiment of the invention provides an electronic device, which comprises a processor and a memory. The processor and the memory are electrically connected by a bus. The memory has program code stored therein. The processor is used for reading the program codes from the memory through the bus and running the program codes to execute the method.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes. It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention. It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

Claims (10)

1. A method for receiving data, the method comprising:
when a current receiving mechanism is an interruption mechanism, and a control plane of data transmission equipment receives data from a data plane of the data transmission equipment based on the interruption mechanism, obtaining a first current data arrival frequency;
when the first current data arrival frequency meets a preset condition, switching the current receiving mechanism into a polling mechanism;
before obtaining the first current data arrival frequency, the method further comprises:
acquiring a return value triggered by the current interruption;
when the return value is judged to be a first preset value, judging whether the number of the currently received data is not less than a preset data receiving number threshold value;
when the number of the currently received data is not less than the preset data receiving number threshold, executing the following steps: obtaining a first current data arrival frequency;
when the first current data arrival frequency meets a preset condition, switching the current receiving mechanism to a polling mechanism, including:
when the first current data arrival frequency is not less than a preset arrival frequency threshold value, judging whether a data frequency receiving mark is a first preset mark or not;
and when the data frequency receiving mark is the first preset mark, switching the current receiving mechanism to a polling mechanism so as to receive data based on the polling mechanism and accumulate the current data receiving frequency value.
2. The method of claim 1, wherein after determining whether the number of currently received data is not less than a preset threshold of the number of received data when the return value is determined to be the first preset value, the method further comprises:
when the number of the currently received data is smaller than the threshold value of the number of the received data, acquiring a second current data arrival frequency;
when the arrival frequency of the second current data is smaller than the arrival frequency threshold, judging whether the data frequency receiving mark is a second preset mark;
when the data frequency receiving mark is the second preset mark, comparing the current data receiving frequency value with a preset data receiving frequency threshold value;
when the current data receiving frequency value is larger than the data receiving frequency threshold value according to the comparison result, assigning the current data receiving frequency value to the data receiving frequency threshold value and resetting the current data receiving frequency value to be zero;
the current receiving mechanism is switched to the interrupt mechanism.
3. The method of claim 2, wherein after obtaining the return value of the current interrupt trigger, the method further comprises:
when the return value is a second preset value, resetting the data frequency receiving flag to be the second preset flag, and resetting the current data receiving frequency value to be zero;
the current reception mechanism is switched to the interrupt mechanism.
4. The method of claim 1, wherein obtaining a return value for a current interrupt trigger comprises:
when the data transmission equipment is in a user mode, a data receiving task is established;
and when the data receiving task acquires the semaphore triggered and released by the current interrupt within a preset time length through preset character equipment, acquiring a return value corresponding to the semaphore.
5. The method according to claim 4, wherein before the data receiving task obtains the semaphore triggered and released by the current interrupt within a preset time period through a preset character device, and obtains a return value corresponding to the semaphore, the method further comprises:
when the data transmission device is in a kernel mode, a character device is created for a data receiving chip included in the data transmission device.
6. A data transmission device, comprising:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a first current data arrival frequency when a current receiving mechanism is an interrupt mechanism and a control plane of data transmission equipment receives data from a data plane of the data transmission equipment based on the interrupt mechanism;
the switching unit is used for switching the current receiving mechanism into a polling mechanism when the arrival frequency of the first current data meets a preset condition;
the first processing unit is used for acquiring a return value triggered by the current interrupt; when the return value is judged to be a first preset value, judging whether the number of the currently received data is not less than a preset data receiving number threshold value; when the number of the currently received data is not less than the preset data receiving number threshold, executing the following steps: obtaining a first current data arrival frequency;
the switching unit includes:
the switching subunit is used for judging whether the data frequency receiving mark is a first preset mark or not when the arrival frequency of the first current data is not less than a preset arrival frequency threshold; and when the data frequency receiving mark is the first preset mark, switching the current receiving mechanism to a polling mechanism so as to receive data based on the polling mechanism and accumulate the current data receiving frequency value.
7. The data transmission device according to claim 6, characterized in that the data transmission device further comprises:
the second processing unit is used for obtaining a second current data arrival frequency when the number of the currently received data is smaller than the data receiving number threshold; when the arrival frequency of the second current data is smaller than the arrival frequency threshold, judging whether the data frequency receiving mark is a second preset mark; when the data frequency receiving mark is the second preset mark, comparing the current data receiving frequency value with a preset data receiving frequency threshold value; when the current data receiving frequency value is larger than the data receiving frequency threshold value according to the comparison result, assigning the current data receiving frequency value to the data receiving frequency threshold value and resetting the current data receiving frequency value to be zero; the current reception mechanism is switched to the interrupt mechanism.
8. The data transmission device according to claim 7, characterized in that the data transmission device further comprises:
a third processing unit, configured to reset the data frequency receiving flag to the second preset flag when the return value is the second preset value, and reset the current data receiving frequency value to zero; the current reception mechanism is switched to the interrupt mechanism.
9. The data transmission device according to claim 6, wherein the first processing unit comprises:
the first processing subunit is used for creating a data receiving task when the data transmission equipment is in a user mode; and when the data receiving task acquires the semaphore triggered and released by the current interrupt within a preset time length through preset character equipment, acquiring a return value corresponding to the semaphore.
10. The data transmission device according to claim 9, wherein the first processing subunit is further configured to create a character device for a data receiving chip included in the data transmission device when the data transmission device is in a kernel mode.
CN201711361285.1A 2017-12-15 2017-12-15 Data receiving method and data transmission equipment Active CN109936502B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711361285.1A CN109936502B (en) 2017-12-15 2017-12-15 Data receiving method and data transmission equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711361285.1A CN109936502B (en) 2017-12-15 2017-12-15 Data receiving method and data transmission equipment

Publications (2)

Publication Number Publication Date
CN109936502A CN109936502A (en) 2019-06-25
CN109936502B true CN109936502B (en) 2022-05-17

Family

ID=66982243

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711361285.1A Active CN109936502B (en) 2017-12-15 2017-12-15 Data receiving method and data transmission equipment

Country Status (1)

Country Link
CN (1) CN109936502B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0903670A1 (en) * 1997-09-19 1999-03-24 Hewlett-Packard Company Improved peripheral device control in data processing systems
GB0423765D0 (en) * 2003-10-31 2004-12-01 Sun Microsystems Inc Methods and apparatus for dynamically switching between polling and interrupt handle network traffic
CN1956438A (en) * 2005-10-28 2007-05-02 中兴通讯股份有限公司 Automatic switching method of message process mode
US7937499B1 (en) * 2004-07-09 2011-05-03 Oracle America, Inc. Methods and apparatus for dynamically switching between polling and interrupt mode for a ring buffer of a network interface card
CN103391256A (en) * 2013-07-25 2013-11-13 武汉邮电科学研究院 Base station user plane data processing and optimizing method based on Linux system
CN104636287A (en) * 2013-11-07 2015-05-20 上海斐讯数据通信技术有限公司 Data acquisition device and mobile terminal
CN104838361A (en) * 2013-12-03 2015-08-12 华为技术有限公司 Inter-core process communication method, apparatus and system
CN105027081A (en) * 2013-12-20 2015-11-04 华为技术有限公司 Method and apparatus for switching polling and interruption

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8473647B2 (en) * 2007-09-17 2013-06-25 Apple Inc. Methods and apparatus for decreasing power consumption and bus activity
US10063376B2 (en) * 2015-10-01 2018-08-28 International Business Machines Corporation Access control and security for synchronous input/output links

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0903670A1 (en) * 1997-09-19 1999-03-24 Hewlett-Packard Company Improved peripheral device control in data processing systems
GB0423765D0 (en) * 2003-10-31 2004-12-01 Sun Microsystems Inc Methods and apparatus for dynamically switching between polling and interrupt handle network traffic
US7937499B1 (en) * 2004-07-09 2011-05-03 Oracle America, Inc. Methods and apparatus for dynamically switching between polling and interrupt mode for a ring buffer of a network interface card
CN1956438A (en) * 2005-10-28 2007-05-02 中兴通讯股份有限公司 Automatic switching method of message process mode
CN103391256A (en) * 2013-07-25 2013-11-13 武汉邮电科学研究院 Base station user plane data processing and optimizing method based on Linux system
CN104636287A (en) * 2013-11-07 2015-05-20 上海斐讯数据通信技术有限公司 Data acquisition device and mobile terminal
CN104838361A (en) * 2013-12-03 2015-08-12 华为技术有限公司 Inter-core process communication method, apparatus and system
CN105027081A (en) * 2013-12-20 2015-11-04 华为技术有限公司 Method and apparatus for switching polling and interruption

Also Published As

Publication number Publication date
CN109936502A (en) 2019-06-25

Similar Documents

Publication Publication Date Title
CN115152193A (en) Improving end-to-end congestion reaction for IP routed data center networks using adaptive routing and congestion hint based throttling
CN109039746B (en) Method for detecting bidirectional forwarding path and detecting session state and processor
CN109450666B (en) Distributed system network management method and device
CN110784415B (en) ECN quick response method and device
CN102801737B (en) A kind of asynchronous network communication means and device
CN109067571B (en) Electronic device, network configuration method thereof and storage medium
EP4175232A1 (en) Congestion control method and device
CN107872396B (en) Communication method with timeout control, processing device, terminal device and server
CN101686438B (en) Short message group sending method and equipment
US8619589B2 (en) System and method for removing test packets
US20150200872A1 (en) Cloud resource placement based on stochastic analysis of service requests
CN108206787A (en) A kind of congestion-preventing approach and device
CN113992588A (en) Data transmission method and device, electronic equipment and readable storage medium
CN114157609B (en) PFC deadlock detection method and device
CN109936502B (en) Data receiving method and data transmission equipment
US7391785B2 (en) Method for active queue management with asymmetric congestion control
CN109274546B (en) Timer scheduling method and device
CN106603723B (en) A kind of request message processing method and processing device
CN112737940A (en) Data transmission method and device
CN116827853A (en) Path processing method and device and electronic equipment
US10560317B2 (en) Subscription to a subset of switching events
CN110730130B (en) Message sending method, device, network equipment and storage medium
CN114885018A (en) Message pushing method, device, equipment and storage medium based on double queues
CN113542055A (en) Message processing method, device, equipment and machine readable storage medium
CN112835720A (en) ARP aging thread management method and device and electronic equipment

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