Method for routing data packets and electronic device

CN116962292BActive Publication Date: 2026-10-09MEDIATEK INC
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211080387.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2022-04-19
Filing Date
2022-09-05
Publication Date
2026-10-09
Estimated Expiration
2042-09-05

AI Technical Summary

Technical Problem

[0003]然而,由于每32秒发送一次保活封包,所以应用微控制器每32秒从挂起模式(suspend mode)离开一次,导致路由器的功耗增加

Benefits of technology

[0006] By utilizing this invention, data packets can be routed more effectively.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116962292B_ABST
    Figure CN116962292B_ABST
Patent Text Reader

Abstract

An aspect of the present application can provide a method for routing data packets, applied to a router, the router comprising a software NAT and a hardware NAT. The method can comprise: routing, by the software NAT, a first data packet according to a routing rule stored in the software NAT, wherein the software NAT has a routing rule removal function for removing the routing rule stored in the software NAT; sending, by the software NAT, the routing rule to the hardware NAT; storing, by the hardware NAT, the routing rule in the hardware NAT; and routing, by the hardware NAT but not the software NAT, a second data packet according to the routing rule stored in the hardware NAT. Wherein the routing rule removal function of the software NAT is disabled for the routing rule stored in the software NAT. By using the present application, data packets can be better routed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to power-saving methods, and more particularly to power-saving methods and electronic devices applied to routers. Background Technology

[0002] Currently, routers are used to translate Internet Protocol (IP) addresses of data packets in an intranet to IP addresses of data packets in an extranet. Routers can include an application microcontroller and a hardware Network Address Translator (NAT). The hardware NAT offloads the NAT translation from the Linux Network Stack of the application microcontroller, but needs to send a keep-alive packet to the application microcontroller every 32 seconds so that the application microcontroller can maintain connection tracking and remember the link via data packets.

[0003] However, because a keep-alive packet is sent every 32 seconds, the application microcontroller exits suspend mode every 32 seconds, resulting in increased power consumption for the router. Summary of the Invention

[0004] To address the aforementioned problems, the present invention provides a method for routing data packets, applied to a router. The router includes a software network address converter (NAT) and a hardware NAT. The method includes: the software NAT routing a first data packet according to routing rules stored in the software NAT, wherein the software NAT has a routing rule removal function for removing routing rules stored in the software NAT; the software NAT sending the routing rules to the hardware NAT; the hardware NAT storing the routing rules in the hardware NAT; and the hardware NAT, instead of the software NAT, routing a second data packet according to the routing rules stored in the hardware NAT, wherein the routing rule removal function of the software NAT is disabled for the routing rules stored in the software NAT.

[0005] The present invention can also provide an electronic device for routing data packets, including a software network address converter and a hardware network address converter, wherein the software network address converter routes a first data packet according to routing rules stored in the software network address converter, wherein the software network address converter has a routing rule removal function for removing routing rules stored in the software network address converter; the software network address converter sends the routing rules to the hardware network address converter; the hardware network address converter receives the routing rules from the software network address converter and stores the routing rules in the hardware network address converter; and the hardware network address converter, instead of the software network address converter, routes a second data packet according to the routing rules stored in the hardware network address converter, wherein the routing rule removal function of the software network address converter is disabled for the routing rules stored in the software network address converter.

[0006] By utilizing this invention, data packets can be routed more effectively. Attached Figure Description

[0007] The invention can be more fully understood by referring to the following detailed description with reference to the accompanying drawings. It should be understood that the drawings may not be drawn to scale according to industry standard practice. In fact, the dimensions of components are allowed to be arbitrarily enlarged or reduced for clarity of illustration. This means that many specific details, relationships, and methods can be disclosed to provide a complete understanding of the invention.

[0008] Figure 1 This is a flowchart of a method for routing data packets for a router according to some embodiments of the present invention, wherein the router includes software NAT and hardware NAT.

[0009] Figure 2 This is a schematic diagram of an electronic device 200 according to some embodiments of the present invention.

[0010] Figure 3 According to some embodiments of the present invention, Figure 1 The method in [the text] is applied to Figure 2 The flowchart of electronic device 200 in the process. Detailed Implementation

[0011] Some terms are used to refer to specific elements in the specification and claims. Those skilled in the art should understand that hardware manufacturers may use different terms to refer to the same components. The specification and claims of this invention are not intended to distinguish these elements by differences in name, but rather by differences in the functionality of the elements. The terms "comprising" and "including" as used throughout the specification and claims are open-ended terms and can therefore be understood as "including but not limited to". "Generally" can mean that within an acceptable margin of error, those skilled in the art can solve the technical problem and substantially achieve the technical effect within a certain margin of error. Furthermore, the term "coupled" in this invention can include any direct and indirect electrical connection. Therefore, if the text describes a first device coupled to a second device, it means that the first device can be directly electrically connected to the second device, or indirectly electrically connected to the second device through other devices or connection methods.

