A method and system for ARP and routing management based on FPGA and CPU collaboration

By using FPGA and CPU in collaboration to implement ARP and routing management, the problems of high CPU resource consumption, low table lookup efficiency and insufficient table security in existing technologies are solved, and efficient and secure data packet forwarding is achieved in high-speed network environments.

CN123123231APending Publication Date: 2026-11-17JIANGSU NEW QUALITY INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611273115.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-20
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

In existing network communication systems, the pure software architecture for implementing ARP and routing management suffers from high CPU resource consumption, low table lookup efficiency, and insufficient table security in high-speed network environments.

Method used

ARP and routing management are implemented using FPGA and CPU in collaboration. FPGA is responsible for hardware-accelerated table lookup and packet forwarding, while CPU is responsible for ARP request and response and table entry management. Data interaction is carried out through MAC2MAC direct communication to ensure table entry security and efficiency.

Benefits of technology

Significantly reduces CPU and memory resource consumption, improves table lookup speed and stability, and enhances the forwarding performance and security of network devices in high-bandwidth, high-concurrency scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123123231A_ABST
    Figure CN123123231A_ABST
Patent Text Reader

Abstract

This invention discloses a method and system for ARP and routing management based on FPGA and CPU collaboration. After the FPGA and CPU complete initialization, the CPU configures the FPGA's operating parameters, routing table, and ARP table configuration information to the FPGA via MAC-MAC direct communication. The FPGA receives external network data packets through the PHY chip interface, distinguishing between external IP packets and external ARP packets. When processing external IP packets, the FPGA extracts the destination IP address, queries the internal routing table to determine the next-hop IP, and then queries the internal ARP table; if a corresponding MAC address is found, processing continues; otherwise, an ARP alarm message is generated and sent to the CPU. The CPU generates ARP request and response messages based on the ARP alarm message and the external ARP packet, completes local ARP table update and aging management, generates updated routing table and ARP table configuration information, and sends it to the FPGA. The FPGA updates its internal routing table and ARP table, and sends CPU-side ARP packets to the external network through the PHY chip interface. This invention solves the problems of high CPU and memory resource consumption and low table lookup efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of network communication technology, and specifically to a method and system for implementing ARP and routing management based on FPGA and CPU collaboration. Background Technology

[0002] In existing network communication systems, Address Resolution Protocol (ARP) and routing management are the core foundational functions for IP packet forwarding. The ARP protocol resolves IP addresses to MAC addresses, and the resulting ARP table is crucial for Layer 2 packet encapsulation. The routing table determines the exit interface and next-hop address of IP packets and is the core data structure for Layer 3 forwarding. Currently, mainstream network devices generally employ a pure software architecture to implement these functions. The CPU runs protocol stack software modules to handle ARP packet reception, parsing, and response, as well as routing table lookup, updates, and maintenance. Both ARP and routing table entries are stored in system memory and managed and accessed by the operating system kernel. This approach is widely used in conventional speed network devices.

[0003] However, implementing ARP and routing management purely in software has significant technical drawbacks in high-speed network environments. First, ARP processing and route lookups rely entirely on CPU-driven software operations, continuously consuming substantial CPU resources and system memory bandwidth. Under high traffic and high concurrency scenarios, slow lookup response times can easily become a performance bottleneck for packet forwarding, leading to increased device forwarding latency and decreased throughput. Second, ARP and routing tables are stored in system memory, completely exposed to software access, making them vulnerable to malicious tampering, accidental operations, or vulnerability attacks, compromising the security and reliability of the entries. Furthermore, software lookups cannot leverage the advantages of hardware parallel processing; their efficiency and stability fail to meet the requirements of high-speed, stable network devices.

[0004] Therefore, there is an urgent need for a method based on FPGA and CPU collaboration to implement ARP and routing management, in order to solve the problems of high CPU and memory resource consumption and low table lookup efficiency in existing technologies. Summary of the Invention

[0005] To address these issues, this invention provides a method and system for implementing ARP and routing management based on FPGA and CPU collaboration, solving problems such as high CPU and memory resource consumption, low table lookup efficiency, and the vulnerability and inadequacy of ARP and routing tables stored in system memory when handling ARP and routing management in traditional pure software methods.

[0006] To achieve the above objectives, the present invention provides the following technical solution: a method for implementing ARP and routing management based on FPGA and CPU collaboration, comprising:

[0007] The FPGA performs operation parameter reset and initialization; the CPU performs operation environment initialization; after initialization, the CPU configures the FPGA operation parameters, routing table configuration information, and ARP table configuration information to the FPGA via MAC2MAC direct communication;

[0008] After the FPGA completes the parameter and table entry configuration, it receives external network data packets through the PHY chip interface, and determines the type of the data packets to obtain external IP packets and external ARP packets.

[0009] For the external IP packet, the FPGA extracts the destination IP address from the external IP packet; based on the destination IP address, it determines the next-hop IP address by querying the FPGA's internal routing table; based on the next-hop IP address, it queries the FPGA's internal ARP table.

[0010] If the MAC address corresponding to the next-hop IP address is found in the ARP table inside the FPGA, the FPGA will perform subsequent processing of the external IP packet based on the MAC address; if the MAC address corresponding to the next-hop IP address is not found in the ARP table inside the FPGA, the FPGA will generate an ARP alarm message based on the next-hop IP address and send the ARP alarm message to the CPU through MAC2MAC direct communication.

[0011] For the external ARP message, the FPGA forwards the external ARP message to the CPU via MAC2MAC direct communication;

[0012] Based on the received ARP alarm messages and external ARP messages, the CPU generates CPU-side ARP request messages and CPU-side ARP reply messages, and performs local ARP table cache updates and ARP table aging management, generating updated ARP table configuration information and updated routing table configuration information; the CPU-side ARP request messages, CPU-side ARP reply messages, updated ARP table configuration information, and updated routing table configuration information are synchronously sent to the FPGA via MAC2MAC direct communication;

