Message sending method and network equipment

By using the coordinated work of the processor and switching chip in network devices, automatic periodic transmission of messages is achieved, solving the problem that existing devices cannot send messages efficiently, reducing processor occupancy and improving device performance.

CN119402451APending Publication Date: 2025-02-07MAIPU COMM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411530516.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2025-02-07

AI Technical Summary

Technical Problem

Due to the weak processor performance of existing network devices, they cannot support high-frequency packet transmission, which cannot meet the needs of periodic packet transmission in lossless networks. The costly processor replacement reduces the competitiveness of the device.

Method used

By working together between the processor and the switching chip of the network device, the processor adds a mark in the message and sends it to the switching chip. The switching chip determines the target rate based on the mark and generates a message flow, realizing automatic periodic transmission of messages .

Benefits of technology

It reduces the processor occupancy rate and realizes that network devices can support high-speed transmission of packets without replacing high-performance processors, improving the performance and competitiveness of the device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119402451A_ABST
    Figure CN119402451A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of communication, and provides a message sending method and network equipment. The network equipment comprises a processor and a switch chip which are in communication connection, and the method comprises the following steps: firstly, the processor adds a mark in a message and issues the mark to the switch chip, then the switch chip determines a target rate according to the mark carried by the received message, generates a message flow based on the received message and the target rate, and sends the message flow to the processor; and then determining a sending port of the message flow, deleting the mark carried by each message in the message flow, and sending the message flow through the sending port according to the target rate. The message added with the mark is issued to the switch chip through the processor, so that the switch chip identifies the message according to the mark and generates the message flow with the specified rate for transmission, thereby realizing automatic and periodic message transmission by using the switch chip, reducing the occupancy rate of the processor, and improving the message transmission efficiency. The network equipment can support high-speed message sending without replacing a high-performance processor, and the performance and competitiveness of the network equipment are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a message sending method and network equipment. Background Art

[0002] On network devices, since network data forwarding mainly relies on switching chips, only the control of network devices and the processing of protocol messages use processors, so the processor performance is relatively weak. There are some functional modules on network devices that require periodic packet transmission. For example, in a lossless network, when congestion occurs, the network device needs to send CNP (Congestion Notification Packet) messages to the source end at a certain frequency. The source end decides to reduce or increase the speed based on the interval of receiving CNP messages. This requires the network device to support sending messages within microsecond intervals. However, for existing network devices, due to the limitation of processor performance, it cannot support such a high rate of message transmission. At present, the only way to achieve the packet transmission performance requirements is to replace the processor with a stronger performance, but this method is costly and reduces the competitiveness of network equipment. Summary of the invention

[0003] In view of this, an object of the present invention is to provide a message sending method and a network device.

[0004] In order to achieve the above object, the technical solution adopted by the present invention is as follows:

[0005] In a first aspect, the present invention provides a message sending method, which is applied to a network device, wherein the network device includes a processor and a switching chip connected in communication, and the method includes:

[0006] The processor adds a mark to the message and sends it to the switching chip;

[0007] The switching chip determines a target rate according to a tag carried by the received message, and generates a message flow based on the received message and the target rate;

[0008] The switching chip determines a sending port for the message flow, deletes a tag carried by each message in the message flow, and then sends the message flow through the sending port at the target rate.

[0009] In an optional implementation manner, before the processor adds a mark to the message and sends it to the switching chip, the method further includes:

[0010] The processor assigns a tag to each message, sets a corresponding rate and port for each tag, and sends the tags to the switching chip;

[0011] The switching chip saves the rate and port corresponding to each tag into a preset access control list.

[0012] In an optional embodiment, the switch chip has a first internal ingress port;

[0013] The processor adds a mark to the message and sends it to the switching chip, including:

[0014] The processor adds a tag to the message, and sends the message carrying the tag to the switching chip through the first internal ingress port.

[0015] In an optional implementation manner, the switching chip determines the target rate according to a tag carried by the received message, including:

[0016] The switching chip receives a message through the first internal inbound port, searches the access control list according to a tag carried by the received message, and uses a rate corresponding to the tag carried by the received message as a target rate.

[0017] In an optional implementation manner, the switching chip generates a message flow based on the received message and the target rate, including:

[0018] The switching chip replicates the received message based on a preset multicast group to generate a message flow with a rate equal to the target rate.

[0019] In an optional implementation, the multicast group includes a first member port, a second member port, and a third member port, the first member port and the second member port are both connected to the first internal ingress port, and the third member port is connected to the second internal ingress port of the switch chip;

[0020] The switching chip replicates the received message based on a preset multicast group to generate a message flow with a rate being the target rate, including:

[0021] The switching chip copies the received message and sends the copied message to the first member port and the second member port, and forwards the copied message to the first internal input port through the first member port and the second member port, and then copies it again to generate a message flow and limit its speed to obtain a message flow with a rate of the target rate, and forwards the message flow to the second internal input port through the third member port.

[0022] In an optional implementation manner, the switching chip determines a sending port of the message flow, and after deleting a mark carried by each message in the message flow, sends the message flow through the sending port at the target rate, including:

[0023] For each message in the message flow, the switching chip determines a sending port according to a tag carried by the message, and sends the message through the sending port after deleting the tag carried by the message, so as to send the message flow at the target rate.

[0024] In an optional implementation manner, the switching chip determines the sending port according to the tag carried by the message, including:

[0025] The switching chip searches the access control list according to the tag carried by the message, and uses the port corresponding to the tag carried by the message as the sending port.

[0026] In an optional embodiment, the method further comprises:

[0027] When the processor sends the message carrying the mark to the switching chip, the processor starts the timer, and when the timer reaches the set time, sends a message stop sending command to the switching chip;

[0028] The switching chip modifies the port corresponding to the mark in the access control list to a preset packet loss port according to the message stop sending command, so as to stop sending the message flow.

[0029] In a second aspect, the present invention provides a network device, including a processor and a switching chip in communication connection, wherein the network device is used to implement the message sending method described in any one of the aforementioned implementation modes.

[0030] The message sending method and network device provided by the present invention include a processor and a switching chip connected in communication. The method includes: first, the processor adds a mark in the message and sends it to the switching chip; then the switching chip determines the target rate according to the mark carried by the received message, and generates a message flow based on the received message and the target rate; then the switching chip determines the sending port of the message flow, deletes the mark carried by each message in the message flow, and then sends the message flow at the target rate through the sending port. The processor sends the message with the mark to the switching chip, so that the switching chip identifies the message according to the mark and generates a message flow of the specified rate for sending, thereby using the switching chip to realize automatic periodic message sending, reducing the occupancy rate of the processor, and realizing that the network device can support high-speed message sending without replacing the high-performance processor, thereby improving the performance and competitiveness of the network device.

[0031] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0033] Figure 1 A block diagram of a network device provided by an embodiment of the present invention is shown;

[0034] Figure 2 A functional module diagram of a network device provided by an embodiment of the present invention is shown;

[0035] Figure 3 One of the flow diagrams of the message sending method provided in an embodiment of the present invention is shown;

[0036] Figure 4 The second flowchart of the message sending method provided by the embodiment of the present invention is shown.

[0037] Icon: 110 - processor; 120 - memory; 130 - switching chip. DETAILED DESCRIPTION

[0038] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0039] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.

[0040] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0041] See also Figure 1 , is a block diagram of a network device provided by an embodiment of the present invention. The network device includes a processor 110, a memory 120, and a switching chip 130, and each component is directly or indirectly electrically connected to each other to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.

[0042] The processor 110 is used to read / write data or programs stored in the memory 120 and execute corresponding functions. It can be a general-purpose processor, including a CPU (Central Processing Unit), NP (Network Processor), etc.; it can also be a DSP digital signal processor, an ASIC application-specific integrated circuit, an FPGA off-the-shelf programmable gate array or other programmable logic devices, discrete gates or transistor logic devices, and discrete hardware components.

[0043] The memory 120 is used to store programs or data. The memory 120 can be a RAM (Random Access Memory), a ROM (Read Only Memory), a PROM (Programmable Read-Only Memory), an EPROM (Erasable Programmable Read-Only Memory), an EEPROM (Electric Erasable Programmable Read-Only Memory), etc.

[0044] The switching chip 130 is used to generate and send message flows.

