Apparatus and method for packet forwarding with quality of service and rate control

A system and method for forwarding data packets with quality of service and rate control. A plurality of data packets are received from a plurality of sources. The header information of each data packet is extracted and compared against a plurality of tables, and then new header information is assembled based upon the comparison results. The data packets have their headers replaced by the new header information on the fly before being sent to their destinations, or the new header information may be dropped if certain conditions are met.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention generally relates to data communications, and more specifically, relates to an apparatus and method for handling data packets.

2. Description of the Related Art

A local area network (LAN) is the most basic and simplest network that allows communication between a source computer and destination computer. The LAN is often diagramed as a cloud to which computers (also called end stations or end-nodes) that wish to communicate with one another are attached. At least one network element will connect with all of the end stations in the LAN. A single LAN, however, may be insufficient to meet the requirements of an organization that has many end stations because of the limited number of physical connections available to, and the limited message handling capability of, a single repeater.

The capability of computer networks, however, has been extended by connecting different sub-networks to form larger networks that contain thousands of end-stations communicating with each other. These LANs can in turn be connected to each other to create even larger enterprise networks, including wide area network (WAN) links.

To facilitate communication between subnets in a larger network, more complex electronic hardware and software have been proposed and are currently used in conventional networks. Also, new sets of rules for reliable and orderly communication among those end-stations have been defined by various standards based on the principle that the end-stations interconnected by suitable network elements define a network hierarchy, where end-stations within the same subnet have a common classification. A network is thus said to have a topology which defines the features and hierarchical position of nodes and end stations within the network.

The interconnection of end stations through packet switched networks has traditionally followed a peer-to-peer layered architectural abstract. In such a model, a given layer in a source computer communicates with the same layer of a pier end station (usually the destination) across the network. By attaching a header to the data unit received from a higher layer, a layer provides services to enable the operation of the layer above it. A received packet will typically have several headers that were added to the original payload by the different layers operating at the source.

There are several layer partition schemes in the prior art, such as the Arpanet and the Open Systems Interconnect (OSI) models. The seven layer OSI model used here to describe the invention is a convenient model for mapping the functionality and detailed implementations of other models. Aspects of the Arpanet, however, (now redefined by the Internet Engineering Task Force or IETF) will also be used in specific implementations of the invention to be discussed below.

The relevant layers for background purposes here are Layer 1 (physical), Layer-2 (data link), and Layer-3 (network), and to a limited extent Layer-4 (transport). A brief summary of the functions associated with these layers follows.

The physical layer transmits unstructured bits of information across a communication link. The physical layer concerns itself with such issues as the size and shape of connectors, conversion of bits to electrical signals, and bit-level synchronization. Layer-2 provides for transmission of frames of data and error detection. More importantly, the data link layer as referred to in this invention is typically designed to “bridge,” or carry a packet of information across a single hop, i.e., a hop being the journey taken by a packet in going from one node to another. By spending only minimal time processing a received packet before sending the packet to its next destination, the data link layer can forward a packet much faster than the layers above it, which are discussed next. The data link layer provides addressing that may be used to identify a source and a destination between any computers interconnected at or below the data link layer. Examples of Layer-2 bridging protocols include those defined in IEEE 802, such as CSMA/CD, token bus, and token ring (including Fiber Distributed Data Interface, or FDDI).

Similar to Layer-2, Layer-3 also includes the ability to provide addresses of computers that communicate with each other. The network layer, however, also works with topological information about the network hierarchy. The network layer may also be configured to “route” a packet from the source to a destination using the shortest path.

Finally, Layer-4, the transport layer, provides an application program such as an electronic mail program with a “port address” which the application can use to interface with Layer-3. A key difference between the transport layer and the lower layers is that a program on the source computer carries a conversation with a similar program on the destination computer, whereas in the lower layers, the protocols are between each computer and its immediate neighbors in the network, where the ultimate source and destination end-stations may be separated by a number of intermediate nodes. The transport layer can control congestion by simply dropping selected packets, which the source might recognize as a request to reduce the packet rate. Examples of Layer-4 and Layer-3 protocols include the Internet suite of protocols such as TCP (Transmission Control Protocol) and IP (Internet Protocol).

End-stations are the ultimate source and destination of a packet, whereas a node refers to an intermediate point between the end-stations. A node will typically include a network element which has the capability to receive and forward messages on a packet-by-packet basis.

Generally speaking, the larger and more complex networks typically rely on nodes that have higher layer (Layers 3 and 4) functionalities. A very large network consisting of several smaller sub-networks must typically use a Layer-3 network element known as a router which has knowledge of the topology of the sub-networks.

