Message processing method, switch chip and switch

The switch chip processing method accurately manages data transmission rates by determining token bucket capacity and discarding packets when necessary, addressing the issue of uncontrolled data flow in straight-through mode.

CN120281733APending Publication Date: 2025-07-08苏州特思恩科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510509328.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-22
Publication Date
2025-07-08

Smart Images

  • Figure CN120281733A_ABST
    Figure CN120281733A_ABST
Patent Text Reader

Abstract

The invention provides a message processing method, a switch chip and a switch, and relates to the technical field of communication. When the analyzer receives the message header of the nth message data packet, whether the token capacity in the token bucket corresponding to the message associated channel number of the data transmission channel is greater than zero can be directly determined. And the analyzer forwards the nth message data packet only when the message data packet is greater than zero, otherwise, the analyzer discards the nth message data packet. In this way, the flow rate limitation of data transmission is realized in the direct connection mode. In addition, if the (n-1) th message data packet is forwarded before, the nth token capacity is obtained by the analyzer according to the equation Qn = Qn-1-Ln-1 + vtn-1. Therefore, whether the nth message data packet is forwarded or not can be accurately determined, and the accuracy of flow rate limitation of data transmission in a direct mode is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technologies, and in particular, to a packet processing method, a switch chip, and a switch. Background Art

[0002] A switch chip is a core component of an Ethernet switch and is responsible for processing and forwarding data packets. The main functions of the switch chip include preprocessing and forwarding of data packets, which directly affect the performance and efficiency of the switch.

[0003] With the large demand and deployment of low-latency networks, many switching chips adopt a cut-through mode for data forwarding in order to pursue low latency. The cut-through mode means that in order to ensure low latency of data packet forwarding, when the packet header of a data packet is received, it is immediately decided to forward the data packet. As a result, traffic rate limiting for data transmission cannot be performed. Summary of the Invention

[0004] The present application provides a packet processing method, a switch chip, and a switch, which are used to solve the problem that traffic rate limiting for data transmission cannot be performed when sampling the cut-through mode for data forwarding in the prior art.

[0005] In a first aspect, the present application provides a packet processing method, which is applied to a switch chip. The switch chip includes a data transmission port and a parser. The data transmission port includes a plurality of data transmission channels. The method provided by the present application includes:

[0006] For each data transmission channel, when the nth packet data packet is received, the packet header of the nth packet data packet and the packet-by-path channel number of the data transmission channel are transmitted to the parser, where n is an integer greater than or equal to 2;

[0007] When the parser receives the packet header of the nth packet data packet, it determines whether the nth token capacity in the token bucket corresponding to the packet-by-path channel number is greater than zero. Among them, if the (n - 1)th packet data packet was forwarded before, the nth token capacity is calculated by the parser according to the formula Q n = Q n-1 - L n-1 + vt n-1 obtained, Q n-1 is the (n - 1)th token capacity in the token bucket corresponding to the packet-by-path channel number before forwarding the (n - 1)th packet data packet, L n-1 is the packet length of the (n - 1)th packet data packet that has been forwarded, v is the preset token addition rate corresponding to the packet-by-path channel number, t n-1 is the time interval between receiving the nth packet data packet and receiving the (n - 1)th packet data packet, Q nBefore forwarding the nth message data packet, it is the capacity of the nth token in the token bucket corresponding to the message follow-up channel number of the data transmission channel;

[0008] If the token capacity in the token bucket corresponding to the message follow-up channel number of the data transmission channel is greater than zero, the parser forwards the nth message data packet.

[0009] In some embodiments, if the (n - 1)th message data packet was discarded previously, the nth token capacity is obtained by the parser according to the formula Q n = Q n-1 + vt n-1 obtained.

[0010] In some embodiments, after determining whether the nth token capacity in the token bucket corresponding to the message follow-up channel number is greater than zero, the method provided by this application further includes:

[0011] The data transmission channel finishes receiving the nth message data packet;