[0045] Understandably, Figure 1The structure shown is only a schematic diagram of the structure of the network device. The network device may also include Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown. Figure 1 Each component shown in the figure can be implemented by hardware, software or a combination thereof.

[0046] See also Figure 2 , is a functional module diagram of a network device provided by an embodiment of the present invention. The processor of the network device includes a message control module, and the switching chip includes a message generation module and a message sending module.

[0047] The message control module is connected to the message generation module through the first internal input port of the switching chip, namely the input port A. The message generation module includes a multicast group, and the multicast group includes three member ports, namely: the first member port, namely the output port A, the second member port, namely the output port B, and the third member port, namely the output port C; the first member port, namely the output port A and the second member port, namely the output port B, are both connected to the first internal input port, namely the input port A, and the third member port, namely the output port C, is connected to the second internal input port, namely the input port B, of the switching chip. The message generation module is connected to the message sending module through the output port C and the input port B. It can be understood that the first internal input port, the second internal input port and the member ports in the multicast group are all internal reserved ports of the switching chip.

[0048] The message control module is used to assign different tags to different messages, edit the tags into the messages and then send them to the message generation module, and control the sending and stopping of message flows. The message generation module is used to automatically generate message flows corresponding to the messages sent by the message control module, and can also control the rate of the message flow to transmit the message flow of the specified rate to the message sending module. The message sending module is used to delete the tags of messages in different message flows and then send the message flows through different physical ports.

[0049] The following will be Figure 2 The network device shown serves as an execution subject, executes each step in each method provided in the embodiment of the present invention, and achieves corresponding technical effects.

[0050] See also Figure 3 , is a flow chart of a message sending method provided in an embodiment of the present invention.

[0051] Step S204: The processor adds a tag to the message and sends it to the switching chip.

[0052] In this embodiment, the processor assigns different tags to different messages to be sent through the message control module, edits the tags into the messages and then sends them to the switching chip, so that the switching chip generates a message flow corresponding to the message and sends it.

[0053] Step S206: The switching chip determines a target rate according to the tag carried by the received message, and generates a message flow based on the received message and the target rate.

[0054] Step S208: The switching chip determines a sending port for the message flow, deletes a tag carried by each message in the message flow, and then sends the message flow through the sending port at a target rate.

[0055] In this embodiment, the switching chip receives the message sent by the message control module through the message generation module, and determines the rate of sending the message, that is, the target rate, according to the mark carried by the received message; then generates a message flow according to the received message and the target rate, and transmits the message flow to the message sending module. Then, the switching chip determines the sending port of the message flow through the message sending module, deletes the mark carried by each message in the message flow, and sends the message flow through the sending port according to the target rate.

[0056] It can be understood that the embodiment of the present invention is to send the message with the mark added to the switching chip through the processor, so that the switching chip identifies the message according to the mark and generates a message stream of the specified rate for sending, thereby utilizing the switching chip to realize automatic periodic sending of messages, reducing the processor occupancy rate, and realizing that the network equipment can support high-speed message sending without replacing the high-performance processor, thereby improving the performance and competitiveness of the network equipment.

[0057] It can be seen that based on the above steps, the processor first adds a tag to the message and sends it to the switching chip; then the switching chip determines the target rate according to the tag carried by the received message, and generates a message flow based on the received message and the target rate; then the switching chip determines the sending port of the message flow, and after deleting the tag carried by each message in the message flow, sends the message flow at the target rate through the sending port. The processor sends the message with the tag to the switching chip, so that the switching chip identifies the message according to the tag and generates a message flow of the specified rate for sending, thereby using the switching chip to realize automatic periodic sending of messages, reducing the processor occupancy rate, and realizing that the network equipment can support high-speed message sending without replacing the high-performance processor, thereby improving the performance and competitiveness of the network equipment.

[0058] Optionally, before step S204, the embodiment of the present invention further provides a possible implementation method, see Figure 4 .

[0059] Step S200: The processor assigns a tag to each message, sets a corresponding rate and port for each tag, and sends the tags to the switching chip.

[0060] Step S202: The switching chip saves the rate and port corresponding to each tag into a preset access control list.

[0061] In this embodiment, the processor assigns a tag to each message to be sent through the message control module, sets the rate and port for sending each message by setting the corresponding rate and port for each tag, and sends the rate and port corresponding to each tag to the switching chip. After receiving the rate and port corresponding to each tag, the switching chip saves it to a preset access control list (ACL).

[0062] It is understood that the access control list refers to a table of regulations used in network equipment to identify certain message characteristics and take specific actions on such messages. Then, when the switch chip receives a message sent by the processor, it can identify the message according to the access control list and perform corresponding operations on it.

[0063] Optionally, for step S204, an embodiment of the present invention provides a possible implementation manner, namely: the processor adds a tag to the message, and sends the message carrying the tag to the switching chip through the first internal ingress port.

[0064] For ease of understanding, the following takes a scenario in which a CNP message is sent at a rate specified by a processor to control the source end to reduce the traffic sending rate as an example.

[0065] For example, the processor edits the CNP message through the message control module, and uses the VLAN ID (VLAN identifier) ​​in the VLAN (Virtual Local Area Network) tag of the CNP message as a tag. For example, if the VLAN ID is VLAN100, the tag, i.e., VLAN100, is added to the CNP message, and then the CNP message carrying the tag is sent to the message generation module of the switch chip through the first internal ingress port, i.e., ingress port A.

[0066] Optionally, for the process in step S206 in which the switching chip determines the target rate according to the tag carried by the received message, an embodiment of the present invention provides a possible implementation manner.

[0067] Step S206-1: The switching chip receives a message through the first internal inbound port, searches the access control list according to the tag carried by the received message, and uses the rate corresponding to the tag carried by the received message as the target rate.

[0068] For ease of understanding, the above example is continued for explanation. The message generation module of the switching chip receives the CNP message sent by the message control module through the first internal ingress port, namely ingress port A, and then searches the access control list according to the tag carried by the received CNP message, namely VLAN100, and uses the rate corresponding to the tag, namely VLAN100, as the rate for sending the CNP message, namely the target rate. For example, if the target rate is 1 million PPS (Packets Per Second), the subsequent message sending module will send the CNP message at a rate of 1 million PPS.

[0069] Optionally, for the process in step S206 in which the switching chip generates a message flow based on the received message and the target rate, an embodiment of the present invention provides a possible implementation manner.

[0070] Step S206-2: The switching chip copies the received message based on the preset multicast group to generate a message flow with a rate equal to the target rate.

[0071] For ease of understanding, the above example is continued for explanation. After the message generation module in the switching chip obtains the target rate of the CNP message, it replicates the received CNP message based on the multicast group, namely the first member port, namely the egress port A, the second member port, namely the egress port B, and the third member port, namely the egress port C, to generate a message stream with a rate of 1 million PPS.

[0072] It is understandable that if the processor expects to send CPN messages at a new rate, such as 800,000 PPS, it can send a rate update command to the message generation module of the switching chip through the message control module; then the message generation module will modify the rate corresponding to the tag, i.e., VLAN100, from 1 million PPS to 800,000 PPS in the access control list according to the rate update command, and limit the rate of the generated message flow according to the new target rate to obtain and send a message flow with a rate of 800,000 PPS. In this way, the switching chip automatically generates and sends a message flow with a corresponding rate according to the rate specified by the processor.

[0073] Optionally, for step S206-2, an embodiment of the present invention provides a possible implementation method, namely: the switching chip copies the received message, and sends the copied message to the first member port and the second member port, and forwards the copied message to the first internal input port through the first member port and the second member port, and then copies it again to generate a message flow and limit its speed to obtain a message flow with a target rate, and forwards the message flow to the second internal input port through the third member port.

[0074] For ease of understanding, the above example is continued for explanation. After receiving the CNP message through the first internal inbound port, namely inbound port A, the message generation module of the switching chip copies the CNP message and sends the copied CNP message to the first member port, namely outbound port A, the second member port, namely outbound port B, and the third member port, namely outbound port C.

