Test method and device of port buffer value, electronic equipment and readable storage medium

By using IEEE 802.3x flow control technology, data forwarding is suppressed using flow control frames, ensuring that data is stored in the switch buffer. This solves the accuracy and cost issues of switch port buffer size testing and is suitable for testing high-speed ports.

CN117675627BActive Publication Date: 2026-06-16MAIPU COMM TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
MAIPU COMM TECH CO LTD
Filing Date
2022-09-01
Publication Date
2026-06-16

AI Technical Summary

Technical Problem

In existing technologies, switch port buffer size testing has the problem of inaccurate results, especially in high-speed port testing, where the data packets sent by the tester's port may be forwarded beyond the bandwidth, leading to overestimation of the calculated value. Furthermore, existing testing equipment is expensive and lacks universality.

Method used

Employing IEEE 802.3x flow control technology, the system suppresses network device data forwarding by sending flow control frames (PAUSE frames), ensuring that data packets are stored in the port buffer. After stopping the flow control frames, the system receives buffered data packets and calculates the port buffer value.

🎯Benefits of technology

It enables accurate and efficient verification of port buffer capacity, reduces testing costs, and is suitable for testing high-speed ports.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117675627B_ABST
    Figure CN117675627B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a port buffer value testing method and device, electronic equipment and readable storage medium. First, a predetermined line speed is used to send a flow control frame to a network device, and then data packets are continuously sent to the network device within the data packet sending duration, so that the data packets are stored in the port buffer area of the network device. Then, the sending of the data packets and the flow control frame is stopped in sequence, so as to receive the buffered data packets in the port buffer area sent by the network device. Finally, the port buffer value of the network device is determined according to the buffered data packets. In this way, by first sending the flow control frame at a predetermined line speed, the network device stops data export, the network device stores the data packets in the port buffer area, after stopping the sending of the flow control frame, the buffered data packets are received, and finally the port buffer value can be determined according to the buffered data packets, so that the port buffer value of the network device obtained finally is accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication technology, and more specifically, to a method, apparatus, electronic device, and readable storage medium for testing port cache values. Background Technology

[0002] With the rapid development of network communication technology, current network architecture is moving towards data center networks, thus increasing the performance requirements for network devices such as switches. Port buffers, as buffer areas for data packets during the switching process, significantly determine the performance of the device. While a switch's switching chip has a theoretical port buffer capacity, the actual port buffer capacity often differs from the theoretical value, necessitating capacity testing.

[0003] In existing technologies, the method for testing port buffer size involves sending data packets from one port of the tester to the switch, filling the switch's egress bandwidth, and simultaneously sending data packets from another port of the tester to the switch, storing these data packets in the switch's port buffer. Once the egress bandwidth is filled and no more data packets are sent, the data packets stored in the port buffer are returned to the tester from the switch's egress. The tester can then subtract the total number of packets filling the egress bandwidth from the total number of packets returned by the switch to obtain the total number of packets stored in the port buffer. Finally, the tester uses this calculated total number of packets stored in the port buffer and the packet size to calculate the port buffer size.

[0004] However, due to the inherent limitations of the switch's switching chips, switch ports may experience over-bandwidth forwarding to some extent. When one port of the tester sends data packets that fully utilize the switch's egress bandwidth, a very small portion of data packets sent from another port of the tester, besides being stored in the port buffer, may still return to the tester through the switch's egress. This leads to an overestimation of the number of packets buffered by the switch, resulting in an inaccurate calculation of the switch's port buffer size. Summary of the Invention

[0005] The purpose of this invention is to provide a method, apparatus, electronic device, and readable storage medium for testing port cache values, so as to improve the problems existing in the prior art.

[0006] The embodiments of the present invention can be implemented as follows:

[0007] In a first aspect, the present invention provides a method for testing port cache values, comprising:

[0008] A flow control frame is sent to the network device at a predetermined line rate. The flow control frame carries a time parameter, which indicates the stop time for the network device to stop sending data. The predetermined line rate corresponds to the data transmission rate of the network device.

[0009] During the data packet transmission duration, data packets are continuously sent to the network device so that the data packets are stored in the port buffer of the network device.

[0010] When the data packet stops being sent, the flow control frame stops being sent.

[0011] Receive cached data packets from the port buffer sent by the network device;

[0012] The port cache value of the network device is determined based on the cached data packet.

[0013] In an optional implementation, the network device has a first port and a second port, the time parameter is used to indicate the stop time for the first port to stop transmitting data, and the predetermined line speed corresponds to the data transmission rate of the first port;

[0014] The step of sending flow control frames to the network device at a predetermined line rate includes:

[0015] The flow control frame is sent to the first port of the network device at the predetermined line rate.

[0016] The step of continuously sending data packets to the network device includes:

[0017] Continuously send data packets to the second port; the data transmission rate of the first port is greater than or equal to the data transmission rate of the second port;

[0018] The step of receiving the cached data packet in the port buffer sent by the network device includes: receiving the cached data packet sent by the network device through the first port.

[0019] In an optional implementation, the method is applied to a test device having a third port and a fourth port;

[0020] The step of sending flow control frames to the network device at a predetermined line rate includes:

[0021] Send flow control frames to the network device through the third port at a predetermined line rate;

[0022] The step of continuously sending data packets to the network device includes:

[0023] Data packets are continuously sent to the network device through the fourth port;

[0024] The step of receiving the cached data packets in the port buffer sent by the network device includes:

[0025] The cached data packets sent by the network device are received through the third port.