[0012] The following detailed embodiments may be the preferred embodiments of the present invention. The detailed embodiments section is used to illustrate the general principles of the invention and should not be used to limit the invention. The scope of protection of the present invention is determined by the scope of the claims.

[0013] Figure 1 This is a flowchart of a method for routing data packets using a router according to some embodiments of the present invention, wherein the router includes a software NAT and a hardware NAT. In some embodiments, the hardware NAT can receive data packets related to routing rules and pass the data packets to the software NAT according to the routing rules. In some embodiments, the routing rules can include the source of the data packets, the destination of the data packets, and the type of the data packets. In some embodiments, if two sets of data packets have different sources, different destinations, or different types, the two sets of data packets can be associated with different routing rules. In some embodiments, after the hardware NAT receives a data packet associated with a routing rule, the hardware NAT can check whether the routing rule is recorded in the connection table of the hardware NAT. If so, the hardware NAT can directly send the data packet to the corresponding destination. If not, the hardware NAT can pass the data packet to the software NAT. In some embodiments, the hardware NAT can have a routing rule removal function for removing routing rules stored in the hardware NAT. In some embodiments, the hardware NAT can determine whether to remove the routing rules it stores based on the timeout in the hardware NAT.

[0014] Software NAT can determine whether to send a routing rule to hardware NAT based on a threshold number of data packets associated with the routing rule received by the software NAT from the hardware NAT within a predetermined time period. In some embodiments, this threshold number can be an integer between 1 and 5. In some embodiments, the software NAT can store the routing rule in its own connection table and may have a routing rule removal function to remove routing rules originally stored in the software NAT. In some embodiments, the software NAT can determine whether to remove its own stored routing rule based on a timeout period in the software NAT.

[0015] like Figure 1 As shown, the method of the present invention may include routing a first data packet by a software NAT according to routing rules stored in the software NAT. The software NAT may have a routing rule removal function to remove routing rules stored in the software NAT. The routing rule removal function for routing rules stored in the software NAT may be disabled (step S100). The software NAT may send the routing rules to the hardware NAT (step S102). The hardware NAT may store the routing rules in the hardware NAT (step S104). The hardware NAT, instead of the software NAT, routes the second data packet according to the routing rules stored in the hardware NAT (step S106).

[0016] In step S100, the software NAT can route data packets based on routing rules stored in the software NAT. In some embodiments, routing rules can be stored in a connection table of the software NAT. The connection table may reside in the memory of the software NAT. In some embodiments, the software NAT may be an application microcontroller, but the invention is not limited thereto. In some embodiments, the software NAT may have a routing rule removal function for removing routing rules stored in the software NAT. In the routing rule removal function, the software NAT can use a timeout period (set in the software NAT) to determine whether to remove the routing rule stored in the software NAT. For example, if the software NAT has not received any data packets associated with a routing rule for a period longer than the timeout period, the software NAT could originally remove the routing rule. However, in some embodiments of the invention, the routing rule removal function for routing rules stored in the software NAT is disabled. Therefore, even if the software NAT has not received any data packets associated with a routing rule for a period longer than the timeout period, the software NAT may not remove the routing rule, thereby saving the computational resources of the software NAT. In other words, because the routing rule is still stored in the software NAT, the software NAT does not need to prepare routing rules again for the received data packets associated with the same routing rule (e.g., look up routing rules from communication commands between users).

[0017] In some embodiments, the timeout period for software NAT to determine whether to remove routing rules stored in the software NAT can be set to a maximum timeout period (e.g., 65535). In some embodiments, the timeout period for software NAT to determine whether to remove routing rules stored in the software NAT can be disabled.

[0018] In step S102, the software NAT can send the routing rule to the hardware routing rule. In some embodiments, the software NAT can send the routing rule to the hardware NAT based on a threshold number of data packets associated with the routing rule received by the software NAT from the hardware NAT within a predetermined time. For example, the threshold number can be an integer between 1 and 5. The smaller the threshold number of data packets, the easier it is for the software NAT to send the routing rule to the hardware NAT. For example, if the threshold number of data packets is set to 1, the software NAT can send the routing rule to the hardware NAT when it receives one data packet associated with the routing rule from the hardware NAT (e.g., one received within 1 second). If the threshold number of data packets is set to 5, the software NAT can send the routing rule to the hardware NAT when it receives 10 data packets associated with the routing rule from the hardware NAT (e.g., 10 received within 1 second). However, when the software NAT receives 4 data packets associated with the routing rule from the hardware NAT (e.g., 4 received within 1 second), the software NAT will not send the updated routing rule to the hardware NAT. In some embodiments, hardware NAT can provide significantly better NAT capabilities than software NAT.