[0075] Since the first member port, namely the egress port A, and the second member port, namely the egress port B, are connected to the first internal ingress port, namely the ingress port A, the CNP messages received by the egress port A and the egress port B will be returned to the ingress port A, and the traffic received by the ingress port A is twice that before the replication. By performing the replication operation multiple times and returning the CNP messages output by the egress port A and the egress port B to the ingress port A, multiple CNP messages are generated to form a message flow. At the same time, before each replication operation is performed, the traffic metering function provided by the ALC, namely the ACL meter, is used to limit the doubled traffic according to the target rate, namely 1 million PPS, to obtain a message flow with a rate of 1 million PPS, and the message flow is forwarded to the second internal ingress port, namely the ingress port B, through the third member port, namely the egress port C, to transmit the message flow to the message sending module. It can be understood that when the message generation module generates message flows corresponding to different messages, it can limit the speed of different message flows through the ACL meter.

[0076] Optionally, for step S208, an embodiment of the present invention provides a possible implementation method, namely: for each message in the message flow, the switching chip determines the sending port according to the tag carried by the message, and after deleting the tag carried by the message, sends the message through the sending port to send the message flow at the target rate.

[0077] For ease of understanding, the above example is used for further explanation. After receiving the message flow, the message sending module of the switching chip will send the message flow at the target rate, i.e., 1 million PPS. That is, for each CNP message in the message flow, the message sending module will determine the sending port according to the tag carried by the CNP message, i.e., VLAN100, and after deleting the tag carried by the CNP message, i.e., VLAN100, through the VLAN editing function provided by the ACL, redirect the CNP message with the tag deleted to the sending port for sending.

[0078] It is understandable that the tags carried by the messages in the same message flow are the same, so the messages in the same message flow will be sent through the same sending port.

[0079] Optionally, for the process in which the above-mentioned switching chip determines the sending port according to the tag carried by the message, an embodiment of the present invention provides a possible implementation method, namely: the switching chip queries the access control list according to the tag carried by the message, and uses the port corresponding to the tag carried by the message as the sending port.

[0080] For ease of understanding, the above example is used for further explanation. After receiving each CNP message in the message flow, the message sending module of the switching chip will query the access control list according to the tag carried by the CNP message, i.e., VLAN100, and use the port corresponding to the tag, i.e., VLAN100, as the port for sending the CNP message, i.e., the sending port. For example, if the sending port is port 1, the message sending module will send the message flow through port 1.

[0081] It is understandable that if the processor expects to send CPN messages through a new sending port, such as port 2, the message control module can send a port update command to the message generation module of the switching chip; then the message sending module will modify the port corresponding to the tag, i.e., VLAN100, from port 1 to port 2 in the access control list according to the port update command, and send the message flow through the new sending port, i.e., port 2. Thus, the switching chip automatically sends the message flow through the corresponding port according to the port specified by the processor.

[0082] Optionally, based on step S200 and step S202, the embodiment of the present invention further provides a possible implementation manner.

[0083] Step S210: When sending a message carrying a mark to the switching chip, the processor starts a timer, and sends a message stop sending command to the switching chip when the timer reaches a set time.

[0084] Step S212: The switch chip modifies the port corresponding to the mark in the access control list to a preset packet loss port according to the message stop sending command, so as to stop sending the message flow.

[0085] In this embodiment, the processor may further specify a connection time for sending the message flow, that is, the message control module in the processor may further integrate a timer to control the sending and stopping of the message flow.

[0086] For ease of understanding, the above example is used for further explanation. If the processor expects to send CNP messages at a rate of 1 million PPS and stop sending after 2 ms of continuous sending, then the processor can start the timer when sending the CNP message carrying the tag, i.e., VLAN 100, to the message generation module of the switching chip through the message control module, so that the switching chip generates and sends the message flow corresponding to the CNP message.

[0087] When the timer reaches the set time, i.e., 2ms, the processor will send a message stop sending command to the message sending module of the switching chip through the message control module; then, according to the message stop sending command, the message sending module of the switching chip will modify the port corresponding to the tag, i.e., VLAN100, in the access control list to a preset packet loss port, such as a port specifically used to discard messages, to stop sending the message flow. Thus, the switching chip automatically controls the sending duration of the message flow according to the sending duration specified by the processor.

[0088] The embodiment of the present invention further provides a network device, including a processor and a switching chip that are communicatively connected, and the network device is used to implement the message sending method disclosed in the embodiment of the present invention.

[0089] In summary, the message sending method and network device provided by the embodiment of the present invention have the following beneficial effects: (1) Automatic periodic message sending is realized by using the switching chip, and the processor is not required to send the message, thereby reducing the processor occupancy rate. (2) The message sending frequency is high and the time interval is uniform. Since the message is completely automatically generated and sent by the switching chip, the message sending frequency has no performance limit and only depends on the bandwidth supported by the switching chip. The performance is much higher than that of using the processor to send. In addition, the ACL meter speed limit is used to realize the sending of messages at the specified time interval, which has lower jitter than the processor packet sending. (3) The method provided by the present invention can be realized through the basic functions of the network device such as ACL meter speed limit, multicast replication and other functions, so the method provided by the present invention has high versatility. (4) The resources occupied are small. The member ports and internal inbound ports in the multicast group are fixed resources of the switching chip, which are independent of the amount of traffic, and a message flow will only occupy two ACL resources (one for recording the rate and the other for recording the port).

[0090] In several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0091] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.

[0092] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0093] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A message sending method, characterized in that: Applied to a network device, the network device includes a processor and a switching chip in communication connection, the method includes: The processor adds a mark to the message and sends it to the switching chip; The switching chip determines a target rate according to a tag carried by the received message, and generates a message flow based on the received message and the target rate; The switching chip determines a sending port for the message flow, deletes a tag carried by each message in the message flow, and then sends the message flow through the sending port at the target rate.

2. The method according to claim 1, characterized in that Before the processor adds a mark to the message and sends it to the switching chip, the method further includes: The processor assigns a tag to each message, sets a corresponding rate and port for each tag, and sends the tags to the switching chip; The switching chip saves the rate and port corresponding to each tag into a preset access control list.

3. The method according to claim 2, characterized in that The switch chip has a first internal input port; The processor adds a mark to the message and sends it to the switching chip, including: The processor adds a tag to the message, and sends the message carrying the tag to the switching chip through the first internal ingress port.

4. The method according to claim 3, characterized in that The switching chip determines the target rate according to the tag carried by the received message, including: The switching chip receives a message through the first internal inbound port, searches the access control list according to a tag carried by the received message, and uses a rate corresponding to the tag carried by the received message as a target rate.

5. The method according to claim 3, characterized in that: The switching chip generates a message flow based on the received message and the target rate, including: The switching chip replicates the received message based on a preset multicast group to generate a message flow with a rate equal to the target rate.

6. The method according to claim 5, characterized in that The multicast group includes a first member port, a second member port and a third member port, the first member port and the second member port are both connected to the first internal ingress port, and the third member port is connected to the second internal ingress port of the switch chip; The switching chip replicates the received message based on a preset multicast group to generate a message flow with a rate being the target rate, including: The switching chip copies the received message and sends the copied message to the first member port and the second member port, and forwards the copied message to the first internal input port through the first member port and the second member port, and then copies it again to generate a message flow and limit its speed to obtain a message flow with a rate of the target rate, and forwards the message flow to the second internal input port through the third member port.

7. The method according to claim 2, characterized in that The switching chip determines a sending port of the message flow, and after deleting a mark carried by each message in the message flow, sends the message flow through the sending port at the target rate, including: For each message in the message flow, the switching chip determines a sending port according to a tag carried by the message, and sends the message through the sending port after deleting the tag carried by the message, so as to send the message flow at the target rate.

8. The method according to claim 7, characterized in that The switching chip determines the sending port according to the tag carried by the message, including: The switching chip searches the access control list according to the tag carried by the message, and uses the port corresponding to the tag carried by the message as the sending port.

9. The method according to claim 2, characterized in that: The method further comprises: When the processor sends the message carrying the mark to the switching chip, the processor starts the timer, and when the timer reaches the set time, sends a message stop sending command to the switching chip; The switching chip modifies the port corresponding to the mark in the access control list to a preset packet loss port according to the message stop sending command, so as to stop sending the message flow.

10. A network device, characterized in that: The network device comprises a processor and a switching chip in communication connection, and is used to implement the message sending method according to any one of claims 1 to 9.