CN110730130B - Message sending method, device, network equipment and storage medium - Google Patents

Message sending method, device, network equipment and storage medium Download PDF

Info

Publication number
CN110730130B
CN110730130B CN201911009849.4A CN201911009849A CN110730130B CN 110730130 B CN110730130 B CN 110730130B CN 201911009849 A CN201911009849 A CN 201911009849A CN 110730130 B CN110730130 B CN 110730130B
Authority
CN
China
Prior art keywords
message
network interface
flooding
sent
broadcast
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911009849.4A
Other languages
Chinese (zh)
Other versions
CN110730130A (en
Inventor
张晓东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Maipu Communication Technology Co Ltd
Original Assignee
Maipu Communication Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Maipu Communication Technology Co Ltd filed Critical Maipu Communication Technology Co Ltd
Priority to CN201911009849.4A priority Critical patent/CN110730130B/en
Publication of CN110730130A publication Critical patent/CN110730130A/en
Application granted granted Critical
Publication of CN110730130B publication Critical patent/CN110730130B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/32Flooding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application provides a message sending method, a message sending device, network equipment and a storage medium, and relates to the technical field of communication. The method comprises the following steps: identifying a message needing to be broadcast and sent, and adding the message needing to be broadcast and sent into a flooding queue; when a dequeue notification of a system forwarding module is received, judging whether a message to be sent exists in a flooding buffer area or not; when the message to be sent does not exist in the flooding buffer area, the message currently scheduled in the flooding queue is placed into the flooding buffer area, the message to be sent is configured in the flooding buffer area, and the message currently scheduled is sent to a target network interface through the flooding buffer area; and when the message to be sent exists in the flooding buffer area, sending the message to be sent to a target network interface through the flooding buffer area. The flooding process of the message is converted into an asynchronous and staged parallel process through the flooding queue and the flooding buffer zone which operate independently, so that the forwarding efficiency of the message is improved.

Description

Message sending method, device, network equipment and storage medium
Technical Field
The present application relates to the field of communications technologies, and in particular, to a message sending method, an apparatus, a network device, and a storage medium.
Background
With the development of technology, the hardware performance of the network device is higher and higher at present, and the requirement on the forwarding performance of the network device is also higher and higher at the same time, so that more messages are required to be forwarded as much as possible in unit time. Generally, the existing network devices such as routers all have multi-core forwarding, that is, multiple CPUs participate in data forwarding, and even if the network devices are single-CPU forwarding, a special data forwarding process generally forwards data with the highest priority. The basic requirement of the forwarding architecture is that the time for processing a packet is as short as possible, so that the throughput of the system can be improved, and if the time for processing a packet is too long, subsequent packets are queued for waiting, so that the overall forwarding performance of the router is seriously affected, the forwarding delay and data jitter are increased, even packet loss is reduced, and the user service is greatly affected. Bridging flooding of messages to be broadcast and sent has the problems that the whole process is time-consuming because interfaces are traversed, messages are copied and messages are sent in the flooding process, and the time is consumed when more interfaces exist in bridging groups, so that a large amount of time is consumed for processing only one broadcast message, the flooding efficiency of the broadcast message is low, and the overall forwarding performance is seriously influenced.
Disclosure of Invention
In view of this, embodiments of the present application provide a message sending method, an apparatus, a network device, and a storage medium, so as to solve the problems of low message flooding efficiency and poor overall forwarding performance in the prior art.
The embodiment of the application provides a message sending method, which comprises the following steps: identifying a message needing to be broadcast and sent, and adding the message needing to be broadcast and sent into a flooding queue; when a dequeue notification of a system forwarding module is received, judging whether a message to be sent exists in a flooding buffer area or not; when the message to be sent does not exist in the flooding buffer area, the message currently scheduled in the flooding queue is placed into the flooding buffer area, the message to be sent is configured for the flooding buffer area, and the message currently scheduled is sent to a target network interface through the flooding buffer area; and when the message to be sent exists in the flooding buffer area, sending the message to be sent to a target network interface through the flooding buffer area.
In the above implementation manner, through the flooding queue and the flooding buffer area which operate independently, the flooding process of the message which needs to be broadcast and sent in the prior art is converted from a synchronous continuous process which takes a long time into an asynchronous and staged parallel process, so that the overall receiving and sending performance of the network device is not affected when the message is sent, and the message flooding efficiency is improved.
Optionally, the identifying a packet that needs to be broadcast and sent includes: and identifying the broadcast message of which the destination MAC is all 1, the multicast message of which the lowest bit of the first byte of the destination MAC is 1 and the message of which the destination MAC is unicast and a sending interface is not found as the message needing broadcast sending.
In the implementation mode, the message is firstly identified based on the characteristics of the MAC, and the message needing to be broadcasted is determined, so that the accuracy of the message transmitted by broadcasting is improved.
Optionally, the method further comprises an initialization step: registering the flooding queue with a system forwarding module; and distributing the flooding buffer area, wherein the message pointer of the flooding buffer area is initially set to be empty, the initial value of all bits in the network interface bitmap is set to be a first value, each bit of the network interface bitmap corresponds to one network interface, and the first value is used for indicating that the corresponding network interface does not need to send messages.
In the implementation mode, the flooding queue and the flooding buffer area are initialized, so that the flooding queue and the flooding buffer area can independently carry out queue-in and copy sending of the messages needing to be broadcast and sent, and the message flooding efficiency is improved.
Optionally, the adding the packet to be broadcast and sent to a flooding queue includes: and adding the interface index number and the bridge group number of the network interface for receiving the message to be broadcast and sent into the message descriptor of the message to be broadcast and sent.
In the implementation manner, the interface index number and the bridge group number are added to the message descriptor of the message to be broadcast and sent, so that the network interface for receiving the message and the network interface to be broadcast and sent can be accurately determined.
Optionally, the performing configuration to be sent on the flooding buffer includes: based on the interface index number of the receiving network interface of the currently scheduled message, setting the bit corresponding to all other network interfaces, except the receiving network interface, belonging to a bridging group number with the receiving network interface in the network interface bitmap as a second value, wherein the second value is used for indicating that the corresponding network interface needs to send the message; and pointing the message pointer to the message needing to be broadcast and sent.
In the implementation mode, the network interface to be received is determined through the interface index number, so that the message broadcast to the network interface to be received is avoided, the network interface bitmaps of other network interfaces contained in the bridge group number are set to be the second value for indicating that the message needs to be sent, and the message needing to be broadcast is determined through the message pointer, so that the message and the network interface needing to be sent in a broadcast manner are efficiently and accurately determined.
Optionally, the sending the currently scheduled packet/the packet to be sent to a target network interface through the flooding buffer includes: determining whether a bit of the second value is present in the network interface bitmap; when the network interface bitmap has a bit of the second value, determining that the network interface corresponding to the bit is the target network interface; copying the currently scheduled message/the message to be sent pointed by the message pointer to obtain a copied message; and sending the copy message through the target network interface.
In the implementation mode, the broadcast of the message is realized through the network interface bitmap and the message pointer, and the message forwarding efficiency is improved.
Optionally, after the sending the duplicate packet through the target network interface, the method further includes: and setting the bit position corresponding to the target network interface in the network interface bitmap as the first value.
In the implementation manner, after the target network interface finishes message sending, the corresponding bit is reset to the first value, so that the network interface is prevented from carrying out next false sending, and the accuracy of message broadcasting is improved.
Optionally, after the determining whether the bit of the second value is present in the network interface bitmap, the method further comprises: when the network interface bitmap does not have the bit of the second value, releasing the message in the flooding buffer area and the flooding queue; and setting the message pointer in the flooding buffer area to be null.
In the above implementation manner, after the target network interface completes message transmission, the message is released and the message pointer is left vacant, so that preparation is made for the next other message broadcast, and the message broadcast efficiency is further improved.
The embodiment of the application provides a message sending device, which comprises: the enqueue module is used for identifying the message needing to be broadcast and sent and adding the message needing to be broadcast and sent into a flooding queue; the judging module is used for judging whether a message to be sent exists in the flooding buffer area or not when the dequeuing notice of the system forwarding module is received; a sending module, configured to, when the message to be sent does not exist in the flooding buffer, place the currently scheduled message in the flooding queue into the flooding buffer, perform configuration to be sent on the flooding buffer, and send the currently scheduled message to a target network interface through the flooding buffer; the sending module is further configured to send the message to be sent to a target network interface through the flooding buffer area when the message to be sent exists in the flooding buffer area.
In the implementation manner, through the flooding queue and the flooding buffer area which operate independently, the flooding process of the broadcast message in the prior art is converted into an asynchronous and staged parallel process from a synchronous continuous process which takes a long time, so that the overall receiving and sending performance of the network equipment is not affected when the message is broadcast and sent, and the message broadcasting and sending efficiency is improved.
Optionally, the apparatus comprises: and the message identification module is used for identifying the broadcast message of which the target MAC is all 1, the multicast message of which the lowest bit of the first byte of the target MAC is 1 and the message of which the target MAC is unicast and a sending interface is not found as the message needing to be sent in a broadcast mode.
In the implementation mode, the message is firstly identified based on the characteristics of the MAC, and the message needing to be broadcasted is determined, so that the accuracy of the message transmitted by broadcasting is improved.
Optionally, the configuration module is further configured to: registering the flooding queue with a system forwarding module; and distributing the flooding buffer area, wherein the message pointer of the flooding buffer area is initially set to be empty, the initial value of all bits in the network interface bitmap is set to be a first value, each bit of the network interface bitmap corresponds to one network interface, and the first value is used for indicating that the corresponding network interface does not need to send messages.
In the implementation mode, the flooding queue and the flooding buffer area are initialized, so that the flooding queue and the flooding buffer area can independently carry out queue-in and copy sending of the messages needing to be broadcast and sent, and the message flooding efficiency is improved.
Optionally, the enqueuing module is further configured to: and adding the interface index number and the bridge group number of the network interface for receiving the message to be broadcast and sent into the message descriptor of the message to be broadcast and sent.
In the implementation manner, the interface index number and the bridge group number are added to the message descriptor of the message to be broadcast and sent, so that the network interface for receiving the message and the network interface to be broadcast and sent can be accurately determined.
Optionally, the sending module is further configured to: based on the interface index number of the receiving network interface of the currently scheduled message, setting the bit corresponding to all other network interfaces, except the receiving network interface, belonging to a bridging group number with the receiving network interface in the network interface bitmap as a second value, wherein the second value is used for indicating that the corresponding network interface needs to send the message; and pointing the message pointer to the message needing to be broadcast and sent.
In the implementation mode, the network interface to be received is determined through the interface index number, so that the message broadcast to the network interface to be received is avoided, the network interface bitmaps of other network interfaces contained in the bridge group number are set to be the second value for indicating that the message needs to be sent, and the message needing to be broadcast is determined through the message pointer, so that the message and the network interface needing to be sent in a broadcast manner are efficiently and accurately determined.
Optionally, the sending module is specifically configured to: determining whether a bit of the second value is present in the network interface bitmap; when the network interface bitmap has a bit of the second value, determining that the network interface corresponding to the bit is the target network interface; copying the currently scheduled message/the message to be sent pointed by the message pointer to obtain a copied message; and sending the copy message through the target network interface.
In the implementation mode, the broadcast of the message is realized through the network interface bitmap and the message pointer, and the message forwarding efficiency is improved.
Optionally, the configuration module is further configured to: and setting the bit position corresponding to the target network interface in the network interface bitmap as the first value.
In the implementation manner, after the target network interface finishes message sending, the corresponding bit is reset to the first value, so that the network interface is prevented from carrying out next false sending, and the accuracy of message broadcasting is improved.
Optionally, the configuration module is further configured to: when the network interface bitmap does not have the bit of the second value, releasing the message in the flooding buffer area and the flooding queue; and setting the message pointer in the flooding buffer area to be null.
In the above implementation manner, after the target network interface completes message transmission, the message is released and the message pointer is left vacant, so that preparation is made for the next other message broadcast, and the message broadcast efficiency is further improved.
The embodiment of the application also provides network equipment, which comprises a memory and a processor, wherein the memory is stored with program instructions, and the processor executes any message sending method when reading and running the program instructions.
The embodiment of the application also provides a storage medium, wherein computer program instructions are stored in the storage medium, and when the computer program instructions are read and run by a processor, any one of the message sending methods is executed.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a schematic flowchart of a message sending method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a to-be-sent configuration step of a flooding buffer according to an embodiment of the present application;
fig. 3 is a diagram illustrating a correspondence between an interface index number and a network interface bitmap according to an embodiment of the present application;
fig. 4 is a schematic flowchart illustrating a forwarding step of a target network interface of a broadcast packet according to an embodiment of the present application;
fig. 5 is a schematic module diagram of a message sending apparatus according to an embodiment of the present application.
Icon: 20-a message sending device; 21-enqueue module; 22-a judgment module; 23-sending module.
Detailed Description
The technical solution in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
The applicant has found that a network device like a router, which mainly works in the network layer of the TCP/IP protocol, has a core function of forwarding user data according to an IP address, and this process is generally implemented by software. Bridging is a method for directly forwarding data through a two-layer MAC address, and bridging services are deployed on a router, so that some two-layer forwarding services of a client under a specific scene can be met. It should be understood that, besides the router, the message broadcast transmission through the bridge module may also be other network devices such as a switch.
After receiving the message, the bridge module searches and guides the corresponding output interface according to the destination MAC of the message, and then sends out the output interface. For broadcast messages, multicast messages, and unicast messages for which no egress interface is found, flooding is required to be performed, that is, broadcast transmission is performed. The broadcast transmission is to traverse all interfaces in the bridging group in sequence, except a source interface for receiving the message, the broadcast message needs to be transmitted to all other interfaces in the bridging group, before the transmission, the message needs to be copied and the header of the message can be modified, which is a continuous process and is also a part of the whole router data forwarding process. With the development of technology, the hardware performance of the router device is higher and higher at present, and the requirement on the forwarding performance of the router is higher and higher at the same time, so that more messages are required to be forwarded in unit time as much as possible.
However, when network devices such as the existing router and the like broadcast messages, the flooding of the bridge connection to the broadcast messages has the problem, because the traversing of the interfaces, the copying of the messages and the sending of the messages in the flooding process consume time, and the more the interfaces of the bridge connection group are, the more the time is consumed, the problems of poor overall forwarding performance of the network devices and low message broadcasting efficiency are caused.
In order to solve the above problem, an embodiment of the present application provides a bridge broadcast method. Referring to fig. 1, fig. 1 is a flowchart illustrating a bridge broadcast method according to an embodiment of the present disclosure. The specific steps of the bridge broadcast method may be as follows:
step S11: and identifying the message needing to be broadcast and sent, and adding the message needing to be broadcast and sent into a flooding queue.
Optionally, the specific identification step for the packet to be broadcast may include: and identifying the broadcast message of which the destination MAC is all 1, the multicast message of which the lowest bit of the first byte of the destination MAC is 1 and the message of which the destination MAC is unicast and a sending interface is not found as the message needing broadcast sending. It should be understood that in addition to identifying broadcast messages based on MAC, identification may also be made via a message type field or the like in the protocol data unit.
Optionally, before adding the broadcast packet to the flooding queue, initialization setting needs to be performed on the flooding queue and the flooding buffer, and the specific steps may be as follows:
step S111: and registering the flooding queue to a system forwarding module.
The system forwarding module in this embodiment may be a scheduling process executed based on a queue scheduling algorithm, and is used to implement how a relay node or a router in a network selects a packet queue to be sent from one or more data packet queues.
Optionally, compared with the external network interface receiving queue for unicast, the flooding queue in this embodiment may have a lower priority because the unicast packet is often more important or urgent than the broadcast packet, so that the network device performs priority processing on the unicast packet first and then performs forwarding on the broadcast packet.
Step S112: and distributing a flooding buffer area, wherein a message pointer of the flooding buffer area is initially set to be empty, the initial value of all bits in the network interface bitmap is set to be a first value, and each bit of the network interface bitmap corresponds to one network interface.
Flooding (Flooding) is a data flow passing technique used by switches and bridges to send data received from an interface to all interfaces except the interface. The flooding buffer area is used for caching the message needing to be broadcasted.
And the message pointer of the flooding buffer area is used for pointing to the message to be broadcasted so as to obtain the broadcast message and copy the broadcast message based on the message pointer when the message is required to be broadcasted.
The network interface bitmap is used for indicating the execution status of the corresponding network interface, such as transmission/non-transmission, by bit. For example, if a second network interface of a router corresponds to a second bit in the network interface bitmap, it may be indicated that the second network interface needs to perform packet transmission when the bit is set to 1. Wherein, it can also indicate that no message transmission is needed by setting bit to 0. The first value in this embodiment is used to indicate that the network interface corresponding to the bit does not need to send a message. There is no particular limitation in using 0 or 1 as the first value.
Step S12: and when the dequeue notification is received, judging whether a message to be sent exists in the flooding buffer area.
Alternatively, the dequeue notification in this embodiment may be based on priority dequeue, in-order dequeue, or round-robin dequeue, etc.
The message to be sent may be a message that is indicated by the system forwarding module to be broadcast last time, and may not be the same message as the message that needs to be broadcast and sent and is added to the flooding queue in step S11, so that the flooding queue and the flooding buffer operate independently, that is, the message enqueuing and the message sending are processed in parallel, so that the overall transceiving performance of the network device is not affected during message sending, and the message flooding efficiency is improved.
Step S13: when the message to be sent does not exist in the flooding buffer area, the message currently scheduled in the flooding queue is placed into the flooding buffer area, the message to be sent is configured for the flooding buffer area, and the message currently scheduled is sent to a target network interface through the flooding buffer area.
The currently scheduled message is a message which indicates that the flooding queue needs to be broadcast and sent in the dequeuing notification, so that the currently scheduled message is dequeued from the flooding queue.
Step S14: and when the message to be sent exists in the flooding buffer area, sending the message to be sent to a target network interface through the flooding buffer area.
It should be understood that, configuring the flooding buffer requires using information such as a receiving network interface of the packet, a network interface that needs to send the packet, and the like, so that when identifying the packet, the interface index number and the bridge group number of the packet may be added to the packet descriptor of the packet, so as to be used when configuring the flooding buffer.
Specifically, please refer to fig. 2, where fig. 2 is a schematic flowchart of a to-be-sent configuration step of a flooding buffer according to an embodiment of the present application. Step S13 may include the following sub-steps:
step S131: based on the interface index number of the receiving network interface of the currently scheduled message, the bit corresponding to all other network interfaces, except the receiving network interface, belonging to the same bridging group number as the receiving network interface in the network interface bitmap is set as a second value, and the second value is used for indicating that the corresponding network interface needs to send the message.
The interface index numbers correspond to the actual network interfaces one by one, and the actual network interfaces can be determined by the interface index numbers. Optionally, the interface index number in this embodiment may be recorded in a message descriptor of the message when the network device receives the message. Referring to fig. 3, fig. 3 is a diagram illustrating a correspondence relationship between an interface index number and a network interface bitmap according to an embodiment of the present application. For example, it is described that the bridging group where the receiving network interface is located has eight interfaces, and A, B, C, D, E, F, G, H is an interface index number of each network interface in one bridging group, and corresponds to eight bits in 0, 1, 2, 3, 4, 5, 6, and 7 in one byte in the order of arrangement.
When the message sending method in this embodiment is completed by the bridge module, in addition to receiving the interface index number of the network interface, the bridge group number also needs to be recorded into the message descriptor when the broadcast message is received, so as to determine the bridge group number of the bridge module for performing message broadcast sending.
Step S132: and setting corresponding bits of other network interfaces which belong to the same bridging group number except the receiving network interface in the flooding buffer area in a network interface bitmap as a second value.
In this embodiment, the network interface corresponding to the bit of the second value needs to transmit a message, and if the bit of the receiving network interface is not set to the second value, the network interface is still maintained as the first value during initialization, and no message transmission is needed, thereby avoiding message mistransmission.
Taking the interface index number a of the receiving network interface as an example, if the interface index number of a certain message is a, determining that the receiving network interface of the message is a, keeping the value of the bit in the network interface bitmap corresponding to a to be 0, and setting the value of the other bit in the network interface bitmap to be 1.
Step S133: and pointing the message pointer to the message to be broadcast and transmitted.
When the message pointer points to the message, the specific position of the message in the flooding buffer area can be determined, so that data such as the message content of the message can be acquired for broadcast transmission of the message.
As an optional implementation manner, the step of sending the currently scheduled message/the message to be sent to the target network interface through the flooding buffer in the steps S13 and S14 may specifically include the following sub-steps:
step S134: it is determined whether a bit of the second value is present in the network interface bitmap.
When a bit with a bit value of 1 exists in the network interface bitmap, it is indicated that the network interface corresponding to the bit needs to perform message broadcasting.
Step S135: and when the network interface bitmap has the bit of the second value, determining the network interface corresponding to the bit as the target network interface.
The target network interface in this embodiment is a network interface that needs to forward a packet.
Step S136: and copying the currently scheduled message/message to be sent pointed by the message pointer to obtain a copied message.
Optionally, after the message is obtained based on the message pointer of the flooding buffer, the message is copied, the copied message is sent when the message is sent, and before the message is not sent to all target network interfaces, the message in the flooding buffer is reserved without re-caching and obtaining the message, so that the efficiency of broadcasting the message is improved.
Step S137: and sending the copy message through the target network interface.
It should be understood that a message is broadcast-sent, and therefore, the message generally needs to be sent multiple times through multiple target network ports, please refer to fig. 4, where fig. 4 is a schematic flowchart of a target network interface forwarding step of a broadcast message provided in this embodiment of the present application, and specific steps may be as follows:
step S141: it is determined whether a bit of the second value is present in the network interface bitmap.
Step S142: and when the network interface bitmap has the bit of the second value, determining the network interface corresponding to the bit as the target network interface.
Step S143: and copying the message pointed by the message pointer to obtain a copied message.
Step S144: and sending the copy message through the target network interface.
Step S145: and setting the bit position corresponding to the output interface in the output interface bitmap as a first value.
Step S146: it is determined whether a bit of the second value is present in the interface bitmap.
Step S147: when the bit of the second value exists in the egress interface bitmap, the dequeue notification of the system forwarding module is waited, and after the dequeue notification of the system forwarding module is received, the process proceeds to step S12.
It should be noted that, after the step S147 is completed, the forwarding process of a target network interface of the broadcast message is completed, and the step S12 is performed when the dequeue notification of the system forwarding module is received again, at this time, since the flooding buffer message is not sent to all target network interfaces, the step S12 will proceed to the step S14.
And S148, when the output interface bitmap does not have the bit of the second value, releasing the message of the flooding buffer area, setting a message pointer in the flooding buffer area to be null, and entering the step S12 after waiting for the dequeue notification of the system forwarding module.
It should be noted that, after the step S148 is completed, the forwarding process of a target network interface of the broadcast message is completed, and the process enters step S12 when the dequeue notification of the system forwarding module is received again, because the message pointer in the current flooding buffer is set to be empty (that is, the previous message is already sent to all target network interfaces), after the dequeue notification of the system forwarding module is received, it is determined whether there is a message to be sent in the flooding buffer, step S13 is executed, and a message to be sent is dequeued from the flooding queue and is placed in the flooding buffer.
In order to better implement the above message sending method, the embodiment of the present application further provides a message sending apparatus 20.
Referring to fig. 5, fig. 5 is a schematic block diagram of a message sending apparatus according to an embodiment of the present disclosure.
The message transmission device 20 includes:
the enqueue module 21 is configured to identify a message to be broadcast and send, and add the message to be broadcast and sent to a flooding queue;
a judging module 22, configured to judge whether a message to be sent exists in the flooding buffer area when the dequeue notification of the system forwarding module is received;
a sending module 23, configured to, when there is no message to be sent in the flooding buffer, place the currently scheduled message in the flooding queue into the flooding buffer, perform configuration to be sent on the flooding buffer, and send the currently scheduled message to a target network interface through the flooding buffer;
the sending module 23 is further configured to send, when there is a message to be sent in the flooding buffer, the message to be sent to the target network interface through the flooding buffer.
Optionally, the message sending apparatus 20 further includes: and the message identification module is used for identifying the broadcast message of which the target MAC is all 1, the multicast message of which the lowest bit of the first byte of the target MAC is 1 and the message of which the target MAC is unicast and a sending interface is not found as the message needing to be sent in a broadcast mode.
Optionally, the sending module 23 is further configured to: registering a flooding queue to a system forwarding module; distributing a flooding buffer area, wherein a message pointer of the flooding buffer area is initially set to be null, the initial value of all bits in a network interface bitmap is set to be a first value, each bit of the network interface bitmap corresponds to one network interface, and the first value is used for indicating that the corresponding network interface does not need to send messages.
Optionally, the enqueuing module 21 is specifically configured to: and adding the interface index number and the bridging group number of the network interface receiving the message to be broadcast and transmitted into the message descriptor of the message to be broadcast and transmitted.
Optionally, the sending module 23 is specifically configured to: based on the interface index number of the receiving network interface of the currently scheduled message, setting the bit corresponding to all other network interfaces, except the receiving network interface, belonging to the same bridging group number as the receiving network interface in the network interface bitmap as a second value, wherein the second value is used for indicating that the corresponding network interface needs to send the message; and pointing the message pointer to the message to be broadcast and transmitted.
Optionally, the sending module 23 is specifically configured to: determining whether a bit of a second value exists in the network interface bitmap; when the network interface bitmap has a bit of a second value, determining the network interface corresponding to the bit as a target network interface; copying the currently scheduled message/message to be sent pointed by the message pointer to obtain a copied message; and sending the copy message through the target network interface.
Optionally, the sending module 23 is further specifically configured to: and setting the bit position corresponding to the target network interface in the network interface bitmap as a first value.
Optionally, the sending module 23 is further configured to: when the network interface bitmap does not have a bit of a second value, releasing the message in the flooding buffer area and the flooding queue; and setting the message pointer in the flooding buffer area to be null.
The embodiment of the present application further provides a network device, where the network device includes a memory and a processor, where the memory stores program instructions, and when the processor reads and runs the program instructions, the processor executes any of the message sending methods provided in this embodiment.
It should be understood that the network device may be a Personal Computer (PC), a tablet PC, a smart phone, a Personal Digital Assistant (PDA), or other network device having a logical computing function. In this embodiment, specifically, the network device may be a network device such as a router and a switch, which has a communication function and is provided with a bridging module and a system forwarding module, where the system forwarding module is configured to initiate a forwarding instruction for a packet. Meanwhile, it should be understood that the message sending method in this embodiment may be executed by a bridge module in the network device.
The embodiment of the present application further provides a storage medium, where a computer program instruction is stored in the storage medium, and when the computer program instruction is read and executed by a processor, the computer program instruction executes any of the message sending methods provided in the embodiment.
To sum up, the embodiment of the present application provides a message sending method, an apparatus, a network device, and a storage medium, where the method includes: identifying a message needing to be broadcast and sent, and adding the message into a flooding queue; when a dequeue notification of a system forwarding module is received, judging whether the message exists in a flooding buffer area or not; when the message does not exist in the flooding buffer area, putting the message in the flooding queue into the flooding buffer area; when the message exists in the flooding buffer area, performing configuration to be sent on the flooding buffer area based on the message in the flooding buffer area; and sending the message to a target network interface through the flooding buffer area so as to send the message through the target network interface.
In the implementation manner, through the flooding queue and the flooding buffer area which operate independently, the flooding process of the broadcast message in the prior art is converted into an asynchronous and staged parallel process from a synchronous continuous process which takes a long time, so that the overall receiving and sending performance of the network equipment is not affected when the message is broadcast, and the efficiency of the broadcast message is improved.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus may be implemented in other manners. The apparatus embodiments described above are merely illustrative, and for example, the block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of devices according to various embodiments of the present application. In this regard, each block in the block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams, and combinations of blocks in the block diagrams, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Therefore, the present embodiment further provides a readable storage medium, in which computer program instructions are stored, and when the computer program instructions are read and executed by a processor, the computer program instructions perform the steps of any of the block data storage methods. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a RanDOm Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application. It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

Claims (9)

1. A message sending method is characterized in that the method is applied to a bridge module of a network device, and the method comprises the following steps:
registering a flooding queue to a system forwarding module;
distributing a flooding buffer area, wherein a message pointer of the flooding buffer area is initially set to be null, initial values of all bits in a network interface bitmap are set to be first values, each bit of the network interface bitmap corresponds to one network interface, and the first values are used for indicating that the corresponding network interfaces do not need to send messages;
identifying a message needing to be broadcast and sent, and adding the message needing to be broadcast and sent into the flooding queue;
when a dequeue notification of a system forwarding module is received, judging whether a message to be sent exists in the flooding buffer area or not;
when the message to be sent does not exist in the flooding buffer area, the message currently scheduled in the flooding queue is placed into the flooding buffer area, the message to be sent is configured for the flooding buffer area, and the message currently scheduled is sent to a target network interface through the flooding buffer area;
when a message to be sent exists in the flooding buffer area, sending the message to be sent to a target network interface through the flooding buffer area;
the method further comprises the following steps: identifying a message needing unicast, and adding the message needing unicast into an external network interface receiving queue, wherein the priority of the external network interface receiving queue is higher than that of the flooding queue;
adding the message to be broadcast to the flooding queue includes: and adding the interface index number and the bridge group number of the network interface for receiving the message to be broadcast and sent into the message descriptor of the message to be broadcast and sent.
2. The method of claim 1, wherein the identifying the message that needs to be broadcast comprises:
and identifying the broadcast message of which the destination media access control address MAC is all 1, the multicast message of which the lowest bit of the first byte of the destination MAC is 1 and the message of which the destination MAC is unicast and a sending interface is not found as the message needing broadcast sending.
3. The method of claim 2, wherein the configuring the flooding buffer for sending comprises:
based on the interface index number of the receiving network interface of the currently scheduled message, setting the bit corresponding to all other network interfaces, except the receiving network interface, belonging to a bridging group number with the receiving network interface in the network interface bitmap as a second value, wherein the second value is used for indicating that the corresponding network interface needs to send the message;
and pointing the message pointer to the message needing to be broadcast and sent.
4. The method of claim 3, wherein the sending the currently scheduled packet/the packet to be sent to a target network interface through the flooding buffer comprises:
determining whether a bit of the second value is present in the network interface bitmap;
when the network interface bitmap has a bit of the second value, determining that the network interface corresponding to the bit is the target network interface;
copying the currently scheduled message/the message to be sent pointed by the message pointer to obtain a copied message;
and sending the copy message through the target network interface.
5. The method of claim 4, wherein after the sending the duplicate packet over the target network interface, the method further comprises:
and setting the bit position corresponding to the target network interface in the network interface bitmap as the first value.
6. The method of claim 4, wherein after the determining whether the bit of the second value is present in the network interface bitmap, the method further comprises:
when the network interface bitmap does not have the bit of the second value, releasing the message in the flooding buffer area and the flooding queue;
and setting the message pointer in the flooding buffer area to be null.
7. A message transmission apparatus, characterized in that the apparatus comprises:
the configuration module is used for registering the flooding queue to the system forwarding module; distributing a flooding buffer area, wherein a message pointer of the flooding buffer area is initially set to be null, initial values of all bits in a network interface bitmap are set to be first values, each bit of the network interface bitmap corresponds to one network interface, and the first values are used for indicating that the corresponding network interfaces do not need to send messages;
the enqueue module is used for identifying the message needing to be broadcast and sent and adding the message needing to be broadcast and sent into a flooding queue;
the judging module is used for judging whether a message to be sent exists in the flooding buffer area or not when the dequeuing notice of the system forwarding module is received;
a sending module, configured to, when the message to be sent does not exist in the flooding buffer, place the currently scheduled message in the flooding queue into the flooding buffer, perform configuration to be sent on the flooding buffer, and send the currently scheduled message to a target network interface through the flooding buffer;
the sending module is further configured to send the message to be sent to a target network interface through the flooding buffer area when the message to be sent exists in the flooding buffer area;
the enqueue module is further configured to: identifying a message needing unicast, and adding the message needing unicast into an external network interface receiving queue, wherein the priority of the external network interface receiving queue is higher than that of the flooding queue;
adding the message to be broadcast to the flooding queue includes: and adding the interface index number and the bridge group number of the network interface for receiving the message to be broadcast and sent into the message descriptor of the message to be broadcast and sent.
8. A network device comprising a memory having stored therein program instructions and a processor that, when read and executed, performs the messaging method of any of claims 1-6.
9. A storage medium having stored therein computer program instructions which, when executed by a processor, perform the method of messaging according to any one of claims 1-6.
CN201911009849.4A 2019-10-22 2019-10-22 Message sending method, device, network equipment and storage medium Active CN110730130B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911009849.4A CN110730130B (en) 2019-10-22 2019-10-22 Message sending method, device, network equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911009849.4A CN110730130B (en) 2019-10-22 2019-10-22 Message sending method, device, network equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110730130A CN110730130A (en) 2020-01-24
CN110730130B true CN110730130B (en) 2022-04-22

Family

ID=69221730

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911009849.4A Active CN110730130B (en) 2019-10-22 2019-10-22 Message sending method, device, network equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110730130B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114285906B (en) * 2021-12-24 2024-01-23 北京天融信网络安全技术有限公司 Message processing method and device, electronic equipment and storage medium

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7697526B2 (en) * 2002-08-06 2010-04-13 Broadcom Corporation Packet filtering based on port bit map
US8208483B2 (en) * 2006-09-04 2012-06-26 Telefonaktiebolaget Lm Ericsson (Publ) Ethernet switching
CN101079015B (en) * 2007-06-28 2012-01-04 杭州华三通信技术有限公司 Data transmission method and system
CN101883400B (en) * 2010-07-06 2012-11-28 迈普通信技术股份有限公司 Data transmission method and access control equipment in wireless local area network
JP2012128644A (en) * 2010-12-15 2012-07-05 Toshiba Corp Memory system
CN102331923B (en) * 2011-10-13 2015-04-22 西安电子科技大学 Multi-core and multi-threading processor-based functional macropipeline implementing method
US9444751B1 (en) * 2012-08-03 2016-09-13 University Of Southern California Backpressure with adaptive redundancy
CN102811176B (en) * 2012-08-28 2015-09-23 迈普通信技术股份有限公司 A kind of data flow control method and device

Also Published As

Publication number Publication date
CN110730130A (en) 2020-01-24

Similar Documents

Publication Publication Date Title
CN109412964B (en) Message control method and network device
US9762497B2 (en) System, method and apparatus for network congestion management and network resource isolation
US7310339B1 (en) Packet messaging method and apparatus
KR100716184B1 (en) Apparatus and method for a queue management of network processor
US10015112B2 (en) Memory-efficient handling of multicast traffic
CN108768866B (en) Cross-card forwarding method and device for multicast message, network equipment and readable storage medium
CN105812287A (en) Effective circuits in packet-switched networks
US20120002680A1 (en) Interruption, at least in part, of frame transmission
Hua et al. Scheduling heterogeneous flows with delay-aware deduplication for avionics applications
EP3979577B1 (en) Queue congestion control method, device and storage medium
CN113225253B (en) Message forwarding method and device
US7792129B2 (en) Multi-queue packet processing using Patricia tree
CN114079638A (en) Data transmission method, device and storage medium of multi-protocol hybrid network
CN113225196A (en) Service level configuration method and device
JP6055553B2 (en) Queue scheduling method, apparatus and system
US7209489B1 (en) Arrangement in a channel adapter for servicing work notifications based on link layer virtual lane processing
CN110730130B (en) Message sending method, device, network equipment and storage medium
WO2010072122A1 (en) Method, port and system for transmitting messages
RU2138127C1 (en) Method of transmission of messages between subscriber devices combined in network
WO2021101640A1 (en) Method and apparatus of packet wash for in-time packet delivery
CN115412502A (en) Network port expansion and message rapid equalization processing method
JP5728368B2 (en) Network system and communication device
CN116938851A (en) Message transmission method and related equipment
CN110336759B (en) RDMA (remote direct memory Access) -based protocol message forwarding method and device
Thiruvenkatam et al. Optimizing data center network throughput by solving TCP Incast problem using k‐means algorithm

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant