A message queueing method, device, network chip and storage medium

By adopting packaged and reasonable message sending strategies in the network chip, the problem of long delay in packet enqueuing is solved, the number of message interactions is reduced, and the processing efficiency is improved.

CN118677859BActive Publication Date: 2024-11-19格创通信(浙江)有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411146769.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-21
Publication Date
2024-11-19
Estimated Expiration
2044-08-21

AI Technical Summary

Technical Problem

The delay of packet enqueuing in network chips is long, mainly due to the frequent interaction between ENQ messages and ENQ Res messages, especially when a large number of packets are received, the processing efficiency is low.

Method used

In the enqueue management unit, it is determined whether there is a valid message in the target queue. If it exists, it will be temporarily stored and when the preset number reaches or the ENQ Res message is received, it will send the ENQ message of the packet packet to the address allocation unit and request the allocation Address, reduce the number of message interactions.

Benefits of technology

Through package operation and reasonable message sending strategy, the number of message interactions between the queued management unit and the address allocation unit is reduced, and the processing delay of messages is significantly reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118677859B_ABST
    Figure CN118677859B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a message enqueue method, device, network chip and storage medium. It relates to the field of communication technology and is applied to an enqueue management unit in a network chip. The above method includes: when receiving a target message, determining the target queue to which the target message belongs; judging whether there is a valid message belonging to the target queue; if not, sending an ENQ message for the target message to an address allocation unit; if so, temporarily storing the target message, and when the address allocation unit feeds back an ENQ Res message, or the number of temporarily stored messages reaches a preset number, sending an ENQ message for all currently temporarily stored messages to the address allocation unit; after receiving the ENQ Res message fed back by the address allocation unit, enqueue the target message based on the address carried in the ENQ Res message. The solution provided by the embodiment of the present invention can reduce the processing delay of the message.
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 enqueueing method, device, network chip and storage medium. Background Art

[0002] In the related technology, after receiving a message, the enqueue management unit in the network chip needs to send an ENQ (Enqueue Request) message to the address allocation unit in the network chip to request allocation of an address for the message. Then the address allocation unit returns an ENQ Res (Enqueue Request Response) message to the enqueue management unit, and feeds back the address allocated for the message to the enqueue management unit. The enqueue management unit enqueues the message based on the allocated address.

[0003] However, sending ENQ messages and ENQ Res messages takes a certain amount of time. If the network chip receives a large number of messages, the queue management unit and the address allocation unit need to frequently interact with each other multiple times, which takes a long time and causes a long delay in message processing. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide a message queueing method, device, network chip and storage medium to reduce the message processing delay. The specific technical solution is as follows:

[0005] In a first aspect of an embodiment of the present invention, a message enqueue method is first provided, which is applied to an enqueue management unit in a network chip, and the method includes:

[0006] When receiving a target message, determining a target queue to which the target message belongs;

[0007] Determine whether there is a valid message belonging to the target queue; wherein the valid message is: a message for which no ENQ Res message of the address allocation unit in response to the queue request for the message is received;

[0008] If not, sending an enqueue request ENQ message for the target message to the address allocation unit, so that the address allocation unit feeds back the number of addresses requested to be allocated by the ENQ message; wherein the number of addresses requested to be allocated carried in the ENQ message is: the number of messages targeted by the ENQ message;

[0009] If so, temporarily store the target message, and when the address allocation unit feeds back an ENQ Res message, or the number of temporarily stored messages reaches a preset number, send an ENQ message for all currently temporarily stored messages to the address allocation unit, so that the address allocation unit feeds back the number of addresses requested to be allocated by the ENQ message;

[0010] After receiving the ENQ Res message fed back by the address allocation unit, the target message is queued based on the address carried in the ENQ Res message.

[0011] In a possible embodiment, the determining whether there is a valid message belonging to the target queue; if not, sending an ENQ message for the target message to the address allocation unit; if yes, temporarily storing the target message, and when the address allocation unit feeds back an ENQ Res message, or the number of temporarily stored messages reaches a preset number, sending an ENQ message for all currently temporarily stored messages to the address allocation unit; after receiving the ENQ Res message fed back by the address allocation unit, enqueuing the target message based on the address carried in the ENQ Res message, includes:

[0012] Determine whether the target queue has a valid identifier whose value is a first value; wherein the valid identifier is included in the recorded mapping relationship of the corresponding target queue, different mapping relationships correspond to different messages, and the value of the valid identifier is the first value, indicating that: an ENQ Res message for the corresponding message has not been received, otherwise it indicates that an ENQ Res message for the corresponding message has been received;

[0013] If it does not exist, an ENQ message for the target message is sent to the address allocation unit once, and the first mapping relationship corresponding to the target queue is recorded; wherein the first mapping relationship is: a mapping relationship between a start identifier whose value is the identifier of the target message, a valid identifier whose value is the first value, a sending identifier whose value is the second value, and an ending identifier whose value is the identifier of the target message, and the sending identifier whose value is the second value indicates that an ENQ message for the assembled message has been sent to the address allocation unit, otherwise, it indicates that an ENQ message for the assembled message has not been sent to the address allocation unit, and the assembled message is: a message received between the message indicated by the start identifier and the message indicated by the ending identifier;

[0014] If it exists, and the target sending identifier does not exist, then record the second mapping relationship corresponding to the target queue; wherein the second mapping relationship is a mapping relationship between a start identifier whose value is the identifier of the target message, a valid identifier whose value is the first value, a sending identifier whose value is not the second value, and an ending identifier whose value is the identifier of the target message, and the target sending identifier is: a sending identifier corresponding to the target queue whose value is not the second value;

[0015] If it exists, and the target sending identifier exists, then the termination identifier in the mapping relationship containing the target sending identifier is updated to the identifier of the target message, and if the number of the assembled messages after the update reaches the preset number of messages, then an ENQ message for the assembled message corresponding to the mapping relationship is sent to the address allocation unit once to request the address allocation unit to allocate the preset number of addresses to the assembled message, and the value of the sending identifier in the mapping relationship corresponding to the assembled message is updated to the second value;

[0016] If an ENQ Res message for the target queue is received, the value of the valid identifier corresponding to the message targeted by the ENQ Res message is updated to a non-first value, and if a third mapping relationship exists, an ENQ message for the assembled message corresponding to the third mapping relationship is sent; wherein the value of the valid identifier contained in the third mapping relationship is the first value, and the value of the sending identifier contained is not the second value;

[0017] Based on the address contained in the received ENQ Res message, the message corresponding to the ENQ Res message is queued.

[0018] In a possible embodiment, the method further includes:

[0019] After sending the ENQ message corresponding to the message, the identifier of the message is recorded.

[0020] In a possible embodiment, the length of the target message is not less than a preset message length.

[0021] In a second aspect of an embodiment of the present invention, a message enqueue method is further provided, which is applied to an address allocation unit in a network chip, and the method includes:

[0022] Receive an enqueue request ENQ message sent by an enqueue management unit and carrying the number of addresses requested for allocation;

[0023] Allocating the number of addresses to the message;

[0024] An enqueue request response ENQ Res message including the allocated address is sent to the enqueue management unit, so that the enqueue management unit enqueues the message based on the address included in the ENQ Res message.

[0025] In a third aspect of an embodiment of the present invention, a message enqueue device is further provided, which is applied to an enqueue management unit in a network chip, and the device includes:

[0026] A queue determination module, configured to determine, when receiving a target message, a target queue to which the target message belongs;

[0027] A message judging module, used for judging whether there is a valid message belonging to the target queue; wherein the valid message is: a message for which no ENQ Res message of the address allocation unit for the message's queue entry request response is received;

[0028] A first sending module is used for sending an enqueue request ENQ message for the target message to the address allocation unit if it does not exist, so that the address allocation unit feeds back the number of addresses requested to be allocated by the ENQ message, and the number of addresses requested to be allocated carried in the ENQ message is: the number of messages targeted by the ENQ message;

