Method, device, electronic device and storage medium for sending incentive message

By obtaining the initial parameters and determining the scanning cycle and packet transmission parameters, precise control of the excitation message flow is achieved, and the problem of inaccurate packet transmission in the prior art is solved, and the accuracy of excitation message transmission in the routing forwarding chip design is improved.

CN114338434BActive Publication Date: 2025-02-11SANECHIPS TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011025659.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-25
Publication Date
2025-02-11
Estimated Expiration
2040-09-25

AI Technical Summary

Technical Problem

In the prior art, in the design of routing forwarding chips, it is difficult to achieve precise control of the excitation message flow, especially when the packet length and packet transmission rate are variable, resulting in packet inaccuracy.

Method used

By obtaining initial parameters, such as the number of queues, packet length, packet speed, packet length change attributes and packet rate change attributes, the scanning cycle and packet transmission parameters of each queue, including the first packet sending time and packet transmission interval, to achieve incentive reports Accurate sending of text.

Benefits of technology

It realizes precise control of the traffic of the excitation packets sent by each queue, supports variable packet length and packet transmission rate, and improves packet accuracy and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114338434B_ABST
    Figure CN114338434B_ABST
Patent Text Reader

Abstract

The present application provides a method, device, electronic device and storage medium for sending an incentive message. The method obtains initial parameters, which include the number of queues, the packet length of the incentive message, the packet sending rate, the packet length change attribute and the packet sending rate change attribute; determines the scanning period and the packet sending parameters of each queue according to the initial parameters, wherein the packet sending parameters include the first packet sending time and the packet sending interval; sends the incentive message according to the scanning period and the packet sending parameters of each queue. By scanning according to the packet sending parameters of each queue, the incentive message can be sent in time when the packet sending time of the queue is met, so as to achieve precise control of the flow of the incentive message sent by each queue, and supports variable packet length and packet sending rate, and can generate an incentive message flow with precise flow in real time and dynamically.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to computer technology, for example, to a method, device, electronic device and storage medium for sending an incentive message. Background Art

[0002] In the design process of routing and forwarding chips, computer software simulation technology is usually used to simulate and verify the correctness of its design. The SystemC language can support hardware modeling at the system level, behavior description level, and register conversion level. After building the data communication model, the built model needs to be verified. The main verification method is to apply stimulus messages at the model entrance to provide simulation data for the model to be verified, and then record the output of the model and compare it with the expected value to verify the correctness of the model design.

[0003] The currently used stimulus message generator, also known as the packet sender, first initializes the values ​​of each field of the stimulus message, then combines these fields into a stimulus message, and finally inputs the stimulus message into a message stream into the model to be verified. In practical applications, a message stream is a disordered data stream with a certain flow size. In order to control the flow of the message stream, it is necessary to pre-set the packet length and flow size of the stimulus message in each message stream, obtain the actual flow of the current queue in real time during the packet sending process, and compare it with the preset expected flow to decide whether to send the packet at the current moment or wait for a certain delay before sending the packet. In this process, packet sending control is performed only based on the expected flow, and the accuracy of packet sending cannot be guaranteed. In addition, the packet length and flow size of each message stream are preset fixed values. In the case of variable packet length and variable rate, the accuracy of packet sending is lower. Summary of the invention

[0004] The present application provides a method, device, electronic device and storage medium for sending an incentive message to improve the accuracy of packet sending.

[0005] The present application provides a method for sending an incentive message, including:

[0006] Acquire initial parameters, which include the number of queues, the packet length of the incentive message, the packet sending rate, the packet length change attribute, and the packet sending rate change attribute;

[0007] Determine the scanning period and the packet sending parameters of each queue according to the initial parameters, wherein the packet sending parameters include the first packet sending time and the packet sending interval;

[0008] The incentive message is sent according to the packet sending parameters.

[0009] The embodiment of the present application also provides an incentive message sending device, including:

[0010] An initial parameter acquisition module, configured to acquire initial parameters, wherein the initial parameters include the number of queues, the packet length of the incentive message, the packet sending rate, the packet length change attribute, and the packet sending rate change attribute;

[0011] A packet sending parameter determination module, configured to determine a scanning period and packet sending parameters of each queue according to the initial parameters, wherein the packet sending parameters include a first packet sending time and a packet sending interval;

[0012] The sending module is configured to send the incentive message according to the packet sending parameters.

[0013] An embodiment of the present application further provides an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned method for sending an incentive message when executing the program.

[0014] An embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the above-mentioned incentive message sending method is implemented. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 A flowchart of a method for sending an incentive message provided by an embodiment;

[0016] Figure 2 A flowchart of another method for sending an incentive message provided by an embodiment;

[0017] Figure 3 A schematic diagram of determining the first packet sending time of each queue provided by an embodiment;

[0018] Figure 4 A flowchart of another method for sending an incentive message provided by an embodiment;

[0019] Figure 5 A flowchart of a method for sending an incentive message provided by an embodiment;

[0020] Figure 6 A schematic diagram of the structure of an incentive message sending device provided by an embodiment;

[0021] Figure 7 A schematic diagram of the hardware structure of an electronic device provided by an embodiment. DETAILED DESCRIPTION

[0022] The present application is described below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should be noted that, in the absence of conflict, the embodiments in the present application and the features in the embodiments can be combined with each other arbitrarily. It should also be noted that, for ease of description, only the parts related to the present application rather than all structures are shown in the accompanying drawings.