[0019] In some embodiments, after the hardware NAT receives routing rules from the software NAT, in step S104, the hardware NAT can store the routing rules in the hardware NAT. For example, the routing rules can be stored in the hardware NAT's connection table. When the hardware NAT receives a data packet associated with the same routing rule received from the software NAT (e.g., in step S106), the hardware NAT can directly send (or route) the data packet to its destination according to the routing rules stored in the hardware NAT. In other words, hardware NAT can be used to accelerate the efficiency of network address translation.

[0020] In some embodiments, the hardware NAT may have a routing rule removal function. In this function, the hardware NAT may use a timeout period (set within the hardware NAT) to determine whether to remove a routing rule stored in the hardware NAT. For example, if the hardware NAT does not receive any data packets associated with a routing rule for a period longer than the timeout period, it could normally remove the routing rule. However, in some embodiments of the invention, the routing rule removal function for routing rules stored in the hardware NAT can be disabled. Therefore, even if the hardware NAT does not receive any data packets associated with a routing rule for a period longer than the timeout period, the hardware NAT may not remove the routing rule.

[0021] In some embodiments, the timeout period for hardware NAT to determine whether to remove routing rules stored in the hardware NAT can be set to a maximum timeout period (e.g., 65535). In some embodiments, the timeout period for hardware NAT to determine whether to remove routing rules stored in the hardware NAT can be disabled.

[0022] Initially, hardware NAT may have a keep-alive function to periodically send keep-alive packets to software NAT. However, in some embodiments of the present invention, the keep-alive function of the hardware NAT for routing rules stored in the hardware NAT can be disabled, so that the software NAT is not woken up from suspended mode upon receiving a keep-alive packet from the hardware NAT.

[0023] In some embodiments, software NAT can enter suspend mode if no wake-up event occurs. Wake-up events in some embodiments may include: receiving additional data packets associated with other routing rules; receiving an event that a Universal Serial Bus (USB) device has been installed in the router; or receiving an event that the router's power button has been pressed. Although software NAT can enter suspend mode to save router power, hardware NAT can still perform network address translation, allowing the router to continue operating normally.

[0024] Figure 2 This is a schematic diagram of an electronic device 200 according to some embodiments of the present invention. In some embodiments, the electronic device 200 may be a router, but the present invention is not limited thereto. Figure 2As shown, electronic device 200 may include hardware NAT 202 and software NAT 204. Hardware NAT 202 may be configured to receive data packets associated with routing rules from Wi-Fi 214, Ethernet 216, or modem 218, and translate the IP addresses of data packets in the Intranet (e.g., Wi-Fi 214 and Ethernet 216) to the IP addresses of data packets in the Extranet (e.g., modem 218 and network 219). For example, hardware NAT 202 may be configured to translate the IP addresses of data packets in Wi-Fi 214 to the IP addresses of data packets in network 219 via links 224 and 228 and modem 218. Similarly, hardware NAT 202 may be configured to translate the IP addresses of data packets in Ethernet 216 to the IP addresses of data packets in network 219 via links 226 and 228 and modem 218. Upon receiving a data packet associated with a routing rule, if the routing rule is already recorded in the connection table of hardware NAT 202, hardware NAT 202 can directly send the data packet to the appropriate destination, such as Wi-Fi 214, Ethernet 216, or modem 218. If the routing rule is not recorded in the second connection table of hardware NAT 202, hardware NAT 202 can pass the data packet to software NAT 204 via link 222.

[0025] In some embodiments, driver 210 and connection tracker 212 may be executed by software NAT 204. In some embodiments, driver 210 may include program code for operating software NAT 204, and a threshold number of data packets associated with the routing rules for software NAT 204 to use in determining whether to send routing rules to hardware NAT 202. Connection tracker 212 is capable of controlling a routing rule removal function to remove routing rules stored in software NAT 204. In some embodiments, the method of the present invention can set the threshold number of data packets to 1 to 5 per second by changing settings in driver 210. In some embodiments, the method of the present invention can enable or disable the timeout period for the routing rule removal function in software NAT 204 and hardware NAT 202 by changing settings in driver 210. In some embodiments, the method of the present invention can enable or disable the routing rule removal function in software NAT 204 by changing settings in connection tracker 212. In some embodiments, software NAT 204 can send routing rules to hardware NAT 202 via link 220.

