Control methods and devices for message buffering, storage media and electronic devices

By introducing a cache management module and a target resource status information table into the chip, the problem of low chip message caching success rate is solved, and more efficient message caching operations are achieved.

CN116614461BActive Publication Date: 2025-10-28SUZHOU CENTEC COMM CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310601589.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-25
Publication Date
2025-10-28
Estimated Expiration
2043-05-25

AI Technical Summary

Technical Problem

In existing technologies, chip message caching resources are limited, resulting in a low message caching success rate.

Method used

By introducing a cache management module into the chip, the cache status of the cache space is recorded using the target resource status information table, the target cache status is extracted, and corresponding cache operations are performed according to the cache status, thus avoiding the continued caching of packets when the cache space is full.

Benefits of technology

It improves the success rate of message caching, reduces the difficulty of retrieving cache space status, and avoids resource waste.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116614461B_ABST
    Figure CN116614461B_ABST
Patent Text Reader

Abstract

This application discloses a message caching control method and apparatus, storage medium, and electronic device. The message caching control method includes: obtaining a target message transmitted from a message receiving module to a message sending module, wherein the message to be forwarded by the message sending module includes the target message; calling a target resource status information table corresponding to the message sending module, wherein the target resource status information table is used to record the cache status of the cache space, and the cache status is used to indicate whether the cache space allows continued caching of messages; extracting the target cache status of the cache space from the target resource status information table; and performing a caching operation corresponding to the target cache status on the target message. By adopting the above technical solution, the problem of low success rate of message caching in related technologies is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of chips, and more specifically, to a control method and apparatus for message buffering, a storage medium, and an electronic device. Background Technology

[0002] When a chip receives a message to be forwarded, it often needs to cache the message in the chip before forwarding it. In existing technologies, the message is often cached directly in the chip. However, the chip has limited resources for caching messages, and it is possible that the chip's resources for caching messages may be full, but messages continue to be cached in the chip, resulting in message caching failure.

[0003] No effective solution has yet been proposed to address the low success rate of message caching in related technologies. Summary of the Invention

[0004] This application provides a message caching control method and apparatus, storage medium and electronic device to at least solve the problem of low success rate of message caching in related technologies.

[0005] According to one embodiment of this application, a message caching control method is provided, applied to a cache management module in a chip. The chip further includes a message receiving module and a message sending module. The message receiving module is used to receive messages to be forwarded. The message sending module includes a cache space for caching messages to be forwarded by the message sending module. The message sending module is used to send the cached messages in the cache space. The method includes: obtaining a target message transmitted by the message receiving module to the message sending module, wherein the message to be forwarded by the message sending module includes the target message; calling a target resource status information table corresponding to the message sending module, wherein the target resource status information table is used to record the cache status of the cache space, and the cache status is used to indicate whether the cache space allows continued caching of messages; extracting the target cache status of the cache space from the target resource status information table; and performing a caching operation corresponding to the target cache status on the target message.

[0006] Optionally, the step of calling the target resource status information table corresponding to the message sending module includes: detecting the target resource dimension corresponding to the target message, wherein the cache space has multiple resource dimension division methods, and the multiple resource dimensions include the target resource dimension; extracting the resource status information table corresponding to the target resource dimension from the resource dimensions and resource status information tables with corresponding relationships as the target resource status information table.

[0007] Optionally, extracting the target cache state of the cache space from the target resource status information table includes: detecting the target sending resource corresponding to the target packet under the target resource dimension, wherein the cache space is divided into multiple cache resources according to the target resource dimension, the packet sending module includes multiple sending resources divided according to the target resource dimension, the packet sending module is used to send packets cached in multiple cache resources through multiple sending resources, and the multiple sending resources correspond one-to-one with the multiple cache resources; searching for the cache state corresponding to the target cache resource from the target resource status information table as the target cache state, wherein the target resource status information table is used to record the cache resources and cache states with corresponding relationships, the cache state is used to indicate whether the corresponding cache resource is allowed to continue caching packets, and the target cache resource is the cache resource corresponding to the target sending resource.

[0008] Optionally, the method further includes: obtaining a target update request, wherein the target update request is used to request an update to the cache state of the cache space; responding to the target update request, obtaining the packet length of cached packets in the cache space from the resource count table of the cache space, and obtaining a first packet length threshold for allowed cached packets in the cache space from the resource quota table of the cache space; and updating the cache state corresponding to the cache space in the target resource state information table according to the relationship between the first packet length threshold and the packet length.

[0009] Optionally, updating the cache status corresponding to the cache space in the target resource status information table based on the relationship between the first message length threshold and the message length includes: when the message length is less than or equal to the first message length threshold, updating the cache status of the cache space in the target resource status information table to allow caching of messages in the cache space; and when the message length is greater than the first message length threshold, updating the cache status of the cache space in the target resource status information table to disallow caching of messages in the cache space.

[0010] Optionally, obtaining the target update request includes: detecting a target time period on the status update path of the cache management module, wherein the status update path is independent of the critical path of the cache management module, the critical path is used to execute the steps of obtaining the target packet transmitted by the packet receiving module to the packet sending module, calling the target resource status information table corresponding to the packet sending module, extracting the target cache status of the cache space from the target resource status information table, and performing the cache operation corresponding to the target cache status on the target packet; determining that the target update request has been obtained each time the start time of the target time period is detected, wherein the target time period is divided into a target number of scanning periods, the target number being the number of sending resources included in the packet sending module, and each scanning period being used to update the resource status information table corresponding to a sending resource included in the packet sending module.

