+

CN113676378B - Network bandwidth speed measuring method for simplifying Linux TCP protocol stack - Google Patents

Network bandwidth speed measuring method for simplifying Linux TCP protocol stack Download PDF

Info

Publication number
CN113676378B
CN113676378B CN202110976596.9A CN202110976596A CN113676378B CN 113676378 B CN113676378 B CN 113676378B CN 202110976596 A CN202110976596 A CN 202110976596A CN 113676378 B CN113676378 B CN 113676378B
Authority
CN
China
Prior art keywords
packet
linux
sequence number
protocol stack
speed measurement
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
CN202110976596.9A
Other languages
Chinese (zh)
Other versions
CN113676378A (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.)
Xinhe Semiconductor Technology Wuxi Co Ltd
Original Assignee
Xinhe Semiconductor Technology Wuxi 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 Xinhe Semiconductor Technology Wuxi Co Ltd filed Critical Xinhe Semiconductor Technology Wuxi Co Ltd
Priority to CN202110976596.9A priority Critical patent/CN113676378B/en
Publication of CN113676378A publication Critical patent/CN113676378A/en
Application granted granted Critical
Publication of CN113676378B publication Critical patent/CN113676378B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0876Network utilisation, e.g. volume of load or congestion level
    • H04L43/0894Packet rate
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/163In-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 measurement method for simplifying a Linux TCP protocol stack, which comprises the steps that firstly, a kernel socket in a router initiates a speed measurement request according to speed measurement parameters configured by an operator; when the kernel socket establishes TCP connection with the operator speed measuring server through 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 the data package sent by the subsequent speed measuring server according to the information configured by the kernel socket, statistics is carried out on information of downloaded data, and the specific downloading speed can be calculated after downloading is completed. The invention reduces the packet processing path and the copying operation of the packet in the memory, thereby saving the processing resource of the CPU of the home router and obtaining higher speed measurement result.

Description

Network bandwidth speed measuring method for simplifying Linux TCP protocol stack
Technical Field
The invention relates to the technical field of broadband networks, in particular to a network bandwidth speed measurement method for simplifying a Linux TCP protocol stack.
Background
In recent years, with the large-scale popularization and application of the home broadband network by using the FTTH by operators, the home broadband rate of users is greatly improved, and the downlink bandwidth of some users reaches 1Gbps. Wherein the network bandwidth testing tool on the router enables testing of the bandwidth available to the subscriber router. The speed measuring software on the home router downloads the speed measuring file erected on the speed measuring server by the operator through the TCP protocol to calculate the downlink bandwidth of the user.
For a home router adopting a Linux TCP protocol stack, the Linux TCP protocol stack is huge, and the TCP packet processing process is complex, so that the problems of excessively high CPU utilization rate, low speed measurement rate and the like during downloading can be caused, and the actual bearing capacity of a broadband network can not 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 a Linux kernel check received speed measuring packet, reduce the packet processing path and the copying operation of the packet in a memory, thereby saving the processing resources of a CPU of a home router, and obtaining higher speed measuring results to solve the problems in the background technology.
In order to achieve the above purpose, the present invention provides the following technical solutions:
A network bandwidth speed measurement method for simplifying Linux TCP protocol stack, firstly, 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 to download a speed measurement file from an HTTP protocol to a speed measurement server to calculate the downlink speed of a broadband; when Linux kernel socket establishes TCP connection with the operator speed measuring server through HTTP protocol, corresponding TCP connection information is set to Linux simplified protocol stack module, so that Linux simplified protocol stack module can monitor and process data package sent by subsequent speed measuring server according to Linux kernel socket configured information, statistics of information of downloaded data is carried out, and specific downloading rate can be calculated after downloading is completed.
The Linux simplified protocol stack mainly comprises the following processing flows: the router network interface receives the TCP speed measurement data stream; after the data stream is judged to be the speed-measuring data stream, firstly counting speed-measuring stream information, then analyzing sequence number information of a data packet, and comparing the sequence number information with the sequence number of the next packet expected by the current maintenance speed-measuring data stream; and when judging that the speed measurement data stream established by the kernel socket is not the speed measurement data stream established by the kernel socket, processing the speed measurement data stream by a Linux protocol stack.
Comparing the received speed measuring packet sequence number with the expected next packet sequence number of the simplified Linux TCP protocol stack, the method is divided into the following three cases, and the specific processing is as follows:
If the sequence number of the current 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 sequence number of the next packet in the ACK packet is still the sequence number of the next packet expected by the speed measurement data flow.
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 flow, 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 the packet may be lost or delayed in network transmission.
If the sequence number of the current received packet is equal to the sequence number of the Next packet expected by the speed measurement data flow, discarding the packet, searching whether the packet with the adjacent sequence number exists in the out-of-sequence queue, selecting the adjacent maximum sequence number, updating the next_seq, and sending a confirmation packet by using the new next_seq.
And after the downloading is completed, calculating the downloading rate according to the counted information of the downloaded data and the time consumption.
Further: the TCP window in the ACK packet may take a fixed size of 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 the Linux inner core to the received speed measuring packet, reduce the packet processing path and the copying operation of the packet in the memory, thereby saving the processing resource of the CPU of the home router and obtaining higher speed measuring result.
Drawings
Fig. 1 is a diagram of the overall architecture of the present invention.
FIG. 2 is a flow chart of the processing 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 scheme of the patent is further described in detail below with reference to the specific embodiments.
Referring to fig. 1, a network bandwidth speed measurement method for simplifying a Linux TCP protocol stack, firstly, linux kernel socket in a router initiates a speed measurement request according to a speed measurement parameter configured by an operator, and the current speed measurement mode is to download a speed measurement file to a speed measurement server by using an HTTP protocol to calculate a broadband downlink speed; when Linux kernel socket establishes a TCP connection with the carrier speed measurement server through the 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 the data packet sent by the subsequent speed measurement server according to the information (TCP quintuple information, source IP, destination IP, source port, destination port and protocol number) configured by Linux kernel socket, count the information of downloaded data, and calculate the specific downloading rate after the 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 flow according to the five-tuple information of the configured speed measurement data flow and sending the data flow to a simplified protocol stack data packet processing function.
The Linux simplified protocol stack mainly comprises the following processing flows: the router network interface receives the TCP speed measurement data stream; after the data stream is judged to be the speed-measuring data stream, firstly counting speed-measuring stream information, then analyzing sequence number information of a data packet, and comparing the sequence number information with the sequence number of the next packet expected by the current maintenance speed-measuring data stream; and when judging that the speed measurement data stream established by the kernel socket is not the speed measurement data stream established by the kernel socket, processing the speed measurement data stream by a Linux protocol stack.
Comparing the received speed measuring packet sequence number with the expected next packet sequence number of the simplified Linux TCP protocol stack, the method is divided into the following three cases, and the specific processing is as follows:
If the sequence number of the current 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 sequence number of the next packet in the ACK packet is still the sequence number of the next packet expected by the speed measurement data flow.
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 flow, 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 the packet may be lost or delayed in network transmission.
If the sequence number of the current received packet is equal to the sequence number of the Next packet expected by the speed measurement data flow, discarding the packet, searching whether the packet with the adjacent sequence number exists in the out-of-sequence queue, selecting the adjacent maximum sequence number, updating the next_seq, and sending a confirmation packet by using the new next_seq.
And after the downloading is completed, calculating the downloading rate according to the counted information of the downloaded data and the time consumption.
Further: the TCP window in the ACK packet may take a fixed size of 2M.
While 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 may be made without departing from the spirit of the present patent within the knowledge of one of ordinary skill in the art.

Claims (5)