[0023] In an embodiment of the present application, a method for sending incentive messages is provided. By scanning according to the packet sending parameters of each queue, the incentive message can be sent in time when the packet sending time of the queue is met, thereby achieving precise control of the flow of sending incentive messages for each queue, and supporting variable packet length and packet sending rate, and can generate incentive message flows with precise flow in real time and dynamically.

[0024] Figure 1 A flowchart of a method for sending an incentive message provided by an embodiment, such as Figure 1 As shown, the method provided in this embodiment includes steps 110, 120 and 130.

[0025] In step 110, initial parameters are obtained, and the initial parameters include the number of queues, the packet length of the stimulus message, the packet sending rate, the packet length change attribute, and the packet sending rate change attribute.

[0026] In this embodiment, the initial parameters may be configured by the user or may be pre-set default parameters, and the initial parameters include the number of queues, the packet length of the stimulus message, the packet sending rate, the packet length change attribute, and the packet sending rate change attribute. Among them, the incentive message is divided into one or more queues for transmission; for the incentive message of each queue, it will be split into transmittable data units at the transport layer and a header will be added to form a packet. The packet length can refer to the packet length of the incentive message in each queue, or the total packet length of the incentive message to be sent; the packet sending rate refers to the packet length divided by the time required to send the packet, and the amount of data that can be sent per unit time is obtained, which reflects the packet sending traffic, and can refer to the packet sending rate of the incentive message in each queue, or the total packet sending rate of the incentive message to be sent; the packet length change attribute refers to whether the packet length is variable, or whether it supports dynamic adjustment, and whether the adjustment function is turned on; the packet sending rate change attribute refers to whether the packet sending rate is variable, or whether it supports dynamic adjustment, and whether the adjustment function is turned on. The variable here is, for example, incremental change or random change. The adjustment can be based on the instruction input by the user, or it can be adjusted according to the feedback information output by the model to be verified after the incentive message is sent to the model to be verified.

[0027] When the packet length change attribute and the packet sending rate change attribute are variable attributes, the configuration of the initial parameters can be updated in real time, making the generation of stimulus messages more flexible and adaptable to different packet sending requirements, and providing richer and more reliable simulation data for the model to be verified.

[0028] In step 120, a scanning period and packet sending parameters of each queue are determined according to the initial parameters, wherein the packet sending parameters include a first packet sending time and a packet sending interval.

[0029] In this embodiment, the scanning cycle of time in the packet sending process can be determined according to the initial parameters, and the packet sending parameters of each queue can be determined. For example, the first packet sending time and the packet sending interval of each queue can be determined according to the packet length and the packet sending rate. On this basis, the packet sending time of each packet can be determined to achieve accurate control of packet sending, wherein the packet sending interval can refer to the packet sending interval between two adjacent packets in each queue, and can also refer to the packet sending interval between two adjacent packets of the stimulus message to be sent by all queues. In addition, the scanning cycle can also be determined according to the packet length and the packet sending rate, and the scanning is performed according to the scanning cycle. When the packet sending time of any packet in any queue is met, the corresponding packet can be sent to the model to be verified in time. Among them, the scanning cycle can be set to be less than or equal to the minimum packet sending interval of each queue, so as to reduce the packet sending delay. For example, if the minimum packet sending interval is 2 nanoseconds, the scanning cycle can be 2 nanoseconds or 1 nanosecond, etc. In addition, when the packet length and the packet sending rate are variable, the scanning cycle can also be automatically adjusted or updated.

[0030] In step 130, the stimulation message is sent according to the scanning period and the packet sending parameters of each queue.

[0031] In this embodiment, the initial parameters are first configured according to the packet sending requirements, and then the scanning period and the first packet sending time of each queue and the packet sending interval between adjacent packets are determined according to the initial parameters. On this basis, the time when each queue can send packets is scanned and calculated, thereby achieving precise flow control of packet sending. In addition, in the case of supporting variable packet length and packet sending rate or enabling the function of adjusting packet length and packet sending rate, the packet length and packet sending rate of the incentive message can also be dynamically adjusted to meet the requirements of various traffic scenarios for verification, providing more reliable data reference for the simulation verification of the model to be verified, and the design and verification of the routing forwarding chip.

[0032] In this embodiment, based on the packet length of the excitation message in each queue and the packet sending rate corresponding to the queue, the average time required to send a packet can be calculated as the scanning period; alternatively, when the packet length variation attribute and the packet sending rate variation attribute are variable attributes, the minimum time required to send a packet can be calculated as the scanning period based on the minimum packet length of the excitation message in each queue and the maximum packet sending rate corresponding to the queue.

[0033] Taking the case of fixed packet length and fixed packet sending rate as an example, according to the initial parameters, each packet of the excitation message in each queue is sequentially associated with different time intervals in a time period to establish a timing relationship, so as to determine the first packet sending time of each queue; according to the initial parameters, the target packet sending interval between the current packet and the next packet to be sent in any queue, as well as the intra-queue packet sending interval between the current packet and the next packet to be sent in the queue can also be determined; according to the first packet sending time and the packet sending interval, the packet sending time of each packet in each queue can be determined, so that the packet corresponding to the current time can be sent to the model to be verified in time during the scanning process, so as to control the stability of the overall packet sending flow of the excitation messages of all queues, and make the packet sending rate of the excitation message flow in each queue stable.