[0011] Optionally, after extracting the target cache state of the cache space from the target resource status information table, the method further includes: obtaining a second packet length threshold for allowed cached packets in the cache space from the resource quota table of the cache space; reducing the second packet length threshold to obtain a third packet length threshold, wherein the third packet length threshold is less than the second packet length threshold; and updating the second packet length threshold in the resource quota table to the third packet length threshold.

[0012] According to another embodiment of this application, a message caching control device is also provided, applied to a cache management module in a chip. The chip further includes: a message receiving module and a message sending module. The message receiving module is used to receive messages to be forwarded. The message sending module includes a cache space for caching messages to be forwarded by the message sending module. The message sending module is used to send the messages cached in the cache space. The device includes: a first acquisition module for acquiring a target message transmitted by the message receiving module to the message sending module, wherein the message to be forwarded by the message sending module includes the target message; a calling module for calling a target resource status information table corresponding to the message sending module, wherein the target resource status information table is used to record the cache status of the cache space, and the cache status is used to indicate whether the cache space allows continued caching of messages; an extraction module for extracting the target cache status of the cache space from the target resource status information table; and an execution module for performing a caching operation corresponding to the target cache status on the target message.

[0013] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer-readable storage medium, and the computer program is configured to execute the above-described message buffering control method at runtime.

[0014] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the above-described message buffering control method through the computer program.

[0015] In this embodiment, the following steps are taken: The target message transmitted from the message receiving module to the message sending module is obtained, where the message to be forwarded by the message sending module includes the target message; the target resource status information table corresponding to the message sending module is called, where the target resource status information table records the cache status of the cache space, and the cache status indicates whether the cache space allows continued caching of messages; the target cache status of the cache space is extracted from the target resource status information table; and the caching operation corresponding to the target cache status is performed on the target message. That is, when the message receiving module receives a message to be forwarded, it will transmit the received message to the message sending module. In other words, when it is necessary to cache the message in the cache space of the message sending module, the target resource status information table corresponding to the message sending module can be called to directly extract whether the cache space allows continued caching of messages. This achieves a simple and direct extraction of the cache status of the cache space from the resource status information table, reducing the difficulty of extracting the cache status of the cache space. Furthermore, the corresponding caching operation can be performed directly on the message based on the cache status, avoiding the continued caching of messages in the cache space even when it is full, thus improving the success rate of message caching.

[0016] By adopting the above technical solution, the problem of low success rate of message caching in related technologies is solved, and the technical effect of improving the success rate of message caching is achieved. Attached Figure Description

[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0018] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0019] Figure 1This is a schematic diagram of the hardware environment for a message caching control method according to an embodiment of this application;

[0020] Figure 2 This is a flowchart of a message caching control method according to an embodiment of this application;

[0021] Figure 3 This is a schematic diagram of an optional chip structure according to an embodiment of this application;

[0022] Figure 4 This is a schematic diagram of an optional cache space according to an embodiment of this application;

[0023] Figure 5 This is a schematic diagram illustrating an optional method of sending and caching resources at the target port resource level, according to an embodiment of this application.

[0024] Figure 6 This is a schematic diagram of an optional transmission resource and cache resource at the target message queue dimension according to an embodiment of this application;

[0025] Figure 7 This is a schematic diagram illustrating an optional method for determining whether to allow cached packets according to an embodiment of this application;

[0026] Figure 8 This is a schematic diagram of a message caching control method according to an embodiment of this application;

[0027] Figure 9 This is a structural block diagram of a message caching control device according to an embodiment of this application. Detailed Implementation

[0028] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0029] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0030] The methods and embodiments provided in this application can be executed on a computer terminal, device terminal, or similar computing device. Taking running on a computer terminal as an example, Figure 1 This is a schematic diagram of the hardware environment for a message caching control method according to an embodiment of this application. Figure 1 As shown, a computer terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. In one exemplary embodiment, the computer terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the computer terminal described above. For example, the computer terminal may also include components that are more complex than those described above. Figure 1 The more or fewer components shown, or having the same Figure 1 Equivalent functions or ratios shown Figure 1 The functions shown have more different configurations.

[0031] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the message caching control method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thus implementing the above-described method. The memory 104 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to a computer terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0032] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider for the computer terminal. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.

[0033] This embodiment provides a message buffering control method, applied to the aforementioned computer terminal. Figure 2 This is a flowchart of a message caching control method according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps:

[0034] Step S202: Obtain the target message transmitted by the message receiving module to the message sending module, wherein the message to be forwarded by the message sending module includes the target message;

[0035] Step S204: Call the target resource status information table corresponding to the message sending module, wherein the target resource status information table is used to record the cache status of the cache space, and the cache status is used to indicate whether the cache space allows to continue caching messages;

[0036] Step S206: Extract the target cache status of the cache space from the target resource status information table;

[0037] Step S208: Perform the caching operation corresponding to the target cache state on the target message.