[0026] Figure 3 According to some embodiments of the present invention, Figure 1 The method in [the text] is applied to Figure 2 The flowchart of electronic device 200 is shown. Software NAT 204 can first receive data packets associated with routing rules from hardware NAT 202, and route the data packets according to the routing rules. Figure 1 (Step S100 in the above). In some embodiments, the routing rules are already stored in the connection table of the software NAT 204. The software NAT 204 may have a routing rule removal function to remove routing rules. Figure 3 As shown, software NAT 204 can execute driver 210 to set the threshold number of data packets for which software NAT 204 determines to send routing rules to hardware NAT 202 to be 1 to 5 per second (as shown in box 300). Figure 1 (Step S102 in the previous step). Afterwards, the software NAT 204 can execute driver 210 to send routing rules to the hardware NAT 202 via command 302. In some embodiments, the software NAT 204 can also execute driver 210 to disable periodic keepalive packet transmissions from the hardware NAT 202 to the software NAT 204 (i.e., keepalive functionality in the hardware NAT 202) via command 304. In some embodiments, the software NAT 204 can execute driver 210 to send command 304 to the hardware NAT 202, causing the hardware NAT 202 to disable its routing rule removal function based on command 304. In some embodiments, the software NAT 204 can execute driver 210 to disable the routing rule removal function in the software NAT 204 by sending command 306 to the connection tracker 212, causing the connection tracker 212 to disable the routing rule removal function in the software NAT 204. Alternatively, the connection tracker 212 can disable the timeout period for determining whether to remove routing rules stored in the software NAT 204 according to command 306.

[0027] After the hardware NAT 202 receives the routing rules from the software NAT 204 via command 302, the hardware NAT 202 can store the routing rules in its connection table. It can also translate the IP address of data packet 350 in Wi-Fi 214 to the IP address of data packet 350 in network 219, and send data packet 350 to network 219 via modem 218. Similarly, the hardware NAT 202 can translate the IP address of data packet 352 in network 219 to the IP address of data packet 352 in Wi-Fi 214, and send data packet 352 to Wi-Fi 214 via modem 218.

[0028] In some embodiments, when the software NAT 204 does not receive other data packets from the hardware NAT 202 (as shown in block 308), the software NAT 204 can enter a suspend mode (as shown in block 310). In some embodiments, the software NAT 204 can enter a suspend mode if there is no wake-up event. For example, a wake-up event may include: receiving other data packets associated with other routing rules; receiving an event that a USB device is installed in the router; or receiving an event that the router's power button is pressed, but the invention is not limited thereto.

[0029] After software NAT 204 enters suspend mode, because the routing rules associated with data packets 354 and 356 still exist in hardware NAT 202, hardware NAT 202 can still translate the IP addresses of data packets 354 and 356 in Wi-Fi 214 to the IP addresses of data packets 354 and 356 in network 219, and send data packets 354 and 356 to network 219 via modem 218. Then, software NAT 204 encounters a wake-up event (as shown in box 312), causing software NAT 204 to leave suspend mode (as shown in box 314). Software NAT 204 can then execute driver 210 to update the connection table via command 322 based on data packets newly received from hardware NAT 202 and associated with other routing rules.

[0030] Since the routing rule removal function of hardware NAT 202 can be disabled, the number of routing rules stored in hardware NAT 202 may not decrease, thereby reducing the likelihood that hardware NAT 202 will pass data packets to software NAT 204, and also reducing the likelihood that software NAT 204 will leave the suspended mode. Similarly, the keep-alive function of hardware NAT 202 can be disabled, so hardware NAT 202 can send keep-alive packets to software NAT 204 non-periodically, thereby also reducing the likelihood that software NAT 204 will leave the suspended mode. In addition, since the routing rule removal function of software NAT 202 can be disabled, the number of routing rules stored in software NAT 204 may not decrease, thereby reducing the likelihood of encountering new routing rules not stored in software NAT 204. In other words, software NAT 204 does not need to prepare routing rules again for received data packets associated with the same routing rule (e.g., look up routing rules from communication commands between user terminals). The data packet routing method and electronic device of the present invention can achieve the technical effect of saving power.

[0031] The method and electronic device of this invention allow the application microcontroller to remain in suspend mode when transmitting data packets via hardware NAT. Alternatively, all data packets can be stored in a second connection table of the hardware NAT. Connection timeouts in both the application microcontroller and the hardware NAT can be disabled. The application microcontroller can enter suspend mode to conserve power.