[0026] In an optional implementation, prior to the step of sending the flow control frame to the first port of the network device at the predetermined line rate, the method further includes:

[0027] The predetermined line speed is set to be equal to the data transmission rate of the third port.

[0028] In an optional implementation, before the step of determining the port cache value of the network device based on the received data packets in the port cache, the method further includes:

[0029] Determine if the total number of data packets sent exceeds the total number of buffered data packets;

[0030] If so, the step of determining the port cache value of the network device includes:

[0031] The port cache value is determined based on the total number of cached data packets;

[0032] If not, the data packet transmission duration is extended, and based on the extended data packet transmission duration, the process returns to the step of sending a flow control frame to the network device at a predetermined line rate.

[0033] Secondly, the present invention provides a method for testing port cache values, including:

[0034] The network receives a flow control frame sent by the test device at a predetermined line rate. The flow control frame carries a time parameter, which is used to indicate the stop time for the network device to stop sending data. The predetermined line rate corresponds to the data transmission rate of the network device.

[0035] During the data packet transmission time, receive the data packets continuously sent by the test device and store the data packets in the port buffer.

[0036] After the stop time ends, all cached data packets in the port buffer are sent to the test device so that the test device can determine the port cache value of the network device based on the cached data packets.

[0037] In an optional implementation, the method is applied to the network device having a first port and a second port, the time parameter being used to indicate the stop time for the first port to stop transmitting data, and the predetermined line speed corresponding to the data transmission rate of the first port;

[0038] The step of receiving the flow control frame sent by the test device at a predetermined line rate includes:

[0039] Receive flow control frames sent by the test device at a predetermined line rate through the first port;

[0040] The step of receiving data packets continuously sent by the test device and storing the data packets in the port buffer includes:

[0041] The test device continuously sends data packets through the second port, and the data packets are stored in the port buffer.

[0042] When the port buffer is full, newly arriving data packets will be discarded on the second port;

[0043] The step of sending all cached data packets in the port buffer to the test device includes:

[0044] The cached data packet is sent to the test device through the first port.

[0045] In an optional implementation, the test device has a third port and a fourth port;

[0046] The step of receiving the flow control frame sent by the test device at a predetermined line rate includes:

[0047] Receive the flow control frame sent by the test device through the third port at the predetermined line speed;

[0048] The step of receiving data packets continuously sent by the test device and storing the data packets in the port buffer includes:

[0049] Receive data packets continuously sent by the test device through the fourth port, and store the data packets in the port buffer;

[0050] When the port buffer is full, the newly arriving data packets will be discarded.

[0051] The step of sending all cached data packets in the port buffer to the test device includes:

[0052] The cached data packet is sent to the third port.

[0053] Thirdly, the present invention provides a testing device for port cache values, comprising:

[0054] A flow control frame sending module is used to send flow control frames to network devices at a predetermined line rate. The flow control frames carry time parameters, which are used to indicate the stop time for the network devices to stop sending data. The predetermined line rate corresponds to the data transmission rate of the network devices.

[0055] The message sending module is used to continuously send data packets to the network device within the data packet sending duration, so that the data packets are stored in the port buffer of the network device;

[0056] The data processing module is used to stop sending the flow control frame after the data packet stops being sent;

[0057] A cached message receiving module is used to receive cached data messages in the port buffer sent by the network device;

[0058] The data processing module is further configured to determine the port cache value of the network device based on the cached data packet.

[0059] Fourthly, the present invention provides a testing device for port cache values, the device comprising:

[0060] The flow control frame receiving module is used to receive flow control frames sent by the test device at a predetermined line rate. The flow control frame carries a time parameter, which is used to indicate the stop time for the network device to stop sending data. The predetermined line rate corresponds to the data transmission rate of the network device.

[0061] The message receiving module is used to receive data messages continuously sent by the test device within the data message sending time, and store the data messages in the port buffer.

[0062] The cached message sending module is used to send all cached data messages in the port cache area to the test device after the stop time ends, so that the test device can determine the port cache value of the network device based on the cached data messages.

[0063] Fifthly, the present invention provides an electronic device, comprising: a memory and a processor, wherein the memory stores a computer program executable by the processor, and when the electronic device is running, the processor executes the computer program to implement the method as described in any one of the foregoing embodiments or the method as described in any one of the foregoing embodiments.

[0064] In a sixth aspect, the present invention provides a computer-readable storage medium storing a computer program that is executed by a processor to implement the method described in any one of the foregoing embodiments or the method described in any one of the foregoing embodiments.

[0065] Compared with existing technologies, this invention provides a method, apparatus, electronic device, and readable storage medium for testing port cache values. It first sends flow control frames at a predetermined line rate to cause the network device to stop data transmission within a specified time period, and then continuously sends data packets to the network device. Because the network device continuously receives flow control frames, it cannot forward the data packets and can only store them in the port cache. When data packet transmission stops, the sending of flow control frames can cease. The network device then returns the cached data packets from the port cache, ultimately determining the port cache value based on the cached data packets, ensuring the accuracy of the final port cache value obtained from the network device. Attached Figure Description

[0066] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0067] Figure 1 This is a schematic diagram of a scenario for testing switch cache in existing technology.

[0068] Figure 2 This is one of the application scenario diagrams provided by an embodiment of the present invention.

[0069] Figure 3 This is one of the flowcharts illustrating a method for testing port cache values ​​provided in an embodiment of the present invention.

[0070] Figure 4 This is a timing diagram for data transmission provided in an embodiment of the present invention.

[0071] Figure 5 This is a second flowchart illustrating a method for testing port cache values ​​provided in an embodiment of the present invention.

[0072] Figure 6 This is a second schematic diagram of an application scenario provided by an embodiment of the present invention.

[0073] Figure 7 This is a third schematic diagram of an application scenario provided by an embodiment of the present invention.

[0074] Figure 8 This is the third flowchart illustrating a method for testing port cache values ​​provided in an embodiment of the present invention.

[0075] Figure 9 This is one of the structural schematic diagrams of a port cache value testing device provided in an embodiment of the present invention.

[0076] Figure 10 This is a second schematic diagram of a test device for port cache values ​​provided in an embodiment of the present invention.

[0077] Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0078] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0079] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0080] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0081] Furthermore, the terms "first," "second," "third," and "fourth" are used only for distinguishing descriptions and should not be interpreted as indicating or implying relative importance.

[0082] It should be noted that, where there is no conflict, the features in the embodiments of the present invention can be combined with each other.

[0083] Please refer to Figure 1 , Figure 1 This is a schematic diagram of a scenario for testing switch cache in existing technology.

[0084] In existing technology, a tester is used to test the port buffer of a switch. Ports A, B, and C of the tester are connected to ports 1, 3, and 2 of the switch, respectively. The testing process is as follows:

[0085] (1) The tester first sends data packets to port 3 of the switch at 100% line speed through port B (for example, continuously for 30 seconds), which fills the outgoing bandwidth of port 1 of the switch. At this time, the data packets sent by port B continuously return to port A of the tester through port 1.

[0086] (2) Meanwhile, within 30 seconds, the tester continuously sends data packets to port 2 of the switch through port C (for example, continuously for 10 seconds). Since the outbound bandwidth of port 1 of the switch is filled by the data sent by port B of the tester, the packets sent by port C will be stored in the buffer of the switch for forwarding.

[0087] (3) After the tester ports C and B stop sending, the data packets in the switch's buffer are sent to the tester's port A through port 1;

[0088] (4) Finally, the tester subtracts the number of data packets sent by port B from the number of data packets received by port A to obtain the number of data packets buffered by the switch, and then the port buffer size of the switch can be calculated.

[0089] As mentioned in the background section above, in existing technologies, due to the inherent limitations of the switch's switching chip, the switch ports may experience over-bandwidth forwarding to some extent. Specifically, during the time period when port B sends data packets: data packets sent from port B to port 3 will fully utilize the outgoing bandwidth of port 1; and not all data packets sent from port C to port 2 will be stored in the buffer. A very small portion of the data packets sent from port C will not enter the buffer and can instead be directly returned to port A via port 1.

[0090] During the time period when port B sends data packets, data packets sent from port C to port 2 and then directly out through port 1 will also be considered as packets stored in the buffer. This causes the calculated number of data packets in the switch's buffer to be greater than the actual number of packets stored by the switch, ultimately resulting in an inaccurate calculation of the switch's port buffer size.

[0091] Furthermore, current technologies require both the tester and the switch to use three ports. However, in current data center applications, most data center switches have high-speed ports, such as 40G, 100G, or even 400G. Correspondingly, high-speed testers are expensive and have a limited number of ports. For example, a tester from a certain manufacturer that includes a 400G high-speed test port only has two test ports on a single board. This tester cannot use existing technology to test the port buffer size of a 400G switch. In other words, current methods lack universality and cannot be applied to testers with certain high-speed ports.

[0092] Based on the discovery of the aforementioned technical problems, the inventors, through creative labor, proposed the following technical solutions to solve or improve these problems. It should be noted that the deficiencies in the solutions of the prior art are all results derived by the inventors after practical experience and careful research. Therefore, the discovery process of the aforementioned problems and the solutions proposed in the embodiments of this application below should be considered contributions made by the inventors to this application during the inventive process, and should not be construed as technical content known to those skilled in the art.

[0093] Through long-term observation and research, the inventors discovered that switch ports exhibit a certain degree of overbandwidth forwarding. Therefore, in existing technologies, even when one port of the tester sends packets that fill the switch's egress bandwidth, the switch can still forward packets sent from another port of the tester out through the egress port with overbandwidth. In other words, by making the switch's egress port congested or stopping forwarding, preventing data from being forwarded, it can be ensured that all subsequent data packets are stored in the switch's buffer. When the switch's egress port is open, the data in the switch's buffer is returned to the tester, allowing for accurate calculation of the switch's buffer size.

[0094] IEEE 802.3x is a flow control method for the full-duplex Ethernet data link layer. The principle behind flow control is as follows: when the receiver port is congested, to avoid frame loss, the receiver sends a flow control frame (PAUSE frame) to the sender, instructing the sender to pause data transmission. This controls the data flow between the sender and receiver, preventing packet loss. The PAUSE frame includes fields such as destination MAC address, type field identifier, opcode, and operation parameters. The destination MAC address is fixed as a multicast address: 01-80-C2-00-00-01; the type field identifier is 0x8808, representing the protocol type of the frame; the opcode field is two bytes, 0x0001; the operation parameter field is two bytes, which can be used to indicate the time for the receiver to stop forwarding, in units of the time it takes for the receiver to transmit 512 bits of data at its current transmission rate. The value range of the operation parameter is 0~65535. For example, if the time for the receiver to transmit 512 bits of data at its current transmission rate is t, and the operation parameter is 65535, then the time for the receiver to stop sending data is 65535*t.