[0038] Through the above steps, the target message transmitted from the message receiving module to the message sending module is obtained. The message to be forwarded by the message sending module includes the target message. The target resource status information table corresponding to the message sending module is called. This table records the cache status of the cache space, indicating whether the cache space allows continued caching of messages. The target cache status of the cache space is extracted from the target resource status information table. The caching operation corresponding to the target cache status is performed on the target message. In other words, when the message receiving module receives a message to be forwarded, it transmits the received message to the message sending module. When a message needs to be cached in the cache space of the message sending module, the target resource status information table corresponding to the message sending module can be called to directly extract whether the cache space allows continued caching of messages. This achieves a simple and direct extraction of the cache status from the resource status information table, reducing the difficulty of extracting the cache status. Furthermore, the corresponding caching operation can be performed directly on the message based on the cache status, avoiding the situation where messages are still cached in the cache space even when it is full, thus improving the success rate of message caching.

[0039] In the technical solution provided in step S202 above, the chip may include, but is not limited to, one or more message receiving modules and one or more message sending modules. The message receiving module may be used to receive messages to be forwarded by the chip, and the message sending module may be used to receive messages transmitted by one or more message receiving modules. The messages to be sent by the message sending module may include, but are not limited to, one or more messages.

[0040] Figure 3 This is a schematic diagram of an optional chip structure according to an embodiment of this application, such as... Figure 3As shown, chip 202 deploys a message receiving module 202-1, a cache management module 202-2, a message storage module 202-3, and a message sending module 202-4. Cache space 1 is deployed in message sending module 202-4. When message receiving module 202-1 receives a message to be forwarded, it requests cache resources from cache management module 202-2. Cache management module 202-2 calls the resource status information table corresponding to message sending module 202-4, extracts the cache status of cache space 1 from the resource status information table, determines whether it is allowed to continue caching the message in cache space 1, and returns the result to message receiving module 202-1. Based on the result returned by cache management module 202-2, message receiving module 202-1 either stores the message in cache space 1 through message storage module 202-3 or directly discards the message. After the message sending module 202-4 forwards the message cached in cache space 1, the cache status of cache space 1 in cache management module 202-2 can be updated.

[0041] In the technical solution provided in step S204 above, when the message receiving module in the chip receives a message to be forwarded, the message receiving module may, but is not limited to, transmit the received message to the message sending module. In this case, the cache management module may, but is not limited to, call the target resource status information table corresponding to the message sending module. Through the method in this embodiment, by simply calling a resource status table, the resources required to obtain the cache status of the cache space corresponding to the message sending module are saved.

[0042] Optionally, in this embodiment, each message sending module may, but is not limited to, have a corresponding resource status information table, in which the cache status of the cache space corresponding to the message sending module is recorded; or, the cache status of the cache space corresponding to all message sending modules in the chip may, but is not limited to, be recorded in the same resource status information table.

[0043] Figure 4 This is a schematic diagram of an optional cache space according to an embodiment of this application, such as... Figure 4 As shown, in the chip, the total cache space in the message sending module can be divided into a shared pool and a guaranteed pool. The priority of use is that the guaranteed pool is superior to the shared pool. In detail, messages can be cached in the guaranteed pool corresponding to the message sending module first, but not limited to the shared pool. The shared pool can allocate some available storage space from the shared pool for the message sending module when the guaranteed pool of the message sending module is full.

[0044] In an exemplary embodiment, the target resource status information table corresponding to the message sending module can be invoked in the following manner, but not limited to: detecting the target resource dimension corresponding to the target message, wherein the cache space has multiple resource dimension division methods, and the multiple resource dimensions include the target resource dimension; extracting the resource status information table corresponding to the target resource dimension from the resource dimensions and resource status information tables with corresponding relationships as the target resource status information table.

[0045] Optionally, in this embodiment, it is possible, but not limited to, detecting the target port resource dimension (equivalent to the target resource dimension) corresponding to the target packet, and extracting the resource status information table corresponding to the target port resource dimension from the corresponding port resource dimensions and resource status information tables as the target resource status information table; and / or

[0046] It is possible, but not limited to, detecting the target packet queue resource dimension (equivalent to the target resource dimension) corresponding to the target packet, and extracting the resource status information table corresponding to the target packet queue resource dimension from the target packet queue resource dimension and resource status information table with corresponding relationship as the target resource status information table; wherein, the target port resource dimension may include, but is not limited to, one or more target packet queue resource dimensions.

[0047] In an exemplary embodiment, the target cache state of the cache space can be extracted from the target resource status information table in the following manner, but not limited to: detecting the target sending resource corresponding to the target packet under the target resource dimension, wherein the cache space is divided into multiple cache resources according to the target resource dimension, the packet sending module includes multiple sending resources divided according to the target resource dimension, the packet sending module is used to send packets cached in multiple cache resources through multiple sending resources, and the multiple sending resources correspond one-to-one with the multiple cache resources; searching for the cache state corresponding to the target cache resource in the target resource status information table as the target cache state, wherein the target resource status information table is used to record the cache resources and cache states with corresponding relationships, the cache state is used to indicate whether the corresponding cache resource is allowed to continue caching packets, and the target cache resource is the cache resource corresponding to the target sending resource.