[0012] The data transmission channel records the length of the received nth message data packet and transmits the length of the nth message data packet to the parser;

[0013] After forwarding the nth message data packet, the method provided by this application further includes:

[0014] The parser records a forwarding flag in the pre-recorded message status table;

[0015] When it is recognized that the forwarding flag is included in the message status table, the parser updates the token capacity in the token bucket corresponding to the message follow-up channel number of the data transmission channel according to the formula Q m1 = Q n - L n + vT n , where Q m1 is the elapsed time T n after forwarding the nth message data packet, and it is the token capacity in the token bucket corresponding to the message follow-up channel number of the data transmission channel, and L n is the message length of the nth message data packet.

[0016] In some embodiments, the data transmission port includes a counter, and the data transmission channel records the length of the received nth message data packet, including:

[0017] The counter records the message length of the received nth message data packet.

[0018] In some embodiments, after forwarding the nth message data packet, the method provided by this application further includes:

[0019] If the token capacity in the token bucket corresponding to the in-band channel number of the message in the data transmission channel is less than or equal to zero, the parser discards the nth message data packet;

[0020] The parser records a discard flag in the pre-recorded message status table;

[0021] In the case where a discard flag is recorded in the message status table, the parser updates the token capacity in the token bucket corresponding to the in-band channel number of the data transmission channel according to the formula Q m2 =Q n +vT n , where Q m2 is the timing duration T n after discarding the nth message data packet, and is the token capacity in the token bucket corresponding to the in-band channel number of the data transmission channel.

[0022] In some embodiments, the switch chip further includes a data aggregator and a cache. The data transmission port, the data aggregator, and the parser are electrically connected in sequence, and the cache is electrically connected to the data aggregator and the parser respectively. The method provided in this application further includes:

[0023] In each data transmission channel, when the nth message data packet is received, the nth message data packet is transmitted to the data aggregator;

[0024] The data aggregator writes the nth message data packet into the cache;

[0025] Forwarding the nth message data packet includes: the parser reads the nth message data packet from the cache and forwards the nth message data packet.

[0026] In some embodiments, the parser records a token capacity table. Determining whether the nth token capacity in the token bucket corresponding to the in-band channel number of the message is greater than zero includes:

[0027] The parser looks up the nth token capacity of the corresponding token bucket from the token capacity table according to the in-band channel number of the message;

[0028] The parser determines whether the nth token capacity of the found token bucket is greater than zero.

[0029] In some embodiments, the parser records a token capacity table. Before receiving the nth message data packet, the method provided in this application further includes:

[0030] After the parser is powered on, starting from zero in the preset token bucket capacity table, tokens are added to the token bucket corresponding to each data transmission channel according to the token addition rate corresponding to each data transmission channel.

[0031] Second aspect, the present application further provides a switch chip, a data transmission port, and a parser. The data transmission port includes a plurality of data transmission channels. Among them, the switch chip is used to execute the method provided in the first aspect of the present application.

[0032] Third aspect, the present application further provides a switch, including the switch chip provided in the second aspect of the present application.

[0033] The present application provides a message processing method, a switch chip, and a switch. When the parser receives the message header of the nth message data packet, it can directly determine whether the token capacity in the token bucket corresponding to the message follow-up channel number of the data transmission channel is greater than zero. In the case of being greater than zero, the parser forwards the nth message data packet; otherwise, the parser discards the nth message data packet. In this way, traffic rate limiting of data transmission is achieved in the cut-through mode. In addition, if the (n - 1)th message data packet has been forwarded before, the nth token capacity is obtained by the parser according to the formula Q n = Q n-1 - L n-1 + vt n-1 In this way, it can accurately determine whether to forward the nth message data packet, and achieve the accuracy of traffic rate limiting of data transmission in the cut-through mode. Description of the Drawings

[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0035] Figure 1 It is the circuit module connection block diagram of the switch chip provided by the embodiment of the present application;

