Network device for performing map packet forwarding with the aid of network processing unit and / or software map information table

EP4681419A1Pending Publication Date: 2026-01-21AIROHA TECH (SUZHOU) LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
EP2024892471
Authority / Receiving Office
EP · EP
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-05-27
Publication Date
2026-01-21

AI Technical Summary

Technical Problem

Conventional network gateways with hardware-accelerated forwarding circuits have limited IP tunneling resources, leading to suboptimal performance when handling MAP data flows, as they exhaust their resources and resort to CPU-based forwarding, which is inefficient and resource-intensive.

Method used

Employing a network processing unit (NPU) and a software MAP information table to offload packet forwarding tasks when the hardware-accelerated circuit reaches its tunneling limit, utilizing the NPU to generate and forward packets with retrieved IP headers from the stored table entries, thereby enhancing forwarding performance.

Benefits of technology

Improves packet forwarding efficiency by leveraging the NPU's capabilities to handle MAP data flows beyond hardware limitations, reducing CPU load and maintaining high performance without significant resource occupation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024095502_04122025_PF_FP_ABST
    Figure CN2024095502_04122025_PF_FP_ABST
Patent Text Reader

Abstract

A network device includes a storage device and a network processing unit (NPU). The storage device stores a mapping of address and port (MAP) information table, wherein the MAP information table includes a plurality of table entries that store a plurality of second internet protocol (IP) headers each complying with a second IP version. The NPU receives a first packet with a first IP header that complies with a first IP version different from the second IP version, and generates and forwards a second packet that includes a second IP header retrieved from the storage device and at least a portion of the first packet.
Need to check novelty before this filing date? Find Prior Art

Description

NETWORK DEVICE FOR PERFORMING MAP PACKET FORWARDING WITH THE AID OF NETWORK PROCESSING UNIT AND / OR SOFTWARE MAP INFORMATION TABLETECHNICAL FIELD

[0001] The present invention relates to transmitting packets over a network, and more particularly, to a network device for performing mapping of address and port (MAP) packet forwarding with the aid of a network processing unit (NPU) and / or a software MAP information table.BACKGROUND

[0002] MAP is a mechanism for transporting internet protocol version 4 (IPv4) packets over an internet protocol version 6 (IPv6) only network. There are two MAP modes, including MAP with encapsulation (MAP-E) and MAP with Translation (MAP-T) . The MAP-E mode is based on the encapsulation of IPv4 over IPv6 and mapping of IPv4 addresses and ports to IPv6, and vice versa. The MAP-T mode is based on the translation of IPv4 addresses and ports to IPv6, and vice versa. A network gateway is a network device that connects disparate networks by translating communications from one protocol to another. A conventional network gateway may be equipped with a hardware-accelerated forwarding circuit that is a hardware circuit designed to provide hardware acceleration that reduces work load of a central processing unit (CPU) and speeds up uplink / downlink packet forwarding. The hardware-accelerated forwarding circuit implemented in the network gateway may support an IP tunneling function that can facilitate packet forwarding between different networks. However, the hardware-accelerated forwarding circuit has limited IP tunneling resources. For example, the hardware-accelerated forwarding circuit can only serve up to 64 MAP data flows. When the hardware-accelerated forwarding circuit has used up its IP tunneling resources, the hardware-accelerated forwarding circuit may send the incoming MAP data flows to the CPU, and then the MAP data flows are forwarded by the CPU after being  processed by the Linux network protocol stack. Compared to the hardware-accelerated packet forwarding, the software-based packet forwarding handled by the CPU has poorer forwarding performance, and occupies a plenty of CPU resources.SUMMARY OF THE INVENTION

[0003] One of the objectives of the claimed invention is to provide a network device for performing MAP packet forwarding with the aid of an NPU and / or a software MAP information table.