[0048] Optionally, in this embodiment, the target resource dimension may include, but is not limited to, at least one of the target port resource dimension and the target packet queue resource dimension, and the target port resource dimension may include, but is not limited to, one or more target packet queue resource dimensions. Figure 5 This is a schematic diagram illustrating an optional method of sending and caching resources at the target port resource level, according to an embodiment of this application. Figure 5As shown, the buffer space in the message sending module 202-4 is divided into multiple buffer resources according to the target port resource dimension (which may include, but is not limited to, buffer resource 1, buffer resource 2, and buffer resource 3). The message sending module 202-4 includes multiple sending resources divided according to the target port resource dimension (which may include, but is not limited to, port 1, port 2, and port 3). The message sending module 202-4 is used to send the messages buffered in the multiple buffer resources (which may include, but is not limited to, buffer resource 1, buffer resource 2, and buffer resource 3) through the multiple sending resources (which may include, but is not limited to, port 1, port 2, and port 3). The buffer resource corresponding to port 1 is buffer resource 1, the buffer resource corresponding to port 2 is buffer resource 2, and the buffer resource corresponding to port 3 is buffer resource 3.

[0049] Figure 6 This is a schematic diagram illustrating an optional transmission resource and cache resource at the target message queue dimension according to an embodiment of this application, combined with... Figure 5 and Figure 6 As shown, the cache space in the message sending module 202-4 is divided into multiple cache resources according to the target port resource dimension (which may include, but is not limited to, cache resource 1, cache resource 2, and cache resource 3). The message sending module 202-4 includes multiple sending resources divided according to the target port resource dimension (which may include, but is not limited to, port 1, port 2, and port 3). Port 3 includes message queue 1, message queue 2, and message queue 3. The cache resource 3 corresponding to port 3 is divided into cache resource 3-1, cache resource 3-2, and cache resource 3-3 according to the message queue dimension. Among them, the cache resource corresponding to message queue 1 is 3-1, the cache resource corresponding to message queue 2 is 3-2, and the cache resource corresponding to message queue 3 is 3-3.

[0050] To better understand the message caching control method in the embodiments of this application, the control flow of message caching in the embodiments of this application will be explained and described below with reference to optional embodiments, which may be applied to, but is not limited to, the embodiments of this application.

[0051] Figure 7 This is a schematic diagram illustrating an optional method for determining whether to allow cached packets according to an embodiment of this application, such as... Figure 7As shown, the chip may, but is not limited to, deploy packet processing engines (PP) 1, PP 2, and PP 3 that allow parallel processing. The chip may also, but is not limited to, deploy packet receiving modules 1, PP 2, and PP 3. Packet processing engine 1 processes packets received by packet receiving module 1, packet processing engine 2 processes packets received by packet receiving module 2, and packet processing engine 3 processes packets received by packet receiving module 3. Each packet receiving module may, but is not limited to, deploy one or more packet receiving ports (the diagram illustrates this with multiple packet receiving ports). These packet receiving ports may, but are not limited to, be used to receive packets to be forwarded. The chip may, but is not limited to, deploy message sending module 1, message sending module 2, and message sending module 3. Each message sending module has one or more message sending ports deployed (the figure shows an example with multiple message sending ports deployed). The message sending ports may, but are not limited to, be used to forward messages cached in the cache space of the message sending module. In addition, each message sending module has corresponding outbound resource management (equivalent to a cache management module).

[0052] The chip may, but is not limited to, deploy message processing engines 4, 5, and 6 that allow parallel processing. The chip may, but is not limited to, deploy message sending modules 1, 2, and 3. Message processing engine 4 processes messages received by message sending module 1, message processing engine 5 processes messages received by message sending module 2, and message processing engine 6 processes messages received by message sending module 3. When a message to be forwarded is received at the message receiving port of the message receiving module, and a message sending module (which may be one or more, etc., this application does not limit this) has already been assigned to forward the received message, if multiple message sending modules are allowed to forward the message, the message receiving module may, but is not limited to, request resources from the outbound resource management of the corresponding message sending module. The outbound resource management calls the resource status information table corresponding to the message sending module, extracts the cache status of the cache space from the resource status information table corresponding to the message sending module, determines whether it is allowed to continue caching the message in the cache space, and returns the determined result to the message receiving module. Based on the result returned by the cache management module, the message receiving module stores the message in the cache space or discards the message directly. This improves the efficiency of message caching control.

[0053] Figure 8 This is a schematic diagram of a message caching control method according to an embodiment of this application, as shown below. Figure 8As shown, each message sending module's outbound resource management module (equivalent to a cache management module) maintains resource count tables (nR(read) nW(write)), resource status tables (nR1W), resource quota tables (1R), count monitoring tables (1W), and count waterline tables (1R1W) under different resource dimensions. The resource count table records the length of currently cached messages in the cache space, the resource quota table records the maximum length of messages allowed to be cached in the cache space, and the count waterline table records the maximum length of historically cached messages in the cache space.

[0054] When multiple message receiving modules receive messages and all transmit the received messages to the same message sending module (equivalent to receiving messages from message processing engines 0, 1, 2, 3, ..., m of the message receiving module), for message 1 among the multiple messages, if the target resource dimension includes the target port resource dimension, the outbound resource management module may, but is not limited to, call the port resource status table (equivalent to the target resource status information table) of port 1 used to forward message 1 on the message sending module, and then extract the cache status of the cache resource 1 corresponding to port 1 from the port resource status table. If the cache status indicates that the message can continue to be cached in cache space 1, the message is cached in cache space 1, and the length of the message is recorded in the port resource count table and the port count monitoring table. The port count monitoring table compares the length of received packets recorded in it with the historical cached packet length recorded in the counting waterline table. If the length of the received packet recorded in the port count monitoring table is greater than the historical cached packet length recorded in the counting waterline table, the packet length recorded in the port count monitoring table is updated to match the recorded length. During the forwarding of packet 1 from port 1, the cached packet length recorded in the port resource count table is updated.