[0029] A second sending module is used to temporarily store the target message if it exists, and when the address allocation unit feeds back an ENQRes message or the number of temporarily stored messages reaches a preset number, send an ENQ message for all currently temporarily stored messages to the address allocation unit, so that the address allocation unit feeds back the number of addresses requested to be allocated by the ENQ message;

[0030] The message enqueuing module is used to enqueue the target message based on the address carried in the ENQ Res message after receiving the ENQ Res message fed back by the address allocation unit.

[0031] In a possible embodiment, the message determination module, the first sending module, the second sending module, and the message enqueue module are specifically used to:

[0032] Determine whether the target queue has a valid identifier whose value is a first value; wherein the valid identifier is included in the recorded mapping relationship of the corresponding target queue, different mapping relationships correspond to different messages, and the value of the valid identifier is the first value, indicating that: an ENQ Res message for the corresponding message has not been received, otherwise it indicates that an ENQ Res message for the corresponding message has been received;

[0033] If it does not exist, an ENQ message for the target message is sent to the address allocation unit once, and the first mapping relationship corresponding to the target queue is recorded; wherein the first mapping relationship is: a mapping relationship between a start identifier whose value is the identifier of the target message, a valid identifier whose value is the first value, a sending identifier whose value is the second value, and an ending identifier whose value is the identifier of the target message, and the sending identifier whose value is the second value indicates that an ENQ message for the assembled message has been sent to the address allocation unit, otherwise, it indicates that an ENQ message for the assembled message has not been sent to the address allocation unit, and the assembled message is: a message received between the message indicated by the start identifier and the message indicated by the ending identifier;

[0034] If it exists, and the target sending identifier does not exist, then record the second mapping relationship corresponding to the target queue; wherein the second mapping relationship is a mapping relationship between a start identifier whose value is the identifier of the target message, a valid identifier whose value is the first value, a sending identifier whose value is not the second value, and an ending identifier whose value is the identifier of the target message, and the target sending identifier is: a sending identifier corresponding to the target queue whose value is not the second value;

[0035] If it exists, and the target sending identifier exists, then the termination identifier in the mapping relationship containing the target sending identifier is updated to the identifier of the target message, and if the number of the assembled messages after the update reaches the preset number of messages, then an ENQ message for the assembled message corresponding to the mapping relationship is sent to the address allocation unit once to request the address allocation unit to allocate the preset number of addresses to the assembled message, and the value of the sending identifier in the mapping relationship corresponding to the assembled message is updated to the second value;

[0036] If an ENQ Res message for the target queue is received, the value of the valid identifier corresponding to the message targeted by the ENQ Res message is updated to a non-first value, and if a third mapping relationship exists, an ENQ message for the assembled message corresponding to the third mapping relationship is sent; wherein the value of the valid identifier contained in the third mapping relationship is the first value, and the value of the sending identifier contained is not the second value;

[0037] Based on the address contained in the received ENQ Res message, the message corresponding to the ENQ Res message is queued.

[0038] In a possible embodiment, the device further includes:

[0039] The identification recording module is used to record the identification of the message after sending the ENQ message corresponding to the message.

[0040] In a possible embodiment, the length of the target message is not less than a preset message length.

[0041] In a fourth aspect of an embodiment of the present invention, a message enqueue device is further provided, which is applied to an address allocation unit in a network chip, and the device includes:

[0042] A message receiving module, used for receiving an enqueue request ENQ message carrying the number of addresses requested for allocation, sent by the enqueue management unit;

[0043] An address allocation module, used for allocating the number of addresses to the message;

[0044] The third sending module is used to send an enqueue request response ENQ Res message containing the allocated address to the enqueue management unit, so that the enqueue management unit enqueues the message based on the address contained in the ENQ Res message.

[0045] In a fifth aspect of the embodiments of the present invention, a network chip is further provided, wherein an enqueue management unit in the network chip is used to implement any of the method steps described in the first aspect.

[0046] In a sixth aspect of the embodiments of the present invention, a network chip is further provided, wherein the address allocation unit in the network chip is used to implement the method steps described in the second aspect above.

[0047] In another aspect of the present invention, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium. When the computer program is executed by a processor, the method steps described in any one of the first aspect or the second aspect are implemented.

[0048] Beneficial effects of the embodiments of the present invention:

[0049] The message enqueuing method provided by the embodiment of the present invention is that when there are valid messages belonging to the target queue, the enqueuing management unit performs a packing operation on the temporarily stored target messages, and sends an ENQ message for all the currently temporarily stored messages to the address allocation unit. The number of addresses requested for allocation carried in the ENQ message is the number of messages targeted by the ENQ message. Therefore, the address allocation unit can allocate addresses for all the currently temporarily stored messages at one time, and for all the currently temporarily stored messages, the address allocation unit will only return an ENQ Res message to the enqueuing management unit once, thereby avoiding frequent message interactions between the enqueuing management unit and the address allocation unit, thereby reducing the message processing delay.

[0050] Of course, it is not necessary to achieve all of the advantages described above at the same time to implement any product or method of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can also be obtained based on these drawings.

[0052] Figure 1 A schematic diagram of a flow chart of a first message enqueueing method provided in an embodiment of the present invention;

[0053] Figure 2 A schematic diagram of a flow chart of a second message enqueueing method provided in an embodiment of the present invention;

[0054] Figure 3 A schematic diagram of a flow chart of a third message enqueueing method provided by an embodiment of the present invention;

[0055] Figure 4 A schematic diagram of the structure of a queue management unit provided by an embodiment of the present invention;

[0056] Figure 5 A schematic diagram of a change of a termination mark provided in an embodiment of the present invention;

[0057] Figure 6 A schematic diagram of a flow chart of a fourth message enqueueing method provided by an embodiment of the present invention;

[0058] Figure 7 A schematic diagram of the structure of a first message enqueue device provided in an embodiment of the present invention;

[0059] Figure 8 A schematic structural diagram of a second message enqueueing device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0060] The following will be combined with the 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. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field based on the present invention belong to the scope of protection of the present invention.

[0061] The embodiment of the present invention provides a message enqueue method, which is applied to an enqueue management unit in a network chip, see Figure 1 , is a flow chart of a first message enqueueing method provided in an embodiment of the present invention, the method includes S101-S105.

[0062] S101, when receiving a target message, determining a target queue to which the target message belongs.

[0063] In S101, the target queue can be represented by a QID (Queue Identifier), and different QIDs represent different queues. For example, if the QID of the target queue to which the target message belongs is 1, then the target queue to which the target message belongs is the first queue. If the QID of the target queue to which the target message belongs is 2, then the target queue to which the target message belongs is the second queue.

[0064] The number of messages in a queue may be one or more. The embodiment of the present invention does not specifically limit the number of messages contained in the queue.

[0065] In a possible embodiment, the length of the target message is not less than a preset message length.

[0066] The length of the target message may be expressed in bytes or bits. For example, assuming that the preset message length is 50 bits, the length of the target message is not less than 50 bits. The preset message length may be preset by a technician with professional knowledge according to actual needs and / or experience.

[0067] If the length of the target message is lower than the preset message length, the messages entering the network chip will be too dense, affecting the subsequent processing of the messages. Therefore, the length of the target message needs to be limited.

[0068] By selecting the above embodiment, the length of the target message is not less than the preset message length, and the messages entering the network chip can be screened, and the messages with too small length can be discarded or not processed, thereby preventing the messages with too small length from entering the network chip.

[0069] S102, determining whether there is a valid message belonging to the target queue.

[0070] If not, execute S103; if so, execute S104.