[0004] According to a first aspect of the present invention, an exemplary network device is disclosed. The exemplary network device includes a storage device and an NPU. The storage device is arranged to store a MAP information table, wherein the MAP information table includes a plurality of table entries that store a plurality of second IP headers each complying with a second IP version. The NPU is arranged to receive a first packet with a first IP header that complies with a first IP version different from the second IP version, and generate and forward a second packet that comprises a second IP header retrieved from the storage device and at least a portion of the first packet.

[0005] According to a second aspect of the present invention, an exemplary network device is disclosed. The exemplary network device includes an NPU and a hardware-accelerated forwarding circuit. The NPU is arranged to receive a first packet with a first IP header that complies with a first IP version and a second IP header that complies with a second IP version different from the first IP version, and generate and forward a second packet that comprises only a portion of the first packet, wherein the second packet does not include the first IP header. The hardware-accelerated forwarding circuit is arranged to receive the first packet and send the first packet to the NPU.

[0006] These and other objectives of the present invention will no doubt  become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiment that is illustrated in the various figures and drawings.BRIEF DESCRIPTION OF THE DRAWINGS

[0007] FIG. 1 is a diagram illustrating a network device according to an embodiment of the present invention.

[0008] FIG. 2 is a diagram illustrating a MAP information table stored in a storage device according to an embodiment of the present invention.

[0009] FIG. 3 is a flowchart illustrating a method of accessing the MAP information table stored in the storage device according to an embodiment of the present invention.

[0010] FIG. 4 is a flowchart illustrating a MAP-E / MAP-T uplink packet forwarding method according to an embodiment of the present invention.

[0011] FIG. 5 is a diagram illustrating a MAP-E uplink packet forwarding operation according to an embodiment of the present invention.

[0012] FIG. 6 is a diagram illustrating a MAP-T uplink packet forwarding operation according to an embodiment of the present invention.

[0013] FIG. 7 is a diagram illustrating a MAP-E downlink packet forwarding operation according to an embodiment of the present invention.

[0014] FIG. 8 is a diagram illustrating a MAP-T downlink packet forwarding operation according to an embodiment of the present invention.DETAILED DESCRIPTION OF EMBODIMENTS

[0015] Certain terms are used throughout the following description and claims, which refer to particular components. As one skilled in the art will appreciate, electronic equipment manufacturers may refer to a component by different names. This document does not intend to distinguish between components that differ in name but not in function. In the following description and in the claims, the terms "include" and "comprise" are used in an open-ended fashion, and thus should be interpreted to mean "include, but not limited to ... " . Also, the term "couple" is intended to mean either an  indirect or direct electrical connection. Accordingly, if one device is coupled to another device, that connection may be through a direct electrical connection, or through an indirect electrical connection via other devices and connections.

[0016] FIG. 1 is a diagram illustrating a network device according to an embodiment of the present invention. By way of example, but not limitation, the network device 100 may be a network gateway connected between different networks (labeled by “NW1” and “NW2” ) 10 and 20. In a case where the network device 100 is used to deal with uplink packet forwarding, the network 10 may be a local area network (LAN) , and the network 20 may be wide area network (WAN) . In another case where the network device 100 is used to deal with downlink packet forwarding, the network 10 may be a WAN, and the network 20 may be a LAN. As shown in FIG. 1, the network device 100 includes a central processing unit (CPU) 102, a network processing unit (NPU) 104, a storage device 106, and a hardware-accelerated forwarding circuit (labeled by “HW” ) 108. It should be noted that only the components pertinent to the present invention are illustrated in FIG. 1. In practice, the network device 100 may is allowed to have additional components to achieve other designed functions.

[0017] The CPU 102 may be implemented by a general-purpose processor. The NPU 104 may be implemented by an application specific integrated circuit (ASIC) that is optimized for networking applications. The storage device 106 may be implemented by a memory device such as a dynamic random access memory (DRAM) . The hardware-accelerated forwarding circuit 108 is arranged to provide hardware acceleration that reduces work load of the CPU 102 and speeds up uplink / downlink packet forwarding, and is further arranged to support an IP tunneling function for adding / removing an IP header (e.g., IPv4 header or IPv6 header) . The hardware-accelerated forwarding circuit 108 has limited IP tunneling resources. For example, the hardware-accelerated forwarding circuit 108 can only serve up to  64 MAP data flows. When the hardware-accelerated forwarding circuit has used up its IP tunneling resources, the proposed packet forwarding scheme can be enabled to improve the forwarding performance of uplink / downlink MAP packets.