[0055] Alternatively, if multiple message receiving modules receive messages and all transmit the received messages to the same message sending module (equivalent to receiving messages from message processing engines 0, 1, 2, 3, ..., m of the message receiving module), for message 1 among the multiple messages, if the target resource dimension includes the target message queue resource dimension, the outbound resource management module may, but is not limited to, call the message queue resource status table (equivalent to the target resource status information table) of message queue 1 in port 1 of the message sending module used to forward message 1, and then extract the cache status of the cache resource 2 corresponding to message queue 1 from the message queue resource status table. If the cache status indicates that the message can continue to be cached in cache space 2, the message is cached in cache space 2, and the length of the message is recorded in the queue resource count table and the queue count monitoring table. The message length of the received message recorded in the queue count monitoring table is compared with the historical cached message length recorded in the count waterline table. If the message length of the received message recorded in the queue count monitoring table is greater than the historical cached message length recorded in the count waterline table, the message length recorded in the queue count monitoring table is updated to the correct length. During the forwarding of message 1 by message queue 1, the cached message length recorded in the message queue resource count table is updated.

[0056] It should be noted that, when it is necessary to determine whether the received packets can be cached in the cache space, a new resource dimension (such as resource dimension 1 and resource dimension 2, etc.) can be determined by combining the target packet queue resource dimension and the target port resource dimension, but this application does not impose any restrictions on this.

[0057] In an exemplary embodiment, the cache state corresponding to the cache space in the resource state information table may be updated in the following manner, but is not limited to: obtaining a target update request, wherein the target update request is used to request an update to the cache state of the cache space; responding to the target update request, obtaining the packet length of the cached packets in the cache space from the resource count table of the cache space, and obtaining a first packet length threshold of the packets allowed to be cached in the cache space from the resource quota table of the cache space; updating the cache state corresponding to the cache space in the target resource state information table according to the relationship between the first packet length threshold and the packet length.

[0058] Optionally, in this embodiment, when a target update request is obtained, the cache status corresponding to the cache space recorded in the target resource status information table can be updated according to the relationship between the message length of the cached messages recorded in the resource count table of the cache space and the first message length threshold of the cached messages allowed to be cached in the cache space recorded in the resource quota table of the cache space.

[0059] It should be noted that the message length of cached messages recorded in the resource count table of the cache space may change as the message sending module completes the message transmission. It can be understood that the message length of cached messages recorded in the resource count table of the cache space refers to the message length of messages that have not yet been forwarded and are still cached in the cache space.

[0060] In one exemplary embodiment, the cache status corresponding to the cache space in the target resource status information table may be updated in the following ways, but not limited to: when the message length is less than or equal to the first message length threshold, the cache status of the cache space in the target resource status information table is updated to allow caching of messages in the cache space; when the message length is greater than the first message length threshold, the cache status of the cache space in the target resource status information table is updated to disallow caching of messages in the cache space.

[0061] Optionally, in this embodiment, if the message length is less than or equal to the first message length threshold, it can be indicated that the message is allowed to continue to be cached in the cache space. In this case, the cache status of the cache space in the target resource status information table is updated to allow the message to be cached in the cache space. For example, the cache status of the cache space in the target resource status information table is updated to available, allow caching, etc.

[0062] Optionally, in this embodiment, if the message length exceeds the first message length threshold, it can be indicated that caching messages in the cache space is not allowed. In such cases, the cache status of the cache space in the target resource status information table is updated to indicate that caching messages in the cache space is not allowed. For example, the cache status of the cache space in the target resource status information table is updated to unavailable, caching is not allowed, etc.

[0063] In an exemplary embodiment, a target update request may be obtained, but is not limited to, by means of the following: detecting a target time period on the state update path of the cache management module, wherein the state update path is independent of the critical path of the cache management module, the critical path being used to execute the steps of obtaining the target packet transmitted by the packet receiving module to the packet sending module, calling the target resource status information table corresponding to the packet sending module, extracting the target cache status of the cache space from the target resource status information table, and performing the cache operation corresponding to the target cache status on the target packet; determining that the target update request has been obtained each time the start time of the target time period is detected, wherein the target time period is divided into a target number of scan periods, the target number being the number of sending resources included in the packet sending module, and each scan period being used to update the resource status information table corresponding to a sending resource included in the packet sending module.

[0064] Optionally, in this embodiment, the target time period is the time period for updating the resource status information table corresponding to the sending resources included in the message sending module, excluding the time period for the chip to process received messages. The target update request can be determined every time the start time of the target time period is detected. In this case, the resource status information table corresponding to the sending resources included in the message sending module can be updated through a status update path independent of the critical path of the cache management module. This decoupling between the critical path and the status update path improves the chip's message processing efficiency and allows for a comprehensive determination of whether to allow message caching based on multiple resource dimensions, meeting the complex application requirements of the present.

[0065] Optionally, in this embodiment, the resource status information table corresponding to the transmission resources included in a message sending module may be updated in each scan cycle within the target time period, but is not limited to. When the target resource dimension includes the target port resource dimension, the target time period is divided into a target number of scan cycles, where the target number is the number of port transmission resources included in the message sending module. Each scan cycle is used to update the resource status information table corresponding to the port transmission resources included in a message sending module; and / or

[0066] When the target resource dimension includes the target packet queue resource dimension, the target time period is divided into a target number of scan periods. The target number is the number of packet queues in the port transmission resources included by the packet transmission module. Each scan period is used to update the resource status information table corresponding to the packet queue in the port transmission resources included by a packet transmission module.

[0067] In this way, a scanner is added for each resource dimension of the destination packet processing engine (which may include, but is not limited to, at least one of the port resource dimension and queue resource dimension). This scanner is responsible for updating the resource status of the cached resources corresponding to the packet sending module under the specified resource dimension. Since the scanning mechanism scans one port or one queue per clock cycle (equivalent to a scan cycle), its request to read the configuration table is only one read. Furthermore, the logic for dynamic threshold calculation and status check based on this configuration also requires only one copy. Additionally, after calculating the queue-based threshold and comparing it with the read counter value, the availability information for that dimension is saved to a separate status table (equivalent to a resource status information table). Because the status table stores relatively little information, it is used to respond to the results required for packet resource requests. The resource counter table is still used for updates after requesting and after releasing. Quota tables, monitoring tables, and waterline tables only need to be designed based on the scanner's access requirements, greatly reducing the number of logical instances and lowering area overhead, power consumption overhead, and layout and routing difficulties.

[0068] In the technical solution provided in step S206 above, the target cache state of the cache space to which the target message is to be stored can be extracted from the target resource status information table, but is not limited to. The target cache state may indicate that the message is allowed to continue to be cached in the cache space, or the target cache state may indicate that the message is not allowed to continue to be cached in the cache space.

[0069] Optionally, in this embodiment, the target resource status information table may, but is not limited to, record the cache status of one or more message sending modules corresponding to the cache space, or the cache status of each message sending module corresponding to the cache space may be recorded in an independent resource status information table.

[0070] In one exemplary embodiment, the packet length threshold in the resource quota table may be updated in the following manner, but is not limited to: obtaining a second packet length threshold for packets allowed to be cached in the cache space from the resource quota table of the cache space; reducing the second packet length threshold to obtain a third packet length threshold, wherein the third packet length threshold is less than the second packet length threshold; and updating the second packet length threshold in the resource quota table to the third packet length threshold.

[0071] Optionally, in this embodiment, after extracting the target cache state of the cache space from the target resource status information table, the target cache state may indicate that it is not allowed to continue caching packets in the cache space. In such a case, the total cache space in the chip used for caching packets may have been exhausted. In such a case, the packet length of the packets allowed to be cached in the cache space may be reduced, but not limited to, to avoid exhausting the total cache space in the chip used for caching packets and improve the success rate of the chip in processing packets.

[0072] Optionally, in this embodiment, the packet length of the allowed cached packets in the cache space can be adjusted through a more complex and flexible quota mechanism. Method 1: Taking into account the target port resource dimension and the target packet queue resource dimension, etc., add a dynamic threshold parameter factor based on the cache status of dimension 1 or dimension 2, select the current resource dimension (e.g., queue resource dimension), and then calculate the resource quota threshold of the current resource dimension (e.g., queue resource dimension) based on the current cache status of dimension 1 or dimension 2.

[0073] Method 2: Based on the business category (e.g., lossless business, urgent business, etc.), select the dynamic threshold parameter 'factor' for the current resource dimension (e.g., queue resource dimension), and then calculate the resource quota threshold for the current resource dimension based on the current cache status. Optionally, in this embodiment, a first dynamic threshold parameter 'factor' can be selected for lossless and urgent businesses, and a second dynamic threshold parameter 'factor' can be selected for ordinary businesses, etc., where the first dynamic threshold parameter 'factor' is greater than the second dynamic threshold parameter 'factor'.

[0074] Compared to the simple shifting, addition, and subtraction operations performed on the current cache state in related technologies, the method in this application embodiment can achieve a more complex and smoother multiplication strategy. The calculated threshold can no longer change, thus improving the rationality of updating the message length threshold.

[0075] In the technical solution provided in step S208 above, if the target cache state of the cache space indicates that the cache space is allowed to continue caching packets, the target packet is cached in the cache space; if the target cache state of the cache space indicates that the cache space is not allowed to continue caching packets, the target packet is not cached in the cache space, or the target packet is directly discarded. In this way, the cache state of the cache space can be obtained by simply calling a resource status information table, reducing the overhead of SRAM (Static Random-Access Memory) in the chip.

[0076] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.

[0077] Figure 9 This is a structural block diagram of a message buffering control device according to an embodiment of this application, such as... Figure 9 As shown, the device includes:

[0078] The first acquisition module 902 is used to acquire the target message transmitted by the message receiving module to the message sending module, wherein the message to be forwarded by the message sending module includes the target message;

[0079] The module 904 is invoked to invoke the target resource status information table corresponding to the message sending module. The target resource status information table is used to record the cache status of the cache space, and the cache status is used to indicate whether the cache space is allowed to continue caching messages.

[0080] Extraction module 906 is used to extract the target cache status of the cache space from the target resource status information table;

[0081] The execution module 908 is used to perform a caching operation corresponding to the target cache state on the target message.