A router can form and store a topological map of the network around it based upon exchanging information with its neighbors. If a LAN is designed with Layer-3 addressing capability, then routers can be used to forward packets between LANs by taking advantage of the hierarchical routing information available from the end-stations. Once a table of end-station addresses and routes has been compiled by the router, packets received by the router can be forwarded after comparing the packet's Layer-3 destination address to an existing and matching entry in the memory.

In comparison to routers, bridges are network elements operating in the data link layer (Layer-2) rather than Layer-3. They have the ability to forward a packet based only on the Layer-2 address of the packet's destination, typically called the medium access control (MAC) address. Generally speaking, bridges do not modify the packets. Bridges forward packets in a flat network having no hierarchy without any cooperation by the end-stations.

Hybrid forms of network elements also exist, such as “brouters” and switches. A “brouter” is a router which can also perform as a bridge. The term switch refers to a network element which is capable of forwarding packets at high speed with functions implemented in hardwired logic as opposed to a general purpose processor executing instructions. Switches come in many types, operating at both Layer-2 and Layer-3.

A layer-2 switch (or bridge) determines the destination physical port based on layer-2 header (more specifically destination MAC address), and the packet stays intact (without any change) when it is forwarded out. A layer-3 router determines the destination physical port based on layer-3 header (destination IP address), and the layer-2 header (source MAC address and destination MAC address) of the packet is replaced with new values when it is forwarded out. A router can work as a bridge and router simultaneously. When a packet comes in, it performs a layer-2 switch or layer-3 routing based on its destination MAC address.

FIG. 1illustrates an encapsulated data packet known in the prior art, specifically an encapsulated IP packet100. The encapsulated IP packet100includes an IP packet encapsulated by a layer-2 MAC header102. The IP packet includes a layer-3 IP header, a layer-3 header, and a payload, which is a data destined for a recipient identified by the layer-3 address and the layer-4 address.

FIG. 2illustrates a prior art MAC header200. The MAC header includes a destination MAC address, a source MAC address and an ether type information. If the ether type equals 0x0800 (hex), then the layer-3 address has an IPv4 format; if the ether type equals 0x86dd (hex), then the layer-3 address has an IPv6 format.

Generally each end-station on a network is assigned an address and the address most commonly used is IP address. Currently the most widely used addresses follow the IPv4 format. The IPv4 format uses 32-bit addresses, limiting it to 4,294,967,296 unique addresses, many of which are reserved for special purposes such as local networks or multicast addresses, reducing the number of addresses that can be allocated as public Internet addresses. A prior art header for the IPv4 format is illustrated inFIG. 3.

FIG. 4illustrates a prior art IPv6 protocol. IPv6 is a new protocol meant to replace the existing IPv4 format, which is the major layer-3 protocol for the current Internet. Since the installed base of the IPv4 format is huge, the IPv6 format is slowly becoming used. There will be some transitions before IPv6 is deployed all over the world. It is possible that a private LAN is using the IPv6 format, but the ISP is using the IPv4 format. I such case, the IPv6 packet can be carried within an IPv4 packet via a tunnel set up by the gateway as illustrated by the prior art data packet inFIG. 5. Another scenario is that an IPv6 host wants to talk to an IPv4 host through an IPv4 network. In this case, the IPv6 header will be translated into an IPv4 header by the gateway in order for the two parties to communicate successfully. Consequently, the IPv6/IPv4 tunnel and translation are needed in current and future gateways.

Because of the scarcity of the IPv4 address space caused by reserving IPv4 format addresses to private networks or multicast addresses, it is very common for many computers inside a private network, such as a home or office, to have internal private network addresses. When the internal computers access someone outside over the Internet, the private network address is translated into a public network address, such as an IP address. Network Address/Port Translation (NAPT) is a technique for many hosts to share fewer public IP addresses. Because many hosts can share one single IP address, the layer-4 port number is used to distinguish an actual internal host. It is heavily used in a gateway application. A gateway is a device sitting between a private network and a wide area network, e.g. the Internet. When a packet comes in from a private LAN port of a gateway, the gateway determines the destination physical port based on the packet's destination network address, and then applies NAPT to generate a new source network address and port number. When a packet comes in from a WAN port of the gateway, the gateway first applies NAPT to generate a new destination network address and port number, and then determines a destination physical port number.

A network address may have different format depending on the protocol used by the network and it may need to be translated when a packet moves from one network to another. Point-to-Point Protocol (PPP) over Ethernet (PPPoE) is a protocol commonly used between an Internet Service Provider and its end users. The prior art PPPoE packet format and the PPPoE header are shown inFIG. 6. PPPoE is not generally used inside a home/office network; therefore, a gateway may need to perform a PPPoE packet encapsulation/decapsulation if necessary. Other commonly used protocols are transfer control protocol (TCP) and user datagram protocol (UDP). Both UDP and TCP are layer-4 protocols and their prior art header information are shown inFIG. 7andFIG. 8respectively.

Another issue when dealing with interfacing a private network and a public network is the Quality of Service (QoS) issue for certain real time applications. Under QoS guarantee, the packets belonging to real time applications, such as video and audio, should be transmitted as soon as possible no matter if the network is congested or not. To provide QoS guarantee, a gateway must be able to classify packets into difference classes so that important packets will not be disturbed by non important packets, and there must be some scheduler to select a packet from different classes to serve.

In summary, a gateway needs to check layer-2, layer-3, and layer-4 headers in a data packet in order to determine a destination physical port through which to forward the data packet, and when the data packet is forwarded out, the layer-2, layer-3 and layer-4 headers of the data packet will be replaced with new header information. While the incoming header information is checked and new header information is generated, the gateway must also be able to provide the QoS guarantee. Therefore, it is desirous to have an apparatus and method that handles incoming data packets in a fast and efficient way, and at the same time providing the QoS guarantee and it is to such apparatus and method the present invention is primarily directed.

SUMMARY OF THE INVENTION

Briefly described, the invention is a system and method of the invention receive data packets from a plurality of sources and forward them with quality of service and rate control. The header information of each data packet is extracted and compared against a plurality of tables. New header information is assembled based on the comparison results. The new header information may be dropped if certain conditions are met. The data packets have their headers replaced by the new header information on the fly before being sent to their destinations.

In one embodiment, an apparatus of the invention processes data packets received from a data network and forwards the data packets to their destination according to a predefined transfer rate. The apparatus includes at least one lower layer processing unit, a header extracting unit, a plurality of tables, a search engine arbiter unit, a plurality of output queues, an early random drop unit, and a plurality of transfer units. The lower layer processing unit receives data packets from an external source and stores the data packets into an external memory buffer. The header extracting unit is in communication with the lower layer processing unit and capable of extracting header information from each received data packet. Each of the plurality of tables has a plurality of entries of table information. The search engine arbiter receives the extracted header information from the header extracting unit and compares the extracted header information against the plurality of tables. The search engine is also capable of creating new header information for each received data packet based on comparison results and discarding the extracted header information based on the comparison results. Each output queue has an output rate and an availability indicator of queuing additional data. The random early drop module receives the extracted header information from the search engine arbiter and distributes the extracted header information among the plurality of output queues. The random early drop module also monitors the availability indicator in each output queue and is capable of discarding the extracted header information. The plurality of transfer rate control modules receives the extracted header information from the plurality of output queues and each transfer rate control module is in communication with an output queue and controlling the output rate for the output queue. The lower layer processing unit also receives the extracted header information and retrieves the data packet identified by the extracted header information and transmits the data packet to the destination identified in the new header information.

In another embodiment, a method of the invention processes data packets from a data network and forwards the data packets to a destination according to a predefined transfer rate. The method includes receiving a plurality of data packets from a plurality of sources at the device, extracting a header information from each of the plurality of data packets, and comparing the extracted header information with at least one table. If the extracted header information matches one entry in the at least one table, a new header information is created for each of the plurality of data packets; if the extracted header information does not match any entry in the at least one table, the extracted header information is discarded. The method further includes transmitting the extracted header information to a random early drop module in the device, distributing the extracted header information among a plurality of queues, discarding the extracted header information from a queue if the output rate of the queue exceeds a predefined criterion, inserting the new header information in the data packet, and transmitting the data packet to the destination listed in the new header information.

In yet another embodiment, a gateway of the invention processes data packets received from a plurality of data network and forwards the data packets to their destination according to a predefined transfer rate. The gateway includes a plurality of lower layer processing units, a header extracting unit, at least one table with traffic information, a search engine arbiter unit, a flow control unit, and a plurality of output control units. Each lower layer processing unit connects to at least one data link and receives data packets from at least one data link. The header extracting unit is in communication with the plurality of lower layer processing units and capable of extracting header information from the data packets received by the plurality of lower layer processing unit. The search engine arbiter unit compares the extracted header information received from the header extracting unit with the table of traffic information and generates a new header related information based on comparison results. The flow control unit receives the extracted header information from the search engine arbiter unit and discards the data packet associated with the extracted header information according to a predefined criterion. The plurality of output control units receives the extracted header information from the flow control unit and distributes the extracted header information to a lower layer processing unit, wherein the lower layer processing unit transmits a data packet associated with the extracted header information to a destination after inserting the new header related information in the data packet.

The present system and methods are therefore advantageous as they enable data packets be forwarded expeditiously according to a quality of service guarantee. Other advantages and features of the present invention will become apparent after review of the hereinafter set forth Brief Description of the Drawings, Detailed Description of the Invention, and the Claims.

DETAILED DESCRIPTION OF THE INVENTION

In this description, the terms “packet,” and “header” are used interchangeably, and the terms “search result” and “new header related information” are used interchangeably. The term “application” as used herein is intended to encompass executable and nonexecutable software files, raw data, aggregated data, patches, and other code segments. Further, like numerals refer to like elements throughout the several views, and the articles “a” and “the” includes plural references, unless otherwise specified in the description.

In overview, an apparatus and method according to the invention enable an efficient hardware based data packet forwarding in a gateway server, wherein the gateway server receives data packets having different formats from different data networks and forwards them to their destinations after translating the header in each data packet.FIG. 9illustrates an architecture900of an apparatus906according to one embodiment of the invention. The apparatus906receives data packets from a plurality of lower layer processing units912, where each lower layer processing unit912has a packet input908and a packet output910and is in communication with an external source through a pair of data links. Alternatively, the lower layer processing unit912maybe in communication with the external source or destination through a single bidirectional physical link. When a data packet comes in from the physical layer, the lower layer processing unit912is responsible to receive the packet correctly and put it into a packet buffer904, which is a big chunk of memory, usually a synchronized dynamic random access memory (SDRAM). The SDRAM can be shared with the central processing unit902(CPU) and the advantage of sharing the SDRAM is that the total system cost is minimized.

After a data packet is received from the physical layer (link) by the lower layer processing unit912, a Header Extractor914parses the packet, extracts layer-2, layer-3, and layer-4 header information from the packet, and passes them to a Search Engine Arbiter916. The Search Engine Arbiter916coordinates the lookup of three tables, performs Denial of Service (DoS) Attack prevention, merges the search result from the three tables, and writes back the merged search result to the external SDRAM904. The three tables controlled and used by the Search Engine Arbiter906are Layer-2 table918, flow table920, and packet classifier and filter table922. These three tables contain network traffic related information and determine how a data packet is processed and how new header information is generated. The Layer-2 table918will be explained in more detail inFIG. 12; the flow table920will be explained in more detail inFIG. 13; the packet classified and filter table922will be explained in more detail inFIG. 14.

For the layer-2 table918lookup, the Search Engine Arbiter916checks if the source MAC address of the packet matches the MAC address field of an entry in the layer-2 table918. If the source MAC address matches one entry in the layer-2 table918, the packet is dropped if the source filter bit is enabled in this entry. If the destination MAC address of the packet matches the MAC address field of an entry, the search result is SUCCESS and the physical port information of the matching entry is returned back to the Search Engine Arbiter918.

The Search Engine Arbiter916uses the source/destination IP address and source/destination port number as the key to search the flow table920. If there is a match in the flow table920, the search result is SUCCESS and other fields in the same entry are returned back to the Search Engine Arbiter916. These fields include new destination MAC address, new source/destination IP address, new source/destination port number, class of the packet, PPPoE header insertion/removal (and PPPoE session ID if insertion), and necessary information needed for IPv4/IPv6 translation/tunnel.

If there is no match in the flow table920, it may mean that the apparatus906can not directly handle/forward the packet; the packet needs to be sent to CPU902for further processing by the software. Thus, the Search Engine Arbiter916activates the CPU Packet Classifier and Filter unit922. The CPU Packet Classifier and Filter unit922can match a range of source/destination IP address, and/or a range of source/destination port number, Ethertype value, and protocol number in an IP header. The CPU Packet Classifier and Filter unit922can be configured to ignore matches in any particular field. If there is a match in the CPU Packet Classifier and Filter unit922, the search is SUCCESS, the CPU Packet Classifier and Filter unit922returns back to Search Engine Arbiter two pieces of information: 1) whether to drop the packet and 2) if the packet is not dropped, the identity of the queue through which the packet is forwarded to CPU. The “drop the packet” decision can be used as a packet filter, which is one of the functions commonly seen in firewall devices. It also further offloads the CPU902, since potential attacking/intrusion packets can be dropped by the hardware (the apparatus906) directly.

