CN113676378A - Network bandwidth speed measurement application for simplifying Linux TCP protocol stack - Google Patents
Network bandwidth speed measurement application for simplifying Linux TCP protocol stack Download PDFInfo
- Publication number
- CN113676378A CN113676378A CN202110976596.9A CN202110976596A CN113676378A CN 113676378 A CN113676378 A CN 113676378A CN 202110976596 A CN202110976596 A CN 202110976596A CN 113676378 A CN113676378 A CN 113676378A
- Authority
- CN
- China
- Prior art keywords
- packet
- linux
- sequence number
- speed measurement
- protocol stack
- 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
Links
- 238000005259 measurement Methods 0.000 title claims abstract description 63
- 238000012545 processing Methods 0.000 claims abstract description 19
- 238000000034 method Methods 0.000 claims abstract description 14
- 230000006870 function Effects 0.000 claims description 5
- 230000005540 biological transmission Effects 0.000 claims description 3
- 238000012790 confirmation Methods 0.000 claims description 3
- 238000000827 velocimetry Methods 0.000 claims 4
- 238000012360 testing method Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/08—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
- H04L43/0876—Network utilisation, e.g. volume of load or congestion level
- H04L43/0894—Packet rate
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/16—Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
- H04L69/161—Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
- H04L69/162—Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/16—Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
- H04L69/163—In-band adaptation of TCP data exchange; In-band control procedures
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Environmental & Geological Engineering (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention discloses a network bandwidth speed measuring method for simplifying a Linux TCP protocol stack, which comprises the steps that firstly, a core socket in a router initiates a speed measuring request according to a speed measuring parameter configured by an operator; after the kernel socket establishes a TCP connection with the operator speed measurement server through an HTTP protocol, corresponding TCP connection information is set to the Linux simplified protocol stack module, the Linux simplified protocol stack module can monitor and process data packets sent by a subsequent speed measurement server according to information configured by the kernel socket, information of downloaded data is counted, and the specific downloading speed can be calculated after downloading is completed. The invention reduces the packet processing path and the copy operation of the packet in the memory, thereby saving the processing resource of the CPU of the home router and obtaining a higher speed measurement result.
Description
Technical Field
The invention relates to the technical field of broadband networks, in particular to network bandwidth speed measurement application for simplifying a Linux TCP protocol stack.
Background
In recent years, as operators use FTTH to popularize and apply home broadband networks on a large scale, the home broadband rate of users is greatly improved, the downlink bandwidth of some users reaches 1Gbps. Wherein the network bandwidth test tool on the router realizes the test of the available bandwidth of the user router. The speed measurement software on the household router downloads a speed measurement file erected on a speed measurement server by an operator through a TCP protocol to calculate the downlink bandwidth of the user.
For the domestic router adopting the Linux TCP protocol stack, because the Linux TCP protocol stack is huge, and the TCP packet processing process is complex, the problems of too high CPU utilization rate, low speed measurement rate and the like during downloading can be caused, and the actual bearing capacity of the broadband network cannot be reflected.
Disclosure of Invention
The invention aims to provide a method for simplifying a Linux TCP protocol stack to realize the processing process of checking a received speed measurement packet in a Linux, reduce packet processing paths and copy operations of the packet in an internal memory, thereby saving the processing resources of a household router CPU and obtaining a higher speed measurement result so as to solve the problems in the background technology.
In order to achieve the purpose, the invention provides the following technical scheme:
a speed measurement application of network bandwidth of a simplified Linux TCP protocol stack is characterized in that firstly, a Linux kernel socket in a router initiates a speed measurement request according to speed measurement parameters configured by an operator, and the current speed measurement mode is that a speed measurement file is downloaded to a speed measurement server by using an HTTP protocol to calculate the downstream speed of a broadband; after the Linux kernel socket establishes a TCP connection with the operator speed measurement server through an HTTP protocol, corresponding TCP connection information is set to the Linux simplified protocol stack module, so that the Linux simplified protocol stack module can monitor and process data packets sent by a subsequent speed measurement server according to information configured by the Linux kernel socket, count information of downloaded data, and calculate specific downloading speed after downloading.
The Linux simplified protocol stack mainly comprises the following processing flows: a router network interface receives a TCP speed measurement data stream; when the data flow is judged to be the speed measuring data flow, firstly counting speed measuring flow information, then analyzing the sequence number information of the data packet, and comparing the sequence number information with the sequence number of the next packet expected by the currently maintained speed measuring data flow; and when the speed measurement data stream is not established by the kernel socket, processing the speed measurement data stream by a Linux protocol stack.
Comparing the received speed measurement packet sequence number with the expected next packet sequence number of the simplified Linux TCP protocol stack, and dividing into the following three conditions, specifically processing as follows:
4) the method comprises the steps of receiving a speed measurement data stream, counting the number of bytes downloaded from a speed measurement file, and judging whether the number of the bytes downloaded from the speed measurement file is less than the number of the next packet expected by the speed measurement data stream or not, if so, discarding the packet and sending an Acknowledgement (ACK) packet, wherein the expected next packet number in the ACK packet is still the number of the next packet expected by the speed measurement data stream.
5) If the sequence number of the currently received packet is greater than the sequence number of the Next packet expected by the tachometer data stream, discarding the packet, sending an acknowledgement packet (the ACK sequence number is still Next _ Seq), and inserting the sequence number and the length record of the packet into an out-of-sequence queue (oos _ queue) according to the sequence number of the packet from small to large, which indicates that there may be packet loss or delay in network transmission.
6) If the sequence number of the currently received packet is equal to the sequence number of the Next packet expected by the speed measurement data flow, discarding the packet, searching whether a packet with an adjacent sequence number exists in the out-of-sequence queue, selecting an adjacent maximum sequence number, updating the Next _ Seq, and sending a confirmation packet by using the new Next _ Seq.
And after downloading is finished, calculating the downloading rate according to the statistical downloading data information and the consumed time.
Further: the TCP window in the ACK packet may be of fixed size 2M.
Compared with the prior art, the invention has the advantages that: the method for simplifying the Linux TCP protocol stack is provided to realize the processing process of checking the received speed measurement packet in the Linux, and reduce the packet processing path and the copy operation of the packet in the memory, thereby saving the processing resource of the CPU of the home router and obtaining a higher speed measurement result.
Drawings
Fig. 1 is an overall architecture diagram of the present invention.
FIG. 2 is a processing flow chart of the Linux simplified protocol stack of the present invention.
FIG. 3 is a real-time flow chart of the method of the present invention.
Detailed Description
The technical solution of the present patent will be described in further detail with reference to the following embodiments.
Referring to fig. 1, a network bandwidth speed measurement application for simplifying a Linux TCP protocol stack, first, a Linux kernel socket in a router initiates a speed measurement request according to a speed measurement parameter configured by an operator, and a current speed measurement mode is to use an HTTP protocol to download a speed measurement file to a speed measurement server to calculate a broadband downlink speed; after the Linux kernel socket establishes a TCP connection with the operator speed measurement server through an HTTP protocol, corresponding TCP connection information (TCP port information and IP address information) is set to the Linux simplified protocol stack module, so that the Linux simplified protocol stack module can monitor and process data packets sent by a subsequent speed measurement server according to information (TCP quintuple information, source IP, destination IP, source port, destination port and protocol number) configured by the Linux kernel socket, count information of downloaded data, and calculate a specific downloaded rate after downloading is completed.
The Linux simplified protocol stack module is implemented by adding a Linux Hook function to a Linux TCP/IP protocol stack, and identifying the data stream according to the configured quintuple information of the speed measurement data stream and sending the data stream to a simplified protocol stack data packet processing function.
The Linux simplified protocol stack mainly comprises the following processing flows: a router network interface receives a TCP speed measurement data stream; when the data flow is judged to be the speed measuring data flow, firstly counting speed measuring flow information, then analyzing the sequence number information of the data packet, and comparing the sequence number information with the sequence number of the next packet expected by the currently maintained speed measuring data flow; and when the speed measurement data stream is not established by the kernel socket, processing the speed measurement data stream by a Linux protocol stack.
Comparing the received speed measurement packet sequence number with the expected next packet sequence number of the simplified Linux TCP protocol stack, and dividing into the following three conditions, specifically processing as follows:
1) the method comprises the steps of receiving a speed measurement data stream, counting the number of bytes downloaded from a speed measurement file, and judging whether the number of the bytes downloaded from the speed measurement file is less than the number of the next packet expected by the speed measurement data stream or not, if so, discarding the packet and sending an Acknowledgement (ACK) packet, wherein the expected next packet number in the ACK packet is still the number of the next packet expected by the speed measurement data stream.
2) If the sequence number of the currently received packet is greater than the sequence number of the Next packet expected by the tachometer data stream, discarding the packet, sending an acknowledgement packet (the ACK sequence number is still Next _ Seq), and inserting the sequence number and the length record of the packet into an out-of-sequence queue (oos _ queue) according to the sequence number of the packet from small to large, which indicates that there may be packet loss or delay in network transmission.
3) If the sequence number of the currently received packet is equal to the sequence number of the Next packet expected by the speed measurement data flow, discarding the packet, searching whether a packet with an adjacent sequence number exists in the out-of-sequence queue, selecting an adjacent maximum sequence number, updating the Next _ Seq, and sending a confirmation packet by using the new Next _ Seq.
And after downloading is finished, calculating the downloading rate according to the statistical downloading data information and the consumed time.
Further: the TCP window in the ACK packet may be of fixed size 2M.
Although the preferred embodiments of the present patent have been described in detail, the present patent is not limited to the above embodiments, and various changes can be made without departing from the spirit of the present patent within the knowledge of those skilled in the art.
Claims (7)
1. A network bandwidth speed measurement application for simplifying a Linux TCP protocol stack is characterized in that a Linux kernel socket in a router initiates a speed measurement request according to a speed measurement parameter configured by an operator; after the Linux kernel socket establishes a TCP connection with the operator speed measurement server through an HTTP protocol, corresponding TCP connection information is set to the Linux simplified protocol stack module, the Linux simplified protocol stack module can monitor and process data packets sent by a subsequent speed measurement server according to information configured by the Linux kernel socket, information of downloaded data is counted, and the specific downloading speed can be calculated after downloading is completed.
2. The network bandwidth velocimetry application of a simplified Linux TCP protocol stack of claim 1, wherein the Linux simplified protocol stack module functions specifically as: and adding a Linux Hook function to the Linux TCP/IP protocol stack, identifying the data stream according to the configured quintuple information of the speed measurement data stream, and sending the data stream to a simplified protocol stack data packet processing function.
3. The application of claim 1, wherein the corresponding TCP connection information includes TCP port information and IP address information.
4. The application of claim 1, wherein the information configured by the Linux kernel socket includes TCP quintuple information, a source IP, a destination IP, a source port, a destination port, and a protocol number.
5. The network bandwidth velocimetry application of a simplified Linux TCP protocol stack of claim 1, wherein the Linux simplified protocol stack mainly processes as follows: a router network interface receives a TCP speed measurement data stream; when the data flow is judged to be the speed measuring data flow, firstly counting speed measuring flow information, then analyzing the sequence number information of the data packet, and comparing the sequence number information with the sequence number of the next packet expected by the currently maintained speed measuring data flow; and when the speed measurement data stream is not established by the kernel socket, processing the speed measurement data stream by a Linux protocol stack.
6. The network bandwidth velocimetry application of a simplified Linux TCP protocol stack according to claim 5, wherein comparing the received velocimetry packet sequence number with the expected next packet sequence number of the simplified Linux TCP protocol stack is divided into the following three cases, which are specifically processed as follows:
1) if the sequence number of the currently received packet is smaller than the sequence number of the next packet expected by the speed measurement data flow, discarding the packet, and sending an Acknowledgement (ACK) packet, wherein the expected next packet sequence number in the ACK packet is still the sequence number of the next packet expected by the speed measurement data flow;
2) if the sequence number of the currently received packet is greater than the sequence number of the Next packet expected by the speed measurement data stream, discarding the packet, sending an acknowledgement packet (the ACK sequence number is still Next _ Seq), and inserting the sequence number and length record of the packet into an out-of-sequence queue (oos _ queue) according to the sequence number of the packet from small to large, which indicates that packet loss or delay is possible in network transmission;
3) if the sequence number of the currently received packet is equal to the sequence number of the Next packet expected by the speed measurement data flow, discarding the packet, searching whether a packet with an adjacent sequence number exists in the out-of-sequence queue, selecting an adjacent maximum sequence number, updating the Next _ Seq, and sending a confirmation packet by using the new Next _ Seq.
7. The application of claim 6, wherein the TCP window in the ACK packet may be a fixed size of 2M.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110976596.9A CN113676378B (en) | 2021-08-24 | 2021-08-24 | Network bandwidth speed measuring method for simplifying Linux TCP protocol stack |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110976596.9A CN113676378B (en) | 2021-08-24 | 2021-08-24 | Network bandwidth speed measuring method for simplifying Linux TCP protocol stack |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN113676378A true CN113676378A (en) | 2021-11-19 |
| CN113676378B CN113676378B (en) | 2024-05-24 |
Family
ID=78545758
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202110976596.9A Active CN113676378B (en) | 2021-08-24 | 2021-08-24 | Network bandwidth speed measuring method for simplifying Linux TCP protocol stack |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN113676378B (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN118972472A (en) * | 2024-10-21 | 2024-11-15 | 麒麟软件有限公司 | A socket network communication optimization method, system and medium |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106878107A (en) * | 2017-02-28 | 2017-06-20 | 无锡研勤信息科技有限公司 | Based on the network bandwidth speed-measuring method that linux kernel drives |
| CN107707422A (en) * | 2017-08-24 | 2018-02-16 | 四川天邑康和通信股份有限公司 | The network speed-measuring method replied based on the quick ACK of ONU driving layers |
| CN108540333A (en) * | 2017-03-02 | 2018-09-14 | 中兴通讯股份有限公司 | The method of measurement network side handling capacity, home gateway, apparatus and system |
| CN111565131A (en) * | 2020-04-22 | 2020-08-21 | 烽火通信科技股份有限公司 | Speed measuring method and system for household gateway CPU |
-
2021
- 2021-08-24 CN CN202110976596.9A patent/CN113676378B/en active Active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106878107A (en) * | 2017-02-28 | 2017-06-20 | 无锡研勤信息科技有限公司 | Based on the network bandwidth speed-measuring method that linux kernel drives |
| CN108540333A (en) * | 2017-03-02 | 2018-09-14 | 中兴通讯股份有限公司 | The method of measurement network side handling capacity, home gateway, apparatus and system |
| CN107707422A (en) * | 2017-08-24 | 2018-02-16 | 四川天邑康和通信股份有限公司 | The network speed-measuring method replied based on the quick ACK of ONU driving layers |
| CN111565131A (en) * | 2020-04-22 | 2020-08-21 | 烽火通信科技股份有限公司 | Speed measuring method and system for household gateway CPU |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN118972472A (en) * | 2024-10-21 | 2024-11-15 | 麒麟软件有限公司 | A socket network communication optimization method, system and medium |
Also Published As
| Publication number | Publication date |
|---|---|
| CN113676378B (en) | 2024-05-24 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| EP4013016B1 (en) | Automated network diagnostic techniques | |
| KR100990340B1 (en) | Packet Routing in a Wireless Communication Environment | |
| US7555548B2 (en) | Method and apparatus for efficient data collection | |
| WO2019144836A1 (en) | Data transmission method, apparatus and system | |
| US20020078164A1 (en) | System and method for data transfer acceleration in a TCP network environment | |
| CN115499230A (en) | Network attack detection method and device, equipment and storage medium | |
| CN114006937A (en) | Dynamic prediction and management of application service level agreements | |
| CN103945455A (en) | Method and device for sending self-adaptive heartbeat data packets | |
| CN111601335B (en) | Wireless network performance test method and wireless AP | |
| CN117354252A (en) | Data transmission processing method and device, storage medium and electronic device | |
| CN113676378B (en) | Network bandwidth speed measuring method for simplifying Linux TCP protocol stack | |
| CN101888303B (en) | Recording method of network traffic information and related device | |
| CN103095531B (en) | Method, device and gateway equipment for bandwidth measurement | |
| CN1860734A (en) | Method and apparatus for network throughput measurement | |
| CN119652829A (en) | A TCP connection information management method and device based on Netlink | |
| CN117439713A (en) | A reliable transmission method for radar data | |
| CN107733903B (en) | Data transmission confirmation method based on UDP (user Datagram protocol) and base station | |
| CN115001999B (en) | A network status detection method in wireless ad hoc networks | |
| WO2023173876A1 (en) | Data communication method and apparatus, device and medium | |
| CN113691410B (en) | Network performance data acquisition method, device and server | |
| US9143458B2 (en) | Network device, method for controlling the network device, and network system | |
| Kabir et al. | A Comprehensive Study on Different Variants of TCP Protocol in Wireless Network | |
| CN114567603A (en) | Message transmission method, message transmission device, electronic equipment and storage medium | |
| CN113840310A (en) | Optimal control method for curvature acceleration | |
| CN107222299A (en) | A kind of data transmission method, system 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 |