[0082] Through the above embodiments, the target message transmitted from the message receiving module to the message sending module is obtained, wherein the message to be forwarded by the message sending module includes the target message; the target resource status information table corresponding to the message sending module is called, wherein the target resource status information table is used to record the cache status of the cache space, and the cache status is used to indicate whether the cache space allows to continue caching messages; the target cache status of the cache space is extracted from the target resource status information table; and the caching operation corresponding to the target cache status is performed on the target message. That is, when the message receiving module in the chip receives a message to be forwarded, it will transmit the received message to the message sending module. In other words, when it is necessary to cache the message in the cache space of the message sending module, the target resource status information table corresponding to the message sending module can be called to directly extract whether the cache space allows to continue caching messages. This realizes a simple and direct extraction of the cache status of the cache space from the resource status information table, reduces the difficulty of extracting the cache status of the cache space, and can directly perform the corresponding caching operation on the message based on the cache status, avoiding the continued caching of messages in the cache space when the cache space is full, thus improving the success rate of message caching.

[0083] In one exemplary embodiment, the calling module includes:

[0084] The first detection unit is used to detect the target resource dimension corresponding to the target message, wherein the cache space has multiple resource dimension division methods, and the multiple resource dimensions include the target resource dimension;

[0085] The extraction unit uses the resource status information table corresponding to the target resource dimension extracted from the resource dimension and resource status information table with corresponding relationships as the target resource status information table.

[0086] In one exemplary embodiment, the extraction module includes:

[0087] The second detection unit is used to detect the target sending resource corresponding to the target message under the target resource dimension. The cache space is divided into multiple cache resources according to the target resource dimension. The message sending module includes multiple sending resources divided according to the target resource dimension. The message sending module is used to send the message cached in the multiple cache resources through the multiple sending resources. The multiple sending resources correspond one-to-one with the multiple cache resources.

[0088] The lookup unit is used to look up the cache status corresponding to the target cache resource from the target resource status information table as the target cache status. The target resource status information table is used to record the cache resources and cache statuses with corresponding relationships. The cache status is used to indicate whether the corresponding cache resource is allowed to continue caching packets. The target cache resource is the cache resource corresponding to the target sending resource.

[0089] In one exemplary embodiment, the apparatus further includes:

[0090] The second acquisition module is used to acquire a target update request, wherein the target update request is used to request an update to the cache state of the cache space;

[0091] The third acquisition module is used to respond to the target update request, obtain the message length of the cached message in the cache space from the resource count table of the cache space, and obtain the first message length threshold of the cached message in the cache space from the resource quota table of the cache space.

[0092] The first update module is used to update the cache status corresponding to the cache space in the target resource status information table according to the relationship between the first message length threshold and the message length.

[0093] In one exemplary embodiment, the first update module includes:

[0094] The first update unit is configured to update the cache status of the cache space in the target resource status information table to allow caching of messages in the cache space when the message length is less than or equal to the first message length threshold.

[0095] The second update unit is used to update the cache status of the cache space in the target resource status information table to disallow caching messages in the cache space when the message length is greater than the first message length threshold.

[0096] In one exemplary embodiment, the second acquisition module includes:

[0097] The third detection unit is used to detect the target time period on the status update path of the cache management module, wherein the status update path is independent of the critical path of the cache management module. The critical path is used to execute the following steps: obtaining the target message transmitted by the message receiving module to the message sending module, calling the target resource status information table corresponding to the message sending module, extracting the target cache status of the cache space from the target resource status information table, and performing the cache operation corresponding to the target cache status on the target message.

[0098] The determining unit is used to determine the acquisition of the target update request every time the start time of the target time period is detected, wherein the target time period is divided into a target number of scanning periods, the target number being the number of sending resources included in the message sending module, and each scanning period is used to update the resource status information table corresponding to a sending resource included in the message sending module.

[0099] In one exemplary embodiment, the apparatus further includes:

[0100] The third acquisition module is used to obtain the second message length threshold of the allowed cached messages in the cache space from the resource quota table of the cache space after extracting the target cache state of the cache space from the target resource state information table.

[0101] A reduction module is used to reduce the second message length threshold to obtain a third message length threshold, wherein the third message length threshold is less than the second message length threshold;

[0102] The second update module is used to update the second message length threshold in the resource quota table to the third message length threshold.

[0103] Embodiments of this application also provide a storage medium including a stored program, wherein the program executes any of the methods described above when it is run.

[0104] Optionally, in this embodiment, the storage medium may be configured to store program code for performing the following steps:

[0105] S1, obtain the target message transmitted by the message receiving module to the message sending module, wherein the message to be forwarded by the message sending module includes the target message;

[0106] S2, call the target resource status information table corresponding to the message sending module, wherein the target resource status information table is used to record the cache status of the cache space, and the cache status is used to indicate whether the cache space allows to continue caching messages;

[0107] S3, extract the target cache status of the cache space from the target resource status information table;

[0108] S4, perform the caching operation corresponding to the target cache state on the target message.

[0109] Embodiments of this application also provide an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0110] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0111] Optionally, in this embodiment, the processor may be configured to execute the following steps through a computer program:

[0112] S1, obtain the target message transmitted by the message receiving module to the message sending module, wherein the message to be forwarded by the message sending module includes the target message;

[0113] S2, call the target resource status information table corresponding to the message sending module, wherein the target resource status information table is used to record the cache status of the cache space, and the cache status is used to indicate whether the cache space allows to continue caching messages;

[0114] S3, extract the target cache status of the cache space from the target resource status information table;

[0115] S4, perform the caching operation corresponding to the target cache state on the target message.

[0116] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0117] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.

[0118] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.