[0095] Therefore, please see Figure 2 , Figure 2This is a schematic diagram of an application scenario provided by an embodiment of the present invention. The inventors conceived of using IEEE 802.3x flow control technology to send a PAUSE frame from the test device 20 to the data output end of the network device 10. The PAUSE frame suppresses the data forwarding of the network device 10. Thus, within the time period corresponding to the operation parameters of the PAUSE frame, the data received by the network device 10 will not be forwarded out through its data output end.

[0096] Among them, network device 10 can be a general switch, data center switch, router, etc., and test device 20 can be a dedicated test device or tester corresponding to different types of network device 10.

[0097] Therefore, this invention provides a method for testing port buffer values. This method sends flow control frames to a network device at a predetermined line rate to control the network device to stop data forwarding, ensuring that all subsequent data packets sent to the network device are stored in the port buffer. When data packet transmission stops, flow control frames are also stopped, allowing the network device to receive the buffered data packets returned from the port buffer. Finally, the port buffer value can be calculated based on these buffered data packets, ensuring accurate and time-saving verification of the port buffer's capacity. The following detailed description, through embodiments and accompanying drawings, further illustrates this method.

[0098] Please refer to Figure 3 , Figure 3 A flowchart illustrating a method for testing port cache values ​​provided in an embodiment of the present invention includes the following steps:

[0099] S110. Send flow control frames to network devices at a predetermined line rate.

[0100] In this embodiment, the flow control frame carries a time parameter, which can be the operation parameter mentioned above. The time parameter is used to indicate the stop time for the network device to stop sending data, and the predetermined line rate can correspond to the data transmission rate of the network device.

[0101] Flow control frames can be sent within the duration of the flow control frame transmission. Each time a network device receives a flow control frame, it will stop data forwarding within the stop time corresponding to that flow control frame. Therefore, if the network device continuously receives flow control frames within the duration of the flow control frame transmission, it can stop data forwarding for several consecutive stop time periods.

[0102] S120. During the data packet transmission duration, continuously send data packets to the network device so that the data packets are stored in the port buffer of the network device.

[0103] The port buffer is a buffer where packets can be stored waiting to be forwarded and processed. The actual port buffer values of different network devices can be different. When a network device receives a data packet, it stores the data packet in the port buffer of the network device.

[0104] To illustrate the timing relationship between the transmission of the flow control frame and the data packet, please refer to Figure 4 , Figure 4 FIG. is a timing diagram of data transmission provided by an embodiment of the present invention. The flow control frame can be sent to the network device at a predetermined line speed within the flow control frame transmission duration T1, and the data packet can be continuously sent to the network device within the data packet transmission duration T2.

[0105] Among them, the start time t1 of the flow control frame transmission duration T1 is less than the start time t2 of the data packet transmission duration T2, and the end time t4 of the flow control frame transmission duration T1 is greater than the end time t3 of the data packet transmission duration T2, that is, t1 < t2 and t4 > t3.

[0106] S130: When the data packet stops being sent, stop sending the flow control frame.

[0107] S140: Receive the buffered data packet in the port buffer sent by the network device.

[0108] After the data packet stops being sent, the flow control frame can be stopped from being sent so that the network device returns the buffered data packet in the port buffer, and the buffered data packet can represent the data packet stored in the port buffer.

[0109] Refer to Figure 4 At the end time t3 of the data packet transmission duration T2, the data packet can be stopped from being sent; at the end time t4 of the flow control frame transmission duration T1, the flow control frame can be stopped from being sent. Then the network device can return the buffered data packet in the port buffer.

[0110] S170: Determine the port buffer value of the network device according to the buffered data packet.

[0111] After receiving all the buffered data packets in the port buffer, the port buffer value of the port buffer of the network device can be calculated according to all the buffered data packets returned by the network device.

[0112] This invention provides a method for testing port buffer values. It sends flow control frames to a network device at a predetermined line rate to control the network device to stop data forwarding. Simultaneously with sending the flow control frames, it continuously sends data packets to the network device within the data packet transmission duration. The network device stores the received data packets in a port buffer. After stopping data packet transmission and flow control frame transmission, the method receives the buffered data packets from the network device. Finally, the port buffer value can be calculated based on the buffered data packets, ensuring accurate and time-saving verification of the port buffer capacity.

[0113] Optionally, this method can be applied to test equipment. The time parameter of the above flow control frame is 0~65535. In order to ensure that the time when the network device stops sending data is continuous, the time parameter can be directly set to 65535, and the size of the data packet can also be set randomly.

[0114] The test device can first generate a flow control frame, and then send the flow control frame to the network device at a predetermined line rate. The test device can then generate a fixed-size data packet and continuously send the generated data packet to the network device within the data packet transmission duration.

[0115] In the data packet format, the frame header and trailer together occupy 20 bytes. The proportion of these bytes varies depending on the size of the data packet. It's understandable that different data packet sizes might result in different calculated port buffer values. Therefore, data packets of various sizes (64 bytes, 128 bytes, 256 bytes, 512 bytes, 1024 bytes, 1518 bytes, 9216 bytes, etc.) can be generated sequentially. After verifying these different port buffer values ​​multiple times, the maximum value can be used as the actual port buffer value for the network device.

[0116] In one possible implementation, it is essential to ensure that the port buffer of the network device is filled with data packets for the port buffer values ​​calculated by subsequent testing devices to be accurate. Accordingly, in Figure 3 Based on this, please refer to Figure 5 Before step S170, the method may further include steps S150 and S160:

[0117] S150. Determine whether the total number of data packets sent is greater than the total number of buffered data packets.