[0018] In accordance with the proposed packet forwarding scheme, the hardware-accelerated forwarding circuit 108 receives a first packet PKT1 with a first IP header that complies with a first IP version, and uses a hardware forwarding circuit (labeled by “hardware forward” ) 114 to send the first packet PKT1 to the NPU 104; the storage device (e.g., DRAM) 106 is arranged to store a MAP information table (labeled by “MAP info table” ) 110, where the MAP information table 110 includes a plurality of table entries that store a plurality of second IP headers each complying with a second IP version different from the first IP version; and the NPU 104 is arranged to receive the first packet PKT1 output from the hardware-accelerated forwarding circuit 108, and uses a fast forwarding circuit (labeled by “fast forward” ) 112 to generate and forward a second packet PKT2, where the second packet PKT2 includes a second IP header retrieved from the storage device 106 and at least a portion (i.e., part or all) of the first packet PKT1. For example, one of the first IP version and the second IP version may be IPv6, and the other of the first IP version and the second IP version may be IPv4. However, this is for illustrative purposes only, and is not meant to be a limitation of the present invention. In practice, any network device that performs MAP packet forwarding with the aid of an NPU and / or a software MAP information table falls within the scope of the present invention.

[0019] In this embodiment, the NPU 104 (particularly, fast forwarding circuit 112 of NPU 104) generates and forwards the second packet PKT2 during a period in which the hardware-accelerated forwarding circuit 108 has used up its IP tunneling resources. Compared to the software-based packet forwarding handled by the CPU 102, the hardware-based packet forwarding handled by the fast forwarding  circuit 112 of the NPU 104 has better forwarding performance. In this way, the packet forwarding performance of the network device 100 can be improved by the NPU 104 under a condition that the hardware-accelerated forwarding circuit 108 has used up its IP tunneling resources.

[0020] The MAP information table 110 is a software table created and maintained by the CPU 102, and is accessible to the NPU 104. FIG. 2 is a diagram illustrating the MAP information table 110 stored in the storage device 106 according to an embodiment of the present invention. FIG. 3 is a flowchart illustrating a method of accessing the MAP information table 110 stored in the storage device 106 according to an embodiment of the present invention. Provided that the result is substantially the same, the steps are not required to be executed in the exact order shown in FIG. 3. As shown in FIG. 2, the MAP information table 110 includes table entries 202 that store second IP headers, where each of the second IP headers complies with the second IP version that is different from the first IP version with which the first packets PKT1, PKT1’ comply. For example, the second IP headers recorded in the MAP information table 110 may be IPv6 headers that can be used by MAP-E / MAP-T uplink packet forwarding. For another example, the second IP headers recorded in the MAP information table 110 may be IPv4 headers that can be used by MAP-T downlink packet forwarding.

[0021] The proposed packet forwarding scheme may include a CPU learning phase and a follow-up NPU fast forward phase. At step S302, the network device 100 determines whether the CPU learning phase is active. During the CPU learning phase, the hardware-accelerated forwarding circuit 108 is arranged to receive another first packet PKT1’ with another first IP header, calculate a hash value HV’ for the first packet PKT1’ , and send the hash value HV’ and the first packet PKT1’ to the CPU 102. In this embodiment, the hardware-accelerated forwarding circuit 108 includes a hardware hash table 116, and the hardware hash table 116 is used to store  a plurality of pre-calculated hash values, and output one of the pre-calculated hash values in response to the first packet PKT1’ . However, this is for illustrative purposes only, and is not meant to be a limitation of the present invention. In practice, any means capable of deriving the hash value HV’ from the first packet PKT1’ (e.g., header information of the first packet PKT1’ ) can be employed by the hardware-accelerated forwarding circuit 108.