[0036] Figure 2 It is one of the flowcharts of the message processing method provided by the embodiment of the present application;

[0037] Figure 3 It is the second flowchart of the message processing method provided by the embodiment of the present application. Detailed Embodiments

[0038] Hereinafter, the embodiments of the present disclosure will be described with reference to the drawings. However, it should be understood that these descriptions are only exemplary and are not intended to limit the scope of the present disclosure. In addition, in the following description, the description of well-known structures and technologies is omitted to avoid unnecessarily confusing the concepts of the present disclosure.

[0039] Various structural schematic diagrams according to embodiments of the present disclosure are shown in the accompanying drawings. These figures are not drawn to scale, where for the purpose of clear expression, some details are enlarged and some details may be omitted. The shapes of various regions and layers shown in the figures, as well as their relative sizes and positional relationships, are merely exemplary and may deviate in practice due to manufacturing tolerances or technical limitations. Those skilled in the art can additionally design regions / layers with different shapes, sizes, and relative positions according to actual requirements.

[0040] In the context of the present disclosure, when a layer / component is referred to as being "on" another layer / component, the layer / component can be directly on the other layer / component, or there can be an intermediate layer / component between them. Additionally, if a layer / component is "on" another layer / component in one orientation, then when the orientation is reversed, the layer / component can be "under" the other layer / component.

[0041] Next, the technical solutions of the present application and how the technical solutions of the present application solve the above technical problems will be described in detail with specific embodiments. These several specific embodiments below can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below with reference to the accompanying drawings.

[0042] An embodiment of the present application provides a message processing method, which is applied to a switch chip 100. As Figure 1 shown, the switch chip 100 includes a data transmission port 101 and a parser 102. The data transmission port 101 includes a plurality of data transmission channels. For example, it can include 8 data transmission channels, or it can include 4 data transmission channels, etc., which are not limited herein. The parser 102 can record a token capacity table DsMemChannelTokenInfo. After the parser 102 is powered on and in the case of not receiving a message data packet, starting from zero in a preset token bucket capacity table, tokens are added to the token bucket corresponding to each data transmission channel according to the token addition rate corresponding to each data transmission channel until the token bucket is full. Specifically, as Figure 2 shown, the method provided by the embodiment of the present application includes:

[0043] S201: For each data transmission channel, when receiving the nth message data packet, transmit the message header of the nth message data packet and the message follow - up channel number of the data transmission channel to the parser 102.

[0044] Where n is an integer greater than or equal to 2. For example, n can be equal to 2, 3, or 4, etc., which are not limited herein. For example, the nth message data packet can be received from a cloud server or another switch chip.

[0045] For example, when there are 8 data transmission channels, the in-channel numbers of the packets of the 8 data transmission channels can be 01, 02, 03, 04, 05, 06, 07, and 08 in sequence.

[0046] S202: When the parser 102 receives the packet header of the nth packet data packet, it determines whether the nth token capacity in the token bucket corresponding to the in-channel number of the packet is greater than zero; if so, it executes S203; if not, it executes S204.

[0047] Exemplarily, the parser 102 records a token capacity table DsMemChannelTokenInfo. The parser 102 can, according to the in-channel number of the packet, find the nth token capacity of the corresponding token bucket from the token capacity table DsMemChannelTokenInfo; the parser 102 determines whether the found nth token capacity of the token bucket is greater than zero.

[0048] Further, if the (n - 1)th packet data packet has been forwarded before, the nth token capacity is obtained by the parser 102 according to the formula Q n = Q n-1 - L n-1 + vt n-1 where Q n-1 is the (n - 1)th token capacity in the token bucket corresponding to the in-channel number of the packet before forwarding the (n - 1)th packet data packet, L n-1 is the packet length of the (n - 1)th packet data packet being forwarded, v is the preset token addition rate corresponding to the in-channel number of the packet, t n-1 is the time interval between receiving the nth packet data packet and receiving the (n - 1)th packet data packet, and Q n is the nth token capacity in the token bucket corresponding to the in-channel number of the data transmission channel before forwarding the nth packet data packet. It can be understood that when the packet length L n-1 of the nth packet data packet is relatively large, the nth token capacity Q n may be negative.

