Routing port allocation method and data flow identification method

By grouping the ports of mobile wireless routers, the problem of high processor resource usage under multi-terminal connections is solved, the data flow direction can be identified before port conversion, and data processing efficiency and traffic balance are improved.

CN114945201BActive Publication Date: 2025-09-23SPREADTRUM SEMICON(CHENGDU) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210765030.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-30
Publication Date
2025-09-23
Estimated Expiration
2042-06-30

AI Technical Summary

Technical Problem

When multiple terminals are connected to a mobile wireless router, it is difficult to achieve traffic balancing without increasing processor occupancy time with existing technologies. In particular, during the downlink data packet identification process, processor resources are excessively occupied.

Method used

By grouping available ports and allocating a group of ports to each terminal, establishing a port allocation list and a usage status list, the target terminal of downlink data is identified to achieve traffic balancing and reduce processor usage time.

Benefits of technology

Identifying the target terminal of downlink data before port conversion reduces processor occupancy time, improves data processing efficiency, and achieves balanced distribution of traffic.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114945201B_ABST
    Figure CN114945201B_ABST
Patent Text Reader

Abstract

The present invention provides a routing port allocation method, which is executed on a routing device and includes: grouping available ports and forming a usage status list to record the current usage status of each group of ports; establishing and maintaining a port allocation list to record the correspondence between terminals and port groups; when a terminal is successfully connected, allocating a group of ports to the terminal according to the usage status list, and updating the usage status list and port allocation list; when a terminal is disconnected, deleting the corresponding record entry from the port allocation list and updating the usage status list. The present invention also provides a data flow direction identification method. The routing port allocation method and data flow direction identification method provided by the present invention can obtain the terminal corresponding to the downlink data before port conversion and achieve traffic balancing, reducing processor occupancy time and improving data processing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a routing port allocation method and a data flow direction identification method. Background Art

[0002] When multiple terminals are connected to a mobile wireless router, traffic sharing and competition occur. To ensure that all connected terminals can access the Internet normally, traffic balancing is necessary. If a terminal's traffic usage exceeds the average, its speed must be limited, for example, by reducing packet loss.

[0003] In a mobile wireless router implemented on a real-time operating system based on a shared core of an application processor and a communication processor, when multiple terminals access the Internet simultaneously, the system processor usage time is already very high. To achieve traffic balancing and minimize processor usage time, traffic balancing must be performed immediately after the TCP / IP protocol stack receives uplink and downlink data, rather than performing traffic balancing after entering the protocol stack and completing a series of processes such as Demux, routing, and NAPT conversion.

[0004] To balance traffic across terminals, the first step is to identify the direction of TCP / IP data packets—that is, to determine which terminal the packet is originating from. For uplink data, the TCP / IP protocol stack can identify the originating terminal before NAPT conversion, eliminating the need for special processing. For downlink data, the destination address is the IP address of the mobile wireless router's external network card, requiring NAPT conversion to determine the destination terminal. In this case, the destination of downlink data can only be determined after NAPT conversion, which inevitably increases processor usage. Summary of the Invention

[0005] The routing port allocation method and data flow direction identification method provided by the present invention can obtain the terminal corresponding to the downlink data before port conversion and achieve flow balance, reduce the processor's occupancy time, and improve data processing efficiency.

[0006] In a first aspect, the present invention provides a routing port allocation method, executed on a routing device, comprising:

[0007] Group the available ports and form a usage status list to record the current usage status of each group of ports;

[0008] Establish and maintain a port allocation list to record the correspondence between terminals and port groups;

[0009] When the terminal is successfully connected, a group of ports is allocated to the terminal according to the usage status list, and the usage status list and the port allocation list are updated;

[0010] When the terminal is disconnected, the corresponding record entry is deleted from the port allocation list, and the usage status list is updated.

[0011] Optionally, grouping the available ports includes:

[0012] Determine a number of reserved ports from available ports;

[0013] Available ports other than the reserved ports are grouped, with each group including at least one available port.

[0014] Optionally, grouping the available ports includes:

[0015] The available ports are grouped according to a maximum number of terminals that can be connected simultaneously to the routing device so that the number of the groups is the same as the maximum number of terminals.

[0016] Optionally, grouping the available ports includes:

[0017] The available ports are evenly grouped so that the number of available ports in each group is the same.

[0018] Optionally, the port numbers of the available ports in the same group are consecutive.