[0118] In this embodiment, after stopping the transmission of the flow control frame, the network device returns all the buffered data packets in the port buffer. When the packet loss during the transmission between the test device and the network device is not considered, assuming the total number of data packets sent is x and the total number of buffered data packets is y, there are two cases for the comparison between x and y:

[0119] The first is x = y. If all the data packets sent during the data packet transmission duration do not fill the port buffer or just fill the port buffer, then the total number of data packets sent is equal to the total number of buffered data packets;

[0120] The second is x > y. If all the data packets sent during the data packet transmission duration fill the port buffer of the network device, the network device will discard the subsequent received data packets. At this time, the total number of data packets sent is greater than the total number of buffered data packets.

[0121] Since the test device is insensitive to whether the port buffer of the network device is full or just full, for the test device, only when it is determined that the total number of data packets sent is greater than the total number of received buffered data packets can it be determined that the data packets sent during the data packet transmission duration fill the port buffer of the network device.

[0122] If the total number of data packets sent is equal to the total number of buffered data packets, step S160 is executed, and based on the extended data packet transmission duration in S160, the above step S110 is returned for execution.

[0123] S160. Extend the data packet transmission duration.

[0124] If the total number of data packets sent is greater than the total number of buffered data packets, step S171 is executed. Correspondingly, the process of determining the port buffer value of the network device in the above step S170 may include sub-steps:

[0125] S171. Determine the port buffer value according to the total number of buffered data packets and the size of the data packets.

[0126] It should be noted that in combination with Figure 4 , at the beginning of the method execution, the values of T1 and T2 can be taken according to their respective initial values, or can be set by the user on the test device. After extending the data packet transmission duration T2, it is also necessary to ensure that t1 < t2 and t4 > t3, that is, depending on the actual sizes of T1 and T2, it is judged whether to extend T1 after extending T2 to ensure that t1 < t2 and t4 > t3.

[0127] In a possible case, the test device is a network tester, and the above steps S110 to S170 can all be executed by this network tester.

[0128] In another possible scenario, the testing equipment includes a network tester with communication connection and a back-end processing device, such as a personal computer. The network tester is connected to the network device under test. The above steps S110~S140 and S170 can be executed by the network tester, and the above steps S150 and S160 can be executed by the personal computer.

[0129] After the network tester completes step S140, the personal computer can read the total number of sent data packets x and the total number of buffered data packets y from the network tester, or the network tester can send the total number of sent data packets x and the total number of buffered data packets y to the personal computer. Then, the personal computer determines the relationship between x and y: if x > y, the personal computer informs the network tester to proceed with step S170 normally; if x = y, the personal computer increments T2, while simultaneously determining whether to increment T2 based on the actual situation, and then sends the increased T1 and T2 to the network tester, so that the network tester restarts executing S110~S140. This cycle continues until x > y, at which point the network tester can proceed with step S170 to obtain the port buffer value.

[0130] In one possible implementation, please combine Figure 6 A network device can have a first port and a second port. A time parameter can be used to indicate the stop time for the first port to stop transmitting data. A predetermined line speed can correspond to the data transmission rate of the first port. In some cases, the test device can connect to only one network device to test its port buffer value; alternatively, the test device can connect to multiple network devices and test their port buffer values ​​simultaneously. Different network devices can be uniquely identified by their device IDs.

[0131] For at least one network device connected to the test device, the first port of the network device can be connected to one port of the test device, and the second port of the network device can be connected to another port of the test device. The process of determining the port cache value of the network device can be as follows.

[0132] Optionally, the sub-steps of step S110 above may include:

[0133] S111. Send a flow control frame to the first port of the network device at a predetermined line rate.

[0134] Optionally, the sub-steps of step S120 above may include:

[0135] S121. During the data packet transmission duration, continuously send data packets to the second port.

[0136] The data transmission rate is the port rate of the port. The data transmission rate of the first port is greater than or equal to the data transmission rate of the second port.

[0137] Optionally, the sub-steps of step S140 above may include:

[0138] S141. Receive the cached data packet sent by the network device through the first port.

[0139] It should be noted that network devices can be configured at the beginning. In the configuration interface of the test device or the interface of the personal computer included in the test device, the first and second ports of the network device should be added to the same VLAN (Virtual Local Area Network) in an untagged manner.

[0140] In VLANs, a tag is the label of a VLAN, that is, the VLAN ID. When a data packet is a tagged message, the tag is used to indicate which VLAN the data packet belongs to. When a data packet is an untagged message, it means that the data packet does not belong to any VLAN and has no VLAN tag.

[0141] In one possible implementation, please combine Figure 7 Network devices can have a first port and a second port, while test devices can have a third port and a fourth port. The first port can be connected to the third port, and the second port can be connected to the fourth port. The first port and the third port have the same data transmission rate, and the second port and the fourth port have the same data transmission rate.

[0142] Optionally, the sub-steps of step S110 above may include:

[0143] S11a. Send a flow control frame to the network device through the third port at the predetermined line speed.

[0144] The test equipment can send flow control frames to the first port of the network device through the third port at a predetermined line speed.

[0145] Optionally, the sub-steps of step S120 above may include: S12a, continuously sending data packets to the network device through the fourth port during the data packet transmission duration.

[0146] During the data packet transmission duration, the test device can continuously send data packets to the network device's second port through the fourth port. In a possible example, the test device can send data packets at 100% line rate, meaning that the test device's data packet transmission rate is consistent with the data transmission rate of the second and fourth ports, thus completing the test as quickly as possible.

[0147] Optionally, the sub-steps of step S140 above may include:

[0148] S14a, Receive buffered data packets sent by the network device through the third port. The test device can receive buffered data packets returned by the network device's first port through the third port.

[0149] Optionally, prior to step S110 above, the method may further include the step:

[0150] S100, Set the predetermined line speed to equal the data transmission rate of the third port.

[0151] When the predetermined line rate is set to the data transmission rate of the third port, it means that the test device is sending flow control frames to the network device at 100% line rate. Sending flow control frames at 100% line rate ensures that the data packet exit point, the first port, remains in a stopped data forwarding state. Data packets received by the network device can only be stored in the port buffer until the stop time of the flow control frame ends, at which point the network device will forward the buffered data packets from the first port back to the test device.

[0152] The above-described embodiment of the test method for port cache values ​​focuses on the test equipment and describes the process of testing the port cache values ​​of network devices using the test equipment.

[0153] Based on the above, the following describes the process of testing the port cache values ​​of a network device using a testing device, with the network device as the execution subject. It should be noted that the basic principles and resulting technical effects are the same as or similar to those in the aforementioned embodiments. For the sake of brevity, parts not mentioned in this embodiment can be referred to the corresponding content in the above embodiments. Please refer to... Figure 8 , Figure 8 This is a flowchart illustrating a method for testing port cache values ​​provided in an embodiment of the present invention. The method includes the following steps:

[0154] S210, Receive flow control frames sent by the test equipment at a predetermined line rate.

[0155] The flow control frame carries a time parameter that indicates the stop time for the network device to cease data transmission. The predetermined line rate corresponds to the network device's data transmission rate. The network device can calculate the stop time for data transmission based on the time parameter in the flow control frame.

[0156] S220. During the data packet transmission duration, receive the data packets continuously sent by the test device and store the data packets in the port buffer.

[0157] S230. After the stop time ends, all cached data packets in the port buffer are sent to the test device so that the test device can determine the port buffer value of the network device based on the cached data packets.

[0158] This invention provides a method for testing port buffer values. After receiving a flow control frame sent by a test device at a predetermined line rate, the network device stops data forwarding within the stop time corresponding to the flow control frame. Then, during the data packet transmission duration, it receives data packets continuously sent by the test device and stores these data packets in the port buffer. Finally, after the stop time ends, all buffered data packets in the port buffer are sent to the test device, allowing the test device to determine the port buffer value of the network device based on the buffered data packets. This method ensures accurate and time-saving verification of the port buffer capacity.

[0159] In one possible implementation, combined with Figure 6 Since the test equipment may include at least one network device, for any one of these network devices: the network device may have a first port and a second port, the first port being connected to one port of the test equipment, and the second port being connected to the other port of the test equipment. A time parameter can be used to indicate the stop time for the first port to cease data transmission, and a predetermined line speed can correspond to the data transmission rate of the first port.

[0160] Accordingly, the sub-steps of step S210 above may include:

[0161] S211. Receive flow control frames sent by the test device at a predetermined line speed through the first port.

[0162] Accordingly, the sub-steps of step S220 above may include:

[0163] S221. During the data packet transmission time, receive data packets continuously sent by the test device through the second port, store the data packets in the port buffer, and discard newly arriving data packets on the second port when the port buffer is full.

[0164] Accordingly, the process of sending all cached data packets in the port buffer to the test device in step S230 above may include:

[0165] S231. Send the cached data packet to the test device through the first port.

[0166] In one possible implementation, please combine Figure 7 Network devices can have a first port and a second port, while test devices can have a third port and a fourth port. The first port can be connected to the third port, and the second port can be connected to the fourth port. The first port and the third port have the same data transmission rate, and the second port and the fourth port have the same data transmission rate.

[0167] Accordingly, the sub-steps of step S210 above may include:

[0168] S21a Receive the flow control frame sent by the test equipment through the third port at a predetermined line speed.

[0169] Network devices can receive flow control frames sent by test devices through the third port at a predetermined line rate via the first port.

[0170] Accordingly, the sub-steps of step S220 above may include:

[0171] S22a. During the data packet transmission duration, receive the data packets continuously sent by the test device through the fourth port, store the data packets in the port buffer, and discard the newly arriving data packets when the port buffer is full.

[0172] Network devices can receive data packets continuously sent by test devices through the fourth port via the second port, store the data packets in the port buffer until the buffer is full, and then discard the subsequent received data packets.

[0173] Accordingly, the process of sending all cached data packets in the port buffer to the test device in step S230 above may include:

[0174] S23a, Send the cached data packet to the third port.

[0175] Network devices can send cached data packets from the port buffer to the third port of the test device through the first port.

[0176] It should be noted that the execution order of each step in the above method embodiments is not limited to that shown in the attached figures, and the execution order of each step shall be subject to the actual application situation.

[0177] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0178] (1) In this scheme, the test device sends flow control frames to the first port (i.e., the data packet exit) of the network device at a predetermined line rate during the flow control frame transmission duration. This allows the first port to completely stop forwarding data packets. Simultaneously, during the data packet transmission duration, the test device continuously sends data packets to the second port of the network device, so that the data packets fill the port buffer of the network device. Only after the flow control frame transmission stops can the network device return the cached data packets in the port buffer from the first port to the test device. This ensures that the total number of cached packets received by the test device is consistent with the actual number of data packets stored in the port buffer, thus ensuring the accuracy of the final calculated port buffer value.