[0049] For example, when n = 2, if the 1st packet data packet has been forwarded before, the nth token capacity is obtained by the parser 102 according to the formula Q2 = Q1 - L1 + vt1. Q1 is the 1st token capacity in the token bucket corresponding to the in-channel number of the packet before forwarding the 1st packet data packet, L1 is the packet length of the 1st packet data packet being forwarded, v is the preset token addition rate corresponding to the in-channel number of the packet, t1 is the time interval between receiving the 2nd packet data packet and receiving the 1st packet data packet, and Q2 is the 2nd token capacity in the token bucket corresponding to the in-channel number of the data transmission channel before forwarding the 2nd packet data packet.

[0050] In some other embodiments, if the (n - 1)-th message data packet was discarded previously, the n-th token capacity is obtained by the parser 102 according to the formula Q n = Q n-1 + vt n-1 For example, when n = 2, if the 1st message data packet was discarded previously, the 2nd token capacity is obtained by the parser 102 according to the formula Q2 = Q1 + vt1.

[0051] Similarly, when n = 3, n = 4, n = 5, the principle is the same as that of n = 2 above and will not be elaborated here.

[0052] In some embodiments, after S202, the method provided by the embodiments of the present application further includes:

[0053] The data transmission channel finishes receiving the n-th message data packet; the data transmission channel records the length of the received n-th message data packet and transmits the length of the n-th message data packet to the parser 102. Exemplarily, the data transmission port 101 includes a counter, and the counter can be used to record the message length of the received n-th message data packet.

[0054] S203: The parser 102 forwards the n-th message data packet.

[0055] When the n-th message data packet has not been completely received, a part of the received n-th message data packet can be forwarded first; at the same time, the remaining part of the n-th message data packet is received, so as to realize forwarding data while receiving data until the n-th message data packet is completely forwarded.

[0056] For example, the n-th message data packet can be forwarded to other switch chips or terminal devices.

[0057] Furthermore, as still Figure 1 shown, the switch chip 100 further includes a data aggregator 103 and a buffer 104. The data transmission port 101, the data aggregator 103, and the parser 102 are electrically connected in sequence, and the buffer 104 is electrically connected to the data aggregator 103 and the parser 102 respectively. In each data transmission channel, when the n-th message data packet is received, the n-th message data packet is transmitted to the data aggregator 103; the data aggregator 103 writes the n-th message data packet into the buffer 104; the parser 102 reads the n-th message data packet from the buffer 104 and forwards the n-th message data packet.

[0058] After S203, as Figure 3 shown, the method provided by the embodiments of the present application may further include:

[0059] S301: The parser 102 records a forwarding identifier in the pre-recorded message status table DsMemChannelStatusInfo.

[0060] For example, the forwarding identifier can be "0".

[0061] S302: When it is recognized that the message status table DsMemChannelStatusInfo includes a forwarding identifier, the parser 102 updates the token capacity in the token bucket corresponding to the message accompanying channel number of the data transmission channel according to the formula Q m1 = Q n - L n + vT n .

[0062] Where Q m1 is the timing duration T n after forwarding the nth message data packet, and is the token capacity in the token bucket corresponding to the message accompanying channel number of the data transmission channel, and L n is the message length of the nth message data packet.

[0063] For example, when n = 2 and the forwarding identifier is "0", when it is recognized that the message status table DsMemChannelStatusInfo includes the forwarding identifier "0", the parser 102 updates the token capacity in the token bucket corresponding to the message accompanying channel number of the data transmission channel according to the formula Q m1 = Q2 - L2 + vT2. Where Q m1 is the token capacity in the token bucket corresponding to the message accompanying channel number of the data transmission channel at the timing duration T2 after forwarding the nth message data packet, and L2 is the message length of the 2nd data packet.