[0013] Based on the updated ARP table configuration information and the updated routing table configuration information, the FPGA updates the FPGA internal routing table and the FPGA internal ARP table respectively, and sends the CPU-side ARP request message and the CPU-side ARP reply message to the external network through the PHY chip interface.

[0014] As a preferred embodiment of the method for implementing ARP and routing management based on FPGA and CPU collaboration, when the FPGA queries the internal routing table based on the destination IP address, it determines whether the destination IP address and the FPGA external network interface IP address belong to the same network segment; if they belong to the same network segment, the destination IP address is determined as the next-hop IP address; if they do not belong to the same network segment, the gateway IP address is determined as the next-hop IP address.

[0015] As a preferred solution for the method of ARP and routing management based on FPGA and CPU collaboration, when the CPU updates the local ARP table cache, if the corresponding IP address and MAC address entries already exist in the local ARP table cache, the aging flag of the corresponding IP address and MAC address entries is cleared; if they do not exist, the corresponding IP address and MAC address entries are added to the local cache.

[0016] As a preferred solution for ARP and routing management based on FPGA and CPU collaboration, when the CPU performs ARP table aging management, it traverses the local ARP table cache according to a set time period, sets the aging flag for entries that have not been refreshed, and deletes the entries that have been set to the aging flag locally, generating the corresponding ARP table deletion configuration information and sending it to the FPGA.

[0017] As a preferred solution for a method of ARP and routing management based on FPGA and CPU collaboration, after receiving the external ARP packet, the CPU determines whether it is an ARP request to resolve the local IP address; if so, it encapsulates and sends the CPU-side ARP reply packet; if not, it discards the external ARP packet.

[0018] This invention also provides a system for implementing ARP and routing management based on FPGA and CPU collaboration, and employs the above-mentioned method for implementing ARP and routing management based on FPGA and CPU collaboration, including:

[0019] The FPGA and CPU initialization unit is used for resetting and initializing the FPGA's operating parameters and initializing the CPU's operating environment. After initialization, the CPU configures the FPGA's operating parameters, routing table configuration information, and ARP table configuration information to the FPGA via MAC2MAC direct communication.

[0020] The external network data packet acquisition and processing unit is used to receive external network data packets through the PHY chip interface after the FPGA completes the parameter and table entry configuration, and to determine the type of the data packets to obtain external IP packets and external ARP packets.

[0021] An external IP packet processing unit is used to: extract the destination IP address from the external IP packet using the FPGA; determine the next-hop IP address by querying the FPGA's internal routing table based on the destination IP address; and query the FPGA's internal ARP table based on the next-hop IP address.

[0022] The MAC address lookup unit is used to perform subsequent processing of the external IP packet based on the MAC address if the MAC address corresponding to the next-hop IP address is found in the ARP table inside the FPGA; if the MAC address corresponding to the next-hop IP address is not found in the ARP table inside the FPGA, the FPGA generates an ARP alarm message based on the next-hop IP address and sends the ARP alarm message to the CPU through MAC2MAC direct communication.

[0023] An external ARP packet processing unit is used to forward the external ARP packet from the FPGA to the CPU via MAC2MAC direct communication.

[0024] The ARP packet processing and configuration information update unit is used by the CPU to generate CPU-side ARP request packets and CPU-side ARP reply packets based on the received ARP alarm packets and external ARP packets, and to perform local ARP table cache updates and ARP table aging management, generating updated ARP table configuration information and updated routing table configuration information; and to synchronously send the CPU-side ARP request packets, the CPU-side ARP reply packets, the updated ARP table configuration information, and the updated routing table configuration information to the FPGA via MAC2MAC direct communication;

[0025] The FPGA internal routing table and internal ARP table update unit is used to update the FPGA internal routing table and the FPGA internal ARP table respectively based on the updated ARP table configuration information and the updated routing table configuration information, and send the CPU-side ARP request message and the CPU-side ARP reply message to the external network through the PHY chip interface.

[0026] As a preferred solution for a system that uses FPGA and CPU to collaboratively implement ARP and routing management, the external IP packet processing unit determines whether the destination IP address and the FPGA external network interface IP address belong to the same network segment when the FPGA queries the internal routing table based on the destination IP address. If they belong to the same network segment, the destination IP address is determined as the next-hop IP address; if they do not belong to the same network segment, the gateway IP address is determined as the next-hop IP address.

[0027] As a preferred solution for a system that uses FPGA and CPU to collaboratively implement ARP and routing management, in the ARP packet processing and configuration information update unit, when the CPU updates the local ARP table cache, if the corresponding IP address and MAC address entries already exist in the local ARP table cache, then the aging flag of the corresponding IP address and MAC address entries is cleared; if they do not exist, then the corresponding IP address and MAC address entries are added to the local cache.

[0028] As a preferred solution for a system that uses FPGA and CPU to collaboratively implement ARP and routing management, the ARP message processing and configuration information update unit, when the CPU performs ARP table aging management, traverses the local ARP table cache according to a set time period, sets the aging flag for entries that have not been refreshed, and deletes the entries that have been set to the aging flag locally, generating corresponding ARP table deletion configuration information and sending it to the FPGA.

[0029] As a preferred solution for a system that uses FPGA and CPU to collaboratively implement ARP and routing management, in the ARP packet processing and configuration information update unit, after the CPU receives the external ARP packet, it determines whether it is an ARP request to resolve the local IP address; if so, it encapsulates and sends the CPU-side ARP reply packet; if not, it discards the external ARP packet.

[0030] The present invention has the following advantages:

[0031] First, it adopts a hardware and software co-engineering architecture of FPGA and CPU. The FPGA undertakes hardware acceleration operations such as ARP table lookup, routing table lookup and packet forwarding, while the CPU focuses on ARP request and response generation, table entry management and aging maintenance, which greatly reduces the CPU and memory resource consumption and improves the packet processing efficiency in high-speed networks.

[0032] Secondly, the ARP table and routing table are stored inside the FPGA, which does not rely on system memory. This prevents them from being tampered with or misoperated by system software, significantly improving the security of the entries and the stability of packet forwarding.

[0033] Third, the table lookup and frame header encapsulation are completed in parallel in the FPGA hardware, which is faster and has lower latency than pure software table lookup, and can better meet the forwarding needs of high bandwidth and high concurrency network scenarios.

[0034] Fourth, the FPGA and CPU use a MAC2MAC direct connection mode for data interaction, which ensures a stable communication link with low latency and improves the real-time performance of configuration distribution and message interaction.

[0035] Fifth, the routing table and ARP table are managed uniformly by the CPU and synchronized to the FPGA, balancing hardware forwarding performance with software configuration flexibility, and facilitating table entry updates, aging, and maintenance management. Attached Figure Description

[0036] To more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings in the following description are merely exemplary, and those skilled in the art can derive other embodiments based on the provided drawings without creative effort.

[0037] The structures, proportions, sizes, etc. illustrated in this specification are only for the purpose of assisting those skilled in the art in understanding and reading the content disclosed herein, and are not intended to limit the conditions under which the present invention can be implemented. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in the proportions, or adjustments to the size, without affecting the effects and objectives that the present invention can produce, should still fall within the scope of the technical content disclosed in the present invention.

[0038] Figure 1 This is a flowchart illustrating the method for implementing ARP and routing management based on FPGA and CPU collaboration provided in Embodiment 1 of the present invention.

[0039] Figure 2 This is a schematic diagram of the service process in the method for implementing ARP and routing management based on FPGA and CPU collaboration provided in Embodiment 1 of the present invention;

[0040] Figure 3 This is a schematic diagram of the FPGA service processing flow in the method for ARP and routing management based on FPGA and CPU collaboration provided in Embodiment 1 of the present invention;

[0041] Figure 4 This is a schematic diagram of the CPU service processing flow in the method for ARP and routing management based on FPGA and CPU collaboration provided in Embodiment 1 of the present invention;

[0042] Figure 5 This is a schematic diagram of the system architecture for ARP and routing management based on FPGA and CPU collaboration, as provided in Embodiment 2 of the present invention. Detailed Implementation

[0043] The following specific embodiments illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0044] Example 1

[0045] See Figure 1 Embodiment 1 of the present invention provides a method for implementing ARP and routing management based on FPGA and CPU collaboration, including the following steps:

[0046] S1. The FPGA performs operation parameter reset and initialization; the CPU performs operation environment initialization; after initialization, the CPU configures the FPGA operation parameters, routing table configuration information, and ARP table configuration information to the FPGA through MAC2MAC direct communication.

[0047] S2. After the FPGA completes the parameter and table entry configuration, it receives external network data packets through the PHY chip interface, and determines the type of the data packets to obtain external IP packets and external ARP packets.

[0048] S3. For the external IP packet, the FPGA extracts the destination IP address from the external IP packet; based on the destination IP address, it determines the next-hop IP address by querying the FPGA's internal routing table; based on the next-hop IP address, it queries the FPGA's internal ARP table.

[0049] S4. If the MAC address corresponding to the next-hop IP address is found in the ARP table inside the FPGA, the FPGA performs subsequent processing of the external IP packet based on the MAC address; if the MAC address corresponding to the next-hop IP address is not found in the ARP table inside the FPGA, the FPGA generates an ARP alarm message based on the next-hop IP address and sends the ARP alarm message to the CPU through MAC2MAC direct communication.

[0050] S5. For the external ARP message, the FPGA forwards the external ARP message to the CPU through MAC2MAC direct communication;

[0051] S6. Based on the received ARP alarm message and the external ARP message, the CPU generates a CPU-side ARP request message and a CPU-side ARP reply message, and performs local ARP table cache update and ARP table aging management to generate updated ARP table configuration information and updated routing table configuration information; the CPU-side ARP request message, the CPU-side ARP reply message, the updated ARP table configuration information, and the updated routing table configuration information are synchronously sent to the FPGA via MAC2MAC direct communication;

[0052] S7. Based on the updated ARP table configuration information and the updated routing table configuration information, the FPGA updates the FPGA internal routing table and the FPGA internal ARP table respectively, and sends the CPU-side ARP request message and the CPU-side ARP reply message to the external network through the PHY chip interface.

[0053] In this embodiment, in step S1, the FPGA resets and initializes its operating parameters; the CPU initializes its operating environment; after initialization, the CPU configures the FPGA's operating parameters, routing table configuration information, and ARP table configuration information to the FPGA via MAC2MAC direct communication.

[0054] Specifically, such as Figure 2 The diagram shown is a schematic of the business process flow of this invention. A001 represents the external network environment; A002 is the FPGA chip, primarily responsible for ARP table lookup, routing table lookup, packet forwarding, and IP packet processing; Network port 1 uses a PHY chip for network packet communication between the FPGA and the external network; Network ports 2 and 3 are directly connected and use MAC2MAC mode for high-speed, low-latency, and reliable data communication between the FPGA and the CPU. A003 is the CPU chip, primarily responsible for ARP request, ARP reply, ARP aging, and FPGA configuration processing; Network port 3 is directly connected to Network port 2 and uses MAC2MAC mode for high-speed, low-latency, and reliable data communication between the CPU and the FPGA.

[0055] In this embodiment, the FPGA first performs a reset and hardware parameter initialization to prepare the hardware for message reception, table lookup, and forwarding; the CPU simultaneously completes the system environment and network port initialization to ensure that it has configuration and protocol processing capabilities.