[0119] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for controlling message buffering, characterized in that, A cache management module is applied in a chip, the chip further comprising: a message receiving module and a message sending module. The message receiving module is used to receive messages to be forwarded. The message sending module includes a cache space for caching messages to be forwarded by the message sending module. The message sending module is used to send the cached messages in the cache space. The method includes: The target message transmitted by the message receiving module to the message sending module is obtained, wherein the message to be forwarded by the message sending module includes the target message; The target resource status information table corresponding to the message sending module is invoked, wherein the target resource status information table is used to record the cache status of the cache space, and the cache status is used to indicate whether the cache space is allowed to continue caching messages; Extract the target cache status of the cache space from the target resource status information table; Perform the caching operation corresponding to the target cache state on the target message; The method further includes: after the message sending module forwards the message cached in the cache space, updating the cache state corresponding to the cache space in the target resource state information; The step of updating the cache status corresponding to the cache space in the target resource status information includes: obtaining a target update request, wherein the target update request is used to request an update to the cache status of the cache space; responding to the target update request, obtaining the packet length of cached packets in the cache space from the resource count table of the cache space, and obtaining a first packet length threshold of allowed cached packets in the cache space from the resource quota table of the cache space; and updating the cache status corresponding to the cache space in the target resource status information table according to the relationship between the first packet length threshold and the packet length.

2. The method according to claim 1, characterized in that, The invocation of the target resource status information table corresponding to the message sending module includes: Detect the target resource dimension corresponding to the target message, wherein the cache space has multiple resource dimension division methods, and the multiple resource dimensions include the target resource dimension; Extract the resource status information table corresponding to the target resource dimension from the resource dimension and resource status information table with corresponding relationships, and use it as the target resource status information table.

3. The method according to claim 2, characterized in that, The step of extracting the target cache state of the cache space from the target resource status information table includes: The target message is detected to correspond to the target sending resource under the target resource dimension. The cache space is divided into multiple cache resources according to the target resource dimension. The message sending module includes multiple sending resources divided according to the target resource dimension. The message sending module is used to send the message cached in the multiple cache resources through the multiple sending resources. The multiple sending resources correspond one-to-one with the multiple cache resources. The target cache state is obtained by searching the target cache resource status information table and finding the corresponding cache state of the target cache resource. The target cache state information table is used to record the cache resources and cache states that have a corresponding relationship. The cache state is used to indicate whether the corresponding cache resource is allowed to continue caching messages. The target cache resource is the cache resource corresponding to the target sending resource.

4. The method according to claim 1, characterized in that, The step of updating the cache status corresponding to the cache space in the target resource status information table according to the relationship between the first message length threshold and the message length includes: If the message length is less than or equal to the first message length threshold, the cache status of the cache space in the target resource status information table is updated to allow the message to be cached in the cache space; If the message length is greater than the first message length threshold, the cache status of the cache space in the target resource status information table is updated to not allow caching messages in the cache space.

5. The method according to claim 1, characterized in that, The process of obtaining the target update request includes: The target time period is detected on the status update path of the cache management module. The status update path is independent of the critical path of the cache management module. The critical path is used to execute the following steps: obtaining the target message transmitted by the message receiving module to the message sending module, calling the target resource status information table corresponding to the message sending module, extracting the target cache status of the cache space from the target resource status information table, and performing the cache operation corresponding to the target cache status on the target message. Each time the start time of the target time period is detected, the target update request is obtained. The target time period is divided into a target number of scan cycles, where the target number is the number of sending resources included in the message sending module. Each scan cycle is used to update the resource status information table corresponding to a sending resource included in the message sending module.

6. The method according to claim 1, characterized in that, After extracting the target cache state of the cache space from the target resource status information table, the method further includes: Obtain the second packet length threshold of the packets allowed to be cached in the cache space from the resource quota table of the cache space; The second message length threshold is reduced to obtain a third message length threshold, wherein the third message length threshold is less than the second message length threshold; Update the second message length threshold in the resource quota table to the third message length threshold.

7. A control device for message buffering, characterized in that, A cache management module is applied in a chip, the chip further comprising: a message receiving module and a message sending module, the message receiving module being used to receive messages to be forwarded, the message sending module including a cache space for caching messages to be forwarded by the message sending module, and the message sending module being used to send the messages cached in the cache space, the device comprising: The first acquisition module is used to acquire the target message transmitted by the message receiving module to the message sending module, wherein the message to be forwarded by the message sending module includes the target message; The calling module is used to call the target resource status information table corresponding to the message sending module, wherein the target resource status information table is used to record the cache status of the cache space, and the cache status is used to indicate whether the cache space allows to continue caching messages; The extraction module is used to extract the target cache status of the cache space from the target resource status information table; The execution module is used to perform caching operations corresponding to the target cache state on the target message; The device is further configured to: after the message sending module forwards the message cached in the cache space, update the cache status corresponding to the cache space in the target resource status information; The device further includes: a second acquisition module, configured to acquire a target update request, wherein the target update request is used to request an update to the cache status of the cache space; a third acquisition module, configured to respond to the target update request, acquire the packet length of cached packets in the cache space from the resource count table of the cache space, and acquire a first packet length threshold of allowed cached packets in the cache space from the resource quota table of the cache space; and a first update module, configured to update the cache status corresponding to the cache space in the target resource status information table according to the relationship between the first packet length threshold and the packet length.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method of any one of claims 1 to 6.

9. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method of any one of claims 1 to 6 through the computer program.

Citation Information

Patent Citations

  • Queue cache resource control method and device, server and storage medium

    CN107404443A