WO2021209016A1 - Method for processing message in network device, and related device - Google Patents

Method for processing message in network device, and related device Download PDF

Info

Publication number
WO2021209016A1
WO2021209016A1 PCT/CN2021/087575 CN2021087575W WO2021209016A1 WO 2021209016 A1 WO2021209016 A1 WO 2021209016A1 CN 2021087575 W CN2021087575 W CN 2021087575W WO 2021209016 A1 WO2021209016 A1 WO 2021209016A1
Authority
WO
WIPO (PCT)
Prior art keywords
cache
entity
message
space
policy management
Prior art date
Application number
PCT/CN2021/087575
Other languages
French (fr)
Chinese (zh)
Inventor
张镇星
李楠
黄超
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2021209016A1 publication Critical patent/WO2021209016A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/30Flow control; Congestion control in combination with information about buffer occupancy at either end or at transit nodes

Definitions

  • This application relates to the field of information technology, and more specifically, to a method for processing packets in network equipment and related equipment.
  • some network devices adopt the following strategy: if it is determined that the egress port of the network device is congested, the upstream device is requested to stop sending packets sent through the egress port. However, it takes a certain time for the network device to send a notification to the upstream device, and it may also take a certain time for the upstream device to respond to the notification. During this period of time, the upstream device will continue to send packets to the network device. In order to avoid the occurrence of congestion, the buffer set in the network device can be used to buffer the packets received from the upstream device within this period of time.
  • the upstream device may not normally respond to the request sent by the network device and continue to send packets to the network device. At this time, the network device may not be able to buffer the newly received message.
  • network devices usually manage the cache space according to pre-configured rules. But if an error occurs in the pre-configured rules, an abnormal situation may also occur in the cache space.
  • the present application provides a method for processing messages in a network device and related devices, which can reduce the problem of cache space.
  • an embodiment of the present application provides a method for processing a message in a network device.
  • the network device includes a policy management entity, a cache entity, and a message processing entity.
  • the method includes: the policy management entity obtains first cache status information , The first cache state information indicates the first state of the cache entity at the first moment; the policy management entity determines a first packet processing strategy according to the first cache state information, and sends the first packet processing strategy To the message processing entity; the message processing entity processes the newly received message according to the first message processing strategy.
  • the message processing entity may execute a corresponding message processing strategy according to the state of the cache entity to process the newly received message. In this way, the cache entity can be better managed to reduce the occurrence of cache management exceptions in the cache entity.
  • the method further includes: the policy management entity obtains at least one of the following information of the cache entity at the first moment: the length of the sending queue, the The buffer occupancy of the sending queue, the delay of the sending queue, the available capacity of the buffer entity, the used capacity of the buffer entity, the rate of the outgoing port of the buffer entity; the policy management entity obtains the at least one kind of information according to , Determine the first cache status information.
  • the method further includes: the cache entity determining the first cache state information; the policy management entity obtaining the first cache state information includes: the policy management entity obtains the first cache state from the cache entity information.
  • that the policy management entity obtains the first cache state information from the cache entity includes: the policy management entity receives the first cache state information sent by the cache entity.
  • the cache entity may send the cache status information to the policy management entity by itself. This can reduce the workload of the policy management entity.
  • the method before the cache entity sends the first cache state information to the policy management entity, the method further includes: the cache entity determines that the first state satisfies a first preset condition.
  • the cache entity sends the cache state information to the policy management entity only when the state meets the preset condition, which can reduce the occupation of the outbound interface of the cache entity and can reduce the workload of the policy management entity.
  • the first state includes normal or abnormal.
  • the first state includes at least one of the following: the length of the sending queue, the buffer occupancy of the sending queue, the delay of the sending queue, the available capacity of the buffer entity, and the used capacity of the buffer entity Capacity, the rate of the outgoing port of the cache entity.
  • the method before the policy management entity determines the first message processing strategy based on the first cache state information, the method further includes: the policy management entity determines that the first cache state information satisfies a second preset condition.
  • the cache entity includes a target cache space
  • the first state includes the usage of the target cache space at the first moment
  • the policy management entity determines the first message according to the first cache state information
  • the processing strategy includes: the strategy management entity determines the first packet processing strategy according to the usage of the target cache space at the first moment.
  • the method further includes: the policy management entity obtains second cache state information, the second cache state information indicating the second state of the cache entity at the second moment; the policy management entity according to the second state Cache status information, determine a second message processing strategy, and send the second message processing strategy to the message processing entity; the message processing entity processes the newly received message according to the second message processing strategy.
  • the second message processing strategy is used to instruct the message processing entity to no longer execute the first message processing strategy.
  • the second message processing strategy is also used to instruct the message processing entity to use the specified message processing strategy to process the newly received message.
  • the designated message processing strategy is the default message processing strategy or the message processing strategy used before the first message processing strategy is used.
  • the newly received message includes a lossless traffic message.
  • the message processing entity processes the newly received message according to the first message processing strategy, including: the message processing entity adopts one or more of the following processing methods: discarding all new messages Received messages; discard part of the newly received messages; modify the message information of all newly received messages; or modify the message information of some newly received messages.
  • modifying the message information of the newly received message includes: modifying one or more of the following information of the newly received message: the priority of the newly received message; The discard enable bit of the newly received message; the discard priority of the newly received message; the port number of the newly received message; or, the display congestion flag of the newly received message .
  • an embodiment of the present application provides a network device.
  • the network device includes a network device including a policy management entity, a cache entity, and a message processing entity.
  • the policy management entity, the cache entity, and the message processing entity are used to implement the first aspect or any one of the designs of the first aspect.
  • an embodiment of the present application provides a network device.
  • the network device includes a first processor, a second processor, a first memory, and a second memory.
  • the first memory is used to store the first processor and the second processor.
  • the second memory is used to buffer messages from the upstream device.
  • the first processor executes the program code stored in the first memory to realize the function of the policy management entity in the first aspect or any design of the first aspect
  • the second processor executes the program code stored in the first memory to implement the first aspect.
  • the function of the message processing entity in one aspect or any design of the first aspect.
  • an embodiment of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores instructions for implementing the first aspect or the method described in any one of the possible implementation manners of the first aspect.
  • this application provides a computer program product containing instructions, when the computer program product is run on a computer, the computer can execute the above-mentioned first aspect or any one of the possible implementations of the first aspect. method.
  • Figure 1 is a schematic diagram of a network.
  • Figure 2 is a schematic structural block diagram of a network device.
  • Fig. 3 is a schematic flowchart of a method for processing a packet in a network device according to an embodiment of the present application.
  • Figure 4 is a schematic diagram of reserved cache space, shared cache space and headroom cache space.
  • Figure 5 is another schematic diagram of reserved cache space, shared cache space and headroom cache space.
  • Fig. 6 is a schematic flowchart of a method for processing a packet in a network device according to an embodiment of the present application.
  • Fig. 7 is a structural block diagram of a network device provided according to an embodiment of the present application.
  • Fig. 8 is a structural block diagram of a network device provided according to an embodiment of the present application.
  • the network device in the embodiment of the present application may be a network device with a routing function (for example, a router) or a network device with a switching function (for example, a switch).
  • the network equipment in the embodiments of this application may be a network equipment in a wired communication network, or a wireless communication network (such as the Global System of Mobile Communication, GSM) system, Code Division Multiple Access, CDMA) systems, Long Term Evolution (LTE) systems, and future 5G networks, etc.).
  • GSM Global System of Mobile Communication
  • CDMA Code Division Multiple Access
  • LTE Long Term Evolution
  • the subscript sometimes as W 1 may form a clerical error at non-target as W1, while not emphasize the difference, to express their meaning is the same.
  • references described in this specification to "one embodiment” or “some embodiments”, etc. mean that one or more embodiments of the present application include a specific feature, structure, or characteristic described in combination with the embodiment. Therefore, the sentences “in one embodiment”, “in some embodiments”, “in some other embodiments”, “in some other embodiments”, etc. appearing in different places in this specification are not necessarily All refer to the same embodiment, but mean “one or more but not all embodiments” unless it is specifically emphasized otherwise.
  • the terms “including”, “including”, “having” and their variations all mean “including but not limited to”, unless otherwise specifically emphasized.
  • At least one refers to one or more, and “multiple” refers to two or more.
  • “And/or” describes the association relationship of the associated objects, indicating that there can be three relationships, for example, A and/or B, which can mean: A alone exists, A and B exist at the same time, and B exists alone, where A, B can be singular or plural.
  • the character “/” generally indicates that the associated objects before and after are in an “or” relationship.
  • the following at least one item (a)” or similar expressions refers to any combination of these items, including any combination of a single item (a) or a plurality of items (a).
  • at least one item (a) of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple .
  • Figure 1 is a schematic diagram of a network.
  • the network 100 includes a network device 110, an upstream device 121, an upstream device 122, an upstream device 123, an upstream device 124, an upstream device 125, a downstream device 131, a downstream device 132, a downstream device 133, a downstream device 134 and Downstream equipment 135.
  • the upstream device can be a terminal device, such as a computer, a mobile phone, a tablet computer, etc., or a network device.
  • the downstream device can be a terminal device or a network device.
  • the network device 110 can receive packets from the upstream device 121, the upstream device 122, and the upstream device 123 through the port 111.
  • the network device 110 can receive packets from the upstream device 124 through the port 112.
  • the network device 110 can receive packets from the upstream device 115 through the port 113.
  • the network device 110 may send packets to the downstream device 131 and the downstream device 132 through the port 114.
  • the network device 110 may send the message to the downstream device 133, the downstream device 134, and the downstream device 135 through the port 115.
  • FIG. 1 is only a schematic diagram of a network to help those skilled in the art understand the method of the present application, and is not a limitation on the network to which the technical solution of the present application can be applied.
  • the network device 110 may also receive a packet sent by one or more upstream devices other than the upstream device 121 and the upstream device 122 through the port 111.
  • the network device 110 may also receive packets sent from one or more upstream devices through another port.
  • the network device 110 may also send a packet to one or more downstream devices other than the downstream device 131 and the downstream device 132 through the port 114.
  • the network device 110 may also send packets to one or more downstream devices through another port.
  • the ports (for example, port 111, port 112, and port 113) in the network device for receiving packets from the upstream device may be referred to as the ingress port of the network device (abbreviated as the ingress port).
  • the ports (for example, port 114 and port 115) in the network device used to send packets to the downstream device may be referred to as the outgoing port of the network device (abbreviated as the outgoing port).
  • Fig. 2 is a schematic structural block diagram of a network device provided according to an embodiment of the present application.
  • Fig. 2 is a schematic structural block diagram of the network device 110 shown in Fig. 1.
  • the network device 110 includes: a policy management entity 141, a cache entity 142, and a message processing entity 143.
  • the network device 110 may also include a port 111, a port 112 and a port 113, and a port 114 and a port 115.
  • Port 111 to port 113 are ingress ports. Port 111 to port 113 can be used to receive messages from upstream devices and send the received messages to the message processing entity 143.
  • the message processing entity 143 is used for processing messages from the ingress port. For example, the message processing entity 143 can determine whether to allow the message to pass through. If the message is allowed to pass, the message can be sent to the cache entity 142. If the message is not allowed to pass, the message can be deleted, or the discard enable is added to the message header information, and the modified message is sent to the cache entity 142. The cache entity 142 may discard the message after receiving the message containing the discard enable. For another example, the message processing entity 143 can also modify information such as the priority and the outgoing port of the message.
  • the cache entity 142 After the cache entity 142 obtains the message from the message processing entity 143, if it determines that the message does not need to be discarded, it can cache the message, and cache the message through the corresponding out port (for example, port 114 or port 115). The message is sent to the downstream device.
  • the policy management entity 141 may determine the message processing policy according to the state of the cache entity 142.
  • the message processing entity 143 may obtain the message processing strategy determined by the policy management entity 141, and execute the message processing strategy.
  • the network device receives the message sent by the upstream device through the ingress port, and sends the message to the corresponding downstream device through the egress port.
  • the network device is unable to send packets from the upstream device to the downstream device in time due to some reasons (such as congestion on the outbound port, the flow of packets received on the ingress port is greater than the flow of packets sent on the outbound port, etc.) .
  • the network device can cache the messages that were not sent in time to the cache entity (such as the cache entity 142) of the network and the device, and wait for the outgoing port to be able to send these messages, and then cache the messages cached by the cache entity.
  • the document is sent to the downstream device.
  • the buffer space used for buffering messages in the buffer entity can be divided into two types, which can be called the first buffer space and the second buffer space respectively.
  • the first buffer space can be shared by different types of messages.
  • the first buffer space can store any one or more types of messages, and for any one or more types of messages, as long as the first buffer space has available capacity, the messages can be cached to The first buffer space.
  • the first buffer space can all be used to store type 1 messages.
  • the second cache space may include multiple sub-cache spaces.
  • the multiple sub-cache spaces, the multiple sub-cache spaces have a one-to-one correspondence with the multiple types, and each sub-cache space in the multiple sub-cache spaces is used to store messages of a corresponding type.
  • the second cache space includes 8 sub-cache spaces, and the capacity of each sub-cache space in the 8 sub-cache spaces may be 64 MB.
  • the 8 sub-buffer spaces correspond to the 8 types in a one-to-one manner.
  • the 8 types can be called type 0, type 1, ..., type 7, respectively.
  • the eight sub-cache spaces may be referred to as sub-cache space 0, sub-cache space 1, ..., sub-cache space 7, respectively.
  • Sub-buffer space 0 is used to store type 0 messages
  • sub-buffer space 1 is used to store type 1 messages
  • sub-buffer space 2 is used to store type 2 messages, and so on.
  • the second buffer space can store at most type 0 messages with a size of 64 MB, type 1 messages with a size of 64 MB, type 2 messages with a size of 64 MB, and so on.
  • the capacity of the sub-buffer space of different types of messages is the same. In other embodiments, the sizes of different sub-buffer spaces may be different. Also take the second cache space with a total size of 512MB as an example. Assume that the second cache space includes 6 sub-cache spaces in total, which are sub-cache space 0 to sub-cache space 5, respectively. Sub-buffer space 0 to sub-buffer space 5 are respectively used for buffering type 0 to type 5 messages. The size of the sub-cache space 0 and the sub-cache space 1 may be 128MB; the size of each sub-cache space from the sub-cache space 2 to the sub-cache space 5 is 64MB.
  • the above-mentioned sub-buffer space is divided according to capacity. In other embodiments, the sub-buffer space may also be divided according to the maximum number of messages that can be buffered. Also take the foregoing sub-cache space 0 to sub-cache space 7 as an example. In some embodiments, the number of messages that can be buffered in each sub-buffer space is the same. For example, each of the 8 sub-buffer spaces can buffer 100 messages. In other embodiments, the number of messages that can be buffered in different sub-buffer spaces may be different. For example, each sub-cache space from sub-cache space 0 to sub-cache space 3 can buffer 200 messages, and each sub-cache space from sub-cache space 4 to sub-cache space 7 can buffer 100 messages.
  • the type of the message may be determined according to the class of service (CoS) of the message.
  • CoS class of service
  • IEEE 802.1p defines CoS. IEEE802.1p stipulates a total of 8 CoS, which are 0 to 7. A CoS value of 0 has the lowest priority, and a CoS value of 7 has the highest priority.
  • the network device can determine the CoS of the message according to the CoS field in the Layer 2 header of the received message and the virtual local area network (Virtual Local Area Network) identification (ID).
  • ID virtual local area network identification
  • the CoS of the message is the CoS value carried in the message; if the message only carries the CoS value (the VLAN ID is 0 at this time) If the message is a message, the CoS of the message is the CoS value carried by the message; if the message is a message carrying a label, then the CoS of the message is 0 by default or a new CoS can be specified by changing it.
  • the type of the message may correspond to the CoS of the message on a one-to-one basis.
  • the correspondence between the message type and the CoS of the message can be as shown in Table 1.
  • the type of the message is 0; if the CoS of the message is 1, the type of the message is 1, and so on.
  • the correspondence between the type of the message and the CoS of the message may also have multiple CoS corresponding to one type.
  • the correspondence between the message type and the CoS of the message can be as shown in Table 2.
  • the type of packets with CoS 0 and 1 is 0; the type of packets with CoS 2 and 3 is 1; the type of packets with CoS 4 and 5 is 2; CoS is 6 and 7
  • the type of the message is 3.
  • the type of packets with CoS of 0, 1 and 2 is 0; the type of packets with CoS of 3, 4, and 5 is 1, and the type of packets with CoS of 6 and 7 are 2.
  • the type of the message may be determined according to the Internet Protocol (IP) priority of the message.
  • IP Internet Protocol
  • the network device can determine the Type of Service (ToS) field in the IP packet header to determine the IP priority. Similar to CoS priority, the correspondence between IP priority and message type can be one-to-one correspondence, or multiple IP priorities can correspond to one type. For the sake of brevity, it will not be repeated here.
  • IP Internet Protocol
  • ToS Type of Service
  • the type of the message can also be determined according to the priority (priority, Pri) field in the VLAN header of the message or the priority in the differentiated services code point (DSCP) field in the IP header.
  • the specific determination method is the same as that of determining the type of the message according to the CoS. For the sake of brevity, it will not be repeated here.
  • the type of the message can be divided according to other information received in the message.
  • the type of the message can be determined based on the lossy traffic message and the lossless traffic message.
  • the type of the message can be determined according to IP version 4 (IPv4) and IP version 6 (IPv6).
  • the message type can also be determined simultaneously based on priority information and other information (for example, lossy traffic messages and lossless traffic messages, or IPv4 messages and IPv6 messages).
  • priority information for example, lossy traffic messages and lossless traffic messages, or IPv4 messages and IPv6 messages.
  • the number of message types supported by different network devices can be different. For example, some network devices can support 8 types of messages, and other networks can support 4 types of messages.
  • the number of message types supported by the network device may be the same as the number of sub-buffer spaces included in the second buffer space. For example, if the number of message types that the network device can support is 8, then the second buffer space of the network device includes 8 sub-buffer spaces. The 8 sub-buffer spaces have a one-to-one correspondence with the 8 message types.
  • the cache entity may include at least one first cache space and at least one second cache space. In other words, in some embodiments, the cache entity may include a first cache space and a second cache space. In other embodiments, the cache entity may include multiple first cache spaces and one second cache space. In other embodiments, the cache entity may include a first cache space and a plurality of second cache spaces.
  • the second cache space included in the cache entity may have a one-to-one correspondence with the ingress port.
  • the multiple second buffer spaces have a one-to-one correspondence with the multiple ingress ports.
  • Each second buffer space user in the plurality of second buffer spaces buffers the message received through the corresponding port.
  • the cache space of the network device 110 cache entity 142 may include three second cache spaces.
  • the three second cache spaces may be referred to as the second cache space 111, the second cache space 112, and the second cache space 113, respectively.
  • the second buffer space 111 corresponds to the port 111.
  • the second buffer space 111 is used to buffer the message received from the port 111.
  • the second buffer space 112 corresponds to the port 112.
  • the second buffer space 112 is used to buffer the message received from the port 112.
  • the second buffer space 113 corresponds to the port 113.
  • the second buffer space 113 is used to buffer the message received from the port 113.
  • the second buffer space has a one-to-one correspondence with the egress port. In other words, there is a one-to-one correspondence between the multiple second buffer spaces and the multiple egress ports.
  • Each second buffer space in the plurality of second buffer spaces is used for buffering the message sent through the corresponding egress port.
  • the cache entity 142 of the network device 110 may include two second cache spaces.
  • the two second cache spaces may be referred to as the second cache space 114 and the second cache space 115, respectively.
  • the second buffer space 114 corresponds to the port 114.
  • the second buffer space 114 is used to buffer the message sent through the port 114.
  • the second buffer space 115 corresponds to the port 115.
  • the second buffer space 115 is used to buffer the message sent through the port 115.
  • the second cache space in the cache entity may not correspond to the egress port or the ingress port.
  • the second buffer space can buffer the message.
  • this second buffer space that does not distinguish between the ingress port and the egress port may be referred to as a port-independent second buffer space.
  • the foregoing second buffer space corresponding to the egress port or the ingress port may be referred to as a port-related second buffer space.
  • the second cache space corresponding to the egress port may be referred to as the second cache space related to the egress port.
  • the second cache space corresponding to the ingress port may be referred to as the second cache space related to the ingress port.
  • the multiple second cache spaces in the cache entity may all be port-related second cache spaces.
  • the multiple second cache spaces in the cache entity are all second cache spaces related to the egress port.
  • the multiple second cache spaces in the cache entity are all second cache spaces related to the ingress port.
  • a part of the second cache space among the plurality of second cache spaces in the cache entity is the second cache space related to the ingress port, and the other part of the second cache space is the second cache space related to the egress port.
  • the second cache space in the cache entity is a port-independent second cache space.
  • the cache entity includes a port-independent second cache space.
  • the second cache space in the cache entity may have multiple port-related second cache spaces and at least one port-independent second cache space.
  • the cache entity may include multiple second cache spaces related to outbound ports and one second cache space independent of ports.
  • the cache entity may include multiple second cache spaces related to ingress ports and one second cache space independent of ports.
  • the cache entity may include multiple second cache spaces related to ingress ports, multiple second cache spaces related to egress ports, and one port-independent second swap space.
  • the cache entity may use the first cache space and the second cache space in a predetermined order.
  • the order of use of the first cache space and the second cache space can be configured by the user or can be set when the network device is shipped from the factory (in other words, the user cannot change the order of use).
  • the cache entity may first use the port-independent second cache space , And then use the first buffer space, and finally use the port-related second buffer space.
  • the cache entity may first use the first cache space, and then use the port-related second cache space.
  • the cache entity may first use the first cache space, and then use the port-independent second cache space.
  • the buffer space can also cache the corresponding type of messages. If a certain buffer space has no remaining buffer space to buffer the message, the buffer space is skipped. For example, if the first buffer space has no remaining space to buffer the message, the second buffer space is directly used to buffer the message.
  • the first buffer space refers to: first using the sub-buffer space in the second buffer space corresponding to a certain type of message to buffer the corresponding type of message.
  • the first buffer space is used to cache the corresponding type of message (assuming that the first buffer space has available capacity).
  • first buffer space and then the second buffer space means: first use the first buffer space to buffer the message, if the first buffer space does not have enough available capacity to continue to buffer the message, then use the second buffer space and the message
  • the sub-buffer space corresponding to the message type caches the message.
  • the packets in the network 100 shown in FIG. 1 may include lossless traffic packets and lossy traffic packets.
  • the cache entity of the network device 110 may include three second cache spaces and one first cache space.
  • the one first cache space may be referred to as a shared (share) cache space.
  • the three second buffer spaces can be divided into reserve buffer spaces and headroom buffer spaces.
  • the three second cache spaces may include one reserved cache space and three headroom cache spaces.
  • the reserved buffer space is a port-independent second buffer space.
  • the three headroom buffer spaces are the second buffer space related to the ingress port. In other words, each of the three headroom buffer spaces corresponds to an ingress port of the network device 110.
  • the three headroom buffer spaces may be referred to as headroom buffer space 111, headroom buffer space 112, and headroom buffer space 113, respectively.
  • the headroom cache space 111 corresponds to the ingress port 111
  • the headroom cache space 112 corresponds to the ingress port 112
  • the headroom cache space 113 corresponds to the ingress port 113.
  • the headroom buffer space 111 is used for buffering messages received from the port 111
  • the headroom buffer space 112 is used for buffering messages received from the port 112
  • the headroom buffer space 113 is used for buffering messages received from the port 113.
  • the predetermined order of use of the cache space of the cache entity of the network device 100 may be: reserved cache space, shared cache space, and clear cache space.
  • the network device 100 may use the reserved cache space and the shared cache space in the cache entity to cache.
  • Fig. 3 is a schematic flowchart of a method for processing a message in a network device according to an embodiment of the present application.
  • the packets received and processed by the network device in the method shown in FIG. 3 are all packets with lossless traffic.
  • the policy management entity receives cache status information 1 sent by the cache entity.
  • the cache status information 1 includes the used capacity of the target cache space at time 1.
  • the target buffer space can be used to buffer target messages.
  • the target message is a message with a target type.
  • the target type is any one of multiple message types. For example, if the type of the message includes 0 to 7 as shown in Table 1, then the target type can be any of types 0 to 7.
  • the target cache space includes a first cache space, a first target sub-cache space and a second target sub-cache space.
  • the first buffer space has the same function as the first buffer space described above.
  • the first buffer space can be shared by different types of messages. In other words, as long as the first buffer space has available capacity, any type of message can be buffered in the first buffer space, and there is no upper limit for each type of message.
  • the first cache space may be a shared cache space.
  • the target sub-cache space is one of the multiple sub-cache spaces included in the second cache space.
  • the multiple sub-buffer spaces have a one-to-one correspondence with multiple message types supported by the network device.
  • Each sub-buffer space is used to buffer corresponding types of messages.
  • the first target sub-cache space and the second target sub-cache space may be different sub-cache spaces in the second cache space.
  • the first target sub-cache space may be one of multiple sub-cache spaces included in the second cache space 1.
  • the second cache space 1 may be reserved cache space.
  • the second target sub-cache space may be one of multiple sub-cache spaces included in the second cache space 2.
  • the second buffer space 2 may be a headroom buffer space.
  • the headroom cache space in the cache entity of the network device includes four sub-cache spaces, and the four sub-cache spaces may be referred to as sub-cache space 0, sub-cache space 1, sub-cache space 2 and sub-cache space 3, respectively.
  • Sub-cache space 0 corresponds to type 0.
  • Sub-buffer space 0 is used to buffer type 0 messages.
  • Sub-cache space 1 corresponds to type 1.
  • Sub-buffer space 1 is used to buffer type 1 messages.
  • Sub-buffer space 2 corresponds to type 2 messages.
  • the sub-buffer space 2 is used to buffer type 2 messages.
  • the sub-buffer space 3 corresponds to type 3 messages.
  • the sub-buffer space 3 is used to buffer type 3 messages. Assuming that the target message is of type 1, then the second target sub-buffer space is sub-buffer space 1. Assuming that the type of the target message is type 0, then the second target sub-cache space is sub-cache space 0.
  • the cache entity of the network device preferentially uses the second cache space 1 to cache the message.
  • the first buffer space is used to buffer the message.
  • the cache entity uses the second cache space 2 to cache the message.
  • the cache entity may first use the first target sub-cache space to cache the target message; in the case that the first target sub-cache space cannot continue to cache the target message, use the first cache space to cache the target message; In the case that the cache space cannot continue to cache the target message, the second target sub-cache space is used to cache the target message.
  • the cache entity of the network device can monitor the target cache space, determine the used capacity of the target cache space at time 1, and send the used capacity of the target cache space at time 1 to the policy management entity through the cache state 1.
  • the used capacity of the target cache in the cache state 1 may include the used capacity of the first cache space at time 1, the used capacity of the first target sub-cache space at time 1, and the used capacity of the second target sub-cache space at time 1. Used capacity.
  • the policy management entity determines whether the target cache space meets the preset condition 1 according to the used capacity of the target cache space at time 1.
  • the policy management entity may determine the message processing strategy 1 and send the message processing strategy 1 to the message processing entity.
  • the target cache space meeting the preset condition 1 may include: the first target sub-cache space cannot continue to cache the target message, the first cache space cannot continue to cache the target message, and the second target The sub-buffer space cannot continue to cache the target message.
  • the policy management entity may first determine whether the first target sub-cache space can continue to cache the target message. If the first target sub-cache space can continue to cache the target message, the policy management entity can determine that the target cache space does not meet the preset condition 1 and can continue to use the first target sub-cache space to cache the target message . If the first target sub-cache space cannot continue to cache the target message, the policy management entity may continue to determine whether the first cache space can continue to cache the target message. If the first cache space can continue to cache the target message, the policy management entity can determine that the target cache space does not satisfy the preset condition 1 and can continue to use the first cache space to cache the target message.
  • the policy management entity may determine whether the second target sub-cache space can continue to cache the target message. If the second target sub-cache space can cache the target message, the policy management entity may determine that the target cache space does not meet the preset condition 1 and may continue to use the second target sub-cache space to cache the target message . If the second target sub-buffer space cannot cache the target message, the policy management entity may determine that the target buffer space satisfies the preset condition 1.
  • the policy management entity determines that the first target sub-cache space, the first cache space and the second target sub-cache space cannot cache the target message at the same time, the policy management entity determines that the target cache space satisfies the first target packet.
  • a preset condition when the policy management entity determines that the first target sub-cache space, the first cache space and the second target sub-cache space cannot cache the target message at the same time, the policy management entity determines that the target cache space satisfies the first target packet.
  • the inability of the first buffer space to buffer the target message may include: the first buffer space does not have sufficient available capacity for buffering the message. In other words, all the available capacity of the first buffer space has been occupied by the buffered messages.
  • the inability of the first buffer space to buffer the target message may include: the used capacity in the first buffer space reaches the upper limit of the used capacity.
  • an upper limit of used capacity can be set for the first cache space, for example, it can be referred to as a preset threshold 1. If the used capacity in the first buffer space reaches the preset threshold 1, the first buffer space may no longer continue to buffer packets.
  • the preset threshold value 1 can be set to 85%. In other words, if 85% of the buffer space of the first buffer space is already occupied by the message, then the first buffer space cannot continue to buffer the message.
  • the remaining 15% of the capacity in the first cache space after reaching the upper limit of the used capacity can be activated under special circumstances. For example, it can be used to buffer burst messages or messages that cannot be discarded.
  • the 85% preset threshold value 1 in the foregoing embodiment is just an example.
  • the preset threshold value 1 may also be a proportional value, such as 95%, 90%, or 80%. It is understandable that if the preset threshold value 1 is 100%, it means that the first buffer space cannot buffer the target message when all the available capacity of the first buffer space has been occupied.
  • the preset threshold value 1 may be a buffer capacity value. For example, assuming that the total size of the first cache space is 2048MB, the preset threshold 1 may be 1800MB, 1900MB or 1700MB.
  • the preset threshold 2 may also be the number of packets.
  • the preset threshold 1 may be 800, 900, or 950.
  • the preset threshold value 1 in the foregoing embodiment is a preset value for the used capacity.
  • a lower limit of the available capacity can also be set according to the available capacity of the first cache space. If the available capacity of the first cache space reaches the lower limit of available capacity, the first cache space may not continue to cache messages (correspondingly, the available capacity of the target cache space reported by the cache entity at this time).
  • the upper limit of used capacity and the lower limit of available capacity of the aforementioned first cache space can be configured by the user, or set by the network device when it leaves the factory (in other words, the user cannot change the upper limit of used capacity and the lower limit of available capacity).
  • the inability of the first cache space to cache the target message may also include that the first cache space fails to continue to cache the target message.
  • the inability of the first target sub-buffer space to cache the target message may include: the first target sub-buffer space does not have sufficient available capacity for buffering messages. In other words, all the available capacity of the first target sub-buffer space has been occupied by the cached messages.
  • the inability of the first target sub-buffer space to cache the target message may include: the used capacity in the first target sub-buffer space reaches the upper limit of the used capacity.
  • an upper limit of used capacity can be set for the first target sub-cache space, for example, it can be referred to as a preset threshold 2. If the used capacity in the first target sub-buffer space reaches the preset threshold 2, the first target sub-buffer space may no longer continue to buffer packets.
  • the preset threshold 2 can be set to 85%. In other words, if 85% of the buffer space of the first target sub-buffer space is already occupied by messages, then the first target sub-buffer space cannot continue to buffer messages.
  • the remaining 15% of the capacity in the first target sub-cache space after reaching the upper limit of the used capacity can be activated under special circumstances. For example, it can be used to buffer burst messages or messages that cannot be discarded.
  • the inability of the second target sub-buffer space to cache the target message may include: the second target sub-buffer space does not have sufficient available capacity for buffering messages. In other words, all the available capacity of the second target sub-buffer space has been occupied by the cached messages.
  • the inability of the second target sub-buffer space to cache the target message may include: the used capacity in the second target sub-buffer space reaches the upper limit of the used capacity.
  • an upper limit of the used capacity can be set for the second target sub-cache space, for example, also the preset threshold 2. If the used capacity in the second target sub-buffer space reaches the preset threshold 2, the second target sub-buffer space may no longer continue to buffer packets.
  • the preset threshold 2 can be set to 85%. In other words, if 85% of the buffer space of the second target sub-buffer space is already occupied by the message, the second target sub-buffer space cannot continue to buffer the message.
  • the remaining 15% of the capacity in the second target sub-cache space after reaching the upper limit of the used capacity can be activated under special circumstances. For example, it can be used to buffer burst messages or messages that cannot be discarded.
  • the 85% preset threshold 2 in the foregoing embodiment is just an example.
  • the preset threshold 2 may also be a proportional value, such as 95%, 90%, or 80%. It can be understood that if the preset threshold 2 is 100%, it means that the target sub-cache space cannot cache the target message when the entire capacity of the target sub-cache space has been occupied.
  • the preset threshold 2 may be a buffer capacity value. For example, assuming that the total size of the first target sub-cache space is 2048MB, then the preset threshold 2 may be 1800MB, 1900MB or 1700MB.
  • the preset threshold 2 may also be the number of packets. For example, assuming that the first target sub-buffer space can buffer 1000 packets in total, the preset threshold 2 may be 800, 900, or 950.
  • the preset threshold 2 in the foregoing embodiment is a preset value for available capacity.
  • a lower limit of available capacity can also be set according to the available capacity of the target sub-cache space. If the available capacity of the target sub-cache space reaches the lower limit of the available capacity (correspondingly, the available capacity of the target cache space reported by the cache entity at this time), then the target sub-cache space may no longer continue to cache messages.
  • the upper limit of the used capacity and the lower limit of the available capacity of the above-mentioned first target sub-cache space and the second target sub-cache space can be configured by the user, or can be set by the network device when it leaves the factory (in other words, the user cannot change the The upper limit of available capacity and the lower limit of available capacity).
  • the upper limit of the used capacity of the first cache space, the first target sub-cache space and the second target sub-cache space are the same. In other embodiments, the upper limit of the used capacity of the first cache space, the first target sub-cache space and the second target sub-cache space may also be different. For example, the upper limit of the used capacity of the first cache space is 85%, the upper limit of the used capacity of the first target sub-cache space is 90%, and the upper limit of the used capacity of the second target sub-cache space is 95%.
  • the inability of the first target sub-cache space to cache the target message may also include that the first target sub-cache space fails to continue to cache the target message.
  • the inability of the second target sub-cache space to cache the target message may also include that the second target sub-cache space fails to continue to cache the target message.
  • the policy management entity may estimate the time when the target buffer space is full and start a timer according to the transmission rate of the incoming port message and the available capacity of the target buffer space. If the timer reaches the estimated time and the transmission rate of the ingress port does not change during this period, the policy management entity can determine that the target buffer space meets the preset condition 1. If the transmission rate of the ingress port or the transmission rate of the egress port changes before the timer reaches the estimated time, the policy management entity can adjust the estimated time according to the changed transmission rate, and according to the adjusted estimate Time determines whether the target buffer space meets the preset condition 1.
  • the policy management entity may determine whether the first target sub-cache space and the first cache space can cache the target message according to the used capacity of the first target sub-cache space and the used capacity of the first cache space. . If the first target sub-buffer space and the first buffer space cannot buffer the target message, the policy management entity may estimate the second target message according to the transmission rate of the ingress port receiving the target message and the size of the second target sub-buffer space. The time when the target sub-buffer space is full, and a timer is started. If the timer reaches the estimated time and the transmission rate of the target message received by the ingress port does not change, the policy management entity may determine that the second target buffer space meets the preset condition 1.
  • the policy management entity can change according to the change
  • the estimated time is adjusted for the subsequent transmission rate, and it is determined whether the second target buffer space satisfies the preset condition 1 according to the adjusted estimated time.
  • the message processing entity processes the newly received message according to the message processing strategy 1.
  • the message processing strategy 1 may be to delete the newly received target message.
  • the message processing entity may process the newly received target message, change the message header information, add discard enable to the message header information, and send the modified message to the cache entity.
  • the cache entity can delete the target message containing the discard enable.
  • the message processing entity may directly discard the newly received target message.
  • the message processing strategy 1 may be to modify the type of the newly received target message.
  • the message processing entity can modify the type of the newly received target message.
  • the newly received target message After the newly received target message is modified, it will be cached using the sub-buffer space corresponding to the modified type.
  • the target message is type 0
  • the type of the target message is type 1.
  • the sub-cache space used for the cache type 1 in the second cache space can be used to cache the target message with the modified type.
  • the modification to the type of the target message may be modified in the order of priority.
  • the type priority of the target packet after modification is lower than the type before modification. Assume that the priority of type 0 is greater than the priority of type 1 than the priority of type 2. If the target message has a priority of type 0, the type of the target message can be modified to type 1.
  • the sub-buffer space corresponding to the re-determined message type has available capacity to buffer the reclassified message.
  • the policy management entity may first determine the sub-buffer space with available capacity, and then determine that a corresponding type in these sub-buffer spaces is the type that needs to be modified for the target message, and the type that needs to be modified can be sent to as the message processing strategy Message processing entity. For example, assuming that the type of the target message is type 0, the sub-buffer space corresponding to type 1 can no longer continue to cache the message, and the sub-buffer space corresponding to type 2 and type 3 can still continue to buffer the message. In this case, the message processing strategy 1 determined by the policy management entity may be to modify the type of the newly received target message to type 2 or type 3. After the message processing entity newly receives the target message, it can modify the type of the target message to type 2 or type 3. In this way, the cache entity can continue to use the type 2 or type 3 sub-cache space to cache newly received messages.
  • the cache entity includes a plurality of second cache spaces and the plurality of second cache spaces have a one-to-one correspondence with a plurality of egress ports. Then, performing exception management on the newly received target message may be to modify the outgoing port used to send the newly received target message.
  • each second buffer space in the buffer entity may be used to buffer the message sent through the corresponding out port. Therefore, it may happen that the sub-storage space used for buffering the target message in one second buffer space of the plurality of second buffer spaces is full but the sub-buffer used for buffering the target message in the other or more second buffer spaces The space can also continue to cache target messages. Therefore, the egress port used to send the target message can be modified, so that the target sub-buffer space in the other second buffer space can be used to cache the target message.
  • the cache management of the network device can enable the target message to not preempt the child corresponding to other types of messages in the unified second buffer space when the target sub-buffer space cannot continue to cache the target message. Cache space. If the network device also includes a port-independent second buffer space, the target message will not preempt the port-independent second buffer space corresponding to other types of sub-buffer spaces. In this way, it can be ensured that the network device has the remaining buffer space to use when other types of messages need to be buffered.
  • the network device may also notify the upstream sending the target packet to stop sending the target packet to the network device when it is determined that the target buffer space satisfies the preset condition 1.
  • the message processing entity may also stop exception management of newly received target messages when the cache management returns to normal.
  • the policy management entity may receive the cache status 2 sent by the cache entity.
  • the cache state 2 carries the used capacity of the target cache at time 2.
  • the policy management entity may determine whether the target cache space meets the preset condition 2 according to the used capacity of the target cache space at time 2. If the target cache space satisfies the preset condition 2, the policy management entity can determine the message processing strategy 2 and send the message processing strategy 2 to the message processing entity, where the message processing strategy 2 is different from the message processing strategy 1. In this case, the message processing entity implements message processing strategy 2. If the target buffer space does not meet the preset condition 2, the measurement management entity is not sure of a new message processing strategy. In this case, the message processing entity continues to execute message processing strategy 1.
  • the policy management entity may first determine whether there are still cached target packets in the second target sub-cache space. If at least one target message is still cached in the second target sub-cache space, the policy management entity may determine that the target cache space does not satisfy the preset condition 2. For example, if the available capacity of the second target sub-cache space is equal to the total capacity of the second target sub-cache space, the policy management entity may determine that no target packet is cached in the second target sub-cache space. If the available capacity of the second target sub-cache space is less than the total capacity of the second target sub-cache space, the policy management entity may determine that at least one target message is cached in the second target sub-cache space.
  • the policy management entity determining whether the target cache space satisfies the preset condition 2 may include: determining the used capacity of the first cache space Is it less than the preset threshold 3; if the used capacity of the first cache space is less than the preset threshold 3, it can be determined that the target cache space satisfies the preset condition 2; if the used capacity of the first cache space is greater than or If it is equal to the preset threshold 3, it can be determined that the target cache space does not satisfy the preset condition 2.
  • the policy management entity determining whether the target cache space satisfies the preset condition 2 may include: determining the value of the first target sub-cache space Whether the used capacity is less than the preset threshold 4; if the used capacity of the first target sub-cache is less than the preset threshold 4, it can be determined that the target cache space satisfies the preset condition 2; if the first target sub-cache If the used capacity of the space is greater than or equal to the preset threshold 4, it can be determined that the target cache space does not satisfy the preset condition 2.
  • the policy management entity determining whether the target cache space satisfies the preset condition 2 may include: determining the used amount of the first cache space Is the capacity less than the preset threshold 3 and the used capacity of the first target sub-cache space is less than the preset threshold 4; if the used capacity of the first cache space is less than the preset threshold 3 and the used capacity of the first target sub-cache space If the used capacity is less than the preset threshold 4, it can be determined that the target cache space meets the preset condition 2; otherwise, it can be determined that the target cache space does not meet the preset condition 2.
  • the preset threshold value 3 and the preset threshold value 4 may be a ratio value or a specific capacity value or the number of packets.
  • the preset threshold 3 and the preset threshold 4 may be configured by the user or may be set when the network device leaves the factory.
  • the network device When the network device sends the messages buffered in the buffer entity, they will be sent in the reverse order of the buffer order. For example, the second target sub-buffer space starts to buffer the target message after the first buffer space cannot continue to buffer the message. Therefore, the network device may first send the target message buffered in the second target sub-buffer space through the corresponding out port, then send the target message buffered in the first buffer space, and finally send the first target message. Target message in the sub-buffer space. Therefore, through the above solution, it can be achieved that the second target sub-buffer space has available capacity to buffer the new target message. In this way, if the target message needs to be cached, the second target sub-buffer space can be used to cache the target message.
  • the policy management entity may determine whether the used capacity of the second target sub-cache space is less than a preset threshold of 5. If the used capacity of the second target sub-cache space is less than the preset threshold value 5, the policy management entity may determine that the target cache space meets the preset condition 2. If the used capacity of the second target sub-cache space is greater than or equal to the preset threshold value 5, the policy management entity may determine that the target cache space does not satisfy the preset condition 2.
  • the policy management entity may start a timer after sending the message processing policy 1 to the message processing entity, if the timer reaches the preset time and is used to send the target message's egress port During this period, the target message has been sent, then the policy management entity can determine that the target buffer space satisfies the preset condition 2.
  • the network device always sends the target message through the outgoing port. Therefore, after the message processing entity executes the message processing strategy 1, the target message cached in the target buffer space is always decreasing. After a preset time has elapsed, there is already available capacity in the target buffer space to continue to buffer the target message. In this case, the policy management entity may determine another message processing strategy (for example, message processing strategy 2), and send the newly determined message processing strategy to the message processing entity.
  • the preset time may be determined according to the sending speed of the target message and the capacity of the second target sub-buffer space. For example, if the sending speed of the target message does not change, when the timer reaches the preset time, all target messages in the second target sub-buffer space have been sent. In other words, the preset time may be sufficient for the network device to send out the target message buffered in the second target sub-buffer space. For another example, in other embodiments, the preset time may cause the network device to send out most of the target message cached in the second target sub-cache space (for example, 80%, 90%, or 95%, etc.).
  • the message processing strategy 2 may be to stop executing the message processing strategy 1. In this way, the message processing entity can stop executing the message processing strategy 1 after receiving the message processing strategy 2 (for example, not deleting the newly received target message). After receiving the message processing strategy 2, the message processing entity can use the default message processing strategy to process the newly received message or use the message processing strategy used before the message processing strategy 1 to process the newly received message. Arts.
  • Figure 4 is a schematic diagram of reserved cache space, shared cache space and headroom cache space.
  • Fig. 4 is a schematic diagram of how to buffer the target message in the buffer space without adopting the method shown in Fig. 3.
  • the network device 110 starts to receive type 1 packets from the upstream device 121 through the port 111 at time t0, and the transmission rate for receiving type 1 packets is 60 Gbps.
  • the network device 110 starts to receive type 1 packets from the upstream device 122 through the port 111 at time t0, and the transmission rate for receiving type 1 packets is 60 Gps.
  • the cache entity in the network device 110 may first cache the received type 1 message in a sub-cache space in the reserved cache space for caching type 1 messages (hereinafter referred to as type 1 reserved cache space) .
  • the reserved buffer space of type 1 is all occupied by type 1 packets.
  • the cache entity can determine whether there is any available capacity in the shared cache space. If there is remaining space in the shared cache space, the cache entity may cache type 1 messages in the shared cache space.
  • the cache entity may use the sub-buffer space in the headroom cache space for caching type 1 messages (hereinafter referred to as type 1 headroom cache space) to cache type 1 messages.
  • the headroom buffer space of type 1 is all occupied by type 1 packets.
  • the cache entity uses the sub-caching space for caching other types to cache type 1 messages.
  • type 1 messages start to preempt the reserved buffer space and the sub-buffer space in the headroom buffer space for buffering other types of messages.
  • the reserved buffer space, shared buffer space, and headroom buffer space have all been occupied by type 1 messages.
  • the network device 110 starts to receive type 2 packets from the upstream device 123 through the port 111 at time t4, and the transmission rate for receiving type 2 packets is 100 Gps. Assume that type 2 messages still need to be sent through port 114. It can be seen that at t4, the port 111 is still receiving Type 1 packets from the upstream device 111 and the upstream device 112 at a transmission speed of 60 Gps respectively. Therefore, type 2 messages cannot be sent from port 114 in time.
  • the cache entity needs to cache type 2 messages, but since the reserved cache space and headroom cache space, the sub-buffer space that was used to cache type 2 messages has been preempted by type 1 messages, so the cache entity cannot Cache type 2 packets in time. This caused an abnormal resource management.
  • Figure 5 is another schematic diagram of reserved cache space, shared cache space and headroom cache space.
  • Fig. 5 is a schematic diagram of reserved cache space, shared cache space and clear cache space after using the method shown in Fig. 3. It is assumed that the cache entity periodically sends the available capacity of each sub-cache space in the reserved cache space, the available capacity of the shared cache space, and the available capacity of each sub-cache space in the headroom cache space to the policy management entity.
  • the policy management entity determines the message processing strategy 1 and sends the message processing strategy 1 to the message processing entity. Assume that the message processing strategy 1 is to discard type 1 messages.
  • the message processing entity acquires and executes message processing strategy 1 and starts to execute message processing strategy 1 at time t3. In this way, the message processing entity discards the newly received type 1 message from time t3.
  • the type 1 packets stored in the headroom buffer space 111 continue to decrease.
  • the message processing entity obtains the message processing strategy 2 determined by the policy management entity and starts to execute the message processing strategy 2, where the message processing strategy 2 is to stop executing the message processing strategy 1. Therefore, starting from t6, the message processing entity can stop discarding newly received type 1 messages.
  • the speed at which the port 111 receives type 1 messages has not changed, the amount of type 1 messages buffered in the shared buffer space continues to increase.
  • type 1 message since the newly received type 1 message is discarded according to the state of the cache entity, the type 1 message no longer preempts the sub-buffer space of other types of messages. Therefore, type 2 messages received from time t4 can be cached in the sub-buffer space reserved for buffering type 2 in the reserved buffer space. In this way, it is possible to avoid the situation that the type 1 message preempts the sub-buffer space of other types of messages caused by the configuration error of the cache entity.
  • Fig. 6 is a schematic flowchart of a method for processing a message in a network device according to an embodiment of the present application.
  • the method shown in FIG. 6 may be executed by the network device shown in FIG. 2.
  • the policy management entity in the method shown in FIG. 6 may be the policy management entity 141 shown in FIG. 2.
  • the cache entity in the method shown in FIG. 6 may be the cache entity 142 shown in FIG. 2.
  • the message processing entity in the method shown in FIG. 6 may be the message processing entity 143 shown in FIG. 2.
  • the policy management entity obtains first cache state information from the cache entity.
  • the first cache state information is used to indicate the first state of the cache entity at the first moment.
  • the first state may be the state of the cache entity.
  • the first state may be one of a plurality of states.
  • the multiple states include: an abnormal state and a normal state.
  • the first state may be a normal state or an abnormal state.
  • the multiple states may include: a normal state, a critical state, and an abnormal state.
  • the first state may be a normal state, a critical state or an abnormal state.
  • the first state may be related information of the cache entity. These related information can reflect the state of the cache entity.
  • the first state may include at least one of the following information: the length of the sending queue, the buffer occupancy of the sending queue, the delay of the sending queue, the available capacity of the buffer entity, the used capacity of the buffer entity, and the size of the buffer entity. The rate of the outgoing port, etc.
  • each counter corresponds to an egress port queue.
  • the counter is used to record the number of packets of the corresponding outgoing port.
  • the length of the queue (which can be referred to as the sending queue) of each outgoing port can be obtained.
  • the length of the sending queue can be the queue length of each outgoing port, the queue length of one or more specific outgoing ports (for example, the outgoing port with the longest queue or the outgoing port with the lowest outgoing port rate, etc.), the average queue length, or the total
  • the length of the queue, etc. are not limited in the embodiment of the present application.
  • the first state may include the queue length corresponding to port 114 and the queue length of port 115. In other embodiments, the first state may only include the queue length of the egress port with the longest length (for example, it may be the queue length of port 114). In other embodiments, the first state may be the sum of the queue length of port 114 and the queue length of port 115.
  • the rate of the outgoing port of the cache entity can be the rate of each outgoing port, or the rate of one or more specific outgoing ports (such as the outgoing port with the longest queue or the outgoing port with the lowest outgoing port rate, etc.), or the average Rate, etc., which are not limited in the embodiment of the present application
  • the first state may include the rate corresponding to port 114 and the rate of port 115. In other embodiments, the first state may only include the rate of the egress port with the longest length (for example, it may be the queue length of port 114). In other embodiments, the first state may be the average of the port 114 rate and the port 115 rate.
  • the available capacity of the cache entity may be the total available capacity of the cache entity, or the available capacity of part of the cache space in the cache entity.
  • the first state may include the available capacity of the first buffer space. In other embodiments, the first state may include the available capacity of each sub-cache space in the second cache space. In other embodiments, the first state may include the available capacity of one or more sub-cache spaces in the second cache space. For example, a sub-buffer space used to cache messages of the target type. In other embodiments, the first state may include the available capacity of the first cache space and the available capacity of the second cache space.
  • the used capacity of the cache entity may be the total used capacity of the cache entity or the used capacity of part of the cache space in the cache entity.
  • the cache space of the cache entity may include a first cache space and a second cache space.
  • the first state may include the used capacity of the first buffer space.
  • the first state may include the used capacity of each sub-cache space in the second cache space.
  • the first state may include the used capacity of one or more sub-cache spaces in the second cache space. For example, a sub-buffer space used to cache messages of the target type.
  • the first state may include the used capacity of the first cache space and the used capacity of the second cache space.
  • the first state is the used capacity of the target cache space at time 1.
  • the caching entity may determine the first state, and send first caching state information for indicating the first state to the policy management entity.
  • the policy management entity receives the first cache state information sent by the cache entity. In other words, the first cache state information is actively determined by the cache entity and sent to the policy management entity.
  • the cache entity may periodically determine the state of the cache entity and indicate the determined state of the cache entity to the policy management entity through cache state information.
  • the caching entity may send the first caching state information to the policy management entity when it is determined that the first state satisfies the first preset condition.
  • the cache entity only indicates the state of the cache entity to the network device when the state meets the first preset condition. If the state of the cache entity does not meet the first preset condition, the cache entity may not need to indicate the state of the cache device to the policy management entity.
  • the first preset condition is configured at the factory and cannot be modified by the user. In other embodiments, the user can set the first preset condition according to needs.
  • the first preset condition is that the available capacity of the cache entity is less than or equal to the threshold Th1.
  • the cache entity may send the first cache state information to the policy management entity.
  • the first preset condition may be that the rate of the egress port reaches the maximum rate.
  • the cache entity may send the first cache state information to the policy management entity.
  • the first preset condition may be that the available capacity of the target sub-cache space is less than the threshold Th2.
  • the cache entity may send the first cache state information to the policy management entity.
  • the first preset condition may be that the queue length of the egress port is greater than the threshold Th3.
  • the cache entity may send the first cache status information to the policy management entity.
  • only one preset condition for triggering the reporting of the first cache state information may be stored in the cache entity.
  • the cache entity may store a plurality of preset conditions for triggering the reporting of the first cache status information. As long as the first state satisfies one of the multiple preset conditions, the cache entity wants the policy management entity to send the first cache state information. Among the plurality of preset conditions, the preset condition satisfied by the first state is the first preset condition.
  • the policy management entity or the message processing entity may send a status request to the cache entity.
  • the caching entity may determine the first state and send the first caching state information used to indicate the first state to the policy management entity upon receiving the state request.
  • the manner in which the policy management entity or the message processing entity sends the status request to the cache entity may be periodic or aperiodic.
  • the message processing entity may send the status request to the cache entity when the rate of the ingress port is greater than a threshold.
  • the message processing entity may send the status request to the cache entity when a message with a specific mark or level is received.
  • the first cache status information is sent by the cache entity to the policy management entity.
  • the policy management entity may actively read the first cache state information in the cache entity.
  • the cache entity may obtain the state of the cache entity, determine the cache state information according to the obtained state of the cache entity, and save the determined cache state information.
  • the cache entity may obtain the first state of the cache entity at the first moment, determine the first cache state information, and save the first cache state information.
  • the policy management entity can read the first cache state information stored by the cache entity.
  • the buffer entity may adjust the length of the sending queue, the buffer occupancy of the sending queue, the delay of the sending queue, the available capacity of the buffer entity, the used capacity of the buffer entity, the rate of the outgoing port of the buffer entity, etc.
  • At least one type of information in is sent to the policy management entity.
  • the policy management entity may determine the first cache state information according to the received at least one type of information. In this case, the first cache state information is the state of the cache entity.
  • the buffer entity can obtain the length of the sending queue, the buffer occupancy of the sending queue, the delay of the sending queue, the available capacity of the buffer entity, the used capacity of the buffer entity, the rate of the outgoing port of the buffer entity, etc. At least one type of information in and save the acquired at least one type of information.
  • the policy management entity may read at least one type of information stored in the cache entity, and determine the first cache state information according to the at least one type of information. In this case, the first cache state information is the state of the cache entity.
  • the policy management entity determines a first packet processing policy according to the acquired first cache state information.
  • the policy management entity can determine the message processing strategy, for example, discarding the newly received target message.
  • the policy management entity may not be sure of a new message processing policy.
  • the policy management entity may maintain multiple message processing policies. Different message processing strategies can correspond to different cache status information. For example, message processing strategy 11 corresponds to the queue length of the egress port being less than the threshold Th5; message processing strategy 12 corresponds to the queue length of the egress port being greater than or equal to Th5 and less than the threshold Th6; message processing strategy 13 corresponds to the queue of the egress port The length is greater than or equal to Th6. In this case, if the length of the outbound port queue included in the first buffer status information is less than Th5, the policy management entity may determine that the first packet processing strategy is the packet processing strategy 11.
  • the policy management entity sends the first packet processing policy to the packet processing entity
  • the message processing entity executes the first message processing strategy, and processes the newly received message according to the first message processing strategy.
  • the first message processing strategy may be to discard all newly received messages.
  • the message processing entity can discard all newly received messages.
  • the first message processing strategy may be to modify the message information of all newly received messages.
  • Modifying the message information can be modifying the priority of the message, modifying the discarding priority of the message, modifying the port number of the message, modifying the explicit congestion notification (ECN) bit of the message, or modifying the discarding of the message One or more of the enable bits, etc.
  • ECN explicit congestion notification
  • the message processing entity can modify the message information of all newly received messages.
  • the first message processing strategy may be to discard some newly received messages.
  • the message processing entity can discard some of the newly received messages. For example, in the embodiment shown in FIG. 3, only the newly received target message may be discarded. For another example, the message processing entity can randomly discard newly received messages.
  • the first message processing strategy may be to modify the message information of a part of the newly received message.
  • the message processing entity can modify the message information of some newly received messages. For example, in the embodiment shown in FIG. 3, only the message information of the target message may be modified.
  • the message processing entity can randomly select a part of the messages and modify the message information of the selected messages.
  • the first message processing strategy may be to discard part of the message while modifying the message information of another part of the message.
  • the first message processing strategy may be to discard a part of the message, while modifying the message information of a part of the message, while not performing any processing on a part of the message.
  • the policy management entity obtains the second cache status information.
  • the second cache state information is used to indicate the second state of the cache entity at the second moment.
  • the manner in which the policy management entity obtains the second cache state information is the same as the manner in which the first cache state information is obtained. For example, both the first cache state information and the second cache state information are actively sent by the cache entity to the policy management entity.
  • the method of obtaining the second cache state information by the policy management entity may be different from the method of obtaining the first cache state information.
  • the first cache state information is actively sent by the cache entity to the policy management entity, and the second cache state information is read from the cache entity by the policy management entity.
  • the specific method for the policy management entity to obtain the second cache state information is similar to the specific method for the policy management entity to obtain the first cache state information. For the sake of brevity, I won't repeat them here.
  • the policy management entity determines a second packet processing policy according to the second cache status information
  • the policy management entity sends the second packet processing policy to the packet processing entity.
  • the message processing entity executes the second message processing strategy, and processes the newly received message according to the second message processing strategy.
  • the second packet processing strategy is used to instruct the packet processing entity to no longer execute the first packet processing strategy. For example, assuming that the first packet processing strategy is to discard packets of the target type, the packet processing strategy may stop discarding packets of the target type after receiving the second packet processing strategy.
  • the second message processing strategy is also used to instruct the message processing entity to use the specified message processing strategy to process the newly received message.
  • the designated message processing strategy may be a default message processing strategy.
  • the default message processing strategy is not to perform any additional processing (such as discarding or modifying message information) on the target type of message.
  • the default message processing strategy is to process the target type messages and non-target type messages in the same way.
  • the designated message processing strategy may be a message processing strategy used before the first message processing strategy is used.
  • the message processing strategy used before the first message processing strategy is used is the third message processing strategy.
  • the third message processing strategy is to modify the priority of the target type of message. In this way, after receiving the second message processing strategy, the message processing entity no longer discards the target type of message, but modifies the priority of the target type of message.
  • the message in the method shown in FIG. 6 is a lossless traffic message. In other embodiments, the message in the method shown in FIG. 6 may be a lossless traffic message or a lossy traffic message.
  • the message processing entity can execute the corresponding message processing strategy according to the state of the cache entity. In this way, the cache entity can be better managed to reduce the occurrence of cache management exceptions in the cache entity.
  • the resource management rule in the cache entity is that the message input to the cache entity is discarded only when the queue length of port 115 is greater than 25535.
  • the queue length of the port 115 in the resource management rules is greater than the queue length that the port 115 can actually handle (assuming that the queue length that the port 115 can actually handle is 1023).
  • the policy management entity can obtain the queue length of port 115 reported by the cache entity, and determine the message processing strategy when the queue length of port 115 is greater than 1000 and send the determined message processing strategy to Message processing entity. It is assumed that the message processing strategy can be to modify the outgoing port of the message to be port 114. In this way, the message processing entity can modify the outgoing port of the packet from 115 to 114. In this way, it is possible to avoid the occurrence of an abnormal cache management caused by a configuration error of the cache entity.
  • the network device in a lossless network, for lossless traffic packets, if the network device is congested on the outgoing port, it requests the upstream device to stop sending the packets sent through the outgoing port. However, the upstream device may not normally respond to the request sent by the network device and continue to send packets to the network device. According to the current industry processing method, since the received message is a lossless traffic message, the network device cannot discard the newly received message. However, network devices cannot send lossless traffic packets in time. In this way, there may not be enough buffer space to buffer the newly received message. Using the method shown in FIG. 6, the policy management entity can obtain the available capacity of the cache space reported by the cache entity.
  • the policy management entity may determine a message processing strategy and send the determined message processing strategy to the message processing entity when the available capacity of the buffer space is insufficient. It is assumed that the message processing strategy can be to discard all newly received messages. In this way, the message processing entity can discard the newly received message. In this way, the message capacity that needs to be cached by the cache entity will not exceed the available capacity of the cache entity.
  • the cache entity 142 may be realized by a memory.
  • different types of cache spaces ie, the first cache space and the second cache space
  • the same memory may be implemented by the same memory.
  • different types of cache spaces in the cache entity 142 may be implemented by different memories.
  • the cache entity 142 may be realized by four memories.
  • Memory 1 can be used as a first buffer space
  • memory 2 can be used as a second buffer space corresponding to port 111
  • memory 3 can be used as a second buffer space corresponding to port 112
  • memory 4 can be used as a corresponding The second buffer space at port 113.
  • the memory in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory.
  • the non-volatile memory can be read-only memory (ROM), programmable read-only memory (programmable ROM, PROM), erasable programmable read-only memory (erasable PROM, EPROM), and electrically available Erase programmable read-only memory (electrically EPROM, EEPROM) or flash memory.
  • the volatile memory may be random access memory (RAM), which is used as an external cache.
  • RAM random access memory
  • static random access memory static random access memory
  • dynamic RAM dynamic RAM
  • DRAM dynamic random access memory
  • synchronous dynamic random access memory synchronous DRAM, SDRAM
  • double data rate synchronous dynamic random access memory double data rate SDRAM, DDR SDRAM
  • enhanced synchronous dynamic random access memory enhanced SDRAM, ESDRAM
  • synchronous connection dynamic random access memory serial DRAM, SLDRAM
  • direct rambus RAM direct rambus RAM
  • the policy management entity 141 and the message processing entity 143 may be implemented by the same processor or system on chip (SoC).
  • the processor may be a central processing unit (central processing until, CPU) or a network processor (network processor, NP).
  • the policy management entity 141 and the message processing entity 143 may be implemented by different processors.
  • the message processing entity 143 may be a central processing until (CPU) or a network processor (NP)
  • the policy management entity 141 may be an application specific integrated circuit (ASIC).
  • the message processing entity 143 may be implemented by an ASIC
  • the policy management entity 141 may be implemented by another ASIC.
  • Fig. 7 is a structural block diagram of a network device provided according to an embodiment of the present application.
  • the network device 700 shown in FIG. 7 includes a processor 701, a memory 702, a receiver 703, and a transmitter 704.
  • the processor 701, the memory 702, the receiver 703, and the transmitter 704 can communicate through a bus 705.
  • the processor 701 is the control center of the network device 700, and provides sequencing and processing facilities for executing instructions, executing interrupt actions, providing timing functions, and other functions.
  • the processor 701 includes one or more central processing units (CPUs).
  • the network device 700 includes multiple processors.
  • the processor 701 may be a single-core (single CPU) processor or a multi-core (multi-CPU) processor.
  • the processor 701 may also be an application specific integrated circuit (ASIC), a system on chip (SoC), a network processor (NP), or a digital signal processing Circuit (digital signal processor, DSP), microcontroller (microcontroller unit, MCU), programmable logic device (PLD), other programmable logic devices, discrete gates, or transistor logic devices , Discrete hardware components, or other integrated chips, etc.
  • ASIC application specific integrated circuit
  • SoC system on chip
  • NP network processor
  • DSP digital signal processing Circuit
  • microcontroller microcontroller unit, MCU
  • PLD programmable logic device
  • other programmable logic devices discrete gates, or transistor logic devices , Discrete hardware components, or other integrated chips, etc.
  • the program code executed by the processor 701 may be stored in the memory 702.
  • the processor 701 controls the communication with peripheral devices by controlling the execution of other programs or processes, thereby controlling the operation of the network device 700, so as to implement the operation steps of the foregoing method.
  • the memory 702 may also be used to store messages from upstream devices.
  • the receiver 703 is used to receive a message from an upstream device.
  • the transmitter 704 is configured to send the message stored in the memory to the downstream device.
  • bus 705 may also include a power bus, a control bus, a status signal bus, and the like. However, for clear description, various buses are marked as bus 705 in the figure.
  • Fig. 8 is a structural block diagram of a network device provided according to an embodiment of the present application.
  • the network device 800 shown in FIG. 8 includes: a first processor 801, a second processor 802, a first memory 803, a second memory 804, a receiver 805, and a transmitter 806.
  • the receiver 805 and the transmitter 806 have the same implementation manners and functions as the receiver 703 and the transmitter 704 in the network device 700 shown in FIG. 7, and will not be repeated here for brevity.
  • the first processor 801 may be used to implement the function of the policy management entity in the foregoing embodiment.
  • the second processor 802 may be used to implement the function of the message processing entity in the foregoing embodiment.
  • the first memory 803 may be used to store program codes executed by the first processor 801 and the second processor 802.
  • the second memory 804 may be used to buffer messages from the upstream device.
  • the embodiment of the present application also provides a chip, which includes a logic circuit and an input/output interface.
  • the logic circuit may be coupled with the memory to execute instructions and/or codes in the memory to realize the functions performed by the policy management entity in the foregoing embodiments.
  • the embodiment of the present application also provides a chip, which includes a logic circuit and an input/output interface.
  • the logic circuit may be coupled with the memory for executing instructions and/or codes in the memory, and the chip may perform the functions performed by the message processing entity in the foregoing embodiments.
  • the embodiment of the present application also provides a chip, which includes a logic circuit and an input/output interface.
  • the logic circuit may be coupled with the memory to execute instructions and/or codes in the memory, and the chip may perform the functions performed by the policy management entity and the message processing entity in the foregoing embodiments.
  • the aforementioned chip can be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), or a central processing unit.
  • the central processor unit (CPU) can also be a network processor (NP), a digital signal processing circuit (digital signal processor, DSP), or a microcontroller (microcontroller unit, MCU) It may also be a programmable logic device (PLD), other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, or other integrated chips.
  • the embodiment of the present application also provides a computer-readable storage medium on which an instruction is stored, and the method in the foregoing method embodiment is executed when the instruction is executed.
  • An embodiment of the present application also provides a computer-readable storage medium on which an instruction is stored, and when the instruction is executed, the steps performed by the policy management entity in the foregoing method embodiment are executed.
  • the embodiment of the present application also provides a computer-readable storage medium on which an instruction is stored, and when the instruction is executed, the steps performed by the message processing entity in the foregoing method embodiment are executed.
  • a computer program product containing instructions is provided, and when the instructions are executed, the method in the foregoing method embodiment is executed.
  • a computer program product containing instructions is provided, and when the instructions are executed, the steps performed by the policy management entity in the foregoing method embodiments are executed.
  • a computer program product containing instructions is provided, and when the instructions are executed, the steps performed by the message processing entity in the foregoing method embodiments are executed.
  • the disclosed system, device, and method can be implemented in other ways.
  • the device embodiments described above are merely illustrative.
  • the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or It can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the technical solution of the present application essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program code .