[0071] In S102, if there is no valid message belonging to the target queue, it means that the messages belonging to the target queue have received the ENQ Res message for the message from the address allocation unit. If there is a valid message belonging to the target queue, it means that there is a message belonging to the target queue that has not received the ENQ Res message for the message from the address allocation unit.

[0072] A valid message is a message for which no ENQ Res message is received from the address allocation unit.

[0073] Specifically, valid messages can be divided into two types.

[0074] The first is that the enqueue management unit has sent an ENQ message for the message, but has not received an ENQ Res message for the message from the address allocation unit. For example, if the enqueue management unit has sent an ENQ message for Packet 0, but has not received an ENQ Res message for Packet0 from the address allocation unit, Packet0 is a valid message.

[0075] The second is that the queue management unit does not send an ENQ message for the message. For example, if the queue management unit does not send an ENQ message for Packet 1, then Packet 1 is a valid message.

[0076] S103, sending an enqueue request message for the target message to the address allocation unit, so that the address allocation unit feeds back the number of addresses requested to be allocated by the enqueue request message.

[0077] In S103, if there is no valid message belonging to the target queue, it means that the messages belonging to the target queue have received the ENQ Res message for the message from the address allocation unit. Therefore, the queue management unit directly sends an ENQ message for the target message to the address allocation unit, so that the address allocation unit feeds back the number of addresses requested to be allocated by the ENQ message. The number of addresses requested to be allocated carried in the ENQ message is: the number of messages targeted by the ENQ message.

[0078] Since all the messages belonging to the target queue have received the ENQ Res message for the message from the address allocation unit, at this time, the only message targeted by the ENQ message is the target message, the number of messages targeted by the ENQ message is 1, and the number of addresses requested for allocation carried in the ENQ message is 1, that is, the address allocation unit feeds back an ENQ Res message containing an address for the target message to the enqueue management unit.

[0079] In the embodiment of the present invention, the enqueue request response message is an ENQ Res message, and the enqueue request message is an ENQ message.

[0080] S104, temporarily storing the target message, when the address allocation unit feeds back an enqueue request response message, or the number of temporarily stored messages reaches a preset number, sending an enqueue request message for all currently temporarily stored messages to the address allocation unit, so that the address allocation unit feeds back the number of addresses requested to be allocated by the enqueue request message.

[0081] In S104, if there is a valid message belonging to the target queue, it means that there is a message belonging to the target queue that has not received the ENQ Res message for the message from the address allocation unit, so the target message is temporarily stored and waits for the target message to be packaged with other messages belonging to the target queue.

[0082] While the target message is waiting to be assembled with other messages belonging to the target queue, if the address allocation unit feeds back an ENQ Res message, or the number of temporarily stored messages reaches a preset number, an ENQ message for all currently temporarily stored messages is sent to the address allocation unit, so that the address allocation unit feeds back the number of addresses requested to be allocated by the ENQ message.

[0083] Exemplarily, assuming that the preset number is 16, if the number of temporarily stored messages reaches 16, an ENQ message for the 16 messages currently temporarily stored is sent to the address allocation unit, so that the address allocation unit feeds back 16 addresses.

[0084] If the address allocation unit feeds back an ENQ Res message while the target message is waiting to be assembled with other messages belonging to the target queue, and assuming that the number of temporarily stored messages reaches 3 at this time, an ENQ message for the 3 currently temporarily stored messages is sent to the address allocation unit, so that the address allocation unit feeds back 3 addresses.

[0085] It should be noted that the number of addresses requested for allocation carried in the ENQ message may be the number of messages targeted by the ENQ message, or the number of messages targeted by the ENQ message-1.

[0086] Exemplarily, the number of addresses requested for allocation carried in the ENQ message may be represented by Pcount (count), and the number of messages targeted by the ENQ message is N. In one case, the value of Pcount is N, and in another case, the value of Pcount is N-1.

[0087] For example, the number of messages targeted by the ENQ message is 16. If the number of addresses requested for allocation carried in the ENQ message can be the number of messages targeted by the ENQ message itself, the value of Pcount is 16; if the number of addresses requested for allocation carried in the ENQ message is the number of messages targeted by the ENQ message - 1, the value of Pcount is 15.

[0088] For example, the number of messages targeted by the ENQ message is 2. If the number of addresses requested for allocation carried in the ENQ message can be the number of messages targeted by the ENQ message itself, the value of Pcount is 2; if the number of addresses requested for allocation carried in the ENQ message is the number of messages targeted by the ENQ message - 1, the value of Pcount is 1.

[0089] S105, after receiving the queue request response message fed back by the address allocation unit, the target message is queued based on the address carried in the queue request response message.

[0090] In S105, after receiving the ENQ Res message fed back by the address allocation unit, the enqueue management unit enqueues the target message based on the address carried in the ENQ Res message, because the ENQ Res message carries the address allocated to the target message by the address allocation unit.

[0091] In a possible embodiment, after receiving the message, the queue management unit temporarily stores all the messages in a message temporary storage space, and if the queue management unit has sent an ENQ message for a message in the message temporary storage space to the address allocation unit, the message is marked. If the queue management unit receives an ENQ Res message from the address allocation unit for a message in the message temporary storage space, the message is queued, and the message leaves the message temporary storage space.

[0092] By traversing the temporary message storage space, it is possible to determine which messages in the temporary message storage space have not sent an ENQ message and which messages have sent an ENQ message but have not returned an ENQ Res message.

[0093] If ENQ messages have been sent for some messages in the message temporary storage space, but ENQ Res messages have not been returned, the ENQ Res messages of these messages are waited for to be fed back by the address allocation unit.

[0094] If there are some messages in the message temporary storage space for which ENQ messages have not been sent, then after the address allocation unit feeds back an ENQRes message, or after the number of messages for which ENQ messages have not been sent reaches a preset number, an ENQ message for the message is sent.

[0095] It should be noted that, in the process of message assembly, the identifiers of all assembled messages can be recorded, or the identifier of the first message and the identifier of the last message can be recorded. For example, if Packet1, Packet2, and Packet3 are assembled, the identifier of Packet1 is 1, the identifier of Packet2 is 2, and the identifier of Packet3 is 3, 1, 2, 3 can be recorded, or only 1 and 3 can be recorded.

[0096] By selecting the above embodiment, since the enqueue management unit performs a packing operation on the temporarily stored target messages when there are valid messages belonging to the target queue, and sends an ENQ message for all currently temporarily stored messages to the address allocation unit, the number of addresses requested for allocation carried in the ENQ message is the number of messages targeted by the ENQ message. Therefore, the address allocation unit can allocate addresses for all currently temporarily stored messages at one time, and for all currently temporarily stored messages, the address allocation unit will only return an ENQ Res message to the enqueue management unit once, thereby avoiding frequent message interactions between the enqueue management unit and the address allocation unit, thereby reducing the message processing delay.

[0097] In one possible embodiment, see Figure 2 , is a flow chart of a second message enqueue method provided by an embodiment of the present invention, which is similar to the aforementioned Figure 1 Compared with the embodiment shown, the above S102-S105 can be implemented through S201-S206.

[0098] S201, determining whether there is a valid identifier with a first value in the target queue.

[0099] If not, execute S202; if so, execute S203 or S204.

[0100] In S201, the valid identifier is included in the recorded mapping relationship of the corresponding target queue. Different mapping relationships correspond to different messages. The value of the valid identifier is a first value indicating that the ENQ Res message for the corresponding message has not been received, otherwise it indicates that the ENQ Res message for the corresponding message has been received.

[0101] The target queue does not have a valid identifier with a first value, indicating that the target queue does not have a message that has not received the ENQRes message. The target queue has a valid identifier with a first value, indicating that the target queue has a message that has not received the ENQ Res message.