[0019] Optionally, the starting port number and the ending port number are used to determine the available ports in the same group.

[0020] Optionally, allocating a group of ports to the terminal according to the usage status list includes:

[0021] Any unused group in the usage status list is allocated to the terminal so as to use a port in the corresponding group during the port conversion process.

[0022] Optionally, using the ports in the corresponding group during the port conversion process includes:

[0023] When a terminal sends an uplink data packet, any port in the corresponding group is allocated to the terminal and recorded in the port conversion list, so that the server can reply a response message to the corresponding port.

[0024] In a second aspect, the present invention provides a method for identifying a data flow direction, which is executed in a routing device, wherein the routing device allocates ports according to any one of the methods described above, comprising:

[0025] Get the downlink data sent by the server;

[0026] Determining the group to which the target port belongs based on the downlink data;

[0027] A target terminal corresponding to the downlink data is determined based on the grouping.

[0028] Optionally, after determining the target terminal corresponding to the downlink data according to the grouping, the method further includes:

[0029] Determining whether the traffic of the target terminal exceeds the average traffic;

[0030] When the traffic of the target terminal exceeds the average traffic, discarding the downlink data;

[0031] When the traffic of the target terminal does not exceed the average traffic, the target address of the downlink data is port-translated and sent to the target terminal.

[0032] In the technical solution provided by the present invention, by grouping the available ports, a group of ports is allocated to each connected terminal. When the downlink data sent by the server is received, it is only necessary to determine which group the port of the downlink data corresponds to in order to identify the data flow direction. Therefore, the terminal traffic can be balanced before the port conversion, which can effectively reduce the processor's occupancy time and improve data processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 This is a flow chart of a method for allocating routing ports according to an embodiment of the present invention;

[0034] Figure 2 A flow chart of port grouping in a method for allocating routing ports according to another embodiment of the present invention;

[0035] Figure 3 This is a flowchart of a method for identifying data flow according to another embodiment of the present invention;

[0036] Figure 4 Flow chart of traffic balancing of a method for identifying data flow direction according to another embodiment of the present invention

[0037] Figure 5 This is an interactive diagram of a method for identifying data flow according to another embodiment of the present invention. DETAILED DESCRIPTION

[0038] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.

[0039] The embodiment of the present invention provides a routing port allocation method, which is executed on a routing device, such as Figure 1 As shown, including:

[0040] Step 100, grouping the available ports and forming a usage status list to record the current usage status of each group of ports;

[0041] In some embodiments, after the available ports are grouped, each group of ports corresponds to a terminal in the subsequent data uplink or downlink process. To ensure that each terminal has sufficient port resources, each group of ports has at least one available port. The usage status list is a list that records the usage status of each group of ports. The usage status list has the same number of entries as the number of groups, and each entry corresponds to the usage status of a group of ports. For example, the usage status list can take the following form:

[0042]

[0043]

[0044] Wherein, A is the number of groups, and B is the number of available ports in each group. In the above table, the same number of available ports in each group is used as an example. In other embodiments, the number of ports in each group may be different.

[0045] Step 200: Establish and maintain a port allocation list to record the correspondence between terminals and port groups;

[0046] In some embodiments, the port allocation list is a list indicating the correspondence between connected terminals and port groups. Since after a group of ports is allocated, the group of ports will be changed to the used status in the usage status list, each group of ports can only correspond to one terminal. The form of the port allocation list can be shown in the following table, for example:

[0047] Station IP Port range 192.168.1.2 1025~1025+B-1 192.168.1.3 1025+B~1025+2×B-1 192.168.1.4 1025+2×B~1025+3×B-1

[0048] Among them, Station ip is the intranet IP corresponding to the connected terminal, and B is the number of ports corresponding to a single group.

[0049] Step 310: When the terminal is successfully connected, a group of ports is allocated to the terminal according to the usage status list, and the usage status list and the port allocation list are updated;

[0050] In some embodiments, after a terminal successfully connects, an unused port group in the usage status list is assigned to the terminal. After the assignment is complete, the usage status of the corresponding port group is changed to used, and the correspondence between the terminal and the port group is added to the port allocation list. At this point, the terminal is not assigned to a specific port resource. Instead, when the terminal subsequently sends and receives data, a specific port resource is allocated from the corresponding group for occupation.

[0051] Step 320: When the terminal is disconnected, the corresponding record entry is deleted from the port allocation list, and the usage status list is updated.

[0052] In some embodiments, when a terminal is disconnected, the corresponding port group no longer corresponds to the terminal and should be deleted from the port allocation list. At this time, the status of the corresponding group in the usage status list is changed to an unused state so that it can be used when other terminals are connected later.

[0053] In this embodiment, an exemplary embodiment is provided to illustrate the change process of the port allocation list and the usage status list during the terminal connection and disconnection process, as follows:

[0054] In the initial state of the mobile wireless router, there is no terminal connected, so the usage status list at this time is as follows:

[0055] Port range Usage status (unused - False, used - True) 1025~1025+B-1 False 1025+B~1025+2×B-1 False 1025+2×B~1025+3×B-1 False 1025+4×B~1025+5×B-1 False 1025+4×B~1025+5×B-1 False …… ……

[0056] The port allocation list is as follows:

[0057] Station IP Port range null null

[0058] When the first terminal is connected, a port group is assigned to the terminal. The usage status list is as follows:

[0059]

[0060]

[0061] The port allocation list is as follows:

[0062] Station IP Port range 192.168.1.2 1025~1025+B-1

[0063] When the second terminal is connected, a port group is assigned to the terminal. The usage status list is as follows:

[0064] Port range Usage status (unused - False, used - True) 1025~1025+B-1 True 1025+B~1025+2×B-1 True 1025+2×B~1025+3×B-1 False 1025+4×B~1025+5×B-1 False 1025+4×B~1025+5×B-1 False …… ……

[0065] The port allocation list is as follows:

[0066] Station IP Port range 192.168.1.2 1025~1025+B-1 192.168.1.3 1025+B~1025+2×B-1

[0067] When the third terminal is connected, a port group is assigned to the terminal. The usage status list is as follows:

[0068]

[0069]

[0070] The port allocation list is as follows:

[0071] Station IP Port range 192.168.1.2 1025~1025+B-1 192.168.1.3 1025+B~1025+2×B-1 192.168.1.4 1025+2×B~1025+3×B-1

[0072] At this time, if the second terminal is disconnected, the corresponding entry in the port allocation list is deleted and the usage status list is updated. At this time, the usage status list is as follows:

[0073] Port range Usage status (unused - False, used - True) 1025~1025+B-1 True 1025+B~1025+2×B-1 False 1025+2×B~1025+3×B-1 True 1025+4×B~1025+5×B-1 False 1025+4×B~1025+5×B-1 False …… ……

[0074] The port allocation list is as follows:

[0075] Station IP Port range 192.168.1.2 1025~1025+B-1 192.168.1.4 1025+2×B~1025+3×B-1

[0076] When the fourth terminal is connected, a port group is assigned to the terminal. The usage status list is as follows:

[0077] Port range Usage status (unused - False, used - True) 1025~1025+B-1 True 1025+B~1025+2×B-1 True 1025+2×B~1025+3×B-1 True 1025+4×B~1025+5×B-1 False 1025+4×B~1025+5×B-1 False …… ……

[0078] The port allocation list is as follows:

[0079] Station IP Port range 192.168.1.2 1025~1025+B-1 192.168.1.4 1025+2×B~1025+3×B-1 192.168.1.5 1025+B~1025+2×B-1

[0080] The above exemplary embodiments exemplarily illustrate the changes in the port allocation list and the usage status list during the process of terminal connection and disconnection.

[0081] In the technical solution provided by the embodiment of the present invention, by grouping the available ports, a group of ports is allocated to each connected terminal. When the downlink data sent by the server is received, it is only necessary to determine which group the port of the downlink data corresponds to in order to identify the data flow direction. Therefore, the terminal traffic can be balanced before the port conversion, which can effectively reduce the processor's occupancy time and improve data processing efficiency.

[0082] As an optional implementation, Figure 2 As shown, in step 100, grouping the available ports includes:

[0083] Step 110, determining a number of reserved ports from the available ports;

[0084] In some embodiments, in a local area network, it is usually necessary to reserve some ports as reserved ports, and the reserved ports cannot be occupied. For example, when some terminals in the local area network need to use static ports, the ports configured by these terminals should not be dynamically occupied by other terminals, and should be reserved as reserved ports.

[0085] Step 120: Group the available ports other than the reserved ports, with each group including at least one available port.

[0086] In some embodiments, after the reserved ports are reserved, the other ports are grouped and dynamically used by the terminals connected to the routing device. In order to ensure that the terminals connected to the routing device have sufficient port resources, each group should have at least one available port.