[0056] Specifically, such as Figure 3 Step S001 shown: Reset and initialize FPGA operating parameters; Figure 4 Step S004 shown: Initialize the CPU environment (not limited to the IP address, MAC address, etc. of network port 3).

[0057] After initialization, the CPU sends working parameters, initial routing table and ARP table to the FPGA through the MAC2MAC direct high-speed channel, enabling the FPGA to independently complete high-speed table lookup and packet forwarding without CPU intervention, laying the foundation for hardware and software collaboration.

[0058] Specifically, the steps by which the CPU configures the FPGA operating parameters, routing table configuration information, and ARP table configuration information to the FPGA are as follows: Figure 4 As shown:

[0059] S410: Configure FPGA operating parameters, then proceed to S411;

[0060] S411: Encapsulate into an FPGA operation parameter configuration management request message (not limited to the IP address, MAC address, etc. of network port 1) and forward to S412;

[0061] S412: Send the FPGA operation parameter configuration management request message to network port 3, then transfer to S201;

[0062] S420: Configure the routing table, then proceed to S421;

[0063] S421: Encapsulate into a configuration management request message for adding or deleting routing tables, and forward to S422;

[0064] S422: Send the routing table configuration management request message to network interface 3, then proceed to S201.

[0065] like Figure 3 As shown, the specific steps for FPGA to configure parameters based on the information received from the CPU are as follows:

[0066] S201: Receives data packets from the CPU via network port 2 and forwards them to S202;

[0067] S202: Determine the data packet type. If the data packet is an FPGA operation parameter configuration management request message, proceed to S210; if the data packet is a routing table configuration management request message, proceed to S220; if the data packet is an ARP table configuration management request message, proceed to S230; if the data packet is an ARP message, proceed to S240.

[0068] S210: The data packet is an FPGA operation parameter configuration management request message, proceed to S211;

[0069] S211: Set FPGA operating parameters (not limited to IP address, MAC address, etc. of network port 1), then proceed to S212;

[0070] S212: Encapsulate the FPGA operation parameter configuration management response message, send the response message to network port 2, and transfer to S430;

[0071] S220: The data packet is a routing table configuration management request message; proceed to S221.

[0072] S221: Determine the type of the routing table configuration management request message. If it is to add routing table configuration information, proceed to S222; if it is to delete routing table configuration information, proceed to S223.

[0073] S222: Add routing table configuration information, proceed to S224;

[0074] S223: Delete routing table configuration information, proceed to S224;

[0075] S224: Encapsulate the routing table configuration management response message, send the response message to network interface 2, and then transfer to S430;

[0076] S230: The data packet is an ARP table configuration management request message, proceed to S231.

[0077] In this embodiment, in step S2, after the FPGA completes the parameter and table entry configuration, it receives external network data packets through the PHY chip interface, and determines the type of the data packets to obtain external IP packets and external ARP packets.

[0078] Specifically, the FPGA establishes physical layer communication with the external network through the PHY chip interface and continuously receives network data packets. The FPGA identifies the packet type at the hardware layer, distinguishing between external IP packets used for Layer 3 forwarding and external ARP packets used for address resolution, thereby enabling the separate processing of different types of packets and avoiding uploading all packets to the CPU, thus reducing system resource consumption.

[0079] like Figure 3 As shown, the specific steps for the FPGA to receive external network data packets and perform type determination are as follows:

[0080] S101: Receive network data packets from the external network from network port 1 and transfer them to S102;

[0081] S102: Determine the network packet type. If the network packet is an IP packet, proceed to S110; if the network packet is an ARP packet, proceed to S120.

[0082] In this embodiment, in step S3, for the external IP packet, the FPGA extracts the destination IP address from the external IP packet; based on the destination IP address, it determines the next-hop IP address by querying the FPGA's internal routing table; and based on the next-hop IP address, it queries the FPGA's internal ARP table.

[0083] Specifically, for external IP packets, the FPGA first extracts the target IP address from the packet header, uses this address as an index to query the FPGA's internal routing table, and determines the next-hop IP address of the packet based on the longest prefix matching principle; then, using the next-hop IP address as an index, it queries the FPGA's internal ARP table to obtain the corresponding MAC address, providing the necessary address information for Layer 2 packet encapsulation.

[0084] like Figure 3 As shown, the specific steps are as follows:

[0085] S110: The network data packet is an IP packet, forward to S111;

[0086] S111: Extract the destination IP from the IP packet header and proceed to S112;

[0087] S112: Query the routing table to determine if the destination IP address and the IP address of network interface 1 are in the same network, determine the next hop IP, if they are in the same network, then go to S114; otherwise go to S113.

[0088] S113: The next hop IP is the gateway IP, proceed to S115;

[0089] S114: The next hop IP is the destination IP, then proceed to S115.

[0090] In this embodiment, in step S4, if the MAC address corresponding to the next-hop IP address is found in the ARP table inside the FPGA, the FPGA performs subsequent processing of the external IP packet based on the MAC address; if the MAC address corresponding to the next-hop IP address is not found in the ARP table inside the FPGA, the FPGA generates an ARP alarm message based on the next-hop IP address and sends the ARP alarm message to the CPU through MAC2MAC direct communication.

[0091] Specifically, when the ARP table is hit, the FPGA directly uses the found MAC address to complete the packet encapsulation and enter the subsequent forwarding process; when the ARP table is not hit, the FPGA does not handle address resolution itself, but generates an ARP alarm message containing the missing IP address, and sends it to the CPU through the MAC2MAC channel to trigger the CPU to initiate address resolution, realizing a collaborative mechanism of fast hardware forwarding and software completion of table entries.

[0092] like Figure 3 As shown, the specific steps are as follows:

[0093] S115: Query the ARP table to confirm whether the MAC address corresponding to the next-hop IP exists. If it exists, proceed to S117; otherwise, proceed to S116.

[0094] S116: Encapsulate the ARP alarm message according to the next-hop IP address, send the alarm message to network interface 2, and then transfer to S430;

[0095] S117: Hand over the IP packet to the subsequent IP packet processing logic module;

[0096] S301: Data packets from the IP packet processing logic module are transferred to S302;

[0097] S302: Extract the destination IP from the IP packet header and proceed to S303;

[0098] S303: Query the routing table to determine if the destination IP address and the IP address of network interface 1 are in the same network, determine the next hop IP, and if they are in the same network, then proceed to S305; otherwise, proceed to S304.

[0099] S304: The next hop IP is the gateway IP, proceed to S306;

[0100] S305: If the next-hop IP is the destination IP, proceed to S306;

[0101] S306: Query the ARP table to confirm whether the MAC address corresponding to the next-hop IP exists. If it exists, proceed to S308; otherwise, proceed to S307.

[0102] S307: Encapsulate the ARP alarm message according to the next-hop IP address, send the alarm message to network interface 2, and then transfer to S430;

[0103] S308: Updates the Ethernet frame header based on the destination MAC address and sends the updated network data packet to the external network through network port 1.

[0104] like Figure 4 As shown, the CPU receives the ARP alarm message sent by the FPGA:

[0105] S430: Receives data packets from the FPGA via network port 3 and forwards them to S431.

[0106] In this embodiment, in step S5, for the external ARP message, the FPGA forwards the external ARP message to the CPU through MAC2MAC direct communication.

[0107] Specifically, since FPGA does not have complete software processing capabilities for the ARP protocol, it directly transmits ARP request and response messages from the external network to the CPU. The CPU then judges, responds to, and maintains local cache according to the ARP protocol specifications, maintaining a clear division of labor where the CPU is responsible for the protocol logic and the FPGA is responsible for hardware acceleration.

[0108] like Figure 3As shown, the steps for the FPGA to forward external ARP packets to the CPU via MAC2MAC direct communication are as follows:

[0109] S120: The network data packet is an ARP message, forward to S121;

[0110] S121: Send the ARP request message and ARP reply message to network interface 2, and then transfer to S430.

[0111] like Figure 4 As shown, the CPU receives data sent by the FPGA:

[0112] S430: Receives data packets from the FPGA via network port 3 and forwards them to S431.

[0113] In this embodiment, in step S6, the CPU generates CPU-side ARP request messages and CPU-side ARP response messages based on the received ARP alarm messages and external ARP messages, and performs local ARP table cache updates and ARP table aging management to generate updated ARP table configuration information and updated routing table configuration information. The CPU-side ARP request messages, CPU-side ARP response messages, updated ARP table configuration information, and updated routing table configuration information are synchronously sent to the FPGA via MAC2MAC direct communication.

[0114] Specifically, after receiving ARP alarms and external ARP packets, the CPU generates ARP request or response packets according to the protocol, while maintaining the local ARP cache, adding new entries, refreshing old entries, and performing aging deletion. The CPU then distributes the updated routing table and ARP table information, as well as the ARP packets to be sent, to the FPGA to ensure that the FPGA hardware entries and CPU software data are consistent, providing an accurate basis for subsequent high-speed forwarding.

[0115] like Figure 4 As shown, the specific processing steps of the CPU are as follows:

[0116] S430: Receives data packets from the FPGA via network port 3 and forwards them to S431;

[0117] S431: Determine the data packet type. If the data packet is an ARP alarm message, proceed to S501; if the data packet is an ARP reply message, proceed to S601; if the data packet is an ARP request message, proceed to S701; if the data packet is a configuration management reply message for FPGA operating parameters, routing table, or ARP table, proceed to S801.

[0118] S501: The data packet is an ARP alarm message, proceed to S502;

[0119] S502: Extract the IP address from the ARP alarm message and forward to S503;

[0120] S503: Encapsulate the ARP request packet corresponding to the IP address and forward it to S504;

[0121] S504: Send the ARP request message to network interface 3, then forward to S201;

[0122] S601: The data packet is an ARP reply message, proceed to S602;

[0123] S602: Extract the valid IP address and MAC address from the ARP reply message and forward to S603;

[0124] S603: Check the local cached ARP table to see if the IP address and MAC address already exist. If they do, proceed to S605; otherwise, proceed to S604.

[0125] S604: Add the IP address and MAC address to the local cached ARP table, then proceed to S606;

[0126] S605: Clear the aging flag of the corresponding IP address and MAC address entries in the local cached ARP table;

[0127] S606: Based on the IP address and MAC address, encapsulate the request into an ARP table configuration management request message and forward it to S607;

[0128] S607: Send the ARP table configuration management request message to network interface 3, then transfer to S201;

[0129] S701: The data packet is an ARP request message, proceed to S702;

[0130] S702: Determine if it is a request to resolve the local IP address. If yes, proceed to S704; otherwise, proceed to S703.

[0131] S703: Discard message;

[0132] S704: Encapsulate the corresponding ARP reply message and proceed to S705;

[0133] S705: Sends the ARP reply message to network interface 3, then forwards to S201;

[0134] S801: The data packet is a configuration management response message for FPGA operating parameters, routing table, and ARP table. It is then forwarded to S802.

[0135] S802: Perform corresponding process processing on the configuration management response message results;

[0136] S440: ARP table aging process, proceed to S441;

[0137] S441: Perform the preset aging sleep time, then proceed to S442;

[0138] S442: Loop through the local cached ARP table, then go to S443;

[0139] S443: Determine if the local cached ARP table has been traversed. If yes, proceed to S441; otherwise, proceed to S444.

[0140] S444: Determine whether the aging flag of the corresponding entry is set. If yes, proceed to S446; otherwise, proceed to S445.

[0141] S445: Set the aging flag of the corresponding entry and proceed to S442;

[0142] S446: Based on the IP address and MAC address in this entry, encapsulate it into a Deletion of ARP Table Configuration Management Request message and proceed to S447;

[0143] S447: Delete the entry in the local cached ARP table, then proceed to S448;

[0144] S448: Send the ARP table deletion configuration management request message to network interface 3, then forward to S201, and then forward to S442;

[0145] S201: Network port 3 is directly connected to network port 2, and packets are forwarded from the CPU to the FPGA.

[0146] In this embodiment, in step S7, based on the updated ARP table configuration information and the updated routing table configuration information, the FPGA updates the FPGA internal routing table and the FPGA internal ARP table respectively, and sends the CPU-side ARP request message and the CPU-side ARP reply message to the external network through the PHY chip interface.

[0147] Specifically, the FPGA performs add, delete, and modify operations on the internal routing table and ARP table based on the configuration information issued by the CPU to ensure that the hardware table lookup data is up-to-date. At the same time, it sends the ARP request and response packets generated by the CPU to the external network through the PHY interface to complete the ARP resolution interaction, so that subsequent IP packets can be directly forwarded by the FPGA hardware, forming a complete "table lookup-alarm-resolution-update-forward" closed loop.

[0148] like Figure 3 As shown, the specific steps for updating the internal routing table and ARP table of the FPGA are as follows:

[0149] S201: Receives data packets from the CPU via network port 2 and forwards them to S202;

[0150] S202: Determine the data packet type. If the data packet is an FPGA operation parameter configuration management request message, proceed to S210; if the data packet is a routing table configuration management request message, proceed to S220; if the data packet is an ARP table configuration management request message, proceed to S230; if the data packet is an ARP message, proceed to S240.

[0151] S220: The data packet is a routing table configuration management request message; proceed to S221.

[0152] S221: Determine the type of the routing table configuration management request message. If it is to add routing table configuration information, proceed to S222; if it is to delete routing table configuration information, proceed to S223.

[0153] S222: Add routing table configuration information, proceed to S224;

[0154] S223: Delete routing table configuration information, proceed to S224;

[0155] S224: Encapsulate the routing table configuration management response message, send the response message to network interface 2, and then transfer to S430;

[0156] S230: The data packet is an ARP table configuration management request message, proceed to S231;

[0157] S231: Determine the type of the ARP table configuration management request message. If it is to add ARP table configuration information, proceed to S232; if it is to delete ARP table configuration information, proceed to S233.

[0158] S232: Add ARP table configuration information, proceed to S234;

[0159] S233: Delete ARP table configuration information, proceed to S234;

[0160] S234: Encapsulate the ARP table configuration management response message, send the response message to network interface 2, and then transfer to S430;

[0161] S240: The data packet is an ARP message, proceed to S241;

[0162] S241: Send ARP request messages and ARP reply messages to the external network through network port 1.

[0163] The application scenarios of this invention are as follows:

[0164] In high-throughput switch and gateway device scenarios in data centers, this invention accelerates ARP table lookup and routing lookup through FPGA hardware, reduces CPU load, adapts to the needs of high-volume, high-concurrency data forwarding, and maintains stable operation of the device for a long time.

[0165] In enterprise-level core routers and aggregation layer network devices, this invention stores the ARP table and routing table in the FPGA, which improves the security of table entries, reduces the risk of software tampering, and ensures the reliability of data forwarding within the enterprise intranet.

[0166] In industrial Ethernet and fieldbus communication equipment scenarios, this invention reduces system resource consumption and improves forwarding response speed, meeting the long-term operation requirements of industrial environments for equipment stability and low latency.

[0167] In scenarios involving carrier access networks and edge routing devices, this invention optimizes the hardware and software collaborative processing mechanism to improve address resolution and routing forwarding capabilities when multiple users access the network concurrently.

[0168] In network security devices and perimeter protection gateway scenarios, this invention enhances the protection capabilities of ARP and routing table entries, reduces the impact of protocol layer attacks on the forwarding process, and improves the overall security of the device.

[0169] In high-performance server network cards and intelligent network interface devices, this invention enables ARP offloading and routing processing functions, improving the efficiency and stability of server data interaction with the outside world.

[0170] It should be noted that the method of this disclosure embodiment can be executed by a single device, such as a computer or server. The method of this embodiment can also be applied to a distributed scenario, where multiple devices cooperate to complete the task. In such a distributed scenario, one of these devices may execute only one or more steps of the method of this disclosure embodiment, and the multiple devices will interact with each other to complete the method described.

[0171] It should be noted that the above description describes some embodiments of this disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in a different order than that shown in the above embodiments and still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0172] Example 2

[0173] See Figure 5 Embodiment 2 of the present invention also provides a system for ARP and routing management based on FPGA and CPU collaboration, including:

[0174] The FPGA and CPU initialization unit 001 is used for resetting and initializing the FPGA's operating parameters and initializing the CPU's operating environment. After initialization, the CPU configures the FPGA's operating parameters, routing table configuration information, and ARP table configuration information to the FPGA via MAC2MAC direct communication.

[0175] The external network data packet acquisition and processing unit 002 is used to receive external network data packets through the PHY chip interface after the FPGA completes the parameter and table entry configuration, and to determine the type of the data packets to obtain external IP packets and external ARP packets.

[0176] The external IP packet processing unit 003 is used to: extract the destination IP address from the external IP packet using the FPGA; determine the next-hop IP address by querying the FPGA's internal routing table based on the destination IP address; and query the FPGA's internal ARP table based on the next-hop IP address.