[0102] Exemplarily, assuming that the valid identifier is represented by Valid, and the first value is 1, if the Valid value of Packet0 is 1, it means that the ENQ Res message for Packet0 has not been received, and the target queue has a valid identifier with the first value. On the contrary, if the Valid value of Packet0 is 0, it means that the ENQ Res message for Packet0 has been received, and the target queue does not have a valid identifier with the first value.

[0103] It should be noted that, in the embodiment of the present invention, the first value can be set to "1" and the non-first value can be set to "0", or the first value can be set to "0" and the non-first value can be set to "1", or the first value can be set to "a" and the non-first value can be set to "b". The embodiment of the present invention does not specifically limit the representation method of the first value.

[0104] S202: If it does not exist, send an enqueue request message for the target message to the address allocation unit once, and record the first mapping relationship corresponding to the target queue.

[0105] In S202, if the target queue does not have a valid identifier with the first value, it means that the messages belonging to the target queue have received the ENQ Res message for the message from the address allocation unit. Therefore, an ENQ message for the target message is directly sent to the address allocation unit once, and the first mapping relationship corresponding to the target queue is recorded.

[0106] The first mapping relationship is: a mapping relationship between a start identifier whose value is the identifier of the target message, a valid identifier whose value is the first value, a sending identifier whose value is the second value, and an ending identifier whose value is the identifier of the target message. If the sending identifier has the second value, it indicates that an ENQ message for the spliced ​​message has been sent to the address allocation unit. Otherwise, it indicates that an ENQ message for the spliced ​​message has not been sent to the address allocation unit. The spliced ​​message is: a message received between the message indicated by the start identifier and the message indicated by the ending identifier.

[0107] In a possible embodiment, the start identifier is represented by Tag, the valid identifier is represented by Valid, the send identifier is represented by Sent, the end identifier is represented by Last Tag, the first value is set to 1, and the second value is set to 1. Assuming that the target message is Packet0, and the target queue to which the target message belongs is QID0, after the enqueue management unit sends an ENQ message for Packet0 to the address allocation unit once, the first mapping relationship corresponding to the target queue is shown in Table 1.

[0108] See Table 1, which is a first mapping relationship table provided in an embodiment of the present invention.

[0109] Table 1

[0110]

[0111] In Table 1, the target message is Packet0, so the starting identifier Tag value of the target message is 0. The enqueue management unit has not received the ENQ Res message for Packet0 from the address allocation unit, so the Valid value is 1. The enqueue management unit has sent an ENQ message for Packet0 to the address allocation unit, so the Sent value is 1. The target queue to which the target message belongs is QID0, so the QID value is 0. The enqueue management unit sends an ENQ message for Packet0 to the address allocation unit once, and Packet0 is not assembled, so the Last Tag value is 0.

[0112] S203: If it exists, and there is no target sending identifier, then record the second mapping relationship corresponding to the target queue.

[0113] In S203, if the target queue has a valid identifier with the first value and there is no target sending identifier, it means that there are messages in the target queue that have not received the ENQ Res message, and the ENQ messages of the messages before the target queue have all been sent, and the target message begins to be assembled, then the second mapping relationship corresponding to the target queue is recorded.

[0114] The target sending identifier is: the sending identifier corresponding to the target queue is a non-second value. Exemplarily, if the sending identifier is represented by Sent, and the second value is set to 1, then the value corresponding to the target queue is a non-second value, which means Sent=0, indicating that the queue management unit has sent an ENQ message for the previous message in the target queue.

[0115] Exemplarily, still taking Table 1 as an example, if the enqueue management unit has sent an ENQ message for Packet0 to the address allocation unit, but has not received an ENQ Res message for Packet0 from the address allocation unit, at this time, the enqueue management unit receives the target message Packet1. Since Valid=1 exists in Table 1 and Sent=0 does not exist, it means that Packet1 starts to assemble packets, and the second mapping relationship corresponding to the target queue is recorded.

[0116] The second mapping relationship is a mapping relationship between a start identifier whose value is the identifier of the target message, a valid identifier whose value is the first value, a sending identifier whose value is not the second value, and an end identifier whose value is the identifier of the target message.

[0117] In a possible embodiment, the start identifier is represented by Tag, the valid identifier is represented by Valid, the sending identifier is represented by Sent, the end identifier is represented by Last Tag, the first value is set to 1, the second value is set to 1, assuming that the target message is Packet1, and the target queue to which the target message belongs is QID0, the second mapping relationship is shown in Table 2.

[0118] See Table 2, which is a second mapping relationship table provided in an embodiment of the present invention.

[0119] Table 2

[0120]

[0121] In Table 2, the value corresponding to Packet0 is the same as that in Table 1, and is not repeated here. The value corresponding to Packet1 is determined in the following manner.

[0122] If the target message is Packet1, the starting tag value of the target message is 1. If the enqueue management unit does not receive the ENQ Res message for Packet1 from the address allocation unit, the Valid value is 1. If the enqueue management unit does not send the ENQ message for Packet1 to the address allocation unit, the Sent value is 0. The target queue to which the target message belongs is QID0, and the QID value is 0. Since the address allocation unit does not feedback the ENQ Res for Packet0, Packet1 is temporarily stored. At this time, the only message to be assembled is Packet1, and the Last Tag value is 1.

[0123] S204, if it exists and there is a target sending identifier, then the termination identifier in the mapping relationship containing the target sending identifier is updated to the identifier of the target message. If the number of assembled messages after the update reaches the preset number of messages, then an enqueue request message for the assembled message corresponding to the mapping relationship is sent to the address allocation unit once to request the address allocation unit to allocate a preset number of addresses for the assembled message, and update the value of the sending identifier in the mapping relationship corresponding to the assembled message to the second value.

[0124] In S204, if the target queue has a valid identifier whose value is the first value, and there is a target sending identifier, it means that there is a message in the target queue that has not received the ENQ Res message, and there is an ENQ message of the message belonging to the target queue that has not been sent, and the target message can be packaged with the message belonging to the target queue that has not sent the ENQ message, then the termination identifier in the mapping relationship containing the target sending identifier is updated to the identifier of the target message.

[0125] Exemplarily, still taking Table 2 as an example, if the enqueue management unit has sent an ENQ message for Packet0 to the address allocation unit, but has not received an ENQ Res message for Packet0 from the address allocation unit, and the enqueue management unit has not sent an ENQ message for Packet1 to the address allocation unit, at this time, the enqueue management unit receives the target message Pcket2. Since Valid=1 exists in Table 2, and Sent=0 corresponding to Tag1 in Table 2, it means that Packet2 can be combined with Packet1. Then the termination identifier in the mapping relationship containing the target sending identifier is updated to the identifier of Packet2. The update result is shown in Table 3.

[0126] See Table 3, which is a third mapping relationship table provided in an embodiment of the present invention.

[0127] Table 3

[0128]

[0129] Since the enqueue management unit has sent an ENQ message for Packet0 to the address allocation unit, but has not received an ENQ Res message for Packet0 from the address allocation unit, Packet1 and Packet2 are combined. Therefore, the termination identifier is the identifier of Packet2, that is, the value of Last Tag is updated from 1 to 2, and the other values ​​are the same as those in Table 2.

[0130] If the number of updated assembled messages reaches the preset number of messages, an ENQ message for the assembled message corresponding to the mapping relationship is sent to the address allocation unit to request the address allocation unit to allocate the preset number of addresses for the assembled message, and update the value of the sending identifier in the mapping relationship corresponding to the assembled message to the second value.

[0131] Exemplarily, assuming that the preset number is 16, if the number of spliced ​​messages after the update reaches 16, an ENQ message for the spliced ​​message corresponding to the mapping relationship is sent to the address allocation unit to request the address allocation unit to allocate 16 addresses for the spliced ​​message, and update the value of the sending identifier in the mapping relationship corresponding to the spliced ​​message to the second value.

[0132] See Table 4, which is a fourth mapping relationship table provided in an embodiment of the present invention.