[0087] In this embodiment, the reserved ports are kept from participating in the grouping, ensuring that terminals with special port requirements can use them normally.

[0088] As an optional implementation, in step 100, grouping the available ports includes:

[0089] Step 130: Group the available ports according to the maximum number of terminals that can be connected simultaneously to the routing device, so that the number of the groups is the same as the maximum number of terminals.

[0090] In some embodiments, when the number of groups of available ports is greater than the maximum number of terminals that a routing device can simultaneously connect to, some port resources will never be used, resulting in a waste of port resources. On the other hand, when the number of groups of available ports is less than the maximum number of terminals that a routing device can simultaneously connect to, the number of terminals that the routing device can simultaneously connect to will be reduced. Therefore, as a preferred embodiment, the number of groups of available ports should be the same as the maximum number of terminals that a routing device can simultaneously connect to.

[0091] As an optional implementation, in step 100, grouping the available ports includes:

[0092] Step 140: Evenly group the available ports so that the number of available ports in each group is the same.

[0093] In some embodiments, to ensure that each terminal connected to the routing device has sufficient port resources, in this embodiment, the available ports are evenly grouped to ensure that the number of available ports in each group is the same. In this grouping method, no matter which port group a terminal is assigned to, it has sufficient port resources.

[0094] As an optional implementation manner, the port numbers of the available ports in the same group are continuous.

[0095] In some embodiments, setting the port numbers of available ports in the same group to be consecutive can facilitate the management of port groups and also help reduce the information recorded in the port allocation list and the usage list.

[0096] As an optional implementation manner, the starting port number and the ending port number are used to determine the available ports in the same group.

[0097] In some embodiments, by determining the port grouping by means of the starting port number and the ending port number, the grouping maintenance of the ports can be achieved with minimal information, which is beneficial to saving storage and computing resources.

[0098] As an optional implementation, in step 310, allocating a group of ports to the terminal according to the usage status list includes:

[0099] Step 311: Allocate any unused group in the usage status list to the terminal, so that the port in the corresponding group is used during the port conversion process.

[0100] In some embodiments, any unused group in the usage status list may be allocated to a newly connected terminal. As a preferred method, for ease of management, groups with earlier port numbers are preferentially allocated to the newly connected terminal.

[0101] As an optional implementation, in step 310, using the ports in the corresponding group during the port translation process includes:

[0102] Step 312: When the terminal sends an uplink data packet, any port in the corresponding group is allocated to the terminal and recorded in the port conversion list, so that the server can reply a response message to the corresponding port.

[0103] In some embodiments, after completing the port grouping assignment, the terminal does not occupy specific port resources. The terminal typically occupies specific port resources when sending uplink data packets. However, the port grouping assignment limits the terminal's occupation of specific port resources when sending uplink data packets. When a terminal sends an uplink data packet, it can only occupy the port resources within the corresponding group.

[0104] The present invention also provides a method for identifying data flow direction, which is executed in a routing device, wherein the routing device allocates ports according to any one of the above methods, comprising:

[0105] Step 400: Obtain downlink data sent by the server;

[0106] In some embodiments, the server typically sends a message to the terminal in response to a request from the terminal. When the server sends the message, its target address is the IP address of the external network card of the routing device and has a specific port number.

[0107] Step 500, determining the group to which the target port belongs based on the downlink data;

[0108] In some embodiments, after obtaining the port number from the downlink data, the port allocation list can be queried to determine which group the port number corresponds to. Since the port group and the terminal are one-to-one corresponding, after knowing the port group, it is possible to further know which terminal the downlink data is destined for.

[0109] Step 600: Determine the target terminal corresponding to the downlink data based on the grouping.

[0110] In some embodiments, in the port allocation list, port groups correspond one-to-one to terminals. Once the port group is known in step 500, the corresponding terminal field in the same entry can be searched to determine which terminal the downlink data is destined for. Thus, the data flow direction can be determined before completing NAPT conversion.

[0111] In the technical solution provided by the embodiment of the present invention, by grouping the available ports, a group of ports is allocated to each connected terminal. When the downlink data sent by the server is received, it is only necessary to determine which group the port of the downlink data corresponds to in order to identify the data flow direction. Therefore, the terminal traffic can be balanced before the port conversion, which can effectively reduce the processor's occupancy time and improve data processing efficiency.

[0112] As an optional implementation, Figure 4 As shown, in step 600, after determining the target terminal corresponding to the downlink data according to the grouping, the method further includes:

[0113] Step 700, determining whether the traffic of the target terminal exceeds the average traffic;

[0114] In some embodiments, when multiple terminals are connected to a routing device, traffic sharing and competition may occur. To ensure that all connected terminals can access the internet normally, traffic balancing is necessary. If a terminal's traffic usage exceeds the average, its speed may need to be limited. Therefore, in this embodiment, after determining the downlink data flow, the target terminal's traffic flow is determined.

[0115] Step 710: When the traffic of the target terminal exceeds the average traffic, the downlink data is discarded;

[0116] In some embodiments, when the traffic of the target terminal exceeds the average traffic, the target terminal should be speed-limited, which can be achieved by discarding the downlink data.

[0117] Step 720: When the traffic of the target terminal does not exceed the average traffic, the target address of the downlink data is port-translated and sent to the target terminal.

[0118] In some embodiments, when the traffic of the target terminal does not exceed the average traffic, there is no need to limit the speed of the target terminal, and the downlink data can be directly converted and sent normally.

[0119] Figure 5 An exemplary method for identifying the direction of data flow is shown, such as Figure 5 As shown in the figure, for downlink data sent by the server, the routing device first determines which terminal the downlink data is sent to based on the port number and then directly performs traffic balancing based on the determination result. In other words, traffic balancing can be achieved without performing NAPT conversion, thereby reducing processor usage and improving processor efficiency.

[0120] Those skilled in the art will appreciate that all or part of the processes in the above method embodiments can be implemented by instructing related hardware through a computer program. The program can be stored in a computer-readable storage medium, and when executed, the program can include the processes in the above method embodiments. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0121] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.

Claims

1. A routing port allocation method, characterized in that: Executed on routing devices, including: Group the available ports and form a usage status list to record the current usage status of each group of ports; Establish and maintain a port allocation list to record the correspondence between terminals and port groups; where each port group corresponds to only one connected terminal; When a terminal is successfully connected, a group of ports is allocated to the terminal according to the usage status list, and the usage status list and the port allocation list are updated; and when downlink data is received from the server, the data flow direction is identified according to the port grouping corresponding to the port of the downlink data, and traffic balancing is performed on the terminal before port conversion; When the terminal is disconnected, the corresponding record entry is deleted from the port allocation list, and the usage status list is updated.

2. The method according to claim 1, characterized in that The grouping of available ports includes: Determine a number of reserved ports from available ports; Available ports other than the reserved ports are grouped, with each group including at least one available port.

3. The method according to claim 1, characterized in that The grouping of available ports includes: The available ports are grouped according to a maximum number of terminals that can be connected simultaneously to the routing device so that the number of the groups is the same as the maximum number of terminals.

4. The method according to claim 1, wherein The grouping of available ports includes: The available ports are evenly grouped so that the number of available ports in each group is the same.

5. The method according to claim 1, wherein The port numbers of available ports in the same group are consecutive.

6. The method according to claim 5, characterized in that The available ports in the same group are determined using the starting port number and the ending port number.

7. The method according to claim 1, characterized in that Allocating a group of ports to the terminal according to the usage status list includes: Any unused group in the usage status list is allocated to the terminal so as to use a port in the corresponding group during the port conversion process.

8. The method according to claim 1, characterized in that The use of ports in the corresponding group during the port conversion process includes: When a terminal sends an uplink data packet, any port in the corresponding group is allocated to the terminal and recorded in the port conversion list, so that the server can reply a response message to the corresponding port.

9. A method for identifying data flow direction, characterized in that: Executed in a routing device, the routing device assigns ports according to the method according to any one of claims 1 to 8, comprising: Get the downlink data sent by the server; Determining the group to which the target port belongs based on the downlink data; A target terminal corresponding to the downlink data is determined based on the grouping.

10. The method according to claim 9, characterized in that After determining the target terminal corresponding to the downlink data according to the grouping, the method further includes: Determining whether the traffic of the target terminal exceeds the average traffic; When the traffic of the target terminal exceeds the average traffic, discarding the downlink data; When the traffic of the target terminal does not exceed the average traffic, the target address of the downlink data is port-translated and sent to the target terminal.

Citation Information

Patent Citations

  • Systems And Methods For Processing Packets In A Computer Network

    CN107710700A

  • Congestion avoidance in network device

    CN109479032A

  • Target port determination method, apparatus and device, and readable storage medium

    CN111447300A