[0022] The CPU 102 loads and executes a plurality of software modules, including network drivers (e.g., LAN driver and WAN driver) 118, a Linux network protocol stack 120, and a MAP information learning module (labeled by “MAP info learning” ) 122. During the CPU learning phase, the MAP information learning module (labeled by “MAP info learning” ) 122 running on the CPU 102 obtains data of the hash value HV’ and the first packet PKT1’ through the network drivers 118 and the Linux network protocol stack 120, parses the first packet PKT1’ to obtain a second IP header that is mapped to the first IP header PKT1’ with the first header (step S304) , uses the obtained hash value HV’ to locate a table entry of the MAP information table 110 (step S306) , and store / write the obtained second IP header into the table entry indexed by the hash value HV’ (step S308) . To put it simply, the MAP information learning module (labeled by “MAP info learning” ) 122 learns IP headers needed by stateless MAP-E / MAP-T conversion of first packets PKT1’ that are received from the network 10 after the hardware-accelerated forwarding circuit 108 uses up it IP tunneling resources, and stores the learned IP headers into the MAP information table 110 for later use. The si ze of the MAP information table 110 may be adjusted, depending upon actual design considerations.

[0023] The MAP information table 110 is created and maintained by the CPU 102 according to a plurality of first packets PKT1’ that are received from the network 10 by the hardware-accelerated forwarding circuit 108 (which has used up its IP tunneling resources) during the CPU learning phase. In this embodiment, the CPU 102 may also  handle the forwarding task of the first packets PKT1’ before the CPU learning phase is completed. Hence, regarding each of the first packet PKT1’ received during the CPU learning phase, the CPU 102 generates and forwards a second packet PKT2’ that includes a second IP header retrieved from the storage device 106 and at least a portion (i.e., part or all) of the first packet PKT1’ . It should be noted that the duration of the CPU learning phase is short, such that the software-based packet forwarding does not occupy many CPU resources. Specifically, the CPU utilization is increased during the CPU learning phase due to computation of the software MAP information table, and is decreased during the follow-up NPU fast forward phase due to the NPU-assisted packet forwarding, where the duration of the NPU fast forward phase is much longer than the duration of the CPU learning phase.

[0024] After the CPU learning phase is completed (i.e., the MAP information table 110 is filled with IP headers) , the network device 100 enters the follow-up NPU fast forward phase to leverage the fast forwarding capability of the NPU 104, where MAP data flows are not forwarded by the Linux network protocol stack 120 of the CPU 102. During the NPU fast forward phase, the hardware-accelerated forwarding circuit 108 (which has used up its IP tunneling resources) receives the first packet PKT1, calculates a hash value HV for the first packet PKT1, and send the hash value HV and the first packet PKT1 to the NPU 104. In this embodiment, the hardware-accelerated forwarding circuit 108 includes the hardware hash table 116, and the hardware hash table 116 stores a plurality of pre-calculated hash values, and outputs one of the pre-calculated hash values in response to the first packet PKT. However, this is for illustrative purposes only, and is not meant to be a limitation of the present invention. In practice, any means capable of deriving the hash value HV from the first packet PKT (e.g., header information of the first packet PKT) can be employed by the hardware-accelerated forwarding circuit 108. Since the MAP information table 110 is available in the storage device 106, the NPU 104 (particularly, fast forwarding  circuit 112 of NPU 104) is arranged to use the obtained hash value HV to locate a table entry of the MAP information table 110 (step S310) , and retrieve a second IP header from the table entry indexed by the hash value HV (step S312) . Hence, the NPU 104 (particularly, fast forwarding circuit 112 of NPU 104) generates and forwards the second packet PKT2 that includes the second IP header retrieved from the storage device 106 and at least a portion (i.e., part or all) of the first packet PKT1.