[0133] Table 4

[0134]

[0135] Assume that the enqueue management unit has sent an ENQ message for Packet0 to the address allocation unit and has not received an ENQ Res message for Packet0 from the address allocation unit, but the Last Tag is 16, indicating that the number of updated splicing messages reaches 16. At this time, the enqueue management unit sends an ENQ message for the splicing message corresponding to the mapping relationship to the address allocation unit to request the address allocation unit to allocate 16 addresses for the splicing message.

[0136] After the enqueue management unit sends an ENQ message for the assembled message corresponding to the mapping relationship to the address allocation unit, the value of the sending identifier in the mapping relationship corresponding to the assembled message is updated to the second value. Therefore, the value of Sent corresponding to Tag1 in Table 4 is updated from 0 to 1.

[0137] S205, if an enqueue request response message for the target queue is received, the value of the valid identifier corresponding to the message targeted by the enqueue request response message is updated to a non-first value, and if a third mapping relationship exists, an enqueue request message for the assembled message corresponding to the third mapping relationship is sent.

[0138] In S205, if the enqueue management unit receives an ENQ Res message for the target queue, the value of the valid identifier corresponding to the message targeted by the ENQ Res message is updated to a non-first value, indicating that the address allocation unit has allocated an address for the message targeted by the ENQ Res message, and the message targeted by the ENQ Res message can be subsequently enqueued according to the address allocated by the address allocation unit.

[0139] Exemplarily, if the enqueue management unit receives an ENQ Res message for Packet0, the value of the valid identifier corresponding to Packet0 is updated to a non-first value.

[0140] See Table 5, which is a fifth mapping relationship table provided in an embodiment of the present invention.

[0141] Table 5

[0142]

[0143] In Table 5, since the enqueue management unit receives the ENQ Res message for Packet0, the value of Valid corresponding to Packet0 is updated from 1 to 0. Compared with Table 3, in Table 5, the value of Valid corresponding to Tag0 is updated from 1 to 0, and the values ​​of other data in Table 5 remain unchanged.

[0144] After the enqueue management unit receives the ENQ Res message for the target queue, if the third mapping relationship exists, it means that there is a message belonging to the target queue for which the ENQ message has not been sent. At this time, the ENQ message for the assembled message corresponding to the third mapping relationship is sent.

[0145] The value of the valid identifier included in the third mapping relationship is the first value, and the value of the sending identifier included is not the second value.

[0146] Exemplarily, taking Table 5 as an example, after the enqueue management unit receives the ENQ Res message for Packet0, the value of the valid identifier corresponding to Packet1 and Packet2 is the first value, that is, Valid = 1, and the value of the sending identifier corresponding to Packet1 and Packet2 is not the second value, that is, Sent = 0, then the ENQ message for Packet1 and Packet2 is sent.

[0147] It should be noted that after the queue management unit sends the ENQ message for Packet1 and Packet2, the values ​​of the sending identifiers corresponding to Packet1 and Packet2 are updated to the second value, that is, Sent=0 corresponding to Tag1 in Table 5 is updated to Sent=1.

[0148] Moreover, after receiving the ENQ Res messages for Packet1 and Packet2, the enqueue management unit updates the values ​​of the valid identifiers corresponding to Packet1 and Packet2 to non-first values, that is, updates Valid=1 corresponding to Tag1 in Table 5 to Valid=0.

[0149] S206: Enqueue a message corresponding to the enqueue request response message based on the address included in the received enqueue request response message.

[0150] In S206, if the ENQ Res message received by the enqueue management unit includes N addresses, N messages corresponding to the ENQ Res message are enqueued, wherein the value of N is the same as the number of messages targeted by the ENQ message.

[0151] Exemplarily, if the ENQ Res message received by the enqueue management unit includes one address, one message corresponding to the ENQ Res message is enqueued. If the ENQ Res message received by the enqueue management unit includes three addresses, three messages corresponding to the ENQ Res message are enqueued.

[0152] The above embodiment is selected to implement the management of ENQ message sending by using a valid identifier, a sending identifier, a start identifier and an end identifier. When there is a valid identifier with a first value in the target queue, the target message is assembled, and the mapping relationship corresponding to the target queue is recorded, and an ENQ message for the assembled message corresponding to the mapping relationship is sent to the address allocation unit once to request the address allocation unit to allocate a preset number of addresses for the assembled message. Therefore, the address allocation unit can allocate addresses for all assembled messages at one time, and for all assembled messages, the address allocation unit will only return an ENQ Res message to the queue management unit once, avoiding frequent message interactions between the queue management unit and the address allocation unit, thereby reducing the message processing delay.

[0153] In one possible embodiment, see Figure 3 , which is a flow chart of a third message enqueueing method provided in an embodiment of the present invention, and is applied to an enqueueing management unit in a network chip. The method includes S301-S307.

[0154] S301, receiving a target message or an enqueue request response message.

[0155] If the target message is received, S302 is executed. If the queue request response message is received, S307 is executed.

[0156] The enqueue request response message is an enqueue request response message for the target queue.

[0157] The enqueue management unit may receive the target message and the enqueue request response message successively, or may receive the target message and the enqueue request response message simultaneously. If the enqueue management unit receives the ENQ Res message and the target message for the target queue simultaneously, the ENQ Res message and the target message are randomly selected, that is, one of them is randomly selected for processing.

[0158] S302, determining whether there is a valid message belonging to the target queue, and determining whether the queue entry request message of the previous message belonging to the target queue has been sent.

[0159] If there is a valid message belonging to the target queue, and the ENQ message of the previous message belonging to the target queue has been sent, S303 is executed.

[0160] If there is a valid message belonging to the target queue, and the ENQ message of the previous message belonging to the target queue has not been sent, S304 is executed.

[0161] If there is no valid message belonging to the target queue, it means that the messages belonging to the target queue have received the ENQ Res message for the message from the address allocation unit, and then S306 is executed.

[0162] S303, temporarily storing the target message and starting to assemble the target message.

[0163] S304, determining whether the number of temporarily stored messages reaches a preset number of messages.

[0164] If the number of temporarily stored messages reaches the preset number of messages, S306 is executed. If the number of temporarily stored messages does not reach the preset number of messages, S305 is executed.

[0165] S305, temporarily storing the target message and waiting for the target message to be assembled.

[0166] S306: Send an enqueue request message for all messages currently temporarily stored to the address allocation unit, so that the address allocation unit feeds back the number of addresses requested to be allocated by the enqueue request message.

[0167] If the number of all messages currently temporarily stored is 1, the address allocation unit feeds back 1 address. If the number of all messages currently temporarily stored is N, the address allocation unit feeds back N addresses, where N is an integer greater than 1 and less than or equal to the preset number of messages.

[0168] S307, determining whether there is a valid message belonging to the target queue.

[0169] If there is no valid message belonging to the target queue after receiving the ENQ Res message for the target queue, no processing is performed.

[0170] If after receiving the ENQ Res message for the target queue, there is a valid message belonging to the target queue and no ENQ message for the valid message is sent, S306 is executed. Wherein, when the number of valid messages is greater than 1, the process can be understood as packet splicing, and after the valid message is spliced, an ENQ message for the spliced ​​message is sent.

[0171] In a possible embodiment, the above-mentioned message enqueueing method also includes step A.

[0172] Step A: after sending the ENQ message corresponding to the message, record the identifier of the message.

[0173] The identifier of the message can be represented by a Tag. For example, if the Tag value is 0, it represents Packet 0, and if the Tag value is 1, it represents Packet 1. After sending the ENQ message corresponding to Packet 1, the enqueue management unit records the Tag of Packet 1.

[0174] By selecting the above embodiment, after sending the ENQ message corresponding to the message, the identifier of the message is recorded, so that when an abnormality occurs in the message queue, the message with abnormal entry and exit can be determined in time, thereby improving the detection efficiency of the abnormality of the message queue.

