Method and device for quickly answering messages on behalf of network switching chip
Patent Information
- Application Number
- CN202510553032.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2025-08-08
AI Technical Summary
功能比较局限,用户自定义受限
Smart Images

Figure CN120455407A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of switch chips, and in particular to a method and device for quickly answering messages of a network switch chip. Background Art
[0002] Currently, the proxy answering function is almost nonexistent on switch chips in the industry. Most switches that do have this function rely on software protocol stacks, answering a limited number of protocol packets or customizing them for specific messages. This functionality is limited, restricting user customization. Furthermore, because it's software-based, its ability to answer messages depends on the CPU's processing power. Summary of the Invention
[0003] In response to the above technical problems, the present invention innovatively proposes a network switching chip message answering method and device, which supports the use of a small number of hardware table entries and cache resources, supports users to flexibly configure and edit various answering messages, and is not limited to the type of answering messages. At the same time, due to hardware answering, the processing capacity can reach the full bandwidth rate of the port, and due to answering, the downstream bandwidth of the answering port is significantly saved, thereby improving resource utilization.
[0004] In order to achieve the above-mentioned purpose, the technical solution of the present invention provides a method for quickly answering messages of a network switching chip, which includes the following steps: S1: enabling the answering function at the port where the answering function needs to be enabled, and editing the answering message by using the hardware table configuration; S2: receiving the request message, and judging whether the exit of the request message is the port with the answering function enabled, and whether the request message hits the pre-set message rule. If so, proceed to step S3, otherwise follow the normal processing flow; S3: executing the answering function, obtaining the index of the corresponding message rule that is hit, and replying by indexing the corresponding answering message.
[0005] Furthermore, in step S1, the request message hit rule is set according to actual needs through the access control list, and the header information and payload information of the reply message are edited and configured.
[0006] Furthermore, in step S2, the message rule is matched through the access control list, and when a rule in the access control list is matched, the access control list provides an index after the match.
[0007] Furthermore, in step S1, the capture function is enabled to support capturing the reply message of the reply port and caching it in the chip as the reply message for the subsequent request message, and supports configuring dynamic update. When update=1 is configured, the reply message of the reply port that hits the rule will be captured each time as the latest reply message; when update=0 is configured, the reply message captured for the first time will be used as the reply message and placed in the corresponding entry of the cache. Even if a reply message that hits the rule appears on the reply port subsequently, it will not be updated to the chip.
[0008] Furthermore, in step S3, if the capture function is enabled, the index is directly used to index the captured reply message in the cache as a proxy message for reply; if the capture function is not enabled, the configured message header information and payload information are used to form a proxy message for reply.
[0009] Furthermore, in step S1, a hash table is created to set the request message hit rules according to actual needs, and the header information and payload information of the reply message are edited and configured; and in step S2, a hash search is performed to match the message rules, and a corresponding index is given when the hash hits.
[0010] Furthermore, in step S2, message rule matching is performed based on MAC address, IP address, protocol type or port number.
[0011] Furthermore, in step S1, the number of rule entries is planned based on customer demand, and the number of reply message caches corresponds one-to-one to the rule entries.
[0012] The technical solution of the present invention also provides a device for quickly answering messages of a network switching chip, which includes the following modules: an answering function enabling module: used to enable the answering function at the port where the answering function needs to be enabled, and to edit the answering message by using hardware table configuration; a message rule matching module: used to receive a request message, and to determine whether the exit of the request message is a port with the answering function enabled, and whether the request message hits a preset message rule; an answering function execution module: used to execute the answering function when the exit of the request message is a port with the answering function enabled, and the request message hits a preset message rule, obtain the index of the corresponding message rule that is hit, and reply by indexing the corresponding answering message. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without paying any creative work.
[0014] Figure 1 This is an example diagram of the answering principle of the present invention;
[0015] Figure 2 This is an example diagram of the configuration principle of the reply message of the present invention. DETAILED DESCRIPTION
[0016] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the present invention.
[0017] This invention innovatively supports the use of a small number of hardware entries and cache resources, allowing users to flexibly configure and edit various proxy messages. This allows for flexible configuration and editing of various proxy message types, regardless of the type of proxy message. Furthermore, thanks to hardware proxy, processing capacity can reach the full bandwidth of the port. Furthermore, proxying significantly reduces downlink bandwidth on the proxy port, improving resource utilization.
[0018] In a specific embodiment, the present invention innovatively leverages the existing access control list (ACL) module within the switch chip to perform rule matching for messages requiring proxy answering. This matching can be based on MAC addresses, IP addresses, protocol types, and other criteria, all of which are user-defined, offering flexibility and unrestricted control. The ACL module also provides flexible configuration of proxy answering messages, enabling the answering of protocol messages, application messages, and user-defined messages. This eliminates the need for dedicated modules, conserving resources.
[0019] First, enable the proxy answering feature on the ports where proxy answering is required. Then, configure the request packet matching rules based on actual needs, and edit the proxy answering message header and payload information. Proxy answering messages can also capture the proxy answering port's reply messages and cache them in the chip, using them as proxy answers for subsequent request messages. Simply enable capture, eliminating manual configuration. When capture is enabled, since the proxy answering port passes all normal packets, you also need to configure access control list rules to filter the proxy answering messages that match the rules and place them in the chip cache. Dynamic update is also supported. If update=1 is configured, each reply message from the proxy answering port that matches the rules will be captured and used as the latest proxy answering message. If update=0 is configured, the first reply message captured will be used as the proxy answering message and placed in the corresponding cache entry. Subsequent reply messages from the proxy answering port that match the rules will not be updated to the chip and will be sent back to the requester as proxy answers.
[0020] If the request message's exit point is a proxy-answer-enabled port and matches an access control list rule, the proxy-answer function is executed. The access control list finds the index that matches the request message, and the proxy-answer message is retrieved through the index. If the capture function is enabled, the cached reply message is directly indexed using this index, and this message is used as the proxy-answer message. If the capture function is not enabled, the access control list's internal editing behavior module is indexed using the index, and the proxy-answer message is composed of the user-configured message header and payload information.
[0021] Fast message pickup uses the chip's existing module access control lists (ACLs), saving development costs. Furthermore, the number of cached reply messages corresponds to the number of ACL rule entries, eliminating the need to reserve excessive resources. In actual chip design, the specific number of entries can be planned based on customer needs.
[0022] For example, consider a user accessing a remote web server. When the remote web server requires an upgrade or maintenance, a prompt message is typically returned to the requesting user, such as a message on the browser interface indicating that the system is undergoing maintenance or upgrade. This reply message is typically small and lacks the rich content of a normal web page. In this case, enable the packet quick reply feature for the switch port connected to the server. Enable this feature on the port and enable capture. Configure two matching rules in the access control list function module, one for request packets and one for reply packets. For example, if the protocol is TCP, set layer4destport to 80 as the request packet matching rule; and if the protocol is TCP, set layer4sourceport to 80 as the reply packet capture rule. When a web request accesses the server, the destination port is the switch port connected to the server, with the proxy reply feature enabled. If a request packet matches this rule, the switch will cache the reply message that matches the capture rule as a reply message. If a subsequent packet that meets the request rule is received, the switch will directly retrieve the cached reply message and respond to the user. This is completely invisible to users, and the server's web service can even be offline for maintenance, eliminating the need to process request messages and conserving computing resources. Furthermore, servers typically run multiple services, and the proxy answering feature saves bandwidth for web traffic. Requests for web services are no longer sent to the server, freeing up bandwidth for other services on the server, achieving multiple goals at once. Once the web service is maintained, simply disable the proxy answering feature on the port, and users can access the server content normally.
[0023] Alternatively, protocol proxy reply can be used, such as ARP proxy reply. ARP request packets are broadcast packets. If proxy reply is enabled on the port in the corresponding broadcast domain and an ARP hit rule is configured, the chip can reply using the user-configured ARP proxy reply message or a captured ARP proxy reply message. This eliminates the need to forward packets to downstream devices, saving bandwidth and improving reply efficiency.
[0024] It is understood that, as an alternative embodiment, when using message rule matching, it is not necessary to go through the access control list function module. For example, a hash table can be created to perform a hash search on the message information to be matched, such as MAC address, IP address, protocol type, port number, etc. If the hash hits, the rule is satisfied and the index is used to index the message editing action table entry for subsequent processing.
[0025] In an embodiment of the present invention, a method for quickly answering messages of a network switching chip is provided, which includes the following steps: S1: enabling the answering function at the port where the answering function needs to be enabled, and editing the answering message by using the hardware table configuration; S2: receiving a request message, and determining whether the exit of the request message is a port with the answering function enabled, and whether the request message hits a preset message rule, if so, proceeding to step S3, otherwise following the normal processing flow; S3: executing the answering function, obtaining the index of the corresponding message rule that is hit, and replying by indexing the corresponding answering message.
[0026] Furthermore, in step S1, the request message hit rule is set according to actual needs through the access control list, and the header information and payload information of the reply message are edited and configured.
[0027] Furthermore, in step S2, the message rule is matched through the access control list, and when a rule in the access control list is matched, the access control list provides an index after the match.
[0028] Furthermore, in step S1, the capture function is enabled to support capturing the reply message of the reply port and caching it in the chip as the reply message for the subsequent request message, and supports configuring dynamic update. When update=1 is configured, the reply message of the reply port that hits the rule will be captured each time as the latest reply message; when update=0 is configured, the reply message captured for the first time will be used as the reply message and placed in the corresponding entry of the cache. Even if a reply message that hits the rule appears on the reply port subsequently, it will not be updated to the chip.
[0029] Furthermore, in step S3, if the capture function is enabled, the index is directly used to index the captured reply message in the cache as a proxy message for reply; if the capture function is not enabled, the configured message header information and payload information are used to form a proxy message for reply.
[0030] Furthermore, in step S1, a hash table is created to set the request message hit rules according to actual needs, and the header information and payload information of the reply message are edited and configured; and in step S2, a hash search is performed to match the message rules, and a corresponding index is given when the hash hits.
[0031] Furthermore, in step S2, message rule matching is performed based on MAC address, IP address, protocol type or port number.
[0032] Furthermore, in step S1, the number of rule entries is planned based on customer demand, and the number of reply message caches corresponds one-to-one to the rule entries.
[0033] In another embodiment of the present invention, a device for quickly answering messages of a network switching chip is also provided, which includes the following modules: an answering function enabling module: used to enable the answering function at the port where the answering function needs to be enabled, and to edit the answering message by using hardware table configuration; a message rule matching module: used to receive a request message, and to determine whether the exit of the request message is a port with the answering function enabled, and whether the request message hits a preset message rule; an answering function execution module: used to execute the answering function when the exit of the request message is a port with the answering function enabled, and the request message hits a preset message rule, obtain the index of the corresponding message rule that is hit, and reply to the corresponding answering message through the index.
[0034] Beneficial technical effects of the technical solution of the present invention:
[0035] The present invention uses a small number of hardware entries (e.g., access control lists or hash tables) and cache resources to quickly answer messages that meet the requirements. This allows for a wide range of unrestricted answer message types, high hardware answer rates, and high bandwidth. It also does not consume CPU resources within the switch and does not require specialized software development. This significantly reduces answer port bandwidth and computing resources for related downstream devices. Furthermore, since it is based on an access control list functional module, it does not require significant additional development costs.
[0036] The above description is only a preferred specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any technician familiar with the technical field, within the technical scope disclosed by the present invention, who makes equivalent replacements or changes based on the technical solution and inventive concept of the present invention, should be covered by the scope of protection of the present invention.
Claims
1. A method for quickly answering messages on a network switching chip, characterized in that: The steps include: S1: Enable proxy answering on the ports where it is required, and edit the proxy answering message using hardware configuration entries. S2: Receive the request message and determine whether the request message's egress is a port with the proxy answering function enabled and whether the request message matches the pre-set message rules. If so, proceed to step S3; otherwise, follow the normal processing flow. S3: Execute the proxy answering function, obtain the index of the corresponding message rule that is hit, and reply with the corresponding proxy answering message through the index.
2. The method according to claim 1, characterized in that In step S1, the request message matching rules are set according to actual needs through the access control list, and the header information and payload information of the reply message are edited and configured.
3. The method according to claim 2, characterized in that In step S2, the message rule is matched through the access control list, and when a rule in the access control list is matched, the access control list provides an index after the match.
4. The method according to claim 3, characterized in that In step S1, the capture function is also enabled to support the capture of the reply port reply message and cache it in the chip as the reply message for the subsequent request message, and support the configuration dynamic update update, wherein, When update=1 is configured, the reply message of the reply port that hits the rule will be captured each time as the latest reply message; when update=0 is configured, the reply message captured for the first time will be used as the reply message and placed in the corresponding entry in the cache. Even if the reply message that hits the rule appears on the reply port later, it will not be updated to the chip.
5. The method according to claim 4, characterized in that In step S3, if the capture function is enabled, the index is directly used to index the captured reply message in the cache and reply as the reply message; If the capture function is not enabled, the configured packet header and payload information form a reply message.
6. The method according to claim 1, characterized in that In step S1, a hash table is created to set the request message matching rules according to actual needs, and the header information and payload information of the reply message are edited and configured; And in step S2, message rule matching is performed by performing hash search, and a corresponding index is given when the hash hits.
7. The method according to claim 1, characterized in that In step S2, message rule matching is performed based on MAC address, IP address, protocol type or port number.
8. The method according to claim 2, characterized in that In step S1, the number of rule entries is planned based on customer demand, and the number of reply message buffers corresponds to the rule entries one by one.
9. A device for quickly answering messages on a network switching chip, characterized in that: Includes the following modules: The proxy answering function enabling module is used to enable the proxy answering function on the ports that need it, and edit the proxy answering message by using hardware table configuration; Message rule matching module: used to receive request messages and determine whether the egress of the request message is a port with the proxy answering function enabled and whether the request message matches the pre-set message rules; Proxy answering function execution module: used to execute the proxy answering function when the exit of the request message is a port that enables the proxy answering function and the request message hits the pre-set message rule, obtain the index of the corresponding message rule that is hit, and reply to the corresponding proxy answering message through the index.
Citation Information
Patent Citations
Message transmission method and device
CN107547346A
Direct replying actions in SDN switches
CN107615710A
Message capturing method and device based on network application
CN114553546A
Efficient deep packet inspection method and device
CN114584632A
Optimization method for ARP (Address Resolution Protocol) pickup
CN115065660A