[0032] It is understood that the systems, devices, and methods disclosed in some embodiments of this invention can be implemented by other methods. The device embodiments described above are merely exemplary; for example, the division of units is only a division of logical functions, and other divisions may exist in actual implementation. For instance, multiple units or elements may be combined or integrated into another system, or certain features may be omitted or not implemented. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.

[0033] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically independently, or two or more units can be integrated into one unit. The aforementioned integrated unit can be implemented in hardware or as a software functional unit.

[0034] While the invention has been disclosed above in preferred embodiments, these embodiments are not intended to limit the scope of the invention. Any adjustments and modifications can be made by those skilled in the art without departing from the spirit and scope of the invention. Therefore, the scope of protection of the invention should be determined by the scope of the claims.

Claims

1. A method for routing data packets, applied to a router, the router including a software network address translator and a hardware network address translator, the method comprising: The software network address converter routes the first data packet according to the routing rules stored in the software network address converter, wherein the software network address converter has a routing rule removal function to remove the routing rules stored in the software network address converter; The software network address translator sends the routing rules to the hardware network address translator; The hardware network address translator stores the routing rules in the hardware network address translator; and The second data packet is routed by the hardware network address translator (NAT) instead of the software NAT, according to the routing rules stored in the hardware NAT. Specifically, the routing rule removal function of the software network address translator is disabled for the routing rules stored in the software network address translator. The hardware network address converter has a keep-alive function, which is used to periodically send keep-alive packets to the software network address converter. The keep-alive function of the hardware network address converter is disabled for the routing rules stored in the hardware network address converter.

2. The method as described in claim 1, characterized in that, The hardware network address converter has a routing rule removal function, which is used to remove the routing rules stored in the hardware network address converter. The routing rule removal function of the hardware network address converter is disabled for the routing rules stored in the hardware network address converter.

3. The method as described in claim 1, characterized in that, The step of the software network address translator sending the routing rules to the hardware network address translator includes: The software network address converter sends the routing rule to the hardware network address converter based on a threshold number of data packets associated with the routing rule received by the software network address converter from the hardware network address converter within a predetermined time period. The number of thresholds is an integer between 1 and 5.

4. The method as described in claim 1, characterized in that, The timeout period used to determine whether to remove routing rules stored in the software network address translator is disabled.

5. The method as described in claim 1, characterized in that, The timeout period used to determine whether to remove routing rules stored in the software network address translator is set to the maximum value of the timeout period.

6. The method as described in claim 2, characterized in that, The timeout used to determine whether the removal of routing rules stored in the hardware network address translator is disabled, or the timeout is set to the maximum value of the timeout period.

7. An electronic device for routing data packets, comprising a software network address converter and a hardware network address converter. in, The software network address converter routes the first data packet according to the routing rules stored in the software network address converter, wherein the software network address converter has a routing rule removal function to remove the routing rules stored in the software network address converter; The software network address translator sends the routing rules to the hardware network address translator. The hardware network address converter receives the routing rules from the software network address converter and stores the routing rules in the hardware network address converter; as well as The second data packet is routed by the hardware network address translator (NAT) instead of the software NAT, according to the routing rules stored in the hardware NAT. Specifically, the routing rule removal function of the software network address translator is disabled for the routing rules stored in the software network address translator. The hardware network address converter has a keep-alive function, which is used to periodically send keep-alive packets to the software network address converter. The keep-alive function of the hardware network address converter is disabled for the routing rules stored in the hardware network address converter.

8. The electronic device as claimed in claim 7, characterized in that, The hardware network address converter has a routing rule removal function, which is used to remove the routing rules stored in the hardware network address converter. The routing rule removal function of the hardware network address converter is disabled for the routing rules stored in the hardware network address converter.

9. The electronic device as claimed in claim 7, characterized in that, The software network address converter sends the routing rule to the hardware network address converter based on a threshold number of data packets associated with the routing rule received by the software network address converter from the hardware network address converter within a predetermined time period, wherein the threshold number is an integer between 1 and 5.

10. The electronic device as claimed in claim 7, characterized in that, The timeout period used by the software network address translator to determine whether to remove routing rules stored in the software network address translator is disabled.

11. The electronic device as claimed in claim 7, characterized in that, The timeout period used by the software network address translator to determine whether to remove routing rules stored in the software network address translator is set to the maximum value of the timeout period.

12. The electronic device as claimed in claim 8, characterized in that, The timeout period used by the hardware network address translator to determine whether to remove routing rules stored in the hardware network address translator is disabled, or the timeout period is set to the maximum value of the timeout period.

Citation Information

Patent Citations

  • Method, device and apparatus for NAT rule management

    CN109088957A

  • Efficient NAT in SDN network

    US20190379600A1