1. A network bandwidth speed measurement method for simplifying a Linux TCP protocol stack is characterized in that Linux kernel socket in a router initiates a speed measurement request according to speed measurement parameters configured by an operator; when Linux kernel socket establishes TCP connection with the operator speed measuring server through HTTP protocol, corresponding TCP connection information is set to a Linux simplified protocol stack module, the Linux simplified protocol stack module can monitor and process the data package sent by the subsequent speed measuring server according to the information configured by Linux kernel socket, count the information of the downloaded data, and calculate the specific speed of the download after the downloading is completed;
The Linux simplified protocol stack mainly comprises the following processing flows: the router network interface receives the TCP speed measurement data stream; after the data stream is judged to be the speed-measuring data stream, firstly counting speed-measuring stream information, then analyzing sequence number information of a data packet, and comparing the sequence number information with the sequence number of the next packet expected by the current maintenance speed-measuring data stream; when judging that 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 measuring packet sequence number with the expected next packet sequence number of the simplified Linux TCP protocol stack, the method is divided into the following three cases, and the specific processing is as follows:
1) If the sequence number of the current 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 sequence number of the next packet expected 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 current received packet is larger than the sequence number of the Next packet expected by the speed measurement data flow, discarding the packet, sending an acknowledgement packet (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 the packet may be lost or delayed in network transmission;
3) If the sequence number of the current received packet is equal to the sequence number of the Next packet expected by the speed measurement data flow, discarding the packet, searching whether the packet with the adjacent sequence number exists in the out-of-sequence queue, selecting the adjacent maximum sequence number, updating the next_seq, and sending a confirmation packet by using the new next_seq.
2. The network bandwidth speed measurement method for simplifying a Linux TCP protocol stack according to claim 1, wherein the Linux simplified protocol stack module has the following functions: and adding a Linux Hook function to the Linux TCP/IP protocol stack, identifying the data flow according to the five-tuple information of the configured speed measurement data flow, and sending the data flow to a simplified protocol stack data packet processing function.
3. The method for network bandwidth speed measurement by simplifying a Linux TCP protocol stack according to claim 1, wherein the corresponding TCP connection information includes TCP port information and IP address information.
4. The method for network bandwidth speed measurement by simplifying a Linux TCP protocol stack according to claim 1, wherein said Linux kernel socket configured information includes TCP quintuple information, source IP, destination IP, source port, destination port and protocol number.
5. The method for network bandwidth speed measurement by simplifying the Linux TCP protocol stack according to claim 1, wherein the TCP window in the ACK packet may be a fixed size of 2M.
CN202110976596.9A 2021-08-24 2021-08-24 Network bandwidth speed measuring method for simplifying Linux TCP protocol stack Active CN113676378B (en)

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 CN113676378A (en) 2021-11-19
CN113676378B true 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)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118972472B (en) * 2024-10-21 2025-01-21 麒麟软件有限公司 A socket network communication optimization method, system and medium

Citations (4)

* Cited by examiner, † Cited by third party
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

Patent Citations (4)

* Cited by examiner, † Cited by third party
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

Also Published As

Publication number Publication date
CN113676378A (en) 2021-11-19

Similar Documents

Publication Publication Date Title
EP4013016B1 (en) Automated network diagnostic techniques
KR100990340B1 (en) Packet Routing in a Wireless Communication Environment
CN106815112B (en) Massive data monitoring system and method based on deep packet inspection
KR100990054B1 (en) Provision of QoS processing based on multiple requests
Liu et al. On improving TCP performance over mobile data networks
CN115499230A (en) Network attack detection method and device, equipment and storage medium
CN114006937B (en) Dynamic prediction and management of application service level agreements
US20020078164A1 (en) System and method for data transfer acceleration in a TCP network environment
US20180349803A1 (en) Dynamically optimized transport system
WO2019144836A1 (en) Data transmission method, apparatus and system
CN113676361A (en) On-demand probes for quality of experience metrics
CN107645398A (en) A kind of method and apparatus of diagnostic network performance and failure
US20180343182A1 (en) Network traffic capture analysis
CN113452676B (en) A detector allocation method and Internet of things detection system
CN103945455A (en) Method and device for sending self-adaptive heartbeat data packets
CN113676378B (en) Network bandwidth speed measuring method for simplifying Linux TCP protocol stack
CN111601335B (en) Wireless network performance test method and wireless AP
CN117354252A (en) Data transmission processing method and device, storage medium and electronic device
CN119652829A (en) A TCP connection information management method and device based on Netlink
EP4383668A1 (en) System and method for measuring and managing latency on a computer network
CN102480503B (en) P2P (peer-to-peer) traffic identification method and P2P traffic identification device
EP4005166B1 (en) Traffic monitoring in a network node
CN112367265A (en) Reliable data transmission method and device suitable for narrow-band weak connection network
CN117439713A (en) A reliable transmission method for radar data
CN107733903B (en) Data transmission confirmation method based on UDP (user Datagram protocol) and base station

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
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载