[0034] During the scanning process, if the current time scanned is the first packet sending time, or the time interval between the current time and the last packet sending time reaches the packet sending interval, the packets to be sent in the queue that can be sent corresponding to the current time are placed in the packet sending buffer to execute the packet sending, and the last packet sending time of the queue is updated to the current time, and then the scanning is continued until the excitation message sending of all queues is completed. For the packets in the packet sending buffer, the packet sending can be executed according to a certain packet sending cycle, and the packet sending cycle can be determined by referring to the scanning cycle.

[0035] In one embodiment, the method also includes: when the packet length change attribute and the packet sending rate change attribute are variable attributes, receiving parameter adjustment instructions or feedback information of the model to be verified; adjusting the packet length and packet sending rate in the initial parameters according to the parameter adjustment instructions or feedback information, and updating the scanning period and the packet sending parameters of each queue.

[0036] Figure 2 A flowchart of another method for sending an incentive message provided by an embodiment. This method can not only accurately control the flow of incentive messages sent by each queue with a fixed packet length and packet sending rate, but also supports dynamic adjustment of the packet length and packet sending rate according to parameter adjustment instructions or feedback information of the model to be verified, and updates the scanning cycle and the packet sending parameters of each queue, so as to generate an incentive message flow with accurate flow in real time and dynamically. Figure 2 As shown, the method includes:

[0037] Step 210: Acquire initial parameters, which include the number of queues, the packet length of the stimulus message, the packet sending rate, the packet length change attribute, and the packet sending rate change attribute.

[0038] Step 220: Determine the scanning period and the packet sending parameters of each queue according to the initial parameters, wherein the packet sending parameters include the first packet sending time and the packet sending interval.

[0039] Step 230: Send the stimulation message according to the scanning cycle and the packet sending parameters of each queue.

[0040] Step 240: Is the packet length change attribute or the packet transmission rate change attribute a variable attribute? If yes, execute steps 250-260; otherwise, return to execute step 230 and send the excitation message according to the fixed scanning cycle and packet transmission parameters.

[0041] Step 250: Receive parameter adjustment instructions or feedback information of the model to be verified.

[0042] In this embodiment, the parameter adjustment instruction may be generated according to the packet length and packet sending rate input by the user, or may be automatically generated according to the feedback information of the model to be verified.

[0043] Step 260: Adjust the packet length and packet sending rate in the initial parameters according to the parameter adjustment instruction or the feedback information, and update the scanning period and the packet sending parameters of each queue.

[0044] In this embodiment, when the packet length change attribute and the packet sending rate change attribute are variable attributes, the configuration of the initial parameters can be updated in real time, making the generation of the stimulus message more flexible, adapting to different packet sending requirements, and providing richer and more reliable simulation data for the model to be verified.

[0045] In one embodiment, the parameter adjustment instruction or feedback information includes: the number of queues for adjusting the parameters, the conditions for adjusting the parameters, the adjustment value of the packet length, and the adjustment value of the packet sending rate; wherein the conditions for adjusting the parameters include one of the following: the time for adjusting the parameters; the total number of packets sent when adjusting the parameters; the packet number threshold of the queue currently sending packets when adjusting the parameters.

[0046] In this embodiment, the parameter adjustment instruction or feedback information includes the number of queues whose parameters need to be adjusted, and for the queues whose parameters need to be adjusted, under what conditions the packet length and packet sending rate of the queue are adjusted, and the adjustment values ​​of the packet length and packet sending rate, wherein the adjustment values ​​of the packet length and packet sending rate can also be replaced with the target values ​​of the adjusted packet length and packet sending rate. The condition for adjusting the parameter can be the moment when the adjustment parameter is scanned, or the total number of packets sent by all queues reaches the total number of packets sent threshold, or the number of packets sent by the queue currently sending packets reaches the packet sending threshold. Accordingly, the scanning period is updated after the packet length and packet sending rate are adjusted.

[0047] In this embodiment, the adjustment of packet length and packet sending rate is achieved based on parameter adjustment instructions or feedback information of the model to be verified. A separate thread is used to adjust the packet length and packet sending rate of each queue. The parameter adjustment instructions or feedback information are placed in the cache and processed in sequence. This will not affect the sending of incentive messages and the simulation verification of the model to be verified.

[0048] In one embodiment, the method further includes: counting the number of packets sent by each queue and the total number of packets sent by all queues.

[0049] In this embodiment, by counting the number of packets sent by each queue and the total number of packets sent by all queues, a basis is provided for judging whether the conditions for adjusting parameters are met. If the conditions for adjusting parameters are met, the packet length and packet sending rate of the queue are adjusted in time, providing a reliable basis for the verification analysis of the model to be verified.

[0050] In one embodiment, an incentive message is sent according to a scanning cycle and a packet sending parameter of each queue, including: scanning according to the scanning cycle until the incentive message packet sending of all queues is completed; when the current moment scanned is the first packet sending moment, or the time interval between the current moment and the last packet sending moment reaches the packet sending interval, the packets to be sent in the queue are placed in a packet sending cache to execute packet sending, and the last packet sending moment of the queue is updated to the current moment.

[0051] In this embodiment, by continuously scanning the time according to the packet sending parameters, it is calculated whether there is a queue that can send packets at the current moment. If the current moment is the first packet sending moment of a queue, or the time interval between the current moment and the last packet sending moment of a queue reaches the packet sending interval, then the queue has a packet to be sent at the current moment, the packet to be sent is placed in the packet sending buffer, the packet is sent, and the last packet sending moment of the queue is updated using the current moment, wherein the time waiting for the packet sending in the packet sending buffer can be ignored; if there is no queue that can send packets, the scanning continues until the next scan finds a queue that can send packets.