[0175] In a possible embodiment, the message data of the assembled message is stored in data_ram (Data Random Access Memory), and the message descriptor information of the assembled message is stored in pd_ram (Peripheral Dynamic Random Access Memory).

[0176] After the message is assembled, the message descriptor information in pd_ram will be updated. And after the message is dequeued, the message data of the assembled message can be read from data_ram, the message descriptor information of the assembled message can be read from pd_ram, and the assembled message can be unpacked according to the assembly mark in the message descriptor information, and then the message can be dequeued.

[0177] In one possible embodiment, see Figure 4 , is a structural diagram of an enqueue management unit provided in an embodiment of the present invention.

[0178] The input signal of the queue management unit includes a queue identification number QID, a valid identification Valid, and a sending identification Sent.

[0179] The output signal includes a first identifier, a second identifier and a third identifier.

[0180] The first flag is QID Exit (Queue Identifier Exit), which means that the QID exists in the mapping table and Valid is valid.

[0181] The second flag is QID Exit and no Sent (Queue Identifier Exit and no Sent, the queue identifier exists, and Sent is invalid), which means that QID exists in the mapping table, Valid is valid, but Sent is invalid.

[0182] The third identifier is Search tag, which indicates the tag number corresponding to the valid QID.

[0183] In one possible embodiment, see Figure 5 , which is a schematic diagram of the change of a termination mark provided in an embodiment of the present invention.

[0184] Among them, the starting identifier of the first message is 3, the queue identifier is 2, the starting identifier of the second message is 5, the queue identifier is 2, the starting identifier of the third message is 8, and the queue identifier is 2. Then in the queue request table entry, the value of the end identifier is updated from 3 to 5, and then to 8.

[0185] In the queue request response table entry, the start identifier 3 corresponds to the end identifier 5, and the start identifier 5 corresponds to the end identifier 8. "×" indicates that there is no corresponding end identifier for the start identifier 8. The data in the queue request response table entry is used in the unpacking process.

[0186] It should be noted that in order to more clearly describe the change process of the termination mark, Figure 5 The data of the first message, the second message and the third message are three lines of data, but in fact the data of the first message, the second message and the third message are one line of data, and only the starting mark is changed.

[0187] The embodiment of the present invention also provides a message queueing method, which is applied to the address allocation unit in the network chip, see Figure 6 , which is a flow chart of a fourth message enqueueing method provided in an embodiment of the present invention, wherein the method includes S601-S603.

[0188] S601, receiving an enqueue request message carrying the number of addresses requested for allocation, sent by an enqueue management unit.

[0189] In S601, the number of addresses requested for allocation in the ENQ message may be one or more.

[0190] If there is no valid message belonging to the target queue, it means that the messages belonging to the target queue have received the ENQ Res message for the message from the address allocation unit. At this time, the number of addresses requested for allocation in the ENQ message can be one, that is, the address allocation unit only allocates addresses for the target message.

[0191] If there is a valid message belonging to the target queue, it means that there is a message belonging to the target queue that has not received the ENQ Res message for the message from the address allocation unit. When the address allocation unit feeds back an ENQ Res message, or the number of temporarily stored messages reaches a preset number, an ENQ message for all currently temporarily stored messages is sent to the address allocation unit. At this time, the number of addresses requested for allocation in the ENQ message is N, where N is an integer greater than 1 and less than or equal to the preset number of messages.

[0192] S602, allocate address quantity addresses to the message.

[0193] In S602, the number of addresses allocated by the address allocation unit is related to the number of messages targeted by the ENQ message. For example, if the enqueue management unit sends an ENQ message for 16 messages currently stored to the address allocation unit, the address allocation unit allocates 16 addresses. If the enqueue management unit sends an ENQ message for 3 messages currently stored to the address allocation unit, the address allocation unit allocates 3 addresses.

[0194] S603: Send an enqueue request response message including the allocated address to the enqueue management unit, so that the enqueue management unit enqueues the message based on the address included in the enqueue request response message.

[0195] In S603, since the ENQ Res message carries the address assigned to the message by the address allocation unit, the queue management unit queues the message based on the address carried in the ENQ Res message.

[0196] By selecting the above embodiment, when the address allocation unit in the network chip receives the ENQ message sent by the enqueue management unit, it can allocate addresses to the message at one time according to the number of addresses requested for allocation carried in the ENQ message, and send an ENQ Res message containing the allocated addresses to the enqueue management unit, so that the enqueue management unit enqueues the message based on the address contained in the ENQ Res message.

[0197] Since when there are multiple temporarily stored messages, the address allocation unit can allocate addresses for multiple temporarily stored messages at one time, and the address allocation unit will only return an ENQ Res message to the enqueue management unit once, avoiding frequent message interactions between the enqueue management unit and the address allocation unit, thereby reducing the message processing delay.

[0198] Corresponding to the aforementioned message enqueue method, the embodiment of the present invention further provides a message enqueue device, which is applied to an enqueue management unit in a network chip, see Figure 7 , is a structural diagram of a first message enqueue device provided by an embodiment of the present invention, the device comprising:

[0199] The queue determination module 701 is used to determine the target queue to which the target message belongs when receiving the target message;

[0200] The message determination module 702 is used to determine whether there is a valid message belonging to the target queue; wherein a valid message is a message for which no ENQ Res message of the address allocation unit has been received in response to the queue request of the message;

[0201] The first sending module 703 is used to send an enqueue request ENQ message for the target message to the address allocation unit if it does not exist, so that the address allocation unit feeds back the number of addresses requested to be allocated by the ENQ message, and the number of addresses requested to be allocated carried in the ENQ message is: the number of messages targeted by the ENQ message;

[0202] The second sending module 704 is used to temporarily store the target message if it exists, and when the address allocation unit feeds back an ENQ Res message, or the number of temporarily stored messages reaches a preset number, send an ENQ message for all currently temporarily stored messages to the address allocation unit, so that the address allocation unit feeds back the number of addresses requested to be allocated by the ENQ message;

[0203] The message enqueuing module 705 is configured to enqueue a target message based on the address carried in the ENQRes message after receiving the ENQ Res message fed back by the address allocation unit.

[0204] By selecting the above embodiment, since the enqueue management unit performs a packing operation on the temporarily stored target messages when there are valid messages belonging to the target queue, and sends an ENQ message for all currently temporarily stored messages to the address allocation unit, the number of addresses requested for allocation carried in the ENQ message is the number of messages targeted by the ENQ message. Therefore, the address allocation unit can allocate addresses for all currently temporarily stored messages at one time, and for all currently temporarily stored messages, the address allocation unit will only return an ENQ Res message to the enqueue management unit once, thereby avoiding frequent message interactions between the enqueue management unit and the address allocation unit, thereby reducing the message processing delay.

[0205] In a possible embodiment, the message determination module 702, the first sending module 703, the second sending module 704, and the message queue module 705 are specifically used to:

[0206] Determine whether there is a valid identifier with a first value in the target queue; wherein the valid identifier is included in the recorded mapping relationship of the corresponding target queue, different mapping relationships correspond to different messages, and the value of the valid identifier is the first value, indicating that: an ENQ Res message for the corresponding message has not been received, otherwise, it indicates that an ENQ Res message for the corresponding message has been received;

[0207] If it does not exist, an ENQ message for the target message is sent to the address allocation unit once, and the first mapping relationship corresponding to the target queue is recorded; wherein the first mapping relationship is: a mapping relationship between a start identifier whose value is the identifier of the target message, a valid identifier whose value is the first value, a sending identifier whose value is the second value, and an ending identifier whose value is the identifier of the target message, and the sending identifier whose value is the second value indicates that an ENQ message for the assembled message has been sent to the address allocation unit, otherwise, it indicates that an ENQ message for the assembled message has not been sent to the address allocation unit, and the assembled message is: a message received between the message indicated by the start identifier and the message indicated by the ending identifier;