[0177] The MAC address lookup unit 004 is used to perform subsequent processing of the external IP packet based on the MAC address if the MAC address corresponding to the next-hop IP address is found in the ARP table inside the FPGA; if the MAC address corresponding to the next-hop IP address is not found in the ARP table inside the FPGA, the FPGA generates an ARP alarm message based on the next-hop IP address and sends the ARP alarm message to the CPU through MAC2MAC direct communication.

[0178] External ARP packet processing unit 005 is used to forward the external ARP packet from the FPGA to the CPU via MAC2MAC direct communication.

[0179] The ARP message processing and configuration information update unit 006 is used by the CPU to generate CPU-side ARP request messages and CPU-side ARP reply messages based on the received ARP alarm messages and external ARP messages, and to perform local ARP table cache updates and ARP table aging management, generating updated ARP table configuration information and updated routing table configuration information; and to synchronously send the CPU-side ARP request messages, the CPU-side ARP reply messages, the updated ARP table configuration information, and the updated routing table configuration information to the FPGA via MAC2MAC direct communication.

[0180] The FPGA internal routing table and internal ARP table update unit 007 is used to update the FPGA internal routing table and the FPGA internal ARP table respectively based on the updated ARP table configuration information and the updated routing table configuration information, and send the CPU-side ARP request message and the CPU-side ARP reply message to the external network through the PHY chip interface.

[0181] In this embodiment, in the external IP packet processing unit 003, when the FPGA queries the FPGA internal routing table based on the destination IP address, it determines whether the destination IP address and the FPGA external network interface IP address belong to the same network segment; if they belong to the same network segment, the destination IP address is determined as the next-hop IP address; if they do not belong to the same network segment, the gateway IP address is determined as the next-hop IP address.

[0182] In this embodiment, in the ARP packet processing and configuration information update unit 006, when the CPU updates the local ARP table cache, if the corresponding IP address and MAC address entries already exist in the local ARP table cache, the aging flag of the corresponding IP address and MAC address entries is cleared; if they do not exist, the corresponding IP address and MAC address entries are added to the local cache.

[0183] In this embodiment, in the ARP message processing and configuration information update unit 006, when the CPU performs ARP table aging management, it traverses the local ARP table cache according to a set time period, sets the aging flag for entries that have not been refreshed, and deletes the entries that have been set with the aging flag locally, generating the corresponding ARP table deletion configuration information and sending it to the FPGA.

[0184] In this embodiment, in the ARP packet processing and configuration information update unit 006, after the CPU receives the external ARP packet, it determines whether it is an ARP request to resolve the local IP address; if so, it encapsulates and sends the CPU-side ARP response packet; if not, it discards the external ARP packet.

[0185] It should be noted that the information interaction and execution process between the modules of the above system are based on the same concept as the method embodiment in Embodiment 1 of this application, and the resulting technical effects are the same as those in the method embodiment of this application. For details, please refer to the description in the method embodiment shown above in this application, and it will not be repeated here.

[0186] Example 3

[0187] Embodiment 3 of the present invention provides a non-transitory computer-readable storage medium, wherein the computer-readable storage medium stores program code for a method of implementing ARP and routing management based on FPGA and CPU collaborative implementation, the program code including instructions for executing the method of implementing ARP and routing management based on FPGA and CPU collaborative implementation in Embodiment 1 or any possible implementation thereof.

[0188] Computer-readable storage media can be any available medium that a computer can access, or a data storage device such as a server or data center that integrates one or more available media. The available medium can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).

[0189] Example 4

[0190] Embodiment 4 of the present invention provides an electronic device, including: a memory and a processor;

[0191] The processor and the memory communicate with each other via a bus; the memory stores program instructions that can be executed by the processor, and the processor can call the program instructions to execute the method of ARP and routing management based on FPGA and CPU collaboration in Embodiment 1 or any possible implementation thereof.

[0192] Specifically, a processor can be implemented in hardware or software. When implemented in hardware, the processor can be a logic circuit, an integrated circuit, etc. When implemented in software, the processor can be a general-purpose processor that reads software code stored in memory. This memory can be integrated into the processor or located outside the processor and exist independently.

[0193] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable system. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means.

[0194] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing systems. They can be centralized on a single computing system or distributed across a network of multiple computing systems. Optionally, they can be implemented using program code executable by a computing system, thereby storing them in a storage system for execution by the computing system. In some cases, the steps shown or described can be performed in a different order than those presented herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.

[0195] Although the present invention has been described in detail above with general descriptions and specific embodiments, modifications or improvements can be made to it, which will be obvious to those skilled in the art. Therefore, all such modifications or improvements made without departing from the spirit of the present invention fall within the scope of protection claimed by the present invention.

Claims

1. A method for implementing ARP and routing management based on FPGA and CPU collaboration, characterized in that, include: FPGA operation parameters are reset and initialized; The CPU initializes the runtime environment; after initialization, the CPU configures the FPGA running parameters, routing table configuration information, and ARP table configuration information to the FPGA via MAC2MAC direct communication. After the FPGA completes the parameter and table entry configuration, it receives external network data packets through the PHY chip interface, and determines the type of the data packets to obtain external IP packets and external ARP packets. For the external IP packet, the FPGA extracts the destination IP address from the external IP packet; Based on the destination IP address, the next-hop IP address is determined by querying the FPGA's internal routing table; Based on the next-hop IP address, query the FPGA's internal ARP table; If the MAC address corresponding to the next-hop IP address is found in the ARP table inside the FPGA, the FPGA will perform subsequent processing of the external IP packet based on the MAC address; if the MAC address corresponding to the next-hop IP address is not found in the ARP table inside the FPGA, the FPGA will generate an ARP alarm message based on the next-hop IP address and send the ARP alarm message to the CPU through MAC2MAC direct communication. For the external ARP message, the FPGA forwards the external ARP message to the CPU via MAC2MAC direct communication; Based on the received ARP alarm messages and external ARP messages, the CPU generates CPU-side ARP request messages and CPU-side ARP reply messages, and performs local ARP table cache updates and ARP table aging management, generating updated ARP table configuration information and updated routing table configuration information; the CPU-side ARP request messages, CPU-side ARP reply messages, updated ARP table configuration information, and updated routing table configuration information are synchronously sent to the FPGA via MAC2MAC direct communication; Based on the updated ARP table configuration information and the updated routing table configuration information, the FPGA updates the FPGA internal routing table and the FPGA internal ARP table respectively, and sends the CPU-side ARP request message and the CPU-side ARP reply message to the external network through the PHY chip interface.