[0052] In this embodiment, an independent process is used to cache the packets to be sent and execute the packet sending. The packets in the packet sending cache are sent evenly at a certain period. If there is no packet in the packet sending cache, wait for a packet to be stored. The smaller the packet sending period, the lower the delay of packet sending, the higher the accuracy, and the more resources need to be consumed accordingly.

[0053] In one embodiment, there are two working modes for executing packet sending to meet different user needs: 1) Normal working mode: the average time required to send a packet is determined according to the packet sending interval of each queue and used as the packet sending period, so that the inbound rate of the packet sending buffer is equal to the outbound rate, which can ensure the uniformity of the overall packet sending rate of all queues and consume less resources; 2) High-precision working mode: suitable for situations with sufficient resources, the minimum time required to send a packet is determined according to the packet length and packet sending rate of each queue, and used as the packet sending period, to ensure the accuracy of the packet sending time and the uniformity of the packet sending rate of each queue, meeting the high-precision requirements.

[0054] In one embodiment, when there are multiple queues capable of sending packets at the same time, packets to be sent are sequentially placed in the packet sending buffer according to the number of queues for packet sending.

[0055] In one embodiment, the packet sending interval includes: a target packet sending interval between a current packet and the next packet to be sent in any queue, wherein the target packet sending interval is determined based on the packet length of the current packet and the total packet sending rate of all queues; an intra-queue packet sending interval between the current packet and the next packet to be sent in the queue, wherein the intra-queue packet sending interval is determined based on the packet length of the current packet of the excitation message in each queue and the packet sending rate corresponding to the queue.

[0056] In this embodiment, by controlling the target packet sending interval of two adjacent packets of all queue excitation messages, it is possible to ensure that the total packet sending rate is uniform within a unit time, and the total packet sending rate V 总 = packet length of current packet / target packet sending interval, so as to achieve the stability of the overall packet sending flow of all queues’ incentive messages; by controlling the packet sending interval between two adjacent packets in each queue, it can be ensured that the proportion of packets sent by a single queue in a unit time is consistent with the proportion of the traffic of the queue to the total traffic of all queues, and the packet sending rate V of queue n n =The packet length of the current packet / the interval between two adjacent packets in queue n, so that the rate of the message flow of each queue is stable. For example, at the current moment, the third packet Q3,3 in queue Q3 is sent, and the packet length of this packet is X. Based on this, the target packet interval and the interval between packets in the queue can be calculated. The next time a queue is scanned to send packets, for example, the second packet Q1,2 in queue Q1, the target packet interval refers to the time interval T1 between Q3,3 and Q1,2, satisfying T1=X / V 总 ; For the next packet Q3,4 in queue Q3, the packet sending interval within the queue refers to the time interval T2 between Q3,3 and Q3,4, satisfying T2 = X / V3.

[0057] In this embodiment, the control of the packet sending interval is not only applicable to queues with fixed packet length and packet sending rate, but also applicable to situations where the packet length and packet sending rate are variable. When the packet length and packet sending rate of a queue are variable, or the packet length and packet sending rate adjustment function is enabled, if the packet length and packet sending rate of the queue change, the corresponding packet sending interval also changes. By controlling the packet sending interval in each queue in real time, automatic adjustment of the flow of each queue and precise control of packet sending are achieved.

[0058] In one embodiment, determining the scanning period according to the initial parameters includes: calculating the average time required to send a packet according to the packet length of the stimulation message in each queue and the packet sending rate corresponding to the queue, and using the average time as the scanning period.

[0059] In this embodiment, each queue is continuously scanned according to the scanning cycle to calculate whether there is a queue that can send packets at the current moment. If the scanning cycle is too long, it will cause untimely packet sending, resulting in packet accumulation and reduced packet sending accuracy; if the scanning cycle is too short, it will cause low processing efficiency, slow operation rate and high resource consumption. In this embodiment, according to the packet sending rate of each queue and the packet length of the incentive message, the total number of packets sent by each queue per unit time is calculated, and then the average time required to send a packet is calculated as the scanning cycle.

[0060] In one embodiment, the scanning period is determined based on the initial parameters, including: when the packet length change attribute and the packet sending rate change attribute are variable attributes, the minimum time required to send a packet is calculated based on the minimum packet length of the excitation message in each queue and the maximum packet sending rate corresponding to the queue, and the minimum time is used as the scanning period.

[0061] In this embodiment, when the packet length and packet transmission rate are variable or adjustable, for each queue, the combination of the maximum packet transmission rate and the minimum packet length of the queue is taken to obtain the minimum time required to send a packet, and this minimum time is used as the scanning period to ensure the packet transmission accuracy when the packet length and packet transmission rate are variable. For example, the packet transmission rate of each queue ranges from 1Kbps to 256Gbps, and the packet length of each queue ranges from 40B to 16384B, then the minimum time required to send a packet is (40*8bit) / (256Gbps)=1.25 nanoseconds, and the scanning period is 1.25 nanoseconds.

[0062] In one embodiment, the first packet sending time of each queue is determined according to the initial parameters, including: calculating the total number N of packets sent in a time period, and dividing the time period into N time intervals; for each queue in turn, associating each packet of the excitation message in the queue to a time interval according to the set rules; based on the association relationship between the first packet of each queue and the time interval, recording the first packet sending time of each queue.