[0208] If it exists, and the target sending identifier does not exist, then record the second mapping relationship corresponding to the target queue; wherein the second mapping relationship is a mapping relationship between the start identifier whose value is the identifier of the target message, the valid identifier whose value is the first value, the sending identifier whose value is not the second value, and the ending identifier whose value is the identifier of the target message, and the target sending identifier is: the sending identifier whose value corresponds to the target queue is not the second value;

[0209] If it exists, and there is a target sending identifier, then the termination identifier in the mapping relationship including the target sending identifier is updated to the identifier of the target message, and if the number of the assembled messages after the update reaches the preset number of messages, an ENQ message for the assembled message corresponding to the mapping relationship is sent to the address allocation unit once to request the address allocation unit to allocate a preset number of addresses for the assembled message, and the value of the sending identifier in the mapping relationship corresponding to the assembled message is updated to the second value;

[0210] If an ENQ Res message for the target queue is received, the value of the valid identifier corresponding to the message targeted by the ENQ Res message is updated to a non-first value, and if a third mapping relationship exists, an ENQ message for the assembled message corresponding to the third mapping relationship is sent; wherein the value of the valid identifier contained in the third mapping relationship is the first value, and the value of the sending identifier contained is not the second value;

[0211] Based on the address contained in the received ENQ Res message, the message corresponding to the ENQ Res message is queued.

[0212] The above embodiment is selected to implement the management of ENQ message sending by using a valid identifier, a sending identifier, a start identifier and an end identifier. When there is a valid identifier with a first value in the target queue, the target message is assembled, and the mapping relationship corresponding to the target queue is recorded, and an ENQ message for the assembled message corresponding to the mapping relationship is sent to the address allocation unit once to request the address allocation unit to allocate a preset number of addresses for the assembled message. Therefore, the address allocation unit can allocate addresses for all assembled messages at one time, and for all assembled messages, the address allocation unit will only return an ENQ Res message to the queue management unit once, avoiding frequent message interactions between the queue management unit and the address allocation unit, thereby reducing the message processing delay.

[0213] In a possible embodiment, the above device further includes:

[0214] The identification recording module is used to record the identification of the message after sending the ENQ message corresponding to the message.

[0215] By selecting the above embodiment, after sending the ENQ message corresponding to the message, the identifier of the message is recorded, so that when an abnormality occurs in the message queue, the message with abnormal entry and exit can be determined in time, thereby improving the detection efficiency of the abnormality of the message queue.

[0216] In a possible embodiment, the length of the target message is not less than a preset message length.

[0217] By selecting the above embodiment, the length of the target message is not less than the preset message length, and the messages entering the network chip can be screened, and the messages with too small length can be discarded or not processed, thereby preventing the messages with too small length from entering the network chip.

[0218] Corresponding to the aforementioned message enqueue method, an embodiment of the present invention further provides a message enqueue device, which is applied to an address allocation unit in a network chip, see Figure 8 , is a structural diagram of a second message enqueue device provided by an embodiment of the present invention, the device comprising:

[0219] The message receiving module 801 is used to receive an enqueue request ENQ message carrying the number of addresses requested for allocation, sent by the enqueue management unit;

[0220] An address allocation module 802 is used to allocate address quantity addresses to the message;

[0221] The third sending module 803 is used to send an enqueue request response ENQ Res message containing the allocated address to the enqueue management unit, so that the enqueue management unit enqueues the message based on the address contained in the ENQ Res message.

[0222] By selecting the above embodiment, when the address allocation unit in the network chip receives the ENQ message sent by the enqueue management unit, it can allocate addresses to the message at one time according to the number of addresses requested for allocation carried in the ENQ message, and send an ENQ Res message containing the allocated addresses to the enqueue management unit, so that the enqueue management unit enqueues the message based on the address contained in the ENQ Res message.

[0223] Since when there are multiple temporarily stored messages, the address allocation unit can allocate addresses for multiple temporarily stored messages at one time, and the address allocation unit will only return an ENQ Res message to the enqueue management unit once, avoiding frequent message interactions between the enqueue management unit and the address allocation unit, thereby reducing the message processing delay.

[0224] An embodiment of the present invention further provides a network chip, wherein an enqueue management unit in the network chip is used to implement the steps described in any message enqueue method applied to the enqueue management unit.

[0225] By selecting the above embodiment, since the enqueue management unit performs a packing operation on the temporarily stored target messages when there are valid messages belonging to the target queue, and sends an ENQ message for all currently temporarily stored messages to the address allocation unit, the number of addresses requested for allocation carried in the ENQ message is the number of messages targeted by the ENQ message. Therefore, the address allocation unit can allocate addresses for all currently temporarily stored messages at one time, and for all currently temporarily stored messages, the address allocation unit will only return an ENQ Res message to the enqueue management unit once, thereby avoiding frequent message interactions between the enqueue management unit and the address allocation unit, thereby reducing the message processing delay.

[0226] An embodiment of the present invention further provides a network chip, in which an address allocation unit is used to implement the steps described in any message enqueueing method applied to the address allocation unit.

[0227] By selecting the above embodiment, when the address allocation unit in the network chip receives the ENQ message sent by the enqueue management unit, it can allocate addresses to the message at one time according to the number of addresses requested for allocation carried in the ENQ message, and send an ENQ Res message containing the allocated addresses to the enqueue management unit, so that the enqueue management unit enqueues the message based on the address contained in the ENQ Res message.

[0228] Since when there are multiple temporarily stored messages, the address allocation unit can allocate addresses for multiple temporarily stored messages at one time, and the address allocation unit will only return an ENQ Res message to the enqueue management unit once, avoiding frequent message interactions between the enqueue management unit and the address allocation unit, thereby reducing the message processing delay.

[0229] In another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned message enqueuing methods are implemented.

[0230] By selecting the above embodiment, since the enqueue management unit performs a packing operation on the temporarily stored target messages when there are valid messages belonging to the target queue, and sends an ENQ message for all currently temporarily stored messages to the address allocation unit, the number of addresses requested for allocation carried in the ENQ message is the number of messages targeted by the ENQ message. Therefore, the address allocation unit can allocate addresses for all currently temporarily stored messages at one time, and for all currently temporarily stored messages, the address allocation unit will only return an ENQ Res message to the enqueue management unit once, thereby avoiding frequent message interactions between the enqueue management unit and the address allocation unit, thereby reducing the message processing delay.

[0231] In another embodiment of the present invention, a computer program product including instructions is provided, which, when executed on a computer, enables the computer to execute any one of the message enqueueing methods in the above embodiments.

[0232] By selecting the above embodiment, since the enqueue management unit performs a packing operation on the temporarily stored target messages when there are valid messages belonging to the target queue, and sends an ENQ message for all currently temporarily stored messages to the address allocation unit, the number of addresses requested for allocation carried in the ENQ message is the number of messages targeted by the ENQ message. Therefore, the address allocation unit can allocate addresses for all currently temporarily stored messages at one time, and for all currently temporarily stored messages, the address allocation unit will only return an ENQ Res message to the enqueue management unit once, thereby avoiding frequent message interactions between the enqueue management unit and the address allocation unit, thereby reducing the message processing delay.

[0233] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.

[0234] It should be noted that, in this article, relational terms such as first and second, etc. are only used 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.