2. The method for ARP and routing management based on FPGA and CPU collaboration according to claim 1, characterized in that, When the FPGA queries the internal routing table based on the destination IP address, it determines whether the destination IP address and the FPGA external network interface IP address belong to the same network segment; if they belong to the same network segment, the destination IP address is determined as the next-hop IP address. If they do not belong to the same network segment, the gateway IP address will be determined as the next-hop IP address.

3. The method for ARP and routing management based on FPGA and CPU collaboration according to claim 2, characterized in that, When the CPU updates the local ARP table cache, if the corresponding IP address and MAC address entries already exist in the local ARP table cache, the aging flag of the corresponding IP address and MAC address entries is cleared. If it does not exist, add the corresponding IP address and MAC address entries to the local cache.

4. The method for ARP and routing management based on FPGA and CPU collaboration according to claim 3, characterized in that, When the CPU performs ARP table aging management, it traverses the local ARP table cache according to the set time period, sets the aging flag for entries that have not been refreshed, deletes the entries that have been set to aging flag locally, and generates the corresponding ARP table deletion configuration information and sends it to the FPGA.

5. The method for ARP and routing management based on FPGA and CPU collaboration according to claim 4, characterized in that, After receiving the external ARP packet, the CPU determines whether it is an ARP request to resolve the local IP address; if so, it encapsulates and sends the CPU-side ARP reply packet; if not, it discards the external ARP packet.

6. A system for ARP and routing management based on FPGA and CPU collaboration, employing the method for ARP and routing management based on FPGA and CPU collaboration as described in any one of claims 1-5, characterized in that, include: FPGA and CPU initialization unit, used for resetting and initializing FPGA operating parameters; The CPU initializes the runtime environment; After initialization is complete, the CPU configures the FPGA operating parameters, routing table configuration information, and ARP table configuration information to the FPGA via MAC2MAC direct communication. The external network data packet acquisition and processing unit is used to receive external network data packets through the PHY chip interface after the FPGA completes the parameter and table entry configuration, and to determine the type of the data packets to obtain external IP packets and external ARP packets. An external IP packet processing unit is used to extract the destination IP address from the external IP packet by the FPGA. Based on the destination IP address, the next-hop IP address is determined by querying the FPGA's internal routing table; Based on the next-hop IP address, query the FPGA's internal ARP table; The MAC address lookup unit is used to perform subsequent processing of the external IP packet based on the MAC address if the MAC address corresponding to the next-hop IP address is found in the ARP table inside the FPGA; if the MAC address corresponding to the next-hop IP address is not found in the ARP table inside the FPGA, the FPGA generates an ARP alarm message based on the next-hop IP address and sends the ARP alarm message to the CPU through MAC2MAC direct communication. An external ARP packet processing unit is used to forward the external ARP packet from the FPGA to the CPU via MAC2MAC direct communication. The ARP packet processing and configuration information update unit is used by the CPU to generate CPU-side ARP request packets and CPU-side ARP reply packets based on the received ARP alarm packets and external ARP packets, and to perform local ARP table cache updates and ARP table aging management, generating updated ARP table configuration information and updated routing table configuration information; and to synchronously send the CPU-side ARP request packets, the CPU-side ARP reply packets, the updated ARP table configuration information, and the updated routing table configuration information to the FPGA via MAC2MAC direct communication; The FPGA internal routing table and internal ARP table update unit is used to update the FPGA internal routing table and the FPGA internal ARP table respectively based on the updated ARP table configuration information and the updated routing table configuration information, and send the CPU-side ARP request message and the CPU-side ARP reply message to the external network through the PHY chip interface.

7. The system for ARP and routing management based on FPGA and CPU collaboration as described in claim 6, characterized in that, In the external IP packet processing unit, when the FPGA queries the internal routing table of the FPGA based on the destination IP address, it determines whether the destination IP address and the FPGA external network interface IP address belong to the same network segment. If they belong to the same network segment, then the destination IP address is determined as the next-hop IP address; If they do not belong to the same network segment, the gateway IP address will be determined as the next-hop IP address.

8. The system for ARP and routing management based on FPGA and CPU collaboration as described in claim 7, characterized in that, In the ARP packet processing and configuration information update unit, when the CPU updates the local ARP table cache, if the corresponding IP address and MAC address entries already exist in the local ARP table cache, the aging flag of the corresponding IP address and MAC address entries is cleared. If it does not exist, add the corresponding IP address and MAC address entries to the local cache.

9. The system for ARP and routing management based on FPGA and CPU collaboration as described in claim 8, characterized in that, In the ARP message processing and configuration information update unit, when the CPU performs ARP table aging management, it traverses the local ARP table cache according to a set time period, sets the aging flag for entries that have not been refreshed, and deletes the entries that have been set to the aging flag locally, generating the corresponding ARP table deletion configuration information and sending it to the FPGA.

10. The system for ARP and routing management based on FPGA and CPU collaboration as described in claim 9, characterized in that, In the ARP packet processing and configuration information update unit, after the CPU receives the external ARP packet, it determines whether it is an ARP request to resolve the local IP address; if so, it encapsulates and sends the CPU-side ARP response packet; if not, it discards the external ARP packet.