The Search Engine Arbiter916also performs some basic check on the packets such as IP/TCP/UDP checksum verification and recalculation (since some fields in the IP/TCP/UDP header are modified, checksum requires recalculation), checks if the TTL (time-to-live field in an IP header) is 0 (if so, the packet should also be dropped according to the Internet standard). After all these works are done, the Search Engine Arbiter916merges the result into 64-bytes (seeFIG. 11for the detailed representation), and write back to the very beginning of the packet buffer. The Search Engine Arbiter916can handle multiple header information from multiple packets in a pipeline fashion, i.e., while a header information is compared against the flow table, the header information from another packet is compared with the Layer-2 table. Thus, the throughput from the Search Engine Arbiter916is maximized. The function of the Search Engine Arbiter916will be explained in more detail inFIGS. 15A-15B.

After the Search Engine Arbiter916processed the extracted header information, a new set of header related information is generated and written in the first 64 bytes of the packet buffer, as shown inFIG. 11, where the corresponding data packet is stored. The new header related information is generated by the Search Engine Arbiter916based on the information returned from looking up the three tables. The Search Engine Arbiter916also sends the extracted header information and output information to the Random Early Drop (RED) module924. The output information includes a buffer handle for the packet, a physical destination output port for the packet, a class of the queue to which the packet will be sent, and a packet length. The RED module924has the information of all queues, such as availability in each queue, and is responsible for control the flow of data packets by deciding whether a packet can be added to the targeted port and queue. If there is no room in the destination queue, the RED module924can drop the packet directly. The RED module924will also drop the packet if its “discard” bit is set. The RED module924will start to drop packets when the queue is almost, but not totally occupied. This approach avoids “global synchronization” phenomenon and congestion avoidance.

If RED module924decides that the packet can stay, the output information mentioned above is sent to the particular output queue as specified. The output queue1002is inside the queuing, scheduling and shaping module926and shown in more detail inFIG. 10. The queuing, scheduling and shaping module926is an output control unit and regulates the data packet outputs. The queuing, scheduling and shaping module926includes a plurality of output queues1002, a plurality of Leaky Bucket Shaping modules1004, a Scheduling module1006, and an overall Leaky Bucket Shaping module1008. In front of each output queue1002, there is a Leaky Bucket Shaping module1004, which is used to control the output rate of each output queue1002. The Leaky Bucket Shaping module1004(also known as transfer rate control module) enforces the output rate according to the following formula:At any time t, the sum of the packet length outputted P(t) is less than A*t+B
P(t)<=A*t+B(1)where A is a parameter representing the desired average rate of the queue, andB is the bucket size representing the maximum burstiness the queue can have.

When a packet becomes the head of line in the queue, the leaky bucket module checks if it conforms to the above formula, if not, the packet will be kept in the queue for a certain period of time until it conforms to formula (1). In this way, a user can control the traffic behavior of each queue.

The function of the Scheduling module1006is to select one of the head-of-line packets (from all of the output queues) for transmission. In one embodiment, two scheduling algorithms are used to pick packets for transmission: (1) combined strict priority and weighted fair queuing (WFQ) and (2) pure weighted fair queuing. In the first algorithm, combined strict priority and WFQ, one of the output queues1002is designated as the most important queue, and the packet will be selected to go out whenever there is a packet in this queue (of course it still under the constrain of the leaky bucket shaping module1004). The rest of the queues will be served in a weighted fair manner. The weighted fair manner means that the total sum of packet length outputted for each queue1002will conform to certain ratio in the long run. For example, if there are 3 queues (1, 2 and 3), and if the weight of each queue are set to be 4, 2, and 1 respectively. Then after a certain period of time, if queue 1 has transmitted 4 MB of data, then queue 2 must have transmitted around 2 MB and queue 3 must have transmitted around 1 MB. The scheme allows user to put delay sensitive data into the most important queue, and other traffics can share the bandwidth in a predefined ratio. For example, user can configure a hyper-text transfer protocol (HTTP) traffic to use 50% of the bandwidth, a file transfer protocol (FTP) traffic to use 20%, others traffics to use 10%. For the second algorithm, pure weighted fair queue, all of the output queues are configured with weighted fair manner.

After Scheduling module1006has selected a packet to be forwarded, there is an overall leaky bucket shaping module1008that controls the average rate and burstness of the aggregated output link. The leaky bucket module1004of each queue1002controls one single separate queue1002; the overall leaky bucket module1008controls one output link (which may have many queues). The overall leaky bucket module1008regulates the traffic of a single uplink so that the traffic on the uplink conforms to a quality of service (QoS) of a service level agreement between a service provider and end customer. The predefined transfer rate, i.e., QoS, is achieved through the combined effort of the Scheduling module1006and leaky bucket modules1004and1008.

When a packet passes through the overall leaky bucket module1008, it is ready for transmission. It is then sent to the lower layer processing unit912along with its packet buffer handle. The lower layer processing unit912reads in the header related information that is in the first 64-byte of the packet buffer, and reads the packet data. The lower layer processing unit912takes information from the first 64-bytes and insert them into different sections of the data packet replacing certain fields as defined in the 64-byte header related information. The insertions and replacements are done on the fly when a packet is being transmitted. While the packet stays in the packet buffer904, it stays intact, and it is modified only while it is being transmitted. When a packet or an extracted header information is discarded, dropped, or filtered out, the corresponding packet that is stored in the external memory is also discarded and the buffer made available to next data packet. This approach eliminates unnecessary data movement and wastes no memory bandwidth.

In one embodiment, the search result (new header related information) is located at the first 64 bytes (FIG. 11) of a packet buffer. Each packet buffer occupies 2 KB of memory, where bytes1-64are used to store search result, and bytes65-2048are used to store the actual packet data. The search result occupies a lot of space because a gateway in which the invention is likely used performs a lot of packet field replacements, and format translations. By putting the search result to an external SDRAM, instead of inside the chip, the chip size and cost are greatly reduced.

Now, directing the attention to the layer-2 table918, an entry1200of which is shown inFIG. 12. The entry1200includes a MAC address,1202, a destination filter1204, a source filter1206, a lock indicator1208, a validity indicator1210, an age out indicator1212, and a physical port indicator1214. The MAC address1202is used to compare with the destination MAC address in a layer-2 header. When the destination filter1204is enabled, the destination MAC address from the incoming packet is compared with the MAC address1202. If the destination MAC address of the packet matches the MAC address1202, then the search is a success and the physical port indicator1214is returned to the Search Engine Arbiter916. If the source filter1206is enabled, the source MAC address from the incoming packet is compared with the MAC address1202. If the source MAC address of the packet matches the MAC address1202, then the packet will be dropped. The lock indicator1208, if enabled, indicates that the entry will not be aged out, i.e., the entry will not be removed from the table for being an old entry. The validity indicator1210indicates whether the entry is a valid entry. The age out indicator1212, if enabled, indicates that the entry has been aged out. The physical port indicator1214indicates which physical port of the apparatus906has this MAC address.

FIG. 13illustrates an entry1300in the flow table920. The format1300includes the following fields:Next Hop MAC-WAN1302—WAN port next hop destination MAC addressNext Hop MAC-LAN1304—LAN port next hop destination MAC addressSSID1304—PPPoE Session IDLocal IP (v4)1310—source IPv4 address in private LANRemote IP (v4)1312—destination IPv4 address in WANR-port1314—remote port numberL-port1316—local port numberN-port1318—new port numberLAN (local) IP (v4/v6)1322—new IPv4 address or LAN IPv6 source IP addressRemote IP (v4/v6)1324—tunnel IPv4 address or WAN IPv6 destination IP addressOCTL1308, whereOCTL[15:8]=TOSOCTL[0]=PPPoE; If the WAN traffic will be encapsulated in PPPoEOCTL[2:1]=Class; Indicate transmit priorityOCTL[6]=LAN port; Indicate the output port for ingress trafficOCTL[7]=WAN port; Indicate the output port for egress trafficTCTL1320, whereTCTL[15:8]=reservedTCTL[0]=IPv4 Tunnel entryTCTL[1]=NAT entryTCTL[2]=Routing entryTCTL[3]=IPMC entryTCTL[4]=LAN is IPv6TCTL[5]=WAN is IPv6TCTL[7]=Protocol: 0=TCP; 1=UDP

Each entry of the flow table920has a mode associated with it. The mode is represented by TCTL [0:7] as described above. Each mode represents a flow and network condition. For example, in one embodiment,TCTL[0] is set when the public network uses a format different from the format used by the private network.TCTL[1] is set when the translation of the network address and the port number are needed, such as in a situation when multiple devices in a private network sharing a common public network address.TCTL[2] is set when there is no need to translate the network address or the port number, such as in a situation when a plurality of public network addresses are available to a plurality of devices in a private network.TCTL[3] is set for a multicast situation when the source network address and port number need to be translated.TCTL[4] is set when the private network uses IPv6 format.TCTL[5] is set when the public network uses IPv6 format.TCTL[7] is 0 when the protocol is TCP and 1 when the protocol is UDP.

The flow table look up is performed as follows:

An example of the flow table look up is described herein. When a data packet is received from a local area network (LAN), i.e. a private network, its header information is extracted by the Header Extractor unit914, and passed to the Search Engine Arbiter916for comparison. The Search Engine Arbiter916searches through all entries of the flow table920. If an entry has TCTL[1] set, then the extracted header information is compared to the entry. If LAN IP1322, Remote IP1324, R-port1314, and L-port1316match the corresponding elements from the extracted header information, then Local IP1310and N-port1318are returned to the Search Engine Arbiter916.

The flow table look up can be further illustrated in the following table 1 and corresponding explanation.

Field SetupIPv4 NAT:Local Host IP in (3)Remote IP in (2) and (4)Access IP in (1)Local host port in (6)Remote port in (5)Translated port in (7)TCTL[5:0]=0b00—0010IPv4 LAN NATPT:Local Host IP in (1)Remote IP (v4 equivalent) in (2)Remote v6 IP in (4)Access IP in (3)Local Host source port in (6)Remote port in (5)Translated port in (7)TCTL[5:0]=0b10—0010IPv6 LAN NATPT:Local Host IP in (3)Remote IP (v6 equivalent) in (4)Remote IP (v4) in (2)Access IP in (1)Local Host source port in (6)Remote port in (5)Translated port in (7)TCTL[5:0]=0b01—0010IPv6 in IPv4 Tunnel:Local Host IP in (3)Remote Host IP in (4)Local Tunnel terminal in (1)Remote Tunnel Terminal in (2)Local Host source port in (6)Remote port in (5)TCTL[5:0]=0b01—0001IPv6 route:Local Host IP in (3)Remote IP in (4)Local Host source port in (6)Remote port in (5)TCTL[5:0]=0b11—0100IPMC: (Same as all NAT cases other than the TCTL)TCTL[5:0]=0bxx—1000

FIG. 14illustrates an entry1400in the packet classifier and filter table922(also known as rule table). The format1400includes the following fields:Rport0˜Rport11402,1404: defines the range of destination port number a packet can match.Lport0˜Lport11406,1408: defines the range of source port number a packet can matchEthertype1410: define the Ethertype value a packet can matchL/RIPM1412: source and destination IP mask a packet can matchProtocol1414: protocol number in the IP header a packet can matchCCTL[0-20]1416where:CCTL[0]=L4 port match bi-directionalCCTL[1]=L4 port match local or destination. (0: Match local AND remote)CCTL[2]=IP match bi-directionalCCTL[3]=IP match local or destination. (0: Match local AND remote)CCTL[8]=Check if Ethertype matchCCTL[9]=Check if remote IP matchCCTL[10]=Check if local IP matchCCTL[11]=Check if remote L4 port matchCCTL[12]=Check if local L4 port matchCCTL[13]=Check if protocol matchCCTL[14]=Check if the source port applyCCTL[16]=Table is valid (Only valid entry can be linked!!)CCTL[17]=Filter the packet if match this ruleCCTL[19:18]=Applied source port. (bit18for port 0; bit19for port 1)CCTL[21:20]=Priority class used to pass the packet if match this rule

The packet classifier and filter table922is used in a manner similar to that of the flow table920. However, some considerations are taken.Since the IPv4 will be aligned to the right of the IPv6, IP Mask for the IPv4 should be the number of bits in v4 address plus 96. For example, the net mask 255.0.0.0 with 8 matching bit should have the mask value 8+96=104.If check port number is enabled, only TCP or UDP traffic will be matched.Rule is arranged in a link list for easier priority management. Once a rule is matching the packet, the search will stop. LNK field bit7indicates the end of the link. The register LHEAD indicates the starting entry of the link.

Because the packet classifier and filter table922can be use in unidirectional case, the flow direction first must be determined first. From the primary direction,Set the source IP to the LAN IP(2)Set the destination IP to the Remote IP (1)Set the source L4 port range to Lport0/1 (4)Set the destination L4 port range to Rport0/1 (3)Lport0 should always be smaller or equal to Lport1. So as to the Rport0, Rport1

The packet classifier and filter table922look up can be further illustrated in the following table 2 and corresponding explanation.

Now directing the attention toFIGS. 15A-B, where the Search Engine Arbiter916operations are explained in more detail. The Search Engine Arbiter916first check if any rules for denial of service (DoS) has been violated, step1502. A set of DoS rules are implemented in hardware for the Search Engine Arbiter916use. The rules are:Rule 1. drop the packet if Src_IP=Dst_IPRule 2. drop the packet if Src_IP=127.0.0.0Rule 3. drop the packet if Dst_IP=broadcastRule 4. drop the packet if TCP_SYN=1 & Dst_IP=multicastRule 5. drop the packet if TTL=0Rule 6. drop the packet if Protocol=TCP & Dst_Port=0Rule 7. drop the packet if Protocol=UDP & Dst_Port=0