[0235] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, network chip, and storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0236] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A message enqueue method, characterized in that: Applied to an enqueue management unit in a network chip, the method comprises: When receiving a target message, determining a target queue to which the target message belongs; Determine whether there is a valid message belonging to the target queue; wherein the valid message is: a message for which no ENQ Res message of the address allocation unit in response to the queue request for the message is received; If not present, an enqueue request ENQ message for the target message is sent to the address allocation unit, so that the address allocation unit feeds back the number of addresses requested to be allocated by the ENQ message; wherein the number of addresses requested to be allocated carried in the ENQ message is: the number of messages targeted by the ENQ message, and the number of messages targeted by the ENQ message is 1 or more; If so, temporarily store the target message, and when the address allocation unit feeds back an ENQ Res message, or the number of temporarily stored messages reaches a preset number, send an ENQ message for all currently temporarily stored messages to the address allocation unit, so that the address allocation unit feeds back the number of addresses requested to be allocated by the ENQ message; After receiving the ENQ Res message fed back by the address allocation unit, the target message is queued based on the address carried in the ENQ Res message.

2. The method according to claim 1, characterized in that: The determining whether there is a valid message belonging to the target queue includes: Determine whether the target queue has a valid identifier whose value is the first value; wherein the valid identifier is included in the recorded mapping relationship of the corresponding target queue, different mapping relationships correspond to different messages, and the value of the valid identifier is the first value, indicating that: no ENQ Res message for the corresponding message has been received.

3. The method according to claim 1, characterized in that If it does not exist, sending an enqueue request ENQ message for the target message to the address allocation unit, so that the address allocation unit feeds back the number of addresses requested to be allocated by the ENQ message, including: If not, sending an ENQ message for the target message to the address allocation unit once, and recording the first mapping relationship corresponding to the target queue; Among them, the first mapping relationship is: a mapping relationship between a start identifier whose value is the identifier of the target message, a valid identifier whose value is the first value, a sending identifier whose value is the second value, and an ending identifier whose value is the identifier of the target message. The sending identifier whose value is the second value indicates that an ENQ message for the spliced ​​message has been sent to the address allocation unit, and the spliced ​​message is: a message received between the message indicated by the start identifier and the message indicated by the ending identifier.

4. The method according to claim 1, characterized in that: If the target message exists, temporarily storing the target message, and when the address allocation unit feeds back an ENQ Res message, or the number of temporarily stored messages reaches a preset number, sending an ENQ message for all currently temporarily stored messages to the address allocation unit, so that the address allocation unit feeds back the number of addresses requested to be allocated by the ENQ message, including: If it exists, and the target sending identifier does not exist, then record the second mapping relationship corresponding to the target queue; wherein the second mapping relationship is a mapping relationship between a start identifier whose value is the identifier of the target message, a valid identifier whose value is the first value, a sending identifier whose value is not the second value, and an ending identifier whose value is the identifier of the target message, and the target sending identifier is: a sending identifier corresponding to the target queue whose value is not the second value; If it exists and the target sending identifier exists, the termination identifier in the mapping relationship containing the target sending identifier is updated to the identifier of the target message. If the number of spliced ​​messages after the update reaches the preset number of messages, an ENQ message for the spliced ​​message corresponding to the mapping relationship is sent to the address allocation unit once to request the address allocation unit to allocate the preset number of addresses to the spliced ​​message, and update the value of the sending identifier in the mapping relationship corresponding to the spliced ​​message to the second value.

5. The method according to claim 3 or 4, characterized in that: The method further comprises: If an ENQ Res message for the target queue is received, the value of the valid identifier corresponding to the message targeted by the ENQ Res message is updated to a non-first value, and if a third mapping relationship exists, an ENQ message for the assembled message corresponding to the third mapping relationship is sent; The value of the valid identifier included in the third mapping relationship is the first value, and the value of the sending identifier included is not the second value.

6. The method according to claim 1, characterized in that After receiving the ENQ Res message fed back by the address allocation unit, the target message is queued based on the address carried in the ENQ Res message, including: Based on the address contained in the received ENQ Res message, the message corresponding to the ENQ Res message is queued.

7. The method according to claim 1, characterized in that The method further comprises: After sending the ENQ message corresponding to the message, the identifier of the message is recorded.

8. The method according to any one of claims 1 to 7, characterized in that The length of the target message is not less than the preset message length.

9. A message enqueue method, characterized in that: Applied to an address allocation unit in a network chip, the method comprises: Receive an enqueue request ENQ message sent by an enqueue management unit and carrying the number of addresses requested for allocation; Allocating the number of addresses to the message; Sending an enqueue request response ENQ Res message including the allocated address to the enqueue management unit, so that the enqueue management unit enqueues the message based on the address included in the ENQ Res message; The receiving ENQ message sent by the queuing management unit and carrying the number of addresses requested for allocation includes: When the enqueue management unit receives the target message, determines the target queue to which the target message belongs, and determines that there is no valid message belonging to the target queue, receives an enqueue request ENQ message for the target message sent by the enqueue management unit; wherein the valid message is: a message for which the enqueue request response ENQ Res message of the address allocation unit for the message is not received; the number of addresses requested for allocation carried in the ENQ message is: the number of messages targeted by the ENQ message, and the number of messages targeted by the ENQ message is 1 or more; When the enqueue management unit receives the target message, determines the target queue to which the target message belongs, and determines that there is a valid message belonging to the target queue, the enqueue management unit receives an ENQ message for all currently stored messages sent after the address allocation unit feeds back an ENQRes message, or the number of temporarily stored messages reaches a preset number.

10. A message enqueue device, characterized in that: An enqueue management unit applied to a network chip, the device comprising: A queue determination module, configured to determine, when receiving a target message, a target queue to which the target message belongs; A message judging module, used for judging whether there is a valid message belonging to the target queue; wherein the valid message is: a message for which no ENQ Res message of the address allocation unit for the message's queue entry request response is received; A first sending module is used for sending an enqueue request ENQ message for the target message to the address allocation unit if it does not exist, so that the address allocation unit feeds back the number of addresses requested to be allocated by the ENQ message, the number of addresses requested to be allocated carried in the ENQ message is: the number of messages targeted by the ENQ message, and the number of messages targeted by the ENQ message is 1 or more; a second sending module, configured to temporarily store the target message if it exists, and send an ENQ message for all messages currently temporarily stored to the address allocation unit when the address allocation unit feeds back an ENQ Res message or the number of temporarily stored messages reaches a preset number, so that the address allocation unit feeds back the number of addresses requested to be allocated by the ENQ message; The message enqueuing module is used to enqueue the target message based on the address carried in the ENQRes message after receiving the ENQ Res message fed back by the address allocation unit.

11. A message enqueue device, characterized in that: An address allocation unit applied to a network chip, the device comprising: A message receiving module, used for receiving an enqueue request ENQ message carrying the number of addresses requested for allocation, sent by an enqueue management unit; An address allocation module, used for allocating the number of addresses to the message; A third sending module, configured to send an enqueue request response ENQRes message containing the allocated address to the enqueue management unit, so that the enqueue management unit enqueues the message based on the address contained in the ENQ Res message; The message receiving module is specifically used for: When the enqueue management unit receives the target message, determines the target queue to which the target message belongs, and determines that there is no valid message belonging to the target queue, receives an enqueue request ENQ message for the target message sent by the enqueue management unit; wherein the valid message is: a message for which the enqueue request response ENQ Res message of the address allocation unit for the message is not received; the number of addresses requested for allocation carried in the ENQ message is: the number of messages targeted by the ENQ message, and the number of messages targeted by the ENQ message is 1 or more; When the enqueue management unit receives the target message, determines the target queue to which the target message belongs, and determines that there is a valid message belonging to the target queue, the enqueue management unit receives an ENQ message for all currently stored messages sent after the address allocation unit feeds back an ENQRes message, or the number of temporarily stored messages reaches a preset number.

12. A network chip, characterized in that: The queue management unit in the network chip is used to implement the method steps described in any one of claims 1-8.

13. A network chip, characterized in that: The address allocation unit in the network chip is used to implement the method steps described in claim 9.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps of any one of claims 1-8 or 9 are implemented.