[0063] In this embodiment, determining the time when the first packet of each queue is sent is a key step. Controlling the time when each packet of each queue is sent only affects the uniformity of packet sending in the queue, while the time when the first packet of each queue is sent determines the stability of the packet sending rate between queues. Take a time period as a benchmark, calculate the total number N of packets sent by all queues in the time period, and divide the time period into N time intervals. According to the set rules, each packet in each queue is placed in a time interval in turn until the N packets of all queues are placed in N time intervals respectively. Record the time when the first packet of each queue is sent, and the time when the first packet of each queue is sent can be controlled during the packet sending process.

[0064] In one embodiment, for each queue, the rules are set to include: associating the first packet of the excitation message in the queue to the first time interval, and associating other packets in the queue except the first packet to the corresponding time intervals in sequence according to the packet sending interval corresponding to the queue; wherein, when the time interval corresponding to a packet is occupied by other packets, the packet is associated with the first unoccupied time interval after the time interval.

[0065] Figure 3 A schematic diagram of determining the first packet sending time of each queue provided by an embodiment. Figure 3 As shown, for queue Q1, the first packet Q1,1 of Q1 is placed in the first time interval, and then the packet sending time of the next packet Q1,2 is calculated based on the first packet sending time and packet sending interval of Q1, and Q1,2 is placed in the corresponding time interval. On this basis, the packet sending time of the next packet Q1,3 can be calculated and placed in the corresponding time interval, and so on, until all the packets in Q1 during this period are placed in the time interval. Then, for queue Q2, the first packet Q2,1 of Q2 is placed in the first idle time interval during this period, and the packet sending time of each subsequent packet is calculated based on the first packet sending time and packet sending interval of Q2, and placed in the corresponding time interval in sequence. Among them, if the time interval corresponding to the packet sending time of a packet is occupied by packets in other queues, the next idle time interval is automatically found and placed. Similarly, for packets in all queues, they are all matched with time intervals according to the same rules, until N packets in all queues are placed in N time intervals respectively, and the sending time of the first packet of each queue is recorded.

[0066] In one embodiment, it also includes: an initialization incentive message; the initialization time is greater than or equal to the time required for the queue with the lowest packet sending rate to send the first packet.

[0067] In this embodiment, each packet of each queue is strictly sorted, reflecting the configured packet sending timing. In this process, a large amount of resources are required to save the timing information of these packet sending. If the timing information of each packet is saved, the initialization process takes a very long time for the long-term packet sending of a large number of queues, which seriously affects the efficiency of packet sending. In this embodiment, only the time when the first packet of each queue is sent needs to be recorded, and the initialization time is greater than or equal to the time when the queue with the slowest packet sending rate sends a packet (i.e., the first packet). This does not affect the accuracy of packet sending, but can also reduce the initialization time and save resources. The packet sending time of the remaining packets in each queue can be determined by continuously scanning according to the time interval and the scanning cycle.

[0068] Figure 4 FIG. 1 is a flow chart of another method for sending an incentive message provided by an embodiment. Figure 4 As shown, the method includes:

[0069] Step 310: Acquire initial parameters, which include the number of queues, the packet length of the stimulus message, the packet sending rate, the packet length change attribute, and the packet sending rate change attribute.

[0070] Step 320: Calculate the target packet sending interval and the packet sending interval within the queue.

[0071] Step 330: Calculate the average time required to send a packet according to the packet length of the excitation message in each queue and the packet sending rate corresponding to the queue, and use the average time as the scanning period.

[0072] Among them, when the packet length change attribute and the packet transmission rate change attribute are variable attributes, step 330 includes: according to the minimum packet length of the excitation message in each queue and the maximum packet transmission rate corresponding to the queue, calculating the minimum time required to send a packet, and taking the minimum time as the scanning period.

[0073] Step 340: Calculate the time when the first packet of each queue is sent.

[0074] Step 350: Scan according to the scanning cycle.

[0075] Step 360: Is the current time scanned as the first packet sending time or is the time interval between the current time and the last packet sending time reaching the packet sending interval?

[0076] Step 370: Put the packets to be sent in the queue into the packet sending buffer to execute packet sending, and update the last packet sending time of the queue to the current time.

[0077] In this embodiment, an independent process is used to cache the packets to be sent and execute the packet sending. The packets in the packet sending cache are sent evenly at a certain packet sending period. If there is no packet in the packet sending cache, wait for a packet to be stored. The packet sending period can be consistent with the scanning period, or can be determined according to the average time required to send a packet, or according to the minimum time required to send a packet.

[0078] Step 380: Have the stimulus messages for all queues been sent?

[0079] Step 390: The stimulus message is sent.

[0080] It should be noted that in the process of executing steps 350-390, if parameter adjustment instructions or feedback information of the model to be verified are received, the initial parameters can be adjusted and the scanning cycle and the packet sending parameters of each queue can be updated when the conditions for adjusting the parameters are met. Then, the scan is performed according to the updated packet sending parameters to determine whether each queue can send packets, thereby achieving precise packet sending with variable packet length and packet sending rate.

[0081] Figure 5 FIG. 1 is a flowchart of a method for sending an incentive message according to an embodiment of the present invention. Figure 5 As shown, the method includes:

[0082] Get initial parameters, such as the number of queues, the total packet length of the incentive message, the total packet sending rate of the incentive message, the packet sending rate of each queue, the packet length of each queue, the packet length change attribute, the packet sending rate change attribute, whether to enable the packet length and packet sending rate adjustment function, etc.

[0083] According to the packet sending rate and packet length of each queue, the scanning cycle and the packet sending interval of each queue are calculated;

[0084] Calculate the time when the first packet of each queue is sent and complete the initialization of the incentive message;

[0085] In the case where the packet length or the packet sending rate is variable or adjustable, a parameter adjustment instruction or feedback information of the model to be verified is detected. If a parameter adjustment instruction or feedback information is received, the packet length, the packet sending rate and the scanning period are adjusted when the conditions for adjusting the parameters are met (for example, the time when the adjustment parameters are reached, or the total number of packets sent reaches the total number of packets sent threshold, or the number of packets sent by the queue currently sending packets reaches the number of packets sent threshold);

[0086] Scan continuously according to the scanning cycle to determine whether there is a queue that can send packets at the current moment. If there is a queue that can send packets, put the packets to be sent into the packet sending cache and update the last packet sending time of the queue; if there is no queue that can send packets, continue scanning; if there are multiple queues that can send packets at the same time, the conflicting packets of different queues can be put into the packet sending cache in a certain order to wait for packet sending; wherein, scan the packet sending cache at a certain packet sending cycle, and if the packet sending cache is not empty, execute the packet sending;

[0087] Execute the packet sending and update the last packet sending time of the corresponding queue, send the stimulus message composed of the packets of each queue to the model to be verified, and complete the stimulus input and model simulation verification.

[0088] The incentive message sending method provided in this embodiment realizes precise control of packet sending of each queue by simulating packet sending traffic and timing and supporting packet sending with variable packet length and packet sending rate. When the packet sending rate and packet length adjustment function is enabled, the packet sending rate and packet length of the incentive message can also be dynamically adjusted according to the feedback information output by the model to be verified, which can meet the requirements of various traffic scenarios and provide more reliable simulation data for model simulation verification and the design of forwarding chips.

[0089] The embodiment of the present application also provides an incentive message sending device. Figure 6 FIG. 1 is a schematic diagram of a structure of an incentive message sending device provided by an embodiment. Figure 6 As shown, the incentive message sending device includes: an initial parameter acquisition module 410, a packet sending parameter determination module 420 and a sending module 430.

[0090] An initial parameter acquisition module 410 is configured to acquire initial parameters, wherein the initial parameters include the number of queues, the packet length of the incentive message, the packet sending rate, the packet length change attribute, and the packet sending rate change attribute;

[0091] The packet sending parameter determination module 420 is configured to determine the scanning period and the packet sending parameters of each queue according to the initial parameters, wherein the packet sending parameters include the first packet sending time and the packet sending interval;

[0092] The sending module 430 is configured to send the stimulation message according to the scanning period and the packet sending parameters of each queue.

[0093] The incentive message sending device of this embodiment can send incentive messages in time when the packet sending time of the queue is met by scanning according to the packet sending parameters of each queue, thereby realizing precise control of the flow of sending incentive messages for each queue, and supporting variable packet length and packet sending rate to improve the accuracy of packet sending.

[0094] In one embodiment, the method further comprises:

[0095] An adjustment receiving module, configured to receive a parameter adjustment instruction or feedback information of a model to be verified when the packet length change attribute and the packet sending rate change attribute are variable attributes;

[0096] A packet length and flow adjustment module, configured to adjust the packet length and packet sending rate in the initial parameters according to the parameter adjustment instruction or the feedback information;

[0097] The scanning cycle updating module is configured to update the scanning cycle and the packet sending parameters of each queue.

[0098] In one embodiment, the sending module 430 includes:

[0099] A scanning module, configured to scan according to the scanning cycle until all the incentive messages of the queues are sent out;

[0100] The packet sending module is configured to put the packets to be sent in the queue into the packet sending cache to execute packet sending when the current moment scanned is the first packet sending moment, or when the time interval between the current moment and the last packet sending moment reaches the packet sending interval, and update the last packet sending moment of the queue to the current moment.

[0101] In one embodiment, the packet sending interval includes:

[0102] a target packet sending interval between the current packet and the next packet to be sent in any queue, wherein the target packet sending interval is determined according to the packet length of the current packet and the total packet sending rate of all queues;

[0103] The packet sending interval in the queue between the current packet and the next packet to be sent in the queue is determined according to the packet length of the current packet of the excitation message in each queue and the packet sending rate corresponding to the queue.

[0104] In one embodiment, the packet transmission parameter determination module 420 includes:

[0105] The first scanning period determination module is configured to calculate the average time required to send a packet according to the packet length of the excitation message in each queue and the packet sending rate corresponding to the queue, and use the average time as the scanning period.

[0106] In one embodiment, the packet transmission parameter determination module 420 includes:

[0107] The second scanning period determination module is configured to calculate the minimum time required to send a packet according to the minimum packet length of the excitation message in each queue and the maximum packet rate corresponding to the queue when the packet length change attribute and the packet sending rate change attribute are variable attributes, and use the minimum time as the scanning period.

[0108] In one embodiment, the packet transmission parameter determination module 420 includes: a first packet transmission time determination module, which is configured as follows:

[0109] Calculate the total number N of packets sent in a time period, and divide the time period into N time intervals;

[0110] For each queue in turn, each packet of the excitation message in the queue is associated with a time interval according to the set rule;

[0111] According to the association between the first packet of each queue and the time interval, the time when the first packet of each queue is sent is recorded.

[0112] In one embodiment, for each queue, the setting rules include:

[0113] Associating the first packet of the excitation message in the queue with the first time interval, and sequentially associating the other packets in the queue except the first packet with the corresponding time intervals according to the packet sending interval corresponding to the queue;

[0114] When a time interval corresponding to a packet is occupied by other packets, the packet is associated with the first unoccupied time interval after the time interval.

[0115] In one embodiment, the parameter adjustment instruction or the feedback information includes: the number of queues for adjusting the parameter, the condition for adjusting the parameter, the adjustment value of the packet length, and the adjustment value of the packet sending rate;

[0116] The condition for adjusting the parameter includes one of the following: the time of adjusting the parameter; the total number of packets sent when adjusting the parameter; the number of packets sent by the queue currently sending packets when adjusting the parameter.

[0117] In one embodiment, it further includes:

[0118] The statistics module is set to count the number of packets sent by each queue and the total number of packets sent by all queues.

[0119] In one embodiment, it further includes: an initialization module configured to initialize the stimulus message;

[0120] The initialization time is greater than or equal to the time required for the queue with the lowest packet sending rate to send the first packet.

[0121] The incentive message sending device proposed in this embodiment and the incentive message sending method proposed in the above embodiment belong to the same inventive concept. The technical details not fully described in this embodiment can be referred to any of the above embodiments, and this embodiment has the same beneficial effects as executing the incentive message sending method.

[0122] The embodiment of the present application also provides an electronic device, Figure 7 A schematic diagram of the hardware structure of an electronic device provided by an embodiment is shown in FIG. Figure 7 As shown, the electronic device provided in the present application includes a memory 52, a processor 51, and a computer program stored in the memory and executable on the processor. When the processor 51 executes the program, the above-mentioned method for sending the incentive message is implemented.

[0123] The electronic device may further include a memory 52; the processor 51 in the electronic device may be one or more, Figure 7 A processor 51 is taken as an example; the memory 52 is used to store one or more programs; the one or more programs are executed by the one or more processors 51, so that the one or more processors 51 implement the incentive message sending method as described in the embodiment of the present application.

[0124] The electronic device further includes: a communication device 53 , an input device 54 and an output device 55 .

[0125] The processor 51, memory 52, communication device 53, input device 54 and output device 55 in the electronic device can be connected via a bus or other means. Figure 7 The example of connecting through bus is taken in the following.

[0126] The input device 54 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the electronic device. The output device 55 may include a display device such as a display screen.

[0127] The communication device 53 may include a receiver and a transmitter. The communication device 53 is configured to perform information transmission and reception communication according to the control of the processor 51.

[0128] The memory 52, as a computer-readable storage medium, can be configured to store software programs, computer executable programs and modules, such as the program instructions / modules corresponding to the method for sending the incentive message described in the embodiment of the present application (for example, the initial parameter acquisition module 410, the packet transmission parameter determination module 420 and the sending module 430 in the incentive message sending device). The memory 52 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function; the storage data area may store data created according to the use of the electronic device, etc. In addition, the memory 52 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage devices. In some instances, the memory 52 may further include a memory remotely arranged relative to the processor 51, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.

[0129] An embodiment of the present application also provides a storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the incentive message sending method described in any one of the embodiments of the present application, the method comprising: obtaining initial parameters, the initial parameters including the number of queues, the packet length of the incentive message, the packet sending rate, the packet length change attribute and the packet sending rate change attribute; determining the scanning period and the packet sending parameters of each queue according to the initial parameters, wherein the packet sending parameters include the first packet sending time and the packet sending interval; sending the incentive message according to the scanning period and the packet sending parameters of each queue.

[0130] The computer storage medium of the embodiment of the present application can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (Random Access Memory, RAM), a read-only memory (Read Only Memory, ROM), an erasable programmable read-only memory (ErasableProgrammable Read Only Memory, EPROM), a flash memory, an optical fiber, a portable CD-ROM, an optical storage device, a magnetic storage device, or any suitable combination of the above. The computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, a device or a device or used in combination with it.

[0131] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to: electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0132] The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, radio frequency (RF), etc., or any suitable combination of the above.

[0133] The computer program code for performing the operation of the present application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and also conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on the remote computer, or completely on the remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., using an Internet service provider to connect through the Internet).

[0134] The above description is merely an exemplary embodiment of the present application and is not intended to limit the protection scope of the present application.

[0135] It will be appreciated by those skilled in the art that the term user terminal covers any suitable type of wireless user equipment, such as a mobile phone, a portable data processing device, a portable web browser or a vehicle-mounted mobile station.

[0136] In general, various embodiments of the present application can be implemented in hardware or dedicated circuits, software, logic or any combination thereof. For example, some aspects can be implemented in hardware, while other aspects can be implemented in firmware or software that can be executed by a controller, microprocessor or other computing device, although the present application is not limited thereto.

[0137] Embodiments of the present application may be implemented by executing computer program instructions by a data processor of a mobile device, for example in a processor entity, or by hardware, or by a combination of software and hardware. The computer program instructions may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages.

[0138] The block diagram of any logic flow in the drawings of the present application may represent program steps, or may represent interconnected logic circuits, modules and functions, or may represent a combination of program steps and logic circuits, modules and functions. A computer program may be stored on a memory. The memory may have any type suitable for the local technical environment and may be implemented using any suitable data storage technology, such as but not limited to read-only memory (ROM), random access memory (RAM), optical memory devices and systems (digital versatile discs (DVD) or compact disks (CD)), etc. Computer-readable media may include non-transient storage media. A data processor may be any type suitable for the local technical environment, such as but not limited to a general-purpose computer, a special-purpose computer, a microprocessor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FGPAs) and a processor based on a multi-core processor architecture.