Landscapes

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

Abstract

Provided are a method for controlling congestion, and a related device. The method comprises: a policy management entity in a network device determining a message processing policy according to the state of a cached entity, and sending the determined message processing policy to a message processing entity; and the message processing entity processing a new received message according to the message processing policy. In the technical solution, the message processing entity can execute the corresponding message processing policy according to the state of the cached entity, so as to process the new received message. In this way, the cached entity can be better managed, so as to reduce the occurrence of cache management exception of the cached entity.

Description

网络设备中处理报文的方法和相关设备Method for processing messages in network equipment and related equipment
本申请要求于2020年04月17日提交中国专利局、申请号为202010307569.8、申请名称为“网络设备中处理报文的方法和相关设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed with the Chinese Patent Office on April 17, 2020, the application number is 202010307569.8, and the application name is "methods for processing messages in network equipment and related equipment", the entire content of which is incorporated by reference In this application.
技术领域Technical field
本申请涉及信息技术领域,更具体地,涉及网络设备中处理报文的方法和相关设备。This application relates to the field of information technology, and more specifically, to a method for processing packets in network equipment and related equipment.
背景技术Background technique
目前,一些网络设备为了避免拥塞,采用了如下策略:如果确定该网络设备的出端口发生拥塞,则请求上游设备停止发送通过该出端口发送的报文。但是该网络设备向该上游设备发送通知需要一定的时间,并且上游设备也可能需要一定的时间才能响应该通知。在这段时间内,该上游设备还会继续向该网络设备发送报文。为了避免拥塞的发生,该网络设备内设置的缓存可以用于缓存在这段时间内接收到的来自于该上游设备的报文。At present, in order to avoid congestion, some network devices adopt the following strategy: if it is determined that the egress port of the network device is congested, the upstream device is requested to stop sending packets sent through the egress port. However, it takes a certain time for the network device to send a notification to the upstream device, and it may also take a certain time for the upstream device to respond to the notification. During this period of time, the upstream device will continue to send packets to the network device. In order to avoid the occurrence of congestion, the buffer set in the network device can be used to buffer the packets received from the upstream device within this period of time.
但是,在一些情况下,上游设备可能没有正常响应网络设备发送的请求,继续向网络设备发送报文。这时网络设备可能无法缓存新接收到的报文。However, in some cases, the upstream device may not normally respond to the request sent by the network device and continue to send packets to the network device. At this time, the network device may not be able to buffer the newly received message.
此外,网络设备通常是根据预先配置的规则对缓存空间进行管理。但是如果预先配置的规则发生错误,那么缓存空间也可能发生异常情况。In addition, network devices usually manage the cache space according to pre-configured rules. But if an error occurs in the pre-configured rules, an abnormal situation may also occur in the cache space.
发明内容Summary of the invention
本申请提供一种网络设备中处理报文的方法和相关设备,可以减少缓存空间出现的问题。The present application provides a method for processing messages in a network device and related devices, which can reduce the problem of cache space.
第一方面,本申请实施例提供一种网络设备中处理报文的方法,该网络设备包括策略管理实体,缓存实体和报文处理实体,该方法包括:该策略管理实体获取第一缓存状态信息,该第一缓存状态信息指示该缓存实体在第一时刻的第一状态;该策略管理实体根据该第一缓存状态信息,确定第一报文处理策略,并将该第一报文处理策略发送至该报文处理实体;该报文处理实体根据该第一报文处理策略对新接收到的报文进行处理。上述技术方案中,报文处理实体可以根据缓存实体的状态来执行相应的报文处理策略,以处理新接收到的报文。这样可以更好地对缓存实体进行管理,以减少缓存实体出现缓存管理异常的情况发生。In a first aspect, an embodiment of the present application provides a method for processing a message in a network device. The network device includes a policy management entity, a cache entity, and a message processing entity. The method includes: the policy management entity obtains first cache status information , The first cache state information indicates the first state of the cache entity at the first moment; the policy management entity determines a first packet processing strategy according to the first cache state information, and sends the first packet processing strategy To the message processing entity; the message processing entity processes the newly received message according to the first message processing strategy. In the above technical solution, the message processing entity may execute a corresponding message processing strategy according to the state of the cache entity to process the newly received message. In this way, the cache entity can be better managed to reduce the occurrence of cache management exceptions in the cache entity.
一种具体的设计中,该策略管理实体获取第一缓存状态信息之前,该方法还包括:该策略管理实体获取该缓存实体在该第一时刻的以下至少一种信息:发送队列的长度,该发送队列的缓存占用量,该发送队列的时延,该缓存实体的可用容量,该缓存实体的已用容量,该缓存实体的出端口的速率;该策略管理实体根据获取的该至少一种信息,确定该第一缓存状态信息。In a specific design, before the policy management entity obtains the first cache status information, the method further includes: the policy management entity obtains at least one of the following information of the cache entity at the first moment: the length of the sending queue, the The buffer occupancy of the sending queue, the delay of the sending queue, the available capacity of the buffer entity, the used capacity of the buffer entity, the rate of the outgoing port of the buffer entity; the policy management entity obtains the at least one kind of information according to , Determine the first cache status information.
一种具体的设计中,该方法还包括:该缓存实体确定该第一缓存状态信息;该策略管理实体获取第一缓存状态信息,包括:该策略管理实体从该缓存实体获取该第一缓存状态信息。In a specific design, the method further includes: the cache entity determining the first cache state information; the policy management entity obtaining the first cache state information includes: the policy management entity obtains the first cache state from the cache entity information.
一种具体的设计中,该策略管理实体从该缓存实体获取该第一缓存状态信息包括:该策略管理实体接收该缓存实体发送的该第一缓存状态信息。上述实施例中,缓存实体可以自行将缓存状态信息发送给策略管理实体。这样可以减少策略管理实体的工作负担。In a specific design, that the policy management entity obtains the first cache state information from the cache entity includes: the policy management entity receives the first cache state information sent by the cache entity. In the foregoing embodiment, the cache entity may send the cache status information to the policy management entity by itself. This can reduce the workload of the policy management entity.
一种具体的设计中,在该缓存实体向该策略管理实体发送该第一缓存状态信息之前,该方法还包括:该缓存实体确定该第一状态满足第一预设条件。上述技术方案中,缓存实体只有在状态满足预设条件的情况下将缓存状态信息发送至策略管理实体,这样可以减少对缓存实体的出接口的占用,并且可以减轻策略管理实体工作负担。In a specific design, before the cache entity sends the first cache state information to the policy management entity, the method further includes: the cache entity determines that the first state satisfies a first preset condition. In the above technical solution, the cache entity sends the cache state information to the policy management entity only when the state meets the preset condition, which can reduce the occupation of the outbound interface of the cache entity and can reduce the workload of the policy management entity.
一种具体的设计中,该第一状态包括正常或异常。In a specific design, the first state includes normal or abnormal.
一种具体的设计中,该第一状态包括以下至少一项:发送队列的长度,该发送队列的缓存占用量,该发送队列的时延,该缓存实体的可用容量,该缓存实体的已用容量,该缓存实体的出端口的速率。In a specific design, the first state includes at least one of the following: the length of the sending queue, the buffer occupancy of the sending queue, the delay of the sending queue, the available capacity of the buffer entity, and the used capacity of the buffer entity Capacity, the rate of the outgoing port of the cache entity.
一种具体的设计中,在该策略管理实体根据该第一缓存状态信息,确定第一报文处理策略之前,该方法还包括:该策略管理实体确定该第一缓存状态信息满足第二预设条件。In a specific design, before the policy management entity determines the first message processing strategy based on the first cache state information, the method further includes: the policy management entity determines that the first cache state information satisfies a second preset condition.
一种具体的设计中,该缓存实体包括目标缓存空间,该第一状态包括该目标缓存空间在该第一时刻的使用情况;该策略管理实体根据该第一缓存状态信息,确定第一报文处理策略,包括:该策略管理实体根据该目标缓存空间在该第一时刻的使用情况,确定该第一报文处理策略。In a specific design, the cache entity includes a target cache space, the first state includes the usage of the target cache space at the first moment; the policy management entity determines the first message according to the first cache state information The processing strategy includes: the strategy management entity determines the first packet processing strategy according to the usage of the target cache space at the first moment.
一种具体的设计中,该方法还包括:该策略管理实体获取第二缓存状态信息,该第二缓存状态信息指示该缓存实体在第二时刻的第二状态;该策略管理实体根据该第二缓存状态信息,确定第二报文处理策略,并将该第二报文处理策略发送至该报文处理实体;该报文处理实体根据该第二报文处理策略处理新接收到的报文。In a specific design, the method further includes: the policy management entity obtains second cache state information, the second cache state information indicating the second state of the cache entity at the second moment; the policy management entity according to the second state Cache status information, determine a second message processing strategy, and send the second message processing strategy to the message processing entity; the message processing entity processes the newly received message according to the second message processing strategy.
一种具体的设计中,该第二报文处理策略用于指示该报文处理实体不再执行该第一报文处理策略。In a specific design, the second message processing strategy is used to instruct the message processing entity to no longer execute the first message processing strategy.
一种具体的设计中,该第二报文处理策略还用于指示该报文处理实体使用指定报文处理策略处理新接收到的报文。In a specific design, the second message processing strategy is also used to instruct the message processing entity to use the specified message processing strategy to process the newly received message.
一种具体的设计中,该指定报文处理策略为默认的报文处理策略或者在使用该第一报文处理策略之前使用的报文处理策略。In a specific design, the designated message processing strategy is the default message processing strategy or the message processing strategy used before the first message processing strategy is used.
一种具体的设计中,该新接收的报文包括无损流量报文。In a specific design, the newly received message includes a lossless traffic message.
一种具体的设计中,该报文处理实体根据该第一报文处理策略对新接收到的报文进行处理,包括:该报文处理实体采用以下一种或多种处理方式:丢弃所有新接收到的报文;丢弃部分新接收到的报文;对所有新接收的报文的报文信息进行修改;或者,对部分新接收到的报文的报文信息进行修改。In a specific design, the message processing entity processes the newly received message according to the first message processing strategy, including: the message processing entity adopts one or more of the following processing methods: discarding all new messages Received messages; discard part of the newly received messages; modify the message information of all newly received messages; or modify the message information of some newly received messages.
一种具体的设计中,修改新接收到的报文的报文信息包括:对该新接收到的报文的以下一种或多种信息进行修改:该新接收到的报文的优先级;该新接收到的报文的丢弃使能位;该新接收到的报文的丢弃优先级;该新接收到的报文的端口号;或者,该新接收到的报文的显示拥塞标志位。In a specific design, modifying the message information of the newly received message includes: modifying one or more of the following information of the newly received message: the priority of the newly received message; The discard enable bit of the newly received message; the discard priority of the newly received message; the port number of the newly received message; or, the display congestion flag of the newly received message .
第二方面,本申请实施例提供一种网络设备,该网络设备包括网络设备包括策略管理实体,缓存实体和报文处理实体。该策略管理实体,该缓存实体和该报文处理实体用于实现第一方面或第一方面的任一种设计。In a second aspect, an embodiment of the present application provides a network device. The network device includes a network device including a policy management entity, a cache entity, and a message processing entity. The policy management entity, the cache entity, and the message processing entity are used to implement the first aspect or any one of the designs of the first aspect.
第三方面,本申请实施例提供一种网络设备,该网络设备包括第一处理器,第二处理器,第一存储器和第二存储器,第一存储器用于存储第一处理器和第二处理器执行的程序代码。第二存储器用于缓存来自于上游设备的报文。该第一处理器执行第一存储器保存程序代码,以实现第一方面或第一方面的任一种设计中策略管理实体的功能,该第二处理器执行第一存储器保存程序代码,以实现第一方面或第一方面的任一种设计中报文处理实体的功能。In a third aspect, an embodiment of the present application provides a network device. The network device includes a first processor, a second processor, a first memory, and a second memory. The first memory is used to store the first processor and the second processor. The program code executed by the device. The second memory is used to buffer messages from the upstream device. The first processor executes the program code stored in the first memory to realize the function of the policy management entity in the first aspect or any design of the first aspect, and the second processor executes the program code stored in the first memory to implement the first aspect. The function of the message processing entity in one aspect or any design of the first aspect.
第四方面,本申请实施例提供一种计算机可读存储介质,该计算机可读存储介质存储包括用于实现第一方面或第一方面的任一种可能的实现方式所述的方法的指令。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores instructions for implementing the first aspect or the method described in any one of the possible implementation manners of the first aspect.
第五方面,本申请提供了一种包含指令的计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机执行上述第一方面或第一方面的任一种可能的实现方式所述的方法。In the fifth aspect, this application provides a computer program product containing instructions, when the computer program product is run on a computer, the computer can execute the above-mentioned first aspect or any one of the possible implementations of the first aspect. method.
附图说明Description of the drawings
图1是一个网络的示意图。Figure 1 is a schematic diagram of a network.
图2是网络设备的示意性结构框图。Figure 2 is a schematic structural block diagram of a network device.
图3是根据本申请实施例提供的一种网络设备中处理报文的方法的示意性流程图。Fig. 3 is a schematic flowchart of a method for processing a packet in a network device according to an embodiment of the present application.
图4是保留缓存空间,共享缓存空间和净空缓存空间的示意图。Figure 4 is a schematic diagram of reserved cache space, shared cache space and headroom cache space.
图5是保留缓存空间,共享缓存空间和净空缓存空间的另一示意图。Figure 5 is another schematic diagram of reserved cache space, shared cache space and headroom cache space.
图6是根据本申请实施例提供的一种网络设备中处理报文的方法的示意性流程图。Fig. 6 is a schematic flowchart of a method for processing a packet in a network device according to an embodiment of the present application.
图7是根据本申请实施例提供的网络设备的结构框图。Fig. 7 is a structural block diagram of a network device provided according to an embodiment of the present application.
图8是根据本申请实施例提供的网络设备的结构框图。Fig. 8 is a structural block diagram of a network device provided according to an embodiment of the present application.
具体实施方式Detailed ways
下面将结合附图,对本申请中的技术方案进行描述。The technical solution in this application will be described below in conjunction with the accompanying drawings.
本申请实施例中的网络设备可以是具有路由功能的网络设备(例如路由器)或者具有交换功能的网络设备(例如交换机)。本申请实施例中的网络设备可以是有线通信网络中的网络设备,也可以是无线通信网络(例如全球移动通讯(Global System of Mobile communication,GSM)系统、码分多址(Code Division Multiple Access,CDMA)系统、长期演进(Long Term Evolution,LTE)系统以及未来5G网络等)中的核心网设备。The network device in the embodiment of the present application may be a network device with a routing function (for example, a router) or a network device with a switching function (for example, a switch). The network equipment in the embodiments of this application may be a network equipment in a wired communication network, or a wireless communication network (such as the Global System of Mobile Communication, GSM) system, Code Division Multiple Access, CDMA) systems, Long Term Evolution (LTE) systems, and future 5G networks, etc.).
本申请将围绕可包括多个设备、组件、模块等的系统来呈现各个方面、实施例或特征。应当理解和明白的是,各个系统可以包括另外的设备、组件、模块等,并且/或者可以并不包括结合附图讨论的所有设备、组件、模块等。此外,还可以使用这些方案的组合。This application will present various aspects, embodiments, or features around a system that may include multiple devices, components, modules, and the like. It should be understood and understood that each system may include additional devices, components, modules, etc., and/or may not include all the devices, components, modules, etc. discussed in conjunction with the accompanying drawings. In addition, a combination of these schemes can also be used.
另外,在本申请实施例中,“示例的”、“例如”等词用于表示作例子、例证或说明。本申请中被描述为“示例”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用示例的一词旨在以具体方式呈现概念。In addition, in the embodiments of the present application, words such as "exemplary" and "for example" are used to represent examples, illustrations, or illustrations. Any embodiment or design solution described as an "example" in this application should not be construed as being more preferable or advantageous than other embodiments or design solutions. Rather, the term example is used to present the concept in a concrete way.
本申请实施例中,“相应的(corresponding,relevant)”和“对应的(corresponding)”有 时可以混用,应当指出的是,在不强调其区别时,其所要表达的含义是一致的。In the embodiments of this application, "corresponding (relevant)" and "corresponding" can sometimes be used together. It should be pointed out that the meanings to be expressed are the same when the difference is not emphasized.
本申请实施例中,有时候下标如W 1可能会笔误为非下标的形式如W1,在不强调其区别时,其所要表达的含义是一致的。 Embodiment of the present application, the subscript sometimes as W 1 may form a clerical error at non-target as W1, while not emphasize the difference, to express their meaning is the same.
本申请实施例描述的网络架构以及业务场景是为了更加清楚的说明本申请实施例的技术方案,并不构成对于本申请实施例提供的技术方案的限定,本领域普通技术人员可知,随着网络架构的演变和新业务场景的出现,本申请实施例提供的技术方案对于类似的技术问题,同样适用。The network architecture and business scenarios described in the embodiments of this application are intended to more clearly illustrate the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided in the embodiments of this application. Those of ordinary skill in the art will know that with the network With the evolution of architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are equally applicable to similar technical problems.
在本说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。References described in this specification to "one embodiment" or "some embodiments", etc. mean that one or more embodiments of the present application include a specific feature, structure, or characteristic described in combination with the embodiment. Therefore, the sentences "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. appearing in different places in this specification are not necessarily All refer to the same embodiment, but mean "one or more but not all embodiments" unless it is specifically emphasized otherwise. The terms "including", "including", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.
本申请中,“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一项(个)”或其类似表达,是指的这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a,b,或c中的至少一项(个),可以表示:a,b,c,a-b,a-c,b-c,或a-b-c,其中a,b,c可以是单个,也可以是多个。In this application, "at least one" refers to one or more, and "multiple" refers to two or more. "And/or" describes the association relationship of the associated objects, indicating that there can be three relationships, for example, A and/or B, which can mean: A alone exists, A and B exist at the same time, and B exists alone, where A, B can be singular or plural. The character "/" generally indicates that the associated objects before and after are in an "or" relationship. "The following at least one item (a)" or similar expressions refers to any combination of these items, including any combination of a single item (a) or a plurality of items (a). For example, at least one item (a) of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple .
图1是一个网络的示意图。如图1所示,网络100中包括网络设备110、上游设备121,上游设备122,上游设备123,上游设备124,上游设备125,下游设备131,下游设备132,下游设备133,下游设备134和下游设备135。上游设备可以是终端设备,例如计算机、手机、平板电脑等,或者是网络设备。类似的,下游设备可以是终端设备或者网络设备。Figure 1 is a schematic diagram of a network. As shown in Figure 1, the network 100 includes a network device 110, an upstream device 121, an upstream device 122, an upstream device 123, an upstream device 124, an upstream device 125, a downstream device 131, a downstream device 132, a downstream device 133, a downstream device 134 and Downstream equipment 135. The upstream device can be a terminal device, such as a computer, a mobile phone, a tablet computer, etc., or a network device. Similarly, the downstream device can be a terminal device or a network device.
如图1所示,网络设备110可以通过端口111接收来自于上游设备121,上游设备122和上游设备123的报文(packet)。网络设备110可以通过端口112接收来自于上游设备124的报文。网络设备110可以通过端口113接收来自于上游设备115的报文。As shown in FIG. 1, the network device 110 can receive packets from the upstream device 121, the upstream device 122, and the upstream device 123 through the port 111. The network device 110 can receive packets from the upstream device 124 through the port 112. The network device 110 can receive packets from the upstream device 115 through the port 113.
网络设备110可以通过端口114将报文发送至下游设备131和下游设备132。网络设备110可以通过端口115将报文发送至下游设备133,下游设备134和下游设备135。The network device 110 may send packets to the downstream device 131 and the downstream device 132 through the port 114. The network device 110 may send the message to the downstream device 133, the downstream device 134, and the downstream device 135 through the port 115.
可以理解的是,图1仅是为了帮助本领域技术人员理解本申请方法的一个网络的示意图,而并非是对能够应用本申请技术方案的网络的限制。例如,在一些实施例中,网络设备110还可以通过端口111接收来除了上游设备121和上游设备122以外的一个或者多个上游设备发送的报文。又如,网络设备110还可以通过另外一个端口接收来自于一个或多个上游设备发送的报文。又如,网络设备110还可以通过端口114向除下游设备131和下游设备132以外的一个或多个下游设备发送报文。又如,网络设备110还可以通过另外一个端口向一个或多个下游设备发送报文。It is understandable that FIG. 1 is only a schematic diagram of a network to help those skilled in the art understand the method of the present application, and is not a limitation on the network to which the technical solution of the present application can be applied. For example, in some embodiments, the network device 110 may also receive a packet sent by one or more upstream devices other than the upstream device 121 and the upstream device 122 through the port 111. For another example, the network device 110 may also receive packets sent from one or more upstream devices through another port. For another example, the network device 110 may also send a packet to one or more downstream devices other than the downstream device 131 and the downstream device 132 through the port 114. For another example, the network device 110 may also send packets to one or more downstream devices through another port.
网络设备中用于接收来自于上游设备的报文的端口(例如端口111,端口112和端口113)可以称为网络设备的入端口(简称入端口)。网络设备中用于向下游设备发送报文的端口(例如端口114和端口115)可以称为网络设备的出端口(简称出端口)。The ports (for example, port 111, port 112, and port 113) in the network device for receiving packets from the upstream device may be referred to as the ingress port of the network device (abbreviated as the ingress port). The ports (for example, port 114 and port 115) in the network device used to send packets to the downstream device may be referred to as the outgoing port of the network device (abbreviated as the outgoing port).
图2是根据本申请实施例提供的网络设备的示意性结构框图。如图2所示是如图1所 示的网络设备110的示意性结构框图。Fig. 2 is a schematic structural block diagram of a network device provided according to an embodiment of the present application. Fig. 2 is a schematic structural block diagram of the network device 110 shown in Fig. 1.
如图2所示,网络设备110包括:策略管理实体141,缓存实体142和报文处理实体143。此外,网络设备110还可以包括端口111,端口112和端口113,端口114和端口115。As shown in FIG. 2, the network device 110 includes: a policy management entity 141, a cache entity 142, and a message processing entity 143. In addition, the network device 110 may also include a port 111, a port 112 and a port 113, and a port 114 and a port 115.
端口111至端口113是入端口。端口111至端口113可以用于接收来自于上游设备的报文,并将接收到的报文发送至报文处理实体143。 Port 111 to port 113 are ingress ports. Port 111 to port 113 can be used to receive messages from upstream devices and send the received messages to the message processing entity 143.
报文处理实体143用于来自于入端口的报文进行处理。例如,报文处理实体143可以确定是否允许报文通过。如果允许报文通过,则可以将该报文发送至缓存实体142。如果不允许报文通过,则可以删除该报文,或者,将在报文头信息增加丢弃使能,并将修改后的报文发送至缓存实体142。缓存实体142在接收到包含丢弃使能的报文后,可以丢弃该报文。又如,报文处理实体143还可以修改报文的优先级、出端口等信息。The message processing entity 143 is used for processing messages from the ingress port. For example, the message processing entity 143 can determine whether to allow the message to pass through. If the message is allowed to pass, the message can be sent to the cache entity 142. If the message is not allowed to pass, the message can be deleted, or the discard enable is added to the message header information, and the modified message is sent to the cache entity 142. The cache entity 142 may discard the message after receiving the message containing the discard enable. For another example, the message processing entity 143 can also modify information such as the priority and the outgoing port of the message.
缓存实体142在获取到来自于报文处理实体143的报文后,如果确定不需要丢弃该报文,则可以缓存报文,并通过对应的出端口(例如端口114或端口115)将缓存的报文发送至下游设备。After the cache entity 142 obtains the message from the message processing entity 143, if it determines that the message does not need to be discarded, it can cache the message, and cache the message through the corresponding out port (for example, port 114 or port 115). The message is sent to the downstream device.
策略管理实体141可以根据缓存实体142的状态确定报文处理策略。报文处理实体143可以获取策略管理实体141确定的报文处理策略,并执行该报文处理策略。The policy management entity 141 may determine the message processing policy according to the state of the cache entity 142. The message processing entity 143 may obtain the message processing strategy determined by the policy management entity 141, and execute the message processing strategy.
策略管理实体141,缓存实体142和报文处理实体143的具体功能和有益效果,将结合以下实施例进行详细描述。The specific functions and beneficial effects of the policy management entity 141, the cache entity 142, and the message processing entity 143 will be described in detail with reference to the following embodiments.
下面结合图1至图5对本申请提供的网络设备中处理报文的方法进行介绍。The method for processing packets in the network device provided by the present application will be introduced below in conjunction with FIG. 1 to FIG. 5.
网络设备(例如网络设备110)通过入端口接收上游设备发送的报文,并通过出端口将报文发送至相应的下游设备。在一些情况下,该网络设备由于一些原因(例如出端口发生拥塞,入端口接收报文的流量大于出端口发送报文的流量等),无法及时将来自于上游设备的报文发送至下游设备。在此情况下,该网络设备可以将没有及时发送的报文缓存到该网络和设备的缓存实体(例如缓存实体142)中,并等待出端口能够发送这些报文时,将缓存实体缓存的报文发送至下游设备。The network device (for example, the network device 110) receives the message sent by the upstream device through the ingress port, and sends the message to the corresponding downstream device through the egress port. In some cases, the network device is unable to send packets from the upstream device to the downstream device in time due to some reasons (such as congestion on the outbound port, the flow of packets received on the ingress port is greater than the flow of packets sent on the outbound port, etc.) . In this case, the network device can cache the messages that were not sent in time to the cache entity (such as the cache entity 142) of the network and the device, and wait for the outgoing port to be able to send these messages, and then cache the messages cached by the cache entity. The document is sent to the downstream device.
根据功能的不同,缓存实体中用于缓存报文的缓存空间可以分为两类,分别可以称为第一缓存空间和第二缓存空间。According to different functions, the buffer space used for buffering messages in the buffer entity can be divided into two types, which can be called the first buffer space and the second buffer space respectively.
第一缓存空间可以由不同类型的报文共享。换句话说,第一缓存空间可以保存任意一个或多个类型的报文,并且对于该任意一个或多个类型的报文,只要该第一缓存空间还有可用容量,报文就可以缓存至第一缓存空间。例如,该第一缓存空间可以全部用于保存类型1的报文。The first buffer space can be shared by different types of messages. In other words, the first buffer space can store any one or more types of messages, and for any one or more types of messages, as long as the first buffer space has available capacity, the messages can be cached to The first buffer space. For example, the first buffer space can all be used to store type 1 messages.
第二缓存空间可以包括多个子缓存空间。该多个子缓存空间,该多个子缓存空间与多个类型一一对应,该多个子缓存空间中的每个子缓存空间用于保存对应类型的报文。例如,假设该第二缓存空间的总容量大小为512MB,该第二缓存空间包括8个子缓存空间,该8个子缓存空间中每个子缓存空间的容量大小可以为64MB。该8个子缓存空间与8个类型一一对应。该8个类型可以分别称为类型0,类型1,……,类型7。该8个子缓存空间可以分别称为子缓存空间0,子缓存空间1,……,子缓存空间7。子缓存空间0用于保存类型0的报文,子缓存空间1用于保存类型1的报文,子缓存空间2用于保存类型2的报文,以此类推。换句话说,第二缓存空间中最多可以保存大小为64MB的类型0的报文, 大小为64MB的类型1的报文,大小为64MB的类型2的报文,以此类推。The second cache space may include multiple sub-cache spaces. The multiple sub-cache spaces, the multiple sub-cache spaces have a one-to-one correspondence with the multiple types, and each sub-cache space in the multiple sub-cache spaces is used to store messages of a corresponding type. For example, assuming that the total capacity of the second cache space is 512MB, the second cache space includes 8 sub-cache spaces, and the capacity of each sub-cache space in the 8 sub-cache spaces may be 64 MB. The 8 sub-buffer spaces correspond to the 8 types in a one-to-one manner. The 8 types can be called type 0, type 1, ..., type 7, respectively. The eight sub-cache spaces may be referred to as sub-cache space 0, sub-cache space 1, ..., sub-cache space 7, respectively. Sub-buffer space 0 is used to store type 0 messages, sub-buffer space 1 is used to store type 1 messages, sub-buffer space 2 is used to store type 2 messages, and so on. In other words, the second buffer space can store at most type 0 messages with a size of 64 MB, type 1 messages with a size of 64 MB, type 2 messages with a size of 64 MB, and so on.
上述实施例中,不同类型的报文的子缓存空间的容量大小是一样的。在另一些实施例中,不同子缓存空间的大小可以是不同的。还以总大小为512MB的第二缓存空间为例。假设第二缓存空间共包括6个子缓存空间,分别为子缓存空间0至子缓存空间5。子缓存空间0至子缓存空间5分别用于缓存类型0至类型5的报文。子缓存空间0和子缓存空间1的容量大小可以为128MB;子缓存空间2至子缓存空间5中的每个子缓存空间的容量大小为64MB。In the foregoing embodiment, the capacity of the sub-buffer space of different types of messages is the same. In other embodiments, the sizes of different sub-buffer spaces may be different. Also take the second cache space with a total size of 512MB as an example. Assume that the second cache space includes 6 sub-cache spaces in total, which are sub-cache space 0 to sub-cache space 5, respectively. Sub-buffer space 0 to sub-buffer space 5 are respectively used for buffering type 0 to type 5 messages. The size of the sub-cache space 0 and the sub-cache space 1 may be 128MB; the size of each sub-cache space from the sub-cache space 2 to the sub-cache space 5 is 64MB.
上述子缓存空间是按照容量划分的。在另一些实施例中,子缓存空间也可以按照最多能缓存的报文数目划分。还以上述子缓存空间0至子缓存空间7为例。在一些实施例中,每个子缓存空间能缓存的报文数目是相同的。例如,8个子缓存空间中的每个子缓存空间可以缓存100个报文。在另一些实施例中,不同的子缓存空间能缓存的报文数目可能是不同的。例如,子缓存空间0至子缓存空间3中的每个子缓存空间可以缓存200个报文,子缓存空间4至子缓存空间7中的每个子缓存空间可以缓存100个报文。The above-mentioned sub-buffer space is divided according to capacity. In other embodiments, the sub-buffer space may also be divided according to the maximum number of messages that can be buffered. Also take the foregoing sub-cache space 0 to sub-cache space 7 as an example. In some embodiments, the number of messages that can be buffered in each sub-buffer space is the same. For example, each of the 8 sub-buffer spaces can buffer 100 messages. In other embodiments, the number of messages that can be buffered in different sub-buffer spaces may be different. For example, each sub-cache space from sub-cache space 0 to sub-cache space 3 can buffer 200 messages, and each sub-cache space from sub-cache space 4 to sub-cache space 7 can buffer 100 messages.
在一些实施例中,报文的类型可以根据报文的服务等级(Class of Service,CoS)确定。电气和电子工程师协会(Institute of Electrical and Electronics Engineers,IEEE)802.1p定义了CoS。IEEE802.1p共规定了8个CoS,分别为0至7。CoS值为0的优先级最低,CoS值为7的优先级最高。网络设备可以根据接收到的报文的二层报文头中的CoS字段和虚拟局域网(Virtual Local Area Network)标识(identification,ID)确定该报文的CoS。例如,若报文是携带有CoS值和VLAN ID的报文,则该报文的CoS为该报文携带的CoS值;若该报文是只携带CoS值(此时VLAN ID为0)的报文,则该报文的CoS为该报文携带的CoS值;若该报文是携带标签的报文,那么该报文的CoS默认为0或者进行更改指定新的CoS。In some embodiments, the type of the message may be determined according to the class of service (CoS) of the message. The Institute of Electrical and Electronics Engineers (IEEE) 802.1p defines CoS. IEEE802.1p stipulates a total of 8 CoS, which are 0 to 7. A CoS value of 0 has the lowest priority, and a CoS value of 7 has the highest priority. The network device can determine the CoS of the message according to the CoS field in the Layer 2 header of the received message and the virtual local area network (Virtual Local Area Network) identification (ID). For example, if the message is a message that carries the CoS value and VLAN ID, the CoS of the message is the CoS value carried in the message; if the message only carries the CoS value (the VLAN ID is 0 at this time) If the message is a message, the CoS of the message is the CoS value carried by the message; if the message is a message carrying a label, then the CoS of the message is 0 by default or a new CoS can be specified by changing it.
在一些实施例中,报文的类型可以和报文的CoS一一对应。例如,报文的类型和报文的CoS的对应关系可以如表1所示。In some embodiments, the type of the message may correspond to the CoS of the message on a one-to-one basis. For example, the correspondence between the message type and the CoS of the message can be as shown in Table 1.
表1Table 1
类型type CoSCoS
00 00
11 11
22 22
33 33
44 44
55 55
66 66
77 77
如表1所示,若报文的CoS为0,则该报文的类型为0;若报文的CoS为1,则该报文的类型为1,以此类推。As shown in Table 1, if the CoS of the message is 0, the type of the message is 0; if the CoS of the message is 1, the type of the message is 1, and so on.
在另一些实施例中,报文的类型和报文的CoS的对应关系也可以多个CoS对应于一 个类型。例如,报文的类型和报文的CoS的对应关系可以如表2所示。In other embodiments, the correspondence between the type of the message and the CoS of the message may also have multiple CoS corresponding to one type. For example, the correspondence between the message type and the CoS of the message can be as shown in Table 2.
表2Table 2
Figure PCTCN2021087575-appb-000001
Figure PCTCN2021087575-appb-000001
如表2所示,CoS为0和1的报文的类型为0;CoS为2和3的报文的类型为1;CoS为4和5的报文的类型为2;CoS为6和7的报文的类型为3。As shown in Table 2, the type of packets with CoS 0 and 1 is 0; the type of packets with CoS 2 and 3 is 1; the type of packets with CoS 4 and 5 is 2; CoS is 6 and 7 The type of the message is 3.
又如,CoS为0,1和2的报文的类型为0;CoS为3,4和5的报文的类型为1;CoS为6和7的报文的类型为2。For another example, the type of packets with CoS of 0, 1 and 2 is 0; the type of packets with CoS of 3, 4, and 5 is 1, and the type of packets with CoS of 6 and 7 are 2.
在另一些实施例中,报文的类型可以根据报文的互联网协议(Internet Protocol,IP)优先级确定。网络设备可以确定IP分组报头中的服务类型(Type of Service,ToS)字段,确定IP优先级。与CoS优先级类似,IP优先级和报文的类型的对应关系可以是一一对应,也可以是多个IP优先级对应一个类型,为了简洁,在此就不再赘述。In other embodiments, the type of the message may be determined according to the Internet Protocol (IP) priority of the message. The network device can determine the Type of Service (ToS) field in the IP packet header to determine the IP priority. Similar to CoS priority, the correspondence between IP priority and message type can be one-to-one correspondence, or multiple IP priorities can correspond to one type. For the sake of brevity, it will not be repeated here.
除此之外,报文的类型还可以根据报文VLAN头中的优先级(priority,Pri)字段或者IP头中的差分服务代码点(differentiated services code point,DSCP)字段中的优先级确定。具体确定方式与根据CoS确定报文的类型相同,为了简洁,在此就不再赘述。In addition, the type of the message can also be determined according to the priority (priority, Pri) field in the VLAN header of the message or the priority in the differentiated services code point (DSCP) field in the IP header. The specific determination method is the same as that of determining the type of the message according to the CoS. For the sake of brevity, it will not be repeated here.
在另一些实施例中,报文的类型可以根据接收该报文的其他信息划分。例如,可以根据有损流量报文和无损流量报文确定报文的类型。又如,可以根据IP第四版(IP version 4,IPv4)和IP第六版(IPv6)确定报文的类型。In other embodiments, the type of the message can be divided according to other information received in the message. For example, the type of the message can be determined based on the lossy traffic message and the lossless traffic message. For another example, the type of the message can be determined according to IP version 4 (IPv4) and IP version 6 (IPv6).
在另一些实施例,报文的类型还可以根据优先级信息和其他信息(例如有损流量报文和无损流量报文,或者IPv4报文和IPv6报文)同时确定。In other embodiments, the message type can also be determined simultaneously based on priority information and other information (for example, lossy traffic messages and lossless traffic messages, or IPv4 messages and IPv6 messages).
不同的网络设备支持的报文的类型数目可以不同。例如,一些网络设备支持报文的类型可以为8种,另一些网络支持的报文类型可以为4种。The number of message types supported by different network devices can be different. For example, some network devices can support 8 types of messages, and other networks can support 4 types of messages.
网络设备支持的报文类型的数可以与第二缓存空间包括的子缓存空间的数目相同。例如,如果网络设备可以支持报文类型的数目为8,那么该网络设备的第二缓存空间中包括8个子缓存空间。该8个子缓存空间与8个报文类型一一对应。The number of message types supported by the network device may be the same as the number of sub-buffer spaces included in the second buffer space. For example, if the number of message types that the network device can support is 8, then the second buffer space of the network device includes 8 sub-buffer spaces. The 8 sub-buffer spaces have a one-to-one correspondence with the 8 message types.
在一些实施例中,该缓存实体中可以包括至少一个第一缓存空间和至少一个第二缓存空间。换句话说,在一些实施例中,该缓存实体可以包括一个第一缓存空间和一个第二缓存空间。在另一些实施例中,该缓存实体可以包括多个第一缓存空间和一个第二缓存空间。在另一些实施例中,该缓存实体可以包括一个第一缓存空间和多个第二缓存空间。In some embodiments, the cache entity may include at least one first cache space and at least one second cache space. In other words, in some embodiments, the cache entity may include a first cache space and a second cache space. In other embodiments, the cache entity may include multiple first cache spaces and one second cache space. In other embodiments, the cache entity may include a first cache space and a plurality of second cache spaces.
在一些实施例中,该缓存实体包括的第二缓存空间可以与入端口一一对应。换句话说,多个第二缓存空间与多个入端口一一对应。该多个第二缓存空间中的每个第二缓存空间用 户缓存通过对应的端口接收的报文。In some embodiments, the second cache space included in the cache entity may have a one-to-one correspondence with the ingress port. In other words, the multiple second buffer spaces have a one-to-one correspondence with the multiple ingress ports. Each second buffer space user in the plurality of second buffer spaces buffers the message received through the corresponding port.
还以图2所示的网络设备110为例。网络设备110缓存实体142的缓存空间可以包括三个第二缓存空间。这三个第二缓存空间可以分别称为第二缓存空间111,第二缓存空间112和第二缓存空间113。第二缓存空间111与端口111对应。第二缓存空间111用于缓存从端口111接收的报文。第二缓存空间112与端口112对应。第二缓存空间112用于缓存从端口112接收的报文。第二缓存空间113与端口113对应。第二缓存空间113用于缓存从端口113接收的报文。Also take the network device 110 shown in FIG. 2 as an example. The cache space of the network device 110 cache entity 142 may include three second cache spaces. The three second cache spaces may be referred to as the second cache space 111, the second cache space 112, and the second cache space 113, respectively. The second buffer space 111 corresponds to the port 111. The second buffer space 111 is used to buffer the message received from the port 111. The second buffer space 112 corresponds to the port 112. The second buffer space 112 is used to buffer the message received from the port 112. The second buffer space 113 corresponds to the port 113. The second buffer space 113 is used to buffer the message received from the port 113.
在另一些实施例中,第二缓存空间是与出端口一一对应的。换句话说,多个第二缓存空间与多个出端口一一对应。该多个第二缓存空间中的每个第二缓存空间用于缓存通过对应的出端口发送的报文。以图2所示的网络设备110为例。网络设备110的缓存实体142可以包括两个第二缓存空间。这两个第二缓存空间可以分别称为第二缓存空间114和第二缓存空间115。第二缓存空间114对应于端口114。第二缓存空间114用于缓存通过端口114发送的报文。第二缓存空间115对应于端口115。第二缓存空间115用于缓存通过端口115发送的报文。In other embodiments, the second buffer space has a one-to-one correspondence with the egress port. In other words, there is a one-to-one correspondence between the multiple second buffer spaces and the multiple egress ports. Each second buffer space in the plurality of second buffer spaces is used for buffering the message sent through the corresponding egress port. Take the network device 110 shown in FIG. 2 as an example. The cache entity 142 of the network device 110 may include two second cache spaces. The two second cache spaces may be referred to as the second cache space 114 and the second cache space 115, respectively. The second buffer space 114 corresponds to the port 114. The second buffer space 114 is used to buffer the message sent through the port 114. The second buffer space 115 corresponds to the port 115. The second buffer space 115 is used to buffer the message sent through the port 115.
在另一些实施例中,该缓存实体中的第二缓存空间可以不与出端口或入端口对应。换句话说,无论该网络设备接收到的报文是来自于哪个入端口或者通过哪个出端口发送,该第二缓存空间都可以缓存报文。为了便于描述,这种不区分入端口和出端口的第二缓存空间可以称为端口无关的第二缓存空间。上述与出端口或入端口对应的第二缓存空间可以称为端口相关的第二缓存空间。更进一步,与出端口对应的第二缓存空间可以称为出端口相关的第二缓存空间。与入端口对应的第二缓存空间可以称为入端口相关的第二缓存空间。In other embodiments, the second cache space in the cache entity may not correspond to the egress port or the ingress port. In other words, no matter which ingress port the message received by the network device comes from or which egress port is sent through, the second buffer space can buffer the message. For ease of description, this second buffer space that does not distinguish between the ingress port and the egress port may be referred to as a port-independent second buffer space. The foregoing second buffer space corresponding to the egress port or the ingress port may be referred to as a port-related second buffer space. Furthermore, the second cache space corresponding to the egress port may be referred to as the second cache space related to the egress port. The second cache space corresponding to the ingress port may be referred to as the second cache space related to the ingress port.
在一些实施例中,该缓存实体中的多个第二缓存空间可以都是端口相关的第二缓存空间。例如,该缓存实体中的多个第二缓存空间都是出端口相关的第二缓存空间。又如,该缓存实体中的多个第二缓存空间都是入端口相关的第二缓存空间。又如,该缓存实体中的多个第二缓存空间中的部分第二缓存空间是入端口相关的第二缓存空间,另一部分第二缓存空间是出端口相关的第二缓存空间。In some embodiments, the multiple second cache spaces in the cache entity may all be port-related second cache spaces. For example, the multiple second cache spaces in the cache entity are all second cache spaces related to the egress port. For another example, the multiple second cache spaces in the cache entity are all second cache spaces related to the ingress port. For another example, a part of the second cache space among the plurality of second cache spaces in the cache entity is the second cache space related to the ingress port, and the other part of the second cache space is the second cache space related to the egress port.
在另一些实施例中,该缓存实体中的第二缓存空间是端口无关的第二缓存空间。例如,该缓存实体包括一个端口无关的第二缓存空间。In other embodiments, the second cache space in the cache entity is a port-independent second cache space. For example, the cache entity includes a port-independent second cache space.
在另一些实施例,该缓存实体中的第二缓存空间中可以有多个端口相关的第二缓存空间以及至少一个端口无关的第二缓存空间。例如,该缓存实体可以包括多个出端口相关的第二缓存空间以及一个端口无关的第二缓存空间。又如,该缓存实体可以包括多个入端口相关的第二缓存空间以及一个端口无关的第二缓存空间。又如,该缓存实体可以包括多个入端口相关的第二缓存空间,多个出端口相关的第二缓存空间以及一个端口无关的第二换存空间。In other embodiments, the second cache space in the cache entity may have multiple port-related second cache spaces and at least one port-independent second cache space. For example, the cache entity may include multiple second cache spaces related to outbound ports and one second cache space independent of ports. For another example, the cache entity may include multiple second cache spaces related to ingress ports and one second cache space independent of ports. For another example, the cache entity may include multiple second cache spaces related to ingress ports, multiple second cache spaces related to egress ports, and one port-independent second swap space.
缓存实体可以按照预定的顺序使用第一缓存空间和第二缓存空间。The cache entity may use the first cache space and the second cache space in a predetermined order.
第一缓存空间和第二缓存空间的使用顺序可以由用户配置也可以是在网络设备在出厂时设置好的(换句话说,用户无法更改使用顺序)。The order of use of the first cache space and the second cache space can be configured by the user or can be set when the network device is shipped from the factory (in other words, the user cannot change the order of use).
在一些实施例中,如果该缓存实体包括一个第一缓存空间,一个端口无关的第二缓存空间以及多个端口相关的第二缓存空间,则该缓存实体可以先使用端口无关的第二缓存空间,然后使用第一缓存空间,最后使用端口相关的第二缓存空间。In some embodiments, if the cache entity includes a first cache space, a port-independent second cache space, and multiple port-related second cache spaces, the cache entity may first use the port-independent second cache space , And then use the first buffer space, and finally use the port-related second buffer space.
在另一些实施例中,如果该缓存实体包括一个第一缓存空间和多个端口相关的第二缓存空间,则该缓存实体可以先使用第一缓存空间,然后使用端口相关的第二缓存空间。In other embodiments, if the cache entity includes a first cache space and multiple port-related second cache spaces, the cache entity may first use the first cache space, and then use the port-related second cache space.
在另一些实施例中,如果该缓存实体包括一个第一缓存空间和一个端口无关的第二缓存空间,则该缓存实体可以先使用第一缓存空间,然后使用端口无关的第二缓存空间。In other embodiments, if the cache entity includes a first cache space and a port-independent second cache space, the cache entity may first use the first cache space, and then use the port-independent second cache space.
可以理解的是,上述按照顺序使用是在缓存空间还能够缓存对应类型的报文的情况下的顺序。如果某一缓存空间没有剩余的缓存空间缓存报文,则跳过该缓存空间。例如,如果第一缓存空间没有剩余的空间缓存报文,则直接使用第二缓存空间缓存报文。It can be understood that the above-mentioned sequential use is the order in the case that the buffer space can also cache the corresponding type of messages. If a certain buffer space has no remaining buffer space to buffer the message, the buffer space is skipped. For example, if the first buffer space has no remaining space to buffer the message, the second buffer space is directly used to buffer the message.
可以理解,先使用第二缓存空间再使用第一缓存空间是指:先使用第二缓存空间中对应于某一类型的报文的子缓存空间缓存对应类型的报文。在该子缓存空间无法缓存对应类型的报文的情况下,使用第一缓存空间缓存对应类型的报文(假设第一缓存空间有可用容量)。It can be understood that using the second buffer space first and then the first buffer space refers to: first using the sub-buffer space in the second buffer space corresponding to a certain type of message to buffer the corresponding type of message. In the case that the sub-buffer space cannot buffer the corresponding type of message, the first buffer space is used to cache the corresponding type of message (assuming that the first buffer space has available capacity).
先使用第一缓存空间再使用第二缓存空间是指:先使用第一缓存空间缓存报文,如果该第一缓存空间没有足够的可用容量继续缓存报文,那么使用第二缓存空间中与报文的类型对应的子缓存空间缓存报文。Using the first buffer space and then the second buffer space means: first use the first buffer space to buffer the message, if the first buffer space does not have enough available capacity to continue to buffer the message, then use the second buffer space and the message The sub-buffer space corresponding to the message type caches the message.
以图1所示的网络100为例,假设如图1所示的网络100中的报文可以包括无损流量报文和有损流量报文。Taking the network 100 shown in FIG. 1 as an example, it is assumed that the packets in the network 100 shown in FIG. 1 may include lossless traffic packets and lossy traffic packets.
假设网络设备110只包括如图1所示的三个入端口和两个出端口。那么,网络设备110的缓存实体中可以包括三个第二缓存空间和一个第一缓存空间。该一个第一缓存空间可以称为共享(share)缓存空间。该三个第二缓存空间可以分为保留(reserve)缓存空间和净空(headroom)缓存空间。该三个第二缓存空间中可以包括一个保留缓存空间和三个净空缓存空间。该保留缓存空间是端口无关的第二缓存空间。该三个净空缓存空间是入端口相关的第二缓存空间。换句话说,该三个净空缓存空间中的每个净空缓存空间与网络设备110的一个入端口对应。三个净空缓存空间可以分别称为净空缓存空间111、净空缓存空间112和净空缓存空间113。净空缓存空间111对应入端口111,净空缓存空间112对应于入端口112,净空缓存空间113对应于入端口113。净空缓存空间111用于缓存从端口111接收的报文,净空缓存空间112用于缓存从端口112接收的报文,净空缓存空间113用于缓存从端口113接收的报文。Assume that the network device 110 only includes three ingress ports and two egress ports as shown in FIG. 1. Then, the cache entity of the network device 110 may include three second cache spaces and one first cache space. The one first cache space may be referred to as a shared (share) cache space. The three second buffer spaces can be divided into reserve buffer spaces and headroom buffer spaces. The three second cache spaces may include one reserved cache space and three headroom cache spaces. The reserved buffer space is a port-independent second buffer space. The three headroom buffer spaces are the second buffer space related to the ingress port. In other words, each of the three headroom buffer spaces corresponds to an ingress port of the network device 110. The three headroom buffer spaces may be referred to as headroom buffer space 111, headroom buffer space 112, and headroom buffer space 113, respectively. The headroom cache space 111 corresponds to the ingress port 111, the headroom cache space 112 corresponds to the ingress port 112, and the headroom cache space 113 corresponds to the ingress port 113. The headroom buffer space 111 is used for buffering messages received from the port 111, the headroom buffer space 112 is used for buffering messages received from the port 112, and the headroom buffer space 113 is used for buffering messages received from the port 113.
对于网络100中的无损流量报文,网络设备100的缓存实体的缓存空间的预定使用顺序可以依次为:保留缓存空间,共享缓存空间,净空缓存空间。For lossless traffic packets in the network 100, the predetermined order of use of the cache space of the cache entity of the network device 100 may be: reserved cache space, shared cache space, and clear cache space.
对于网络100中的有损流量报文,网络设备100可以使用缓存实体中的保留缓存空间和共享缓存空间来缓存。For lossy traffic packets in the network 100, the network device 100 may use the reserved cache space and the shared cache space in the cache entity to cache.
图3是根据本申请实施例提供的一种网络设备中处理报文的方法的意性流程图。为了便于描述,图3所示方法中网络设备接收和处理的报文都是无损流量的报文。Fig. 3 is a schematic flowchart of a method for processing a message in a network device according to an embodiment of the present application. For ease of description, the packets received and processed by the network device in the method shown in FIG. 3 are all packets with lossless traffic.
301,策略管理实体接收缓存实体发送的缓存状态信息1。301: The policy management entity receives cache status information 1 sent by the cache entity.
缓存状态信息1中包括目标缓存空间在时刻1的已用容量。The cache status information 1 includes the used capacity of the target cache space at time 1.
目标缓存空间可以用于缓存目标报文。该目标报文是具有目标类型的报文。该目标类型是多个报文类型中的任意一个。例如,如果报文的类型包括如表1所示的0至7,那么该目标类型可以是类型0至7中的任一个。The target buffer space can be used to buffer target messages. The target message is a message with a target type. The target type is any one of multiple message types. For example, if the type of the message includes 0 to 7 as shown in Table 1, then the target type can be any of types 0 to 7.
该目标缓存空间包括第一缓存空间,第一目标子缓存空间和第二目标子缓存空间。The target cache space includes a first cache space, a first target sub-cache space and a second target sub-cache space.
该第一缓存空间与上述第一缓存空间的功能相同。该第一缓存空间可以由不同类型的报文共享。换句话说,只要该第一缓存空间还有可用容量,那么任意类型的报文都可以缓存至该第一缓存空间,并且每种类型的报文没有上限。The first buffer space has the same function as the first buffer space described above. The first buffer space can be shared by different types of messages. In other words, as long as the first buffer space has available capacity, any type of message can be buffered in the first buffer space, and there is no upper limit for each type of message.
在一些实施例中,该第一缓存空间可以是共享缓存空间。In some embodiments, the first cache space may be a shared cache space.
目标子缓存空间是第二缓存空间包括的多个子缓存空间中的一个。该多个子缓存空间与该网络设备支持的多个报文类型一一对应。每个子缓存空间用于缓存对应类型的报文。The target sub-cache space is one of the multiple sub-cache spaces included in the second cache space. The multiple sub-buffer spaces have a one-to-one correspondence with multiple message types supported by the network device. Each sub-buffer space is used to buffer corresponding types of messages.
第一目标子缓存空间和第二目标子缓存空间可以是不同的第二缓存空间中的子缓存空间。例如,第一目标子缓存空间可以是第二缓存空间1包括的多个子缓存空间中的一个。例如,第二缓存空间1可以是保留缓存空间。第二目标子缓存空间可以是第二缓存空间2包括的多个子缓存空间中的一个。例如第二缓存空间2可以是净空缓存空间。The first target sub-cache space and the second target sub-cache space may be different sub-cache spaces in the second cache space. For example, the first target sub-cache space may be one of multiple sub-cache spaces included in the second cache space 1. For example, the second cache space 1 may be reserved cache space. The second target sub-cache space may be one of multiple sub-cache spaces included in the second cache space 2. For example, the second buffer space 2 may be a headroom buffer space.
以净空缓存空间为例,例如,假设该网络设备支持的报文类型共4种,分别可以称为类型0,类型1,类型2和类型3。那么该网络设备的缓存实体中的净空缓存空间中包括四个子缓存空间,该四个子缓存空间可以分别称为子缓存空间0,子缓存空间1,子缓存空间2和子缓存空间3。子缓存空间0对应于类型0。子缓存空间0用于缓存类型0的报文。子缓存空间1对应于类型1。子缓存空间1用于缓存类型1的报文。子缓存空间2对应于类型2的报文。子缓存空间2用于缓存类型2的报文。子缓存空间3对应于类型3的报文。子缓存空间3用于缓存类型3的报文。假设该目标报文是类型1,那么该第二目标子缓存空间就是子缓存空间1。假设该目标报文的类型是类型0,那么该第二目标子缓存空间就是子缓存空间0。Take the headroom buffer space as an example. For example, suppose that the network device supports a total of 4 message types, which can be called type 0, type 1, type 2 and type 3 respectively. Then the headroom cache space in the cache entity of the network device includes four sub-cache spaces, and the four sub-cache spaces may be referred to as sub-cache space 0, sub-cache space 1, sub-cache space 2 and sub-cache space 3, respectively. Sub-cache space 0 corresponds to type 0. Sub-buffer space 0 is used to buffer type 0 messages. Sub-cache space 1 corresponds to type 1. Sub-buffer space 1 is used to buffer type 1 messages. Sub-buffer space 2 corresponds to type 2 messages. The sub-buffer space 2 is used to buffer type 2 messages. The sub-buffer space 3 corresponds to type 3 messages. The sub-buffer space 3 is used to buffer type 3 messages. Assuming that the target message is of type 1, then the second target sub-buffer space is sub-buffer space 1. Assuming that the type of the target message is type 0, then the second target sub-cache space is sub-cache space 0.
该网络设备的缓存实体优先使用第二缓存空间1缓存报文。在第二缓存空间1无法缓存报文的情况下,使用第一缓存空间缓存报文。在第一缓存空间无法缓存报文的情况下,该缓存实体使用第二缓存空间2缓存报文。换句话说,缓存实体可以先使用第一目标子缓存空间缓存目标报文;在第一目标子缓存空间无法继续缓存目标报文的情况下,使用第一缓存空间缓存目标报文;在第一缓存空间无法继续缓存目标报文的情况下,使用第二目标子缓存空间缓存目标报文。The cache entity of the network device preferentially uses the second cache space 1 to cache the message. In the case that the second buffer space 1 cannot buffer the message, the first buffer space is used to buffer the message. In the case that the first cache space cannot cache the message, the cache entity uses the second cache space 2 to cache the message. In other words, the cache entity may first use the first target sub-cache space to cache the target message; in the case that the first target sub-cache space cannot continue to cache the target message, use the first cache space to cache the target message; In the case that the cache space cannot continue to cache the target message, the second target sub-cache space is used to cache the target message.
该网络设备的缓存实体可以监测目标缓存空间,确定目标缓存空间在时刻1的已用容量,并将该目标缓存空间在时刻1的已用容量通过该缓存状态1发送至策略管理实体。该缓存状态1中的目标缓存的已用容量可以包括第一缓存空间在时刻1的已用容量,第一目标子缓存空间在时刻1的已用容量以及第二目标子缓存空间在时刻1的已用容量。The cache entity of the network device can monitor the target cache space, determine the used capacity of the target cache space at time 1, and send the used capacity of the target cache space at time 1 to the policy management entity through the cache state 1. The used capacity of the target cache in the cache state 1 may include the used capacity of the first cache space at time 1, the used capacity of the first target sub-cache space at time 1, and the used capacity of the second target sub-cache space at time 1. Used capacity.
302,策略管理实体根据该目标缓存空间在时刻1的已用容量,确定该目标缓存空间是否满足预设条件1。302. The policy management entity determines whether the target cache space meets the preset condition 1 according to the used capacity of the target cache space at time 1.
303,若该目标缓存空间满足该预设条件1,则策略管理实体可以确定报文处理策略1并将报文处理策略1发送至报文处理实体。303. If the target cache space satisfies the preset condition 1, the policy management entity may determine the message processing strategy 1 and send the message processing strategy 1 to the message processing entity.
在一些实施例中,该目标缓存空间满足该预设条件1可以包括:第一目标子缓存空间无法继续缓存该目标报文,该第一缓存空间无法继续缓存该目标报文并且该第二目标子缓存空间无法继续缓存该目标报文。In some embodiments, the target cache space meeting the preset condition 1 may include: the first target sub-cache space cannot continue to cache the target message, the first cache space cannot continue to cache the target message, and the second target The sub-buffer space cannot continue to cache the target message.
换句话说,该策略管理实体可以先确定该第一目标子缓存空间是否能够继续缓存该目标报文。若该第一目标子缓存空间可以继续缓存该目标报文,则该策略管理实体可以确定该目标缓存空间不满足该预设条件1并且可以继续使用该第一目标子缓存空间缓存该目 标报文。若该第一目标子缓存空间无法继续缓存该目标报文,则该策略管理实体可以继续确定该第一缓存空间是否能够继续缓存该目标报文。若该第一缓存空间可以继续缓存该目标报文,则该策略管理实体可以确定该目标缓存空间不满足该预设条件1并且可以继续使用该第一缓存空间缓存该目标报文。若该第一缓存空间不能继续缓存该目标报文,则该策略管理实体可以确定该第二目标子缓存空间是否能够继续缓存该目标报文。若该第二目标子缓存空间可以缓存该目标报文,则该策略管理实体可以确定该目标缓存空间不满足该预设条件1并且该可以继续使用该第二目标子缓存空间缓存该目标报文。若该第二目标子缓存空间无法缓存该目标报文,则该策略管理实体可以确定该目标缓存空间满足该预设条件1。In other words, the policy management entity may first determine whether the first target sub-cache space can continue to cache the target message. If the first target sub-cache space can continue to cache the target message, the policy management entity can determine that the target cache space does not meet the preset condition 1 and can continue to use the first target sub-cache space to cache the target message . If the first target sub-cache space cannot continue to cache the target message, the policy management entity may continue to determine whether the first cache space can continue to cache the target message. If the first cache space can continue to cache the target message, the policy management entity can determine that the target cache space does not satisfy the preset condition 1 and can continue to use the first cache space to cache the target message. If the first cache space cannot continue to cache the target message, the policy management entity may determine whether the second target sub-cache space can continue to cache the target message. If the second target sub-cache space can cache the target message, the policy management entity may determine that the target cache space does not meet the preset condition 1 and may continue to use the second target sub-cache space to cache the target message . If the second target sub-buffer space cannot cache the target message, the policy management entity may determine that the target buffer space satisfies the preset condition 1.
换句话说,该策略管理实体在确定该第一目标子缓存空间,该第一缓存空间和该第二目标子缓存空间同时无法缓存该目标报文的情况下,确定该目标缓存空间满足该第一预设条件。In other words, when the policy management entity determines that the first target sub-cache space, the first cache space and the second target sub-cache space cannot cache the target message at the same time, the policy management entity determines that the target cache space satisfies the first target packet. A preset condition.
在一些实施例中,该第一缓存空间无法缓存该目标报文可以包括:该第一缓存空间没有足够的可用容量的可用于缓存报文。换句话说,该第一缓存空间的全部可用容量都已经被缓存的报文占用。In some embodiments, the inability of the first buffer space to buffer the target message may include: the first buffer space does not have sufficient available capacity for buffering the message. In other words, all the available capacity of the first buffer space has been occupied by the buffered messages.
在另一些实施例中,该第一缓存空间无法缓存该目标报文可以包括:该第一缓存空间中的已用容量到达已用容量上限。换句话说,可以为该第一缓存空间设置一个已用容量上限,例如可以称为预设阈值1。如果该第一缓存空间中的已用容量到达该预设阈值1,则该第一缓存空间可以不再继续缓存报文。例如,该预设阈值1可以设置为85%。换句话说,如果该第一缓存空间已经有85%的缓存空间被报文占用,那么该第一缓存空间无法继续缓存报文。到达该已用容量上限后的该第一缓存空间中的剩余的15%的容量可以待特殊情况的时候启用。例如可以用于缓存突发的报文或者无法丢弃的报文等。In other embodiments, the inability of the first buffer space to buffer the target message may include: the used capacity in the first buffer space reaches the upper limit of the used capacity. In other words, an upper limit of used capacity can be set for the first cache space, for example, it can be referred to as a preset threshold 1. If the used capacity in the first buffer space reaches the preset threshold 1, the first buffer space may no longer continue to buffer packets. For example, the preset threshold value 1 can be set to 85%. In other words, if 85% of the buffer space of the first buffer space is already occupied by the message, then the first buffer space cannot continue to buffer the message. The remaining 15% of the capacity in the first cache space after reaching the upper limit of the used capacity can be activated under special circumstances. For example, it can be used to buffer burst messages or messages that cannot be discarded.
可以理解是的是上述实施例中的85%的预设阈值1只是一个例子。该预设阈值1也可以是的比例值,例如95%,90%或者80%等。可以理解的是,如果该预设阈值1为100%,则表示在第一缓存空间的全部可用容量都已经被占用的情况下,该第一缓存空间才无法缓存该目标报文。It can be understood that the 85% preset threshold value 1 in the foregoing embodiment is just an example. The preset threshold value 1 may also be a proportional value, such as 95%, 90%, or 80%. It is understandable that if the preset threshold value 1 is 100%, it means that the first buffer space cannot buffer the target message when all the available capacity of the first buffer space has been occupied.
在另一些实施例中,该预设阈值1可以是缓存容量值。例如假设该第一缓存空间总大小为2048MB,那么该预设阈值1可以是1800MB,1900MB或者1700MB。In other embodiments, the preset threshold value 1 may be a buffer capacity value. For example, assuming that the total size of the first cache space is 2048MB, the preset threshold 1 may be 1800MB, 1900MB or 1700MB.
在另一些实施例中,预设阈值2也可以是报文数量。例如,假设第一缓存空间总共能缓存1000个报文,那么该预设阈值1可以为800,900或者950。In other embodiments, the preset threshold 2 may also be the number of packets. For example, assuming that the first buffer space can buffer 1000 packets in total, the preset threshold 1 may be 800, 900, or 950.
又如,上述实施例中的预设阈值1是针对已用容量的预设值。在另一些实施例中,还可以根据该第一缓存空间的可用容量设置一个可用容量下限。如果该第一缓存空间的可用容量达到该可用容量下限,那么该第一缓存空间可以不再继续缓存报文(相应的,此时缓存实体上报的应该是目标缓存空间的可用容量)。For another example, the preset threshold value 1 in the foregoing embodiment is a preset value for the used capacity. In other embodiments, a lower limit of the available capacity can also be set according to the available capacity of the first cache space. If the available capacity of the first cache space reaches the lower limit of available capacity, the first cache space may not continue to cache messages (correspondingly, the available capacity of the target cache space reported by the cache entity at this time).
上述第一缓存空间的已用容量上限和可用容量下限可以由用户配置,也可以是该网络设备在出厂的时候设置好的(换句话说,用户无法更改已用容量上限和可用容量下限)。The upper limit of used capacity and the lower limit of available capacity of the aforementioned first cache space can be configured by the user, or set by the network device when it leaves the factory (in other words, the user cannot change the upper limit of used capacity and the lower limit of available capacity).
在另一些实施例中,该第一缓存空间无法缓存该目标报文还可以包括该第一缓存空间发生故障无法继续缓存该目标报文。In other embodiments, the inability of the first cache space to cache the target message may also include that the first cache space fails to continue to cache the target message.
类似的,在一些实施例中,该第一目标子缓存空间无法缓存该目标报文可以包括:该 第一目标子缓存空间没有足够的可用容量的可用于缓存报文。换句话说,该第一目标子缓存空间的全部可用容量都已经被缓存的报文占用。Similarly, in some embodiments, the inability of the first target sub-buffer space to cache the target message may include: the first target sub-buffer space does not have sufficient available capacity for buffering messages. In other words, all the available capacity of the first target sub-buffer space has been occupied by the cached messages.
在另一些实施例中,该第一目标子缓存空间无法缓存该目标报文可以包括:该第一目标子缓存空间中的已用容量到达已用容量上限。换句话说,可以为该第一目标子缓存空间设置一个已用容量上限,例如可以称为预设阈值2。如果该第一目标子缓存空间中的已用容量到达该预设阈值2,则该第一目标子缓存空间可以不再继续缓存报文。例如,该预设阈值2可以设置为85%。换句话说,如果该第一目标子缓存空间已经有85%的缓存空间被报文占用,那么该第一目标子缓存空间无法继续缓存报文。到达该已用容量上限后的该第一目标子缓存空间中的其余15%的容量可以待特殊情况的时候启用。例如可以用于缓存突发的报文或者无法丢弃的报文等。In other embodiments, the inability of the first target sub-buffer space to cache the target message may include: the used capacity in the first target sub-buffer space reaches the upper limit of the used capacity. In other words, an upper limit of used capacity can be set for the first target sub-cache space, for example, it can be referred to as a preset threshold 2. If the used capacity in the first target sub-buffer space reaches the preset threshold 2, the first target sub-buffer space may no longer continue to buffer packets. For example, the preset threshold 2 can be set to 85%. In other words, if 85% of the buffer space of the first target sub-buffer space is already occupied by messages, then the first target sub-buffer space cannot continue to buffer messages. The remaining 15% of the capacity in the first target sub-cache space after reaching the upper limit of the used capacity can be activated under special circumstances. For example, it can be used to buffer burst messages or messages that cannot be discarded.
类似的,在一些实施例中,该第二目标子缓存空间无法缓存该目标报文可以包括:该第二目标子缓存空间没有足够的可用容量的可用于缓存报文。换句话说,该第二目标子缓存空间的全部可用容量都已经被缓存的报文占用。Similarly, in some embodiments, the inability of the second target sub-buffer space to cache the target message may include: the second target sub-buffer space does not have sufficient available capacity for buffering messages. In other words, all the available capacity of the second target sub-buffer space has been occupied by the cached messages.
在另一些实施例中,该第二目标子缓存空间无法缓存该目标报文可以包括:该第二目标子缓存空间中的已用容量到达已用容量上限。换句话说,可以为该第二目标子缓存空间设置一个已用容量上限,例如也为预设阈值2。如果该第二目标子缓存空间中的已用容量到达该预设阈值2,则该第二目标子缓存空间可以不再继续缓存报文。例如,该预设阈值2可以设置为85%。换句话说,如果该第二目标子缓存空间已经有85%的缓存空间被报文占用,那么该第二目标子缓存空间无法继续缓存报文。到达该已用容量上限后的该第二目标子缓存空间中的其余15%的容量可以待特殊情况的时候启用。例如可以用于缓存突发的报文或者无法丢弃的报文等。In other embodiments, the inability of the second target sub-buffer space to cache the target message may include: the used capacity in the second target sub-buffer space reaches the upper limit of the used capacity. In other words, an upper limit of the used capacity can be set for the second target sub-cache space, for example, also the preset threshold 2. If the used capacity in the second target sub-buffer space reaches the preset threshold 2, the second target sub-buffer space may no longer continue to buffer packets. For example, the preset threshold 2 can be set to 85%. In other words, if 85% of the buffer space of the second target sub-buffer space is already occupied by the message, the second target sub-buffer space cannot continue to buffer the message. The remaining 15% of the capacity in the second target sub-cache space after reaching the upper limit of the used capacity can be activated under special circumstances. For example, it can be used to buffer burst messages or messages that cannot be discarded.
可以理解是的是上述实施例中的85%的预设阈值2只是一个例子。该预设阈值2也可以是的比例值,例如95%,90%或者80%等。可以理解的是,如果该预设阈值2为100%,则表示在目标子缓存空间的全部容量都已经被占用的情况下,该目标子缓存空间才无法缓存该目标报文。It can be understood that the 85% preset threshold 2 in the foregoing embodiment is just an example. The preset threshold 2 may also be a proportional value, such as 95%, 90%, or 80%. It can be understood that if the preset threshold 2 is 100%, it means that the target sub-cache space cannot cache the target message when the entire capacity of the target sub-cache space has been occupied.
在另一些实施例中,该预设阈值2可以是缓存容量值。例如假设该第一目标子缓存空间总大小为2048MB,那么该预设阈值2可以是1800MB,1900MB或者1700MB。In other embodiments, the preset threshold 2 may be a buffer capacity value. For example, assuming that the total size of the first target sub-cache space is 2048MB, then the preset threshold 2 may be 1800MB, 1900MB or 1700MB.
在另一些实施例中,预设阈值2也可以是报文数量。例如,假设第一目标子缓存空间总共能缓存1000个报文,那么该预设阈值2可以为800,900或者950。In other embodiments, the preset threshold 2 may also be the number of packets. For example, assuming that the first target sub-buffer space can buffer 1000 packets in total, the preset threshold 2 may be 800, 900, or 950.
又如,上述实施例中的预设阈值2是针对可用容量的预设值。在另一些实施例中,还可以根据该目标子缓存空间的可用容量设置一个可用容量下限。如果该目标子缓存空间的可用容量达到该可用容量下限(相应的,此时缓存实体上报的应该是目标缓存空间的可用容量),那么该目标子缓存空间可以不再继续缓存报文。For another example, the preset threshold 2 in the foregoing embodiment is a preset value for available capacity. In other embodiments, a lower limit of available capacity can also be set according to the available capacity of the target sub-cache space. If the available capacity of the target sub-cache space reaches the lower limit of the available capacity (correspondingly, the available capacity of the target cache space reported by the cache entity at this time), then the target sub-cache space may no longer continue to cache messages.
上述第一目标子缓存空间和第二目标子缓存空间的已用容量上限和可用容量下限可以由用户配置,也可以是该网络设备在出厂的时候设置好的(换句话说,用户无法更改已用容量上限和可用容量下限)。The upper limit of the used capacity and the lower limit of the available capacity of the above-mentioned first target sub-cache space and the second target sub-cache space can be configured by the user, or can be set by the network device when it leaves the factory (in other words, the user cannot change the The upper limit of available capacity and the lower limit of available capacity).
此外,上述实施例中,第一缓存空间,第一目标子缓存空间和第二目标子缓存空间的已用容量上限相同。在另一些实施例中,第一缓存空间,第一目标子缓存空间和第二目标子缓存空间的已用容量上限也可以不相同。例如,第一缓存空间的已用容量上限为85%, 第一目标子缓存空间的已用容量上限为90%,第二目标子缓存空间的已用容量上限为95%。In addition, in the foregoing embodiment, the upper limit of the used capacity of the first cache space, the first target sub-cache space and the second target sub-cache space are the same. In other embodiments, the upper limit of the used capacity of the first cache space, the first target sub-cache space and the second target sub-cache space may also be different. For example, the upper limit of the used capacity of the first cache space is 85%, the upper limit of the used capacity of the first target sub-cache space is 90%, and the upper limit of the used capacity of the second target sub-cache space is 95%.
在另一些实施例中,该第一目标子缓存空间无法缓存该目标报文还可以包括该第一目标子缓存空间发生故障无法继续缓存该目标报文。类似的,该第二目标子缓存空间无法缓存该目标报文还可以包括该第二目标子缓存空间发生故障无法继续缓存该目标报文。In other embodiments, the inability of the first target sub-cache space to cache the target message may also include that the first target sub-cache space fails to continue to cache the target message. Similarly, the inability of the second target sub-cache space to cache the target message may also include that the second target sub-cache space fails to continue to cache the target message.
在另一些实施例中,该策略管理实体可以根据入端口的报文的传输速率和目标缓存空间的可用容量,预估目标缓存空间被占满的时间并启动计时器。如果计时器到达预估的时间并且入端口的传输速率在这期间没有发生变化,则该策略管理实体可以确定该目标缓存空间满足该预设条件1。如果在计时器到达预估的时间前入端口的传输速率或者出端口的传输速率发生了变化,那么该策略管理实体可以根据变化后的传输速率调整预估的时间,并根据调整后的预估时间判断该目标缓存空间是否满足该预设条件1。In other embodiments, the policy management entity may estimate the time when the target buffer space is full and start a timer according to the transmission rate of the incoming port message and the available capacity of the target buffer space. If the timer reaches the estimated time and the transmission rate of the ingress port does not change during this period, the policy management entity can determine that the target buffer space meets the preset condition 1. If the transmission rate of the ingress port or the transmission rate of the egress port changes before the timer reaches the estimated time, the policy management entity can adjust the estimated time according to the changed transmission rate, and according to the adjusted estimate Time determines whether the target buffer space meets the preset condition 1.
在另一些实施例中,该策略管理实体可以根据第一目标子缓存空间的已用容量和第一缓存空间的已用容量判断第一目标子缓存空间和第一缓存空间是否能够缓存目标报文。如果第一目标子缓存空间和第一缓存空间无法缓存目标报文,那么该策略管理实体可以根据入端口接收该目标报文的传输速率和该第二目标子缓存空间的大小预估该第二目标子缓存空间被占满的时间,并启动计时器。如果计时器到达预估时间并且入端口接收该目标报文的传输速率没有发生变化,则该策略管理实体可以确定该第二目标缓存空间满足该预设条件1。如果在计时器到达预估的时间前,用于接收该目标报文的入端口的传输速率或者用于发送该目标报文的出端口的传输速率发生了变化,那么该策略管理实体可以根据变化后的传输速率调整预估的时间,并根据调整后的预估时间判断该第二目标缓存空间是否满足该预设条件1。In other embodiments, the policy management entity may determine whether the first target sub-cache space and the first cache space can cache the target message according to the used capacity of the first target sub-cache space and the used capacity of the first cache space. . If the first target sub-buffer space and the first buffer space cannot buffer the target message, the policy management entity may estimate the second target message according to the transmission rate of the ingress port receiving the target message and the size of the second target sub-buffer space. The time when the target sub-buffer space is full, and a timer is started. If the timer reaches the estimated time and the transmission rate of the target message received by the ingress port does not change, the policy management entity may determine that the second target buffer space meets the preset condition 1. If the transmission rate of the ingress port used to receive the target packet or the transmission rate of the egress port used to send the target packet changes before the timer reaches the estimated time, then the policy management entity can change according to the change The estimated time is adjusted for the subsequent transmission rate, and it is determined whether the second target buffer space satisfies the preset condition 1 according to the adjusted estimated time.
304,报文处理实体根据报文处理策略1对新接收到的报文进行处理。304: The message processing entity processes the newly received message according to the message processing strategy 1.
在一些实施例中,报文处理策略1可以是删除新接收到的目标报文。例如,该报文处理实体可以对新接收到的目标报文进行处理,更改报文头信息,在报文头信息增加丢弃使能,并将修改后的报文发送至缓存实体。这样,缓存实体可以删除包含丢弃使能的目标报文。又如,该报文处理实体可以直接丢弃新接收到的目标报文。In some embodiments, the message processing strategy 1 may be to delete the newly received target message. For example, the message processing entity may process the newly received target message, change the message header information, add discard enable to the message header information, and send the modified message to the cache entity. In this way, the cache entity can delete the target message containing the discard enable. For another example, the message processing entity may directly discard the newly received target message.
在另一些实施例中,报文处理策略1可以是修改新接收到的目标报文的类型。这样,该报文处理实体可以修改新接收到的目标报文的类型。新接收到的目标报文在修改类型后,会使用修改后的类型对应的子缓存空间来缓存。例如,目标报文为类型0,修改类型后,该目标报文的类型为类型1。这样,就可以使用第二缓存空间中用于缓存类型1的子缓存空间来缓存类型修改后的目标报文。In other embodiments, the message processing strategy 1 may be to modify the type of the newly received target message. In this way, the message processing entity can modify the type of the newly received target message. After the newly received target message is modified, it will be cached using the sub-buffer space corresponding to the modified type. For example, the target message is type 0, and after the type is modified, the type of the target message is type 1. In this way, the sub-cache space used for the cache type 1 in the second cache space can be used to cache the target message with the modified type.
在一些实施例中,对目标报文的类型进行修改可以按照优先级顺序进行修改。该目标报文在修改后的类型优先级小于修改前的类型。假设类型0的优先级大于类型1的优先级大于类型2的优先级。如果目标报文是类型0的优先级,则可以将目标报文的类型修改为类型1。In some embodiments, the modification to the type of the target message may be modified in the order of priority. The type priority of the target packet after modification is lower than the type before modification. Assume that the priority of type 0 is greater than the priority of type 1 than the priority of type 2. If the target message has a priority of type 0, the type of the target message can be modified to type 1.
重新确定的报文的类型对应的子缓存空间有可用容量来缓存该重分类报文。该策略管理实体可以先确定有可用容量的子缓存空间,然后确定这些子缓存空间中的一个对应的类型为该目标报文需要修改的类型,需要修改的类型可以作为报文处理策略的发送给报文处理实体。例如假设目标报文的类型为类型0,对应于类型1的子缓存空间已经无法继续缓 存报文,对应于类型2和类型3的子缓存空间还可以继续缓存报文。在此情况下,该策略管理实体确定的报文处理策略1可以是将新接收到的目标报文的类型修改为类型2或者类型3。报文处理实体在新接收到目标报文后,可以将该目标报文的类型修改为类型2或类型3。这样,缓存实体可以继续使用类型2或者类型3的子缓存空间来缓存新接收到的报文。The sub-buffer space corresponding to the re-determined message type has available capacity to buffer the reclassified message. The policy management entity may first determine the sub-buffer space with available capacity, and then determine that a corresponding type in these sub-buffer spaces is the type that needs to be modified for the target message, and the type that needs to be modified can be sent to as the message processing strategy Message processing entity. For example, assuming that the type of the target message is type 0, the sub-buffer space corresponding to type 1 can no longer continue to cache the message, and the sub-buffer space corresponding to type 2 and type 3 can still continue to buffer the message. In this case, the message processing strategy 1 determined by the policy management entity may be to modify the type of the newly received target message to type 2 or type 3. After the message processing entity newly receives the target message, it can modify the type of the target message to type 2 or type 3. In this way, the cache entity can continue to use the type 2 or type 3 sub-cache space to cache newly received messages.
在另一些实施例中,如果该缓存实体中包括多个第二缓存空间且该多个第二缓存空间与多个出端口一一对应。那么对新接收到的目标报文进行异常管理可以是修改用于发送新接收到的目标报文的出端口。如上所述,缓存实体中的每个第二缓存空间可以用于缓存通过对应的出端口发送的报文。因此,可能出现多个第二缓存空间中的一个第二缓存空间中用于缓存目标报文的子存储空间已满但是另一个或多个第二缓存空间中用于缓存目标报文的子缓存空间还能够继续缓存目标报文。因此,可以修改用于发送目标报文的出端口,从而可以利用其它第二缓存空间中的目标子缓存空间来缓存该目标报文。In other embodiments, if the cache entity includes a plurality of second cache spaces and the plurality of second cache spaces have a one-to-one correspondence with a plurality of egress ports. Then, performing exception management on the newly received target message may be to modify the outgoing port used to send the newly received target message. As described above, each second buffer space in the buffer entity may be used to buffer the message sent through the corresponding out port. Therefore, it may happen that the sub-storage space used for buffering the target message in one second buffer space of the plurality of second buffer spaces is full but the sub-buffer used for buffering the target message in the other or more second buffer spaces The space can also continue to cache target messages. Therefore, the egress port used to send the target message can be modified, so that the target sub-buffer space in the other second buffer space can be used to cache the target message.
上述技术方案中,对该网络设备的缓存管理可以使得在目标子缓存空间无法继续缓存目标报文的情况下,目标报文不会抢占统一第二缓存空间中的对应于其他类型报文的子缓存空间。如果该网络设备中还包括端口无关的第二缓存空间,那么该目标报文也不会抢占该端口无关的第二缓存空间中对应于其他类型的子缓存空间。这样,可以保障在需要缓存其他类型的报文的情况下,该网络设备有剩余的缓存空间使用。In the above technical solution, the cache management of the network device can enable the target message to not preempt the child corresponding to other types of messages in the unified second buffer space when the target sub-buffer space cannot continue to cache the target message. Cache space. If the network device also includes a port-independent second buffer space, the target message will not preempt the port-independent second buffer space corresponding to other types of sub-buffer spaces. In this way, it can be ensured that the network device has the remaining buffer space to use when other types of messages need to be buffered.
在一些实施例中,该网络设备还可以在确定目标缓存空间满足预设条件1的情况下通知发送该目标报文的上游停止向该网络设备发送该目标报文。In some embodiments, the network device may also notify the upstream sending the target packet to stop sending the target packet to the network device when it is determined that the target buffer space satisfies the preset condition 1.
该报文处理实体还可以在缓存管理恢复正常的情况下,停止对新接收到的目标报文进行异常管理。The message processing entity may also stop exception management of newly received target messages when the cache management returns to normal.
在一些实施例中,该策略管理实体可以接收缓存实体发送的缓存状态2。缓存状态2中携带目标缓存在时刻2的已用容量。该策略管理实体可以根据该目标缓存空间在时刻2的已用容量,确定该目标缓存空间是否满足预设条件2。如果该目标缓存空间满足该预设条件2,那么该策略管理实体可以确定报文处理策略2并将报文处理策略2发送至报文处理实体,其中报文处理策略2不同于报文处理策略1。在此情况下,报文处理实体执行报文处理策略2。如果该目标缓存空间不满足预设条件2,则该测量管理实体不确定新的报文处理策略。在此情况下,该报文处理实体继续执行报文处理策略1。In some embodiments, the policy management entity may receive the cache status 2 sent by the cache entity. The cache state 2 carries the used capacity of the target cache at time 2. The policy management entity may determine whether the target cache space meets the preset condition 2 according to the used capacity of the target cache space at time 2. If the target cache space satisfies the preset condition 2, the policy management entity can determine the message processing strategy 2 and send the message processing strategy 2 to the message processing entity, where the message processing strategy 2 is different from the message processing strategy 1. In this case, the message processing entity implements message processing strategy 2. If the target buffer space does not meet the preset condition 2, the measurement management entity is not sure of a new message processing strategy. In this case, the message processing entity continues to execute message processing strategy 1.
在一些实施例中,该策略管理实体可以先确定第二目标子缓存空间是否还有缓存的目标报文。如果该第二目标子缓存空间中还缓存有至少一个目标报文,则该策略管理实体可以确定该目标缓存空间不满足该预设条件2。例如,如果该第二目标子缓存空间的可用容量等于该第二目标子缓存空间的总容量,那么该策略管理实体可以确定该第二目标子缓存空间中没有缓存目标报文。如果第二目标子缓存空间的可用容量小于该第二目标子缓存空间的总容量,则该策略管理实体可以确定该第二目标子缓存空间中缓存有至少一个目标报文。In some embodiments, the policy management entity may first determine whether there are still cached target packets in the second target sub-cache space. If at least one target message is still cached in the second target sub-cache space, the policy management entity may determine that the target cache space does not satisfy the preset condition 2. For example, if the available capacity of the second target sub-cache space is equal to the total capacity of the second target sub-cache space, the policy management entity may determine that no target packet is cached in the second target sub-cache space. If the available capacity of the second target sub-cache space is less than the total capacity of the second target sub-cache space, the policy management entity may determine that at least one target message is cached in the second target sub-cache space.
在一些实施例中,如果该第二目标子缓存空间中没有缓存的目标报文,则该策略管理实体确定该目标缓存空间是否满足预设条件2可以包括:确定第一缓存空间的已用容量是否小于预设阈值3;若该第一缓存空间的已用容量小于该预设阈值3,则可以确定该目标缓存空间满足该预设条件2;若该第一缓存空间的已用容量大于或等于该预设阈值3,则 可以确定该目标缓存空间不满足该预设条件2。In some embodiments, if there is no cached target message in the second target sub-cache space, the policy management entity determining whether the target cache space satisfies the preset condition 2 may include: determining the used capacity of the first cache space Is it less than the preset threshold 3; if the used capacity of the first cache space is less than the preset threshold 3, it can be determined that the target cache space satisfies the preset condition 2; if the used capacity of the first cache space is greater than or If it is equal to the preset threshold 3, it can be determined that the target cache space does not satisfy the preset condition 2.
在另一些实施例中,如果该第二目标子缓存空间中没有缓存的目标报文,则该策略管理实体确定该目标缓存空间是否满足预设条件2可以包括:确定第一目标子缓存空间的已用容量是否小于预设阈值4;若该第一目标子缓存空间的已用容量小于该预设阈值4,则可以确定该目标缓存空间满足该预设条件2;若该第一目标子缓存空间的已用容量大于或等于该预设阈值4,则可以确定该目标缓存空间不满足该预设条件2。In other embodiments, if there is no cached target message in the second target sub-cache space, the policy management entity determining whether the target cache space satisfies the preset condition 2 may include: determining the value of the first target sub-cache space Whether the used capacity is less than the preset threshold 4; if the used capacity of the first target sub-cache is less than the preset threshold 4, it can be determined that the target cache space satisfies the preset condition 2; if the first target sub-cache If the used capacity of the space is greater than or equal to the preset threshold 4, it can be determined that the target cache space does not satisfy the preset condition 2.
在另一些实施例中,如果该第二目标子缓存空间中没有缓存的目标报文,则该策略管理实体确定该目标缓存空间是否满足预设条件2可以包括:确定第一缓存空间的已用容量是否小于预设阈值3并且第一目标子缓存空间的已用容量是否小于预设阈值4;若该第一缓存空间的已用容量小于该预设阈值3且第一目标子缓存空间的已用容量小于预设阈值4,则可以确定该目标缓存空间满足该预设条件2;否则可以确定该目标缓存空间不满足该预设条件2。In other embodiments, if there is no cached target message in the second target sub-cache space, the policy management entity determining whether the target cache space satisfies the preset condition 2 may include: determining the used amount of the first cache space Is the capacity less than the preset threshold 3 and the used capacity of the first target sub-cache space is less than the preset threshold 4; if the used capacity of the first cache space is less than the preset threshold 3 and the used capacity of the first target sub-cache space If the used capacity is less than the preset threshold 4, it can be determined that the target cache space meets the preset condition 2; otherwise, it can be determined that the target cache space does not meet the preset condition 2.
与预设阈值1和预设阈值2类似,该预设阈值3和预设阈值4可以是一个比例值也可以是一个具体的容量值或者报文数量。该预设阈值3和预设阈值4可以是由用户配置的也可以是该网络设备出厂时设定的。Similar to the preset threshold value 1 and the preset threshold value 2, the preset threshold value 3 and the preset threshold value 4 may be a ratio value or a specific capacity value or the number of packets. The preset threshold 3 and the preset threshold 4 may be configured by the user or may be set when the network device leaves the factory.
该网络设备在发送缓存实体中缓存的报文时会按照缓存顺序相反的顺序发送。例如,该第二目标子缓存空间是在第一缓存空间无法继续缓存报文后才开始缓存该目标报文的。因此,该网络设备可以先将缓存在该第二目标子缓存空间缓存的目标报文通过对应的出端口发送出去,然后再发送缓存在第一缓存空间的目标报文,最后再发送第一目标子缓存空间的目标报文。因此,通过上述方案,可以实现先使得第二目标子缓存空间有可用容量来缓存新的目标报文。这样,如果还需要缓存目标报文的话,可以利用该第二目标子缓存空间缓存目标报文。When the network device sends the messages buffered in the buffer entity, they will be sent in the reverse order of the buffer order. For example, the second target sub-buffer space starts to buffer the target message after the first buffer space cannot continue to buffer the message. Therefore, the network device may first send the target message buffered in the second target sub-buffer space through the corresponding out port, then send the target message buffered in the first buffer space, and finally send the first target message. Target message in the sub-buffer space. Therefore, through the above solution, it can be achieved that the second target sub-buffer space has available capacity to buffer the new target message. In this way, if the target message needs to be cached, the second target sub-buffer space can be used to cache the target message.
在另一些实施例中,该策略管理实体可以确定该第二目标子缓存空间的已用容量是否小于预设阈值5。如果该第二目标子缓存空间的已用容量小于该预设阈值5,则该策略管理实体可以确定该目标缓存空间满足预设条件2。如果该第二目标子缓存空间的已用容量大于或等于预设阈值5,则该策略管理实体可以确定该目标缓存空间不满足该预设条件2。In other embodiments, the policy management entity may determine whether the used capacity of the second target sub-cache space is less than a preset threshold of 5. If the used capacity of the second target sub-cache space is less than the preset threshold value 5, the policy management entity may determine that the target cache space meets the preset condition 2. If the used capacity of the second target sub-cache space is greater than or equal to the preset threshold value 5, the policy management entity may determine that the target cache space does not satisfy the preset condition 2.
在另一些实施例中,该策略管理实体可以在将报文处理策略1发送至报文处理实体后启动一个计时器,如果该计时器到达预设时间并且用于发送该目标报文的出端口在此期间一直在发送该目标报文,那么该策略管理实体可以确定该目标缓存空间满足该预设条件2。该网络设备一直通过出端口发送该目标报文,因此当该报文处理实体执行报文处理策略1后,该目标缓存空间中缓存的目标报文是一直在减少的。当经过一个预设时间后,该目标缓存空间中已经有可用容量来继续缓存该目标报文。在此情况下,该策略管理实体可以确定另一个报文处理策略(例如报文处理策略2),并将新确定的报文处理策略发送至报文处理实体。In other embodiments, the policy management entity may start a timer after sending the message processing policy 1 to the message processing entity, if the timer reaches the preset time and is used to send the target message's egress port During this period, the target message has been sent, then the policy management entity can determine that the target buffer space satisfies the preset condition 2. The network device always sends the target message through the outgoing port. Therefore, after the message processing entity executes the message processing strategy 1, the target message cached in the target buffer space is always decreasing. After a preset time has elapsed, there is already available capacity in the target buffer space to continue to buffer the target message. In this case, the policy management entity may determine another message processing strategy (for example, message processing strategy 2), and send the newly determined message processing strategy to the message processing entity.
在一些实施例中,该预设时间可以根据该目标报文的发送速度和第二目标子缓存空间的容量确定。例如,如果该目标报文的发送速度没有发生变化,那么当计时器到达该预设时间时,该第二目标子缓存空间中的全部目标报文已经被发送出去。换句话说,该预设时间可以足够该网络设备将缓存在第二目标子缓存空间的目标报文发送出去。又如,在另一些实施例中,该预设时间可以使得该网络设备将缓存在第二目标子缓存空间的大部分(例 如80%,90%或者95%等)目标报文发送出去。In some embodiments, the preset time may be determined according to the sending speed of the target message and the capacity of the second target sub-buffer space. For example, if the sending speed of the target message does not change, when the timer reaches the preset time, all target messages in the second target sub-buffer space have been sent. In other words, the preset time may be sufficient for the network device to send out the target message buffered in the second target sub-buffer space. For another example, in other embodiments, the preset time may cause the network device to send out most of the target message cached in the second target sub-cache space (for example, 80%, 90%, or 95%, etc.).
在一些实施例中,报文处理策略2可以是停止执行报文处理策略1。这样,报文处理实体在接收到报文处理策略2后可以停止执行报文处理策略1(例如不在删除新接收到的目标报文)。报文处理实体在接收到报文处理策略2后可以默认的报文处理策略处理新接收到的报文或者使用在使用报文处理策略1之前使用的报文处理策略来处理新接收到的报文。In some embodiments, the message processing strategy 2 may be to stop executing the message processing strategy 1. In this way, the message processing entity can stop executing the message processing strategy 1 after receiving the message processing strategy 2 (for example, not deleting the newly received target message). After receiving the message processing strategy 2, the message processing entity can use the default message processing strategy to process the newly received message or use the message processing strategy used before the message processing strategy 1 to process the newly received message. Arts.
下面结合图4和图5对图3所示的方案的效果进行介绍。The effect of the solution shown in FIG. 3 will be introduced below in conjunction with FIG. 4 and FIG. 5.
图4是保留缓存空间,共享缓存空间和净空缓存空间的示意图。Figure 4 is a schematic diagram of reserved cache space, shared cache space and headroom cache space.
图4是在没有采用图3所示的方法的情况下,缓存空间如何缓存目标报文的示意。Fig. 4 is a schematic diagram of how to buffer the target message in the buffer space without adopting the method shown in Fig. 3.
如图4所示,网络设备110在t0时刻开始通过端口111接收来自于上游设备121类型1的报文,并且接收类型1的报文的传输速度为60Gbps。网络设备110在t0时刻开始通过端口111接收来自于上游设备122的类型1的报文,并且接收类型1的报文的传输速度为60Gps。As shown in FIG. 4, the network device 110 starts to receive type 1 packets from the upstream device 121 through the port 111 at time t0, and the transmission rate for receiving type 1 packets is 60 Gbps. The network device 110 starts to receive type 1 packets from the upstream device 122 through the port 111 at time t0, and the transmission rate for receiving type 1 packets is 60 Gps.
假设类型1的报文需要通过端口114发送且端口114的最大传输速度为100Gbps。那么,在此情况下,端口114无法及时将端口111和端口112接收到的类型1的报文发出。在此情况下,网络设备110中的缓存实体可以先将接收到类型1的报文缓存至保留缓存空间中用于缓存类型1的报文的子缓存空间(以下简称类型1的保留缓存空间)。Assume that type 1 packets need to be sent through port 114 and the maximum transmission speed of port 114 is 100 Gbps. Then, in this case, the port 114 cannot send the type 1 packets received by the port 111 and the port 112 in time. In this case, the cache entity in the network device 110 may first cache the received type 1 message in a sub-cache space in the reserved cache space for caching type 1 messages (hereinafter referred to as type 1 reserved cache space) .
在t1时刻,类型1的保留缓存空间全部被类型1的报文占用。缓存实体可以确定共享缓存空间中是否还有可用容量。如果共享缓存空间中有剩余的空间,则缓存实体可以将类型1的报文缓存至共享缓存空间。At t1, the reserved buffer space of type 1 is all occupied by type 1 packets. The cache entity can determine whether there is any available capacity in the shared cache space. If there is remaining space in the shared cache space, the cache entity may cache type 1 messages in the shared cache space.
在t2时刻,共享缓存空间的全部容量都被类型1的报文占用。在此情况下,缓存实体可以使用净空缓存空间中用于缓存类型1的报文的子缓存空间(以下简称类型1的净空缓存空间)缓存类型1的报文。At t2, the entire capacity of the shared buffer space is occupied by type 1 packets. In this case, the cache entity may use the sub-buffer space in the headroom cache space for caching type 1 messages (hereinafter referred to as type 1 headroom cache space) to cache type 1 messages.
在t3时刻,类型1的净空缓存空间全部被类型1的报文占用。在此情况下,缓存实体利用用于缓存其他类型的子缓存空间来缓存类型1的报文。如图4所示,类型1的报文开始抢占保留缓存空间和净空缓存空间中用于缓存其他类型报文的子缓存空间。At t3, the headroom buffer space of type 1 is all occupied by type 1 packets. In this case, the cache entity uses the sub-caching space for caching other types to cache type 1 messages. As shown in Figure 4, type 1 messages start to preempt the reserved buffer space and the sub-buffer space in the headroom buffer space for buffering other types of messages.
如图4所示,在t4时刻,保留缓存空间,共享缓存空间,净空缓存空间都已经被类型1的报文占用。网络设备110在t4时刻开始通过端口111接收来自于上游设备123的类型2的报文,并且接收类型2的报文的传输速度为100Gps。假设类型2的报文依然需要通过端口114发送。可以看出,t4时刻,端口111依然分别以60Gps的传输速度接收来自于上游设备111和上游设备112的类型1的报文。因此,类型2的报文无法及时从端口114发出。在此情况下,缓存实体需要缓存类型2的报文,但是由于保留缓存空间和净空缓存空间中本应用于缓存类型2报文的子缓存空间已经被类型1的报文抢占,因此缓存实体无法及时缓存类型2的报文。这样就造成了资源管理异常。As shown in Figure 4, at t4, the reserved buffer space, shared buffer space, and headroom buffer space have all been occupied by type 1 messages. The network device 110 starts to receive type 2 packets from the upstream device 123 through the port 111 at time t4, and the transmission rate for receiving type 2 packets is 100 Gps. Assume that type 2 messages still need to be sent through port 114. It can be seen that at t4, the port 111 is still receiving Type 1 packets from the upstream device 111 and the upstream device 112 at a transmission speed of 60 Gps respectively. Therefore, type 2 messages cannot be sent from port 114 in time. In this case, the cache entity needs to cache type 2 messages, but since the reserved cache space and headroom cache space, the sub-buffer space that was used to cache type 2 messages has been preempted by type 1 messages, so the cache entity cannot Cache type 2 packets in time. This caused an abnormal resource management.
图5是保留缓存空间,共享缓存空间和净空缓存空间的另一示意图。Figure 5 is another schematic diagram of reserved cache space, shared cache space and headroom cache space.
图5利用了图3所示的方法后的保留缓存空间,共享缓存空间和净空缓存空间的示意图。假设缓存实体周期性的将保留缓存空间中每个子缓存空间的可用容量,共享缓存空间的可用容量和净空缓存空间中每个子缓存空间的可用容量发送给策略管理实体。策略管理实体确定报文处理策略1并将报文处理策略1发送至报文处理实体。假设该报文处理策略 1为丢弃类型1的报文。Fig. 5 is a schematic diagram of reserved cache space, shared cache space and clear cache space after using the method shown in Fig. 3. It is assumed that the cache entity periodically sends the available capacity of each sub-cache space in the reserved cache space, the available capacity of the shared cache space, and the available capacity of each sub-cache space in the headroom cache space to the policy management entity. The policy management entity determines the message processing strategy 1 and sends the message processing strategy 1 to the message processing entity. Assume that the message processing strategy 1 is to discard type 1 messages.
如图5所示,假设该报文处理实体在t3时刻获取执行报文处理策略1并开始执行报文处理策略1。这样,该报文处理实体从t3时刻开始丢弃新接收到的类型1的报文。在此情况下,由于用于发送类型1的出端口一直在发送类型1的报文,因此保存在净空缓存空间111中的类型1的报文在持续减少。到t5时刻,净空缓存空间111中不再缓存有类型1的报文。并且,从t5时刻开始,保存在共享缓存空间中的类型1的报文也在减少。假设t6时刻报文处理实体获取到了策略管理实体确定的报文处理策略2并开始执行报文处理策略2,其中报文处理策略2为停止执行报文处理策略1。因此,从t6时刻开始,该报文处理实体可以停止丢弃新接收到的类型1的报文。在此情况下由于端口111接收类型1的报文的速度没有发生变化,共享缓存空间中缓存的类型1的报文量继续上升。As shown in Figure 5, it is assumed that the message processing entity acquires and executes message processing strategy 1 and starts to execute message processing strategy 1 at time t3. In this way, the message processing entity discards the newly received type 1 message from time t3. In this case, since the egress port used to send type 1 has been sending type 1 packets, the type 1 packets stored in the headroom buffer space 111 continue to decrease. At time t5, there are no more type 1 messages in the headroom buffer space 111. And, starting from t5, the type 1 messages stored in the shared buffer space are also decreasing. Assume that at t6, the message processing entity obtains the message processing strategy 2 determined by the policy management entity and starts to execute the message processing strategy 2, where the message processing strategy 2 is to stop executing the message processing strategy 1. Therefore, starting from t6, the message processing entity can stop discarding newly received type 1 messages. In this case, since the speed at which the port 111 receives type 1 messages has not changed, the amount of type 1 messages buffered in the shared buffer space continues to increase.
与图4相比,由于根据缓存实体的状态对新接收到的类型1的报文进行丢弃,类型1的报文不再抢占其他类型的报文的子缓存空间。因此,从t4时刻开始接收到的类型2的报文可以缓存至保留缓存空中用于缓存类型2的子缓存空间中。这样,可以避免因缓存实体配置错误导致的类型1的报文抢占其他类型的报文的子缓存空间的情况发生。Compared with FIG. 4, since the newly received type 1 message is discarded according to the state of the cache entity, the type 1 message no longer preempts the sub-buffer space of other types of messages. Therefore, type 2 messages received from time t4 can be cached in the sub-buffer space reserved for buffering type 2 in the reserved buffer space. In this way, it is possible to avoid the situation that the type 1 message preempts the sub-buffer space of other types of messages caused by the configuration error of the cache entity.
图6是根据本申请实施例提供的网络设备中处理报文的方法的示意性流程图。图6所示的方法可以由图2所示的网络设备执行。例如图6所示方法中的策略管理实体可以是如图2所示的策略管理实体141。图6所示方法中的缓存实体可以是图2所示的缓存实体142。图6所示方法中的报文处理实体可以是图2所示的报文处理实体143。Fig. 6 is a schematic flowchart of a method for processing a message in a network device according to an embodiment of the present application. The method shown in FIG. 6 may be executed by the network device shown in FIG. 2. For example, the policy management entity in the method shown in FIG. 6 may be the policy management entity 141 shown in FIG. 2. The cache entity in the method shown in FIG. 6 may be the cache entity 142 shown in FIG. 2. The message processing entity in the method shown in FIG. 6 may be the message processing entity 143 shown in FIG. 2.
601,策略管理实体获取来自于缓存实体的第一缓存状态信息。601: The policy management entity obtains first cache state information from the cache entity.
该第一缓存状态信息用于指示该缓存实体在第一时刻的第一状态。The first cache state information is used to indicate the first state of the cache entity at the first moment.
在一些实施例中,该第一状态可以是该缓存实体的状态。在此情况下,第一状态可以是多个状态中的一个。例如该多个状态包括:异常状态和正常状态。在此情况下,该第一状态可以是正常状态或异常状态。又如,该多个状态可以包括:正常状态、临界状态和异常状态。在此情况下该第一状态可以是正常状态、临界状态或者异常状态。In some embodiments, the first state may be the state of the cache entity. In this case, the first state may be one of a plurality of states. For example, the multiple states include: an abnormal state and a normal state. In this case, the first state may be a normal state or an abnormal state. For another example, the multiple states may include: a normal state, a critical state, and an abnormal state. In this case, the first state may be a normal state, a critical state or an abnormal state.
在另一些实施例中,该第一状态可以是缓存实体的相关信息。这些相关信息可以反映缓存实体的状态。例如,该第一状态可以包括以下信息中的至少一种:发送队列的长度,发送队列的缓存占用量,发送队列的时延,缓存实体的可用容量,缓存实体的已用容量,缓存实体的出端口的速率等。In other embodiments, the first state may be related information of the cache entity. These related information can reflect the state of the cache entity. For example, the first state may include at least one of the following information: the length of the sending queue, the buffer occupancy of the sending queue, the delay of the sending queue, the available capacity of the buffer entity, the used capacity of the buffer entity, and the size of the buffer entity. The rate of the outgoing port, etc.
缓存实体中设置多个计数器,每个计数器与一个出端口队列对应。计数器用于记录对应的出端口的报文数目。根据该计数器记录的报文数目可以得到每个出端口的队列(可以称为发送队列)的长度。发送队列的长度可以是每个出端口的队列长度、某一个或多个特定出端口(例如队列最长的出端口或者出端口速率最低的出端口等)的队列长度、平均队列长度,或者总队列长度等,本申请实施例对此并不限定。Multiple counters are set in the cache entity, and each counter corresponds to an egress port queue. The counter is used to record the number of packets of the corresponding outgoing port. According to the number of packets recorded by the counter, the length of the queue (which can be referred to as the sending queue) of each outgoing port can be obtained. The length of the sending queue can be the queue length of each outgoing port, the queue length of one or more specific outgoing ports (for example, the outgoing port with the longest queue or the outgoing port with the lowest outgoing port rate, etc.), the average queue length, or the total The length of the queue, etc., are not limited in the embodiment of the present application.
以图2所示的网络设备为例。在一些实施例中,该第一状态可以包括对应于端口114的队列长度和端口115的队列长度。在另一些实施例中,该第一状态可以仅包括对了长度最长的一个出端口的队列长度(例如可以是端口114的队列长度)。在另一些实施例中,该第一状态可以是端口114的队列长度和端口115的队列长度之和。Take the network device shown in Figure 2 as an example. In some embodiments, the first state may include the queue length corresponding to port 114 and the queue length of port 115. In other embodiments, the first state may only include the queue length of the egress port with the longest length (for example, it may be the queue length of port 114). In other embodiments, the first state may be the sum of the queue length of port 114 and the queue length of port 115.
缓存实体的出端口的速率可以是每个出端口的速率,也可以是某一个或多个特定出端口(例如队列最长的出端口或者出端口速率最低的出端口等)的速率、或者平均速率等, 本申请实施例对此并不限定The rate of the outgoing port of the cache entity can be the rate of each outgoing port, or the rate of one or more specific outgoing ports (such as the outgoing port with the longest queue or the outgoing port with the lowest outgoing port rate, etc.), or the average Rate, etc., which are not limited in the embodiment of the present application
以图2所示的网络设备为例。在一些实施例中,该第一状态可以包括对应于端口114的速率和端口115的速率。在另一些实施例中,该第一状态可以仅包括对了长度最长的一个出端口的速率(例如可以是端口114的队列长度)。在另一些实施例中,该第一状态可以是端口114的速率和端口115的速率的平均值。Take the network device shown in Figure 2 as an example. In some embodiments, the first state may include the rate corresponding to port 114 and the rate of port 115. In other embodiments, the first state may only include the rate of the egress port with the longest length (for example, it may be the queue length of port 114). In other embodiments, the first state may be the average of the port 114 rate and the port 115 rate.
缓存实体的可用容量可以是缓存实体的总可用容量,也可以是缓存实体中的部分缓存空间的可用容量。The available capacity of the cache entity may be the total available capacity of the cache entity, or the available capacity of part of the cache space in the cache entity.
在一些实施例中,该第一状态可以包括第一缓存空间的可用容量。在另一些实施例中,该第一状态可以包括第二缓存空间中的每个子缓存空间的可用容量。在另一些实施例中,该第一状态可以包括第二缓存空间中的某一个或多个子缓存空间的可用容量。例如用于缓存目标类型的报文的子缓存空间。在另一些实施例中,该第一状态可以包括第一缓存空间的可用容量以及第二缓存空间的可用容量。In some embodiments, the first state may include the available capacity of the first buffer space. In other embodiments, the first state may include the available capacity of each sub-cache space in the second cache space. In other embodiments, the first state may include the available capacity of one or more sub-cache spaces in the second cache space. For example, a sub-buffer space used to cache messages of the target type. In other embodiments, the first state may include the available capacity of the first cache space and the available capacity of the second cache space.
类似的,缓存实体的已用容量可以是缓存实体的总已用容量,也可以是缓存实体中的部分缓存空间的已用容量。Similarly, the used capacity of the cache entity may be the total used capacity of the cache entity or the used capacity of part of the cache space in the cache entity.
还假设缓存实体的缓存空间可以包括第一缓存空间和第二缓存空间。在一些实施例中,该第一状态可以包括第一缓存空间的已用容量。在另一些实施例中,该第一状态可以包括第二缓存空间中的每个子缓存空间的已用容量。在另一些实施例中,该第一状态可以包括第二缓存空间中的某一个或多个子缓存空间的已用容量。例如用于缓存目标类型的报文的子缓存空间。在另一些实施例中,该第一状态可以包括第一缓存空间的已用容量以及第二缓存空间的已用容量。It is also assumed that the cache space of the cache entity may include a first cache space and a second cache space. In some embodiments, the first state may include the used capacity of the first buffer space. In other embodiments, the first state may include the used capacity of each sub-cache space in the second cache space. In other embodiments, the first state may include the used capacity of one or more sub-cache spaces in the second cache space. For example, a sub-buffer space used to cache messages of the target type. In other embodiments, the first state may include the used capacity of the first cache space and the used capacity of the second cache space.
例如,在图3所示的实施例中,第一状态为目标缓存空间在时刻1的已用容量。For example, in the embodiment shown in FIG. 3, the first state is the used capacity of the target cache space at time 1.
在一些实施例中,该缓存实体可以确定该第一状态,并向该策略管理实体发送用于指示该第一状态的第一缓存状态信息。相应的,该策略管理实体接收该缓存实体发送的该第一缓存状态信息。换句话说,该第一缓存状态信息是由该缓存实体主动确定并发送给该策略管理实体。In some embodiments, the caching entity may determine the first state, and send first caching state information for indicating the first state to the policy management entity. Correspondingly, the policy management entity receives the first cache state information sent by the cache entity. In other words, the first cache state information is actively determined by the cache entity and sent to the policy management entity.
在一些实施例中,该缓存实体可以周期性的确定该缓存实体的状态并将确定的缓存实体的状态通过缓存状态信息指示给该策略管理实体。In some embodiments, the cache entity may periodically determine the state of the cache entity and indicate the determined state of the cache entity to the policy management entity through cache state information.
在另一些实施例中,该缓存实体可以在确定第一状态满足第一预设条件的情况下,向该策略管理实体发送该第一缓存状态信息。换句话说,该缓存实体只有在状态满足该第一预设条件的情况下才将该缓存实体的状态指示给该网络设备。如果该缓存实体的状态不满足第一预设条件,则该缓存实体可以不需要将该缓存设备的状态指示给该策略管理实体。In other embodiments, the caching entity may send the first caching state information to the policy management entity when it is determined that the first state satisfies the first preset condition. In other words, the cache entity only indicates the state of the cache entity to the network device when the state meets the first preset condition. If the state of the cache entity does not meet the first preset condition, the cache entity may not need to indicate the state of the cache device to the policy management entity.
在一些实施例中,该第一预设条件是出厂时配置好的,用户不能进行修改。在另一些实施例中,用户可以根据需要自行设定该第一预设条件。In some embodiments, the first preset condition is configured at the factory and cannot be modified by the user. In other embodiments, the user can set the first preset condition according to needs.
例如,该第一预设条件是缓存实体的可用容量小于或等于阈值Th1。在此情况下,如果缓存实体确定该缓存实体的可用容量小于或等于Th1,则可以向该策略管理实体发送该第一缓存状态信息。For example, the first preset condition is that the available capacity of the cache entity is less than or equal to the threshold Th1. In this case, if the cache entity determines that the available capacity of the cache entity is less than or equal to Th1, it may send the first cache state information to the policy management entity.
又如,该第一预设条件可以是出端口的速率到达最大速率。在此情况下,如果缓存实体确定该缓存实体的出端口的速率达到最大速率,则可以向该策略管理实体发送该第一缓存状态信息。For another example, the first preset condition may be that the rate of the egress port reaches the maximum rate. In this case, if the cache entity determines that the rate of the outgoing port of the cache entity reaches the maximum rate, it may send the first cache state information to the policy management entity.
又如,该第一预设条件可以是目标子缓存空间的可用容量小于阈值Th2。在此情况下,如果缓存实体确定该缓存实体的目标子缓存空间的可用容量小于Th2,则可以向该策略管理实体发送该第一缓存状态信息。For another example, the first preset condition may be that the available capacity of the target sub-cache space is less than the threshold Th2. In this case, if the cache entity determines that the available capacity of the target sub-cache space of the cache entity is less than Th2, it may send the first cache state information to the policy management entity.
又如,该第一预设条件可以是出端口的队列长度大于阈值Th3。在此情况下,如果缓存实体确定端口114或端口115中的至少一个的队列长度大于阈值Th3,则可以向该策略管理实体发送该第一缓存状态信息。For another example, the first preset condition may be that the queue length of the egress port is greater than the threshold Th3. In this case, if the cache entity determines that the queue length of at least one of the port 114 or the port 115 is greater than the threshold Th3, it may send the first cache status information to the policy management entity.
在一些实施例中,该缓存实体中可以只保存一个用于触发上报第一缓存状态信息的预设条件。In some embodiments, only one preset condition for triggering the reporting of the first cache state information may be stored in the cache entity.
在另一些实施例中,该缓存实体中可以保存多个用于触发上报第一缓存状态信息的预设条件。只要该第一状态满足该多个预设条件中的一个,该缓存实体就想策略管理实体发送第一缓存状态信息。在多个预设条件中,该第一状态满足的预设条件是该第一预设条件。In other embodiments, the cache entity may store a plurality of preset conditions for triggering the reporting of the first cache status information. As long as the first state satisfies one of the multiple preset conditions, the cache entity wants the policy management entity to send the first cache state information. Among the plurality of preset conditions, the preset condition satisfied by the first state is the first preset condition.
在另一些实施例中,该策略管理实体或者该报文处理实体可以向该缓存实体发送状态请求。该缓存实体可以在接收到状态请求的情况下,确定第一状态并将用于指示第一状态的第一缓存状态信息发送至该策略管理实体。该策略管理实体或者该报文处理实体向该缓存实体发送状态请求的方式可以是周期性的也可以是非周期性的。例如,该报文处理实体可以在入端口的速率大于一个阈值的情况下,向该缓存实体发送该状态请求。又如,该报文处理实体可以在接收到具有特定标记或者等级的报文的情况下,向该缓存实体发送该状态请求。In other embodiments, the policy management entity or the message processing entity may send a status request to the cache entity. The caching entity may determine the first state and send the first caching state information used to indicate the first state to the policy management entity upon receiving the state request. The manner in which the policy management entity or the message processing entity sends the status request to the cache entity may be periodic or aperiodic. For example, the message processing entity may send the status request to the cache entity when the rate of the ingress port is greater than a threshold. For another example, the message processing entity may send the status request to the cache entity when a message with a specific mark or level is received.
例如,在图3所示的实施例中,第一缓存状态信息是由缓存实体发送至策略管理实体的。For example, in the embodiment shown in FIG. 3, the first cache status information is sent by the cache entity to the policy management entity.
在另一些实施例中,策略管理实体可以主动读取缓存实体中的第一缓存状态信息。缓存实体可以获取缓存实体的状态,根据获取到的缓存实体的状态确定缓存状态信息,并保存确定的缓存状态信息。例如缓存实体可以获取缓存实体在第一时刻的第一状态,确定第一缓存状态信息并保存该第一缓存状态信息。策略管理实体可以读取缓存实体保存的该第一缓存状态信息。In other embodiments, the policy management entity may actively read the first cache state information in the cache entity. The cache entity may obtain the state of the cache entity, determine the cache state information according to the obtained state of the cache entity, and save the determined cache state information. For example, the cache entity may obtain the first state of the cache entity at the first moment, determine the first cache state information, and save the first cache state information. The policy management entity can read the first cache state information stored by the cache entity.
在另一些实施例中,缓存实体可以将发送队列的长度,发送队列的缓存占用量,发送队列的时延,缓存实体的可用容量,缓存实体的已用容量,缓存实体的出端口的速率等中的至少一种信息发送至策略管理实体。该策略管理实体可以根据接收到的至少一种信息,确定该第一缓存状态信息。在此情况下,该第一缓存状态信息是该缓存实体的状态。In other embodiments, the buffer entity may adjust the length of the sending queue, the buffer occupancy of the sending queue, the delay of the sending queue, the available capacity of the buffer entity, the used capacity of the buffer entity, the rate of the outgoing port of the buffer entity, etc. At least one type of information in is sent to the policy management entity. The policy management entity may determine the first cache state information according to the received at least one type of information. In this case, the first cache state information is the state of the cache entity.
在另一些实施例中,缓存实体可以获取发送队列的长度,发送队列的缓存占用量,发送队列的时延,缓存实体的可用容量,缓存实体的已用容量,缓存实体的出端口的速率等中的至少一种信息并保存获取的至少一种信息。该策略管理实体可以读取缓存实体保存的至少一种信息,并根据该至少一种信息确定该第一缓存状态信息。在此情况下,该第一缓存状态信息是该缓存实体的状态。In other embodiments, the buffer entity can obtain the length of the sending queue, the buffer occupancy of the sending queue, the delay of the sending queue, the available capacity of the buffer entity, the used capacity of the buffer entity, the rate of the outgoing port of the buffer entity, etc. At least one type of information in and save the acquired at least one type of information. The policy management entity may read at least one type of information stored in the cache entity, and determine the first cache state information according to the at least one type of information. In this case, the first cache state information is the state of the cache entity.
602,该策略管理实体根据获取到的第一缓存状态信息,确定第一报文处理策略。602. The policy management entity determines a first packet processing policy according to the acquired first cache state information.
以图3所示的方法为例,在图3所示的方法中,如果缓存状态信息1满足以下预设条件:该第一缓存空间无法继续缓存该目标报文并且该目标子缓存空间无法继续缓存该目标报文,那么该策略管理实体可以确定报文处理策略,例如丢弃新接收到的目标报文。Taking the method shown in FIG. 3 as an example, in the method shown in FIG. 3, if the cache state information 1 meets the following preset conditions: the first cache space cannot continue to cache the target message and the target sub-cache space cannot continue By caching the target message, the policy management entity can determine the message processing strategy, for example, discarding the newly received target message.
如果缓存状态信息1不满足上述预设条件,那么该策略管理实体可以不确定新的报文 处理策略。If the cache status information 1 does not meet the foregoing preset conditions, the policy management entity may not be sure of a new message processing policy.
在另一些实施例中,该策略管理实体可以维护多个报文处理策略。不同的报文处理策略可以对应不同的缓存状态信息。例如,报文处理策略11对应于出端口的队列长度小于阈值Th5;报文处理策略12对应于出端口的队列长度大于或等于Th5且小于阈值Th6;报文处理策略13对应于出端口的队列长度大于或等于Th6。在此情况下,如果第一缓存状态信息包括的出端口队列长度小于Th5,则该策略管理实体可以确定第一报文处理策略为报文处理策略11。In other embodiments, the policy management entity may maintain multiple message processing policies. Different message processing strategies can correspond to different cache status information. For example, message processing strategy 11 corresponds to the queue length of the egress port being less than the threshold Th5; message processing strategy 12 corresponds to the queue length of the egress port being greater than or equal to Th5 and less than the threshold Th6; message processing strategy 13 corresponds to the queue of the egress port The length is greater than or equal to Th6. In this case, if the length of the outbound port queue included in the first buffer status information is less than Th5, the policy management entity may determine that the first packet processing strategy is the packet processing strategy 11.
603,该策略管理实体向报文处理实体发送该第一报文处理策略603. The policy management entity sends the first packet processing policy to the packet processing entity
604,该报文处理实体执行第一报文处理策略,根据第一报文处理策略,对新接收到的报文进行处理。604: The message processing entity executes the first message processing strategy, and processes the newly received message according to the first message processing strategy.
在一些实施例中,第一报文处理策略可以是丢弃所有新接收到的报文。在此情况下,报文处理实体可以丢弃所有新接收到的报文。In some embodiments, the first message processing strategy may be to discard all newly received messages. In this case, the message processing entity can discard all newly received messages.
在另一些实施例中,第一报文处理策略可以是对所有新接收到的报文的报文信息进行修改。修改报文信息可以是修改报文的优先级、修改报文的丢弃优先级、修改报文的端口号,修改报文的显示拥塞标志(explicit congestion notification,ECN)位、或者修改报文的丢弃使能位等中的一个或者多个。在此情况下,报文处理实体可以对所有新接收到的报文的报文信息进行修改。In other embodiments, the first message processing strategy may be to modify the message information of all newly received messages. Modifying the message information can be modifying the priority of the message, modifying the discarding priority of the message, modifying the port number of the message, modifying the explicit congestion notification (ECN) bit of the message, or modifying the discarding of the message One or more of the enable bits, etc. In this case, the message processing entity can modify the message information of all newly received messages.
在另一些实施例中,第一报文处理策略可以是丢弃部分新接收到的报文。在此情况下,报文处理实体可以丢弃部分新接收到的报文。例如在图3所示实施例中,可以仅丢弃新接收到的目标报文。又如,报文处理实体可以随机丢弃新接收到的报文。In other embodiments, the first message processing strategy may be to discard some newly received messages. In this case, the message processing entity can discard some of the newly received messages. For example, in the embodiment shown in FIG. 3, only the newly received target message may be discarded. For another example, the message processing entity can randomly discard newly received messages.
在另一些实施例中,第一报文处理策略可以是修改部分新接收到的报文的报文信息。在此情况下,报文处理实体可以对部分新接收到的报文的报文信息进行修改。例如,在图3所示的实施例中,可以仅修改目标报文的报文信息。又如,报文处理实体可以随机选取一部分报文,并修改选取的报文的报文信息。In other embodiments, the first message processing strategy may be to modify the message information of a part of the newly received message. In this case, the message processing entity can modify the message information of some newly received messages. For example, in the embodiment shown in FIG. 3, only the message information of the target message may be modified. For another example, the message processing entity can randomly select a part of the messages and modify the message information of the selected messages.
在另一些实施例中,第一报文处理策略可以是丢弃部分报文,同时修改另一部分报文的报文信息。In other embodiments, the first message processing strategy may be to discard part of the message while modifying the message information of another part of the message.
在另一些实施例中,第一报文处理策略可以是丢弃一部分报文,同时修改一部分报文的报文信息,同时对一部分报文不进行任何处理。In other embodiments, the first message processing strategy may be to discard a part of the message, while modifying the message information of a part of the message, while not performing any processing on a part of the message.
605,策略管理实体获取第二缓存状态信息。605: The policy management entity obtains the second cache status information.
该第二缓存状态信息用于指示该缓存实体在第二时刻的第二状态。The second cache state information is used to indicate the second state of the cache entity at the second moment.
在一些实施例中,策略管理实体获取第二缓存状态信息的方式与获取第一缓存状态信息的方式相同。例如,第一缓存状态信息和第二缓存状态信息都是由缓存实体主动发送给策略管理实体的。In some embodiments, the manner in which the policy management entity obtains the second cache state information is the same as the manner in which the first cache state information is obtained. For example, both the first cache state information and the second cache state information are actively sent by the cache entity to the policy management entity.
在另一些实施例中,策略管理实体获取第二缓存状态信息的方式与获取第一缓存状态信息的方式可以不相同。例如,第一缓存状态信息是缓存实体主动发送给策略管理实体的,第二缓存状态信息是策略管理实体从缓存实体中读取的。In other embodiments, the method of obtaining the second cache state information by the policy management entity may be different from the method of obtaining the first cache state information. For example, the first cache state information is actively sent by the cache entity to the policy management entity, and the second cache state information is read from the cache entity by the policy management entity.
策略管理实体获取第二缓存状态信息的具体方法与策略管理实体获取第一缓存状态信息的具体方法类似。为了简洁,在此就不在赘述。The specific method for the policy management entity to obtain the second cache state information is similar to the specific method for the policy management entity to obtain the first cache state information. For the sake of brevity, I won't repeat them here.
第二状态与第一状态的含义也类似,为了简洁,在此就不在赘述。The meaning of the second state is similar to that of the first state. For the sake of brevity, it will not be repeated here.
606,该策略管理实体根据该第二缓存状态信息,确定第二报文处理策略606. The policy management entity determines a second packet processing policy according to the second cache status information
607,该策略管理实体将该第二报文处理策略发送至该报文处理实体;607. The policy management entity sends the second packet processing policy to the packet processing entity.
608,该报文处理实体执行该第二报文处理策略,根据该第二报文处理策略,处理新接收到的报文。608. The message processing entity executes the second message processing strategy, and processes the newly received message according to the second message processing strategy.
在一些实施例中,该第二报文处理策略用于指示该报文处理实体不再执行该第一报文处理策略。例如,假设该第一报文处理策略为丢弃目标类型的报文,则该报文处理策略在接收到该第二报文处理策略后可以停止丢弃该目标类型的报文。In some embodiments, the second packet processing strategy is used to instruct the packet processing entity to no longer execute the first packet processing strategy. For example, assuming that the first packet processing strategy is to discard packets of the target type, the packet processing strategy may stop discarding packets of the target type after receiving the second packet processing strategy.
在一些实施例中,该第二报文处理策略还用于指示该报文处理实体使用指定报文处理策略处理新接收到的报文。In some embodiments, the second message processing strategy is also used to instruct the message processing entity to use the specified message processing strategy to process the newly received message.
例如,该指定报文处理策略可以是默认的报文处理策略。例如,该默认的报文处理策略是不对目标类型的报文进行任何额外的处理(例如丢弃或者修改报文信息)。换句话说,默认的报文处理策略是对目标类型的报文和非目标类型的报文采用相同的方式处理。For example, the designated message processing strategy may be a default message processing strategy. For example, the default message processing strategy is not to perform any additional processing (such as discarding or modifying message information) on the target type of message. In other words, the default message processing strategy is to process the target type messages and non-target type messages in the same way.
又如该指定报文处理策略可以是在使用该第一报文处理策略之前使用的报文处理策略。例如,在使用该第一报文处理策略之前使用的报文处理策略是第三报文处理策略。第三报文处理策略为修改目标类型的报文的优先级。这样,在收到第二报文处理策略之后,该报文处理实体不再丢弃目标类型的报文,而是修改目标类型的报文的优先级。In another example, the designated message processing strategy may be a message processing strategy used before the first message processing strategy is used. For example, the message processing strategy used before the first message processing strategy is used is the third message processing strategy. The third message processing strategy is to modify the priority of the target type of message. In this way, after receiving the second message processing strategy, the message processing entity no longer discards the target type of message, but modifies the priority of the target type of message.
在一些实施例中,图6所示方法中的报文是无损流量报文。在另一些实施例中,图6所示的方法中的报文可以是无损流量报文,也可以是有损流量报文。In some embodiments, the message in the method shown in FIG. 6 is a lossless traffic message. In other embodiments, the message in the method shown in FIG. 6 may be a lossless traffic message or a lossy traffic message.
根据图6所示的方法,报文处理实体可以根据缓存实体的状态来执行相应的报文处理策略。这样可以更好地对缓存实体进行管理,以减少缓存实体出现缓存管理异常的情况发生。According to the method shown in FIG. 6, the message processing entity can execute the corresponding message processing strategy according to the state of the cache entity. In this way, the cache entity can be better managed to reduce the occurrence of cache management exceptions in the cache entity.
例如,由于错误配置,缓存实体中的资源管理规则是端口115的队列长度大于25535的时候才开始丢弃输入到缓存实体的报文。但是资源管理规则中的端口115的队列长度大于端口115实际能够处理的队列长度(假设端口115实际能够处理的队列长度为1023)。但是利用图6所示的方法,策略管理实体可以获取缓存实体上报的端口115的队列长度,并在端口115的队列长度大于1000的时候确定报文处理策略并将确定的报文处理策略发送至报文处理实体。假设该报文处理策略可以为修改报文的出端口为端口114。这样,报文处理实体可以将出端口为115报文的出端口修改为114。这样,可以避免缓存实体配置错误导致的缓存管理异常的情况下发生。For example, due to misconfiguration, the resource management rule in the cache entity is that the message input to the cache entity is discarded only when the queue length of port 115 is greater than 25535. However, the queue length of the port 115 in the resource management rules is greater than the queue length that the port 115 can actually handle (assuming that the queue length that the port 115 can actually handle is 1023). However, using the method shown in Figure 6, the policy management entity can obtain the queue length of port 115 reported by the cache entity, and determine the message processing strategy when the queue length of port 115 is greater than 1000 and send the determined message processing strategy to Message processing entity. It is assumed that the message processing strategy can be to modify the outgoing port of the message to be port 114. In this way, the message processing entity can modify the outgoing port of the packet from 115 to 114. In this way, it is possible to avoid the occurrence of an abnormal cache management caused by a configuration error of the cache entity.
又如,在无损网络中,对于无损流量报文,网络设备在出端口发生拥塞,则请求上游设备停止发送通过该出端口发送的报文。但是,上游设备可能没有正常响应网络设备发送的请求,继续向网络设备发送报文。按住目前业界的处理方法,由于接收到的报文是无损流量报文,因此网络设备无法丢弃新接收到的报文。但是网络设备又不能及时发送无损流量报文。这样就会出现没有足够的缓存空间来缓存新接收到的报文的情况发生。利用图6所示的方法,策略管理实体可以获取缓存实体上报缓存空间的可用容量。策略管理实体可以在缓存空间的可用容量不足的情况下,确定报文处理策略并将确定的报文处理策略发送至报文处理实体。假设该报文处理策略可以是丢弃新接收到的所有报文。这样,报文处理实体可以丢弃新接收到的报文。这样可以使得需要缓存实体缓存的报文容量不会超过缓存实体的可用容量。For another example, in a lossless network, for lossless traffic packets, if the network device is congested on the outgoing port, it requests the upstream device to stop sending the packets sent through the outgoing port. However, the upstream device may not normally respond to the request sent by the network device and continue to send packets to the network device. According to the current industry processing method, since the received message is a lossless traffic message, the network device cannot discard the newly received message. However, network devices cannot send lossless traffic packets in time. In this way, there may not be enough buffer space to buffer the newly received message. Using the method shown in FIG. 6, the policy management entity can obtain the available capacity of the cache space reported by the cache entity. The policy management entity may determine a message processing strategy and send the determined message processing strategy to the message processing entity when the available capacity of the buffer space is insufficient. It is assumed that the message processing strategy can be to discard all newly received messages. In this way, the message processing entity can discard the newly received message. In this way, the message capacity that needs to be cached by the cache entity will not exceed the available capacity of the cache entity.
缓存实体142可以由存储器实现。The cache entity 142 may be realized by a memory.
在一些实施例中,缓存实体142中的不同类型的缓存空间(即第一缓存空间和第二缓存空间)可以由同一个存储器实现。In some embodiments, different types of cache spaces (ie, the first cache space and the second cache space) in the cache entity 142 may be implemented by the same memory.
在另一些实施例中,缓存实体142中的不同类型的缓存空间可以由不同的存储器实现。例如,缓存实体142可以由四个存储器实现。存储器1可以用于作为第一缓存空间,存储器2可以用于作为对应于端口111的第二缓存空间,存储器3可以用于作为对应于端口112的第二缓存空间,存储器4可以用于作为对应于端口113的第二缓存空间。In other embodiments, different types of cache spaces in the cache entity 142 may be implemented by different memories. For example, the cache entity 142 may be realized by four memories. Memory 1 can be used as a first buffer space, memory 2 can be used as a second buffer space corresponding to port 111, memory 3 can be used as a second buffer space corresponding to port 112, and memory 4 can be used as a corresponding The second buffer space at port 113.
可以理解,本申请实施例中的存储器可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(dynamic RAM,DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,DR RAM)。应注意,本文描述的系统和方法的存储器旨在包括但不限于这些和任意其它适合类型的存储器。It can be understood that the memory in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory. Among them, the non-volatile memory can be read-only memory (ROM), programmable read-only memory (programmable ROM, PROM), erasable programmable read-only memory (erasable PROM, EPROM), and electrically available Erase programmable read-only memory (electrically EPROM, EEPROM) or flash memory. The volatile memory may be random access memory (RAM), which is used as an external cache. By way of exemplary but not restrictive description, many forms of RAM are available, such as static random access memory (static RAM, SRAM), dynamic random access memory (dynamic RAM, DRAM), and synchronous dynamic random access memory (synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (double data rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synchronous connection dynamic random access memory (synchlink DRAM, SLDRAM) ) And direct memory bus random access memory (direct rambus RAM, DR RAM). It should be noted that the memories of the systems and methods described herein are intended to include, but are not limited to, these and any other suitable types of memories.
在一些实施例中,策略管理实体141和报文处理实体143可以由同一个处理器实现或者系统芯片(system on chip,SoC)实现。该处理器可以是中央处理器(central processing until,CPU)或者网络处理器(network processor,NP)。In some embodiments, the policy management entity 141 and the message processing entity 143 may be implemented by the same processor or system on chip (SoC). The processor may be a central processing unit (central processing until, CPU) or a network processor (network processor, NP).
在另一些实施例中,策略管理实体141和报文处理实体143可以由不同的处理器实现。例如,报文处理实体143可以是中央处理器(central processing until,CPU)或者网络处理器(network processor,NP),策略管理实体141可以是专用集成芯片(application specific integrated circuit,ASIC)。又如,报文处理实体143可以由一个ASIC实现,策略管理实体141由另一个ASIC实现。In other embodiments, the policy management entity 141 and the message processing entity 143 may be implemented by different processors. For example, the message processing entity 143 may be a central processing until (CPU) or a network processor (NP), and the policy management entity 141 may be an application specific integrated circuit (ASIC). For another example, the message processing entity 143 may be implemented by an ASIC, and the policy management entity 141 may be implemented by another ASIC.
图7是根据本申请实施例提供的网络设备的结构框图。图7所示的网络设备700包括:处理器701,存储器702,接收器703和发送器704。Fig. 7 is a structural block diagram of a network device provided according to an embodiment of the present application. The network device 700 shown in FIG. 7 includes a processor 701, a memory 702, a receiver 703, and a transmitter 704.
处理器701,存储器702,接收器703和发送器704可以通过总线705相通信。The processor 701, the memory 702, the receiver 703, and the transmitter 704 can communicate through a bus 705.
处理器701是网络设备700的控制中心,提供执行指令、执行中断动作、提供定时功能和其他功能的排序和处理设施。可选的,处理器701包括一个或多个中央处理器(CPU)。。可选的,网络设备700包括多个处理器。处理器701可以是单核(单CPU)处理器,也可以是多核(多CPU)处理器。处理器701还可以是专用集成芯片(application specific integrated circuit,ASIC),还可以是系统芯片(system on chip,SoC),还可以是网络处理器(network processor,NP),还可以是数字信号处理电路(digital signal processor,DSP),还可以是微控制器(micro controller unit,MCU),还可以是可编程控制器(programmable logic device,PLD)、其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件,或其他集成芯片等。The processor 701 is the control center of the network device 700, and provides sequencing and processing facilities for executing instructions, executing interrupt actions, providing timing functions, and other functions. Optionally, the processor 701 includes one or more central processing units (CPUs). . Optionally, the network device 700 includes multiple processors. The processor 701 may be a single-core (single CPU) processor or a multi-core (multi-CPU) processor. The processor 701 may also be an application specific integrated circuit (ASIC), a system on chip (SoC), a network processor (NP), or a digital signal processing Circuit (digital signal processor, DSP), microcontroller (microcontroller unit, MCU), programmable logic device (PLD), other programmable logic devices, discrete gates, or transistor logic devices , Discrete hardware components, or other integrated chips, etc.
处理器701执行的程序代码可以存储在存储器702中。处理器701通过控制其他程序或进程的执行,控制与周边设备的通信,从而控制网络设备700的运行,以此实现上述方法的操作步骤。The program code executed by the processor 701 may be stored in the memory 702. The processor 701 controls the communication with peripheral devices by controlling the execution of other programs or processes, thereby controlling the operation of the network device 700, so as to implement the operation steps of the foregoing method.
存储器702还可以用于存储来自于上游设备的报文。The memory 702 may also be used to store messages from upstream devices.
接收器703用于接收来自于上游设备的报文。发送器704用于将存储器存储的报文发送至下游设备。The receiver 703 is used to receive a message from an upstream device. The transmitter 704 is configured to send the message stored in the memory to the downstream device.
总线705除包括数据总线之外,还可以包括电源总线、控制总线和状态信号总线等。但是为了清楚说明起见,在图中将各种总线都标为总线705。In addition to the data bus, the bus 705 may also include a power bus, a control bus, a status signal bus, and the like. However, for clear description, various buses are marked as bus 705 in the figure.
图8是根据本申请实施例提供的网络设备的结构框图。图8所示的网络设备800包括:第一处理器801,第二处理器802,第一存储器803,第二存储器804,接收器805和发送器806。Fig. 8 is a structural block diagram of a network device provided according to an embodiment of the present application. The network device 800 shown in FIG. 8 includes: a first processor 801, a second processor 802, a first memory 803, a second memory 804, a receiver 805, and a transmitter 806.
接收器805和发送器806与图7所示的网络设备700中的接收器703和发送器704的实现方式和功能相同,为了简洁在此就不再赘述。The receiver 805 and the transmitter 806 have the same implementation manners and functions as the receiver 703 and the transmitter 704 in the network device 700 shown in FIG. 7, and will not be repeated here for brevity.
第一处理器801可以用于实现上述实施例中策略管理实体的功能。The first processor 801 may be used to implement the function of the policy management entity in the foregoing embodiment.
第二处理器802可以用于实现上述实施例中报文处理实体的功能。The second processor 802 may be used to implement the function of the message processing entity in the foregoing embodiment.
第一存储器803可以用于存储第一处理器801和第二处理器802执行的程序代码。The first memory 803 may be used to store program codes executed by the first processor 801 and the second processor 802.
第二存储器804可以用于缓存来自于上游设备的报文。The second memory 804 may be used to buffer messages from the upstream device.
本申请实施例还提供一种芯片,该芯片包括逻辑电路和输入/输出接口。该逻辑电路可以与存储器耦合,用于执行存储器中的指令和/或代码,以实现上述实施例中由策略管理实体执行的功能。The embodiment of the present application also provides a chip, which includes a logic circuit and an input/output interface. The logic circuit may be coupled with the memory to execute instructions and/or codes in the memory to realize the functions performed by the policy management entity in the foregoing embodiments.
本申请实施例还提供一种芯片,该芯片包括逻辑电路和输入/输出接口。该逻辑电路可以与存储器耦合,用于执行存储器中的指令和/或代码,该芯片可以执行上述实施例中由报文处理实体执行的功能。The embodiment of the present application also provides a chip, which includes a logic circuit and an input/output interface. The logic circuit may be coupled with the memory for executing instructions and/or codes in the memory, and the chip may perform the functions performed by the message processing entity in the foregoing embodiments.
本申请实施例还提供一种芯片,该芯片包括逻辑电路和输入/输出接口。该逻辑电路可以与存储器耦合,用于执行存储器中的指令和/或代码,该芯片可以执行上述实施例中由策略管理实体和报文处理实体执行的功能。The embodiment of the present application also provides a chip, which includes a logic circuit and an input/output interface. The logic circuit may be coupled with the memory to execute instructions and/or codes in the memory, and the chip may perform the functions performed by the policy management entity and the message processing entity in the foregoing embodiments.
上述芯片可以是现场可编程门阵列(field programmable gate array,FPGA),可以是专用集成芯片(application specific integrated circuit,ASIC),还可以是系统芯片(system on chip,SoC),还可以是中央处理器(central processor unit,CPU),还可以是网络处理器(network processor,NP),还可以是数字信号处理电路(digital signal processor,DSP),还可以是微控制器(micro controller unit,MCU),还可以是可编程控制器(programmable logic device,PLD)、其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件,或其他集成芯片。The aforementioned chip can be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), or a central processing unit. The central processor unit (CPU) can also be a network processor (NP), a digital signal processing circuit (digital signal processor, DSP), or a microcontroller (microcontroller unit, MCU) It may also be a programmable logic device (PLD), other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, or other integrated chips.
本申请实施例还提供一种计算机可读存储介质,其上存储有指令,该指令被执行时执行上述方法实施例中的方法。The embodiment of the present application also provides a computer-readable storage medium on which an instruction is stored, and the method in the foregoing method embodiment is executed when the instruction is executed.
本申请实施例还提供一种计算机可读存储介质,其上存储有指令,该指令被执行时执行上述方法实施例中策略管理实体执行的步骤。An embodiment of the present application also provides a computer-readable storage medium on which an instruction is stored, and when the instruction is executed, the steps performed by the policy management entity in the foregoing method embodiment are executed.
本申请实施例还提供一种计算机可读存储介质,其上存储有指令,该指令被执行时执行上述方法实施例中报文处理实体执行的步骤。The embodiment of the present application also provides a computer-readable storage medium on which an instruction is stored, and when the instruction is executed, the steps performed by the message processing entity in the foregoing method embodiment are executed.
作为本实施例的一种形式,提供一种包含指令的计算机程序产品,该指令被执行时执行上述方法实施例中的方法。As a form of this embodiment, a computer program product containing instructions is provided, and when the instructions are executed, the method in the foregoing method embodiment is executed.
作为本实施例的一种形式,提供一种包含指令的计算机程序产品,该指令被执行时执行上述方法实施例中策略管理实体执行的步骤。As a form of this embodiment, a computer program product containing instructions is provided, and when the instructions are executed, the steps performed by the policy management entity in the foregoing method embodiments are executed.
作为本实施例的一种形式,提供一种包含指令的计算机程序产品,该指令被执行时执行上述方法实施例中报文处理实体执行的步骤。As a form of this embodiment, a computer program product containing instructions is provided, and when the instructions are executed, the steps performed by the message processing entity in the foregoing method embodiments are executed.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。A person of ordinary skill in the art may realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware or a combination of computer software and electronic hardware. Whether these functions are executed by hardware or software depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and conciseness of description, the specific working process of the system, device and unit described above can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed system, device, and method can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or It can be integrated into another system, or some features can be ignored or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the technical solution of the present application essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program code .
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above are only specific implementations of this application, but the protection scope of this application is not limited to this. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in this application. Should be covered within the scope of protection of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.