[0179] (2) The network device sends flow control frames at 100% line speed (i.e., the data transmission rate of the third port). This ensures that the data packet exit point, the first port, remains in a stopped forwarding state to the maximum extent possible. The data packets received by the network device can only be stored in the port buffer until the stop time of the flow control frame ends. Only then will the network device forward the buffered data packets from the first port back to the test device. Sending data packets at 100% line speed (the data transmission rate of the fourth port) allows the data packet buffer to be filled within the shortest possible data packet transmission time, enabling the entire test process to be completed as quickly as possible.

[0180] (3) In this solution, only two ports of the test equipment need to be connected to two ports of the network equipment to complete the test, which is more suitable for testing the test equipment of the data center switch with the current high-speed port.

[0181] (4) Combining IEEE 802.3x flow control technology, the flow control frame with a time parameter of 65535 generated by the test device in this scheme can keep the first port of the network device in a stopped data forwarding state. Compared with the existing technology of sending traffic in a 2-to-1 manner to construct the output port congestion state of the tester, some traffic will still pass through. The test results of this scheme are more accurate.

[0182] In order to perform the corresponding steps in the above method embodiments and various possible implementations, two implementation methods of the test device for port cache values ​​applied to test equipment and network equipment are given below.

[0183] Please see Figure 9 , Figure 9 A schematic diagram of the structure of a port cache value testing device 200 provided in an embodiment of the present invention is shown. The testing device 200 is applied to a testing equipment and includes: a flow control frame sending module 210, a message sending module 220, a data processing module 230, and a cached message receiving module 240.

[0184] The flow control frame sending module 210 is used to send flow control frames to the network device at a predetermined line rate. The flow control frame carries a time parameter, which indicates the stop time for the network device to stop sending data. The predetermined line rate corresponds to the data transmission rate of the network device.

[0185] The message sending module 220 is used to continuously send data packets to the network device within the data packet sending duration, so that the data packets are stored in the port buffer of the network device.

[0186] The data processing module 230 is used to stop sending flow control frames after data packets have stopped being sent.

[0187] The buffered message receiving module 240 is used to receive buffered data packets in the port buffer area sent by the network device.

[0188] The data processing module 230 is also used to determine the port cache value of the network device based on the cached data packets.

[0189] In this embodiment, the flow control frame sending module 210 can be used to implement steps S100 and S110 and their sub-steps. A detailed description of the flow control frame sending module 210 can be found in the detailed descriptions of steps S100 and S110. The message sending module 220 can be used to implement step S120 and its sub-steps. A detailed description of the message sending module 220 can be found in the detailed description of step S120. The data processing module 230 can be used to implement steps S130, S150-S170 and their respective sub-steps. A detailed description of the data processing module 230 can be found in the detailed descriptions of steps S130, S150-S170. The buffered message receiving module 240 can be used to implement step S140 and its sub-steps. A detailed description of the buffered message receiving module 240 can be found in the detailed description of step S140.

[0190] Please see Figure 10 , Figure 10 A schematic diagram of the structure of a port cache value testing device 400 provided in an embodiment of the present invention is shown. The testing device 400 is applied to a network device and includes: a flow control frame receiving module 410, a packet receiving module 420, and a cached packet sending module 430.

[0191] The flow control frame receiving module 410 is used to receive flow control frames sent by the test device at a predetermined line rate. The flow control frame carries a time parameter, which indicates the stop time for the network device to stop sending data. The predetermined line rate corresponds to the data transmission rate of the network device.

[0192] The message receiving module 420 is used to receive data messages continuously sent by the test device within the data message sending time and store the data messages in the port buffer.

[0193] The cached message sending module 430 is used to send all cached data messages in the port buffer to the test device after the stop time ends, so that the test device can determine the port buffer value of the network device based on the cached data messages.

[0194] In this embodiment, the flow control frame receiving module 410 can be used to implement step S210 and its sub-steps as described above. A detailed description of the flow control frame receiving module 410 can be found in the detailed description of step S210. The message receiving module 420 can be used to implement step S220 and its sub-steps as described above. A detailed description of the message receiving module 420 can be found in the detailed description of step S220. The buffered message sending module 430 can be used to implement step S230 and its sub-steps as described above. A detailed description of the buffered message sending module 430 can be found in the detailed description of step S230.

[0195] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the test apparatus 200 and test apparatus 400 described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0196] Please see Figure 11 , Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. The electronic device 300 may include a processor 310, a memory 320, and a bus 330, wherein the processor 310 is connected to the memory 320 via the bus 330.

[0197] Memory 320 can be used to store software programs, for example, Figure 9 The test device 200 shown or Figure 10 The test apparatus 400 shown is included. The memory 320 may be, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Flash Memory, Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), etc.

[0198] The processor 310 can be an integrated circuit chip with signal processing capabilities. The processor 310 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0199] The electronic device 300 can be the aforementioned test device or network device. The memory 320 stores machine-readable instructions executable by the processor 310. When the processor 310 executes the machine-readable instructions, it implements the port cache value testing method disclosed in the above embodiments.

[0200] Understandable. Figure 11 The structure shown is for illustrative purposes only; the electronic device 300 may also include components that are more advanced than those shown. Figure 11 The more or fewer components shown, or having the same Figure 11 The different configurations shown. Figure 11 The components shown can be implemented using hardware, software, or a combination thereof.

[0201] This invention also provides a computer-readable storage medium storing a computer program. When executed by a processor, this computer program implements the port cache value testing method disclosed in the above embodiments. The readable storage medium can be, but is not limited to, various media capable of storing program code, such as a USB flash drive, external hard drive, ROM, RAM, PROM, EPROM, EEPROM, FLASH disk, or optical disk.