[0025] Supposing that the network device 100 is used to deal with uplink packet forwarding, the first packet PKT1 / PKT1’ is an uplink packet (which is an IPv4 packet transmitted over the LAN) , the network 10 is the LAN, the network 20 is the WAN, the first IP version is IPv4, the second IP version is IPv6, and the second IP headers stored in the MAP information table 110 are IPv6 headers. The second packet PKT2 / PKT2’ may be transmitted over an IPv6-only network under a MAP-E mode or a MAP-T mode. Further details of the proposed NPU-assisted MAP-E / MAP-T uplink packet forwarding are described as below with reference to the accompanying drawings.

[0026] Please refer to FIG. 5 in conjunction with FIG. 4. FIG. 4 is a flowchart illustrating a MAP-E / MAP-T uplink packet forwarding method according to an embodiment of the present invention. Provided that the result is substantially the same, the steps are not required to be executed in the exact order shown in FIG. 4. FIG. 5 is a diagram illustrating a MAP-E uplink packet forwarding operation according to an embodiment of the present invention. The hardware-accelerated forwarding circuit 108 (particularly, hardware forwarding circuit 114 of hardware-accelerated forwarding circuit 108) receives an IPv4 packet (MAP-E data) from the LAN (step S402) , where the IPv4 packet includes an IPv4 header and a data section.

[0027] In a case where the hardware-accelerated forwarding circuit 108 does not use up its IP tunneling resources yet and the IPv4 packet is required to be transmitted over an IPv6-only network under the  MAP-E mode (steps S404 and S406) , the hardware-accelerated forwarding circuit 108 (particularly, hardware forwarding circuit 114 of hardware-accelerated forwarding circuit 108) performs the IP tunneling function to add an IPv6 header to the IPv4 packet to achieve the MAP-E conversion, and directly forwards a processed packet (which is a MAP-E packet including the IPv6 header, the IPv4 header, and the data section) to the WAN without intervention of CPU 102 and NPU 104 (step S408) .

[0028] In another case where the hardware-accelerated forwarding circuit 108 has used up its IP tunneling resources (step S404) , the hardware-accelerated forwarding circuit 108 (particularly, hardware forwarding circuit 114 of hardware-accelerated forwarding circuit 108) does not perform the IP tunneling function upon the IPv4 packet (which includes the IPv4 header and the data section) , and sends the IPv4 packet to the NPU 104. The IPv4 packet output from the hardware-accelerated forwarding circuit 108 (particularly, hardware forwarding circuit 114 of hardware-accelerated forwarding circuit 108) is received by a packet receive circuit (labeled by “packet Rx” ) 502 of the NPU 104 (step S412) . A packet classification circuit (labeled by “packet classification” ) 504 of the NPU 104 obtains the MAP mode of the IPv4 packet (step S414) . Since the IPv4 packet is required to be forwarded under the MAP-E mode, a segmented transmission circuit (labeled by “segmented Tx” ) 506 refers to an address of an IPv6 header and an address of the IPv4 packet to generate and forward a MAP-E packet (which includes the IPv6 header, the IPv4 header, and the data section) to the WAN (step S422) , where the segmented transmission circuit 506 obtains the IPv6 header from the MAP information table 110 in the storage device 106 as illustrated in FIG. 2 and FIG. 3.

[0029] Please refer to FIG. 6 in conjunction with FIG. 4. FIG. 6 is a diagram illustrating a MAP-T uplink packet forwarding operation according to an embodiment of the present invention. The hardware-accelerated forwarding circuit 108 (particularly,  hardware forwarding circuit 114 of hardware-accelerated forwarding circuit 108) receives an IPv4 packet (MAP-T data) from the LAN (step S402) , where the IPv4 packet includes an IPv4 header and a data section.