Claims (33)

  1. 一种网络设备中处理报文的方法,其特征在于,所述网络设备包括策略管理实体,缓存实体和报文处理实体,所述方法包括:A method for processing packets in a network device, wherein the network device includes a policy management entity, a cache entity, and a packet processing entity, and the method includes:
    所述策略管理实体获取第一缓存状态信息,所述第一缓存状态信息指示所述缓存实体在第一时刻的第一状态;Acquiring, by the policy management entity, first cache state information, where the first cache state information indicates the first state of the cache entity at the first moment;
    所述策略管理实体根据所述第一缓存状态信息,确定第一报文处理策略,并将所述第一报文处理策略发送至所述报文处理实体;Determining, by the policy management entity, a first packet processing strategy according to the first cache status information, and sending the first packet processing strategy to the packet processing entity;
    所述报文处理实体根据所述第一报文处理策略对新接收到的报文进行处理。The message processing entity processes the newly received message according to the first message processing policy.
  2. 如权利要求1所述的方法,其特征在于,所述策略管理实体获取第一缓存状态信息之前,所述方法还包括:The method according to claim 1, wherein before the policy management entity obtains the first cache status information, the method further comprises:
    所述策略管理实体获取所述缓存实体在所述第一时刻的以下至少一种信息:发送队列的长度,所述发送队列的缓存占用量,所述发送队列的时延,所述缓存实体的可用容量,所述缓存实体的已用容量,所述缓存实体的出端口的速率;The policy management entity obtains at least one of the following information of the buffer entity at the first moment: the length of the sending queue, the buffer occupancy of the sending queue, the delay of the sending queue, the length of the buffer entity Available capacity, the used capacity of the cache entity, and the rate of the outgoing port of the cache entity;
    所述策略管理实体根据获取的所述至少一种信息,确定所述第一缓存状态信息。The policy management entity determines the first cache state information according to the acquired at least one type of information.
  3. 如权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1, wherein the method further comprises:
    所述缓存实体确定所述第一缓存状态信息;Determining the first cache state information by the cache entity;
    所述策略管理实体获取第一缓存状态信息,包括:The obtaining of the first cache state information by the policy management entity includes:
    所述策略管理实体从所述缓存实体获取所述第一缓存状态信息。The policy management entity obtains the first cache state information from the cache entity.
  4. 如权利要求3所述的方法,其特征在于,所述策略管理实体从所述缓存实体获取所述第一缓存状态信息包括:The method of claim 3, wherein the policy management entity acquiring the first cache state information from the cache entity comprises:
    所述策略管理实体接收所述缓存实体发送的所述第一缓存状态信息。The policy management entity receives the first cache state information sent by the cache entity.
  5. 如权利要求4所述的方法,其特征在于,在所述缓存实体向所述策略管理实体发送所述第一缓存状态信息之前,所述方法还包括:The method according to claim 4, wherein before the cache entity sends the first cache status information to the policy management entity, the method further comprises:
    所述缓存实体确定所述第一状态满足第一预设条件。The caching entity determines that the first state satisfies a first preset condition.
  6. 如权利要求1至5中任一项所述的方法,其特征在于,所述第一状态包括正常或异常。The method according to any one of claims 1 to 5, wherein the first state includes normal or abnormal.
  7. 如权利要求1至5中任一项所述的方法,其特征在于,所述第一状态包括以下至少一项:发送队列的长度,所述发送队列的缓存占用量,所述发送队列的时延,所述缓存实体的可用容量,所述缓存实体的已用容量,所述缓存实体的出端口的速率。The method according to any one of claims 1 to 5, wherein the first state includes at least one of the following: the length of the sending queue, the buffer occupancy of the sending queue, and the time of the sending queue. Extension, the available capacity of the cache entity, the used capacity of the cache entity, and the rate of the outgoing port of the cache entity.
  8. 如权利要求1至7中任一项所述的方法,其特征在于,在所述策略管理实体根据所述第一缓存状态信息,确定第一报文处理策略之前,所述方法还包括:The method according to any one of claims 1 to 7, characterized in that, before the policy management entity determines a first packet processing policy according to the first cache status information, the method further comprises:
    所述策略管理实体确定所述第一缓存状态信息满足第二预设条件。The policy management entity determines that the first cache state information satisfies a second preset condition.
  9. 如权利要求1至5中任一项所述的方法,其特征在于,所述缓存实体包括目标缓存空间,所述第一状态包括所述目标缓存空间在所述第一时刻的使用情况;The method according to any one of claims 1 to 5, wherein the cache entity includes a target cache space, and the first state includes a usage situation of the target cache space at the first moment;
    所述策略管理实体根据所述第一缓存状态信息,确定第一报文处理策略,包括:The policy management entity determines the first message processing policy according to the first cache status information, including:
    所述策略管理实体根据所述目标缓存空间在所述第一时刻的使用情况,确定所述第一报文处理策略。The policy management entity determines the first message processing policy according to the usage of the target cache space at the first moment.
  10. 如权利要求1至9中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 9, wherein the method further comprises:
    所述策略管理实体获取第二缓存状态信息,所述第二缓存状态信息指示所述缓存实体在第二时刻的第二状态;Acquiring, by the policy management entity, second cache state information, where the second cache state information indicates the second state of the cache entity at the second moment;
    所述策略管理实体根据所述第二缓存状态信息,确定第二报文处理策略,并将所述第二报文处理策略发送至所述报文处理实体;Determining, by the policy management entity, a second packet processing strategy according to the second cache state information, and sending the second packet processing strategy to the packet processing entity;
    所述报文处理实体根据所述第二报文处理策略处理新接收到的报文。The message processing entity processes the newly received message according to the second message processing strategy.
  11. 如权利要求10所述的方法,其特征在于,所述第二报文处理策略用于指示所述报文处理实体不再执行所述第一报文处理策略。The method according to claim 10, wherein the second message processing strategy is used to instruct the message processing entity to no longer execute the first message processing strategy.
  12. 如权利要求11所述的方法,其特征在于,所述第二报文处理策略还用于指示所述报文处理实体使用指定报文处理策略处理新接收到的报文。The method according to claim 11, wherein the second message processing strategy is further used to instruct the message processing entity to use a specified message processing strategy to process newly received messages.
  13. 如权利要求12所述的方法,其特征在于,所述指定报文处理策略为默认的报文处理策略或者在使用所述第一报文处理策略之前使用的报文处理策略。The method according to claim 12, wherein the designated message processing strategy is a default message processing strategy or a message processing strategy used before the first message processing strategy is used.
  14. 如权利要求1至13中任一项所述的方法,其特征在于,所述新接收的报文包括无损流量报文。The method according to any one of claims 1 to 13, wherein the newly received message comprises a lossless traffic message.
  15. 如权利要求1至14中任一项所述的方法,其特征在于,所述报文处理实体根据所述第一报文处理策略对新接收到的报文进行处理,包括:The method according to any one of claims 1 to 14, wherein the message processing entity processes the newly received message according to the first message processing strategy, comprising:
    所述报文处理实体采用以下一种或多种处理方式:The message processing entity adopts one or more of the following processing methods:
    丢弃所有所述新接收到的报文;Discard all the newly received messages;
    丢弃部分所述新接收到的报文;Discarding part of the newly received message;
    对所有所述新接收的报文的报文信息进行修改;或者Modify the message information of all the newly received messages; or
    对部分所述新接收到的报文的报文信息进行修改。Modify some of the message information of the newly received message.
  16. 如权利要求15所述的方法,其特征在于,修改所述新接收到的报文的报文信息包括:The method according to claim 15, wherein modifying the message information of the newly received message comprises:
    对所述新接收到的报文的以下一种或多种信息进行修改:Modify one or more of the following information of the newly received message:
    所述新接收到的报文的优先级;The priority of the newly received message;
    所述新接收到的报文的丢弃使能位;The discard enable bit of the newly received message;
    所述新接收到的报文的丢弃优先级;The discarding priority of the newly received message;
    所述新接收到的报文的端口号;或者The port number of the newly received message; or
    所述新接收到的报文的显示拥塞标志位。The display congestion flag of the newly received message.
  17. 一种网络设备,其特征在于,所述网络设备包括策略管理实体,缓存实体和报文处理实体,所述方法包括:A network device, characterized in that the network device includes a policy management entity, a cache entity, and a message processing entity, and the method includes:
    所述策略管理实体,用于获取第一缓存状态信息,所述第一缓存状态信息指示所述缓存实体在第一时刻的第一状态;The policy management entity is configured to obtain first cache state information, where the first cache state information indicates the first state of the cache entity at a first moment;
    所述策略管理实体,用于根据所述第一缓存状态信息,确定第一报文处理策略,并将所述第一报文处理策略发送至所述报文处理实体;The policy management entity is configured to determine a first packet processing strategy according to the first cache status information, and send the first packet processing strategy to the packet processing entity;
    所述报文处理实体,用于根据所述第一报文处理策略对新接收到的报文进行处理。The message processing entity is configured to process the newly received message according to the first message processing strategy.
  18. 如权利要求17所述的网络设备,其特征在于,The network device of claim 17, wherein:
    所述策略管理实体,还用于获取所述缓存实体在所述第一时刻的以下至少一种信息:发送队列的长度,所述发送队列的缓存占用量,所述发送队列的时延,所述缓存实体的可 用容量,所述缓存实体的已用容量,所述缓存实体的出端口的速率;The policy management entity is further configured to obtain at least one of the following information of the buffer entity at the first moment: the length of the sending queue, the buffer occupation of the sending queue, the delay of the sending queue, the The available capacity of the cache entity, the used capacity of the cache entity, and the rate of the outgoing port of the cache entity;
    所述策略管理实体,具体用于根据获取的所述至少一种信息,确定所述第一缓存状态信息。The policy management entity is specifically configured to determine the first cache state information according to the acquired at least one type of information.
  19. 如权利要求17所述的网络设备,其特征在于,所述缓存实体,还用于确定所述第一缓存状态信息;The network device according to claim 17, wherein the cache entity is further used to determine the first cache state information;
    所述策略管理实体,具体用于从所述缓存实体获取所述第一缓存状态信息。The policy management entity is specifically configured to obtain the first cache state information from the cache entity.
  20. 如权利要求19所述的网络设备,其特征在于,所述策略管理实体,具体用于接收所述缓存实体发送的所述第一缓存状态信息。The network device according to claim 19, wherein the policy management entity is specifically configured to receive the first cache state information sent by the cache entity.
  21. 如权利要求20所述的网络设备,其特征在于,所述缓存实体,还用于在向所述策略管理实体发送所述第一缓存状态信息之前,确定所述第一状态满足第一预设条件。The network device according to claim 20, wherein the cache entity is further configured to determine that the first state satisfies a first preset before sending the first cache state information to the policy management entity condition.
  22. 如权利要求17至21中任一项所述的网络设备,其特征在于,所述第一状态包括正常或异常。The network device according to any one of claims 17 to 21, wherein the first state includes normal or abnormal.
  23. 如权利要求17至21中任一项所述的网络设备,其特征在于,所述第一状态包括以下至少一项:发送队列的长度,所述发送队列的缓存占用量,所述发送队列的时延,所述缓存实体的可用容量,所述缓存实体的已用容量,所述缓存实体的出端口的速率。The network device according to any one of claims 17 to 21, wherein the first state includes at least one of the following: the length of the sending queue, the buffer occupancy of the sending queue, and the size of the sending queue. Delay, the available capacity of the cache entity, the used capacity of the cache entity, and the rate of the outgoing port of the cache entity.
  24. 如权利要求17至23中任一项所述的网络设备,其特征在于,在所述策略管理实体,还用于在根据所述第一缓存状态信息,确定第一报文处理策略之前,确定所述第一缓存状态信息满足第二预设条件。The network device according to any one of claims 17 to 23, wherein the policy management entity is further configured to determine before determining the first packet processing policy according to the first cache status information The first cache state information satisfies a second preset condition.
  25. 如权利要求17至21中任一项所述的网络设备,其特征在于,所述缓存实体包括目标缓存空间,所述第一状态包括所述目标缓存空间在所述第一时刻的使用情况;The network device according to any one of claims 17 to 21, wherein the cache entity includes a target cache space, and the first state includes a usage situation of the target cache space at the first moment;
    所述策略管理实体,具体用于根据所述目标缓存空间在所述第一时刻的使用情况,确定所述第一报文处理策略。The policy management entity is specifically configured to determine the first packet processing policy according to the usage of the target cache space at the first moment.
  26. 如权利要求17至25中任一项所述的网络设备,其特征在于,The network device according to any one of claims 17 to 25, wherein:
    所述策略管理实体,还用于获取第二缓存状态信息,所述第二缓存状态信息指示所述缓存实体在第二时刻的第二状态;The policy management entity is further configured to obtain second cache state information, where the second cache state information indicates the second state of the cache entity at the second moment;
    所述策略管理实体,还用于根据所述第二缓存状态信息,确定第二报文处理策略,并将所述第二报文处理策略发送至所述报文处理实体;The policy management entity is further configured to determine a second packet processing strategy according to the second cache state information, and send the second packet processing strategy to the packet processing entity;
    所述报文处理实体,还用于根据所述第二报文处理策略处理新接收到的报文。The message processing entity is further configured to process the newly received message according to the second message processing strategy.
  27. 如权利要求26所述的网络设备,其特征在于,所述第二报文处理策略用于指示所述报文处理实体不再执行所述第一报文处理策略。The network device according to claim 26, wherein the second packet processing strategy is used to instruct the packet processing entity to no longer execute the first packet processing strategy.
  28. 如权利要求27所述的网络设备,其特征在于,所述第二报文处理策略还用于指示所述报文处理实体使用指定报文处理策略处理新接收到的报文。The network device according to claim 27, wherein the second message processing strategy is further used to instruct the message processing entity to use a specified message processing strategy to process newly received messages.
  29. 如权利要求28所述的网络设备,其特征在于,所述指定报文处理策略为默认的报文处理策略或者在使用所述第一报文处理策略之前使用的报文处理策略。The network device according to claim 28, wherein the designated message processing strategy is a default message processing strategy or a message processing strategy used before the first message processing strategy is used.
  30. 如权利要求17至29中任一项所述的网络设备,其特征在于,所述新接收的报文包括无损流量报文。The network device according to any one of claims 17 to 29, wherein the newly received message comprises a lossless traffic message.
  31. 如权利要求17至30中任一项所述的网络设备,其特征在于,所述报文处理实体,具体用于采用以下一种或多种处理方式处理新接收到的报文:The network device according to any one of claims 17 to 30, wherein the message processing entity is specifically configured to use one or more of the following processing methods to process a newly received message:
    丢弃所有所述新接收到的报文;Discard all the newly received messages;
    丢弃部分所述新接收到的报文;Discarding part of the newly received message;
    对所有所述新接收的报文的报文信息进行修改;或者Modify the message information of all the newly received messages; or
    对部分所述新接收到的报文的报文信息进行修改。Modify some of the message information of the newly received message.
  32. 如权利要求31所述的网络设备,其特征在于,所述报文处理实体,具体用于对所述新接收到的报文的以下一种或多种信息进行修改:The network device according to claim 31, wherein the message processing entity is specifically configured to modify one or more of the following information of the newly received message:
    所述新接收到的报文的优先级;The priority of the newly received message;
    所述新接收到的报文的丢弃使能位;The discard enable bit of the newly received message;
    所述新接收到的报文的丢弃优先级;The discarding priority of the newly received message;
    所述新接收到的报文的端口号;或者The port number of the newly received message; or
    所述新接收到的报文的显示拥塞标志位。The display congestion flag of the newly received message.
  33. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储用于如权利要求1至16中任一项所述的方法的指令。A computer-readable storage medium, wherein the computer-readable storage medium stores instructions for the method according to any one of claims 1 to 16.
PCT/CN2021/087575 2020-04-17 2021-04-15 Method for processing message in network device, and related device WO2021209016A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010307569.8A CN113542152A (en) 2020-04-17 2020-04-17 Method for processing message in network equipment and related equipment
CN202010307569.8 2020-04-17

Publications (1)

Publication Number Publication Date
WO2021209016A1 true WO2021209016A1 (en) 2021-10-21

Family

ID=78084771

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/087575 WO2021209016A1 (en) 2020-04-17 2021-04-15 Method for processing message in network device, and related device

Country Status (2)

Country Link
CN (1) CN113542152A (en)
WO (1) WO2021209016A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114024923A (en) * 2021-10-30 2022-02-08 江苏信而泰智能装备有限公司 Multithreading message capturing method, electronic equipment and computer storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070076602A1 (en) * 2002-06-03 2007-04-05 Jeffries Clark D Flow Control in Computer Networks
US20090245104A1 (en) * 2008-03-27 2009-10-01 Fujitsu Limited Apparatus and method for controlling buffering of an arrival packet
CN101582842A (en) * 2008-05-16 2009-11-18 华为技术有限公司 Congestion control method and congestion control device
US20130070584A1 (en) * 2011-09-15 2013-03-21 Michael D. Hutchison Network impairment unit for concurrent delay and packet queue impairments
CN106603426A (en) * 2015-10-19 2017-04-26 大唐移动通信设备有限公司 Message discarding method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102006226B (en) * 2010-11-19 2013-01-02 福建星网锐捷网络有限公司 Message cache management method and device as well as network equipment
CN106685848A (en) * 2015-11-10 2017-05-17 中兴通讯股份有限公司 Message discarding method and device
CN108011845A (en) * 2016-10-28 2018-05-08 深圳市中兴微电子技术有限公司 A kind of method and apparatus for reducing time delay

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070076602A1 (en) * 2002-06-03 2007-04-05 Jeffries Clark D Flow Control in Computer Networks
US20090245104A1 (en) * 2008-03-27 2009-10-01 Fujitsu Limited Apparatus and method for controlling buffering of an arrival packet
CN101582842A (en) * 2008-05-16 2009-11-18 华为技术有限公司 Congestion control method and congestion control device
US20130070584A1 (en) * 2011-09-15 2013-03-21 Michael D. Hutchison Network impairment unit for concurrent delay and packet queue impairments
CN106603426A (en) * 2015-10-19 2017-04-26 大唐移动通信设备有限公司 Message discarding method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114024923A (en) * 2021-10-30 2022-02-08 江苏信而泰智能装备有限公司 Multithreading message capturing method, electronic equipment and computer storage medium

Also Published As

Publication number Publication date
CN113542152A (en) 2021-10-22

Similar Documents

Publication Publication Date Title
US10382362B2 (en) Network server having hardware-based virtual router integrated circuit for virtual networking
EP2928136B1 (en) Host network accelerator for data center overlay network
EP2928135B1 (en) Pcie-based host network accelerators (hnas) for data center overlay network
CN110493145B (en) Caching method and device
US10193831B2 (en) Device and method for packet processing with memories having different latencies
US8248930B2 (en) Method and apparatus for a network queuing engine and congestion management gateway
EP2928132B1 (en) Flow-control within a high-performance, scalable and drop-free data center switch fabric
KR100875739B1 (en) Apparatus and method for packet buffer management in IP network system
WO2020134425A1 (en) Data processing method, apparatus, and device, and storage medium
US11646980B2 (en) Technologies for packet forwarding on ingress queue overflow
CN110830382A (en) Message processing method and device, communication equipment and switching circuit
WO2021209016A1 (en) Method for processing message in network device, and related device
US11552905B2 (en) Managing virtual output queues
US11477122B2 (en) Technologies for selecting non-minimal paths and throttling port speeds to increase throughput in a network
JP2021144324A (en) Communication device, method for controlling communication device, and integrated circuit
CN114095431A (en) Queue management method and network equipment
CN112787919A (en) Message transmission method and device and readable medium
US11658924B2 (en) Buffer allocation method, and device
US9325640B2 (en) Wireless network device buffers
CN117749726A (en) Method and device for mixed scheduling of output port priority queues of TSN switch
CN116567088A (en) Data transmission method, apparatus, computer device, storage medium, and program product

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21787647

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21787647

Country of ref document: EP

Kind code of ref document: A1