[0064] S204: The parser 102 discards the nth message data packet.

[0065] In some embodiments, after S204, the method provided by the embodiments of the present application further includes:

[0066] S303: The parser 102 records a discard identifier in the pre-recorded message status table DsMemChannelStatusInfo.

[0067] For example, the discard identifier can be "0".

[0068] S304: When it is recognized that the message status table DsMemChannelStatusInfo records a discard identifier, the parser 102 updates the token capacity in the token bucket corresponding to the message accompanying channel number of the data transmission channel according to the formula Q m2 = Q n + vT n, update the token capacity in the token bucket corresponding to the message follow - up channel number of the data transmission channel.

[0069] Among them, Q m2 is the timing duration T after discarding the nth message data packet n , and it is the token capacity in the token bucket corresponding to the message follow - up channel number of the data transmission channel.

[0070] For example, when n = 2 and the forwarding identifier is "1", in the case where the discard identifier is recorded in the message status table DsMemChannelStatusInfo, the parser 102 updates the token capacity in the token bucket corresponding to the message follow - up channel number of the data transmission channel according to the formula Q m2 = Q2 + vT2, where Q m2 is the token capacity in the token bucket corresponding to the message follow - up channel number of the data transmission channel when the timing duration T2 after discarding the second message data packet.

[0071] In addition, still as Figure 1 shown, the embodiment of the present application also provides a switch chip 100, a data transmission port 101 and a parser 102. The data transmission port 101 includes a plurality of data transmission channels. Among them, the switch chip 100 is used to execute the method provided in the above - mentioned embodiment of the present application.

[0072] In addition, the present application also provides a switch, including the switch chip 100 provided in the above - mentioned embodiment of the present application.

[0073] In summary, the embodiment of the present application provides a message processing method, a switch chip 100 and a switch. When the parser 102 receives the message header of the nth message data packet, it can directly determine whether the token capacity in the token bucket corresponding to the message follow - up channel number of the data transmission channel is greater than zero. In the case where it is greater than zero, the parser 102 forwards the nth message data packet; otherwise, the parser 102 discards the nth message data packet. In this way, traffic rate limiting for data transmission is achieved in the cut - through mode. In addition, if the (n - 1)th message data packet has been forwarded before, the nth token capacity is obtained by the parser 102 according to the formula Q n = Q n-1 - L n-1 + vt n-1 In this way, it can accurately determine whether to forward the nth message data packet, and the accuracy of traffic rate limiting for data transmission in the cut - through mode is achieved.

[0074] In the above description, no detailed explanations are given for technical details such as the composition of each layer. However, those skilled in the art should understand that various technical means can be used to form layers, regions, etc. of the required shapes. Additionally, to form the same structure, those skilled in the art can also design methods that are not exactly the same as the methods described above. Moreover, although the embodiments are described separately above, this does not mean that the measures in each embodiment cannot be used in combination advantageously.

[0075] Although the preferred embodiments of the present application have been described, those skilled in the art can make additional changes and modifications to these embodiments once they know the basic creative concept. Therefore, the appended claims are intended to be construed as including the preferred embodiments as well as all changes and modifications falling within the scope of the present application.

[0076] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these modifications and variations.

Claims

1. A message processing method, characterized in that, Applied to a switch chip, the switch chip includes a data transmission port and a parser, the data transmission port includes a plurality of data transmission channels, and the method includes: For each data transmission channel, when receiving the nth packet data packet, transmit the packet header of the nth packet data packet and the packet associated channel number of the data transmission channel to the parser, where n is an integer greater than or equal to 2; When the parser receives the packet header of the nth packet data packet, it determines whether the nth token capacity in the token bucket corresponding to the packet's associated channel number is greater than zero. Among them, if the (n - 1)th packet data packet has been forwarded before, the nth token capacity is calculated by the parser according to the formula Q n = Q n-1 - L n-1 + vt n-1 where Q n-1 is the (n - 1)th token capacity in the token bucket corresponding to the packet's associated channel number before forwarding the (n - 1)th packet data packet, L n-1 is the packet length of the (n - 1)th packet data packet that has been forwarded, v is the preset token addition rate corresponding to the packet's associated channel number, t n-1 is the time interval between receiving the nth packet data packet and receiving the (n - 1)th packet data packet, and Q n is the nth token capacity in the token bucket corresponding to the packet's associated channel number of the data transmission channel before forwarding the nth packet data packet; If the token capacity in the token bucket corresponding to the packet associated channel number of the data transmission channel is greater than zero, the parser forwards the nth packet data packet.