[0030] In a case where the hardware-accelerated forwarding circuit 108 does not use up its IP tunneling resources yet and the IPv4 packet is required to be transmitted over an IPv6-only network under the MAP-T mode (steps S404 and S406) , the hardware-accelerated forwarding circuit 108 (particularly, hardware forwarding circuit 114 of hardware-accelerated forwarding circuit 108) performs the IP tunneling function to add an IPv6 header to the IPv4 packet (step S410) , and sends a processed packet (which includes the IPv6 header, the IPv4 header, and the data section) to the NPU 104. The processed packet output from the hardware-accelerated forwarding circuit 108 (particularly, hardware forwarding circuit 114 of hardware-accelerated forwarding circuit 108) is received by the packet receive circuit 502 of the NPU 104 (step S412) . The packet classification circuit 504 of the NPU 104 obtains the MAP mode of the IPv4 packet (step S414) . Since the IPv4 packet is required to be forwarded under the MAP-T mode and the processed packet includes an IPv6 header added by the IP tunneling function (steps S416 and S418) , the segmented transmission circuit 506 refers to an address of the IPv6 header and an address of the data section to generate and forward a MAP-T packet (which includes the IPv6 header and the data section) to the WAN (step S422) . In other words, the IPv4 header is skipped by the segmented transmission circuit 506.

[0031] In another case where the hardware-accelerated forwarding circuit 108 has used up its IP tunneling resources (step S404) , the hardware-accelerated forwarding circuit 108 (particularly, hardware forwarding circuit 114 of hardware-accelerated forwarding circuit 108) does not perform the IP tunneling function upon the IPv4 packet (which includes the IPv4 header and the data section) , and sends the IPv4 packet to the NPU 104. The IPv4 packet output  from the hardware-accelerated forwarding circuit 108 (particularly, hardware forwarding circuit 114 of hardware-accelerated forwarding circuit 108) is received by the packet receive circuit 502 of the NPU 104 (step S412) . The packet classification circuit 504 of the NPU 104 obtains the MAP mode of the IPv4 packet (step S414) . Since the IPv4 packet is required to be forwarded under the MAP-T mode and the IP tunneling function is not performed upon the IPv4 packet (steps S416 and S418) , a MAP data processing circuit 508 of the NPU 104 obtains an IPv6 header from the MAP information table 110 in the storage device 106 as illustrated in FIG. 2 and FIG. 3, performs certain modification (e.g., length value modification) , and informs the segmented transmission circuit 506 of an address of the IPv6 header (step S420) . At step S422, the segmented transmission circuit 506 refers to the address of the IPv6 header and an address of the data section to generate and forward a MAP-T packet (which includes the IPv6 header and the data section) to the WAN (step S422) . In other words, the IPv4 header is skipped by the segmented transmission circuit 506.

[0032] Supposing that the network device 100 is used to deal with downlink packet forwarding, the first packet PKT1 / PKT1’ is a downlink packet, the second packet PKT2 / PKT2’ is a downlink packet (which is an IPv4 packet transmitted over the LAN) , the network 10 is the WAN, the network 20 is the LAN, the first IP version is IPv6, the second IP version is IPv4, and the second IP headers stored in the MAP information table 110 are IPv4 headers. The first packet PKT1 / PKT1’ may be transmitted over an IPv6-only network under a MAP-E mode or a MAP-T mode. Further details of the proposed NPU-assisted MAP-E / MAP-T downlink packet forwarding are described as below with reference to the accompanying drawings.

[0033] Please refer to FIG. 7 in conjunction with FIG. 4. FIG. 7 is a diagram illustrating a MAP-E downlink packet forwarding operation according to an embodiment of the present invention. The hardware-accelerated forwarding circuit 108 (particularly,  hardware forwarding circuit 114 of hardware-accelerated forwarding circuit 108) receives a MAP-E packet from the WAN (step S402) , where the MAP-E packet includes an IPv6 header, an IPv4 packet, and a data section.

[0034] In a case where the hardware-accelerated forwarding circuit 108 does not use up its IP tunneling resources yet (step S404) , the hardware-accelerated forwarding circuit 108 (particularly, hardware forwarding circuit 114 of hardware-accelerated forwarding circuit 108) performs the IP tunneling function to remove the IPv6 header from the MAP-E packet to achieve the MAP-E conversion, and directly forwards a processed packet (which is an IPv4 packet including the IPv4 header and the data section) to the LAN without intervention of CPU 102 and NPU 104 (steps S406 and S408) .