[0139] By way of exemplary and non-limiting examples, a detailed description of exemplary embodiments of the present application has been provided above. However, various modifications and adjustments to the above embodiments will be apparent to those skilled in the art when considered in conjunction with the accompanying drawings and claims, but will not depart from the scope of the present application. Therefore, the proper scope of the present application will be determined according to the claims.

Claims

1. A method for sending an incentive message, characterized in that: include: Acquire initial parameters, which include the number of queues, the packet length of the incentive message, the packet sending rate, the packet length change attribute, and the packet sending rate change attribute; Determine the scanning period and the packet sending parameters of each queue according to the initial parameters, wherein the packet sending parameters include the first packet sending time and the packet sending interval; Sending the excitation message according to the scanning period and the packet sending parameters of each queue; Wherein, the method further comprises: In a case where the packet length change attribute and the packet sending rate change attribute are variable attributes, receiving a parameter adjustment instruction or feedback information of a model to be verified; Adjust the packet length and packet sending rate in the initial parameters according to the parameter adjustment instruction or the feedback information, and update the scanning period and the packet sending parameters of each queue; Determining a scanning period according to the initial parameters includes: According to the packet length of the excitation message in each queue and the packet sending rate corresponding to the queue, the average time required to send a packet is calculated, and the average time is used as the scanning period; Determining a scanning period according to the initial parameters includes: When the packet length change attribute and the packet sending rate change attribute are variable attributes, the minimum time required to send a packet is calculated based on the minimum packet length of the excitation message in each queue and the maximum packet sending rate corresponding to the queue, and the minimum time is used as the scanning period.

2. The method according to claim 1, characterized in that Sending the incentive message according to the packet sending parameter includes: Scanning is performed according to the scanning cycle until the excitation message sending of all queues is completed; When the current time scanned is the time for sending the first packet, or the time interval between the current time and the last packet sending time reaches the packet sending interval, the packets to be sent in the queue are placed in the packet sending cache to execute packet sending, and the last packet sending time of the queue is updated to the current time.

3. The method according to claim 1, characterized in that For each queue, the packet sending interval includes: a target packet sending interval between the current packet and the next packet to be sent in any queue, wherein the target packet sending interval is determined according to the packet length of the current packet and the total packet sending rate of all queues; The packet sending interval in the queue between the current packet and the next packet to be sent in the queue is determined according to the packet length of the current packet of the excitation message in each queue and the packet sending rate corresponding to the queue.

4. The method according to claim 1, characterized in that: Determining the first packet sending time of each queue according to the initial parameters includes: Calculate the total number N of packets sent in a time period, and divide the time period into N time intervals; For each queue in turn, each packet of the excitation message in the queue is associated with a time interval according to the set rule; According to the association between the first packet of each queue and the time interval, the time when the first packet of each queue is sent is recorded.

5. The method according to claim 4, characterized in that For each queue, the setting rules include: Associating the first packet of the excitation message in the queue with the first time interval, and sequentially associating the other packets in the queue except the first packet with the corresponding time intervals according to the packet sending interval corresponding to the queue; When a time interval corresponding to a packet is occupied by other packets, the packet is associated with the first unoccupied time interval after the time interval.

6. The method according to claim 1, characterized in that The parameter adjustment instruction or the feedback information includes: the number of queues for adjusting the parameters, the conditions for adjusting the parameters, the adjustment value of the packet length, and the adjustment value of the packet sending rate; The condition for adjusting the parameter includes one of the following: The moment to adjust parameters; The total number of packets sent when adjusting parameters; When adjusting parameters, the packet sending threshold of the queue currently sending packets.

7. The method according to claim 6, characterized in that Also includes: Count the number of packets sent by each queue and the total number of packets sent by all queues.

8. The method according to any one of claims 1 to 7, characterized in that: Also includes: Initialize the stimulus message; The initialization time is greater than or equal to the time required for the queue with the lowest packet sending rate to send the first packet.

9. An incentive message sending device, characterized in that: include: An initial parameter acquisition module, configured to acquire initial parameters, wherein the initial parameters include the number of queues, the packet length of the incentive message, the packet sending rate, the packet length change attribute, and the packet sending rate change attribute; A packet sending parameter determination module, configured to determine a scanning period and packet sending parameters of each queue according to the initial parameters, wherein the packet sending parameters include a first packet sending time and a packet sending interval; A sending module, configured to send the incentive message according to the scanning period and the packet sending parameters of each queue; Wherein, the device further comprises: An adjustment receiving module, configured to receive a parameter adjustment instruction or feedback information of a model to be verified when the packet length change attribute and the packet sending rate change attribute are variable attributes; A packet length and flow adjustment module, configured to adjust the packet length and packet sending rate in the initial parameters according to the parameter adjustment instruction or the feedback information; A scanning cycle updating module, configured to update the scanning cycle and the packet sending parameters of each queue; The packet sending parameter determination module includes: A first scanning period determination module is configured to calculate an average time required to send a packet according to the packet length of the excitation message in each queue and the packet sending rate corresponding to the queue, and use the average time as the scanning period; The module for determining the sending parameters includes: The second scanning period determination module is configured to calculate the minimum time required to send a packet according to the minimum packet length of the excitation message in each queue and the maximum packet rate corresponding to the queue when the packet length change attribute and the packet sending rate change attribute are variable attributes, and use the minimum time as the scanning period.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the incentive message sending method according to any one of claims 1 to 8 is implemented.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for sending an incentive message as described in any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Method for sending messages with random length precisely according to traffic model

    CN104580005A