2. The method according to claim 1, characterized in that, If the (n - 1)-th message data packet was discarded previously, the n-th token capacity is obtained by the parser according to the formula Q n = Q n-1 + vt n-1 as obtained 3. The method according to claim 1, wherein After determining whether the nth token capacity in the token bucket corresponding to the packet associated channel number is greater than zero, the method further includes: The data transmission channel has finished receiving the nth packet data packet; The data transmission channel records the length of the received nth packet data packet and transmits the length of the nth packet data packet to the parser; After forwarding the nth packet data packet, the method further includes: The parser records a forwarding flag in a pre-recorded packet status table; When it is recognized that the forwarding identifier is included in the message status table, the parser updates the token capacity in the token bucket corresponding to the message following channel number of the data transmission channel according to the formula Q m1 =Q n -L n +vT n . Here, Q m1 is the elapsed time T n after forwarding the nth message data packet, when the token capacity in the token bucket corresponding to the message following channel number of the data transmission channel, and L n is the message length of the nth message data packet.

4. The method according to claim 3, characterized in that, The data transmission port includes a counter, and the data transmission channel records the length of the received nth packet data packet, including The counter records the packet length of the received nth packet data packet.

5. The method according to claim 1 or 3, characterized in that, After forwarding the nth packet data packet, the method further includes: If the token capacity in the token bucket corresponding to the packet associated channel number of the data transmission channel is less than or equal to zero, the parser discards the nth packet data packet; The parser records a discard flag in a pre-recorded packet status table; When it is recognized that a discard flag is recorded in the message status table, the parser updates the token capacity in the token bucket corresponding to the message follow-up channel number of the data transmission channel according to the formula Q m2 = Q n + vT n , where Q m2 is the timing duration T n after discarding the nth message data packet, and is the token capacity in the token bucket corresponding to the message follow-up channel number of the data transmission channel.

6. The method according to claim 1, characterized in that, The switch chip further includes a data aggregator and a cache, the data transmission port, the data aggregator, and the parser are electrically connected in sequence, the cache is electrically connected to the data aggregator and the parser respectively, and the method further includes: In each data transmission channel, when receiving the nth packet data packet, transmit the nth packet data packet to the data aggregator; The data aggregator writes the nth packet data packet into the cache; Forwarding the nth packet data packet includes: the parser reads the nth packet data packet from the cache and forwards the nth packet data packet.

7. The method according to claim 1, characterized in that, The parser records a token capacity table, and determining whether the nth token capacity in the token bucket corresponding to the packet associated channel number is greater than zero includes: The parser looks up the nth token capacity of the corresponding token bucket from the token capacity table according to the packet associated channel number; The parser determines whether the nth token capacity of the found token bucket is greater than zero.

8. The method according to claim 1, wherein The parser records a token capacity table, and before receiving the nth packet data packet, the method further includes: After the parser is powered on, starting from zero in a preset token bucket capacity table, add tokens to the token bucket corresponding to each data transmission channel according to the token addition rate corresponding to each data transmission channel.

9. A switch chip, characterized in that, A data transmission port and a parser, the data transmission port including a plurality of data transmission channels, wherein the switch chip is used to execute the method according to any one of claims 1-8.

10. A switch, characterized in that, Including the switch chip according to claim 9.