[0035] In another case where the hardware-accelerated forwarding circuit 108 has used up its IP tunneling resources (step S404) , the hardware-accelerated forwarding circuit 108 (particularly, hardware forwarding circuit 114 of hardware-accelerated forwarding circuit 108) does not perform the IP tunneling function upon the MAP-E packet (which includes the IPv6 header, the IPv4 header, and the data section) , and sends the MAP-E packet to the NPU 104. The MAP-E packet output from the hardware-accelerated forwarding circuit 108 (particularly, hardware forwarding circuit 114 of hardware-accelerated forwarding circuit 108) is received by the packet receive circuit 502 of the NPU 104 (step S412) . The packet classification circuit 504 of the NPU 104 obtains the MAP mode of the MAP-E packet (step S414) . Since the MAP-E packet is transmitted under the MAP-E mode, the segmented transmission circuit 506 refers to an address of an IPv4 header and an address of the data section to generate and forward an IPv4 packet (which includes the IPv4 header and the data section) to the WAN (step S422) . In other words, the IPv6 header is skipped by the segmented transmission circuit 506.

[0036] Please refer to FIG. 8 in conjunction with FIG. 4. FIG. 8 is a diagram illustrating a MAP-T downlink packet forwarding operation according to an embodiment of the present invention. The hardware-accelerated forwarding circuit 108 (particularly, hardware forwarding circuit 114 of hardware-accelerated forwarding circuit 108) receives a MAP-T packet from the WAN (step S402) , where the MAP-T packet includes an IPv6 header and a data section.

[0037] In a case where the hardware-accelerated forwarding circuit 108 does not use up its IP tunneling resources yet (step S404) , the hardware-accelerated forwarding circuit 108 (particularly, hardware forwarding circuit 114 of hardware-accelerated forwarding circuit 108) performs the IP tunneling function to add an IPv4 header to the MAP-T packet (steps S410 and S406) , and sends a processed packet (which includes the IPv4 header, the IPv6 header, and the data section) to the NPU 104. The processed packet output from the hardware-accelerated forwarding circuit 108 (particularly, hardware forwarding circuit 114 of hardware-accelerated forwarding circuit 108) is received by the packet receive circuit 502 of the NPU 104 (step S412) . The packet classification circuit 504 of the NPU 104 obtains the MAP mode of the MAP-T packet (step S414) . Since the MAP-T packet is transmitted under the MAP-T mode and the processed packet includes an IPv4 header added by the IP tunneling function (steps S416 and S418) , the segmented transmission circuit 506 refers to an address of the IPv4 header and an address of the data section to generate and forward an IPv4 packet (which includes the IPv4 header and the data section) to the WAN (step S422) . In other words, the IPv6 header is skipped by the segmented transmission circuit 506.

[0038] In another case where the hardware-accelerated forwarding circuit 108 has used up its IP tunneling resources (step S404) , the hardware-accelerated forwarding circuit 108 (particularly, hardware forwarding circuit 114 of hardware-accelerated forwarding circuit 108) does not perform the IP tunneling function upon the  MAP-T packet (which includes the IPv6 header and the data section) , and sends the MAP-T packet to the NPU 104. The MAP-T packet output from the hardware-accelerated forwarding circuit 108 (particularly, hardware forwarding circuit 114 of hardware-accelerated forwarding circuit 108) is received by the packet receive circuit 502 of the NPU 104 (step S412) . The packet classification circuit 504 of the NPU 104 obtains the MAP mode of the MAP-T packet (step S414) . Since the MAP-T packet is transmitted under the MAP-T mode and the IP tunneling function is not performed upon the MAP-T packet (steps S416 and S418) , the MAP data processing circuit 508 of the NPU 104 obtains an IPv4 header from the MAP information table 110 in the storage device 106 as illustrated in FIG. 2 and FIG. 3, performs certain modification (e.g., length value modification) , and informs the segmented transmission circuit 506 of an address of the IPv4 header (step S420) . At step S422, the segmented transmission circuit 506 refers to the address of the IPv4 header and an address of the data section to generate and forward an IPv4 packet (which includes the IPv4 header and the data section) to the LAN (step S422) . In other words, the IPv6 header is skipped by the segmented transmission circuit 506.