[0202] In summary, this invention provides a method, apparatus, electronic device, and readable storage medium for testing port cache values. It first sends flow control frames at a predetermined line rate to cause the network device to stop data transmission within a specified time period, and then continuously sends data packets to the network device. Because the network device continuously receives flow control frames, it cannot forward the data packets and can only store them in the port cache. When data packet transmission stops, the sending of flow control frames can cease. The network device then returns the cached data packets from the port cache, ultimately allowing the determination of the port cache value based on the cached data packets, ensuring the accuracy of the final port cache value obtained from the network device.

[0203] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for testing port cache values, characterized in that, include: A flow control frame is sent to the first port of the network device at a predetermined line rate. The flow control frame carries a time parameter, which is used to indicate the stop time for the first port to stop sending data. The predetermined line rate corresponds to the data transmission rate of the first port. During the data packet transmission duration, data packets are continuously sent to the second port of the network device so that the data packets are stored in the port buffer of the network device; the data transmission rate of the first port is greater than or equal to the data transmission rate of the second port. When the data packet stops being sent, the flow control frame stops being sent. Receive cached data packets from the port buffer sent by the network device through the first port; The port cache value of the network device is determined based on the cached data packet.

2. The method according to claim 1, characterized in that, The method is applied to a test device having a third port and a fourth port; The step of sending a flow control frame to the first port of the network device at a predetermined line rate includes: At a predetermined line rate, a flow control frame is sent through the third port to the first port of the network device. The step of continuously sending data packets to the second port of the network device includes: Data packets are continuously sent to the second port of the network device through the fourth port; The step of receiving the cached data packets in the port buffer sent by the network device through the first port includes: The third port receives the cached data packets sent by the network device through the first port.

3. The method according to claim 2, characterized in that, Before the step of sending a flow control frame through the third port to the first port of the network device at a predetermined line rate, the method further includes: The predetermined line speed is set to be equal to the data transmission rate of the third port.

4. The method according to claim 1, characterized in that, Before the step of determining the port cache value of the network device based on the cached data packet, the method further includes: Determine if the total number of data packets sent exceeds the total number of buffered data packets; If so, the step of determining the port cache value of the network device includes: The port cache value is determined based on the total number of cached data packets; If not, the data packet transmission duration is extended, and based on the extended data packet transmission duration, the process returns to the step of sending a flow control frame to the first port of the network device at a predetermined line rate.

5. A method for testing port cache values, characterized in that, Applied to a network device, the network device having a first port and a second port; the method includes: The first port receives a flow control frame sent by the test device at a predetermined line rate. The flow control frame carries a time parameter, which is used to indicate the stop time for the first port to stop sending data. The predetermined line rate corresponds to the data transmission rate of the first port. During the data packet transmission duration, the test device continuously sends data packets through the second port, and stores the data packets in the port buffer; the data transmission rate of the first port is greater than or equal to the data transmission rate of the second port. When the stop time ends, all cached data packets in the port buffer are sent to the test device through the first port, so that the test device can determine the port buffer value of the network device based on the cached data packets.

6. The method according to claim 5, characterized in that, The test equipment has a third port and a fourth port; The step of receiving the flow control frame sent by the test device at a predetermined line rate through the first port includes: The first port receives the flow control frame sent by the test device through the third port at the predetermined line speed. The step of receiving data packets continuously sent by the test device through the second port and storing the data packets in the port buffer includes: The second port receives data packets continuously sent by the test device through the fourth port, and stores the data packets in the port buffer. When the port buffer is full, newly arriving data packets will be discarded on the second port; The step of sending all cached data packets in the port buffer to the test device through the first port includes: The cached data packet is sent to the third port through the first port.

7. A testing device for port cache values, characterized in that, include: A flow control frame sending module is used to send flow control frames to a first port of a network device at a predetermined line rate. The flow control frame carries a time parameter, which is used to indicate the stop time for the first port to stop sending data. The predetermined line rate corresponds to the data transmission rate of the first port. The message sending module is used to continuously send data packets to the second port of the network device within the data packet sending duration, so that the data packets are stored in the port buffer of the network device; the data sending rate of the first port is greater than or equal to the data sending rate of the second port; The data processing module is used to stop sending the flow control frame after the data packet stops being sent; A cached message receiving module is used to receive cached data messages in the port buffer area sent by the network device through the first port; The data processing module is further configured to determine the port cache value of the network device based on the cached data packet.

8. A testing device for port cache values, characterized in that, Applied to a network device, the network device having a first port and a second port; the device includes: The flow control frame receiving module is used to receive flow control frames sent by the test device at a predetermined line rate through the first port. The flow control frame carries a time parameter, which is used to indicate the stop time for the first port to stop sending data. The predetermined line rate corresponds to the data transmission rate of the first port. The message receiving module is used to receive data messages continuously sent by the test device through the second port during the data message transmission duration, and store the data messages in the port buffer; the data transmission rate of the first port is greater than or equal to the data transmission rate of the second port; The cached message sending module is used to send all cached data messages in the port cache area to the test device through the first port after the stop time ends, so that the test device can determine the port cache value of the network device based on the cached data messages.

9. An electronic device, characterized in that, include: The electronic device includes a memory and a processor, the memory storing a computer program executable by the processor, which, when the electronic device is running, is executed by the processor to implement the test method for port cache values ​​as described in any one of claims 1-4 or the test method for port cache values ​​as described in claim 5 or 6.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that is executed by a processor to implement the method of any one of claims 1-4 or the test method for port cache values ​​as described in claim 5 or 6.