If the DoS rules have been violated, then the Search Engine Arbiter916sets a discard bit, step1516, and the packet is sent to the RED module924, step1526. If the DoS rules have not been violated, then the Search Engine Arbiter916checks if the packet is a layer-2 broadcast, step1504. If the packet is a layer-2 broadcast, the Search Engine Arbiter916sets a CPU processing bit, step1510, and sends the packet to the packet classifier and filter table922, step1514. After checking for the layer-2 broadcast, the Search Engine Arbiter916checks whether the packet is a “split packet,” i.e., whether the packet has a partial data and the rest of the data is split in another packet, step1506. If that is the situation, the Search Engine Arbiter916sets a CPU processing bit, step1510, and sends the packet to the packet classifier and filter table922, step1514. The Search Engine Arbiter916also checks if the destination of physical layer matches the address of the physical layer of the public network or the private network, step1508. If the destination physical address matches one of the address of the physical layers, then the Search Engine Arbiter916processes the header information, step1512, and sends the packet to the packet classifier and filter table922, step1514.

If the destination physical address do not match one of the address of the physical layers, then the Search Engine Arbiter916checks if special processing is needed, step1518. The special handling can be set by the user through mode setting. After the special processing, step1520, the Search Engine Arbiter916starts the packet classifier and filter table922look up, step1521, and checks if a physical layer address is found, step1522. If the physical layer address is found, the Search Engine Arbiter916determines if the packet should be filtered out, step1524. If the packet is to be filtered out, the Search Engine Arbiter916sets a discard bit, step1516, and the packet is sent to the RED module924, step1526. If the packet is not to be filtered out, the Search Engine Arbiter916sends it to the RED module924for further processing, step1526.

If the physical layer address is not found, the Search Engine Arbiter916checks whether the content of the layer-2 table should be updated as part of an auto-learning process, step1528. If the auto-learn is enabled, the packet is broadcasted, step1532. If the auto-learn is disabled, the Search Engine Arbiter916sets a CPU processing bit, step1530, and sends the packet to the packet classifier and filter table922, step1514. If the special processing is not needed, the Search Engine Arbiter916sets a CPU processing bit, step1530, and sends the packet to the packet classifier and filter table922, step1514.

After the packet classifier and filter table922look up, the Search Engine Arbiter916checks if a flow is found, step1602(shown inFIG. 15B). If a flow is found, the Search Engine Arbiter916obtains new header related information, step1604, and generates a new checksum for the packet, step1606. After generating a new checksum, the Search Engine Arbiter916writes new header related information in the first 64 bytes of the packet buffer, step1608, and sends the packet to the RED module1610.

If no flow is found, the Search Engine Arbiter916checks if the packet should be filtered out, step1612. If the packet is not to be filtered out, the Search Engine Arbiter916proceeds to write the new header related information as described above, step1608and sends the packet to the RED module924, step1610. If the packet is to be filtered out, the Search Engine Arbiter916sets the discard bit, and sends the packet to the RED module924, step1610. The packet is then processed by the RED module924and the rest of the circuit as described above.

In the context ofFIGS. 15A-B, the steps illustrated do not require or imply any particular order of actions. The actions may be executed in sequence or in parallel. The method may be implemented, for example, by operating portion(s) of an electric circuit containing the invention, or by operating a CPU that executes a sequence of machine-readable instructions. The instructions can reside in various types of signal-bearing or data storage primary, secondary, or tertiary media. The media may comprise, for example, RAM (not shown) accessible by, or residing within, the components of the wireless network. Whether contained in RAM, a diskette, or other secondary storage media, the instructions may be stored on a variety of machine-readable data storage media, such as DASD storage (e.g., a conventional “hard drive” or a RAID array), magnetic tape, electronic read-only memory (e.g., ROM, EPROM, or EEPROM), flash memory cards, an optical storage device (e.g. CD-ROM, WORM, DVD, digital optical tape), paper “punch” cards, or other suitable data storage media including digital and analog transmission media.

While the invention has been particularly shown and described with reference to a preferred embodiment thereof, it will be understood by those skilled in the art that various changes in form and detail may be made without departing from the spirit and scope of the present invention as set forth in the following claims. Furthermore, although elements of the invention may be described or claimed in the singular, the plural is contemplated unless limitation to the singular is explicitly stated.