[0039] Those skilled in the art will readily observe that numerous modifications and alterations of the device and method may be made while retaining the teachings of the invention. Accordingly, the above disclosure should be construed as limited only by the metes and bounds of the appended claims.

Claims

1.A network device comprising:a storage device, arranged to store a mapping of address and port (MAP) information table, wherein the MAP information table includes a plurality of table entries that store a plurality of second internet protocol (IP) headers each complying with a second IP version; anda network processing unit (NPU) , arranged to receive a first packet with a first IP header that complies with a first IP version different from the second IP version, and generate and forward a second packet that comprises a second IP header retrieved from the storage device and at least a portion of the first packet.2.The network device of claim 1, further comprising:a hardware-accelerated forwarding circuit, arranged to support an IP tunneling function;wherein the NPU generates and forwards the second packet during a period in which the hardware-accelerated forwarding circuit has used up its IP tunneling resources.3.The network device of claim 1, further comprising:a central proces sing unit (CPU) , arranged to create and maintain the MAP information table in the storage device.4.The network device of claim 3, further comprising:a hardware-accelerated forwarding circuit, arranged to receive another first packet with another first IP header, calculate a hash value for the another first packet, and send the hash value and the another first packet to the CPU;wherein the CPU is further arranged to parse the another first packet to obtain another second IP header that is mapped to the another first IP header, and store the another second IP header into a table entry indexed by the hash value.5.The network device of claim 1, further comprising:a hardware-accelerated forwarding circuit, arranged to receive the first packet with the first IP header, calculate a hash value for the first packet, and send the hash value and the first packet to the NPU;wherein the NPU is further arranged to retrieve the second IP header from a table entry indexed by the hash value.6.The network device of claim 1, wherein the first packet is an uplink packet.7.The network device of claim 6, wherein the second IP version is IPv6, and the first IP version is IPv4.8.The network device of claim 7, wherein the second packet is transmitted over an IPv6-only network under a MAP with Encapsulation (MAP-E) mode.9.The network device of claim 8, wherein the NPU generates the second packet by adding the second IP header to the first packet with the first IP header included therein.10.The network device of claim 7, wherein the second packet is transmitted over an IPv6-only network under a MAP with Translation (MAP-T) mode.11.The network device of claim 10, wherein the NPU generates the second packet by adding the second IP header to the first packet with the first IP header excluded therefrom.12.The network device of claim 1, wherein the first packet is a downlink packet.13.The network device of claim 12, wherein the second IP version is IPv4, and the first IP version is IPv6.14.The network device of claim 13, wherein the first packet is transmitted over an IPv6-only network under a MAP with Translation (MAP-T) mode.15.The network device of claim 14, wherein the NPU generates the second packet by adding the second IP header to the first packet with the first IP header excluded therefrom.16.A network device comprising:a network processing unit (NPU) , arranged to receive a first packet with a first IP header that complies with a first IP version and a second IP header that complies with a second IP version different from the first IP version, and generate and forward a second packet that comprises only a portion of the first packet, wherein the second packet does not include the first IP header; anda hardware-accelerated forwarding circuit, arranged to receive the first packet and send the first packet to the NPU.17.The network device of claim 16, wherein the hardware-accelerated forwarding circuit supports an IP tunneling function; and the NPU generates and forwards the second packet during a period in which the hardware-accelerated forwarding circuit has used up its IP tunneling resources.18.The network device of claim 16, wherein the first packet is a downlink packet.19.The network device of claim 18, wherein the second IP version is IPv4, and the first IP version is IPv6.20.The network device of claim 19, wherein the first packet is transmitted over an IPv6-only network under a MAP with Encapsulation (MAP-E) mode.