WO2022174444A1 - Data stream transmission method and apparatus, and network device - Google Patents

Data stream transmission method and apparatus, and network device Download PDF

Info

Publication number
WO2022174444A1
WO2022174444A1 PCT/CN2021/077239 CN2021077239W WO2022174444A1 WO 2022174444 A1 WO2022174444 A1 WO 2022174444A1 CN 2021077239 W CN2021077239 W CN 2021077239W WO 2022174444 A1 WO2022174444 A1 WO 2022174444A1
Authority
WO
WIPO (PCT)
Prior art keywords
packet
channel
data stream
output
flow
Prior art date
Application number
PCT/CN2021/077239
Other languages
French (fr)
Chinese (zh)
Inventor
魏华
卞云峰
张顺平
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2021/077239 priority Critical patent/WO2022174444A1/en
Priority to CN202180092641.2A priority patent/CN116889024A/en
Publication of WO2022174444A1 publication Critical patent/WO2022174444A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W72/00Local resource management
    • H04W72/50Allocation or scheduling criteria for wireless resources
    • H04W72/54Allocation or scheduling criteria for wireless resources based on quality criteria

Definitions

  • the present application relates to the field of communication technologies, and in particular, to a data stream transmission method, apparatus, and network device.
  • the bandwidth processing capability, the number of ports, and the number of users supported by network devices increase rapidly, and more and more types of services are carried on network devices, so that a network device can carry massive amounts of data.
  • the services can include voice calls, video calls, remote control, and automatic driving. The requirements are very high, and priority service needs to be ensured regardless of the current network status is congested or not.
  • a network device when a network device transmits a data stream through a network card, it usually divides the data stream into a non-congested stream and a congested stream according to the service type of the data stream, and stores the non-congested stream in the on-chip cache of the network card. Stored in the off-chip cache of the NIC. After that, when scheduling the output of the data stream, read the data stream from the on-chip cache and the off-chip cache, and differentiate the two channels of high priority and low priority according to the business priority.
  • Data flows with higher levels are buffered on high-priority channels, and data flows and congested flows with lower priorities among non-congested flows are buffered on low-priority channels, and the high-priority channels are preferentially served. Since the read delay of the on-chip cache is extremely small, and the data flow with higher priority in the non-congested flow is output through the high-priority channel, the high-priority data flow can be output quickly, so as to obtain a lower delay.
  • the congested stream is stored in the off-chip cache, which has a large read delay, and the low-priority data stream in the non-congested stream is output through the low-priority channel, so it is necessary to wait for the congested stream to be read and then queue up for output.
  • This will increase the delay of low-priority data streams in non-congested streams, and will reduce the efficiency of on-chip cache allocation and release to a certain extent.
  • the present application provides a data stream transmission method, device and network device, which can be used to reduce the delay of low-priority data streams in non-congested streams, thereby improving the efficiency of on-chip cache allocation and release, thereby improving on-chip cache utilization rate.
  • a first aspect provides a data stream transmission method, which is applied to a network card, the network card is coupled with an off-chip cache, the network card includes an on-chip cache, a first channel and a second channel, and the priority of the first channel is higher than that of the second channel.
  • the priority of the channel includes: receiving the first packet of the first data flow, and according to the first data flow
  • the service type determines that the first data flow is a non-congested flow or a congested flow, the first data flow may include multiple packets, the first packet is any one of the multiple packets, and the first packet may Including the first queue index used to indicate the first data stream; if the first data stream is a non-congested stream, for example, the first data stream is data for services that require relatively high latency, such as video calls, remote control, or automatic driving stream, store the first packet in the on-chip cache, and when triggering the scheduling instruction of the first data stream, read the first packet of the first data stream from the on-chip cache and output it through the first channel ; If the first data flow is a congested flow, for example, the first data flow is a data flow of services that are not sensitive to delay and packet loss, such
  • the network card when the network card receives the message of the first data flow, if the first data flow is a non-congested flow, the message of the first data flow is stored in the on-chip cache, and the first data flow is scheduled.
  • the data stream is read from the on-chip cache, it is output through the first channel with high priority. Since the read delay of the on-chip cache is small, it can ensure that both high-priority and low-priority data streams in non-congested streams can be quickly processed. To a certain extent, the efficiency of the allocation and release of the on-chip cache is improved, thereby improving the utilization of the on-chip cache.
  • the packets of the first data stream are stored in the off-chip cache, and are read from the off-chip cache when the first data stream is scheduled and passed through the second low-priority second stream.
  • the buffer requirements for congested flows can be guaranteed.
  • the network card determines that the first data flow is a non-congested flow or a congested flow according to a service type of the first data flow, including: if the service type of the first data flow is a delay requirement If the service type of the first data flow is less than the first delay, it is determined that the first data flow is a non-congested flow; if the service type of the first data flow is a service type whose delay requirement is greater than the second delay, it is determined that the first data flow is a congested flow. , the second delay is greater than the first delay.
  • the method may further include: the network card determines according to the port, user priority, and/or real-time corresponding to the first data stream.
  • the queue length determines whether the first data flow is a congested flow or a non-congested flow. For example, if the transmission rate of the port corresponding to the first data stream is high, the user priority is high, or the real-time queue is short, the network card can determine that the first data stream is a non-congested stream. If the rate is low, the user priority is low, or the real-time queue is long, the network card may determine that the first data flow is a congested flow.
  • the method further includes: when receiving the second packet of the first data flow, storing the second packet in the off-chip cache, and the second packet of the second packet is stored in the off-chip cache.
  • the sequence number is greater than the first sequence number of the first packet.
  • the first packet may be a packet before the first data flow is converted from a non-congested flow to a congested flow, and the second packet may be a first data flow from a non-congested flow.
  • a packet after the flow is converted into a congested flow and the sequence number of each packet can be used to indicate the position of the packet in the first data stream (also called the sending order); in the first data stream, the sequence number is less than After the packet of the second sequence number of the second packet is output through the first channel, that is, after all the packets of the first data stream received before the second packet are output, the second packet is read from the off-chip cache. The message is output through the second channel.
  • the received second packet of the first data flow can be stored in the off-chip cache to avoid the first data flow.
  • the packets of the data stream are accumulated in the on-chip cache, thereby improving the efficiency of the allocation and release of the on-chip cache to a certain extent; in addition, when scheduling the first data stream, the After the packet whose sequence number is smaller than the second sequence number is output, the second packet is read from the off-chip cache and output through the second channel, which can avoid the first data stream being converted from the non-congested stream to the congested stream.
  • the text is out of order.
  • the method further includes: when the first packet of the first data stream is input to the first channel, adding an input quantity of the packets of the first data stream in the first channel to One; when the first packet is output from the first channel, add one to the output number of the packets of the first data stream in the first channel; when the second packet is input to the second channel, carry the input number in the first channel In the control information of the two packets; wherein, when the output quantity is greater than or equal to the input quantity carried by the control information of the second packet, the packet whose sequence number is smaller than the second sequence number in the first data stream has passed the first channel output.
  • the network card outputs all the packets of the first data stream received before the second packet
  • the second packet is output through the second channel, thereby ensuring that the first data stream is sent from the first data stream.
  • the packet is out of order.
  • the method further includes: when a third packet of the first data flow is received, storing the third packet in the on-chip cache, where the third packet may be the third packet of the first data stream.
  • a packet after a data stream is converted from a congested stream to a non-congested stream the sequence number of each packet can be used to indicate the position of the packet in the first data stream (also called the sending order); if the second If the packets of the first data stream in the channel are not all output, the third packet is read from the on-chip buffer and output through the second channel; if all the packets of the first data stream in the second channel are output, the third packet is read from the The third message is read in the internal buffer and output through the first channel.
  • the received third packet of the first data flow is stored in the on-chip cache, which can guarantee the first data flow.
  • a small transmission delay can be obtained; in addition, when the first data flow is scheduled, according to whether all the packets of the first data flow in the second pass are output, the third packet is passed through the first data flow correspondingly.
  • the output of one channel or the second channel can avoid the problem of out-of-order packets when the first data flow is converted from the congested flow to the non-congested flow.
  • each packet of the first data stream in the second channel corresponds to one input and output information
  • the method further includes: when the first packet of the first data stream is input to the second channel When outputting from the channel or from the second channel, the input and output information of the first packet is recorded, and the input and output information is used to determine whether all the packets of the first data stream in the second channel are output.
  • the network card can determine whether all the packets of the first data stream in the second channel are output through the input and output information, so as to determine whether the third packet is output through the first channel or the second channel, and further This avoids the problem of out-of-order packets when the first data flow is converted from the congested flow to the non-congested flow.
  • the input and output information is the number of packets of the first data stream in the second channel, and the first packet of the first data stream is input to or from the second channel.
  • recording the input and output information of the first packet including: when the first packet of the first data stream is input to the second channel, adding one to the number of packets; When the second channel outputs, the number of packets is reduced by one; when the number of packets is 0, all the packets of the first data stream in the second channel have been output; when the number of packets is not 0, Not all packets of the first data stream in the second channel are output.
  • a simple and effective manner is provided for determining whether all the packets of the first data stream in the second channel are output.
  • the input and output information includes an input flag bit and a stream flag bit, and when the first packet of the first data stream is input to the second channel or output from the second channel, the first packet of the first data stream is recorded.
  • Input and output information of a packet including: when the first packet of the first data stream is input to the second channel, the input flag position corresponding to the first packet is valid, and the stream flag position is the stream of the first data stream identification; when the first message of the first data stream is output from the second channel, the input flag position corresponding to the first message is invalid; wherein, when the input and output information of the first data stream corresponds to the flow identification of all When the input flag bits are all invalid, all the messages of the first data stream in the second channel are output; when there are valid input flag bits in all input flag bits corresponding to the stream identifier of the first data stream in the input and output information, Not all packets of the first data stream in the second channel are output.
  • the network card includes a register group, each register in the register group is used to store the input and output information of a message, and the depth of the register group is related to the off-chip maximum read delay, The required bandwidth is related to the minimum packet length required to meet the required performance.
  • the method further includes: when the occupancy rate of the register group is greater than the first threshold, reducing the transmission amount of packets of the congested flow in the second channel; When the occupancy rate of the first channel is greater than the second threshold, the transmission amount of the packets of the non-congested flow in the first channel is reduced, and the second threshold is greater than the first threshold.
  • the method further includes: according to at least one of the occupancy rate of the on-chip cache, the occupancy rate of the off-chip cache, the occupancy rate of the first channel, or the occupancy rate of the second channel item that adjusts the throughput of congested streams and/or the throughput of non-congested streams.
  • the over-occupancy of the first channel and/or the second channel can be avoided as much as possible while ensuring that the non-congested flow has a lower delay, thereby avoiding the overloaded work of the network card.
  • a data stream transmission device is provided, the device is coupled to an off-chip cache, the device includes an on-chip cache, a first channel and a second channel, and the priority of the first channel is higher than the priority of the second channel (that is, when both the first channel and the second channel have data output, the network card preferentially serves the first channel), the device further includes: a receiving unit, configured to receive the first packet of the first data stream, the first data stream It may include multiple packets, the first packet is any one of the multiple packets, and the first packet may include a first queue index used to indicate the first data stream; the determining unit is used for determining according to the The service type of the first data flow or the queue length of the first data flow determines that the first data flow is a non-congested flow or a congested flow; the scheduling unit is configured to determine that the first data flow is a non-congested flow (for example, the first data flow is video call, remote control, or automatic driving and other services that require relatively high latency),
  • the writing unit is used to store the first packet in the on-chip cache if the first data flow is a non-congested flow, and if the first data flow is a congested flow, write the The first message is stored in the off-chip cache;
  • the scheduling unit is also used for triggering a scheduling instruction of the first data stream;
  • the reading unit is used for, if the first data stream is a non-congested stream, from the on-chip cache Read the first packet of the first data stream and output it through the first channel. If the first data stream is a congested stream, read the first packet of the first data stream from the off-chip buffer and output it through the second channel .
  • the scheduling unit is further configured to: if the service type of the first data flow is a service type whose delay requirement is less than the first delay, determine that the first data flow is a non-congested flow ; if the service type of the first data flow is a service type whose delay requirement is greater than the second delay, it is determined that the first data flow is a congested flow, and the second delay is greater than the first delay.
  • the scheduling unit is further configured to: according to the corresponding port, user priority, and/or real-time queue length of the first data flow It is determined whether the first data flow is a congested flow or a non-congested flow. For example, if the transmission rate of the port corresponding to the first data stream is relatively high, the user priority is relatively high, or the real-time queue is relatively short, the scheduling unit may determine that the first data stream is a non-congested stream. When the transmission rate is low, the user priority is low, or the real-time queue is long, the scheduling unit may determine that the first data flow is a congested flow.
  • the writing unit is further configured to store the second packet in the off-chip cache when the receiving unit receives the second packet of the first data stream, and the first The second sequence number of the second packet is greater than the first sequence number of the first packet.
  • the first packet may be a packet before the first data flow is converted from a non-congested flow to a congested flow, and the second packet may be the first packet.
  • the apparatus further includes: a first counter, configured to, when the first packet of the first data stream is input to the first channel, count the value of the first data stream in the first channel The input quantity of the message is increased by one; the second counter is used to increase the output quantity of the message of the first data stream in the first channel by one when the first message is output from the first channel; when the second message is input When the second channel is used, the input quantity is carried in the control information of the second packet; wherein, when the output quantity is greater than or equal to the input quantity carried in the control information of the second packet, the sequence number in the first data stream A packet smaller than the second sequence number has been output through the first channel.
  • a first counter configured to, when the first packet of the first data stream is input to the first channel, count the value of the first data stream in the first channel The input quantity of the message is increased by one
  • the second counter is used to increase the output quantity of the message of the first data stream in the first channel by one when the first message is output from the first channel; when the second message is input
  • the writing unit is further configured to, when the receiving unit receives the first data stream of the first data stream When there are three packets, the third packet is stored in the on-chip cache, and the third packet is a packet after the first data stream is converted from a congested stream to a non-congested stream; the reading unit is also used if the If the packets of the first data stream in the second channel are not all output, the third packet is read from the on-chip buffer and output through the second channel; the reading unit is also used if the first data in the second channel All the packets of the flow are output, and the third packet is read from the on-chip buffer and output through the first channel.
  • each packet of the first data stream in the second channel corresponds to one input and output information
  • the reading unit is further configured to: when the first packet of the first data stream When input to or output from the second channel, the input and output information of the first packet is recorded, and the input and output information is used to determine whether all the packets of the first data stream in the second channel are output.
  • the input and output information is the number of packets of the first data stream in the second channel
  • the reading unit is further configured to: when the first packet of the first data stream is input When the second channel is used, the number of packets is increased by one; when the first packet of the first data stream is output from the second channel, the number of packets is reduced by one; when the number of packets is 0, the number of packets is 0. All the packets of the first data stream in the second channel have been output; when the number of the packets is not 0, the packets of the first data stream in the second channel have not been all output.
  • the input and output information includes an input flag bit and a stream flag bit
  • the reading unit is further configured to: when the first packet of the first data stream is input to the second channel, The position of the input flag corresponding to the first packet is valid, and the position of the stream identifier is the stream identifier of the first data stream; when the first packet of the first data stream is output from the second channel, the corresponding value of the first packet is set.
  • the input flag position is invalid; wherein, when all the input flag bits corresponding to the stream identifier of the first data stream in the input and output information are invalid, all the messages of the first data stream in the second channel are output; when the input and output information When there are valid input flag bits in all input flag bits corresponding to the flow identifier of the first data stream in the information, not all packets of the first data stream in the second channel are output.
  • the device includes a register group, each register in the register group is used to store input and output information of a message, and the depth of the register group is related to the off-chip maximum read delay,
  • the required bandwidth is related to the minimum packet length required to meet the required performance.
  • the scheduling unit is further configured to: when the occupancy rate of the register group is greater than the first threshold, reduce the transmission amount of the congested flow; when the occupancy rate of the register group is greater than the first threshold When the second threshold is used, the transmission amount of the non-congested flow is reduced, and the second threshold is greater than the first threshold.
  • the scheduling unit is further configured to: according to the occupancy rate of the on-chip cache, the occupancy rate of the off-chip cache, the occupancy rate of the first channel, or the occupancy rate of the second channel At least one item adjusts the throughput of congested flows and/or the throughput of non-congested flows.
  • a chip is also provided.
  • the chip includes the data stream transmission device provided by the second aspect or any possible implementation manner of the second aspect.
  • the chip is a network card.
  • a network device in yet another aspect of the present application, includes a network card and a processor, the processor can be configured to send a data stream to the network card, and the network card includes the second aspect or any of the second aspects. Possible implementations of the provided data streaming device.
  • the network device may be a terminal device, a router, a switch, or the like in an access network, a metropolitan area network, a backbone network, or a local area network.
  • a computer-readable storage medium where instructions are stored in the computer-readable storage medium, and when the instructions are executed on a device, the device causes the device to perform the above first aspect or the first aspect.
  • a data streaming method provided by any possible implementation.
  • a computer program product which, when the computer program product runs on a device, enables the device to execute the data provided by the first aspect or any possible implementation manner of the first aspect Streaming method.
  • any data stream transmission device, chip, network device, computer storage medium or computer program product provided above are all used to execute the data stream transmission method provided above, and therefore, the beneficial effects that can be achieved.
  • the beneficial effects in the data stream transmission method provided above can be referred to, and details are not repeated here.
  • FIG. 1 is a schematic structural diagram of a network device according to an embodiment of the present application.
  • FIG. 2 is a schematic structural diagram of a network card according to an embodiment of the present application.
  • FIG. 3 is a schematic flowchart of a data stream transmission method according to an embodiment of the present application.
  • FIG. 4 is a schematic flowchart of another data stream transmission method provided by an embodiment of the present application.
  • FIG. 5 is a schematic flowchart of another data stream transmission method provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of a register group provided by an embodiment of the present application.
  • FIG. 7 is a schematic flowchart of a data stream transmission apparatus provided by an embodiment of the present application.
  • FIG. 8 is a schematic flowchart of another data stream transmission apparatus provided by an embodiment of the present application.
  • At least one means one or more
  • plural means two or more.
  • And/or which describes the association relationship of the associated objects, indicates that there can be three kinds of relationships, for example, A and/or B, which can indicate: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A, B can be singular or plural.
  • the character “/” generally indicates that the associated objects are an “or” relationship.
  • At least one item(s) below” or similar expressions thereof refer to any combination of these items, including any combination of single item(s) or plural items(s).
  • At least one (a) of a, b, or c can represent: a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, c may be single or multiple .
  • words such as “first” and “second” are used to distinguish the same items or similar items with substantially the same functions and functions.
  • the first threshold and the second threshold are only used to distinguish different thresholds, and the sequence of the first threshold is not limited. Those skilled in the art can understand that words such as “first” and “second” do not limit the quantity and execution order.
  • the high and low priorities of the data streams may be divided according to the priorities of the services corresponding to the data streams.
  • High-priority services usually refer to services that have higher requirements on bandwidth and delay.
  • the services can include voice calls, video calls, remote control, and automatic driving.
  • a low-priority service usually refers to a service that is not sensitive to delay and packet loss.
  • the low-priority service may include web browsing and file downloading.
  • non-congested flow and the congested flow can be divided according to the status of ports, users, queue scheduling priority, real-time queue length and buffer occupancy status.
  • non-congested flows may include high-priority data flows and some low-priority data flows with smaller data volumes, and congested flows may include some low-priority data flows with larger data volumes;
  • the non-congested flow and the congested flow will also be converted.
  • the non-congested flow can be converted into a congested flow
  • the congested flow can also be converted into a non-congested flow. The two are not fixed.
  • the low-priority data flow can be It is considered to be a non-congested flow; in addition, in most application scenarios, the high-priority data flow will not exceed the maximum processing bandwidth of the port, so the high-priority data flow is basically a non-congested flow.
  • the on-chip cache can also be called the local buffer, which refers to the cache integrated inside the network card.
  • the space of the on-chip cache is small, but the read delay is small, which can be used for fast forwarding of non-congested flows in this application. In the case of fast forwarding, the cache space can be quickly released, and the utilization rate of the cache space can be improved.
  • Off-chip cache refers to the cache located outside the network card chip, that is, independent of the network card.
  • the off-chip cache has a large space, but the read delay is large, and the access bandwidth supported by different off-chip caches may vary. It is usually used after queue congestion accumulates, or for services that require the length of the cache. .
  • FIG. 1 is a schematic structural diagram of a network device provided by an embodiment of the application.
  • the network device may be a terminal device, a router, or a switch in an access network, a metropolitan area network, a backbone network, or a local area network.
  • the foregoing devices are collectively referred to as network devices in the embodiments of the present application.
  • the network device may include a processor 101 , a memory 102 , a network card 103 and a bus 104 , and the processor 101 , the memory 102 and the network card 103 are coupled through the bus 104 .
  • the processor 101 executes various functions of the network device by running or executing software programs and/or modules stored in the memory 102 and calling data stored in the memory 102 .
  • the processor 101 may include one or more modules, for example, the processor 101 may include a central processing unit (CPU), and processing such as a network processor (NP), a digital signal processor, an artificial intelligence other types of general-purpose processors such as microcontrollers, microcontrollers, or microprocessors. Further, the processor 101 may also include other hardware circuits or accelerators, such as an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, transistors Logic devices, hardware components, or any combination thereof, etc.
  • ASIC application specific integrated circuit
  • FPGA field programmable gate array
  • Memory 102 may be used to store data, software programs, and modules, and may be implemented by any type of volatile or non-volatile memory or combinations thereof.
  • the memory 102 may include random access memory (RAM), double data rate (DDR) synchronous dynamic or synchronous static RAM, non-volatile random access memory (non-volatile random access memory) , NVRAM), Electrically Erasable Programmable Read-Only Memory, Erasable Programmable Read-Only Memory, Programmable Read-Only Memory, Read-Only Memory, High Band Memory (HBM), Magnetic Memory, Flash Memory , disk or CD, etc.
  • the multiple memories or modules included in the memory 102 may all be integrated together, or may be partially integrated together.
  • the memory 102 includes DDR and HBM, the DDR can be integrated in the chip of the memory 102, and the HBM can be packaged together with the network card 103 as an independent chip.
  • the network card 103 can be a network interface card (NIC), and the network device can send a data stream through the network card 103, and can also receive a data stream through the network card 103.
  • the bus 104 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus or the like.
  • PCI peripheral component interconnect
  • EISA extended industry standard architecture
  • the bus 104 can be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, only one thick line is used in FIG. 1, but it does not mean that there is only one bus or one type of bus.
  • the network card 103 may include a packet write controller (packet write controller, PWC), a scheduler (scheduler, SCH), a packet read controller (packet read controller, PRC), an on-chip cache .
  • the SCH can be used to distinguish non-congested (NC) flows and congested (congested, CG) flows in the input data flow, for example, according to ports, users, real-time queue length and queue scheduling priority, and buffer occupancy status, etc.
  • the PWC can be used to write the input data stream into the off-chip buffer or on-chip buffer according to the scheduling of the SCH.
  • the off-chip buffer (eg, DDR or HBM) is coupled to the network card 103.
  • the PWC can write the non-congested stream to Enter the on-chip cache and write the congested stream to the off-chip cache.
  • the PRC may include a first channel CH1 and a second channel CH2, the priority of CH1 may be higher than that of CH2, and the PWC may be used to select the off-chip buffer and the on-chip buffer according to the SCH scheduling according to the first-in, first-out ( First in first out, FIFO) reads the data stream sequentially, and outputs the data stream through CH1 and CH2.
  • the CG-FIFO in Figure 2 can represent the storage pointer of the congested stream in the cache
  • the NC-FIFO can represent the non-congested stream in the buffer.
  • the storage pointers in the buffer, the CG-FIFO and the NC-FIFO can be specifically sent to the PRC by the SCH.
  • the network device shown in FIG. 1 and the network card shown in FIG. 2 do not constitute limitations on the structure of the network device and the network card. In practical applications, the network device and the network card may also include more or less components than shown, or combine some components, or arrange different components.
  • FIG. 3 is a schematic flowchart of a data stream transmission method provided by an embodiment of the present application, the method can be applied to a network card, the network card is coupled to an off-chip cache, and the network card includes an on-chip cache, a first channel and a second channel, The priority of the first channel is higher than the priority of the second channel.
  • the method includes the following steps.
  • S301 Receive a first packet of a first data flow, and determine, according to a service type of the first data flow, that the first data flow is a non-congested flow or a congested flow.
  • the first data stream may refer to what is sent to the network card by a processor in the network device where the network card is located.
  • the processor can send the one or more data streams to the network card, so that the network card can send the one or more data streams to
  • the first data stream may be any one of the one or more data streams.
  • the first data stream may include multiple packets (also referred to as data packets), and the first packet may be any one of the multiple packets.
  • Each of the multiple packets of the first data stream may include a stream flag bit, and the stream flag bit may be used to indicate the first data stream, that is, the stream flag bit in each packet of the first data stream is available to indicate that the message is a message of the first data stream.
  • the first data stream can be identified by the first queue index (queue index, QID).
  • the flow flag bit in each packet of the flow may be the first QID.
  • the network card may receive one or more packets of the first data stream, and the first packet may be the one or more packets. any message in the text.
  • the network card can determine whether the first data stream is a congested stream or a non-congested stream according to the service type of the first data stream, and the specific step of determining whether the first data stream is a congested stream or a non-congested stream can be performed by the network card shown in FIG. 2 .
  • the scheduler SCH to execute.
  • the scheduler SCH may determine that the first data stream is a non-congested stream; when the first data stream is a non-congested stream
  • the scheduler SCH may determine that the first data flow is a congested flow. Wherein, if it is determined that the first data stream is a non-congested stream, the following steps S302a-S303a are performed; if it is determined that the first data stream is a congested stream, the following steps S302b-S303b are performed.
  • the network card determining that the first data flow is a non-congested flow or a congested flow according to the service type of the first data flow may include: if the service type of the first data flow is a service type with a delay requirement less than the first delay, then Determine that the first data flow is a non-congested flow; if the service type of the first data flow is a service type with a delay requirement greater than the second delay, then determine that the first data flow is a congested flow, and the second delay is greater than the first delay .
  • the method may further include: the network card determines according to the port, user priority, and/or real-time corresponding to the first data stream.
  • the queue length determines whether the first data flow is a congested flow or a non-congested flow. For example, if the transmission rate of the port corresponding to the first data stream is high, the user priority is high, or the real-time queue is short, the network card can determine that the first data stream is a non-congested stream. If the rate is low, the user priority is low, or the real-time queue is long, the network card may determine that the first data flow is a congested flow.
  • S302a If the first data flow is a non-congested flow, store the first packet in the on-chip cache.
  • the scheduler SCH in the network card determines that the first data stream is a non-congested stream
  • the scheduler SCH can send first indication information to the packet writing controller PWC in the network card, and the first indication information can be used for Indicating that the first data flow is a non-congested flow can also be used to indicate a cache address corresponding to the first packet.
  • the message writing controller PWC receives the first indication information, it can store the first message in the on-chip cache according to the cache address.
  • the network card receives other messages of the first data stream
  • the network card can also store the other messages in the on-chip cache according to the above method. That is, when the first data flow is a non-congested flow, the network card can store the received packets of the first data flow in the on-chip cache.
  • S303a When the scheduling instruction of the first data stream is triggered, read the first packet of the first data stream from the on-chip buffer and output it through the first channel.
  • the scheduling instruction of the first data stream can be triggered by the scheduler SCH in the network card and sent to the message reading controller PRC in the network card, and the scheduling instruction can be used to schedule the message reading controller PRC to read
  • the scheduling instruction of the first data stream may carry the storage address or storage pointer of the first data stream in the on-chip cache.
  • the message reading controller PRC can be based on the scheduling instruction Read the message of the first data stream (including the first message) from the on-chip cache. If the on-chip cache includes multiple messages of the first data stream, the message read controller PRC can read the message according to the first-in The multiple packets are sequentially read in the order of the first-out FIFO, and stored in the first channel, so as to output the multiple packets through the first channel.
  • the priority of the first channel is higher than the priority of the second channel, so that the network card can serve the first channel preferentially when the network is congested, so as to ensure that the packets of the non-congested flow can be quickly output through the first channel, so that the non-congested flow can be quickly output. Congested flow gets extremely low latency.
  • the scheduler SCH in the network card determines that the first data stream is a congested stream
  • the scheduler SCH can send second indication information to the packet writing controller PWC in the network card
  • the second indication information can be used for Indicating that the first data flow is a congested flow may also be used to indicate a cache address corresponding to the first packet.
  • the message writing controller PWC receives the second indication information, it can store the second message in the off-chip cache according to the cache address.
  • the network card may also store the other packets in the off-chip cache according to the above method. That is, when the first data flow is a congested flow, the network card can store the received packets of the first data flow in the off-chip cache.
  • the scheduling instruction of the first data stream can be triggered by the scheduler SCH in the network card and sent to the message reading controller PRC in the network card, and the scheduling instruction can be used to schedule the message reading controller PRC to read
  • the scheduling instruction of the first data stream may carry the storage address or storage pointer of the first data stream in the off-chip cache.
  • the message reading controller PRC can be based on the scheduling instruction Read the message of the first data stream (including the first message) from the off-chip cache; if the off-chip cache includes multiple messages of the first data stream, the message reading controller PRC can read the message according to the first-in
  • the multiple packets are sequentially read in a first-out FIFO order to be stored in the second channel, and the multiple packets are output through the second channel.
  • the priority of the second channel is lower than the priority of the first channel, so that the network card can serve the first channel preferentially when the network is congested, so as to ensure that the high-low priority and low-priority data flows in the non-congested flow can be quickly output, so that the non-congested flow obtains extremely low latency, which in turn improves the utilization of the on-chip cache to a certain extent.
  • the method may also include S304a, and S304a and S303a may be in no particular order.
  • S304a is located after S303a as example to illustrate.
  • S304a When receiving the second packet of the first data stream, store the second packet in the off-chip cache.
  • the network card can store the packet of the congested flow in the off-chip cache according to the principle, Store the second message in the off-chip cache.
  • the scheduler SCH in the network card may send second indication information to the packet writing controller PWC, and the second indication information may be used to indicate the first data stream It is a congested flow, and can also be used to indicate the cache address corresponding to the second packet, so that when the packet writing controller PWC receives the second indication information, it can store the second packet in the off-chip cache according to the cache address.
  • the network card can also store the other packets in the chip according to the method corresponding to the second packet. in the external cache.
  • the method may further include S305a.
  • S305a After the packet with the sequence number smaller than the second sequence number in the first data stream is output through the first channel, read the second packet from the off-chip cache and output through the second channel.
  • the first packet may be a packet before the first data flow is converted from a non-congested flow to a congested flow
  • the second packet may be a packet after the first data flow is converted from a non-congested flow to a congested flow.
  • the first sequence number may be used to indicate the position of the first packet in the first data stream (may also be referred to as a sending order)
  • the second sequence number may be used to indicate the position of the second packet in the first data stream.
  • the position of the second packet in the first data stream is located after the first packet, that is, the second sequence number is greater than the first sequence number.
  • serial number of each packet can be carried in the packet, and when the network card receives each packet, the serial number of the packet can be obtained from each packet. For example, when the network card receives the first packet of the first data stream, it can obtain the first sequence number from the first packet; when receiving the second packet, it can obtain the second sequence number from the second packet. serial number.
  • the storage location of the packets of the first data flow received by the network card is also correspondingly switched from the on-chip cache to the off-chip cache, and the on-chip cache is stored in the on-chip cache.
  • the sequence number of the packet of the first data stream is smaller than the sequence number of the packet of the first data stream in the off-chip cache.
  • the network card can output all the packets of the first data stream received before the second packet after outputting the packets in the first data stream whose sequence number is smaller than the second sequence number through the first channel.
  • the second packet is read from the off-chip buffer and output through the second channel.
  • the network card when the first data stream is a non-congested stream, stores the received packets of the first data stream packet.1 and packet.2 in the on-chip cache, and when the first data stream is converted from the non-congested stream When the flow is congested, the network card stores the received packet packet.3 of the first data flow in the off-chip cache.
  • the network card can schedule the output of the first data stream in the first After the two packets, packet.1 and packet.2, whose sequence numbers are smaller than NO.3 in the data stream, are output through the first channel, packet.3 is read from the off-chip cache to be output through the second channel.
  • the network card may determine whether the packets with the sequence number smaller than the second sequence number in the first data stream have passed through the first channel by recording the input quantity and output quantity of the packets of the first data stream respectively.
  • Channel output that is, to determine whether all the packets of the first data stream in the first channel have been output. Specifically, taking the first packet of the first data stream as an example, when the first packet of the first data stream is input to the first channel, the number of input packets of the first data stream in the first channel is increased by one; When the first packet is output from the first channel, the output quantity of the packets of the first data stream in the first channel is increased by one.
  • the network card may include two counters, the two counters may be a first counter and a second counter, the first counter may be used to record the number of packets of the first data stream input in the first channel, the Two counters may be used to record the number of packets of the first data stream output from the first channel, and the two counters may be located in the packet reading controller PRC of the network card.
  • the network card when the first data stream is converted from a non-congested stream to a congested stream, and the network card receives a second packet converted to a congested stream (for example, the second packet is a packet after the first data stream is converted to a congested stream) packet), when the network card inputs the second packet into the second channel, it can carry the input quantity of the packets of the first data stream corresponding to the current first channel in the control information of the second packet (also referred to as the control information of the second packet). In the associated control information), the number of inputs carried by the control information of the second message can be used to represent the number of messages corresponding to the first data stream input to the first channel before the second message.
  • the network card before outputting the second packet through the second channel, the network card can determine that the sequence number in the first data stream is smaller than the second sequence number according to the number of inputs carried in the control information of the second packet and the number of outputs corresponding to the current first channel Whether the packets with the number of the packets have been output through the first channel; if the output quantity is greater than or equal to the input quantity carried by the control information of the second packet, it is determined that the packets with the sequence number smaller than the second sequence number in the first data stream have been Output through the first channel; if the output quantity is less than the input quantity carried by the control information of the second packet, then the packets whose sequence number is smaller than the second sequence number in the first data stream are not all output through the first channel.
  • the network card may continue to output the packets of the first data stream through the first channel until the output quantity is greater than or equal to the input quantity carried by the control information of the second packet.
  • the first counter when the count of the first counter satisfies the first value (for example, 8K), the count of the first counter and the count of the second counter may be simultaneously subtracted by the second value (for example, 2K). ) to avoid the problem of out-of-order packets due to counter overflow.
  • the first numerical value and the second numerical value may be set in advance, which are not specifically limited in this embodiment of the present application.
  • the method may further include S304b, and S304b and S303b may be in no particular order.
  • S304b is located after S303b as example to illustrate.
  • S304b When the third packet of the first data stream is received, store the third packet in the on-chip cache.
  • the first packet may be a packet before the first data flow is converted from a congested flow to a non-congested flow
  • the third packet may be a packet after the first data flow is converted from a congested flow to a non-congested flow.
  • the first sequence number may be used to indicate the position of the first packet in the first data stream (it may also be referred to as a sending order), and the third sequence number may be used to indicate the position of the third packet in the first data stream.
  • the third sequence number greater than the first sequence number may be used to indicate that the position of the third packet in the first data stream is located after the first packet.
  • serial number of each packet can be carried in the packet, and when the network card receives each packet, the serial number of the packet can be obtained from each packet. For example, when the network card receives the first packet of the first data stream, it can obtain the first sequence number from the first packet; when receiving the third packet, it can obtain the second sequence number from the third packet. serial number.
  • the network card can store the packets of the non-congested flow in the on-chip cache according to the principle of , and store the third message in the on-chip cache.
  • the scheduler SCH in the network card may send third indication information to the packet writing controller PWC, and the third indication information may be used to indicate the first data stream It is a non-congested flow, and can also be used to indicate the cache address corresponding to the third packet, so that when the packet writing controller PWC receives the third indication information, it can store the third packet in the on-chip cache according to the cache address. middle. Further, after the network card is converted into a congested stream, if the network card also receives other packets of the first data stream, the network card can also store the other packets in the chip according to the method corresponding to the third packet. in the internal cache.
  • the method may further include S305b or S305c.
  • S305b If the packets of the first data stream in the second channel are not all output, read the third packet from the on-chip buffer and output through the second channel.
  • S305c If all the packets of the first data stream in the second channel are output, read the third packet from the on-chip buffer and output through the first channel.
  • the storage location of the packets of the first data flow received by the network card is also correspondingly switched from the off-chip cache to the on-chip cache, and the No.
  • the sequence number of the packet of one data stream is greater than the sequence number of the packet of the first data stream in the on-chip cache.
  • the network card can determine whether all the packets of the first data stream in the second channel have been output; Channel output; if not all output, read the third packet from the on-chip buffer and output through the second channel, the read third packet is located in other packets of the first data stream in the second channel (that is, from the chip After the message of the first data stream read in the internal data stream, such as the first message), according to the order of first-in, first-out, after the other messages are output, the third message can be output through the second channel, so as to ensure Packets with the first data stream are not out of sequence when output.
  • the network card when the first data flow is a congested flow, stores the received packets packet.1 and packet.2 of the first data flow in the off-chip cache.
  • the network card stores the received packet packet.3 of the first data flow in the on-chip cache. If the serial numbers corresponding to packet.1 and packet.2 are NO.1 and NO.2 respectively, and the serial number corresponding to packet.3 is NO.3, the network card can determine the first data stream when scheduling the output of the first data stream.
  • the messages of the first data stream in the second channel may correspond to input and output information
  • the network card may determine the first data in the second channel by recording the input and output information of the messages of the first data stream in the second channel. Whether all the packets of the flow have been output, that is, it is determined whether all the packets of the first data flow received before the third packet in the second channel have been output.
  • the input and output information may be the number of packets of the first data stream in the second channel.
  • the process of recording the number of packets may be as follows : When the first packet of the first data stream is input to the second channel, add one to the number of packets of the first data stream in the second channel; when the first packet is output from the second channel, add the number of packets to the second channel minus one.
  • the network card may include a third counter, and the third counter may be used to record the number of packets of the first data flow in the second channel. For example, the third counter may be incremented by one when the first packet enters the second channel.
  • the third counter when the first message is output from the second channel, the third counter can be located in the message reading controller PRC of the network card; in addition, the recorded number of messages can be stored in the memory included in the network card,
  • the memory may be a 2R2W memory, and after the third calculator increases or decreases the number of packets by one each time, the network card may update the memory according to the number corresponding to the third calculator.
  • the network card before outputting the third packet, can read and judge the number of packets stored in the memory; if the number of packets is not 0, it means that the packets of the first data stream in the second channel are not All output, at this time, the third packet is read from the on-chip cache and output through the second channel; if the number of packets is 0, it means that all the packets of the first data stream in the second channel have been output.
  • the third message is read from the on-chip cache and output through the first channel.
  • the above solution of recording the number of packets may be applicable to scenarios where the number of data streams of the system specification is small and only one packet is required to be processed in one clock cycle in terms of processing performance.
  • the number of packets corresponding to multiple data streams can also be mapped to the memory of the memory through a hash algorithm. stored in the same entry.
  • the input and output information may include an input flag bit and a flow flag bit.
  • the process of recording the input and output information of the first packet may be as follows : When the first message is input to the second channel, the input flag position corresponding to the first message is set to be valid, and the flow ID position is the flow ID of the first data stream; when the first message is output from the second channel, the The input flag position corresponding to the first packet is invalid.
  • the network card may include a register group. As shown in FIG. 6 , the structure of the register group may be expressed as depth* ⁇ VLD, QID ⁇ , that is, each register in the register group may include an input flag bit VLD.
  • enq-addr represents the enqueue pointer
  • deq-addr represents the dequeue pointer
  • the VLD in the register is set to 1 (for example, it is valid when set to 1, invalid when set to 0), and QID is set to QID1, and then the enq-addr of the enqueue pointer can be increased by one; if the first message corresponds to the dequeue If the pointer deq-addr is at position 2, when the first message is output from the second channel, the VLD in the register at position 2 can be set to 0 (for example, it is valid when set to 1, invalid when set to 0), and also The QID can be set to 0 (optional), after which the deque-addr can be incremented by one.
  • the network card can judge whether all the packets of the first data stream in the second channel have been output through the input information stored in the register group; When all the input flag bits corresponding to the stream identifier of the first data stream in the input and output information) are invalid, it is determined that all the messages of the first data stream in the second channel are output; if the first data stream in the input and output information is invalid When there is a valid input flag bit in all the input flag bits corresponding to the stream identifier of , it is determined that the packets of the first data stream in the second channel are not all output. It should be noted that the enqueue pointer enq-addr and the dequeue pointer deq-addr can be incremented from 0 until the depth of the register group is incremented, and then the cycle starts from 0 again.
  • the number of registers included in the register group may be larger, for example The number can reach hundreds of thousands or even millions, or it can be set to meet the off-chip read delay of the network card according to the total number of packets that need to be stored in the second channel under the condition that the processing performance requirements of the network card are met.
  • the required maximum depth of the register group is calculated according to different performance specification requirements and the maximum delay of the used off-chip cache.
  • the depth of the register group is related to the maximum off-chip read delay (ie the maximum read delay of the off-chip cache) ⁇ , the bandwidth W required by the specification, and the minimum packet length L required by the specification when meeting the performance requirement.
  • depth ⁇ W/L. If ⁇ is 4us and the specification requires 165 bytes (byte, B) or more to reach 500Gbps as an example, then when W is 500Gbps and L is 165B ⁇ 8bits, depth is equal to 1515 .
  • a control mechanism can be added to control the occupancy of register bank or memory in real time.
  • the control plane For example, the scheduler SCH
  • the network card acts as a back pressure to avoid further occupation of the register set or memory.
  • the control mechanism may include: when the occupancy rate of the register group is greater than the first threshold, reducing the transmission amount of the packets of the congested flow in the second channel, for example, the network card in the The scheduler SCH can reduce the scheduling of the congested flow to reduce the flow of the congested flow read from the off-chip cache by the packet read controller PRC in the network card, thereby reducing the transmission volume of the congested flow in the second channel. .
  • the occupancy rate of the register group is greater than the second threshold, reduce the transmission volume of the packets of the non-congested flow in the first channel.
  • the scheduler SCH in the network card can reduce the scheduling of the non-congested flow to reduce the
  • the packet reading controller PRC in the network card reads the traffic of the non-congested flow from the on-chip cache, thereby reducing the transmission volume of the non-congested flow in the first channel, and the second threshold is greater than the first threshold.
  • the network card can also be based on the occupancy rate of the on-chip cache, the occupancy rate of the off-chip cache, the occupancy rate of the first channel, the occupancy rate of the second channel, the NC-FIFO corresponding to the first channel, and/or the occupancy rate of the second channel.
  • the CG-FIFO corresponding to the channel reduces the transmission amount of the congested flow or the non-congested flow through different thresholds, so as to realize the transmission control of the congested flow and the non-congested flow.
  • the normal transmission of non-congested streams can be ensured by controlling the transmission of congested streams in the case of continuous congestion or small off-chip buffers or insufficient performance, so that non-congested streams can continue to obtain low latency, thereby improving user performance. experience.
  • the network card when the network card receives the message of the first data flow, if the first data flow is a non-congested flow, the message of the first data flow is stored in the on-chip cache, and is scheduled in the scheduling When the first data stream is read from the on-chip cache, it is output through the high-priority first channel. Since the read delay of the on-chip cache is small, it can ensure that both high-priority and low-priority data streams in non-congested streams can be It is quickly output, thereby improving the allocation and release efficiency of the on-chip cache to a certain extent, thereby improving the utilization of the on-chip cache.
  • the packets of the first data stream are stored in the off-chip cache, and are read from the off-chip cache when the first data stream is scheduled and passed through the second low-priority second stream.
  • the buffer requirements for congested flows can be guaranteed.
  • orderly transmission of multiple packets of the same data stream can also be implemented through a certain order-preserving logic. Improve user experience.
  • the network card includes corresponding hardware structures and/or software modules for executing each function.
  • the present application can be implemented in hardware or a combination of hardware and computer software with reference to the network elements and algorithm steps of each example described in the embodiments disclosed herein. Whether a function is performed by hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of this application.
  • the network card may be divided into functional modules according to the foregoing method examples.
  • each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module.
  • the above-mentioned integrated modules can be implemented in the form of hardware, and can also be implemented in the form of software function modules. It should be noted that, the division of modules in the embodiments of the present application is schematic, and is only a logical function division, and there may be other division manners in actual implementation.
  • FIG. 7 shows a possible schematic structural diagram of the data stream transmission device involved in the above embodiment
  • the device may be a network card, and the device includes: a receiving unit 401 , scheduling unit 402 , writing unit 403 and reading unit 404 .
  • the receiving unit 401 is configured to perform S301 in the above method embodiments, the step of receiving the second packet and/or the third packet of the first data stream, etc.;
  • the scheduling unit 402 is configured to perform the above method embodiments determining the first The data flow is a non-congested flow or a congested flow, and the step of triggering the scheduling instruction of the first data flow;
  • the writing unit 403 is configured to execute one or more steps in S302a, S302b, S304a or S304b in the above method embodiments;
  • the reading unit 404 is configured to perform one or more steps of S303a, S303b, S305a, S305b or S305c in the above method embodiments.
  • the corresponding relationship between the functional structure shown in the device and each unit of the network card shown in FIG. 2 may be: the receiving unit 401 and the writing unit 403 may correspond to the message writing controller PWC in FIG.
  • the unit 402 may correspond to the scheduler SCH in FIG. 2
  • the reading unit 404 may correspond to the message reading controller PRC in FIG. 2 .
  • the above-mentioned scheduling unit 402, writing unit 403 and reading unit 404 may be processors, the receiving unit 401 may be a receiver, and the receiver and the transmitter may generally constitute a transceiver, which may be called communication interface.
  • the device may be a network card, and the device includes: a processor 412, a communication interface 413, a memory 411 and bus 414.
  • the processor 412 , the communication interface 413 , and the memory 411 are connected to each other through a bus 414 .
  • the processor 412 is configured to control and manage the actions of the device.
  • the processor 412 is configured to execute S302a-S305a, S302b-S305c in the above method embodiments, and/or used in the methods described herein. Other procedures of the described technique.
  • the communication interface 413 is used to support the device to communicate, for example, to support the device to receive the first message, the second message and/or the third message, and the like.
  • the memory 411 is used to store the program codes and data of the device. For example, the memory 411 may be used to store the packets of the data stream received by the network card.
  • the processor 412 may be a microprocessor, an application specific integrated circuit, a field programmable gate array or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute the various exemplary logical blocks, modules and circuits described in connection with this disclosure.
  • the processor may also be a combination that performs computing functions, such as a combination comprising one or more microprocessors, a combination of a digital signal processor and a microprocessor, and the like.
  • the bus 414 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus or the like.
  • the network card when the network card receives the message of the first data flow, if the first data flow is a non-congested flow, the message of the first data flow is stored in the on-chip cache, and is scheduled in the scheduling When the first data stream is read from the on-chip cache, it is output through the high-priority first channel. Since the read delay of the on-chip cache is small, it can ensure that both high-priority and low-priority data streams in non-congested streams can be It is quickly output, thereby improving the allocation and release efficiency of the on-chip cache to a certain extent, thereby improving the utilization of the on-chip cache.
  • the packets of the first data stream are stored in the off-chip cache, and are read from the off-chip cache when the first data stream is scheduled and passed through the second low-priority second stream.
  • the buffer requirements for congested flows can be guaranteed.
  • a chip is also provided, and the chip is used for executing the data stream transmission method provided herein.
  • the chip may be the network card shown in FIG. 2 , or the chip may include the data stream transmission device shown in FIG. 7 or FIG. 8 .
  • a network device is also provided, and the structure of the network device may be as shown in FIG. 1 , that is, the network device may include a processor 101 and a network card 103; wherein, the processor 101 may be used to The network card 103 sends the data stream, and the network card 103 can be any of the network cards or data stream transmission devices provided above, and is used to execute the data stream transmission method provided herein.
  • the network device may further include a memory 102 .
  • a computer-readable storage medium is also provided, and instructions are stored in the computer-readable storage medium, and when at least one processor of a device executes the instructions, the device causes the device to execute the instructions provided herein. data streaming method.
  • a computer program product in another embodiment, includes computer-executable instructions, and the computer-executable instructions are stored in a computer-readable storage medium; at least one processor of the device can be obtained from a computer-readable storage medium. Reading the storage medium reads the computer-executable instructions, which are executed by at least one processor to cause a device to implement the data streaming methods provided herein.

Landscapes

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

Abstract

The present application relates to the technical field of communications, and provides a data stream transmission method and apparatus, and a network device, which are used for reducing the time delay of low-priority data streams among non-congested streams, and improving the allocation and release efficiency of an on-chip cache. The method comprises: receiving a first packet of a first data stream, and determining, according to the service type of the first data stream, whether the first data stream is a non-congested stream or a congested stream; if the first data stream is a non-congested stream, storing the first packet in an on-chip cache, and when a scheduling instruction for the first data stream is triggered, reading the first packet of the first data stream from the on-chip cache and outputting same through a first channel; and if the first data stream is a congested stream, storing the first packet in an off-chip cache, and when a scheduling instruction for the first data stream is triggered, reading the first packet of the first data stream from the off-chip cache and outputting same through a second channel, the priority of the first channel being higher than that of the second channel.

Description

一种数据流传输方法、装置及网络设备A data stream transmission method, device and network equipment 技术领域technical field
本申请涉及通信技术领域,尤其涉及一种数据流传输方法、装置及网络设备。The present application relates to the field of communication technologies, and in particular, to a data stream transmission method, apparatus, and network device.
背景技术Background technique
随着网络的快速发展,网络设备支持的带宽处理能力、端口数和用户数等迅速增长,网络设备上承载的业务类型也越来越多,从而使得一个网络设备上承载海量的数据。在这海量数据流中,存在一些对时延要求比较高的业务的数据,比如,该业务可以包括语音通话、视频通话、远程操控和自动驾驶等,这些业务对数据的实时性和丢包率的要求很高,无论当前的网络状态是否拥塞都需要确保优先服务。With the rapid development of the network, the bandwidth processing capability, the number of ports, and the number of users supported by network devices increase rapidly, and more and more types of services are carried on network devices, so that a network device can carry massive amounts of data. In this massive data stream, there are some services that require relatively high latency. For example, the services can include voice calls, video calls, remote control, and automatic driving. The requirements are very high, and priority service needs to be ensured regardless of the current network status is congested or not.
现有技术中,网络设备在通过网卡传输数据流时,通常根据数据流的业务类型将数据流划分为非拥塞流和拥塞流,并将非拥塞流存储在网卡的片内缓存中,拥塞流存储在网卡的片外缓存中。之后,当调度数据流输出时,从片内缓存和片外缓存中读取数据流,并根据业务优先级区分高优先级和低优先级两个通道缓存输出,具体是将非拥塞流中优先级较高的数据流缓存在高优先级通道、将非拥塞流中优先级较低的数据流和拥塞流缓存在低优先级通道,并优先服务高优先级通道。由于片内缓存的读延迟极小,且非拥塞流中优先级较高的数据流通过高优先级通道输出,这样高优先级的数据流可以快速被输出,从而获得较低的时延。In the prior art, when a network device transmits a data stream through a network card, it usually divides the data stream into a non-congested stream and a congested stream according to the service type of the data stream, and stores the non-congested stream in the on-chip cache of the network card. Stored in the off-chip cache of the NIC. After that, when scheduling the output of the data stream, read the data stream from the on-chip cache and the off-chip cache, and differentiate the two channels of high priority and low priority according to the business priority. Data flows with higher levels are buffered on high-priority channels, and data flows and congested flows with lower priorities among non-congested flows are buffered on low-priority channels, and the high-priority channels are preferentially served. Since the read delay of the on-chip cache is extremely small, and the data flow with higher priority in the non-congested flow is output through the high-priority channel, the high-priority data flow can be output quickly, so as to obtain a lower delay.
上述方案中,拥塞流存储在片外缓存中,具有较大的读延迟,非拥塞流中低优先级的数据流通过低优先级通道输出,从而需要等待拥塞流读出后一起排队输出,这样会导致非拥塞流中低优先级的数据流的时延增大,同时在一定程度上会降低片内缓存分配和释放的效率。In the above scheme, the congested stream is stored in the off-chip cache, which has a large read delay, and the low-priority data stream in the non-congested stream is output through the low-priority channel, so it is necessary to wait for the congested stream to be read and then queue up for output. This will increase the delay of low-priority data streams in non-congested streams, and will reduce the efficiency of on-chip cache allocation and release to a certain extent.
发明内容SUMMARY OF THE INVENTION
本申请提供一种数据流传输方法、装置及网络设备,可用于降低非拥塞流中低优先级的数据流的时延,从而提高了片内缓存的分配和释放的效率,进而提高片内缓存的利用率。The present application provides a data stream transmission method, device and network device, which can be used to reduce the delay of low-priority data streams in non-congested streams, thereby improving the efficiency of on-chip cache allocation and release, thereby improving on-chip cache utilization rate.
为达到上述目的,本申请采用如下技术方案:To achieve the above object, the application adopts the following technical solutions:
第一方面,提供一种数据流传输方法,应用于网卡中,该网卡与片外缓存耦合,该网卡包括片内缓存、第一通道和第二通道,第一通道的优先级高于第二通道的优先级(即在第一通道和第二通道均有数据输出时,该网卡优先服务第一通道),该方法包括:接收第一数据流的第一报文,并根据第一数据流的业务类型确定第一数据流为非拥塞流或者拥塞流,第一数据流可以包括多个报文,第一报文是这多个报文中的任一报文,第一报文中可以包括用于指示第一数据流的第一队列索引;若第一数据流为非拥塞流,比如,第一数据流是视频通话、远程操控或自动驾驶等对时延要求比较高的业务的数据流,将第一报文存储在该片内缓存中,并在触发第一数据流的调度指令时,从该片内缓存中读取第一数据流的第一报文并通过第一通道输出;若第一数据流为拥塞流,比如,第一数据流是网页浏览或文件下载等对时延和丢包不敏感的业务的 数据流,将第一报文存储在该片外缓存中,并在触发第一数据流的调度指令时,从该片外缓存中读取第一数据流的第一报文并通过第二通道输出。A first aspect provides a data stream transmission method, which is applied to a network card, the network card is coupled with an off-chip cache, the network card includes an on-chip cache, a first channel and a second channel, and the priority of the first channel is higher than that of the second channel. The priority of the channel (that is, when both the first channel and the second channel have data output, the network card preferentially serves the first channel), the method includes: receiving the first packet of the first data flow, and according to the first data flow The service type determines that the first data flow is a non-congested flow or a congested flow, the first data flow may include multiple packets, the first packet is any one of the multiple packets, and the first packet may Including the first queue index used to indicate the first data stream; if the first data stream is a non-congested stream, for example, the first data stream is data for services that require relatively high latency, such as video calls, remote control, or automatic driving stream, store the first packet in the on-chip cache, and when triggering the scheduling instruction of the first data stream, read the first packet of the first data stream from the on-chip cache and output it through the first channel ; If the first data flow is a congested flow, for example, the first data flow is a data flow of services that are not sensitive to delay and packet loss, such as web browsing or file download, store the first packet in the off-chip cache, And when the scheduling instruction of the first data stream is triggered, the first packet of the first data stream is read from the off-chip cache and output through the second channel.
上述技术方案中,当该网卡接收到第一数据流的报文时,若第一数据流为非拥塞流,则将第一数据流的报文存储在片内缓存中,并在调度第一数据流时从片内缓存中读出后通过高优先级的第一通道输出,由于片内缓存的读延迟小,因此可以保证非拥塞流中高优先级和低优先级的数据流均能够被快速输出,从而在一定程度上提高了片内缓存的分配和释放的效率,进而提高片内缓存的利用率。此外,若第一数据流为拥塞流,则将第一数据流的报文存储在片外缓存中,并在调度第一数据流时从片外缓存中读出后通过低优先级的第二通道输出,由于片外缓存的空间较大,从而可以保证对于拥塞流的缓存需求。In the above technical solution, when the network card receives the message of the first data flow, if the first data flow is a non-congested flow, the message of the first data flow is stored in the on-chip cache, and the first data flow is scheduled. When the data stream is read from the on-chip cache, it is output through the first channel with high priority. Since the read delay of the on-chip cache is small, it can ensure that both high-priority and low-priority data streams in non-congested streams can be quickly processed. To a certain extent, the efficiency of the allocation and release of the on-chip cache is improved, thereby improving the utilization of the on-chip cache. In addition, if the first data stream is a congested stream, the packets of the first data stream are stored in the off-chip cache, and are read from the off-chip cache when the first data stream is scheduled and passed through the second low-priority second stream. For channel output, due to the large off-chip buffer space, the buffer requirements for congested flows can be guaranteed.
在第一方面的一种可能的实现方式中,该网卡根据第一数据流的业务类型确定第一数据流为非拥塞流或者拥塞流,包括:若第一数据流的业务类型为时延要求小于第一时延的业务类型,则确定第一数据流为非拥塞流;若第一数据流的业务类型为时延要求大于第二时延的业务类型,则确定第一数据流为拥塞流,第二时延大于第一时延。进一步的,当该网卡根据第一数据流的业务类型确定第一数据流不是非拥塞流时,该方法还可以包括:该网卡根据第一数据流对应的端口、用户优先级、和/或实时队列长度确定第一数据流是拥塞流或者非拥塞流。比如,若第一数据流对应的端口的传输速率较大、用户优先级较高或者实时队列较短,该网卡可以确定第一数据流为非拥塞流,若第一数据流对应的端口的传输速率较小、用户优先级较低或者实时队列较长,该网卡可以确定第一数据流为拥塞流。In a possible implementation manner of the first aspect, the network card determines that the first data flow is a non-congested flow or a congested flow according to a service type of the first data flow, including: if the service type of the first data flow is a delay requirement If the service type of the first data flow is less than the first delay, it is determined that the first data flow is a non-congested flow; if the service type of the first data flow is a service type whose delay requirement is greater than the second delay, it is determined that the first data flow is a congested flow. , the second delay is greater than the first delay. Further, when the network card determines that the first data stream is not a non-congested stream according to the service type of the first data stream, the method may further include: the network card determines according to the port, user priority, and/or real-time corresponding to the first data stream. The queue length determines whether the first data flow is a congested flow or a non-congested flow. For example, if the transmission rate of the port corresponding to the first data stream is high, the user priority is high, or the real-time queue is short, the network card can determine that the first data stream is a non-congested stream. If the rate is low, the user priority is low, or the real-time queue is long, the network card may determine that the first data flow is a congested flow.
在第一方面的一种可能的实现方式中,当第一数据流从该非拥塞流转换为该拥塞流时,比如,第一数据流在前一时间段内被确定为非拥塞流,在后一时间段内被确定为拥塞流,该方法还包括:当接收到第一数据流的第二报文时,将第二报文存储在该片外缓存中,第二报文的第二序列号大于第一报文的第一序列号,第一报文可以是第一数据流从非拥塞流转换为拥塞流之前的一个报文,第二报文可以是第一数据流从非拥塞流转换为拥塞流之后的一个报文,每个报文的序列号可用于指示该报文在第一数据流中的位置(也可以称为发送顺序);在第一数据流中序列号小于第二报文的第二序列号的报文通过第一通道输出之后,即在第二报文之前接收到的第一数据流的报文全部输出之后,从该片外缓存中读取第二报文并通过第二通道输出。上述可能的实现方式中,当第一数据流从该非拥塞流转换为该拥塞流时,可以将接收到的第一数据流的第二报文存储在该片外缓存中,以避免第一数据流的报文在片内缓存中的累积,从而在一定程度上提高片内缓存的分配和释放的效率;此外,当调度第一数据流时,在通过第一通道将第一数据流中序列号小于第二序列号的报文输出之后,再从该片外缓存中读取第二报文并通过第二通道输出,可以避免第一数据流从该非拥塞流转换为该拥塞流时报文出现乱序的问题。In a possible implementation manner of the first aspect, when the first data flow is converted from the non-congested flow to the congested flow, for example, the first data flow is determined to be a non-congested flow in the previous time period, the It is determined as a congested flow in the latter time period, and the method further includes: when receiving the second packet of the first data flow, storing the second packet in the off-chip cache, and the second packet of the second packet is stored in the off-chip cache. The sequence number is greater than the first sequence number of the first packet. The first packet may be a packet before the first data flow is converted from a non-congested flow to a congested flow, and the second packet may be a first data flow from a non-congested flow. A packet after the flow is converted into a congested flow, and the sequence number of each packet can be used to indicate the position of the packet in the first data stream (also called the sending order); in the first data stream, the sequence number is less than After the packet of the second sequence number of the second packet is output through the first channel, that is, after all the packets of the first data stream received before the second packet are output, the second packet is read from the off-chip cache. The message is output through the second channel. In the above possible implementation manner, when the first data flow is converted from the non-congested flow to the congested flow, the received second packet of the first data flow can be stored in the off-chip cache to avoid the first data flow. The packets of the data stream are accumulated in the on-chip cache, thereby improving the efficiency of the allocation and release of the on-chip cache to a certain extent; in addition, when scheduling the first data stream, the After the packet whose sequence number is smaller than the second sequence number is output, the second packet is read from the off-chip cache and output through the second channel, which can avoid the first data stream being converted from the non-congested stream to the congested stream. The text is out of order.
在第一方面的一种可能的实现方式中,该方法还包括:当第一数据流的第一报文输入第一通道时,将第一通道中第一数据流的报文的输入数量加一;当第一报文从第一通道输出时,将第一通道中第一数据流的报文的输出数量加一;当第二报文输入第二通道时,将该输入数量携带在第二报文的控制信息中;其中,当该输出数量大于或 等于第二报文的控制信息携带的该输入数量时,第一数据流中序列号小于第二序列号的报文已通过第一通道输出。上述可能的实现方式中,可以保证该网卡在将第二报文之前接收到的第一数据流的报文全部输出之后,再通过第二通道输出第二报文,从而保证第一数据流从该非拥塞流转换为该拥塞流时报文出现乱序的问题。In a possible implementation manner of the first aspect, the method further includes: when the first packet of the first data stream is input to the first channel, adding an input quantity of the packets of the first data stream in the first channel to One; when the first packet is output from the first channel, add one to the output number of the packets of the first data stream in the first channel; when the second packet is input to the second channel, carry the input number in the first channel In the control information of the two packets; wherein, when the output quantity is greater than or equal to the input quantity carried by the control information of the second packet, the packet whose sequence number is smaller than the second sequence number in the first data stream has passed the first channel output. In the above possible implementation manner, it can be ensured that after the network card outputs all the packets of the first data stream received before the second packet, the second packet is output through the second channel, thereby ensuring that the first data stream is sent from the first data stream. When the non-congested flow is converted into the congested flow, the packet is out of order.
在第一方面的一种可能的实现方式中,当第一数据流从该拥塞流转换为该非拥塞流时,比如,第一数据流在前一时间段内被确定为拥塞流,在后一时间段内被确定为非拥塞流,该方法还包括:当接收到第一数据流的第三报文时,将第三报文存储在该片内缓存中,第三报文可以是第一数据流从拥塞流转换为非拥塞流之后的一个报文,每个报文的序列号可用于指示该报文在第一数据流中的位置(也可以称为发送顺序);若第二通道中第一数据流的报文未全部输出,从该片内缓存中读取第三报文并通过第二通道输出;若第二通道中第一数据流的报文全部输出,从该片内缓存中读取第三报文并通过第一通道输出。上述可能的实现方式中,当第一数据流从该拥塞流转换为该非拥塞流时,将接收到的第一数据流的第三报文存储在该片内缓存中,可以保证第一数据流转换为非拥塞流后可以获取较小的传输时延;此外,当调度第一数据流时,根据第二通过中第一数据流的报文是否全部输出,对应将第三报文通过第一通道或第二通道输出,可以避免第一数据流从该拥塞流转换为该非拥塞流时报文出现乱序的问题。In a possible implementation manner of the first aspect, when the first data flow is converted from the congested flow to the non-congested flow, for example, the first data flow is determined to be a congested flow in a previous time period, and a later It is determined to be a non-congested flow within a period of time, and the method further includes: when a third packet of the first data flow is received, storing the third packet in the on-chip cache, where the third packet may be the third packet of the first data stream. A packet after a data stream is converted from a congested stream to a non-congested stream, the sequence number of each packet can be used to indicate the position of the packet in the first data stream (also called the sending order); if the second If the packets of the first data stream in the channel are not all output, the third packet is read from the on-chip buffer and output through the second channel; if all the packets of the first data stream in the second channel are output, the third packet is read from the The third message is read in the internal buffer and output through the first channel. In the above possible implementation manner, when the first data flow is converted from the congested flow to the non-congested flow, the received third packet of the first data flow is stored in the on-chip cache, which can guarantee the first data flow. After the flow is converted into a non-congested flow, a small transmission delay can be obtained; in addition, when the first data flow is scheduled, according to whether all the packets of the first data flow in the second pass are output, the third packet is passed through the first data flow correspondingly. The output of one channel or the second channel can avoid the problem of out-of-order packets when the first data flow is converted from the congested flow to the non-congested flow.
在第一方面的一种可能的实现方式中,第二通道中第一数据流的每个报文对应一个输入输出信息,该方法还包括:当第一数据流的第一报文输入第二通道或从第二通道输出时,记录第一报文的输入输出信息,该输入输出信息用于确定第二通道中的第一数据流的报文是否全部输出。上述可能的实现方式中,该网卡可以通过该输入输出信息确定第二通道中的第一数据流的报文是否全部输出,从而确定第三报文是通过第一通道或第二通道输出,进而避免第一数据流从该拥塞流转换为该非拥塞流时报文出现乱序的问题。In a possible implementation manner of the first aspect, each packet of the first data stream in the second channel corresponds to one input and output information, and the method further includes: when the first packet of the first data stream is input to the second channel When outputting from the channel or from the second channel, the input and output information of the first packet is recorded, and the input and output information is used to determine whether all the packets of the first data stream in the second channel are output. In the above possible implementation manner, the network card can determine whether all the packets of the first data stream in the second channel are output through the input and output information, so as to determine whether the third packet is output through the first channel or the second channel, and further This avoids the problem of out-of-order packets when the first data flow is converted from the congested flow to the non-congested flow.
在第一方面的一种可能的实现方式中,该输入输出信息为第二通道中第一数据流的报文数量,该当第一数据流的第一报文输入第二通道或从第二通道输出时,记录第一报文的输入输出信息,包括:当第一数据流的第一报文输入第二通道时,将该报文数量加一;当第一数据流的第一报文从第二通道输出时,将该报文数量减一;其中,当该报文数量为0时,第二通道中第一数据流的报文已全部输出;当该报文数量不为0时,第二通道中第一数据流的报文未全部输出。上述可能的实现方式中,提供了一种简单、有效的确定第二通道中的第一数据流的报文是否全部输出的方式。In a possible implementation manner of the first aspect, the input and output information is the number of packets of the first data stream in the second channel, and the first packet of the first data stream is input to or from the second channel. When outputting, recording the input and output information of the first packet, including: when the first packet of the first data stream is input to the second channel, adding one to the number of packets; When the second channel outputs, the number of packets is reduced by one; when the number of packets is 0, all the packets of the first data stream in the second channel have been output; when the number of packets is not 0, Not all packets of the first data stream in the second channel are output. In the above possible implementation manner, a simple and effective manner is provided for determining whether all the packets of the first data stream in the second channel are output.
在第一方面的一种可能的实现方式中,该输入输出信息包括输入标志位和流标识位,该当第一数据流的第一报文输入第二通道或从第二通道输出时,记录第一报文的输入输出信息,包括:当第一数据流的第一报文输入第二通道时,将第一报文对应的输入标志位置为有效、该流标识位置为第一数据流的流标识;当第一数据流的第一报文从第二通道输出时,将第一报文对应的输入标志位置为无效;其中,当该输入输出信息中第一数据流的流标识对应的所有输入标志位均为无效时,第二通道中第一数据流的报文全部输出;当该输入输出信息中第一数据流的流标识对应的所有输入标志位中存在有效的输入标志位时,第二通道中第一数据流的报文未全部输出。上述可能的实现方式中,提供了另一种简单、有效的确定第二通道中的第一数据流的报文是否全 部输出的方式。In a possible implementation manner of the first aspect, the input and output information includes an input flag bit and a stream flag bit, and when the first packet of the first data stream is input to the second channel or output from the second channel, the first packet of the first data stream is recorded. Input and output information of a packet, including: when the first packet of the first data stream is input to the second channel, the input flag position corresponding to the first packet is valid, and the stream flag position is the stream of the first data stream identification; when the first message of the first data stream is output from the second channel, the input flag position corresponding to the first message is invalid; wherein, when the input and output information of the first data stream corresponds to the flow identification of all When the input flag bits are all invalid, all the messages of the first data stream in the second channel are output; when there are valid input flag bits in all input flag bits corresponding to the stream identifier of the first data stream in the input and output information, Not all packets of the first data stream in the second channel are output. In the above possible implementation manner, another simple and effective manner for determining whether all the packets of the first data stream in the second channel are output is provided.
在第一方面的一种可能的实现方式中,该网卡包括寄存器组,该寄存器组中的每个寄存器用于存储一个报文的输入输出信息,该寄存器组的深度与片外最大读延迟、要求带宽和满足要求性能时的最小包长有关。上述可能的实现方式可以尽可能的减小寄存器组的深度,从而降低该网卡的芯片面积和成本。In a possible implementation manner of the first aspect, the network card includes a register group, each register in the register group is used to store the input and output information of a message, and the depth of the register group is related to the off-chip maximum read delay, The required bandwidth is related to the minimum packet length required to meet the required performance. The above possible implementation manners can reduce the depth of the register set as much as possible, thereby reducing the chip area and cost of the network card.
在第一方面的一种可能的实现方式中,该方法还包括:当该寄存器组的占用率大于第一阈值时,减小第二通道中拥塞流的报文的传输量;当该寄存器组的占用率大于第二阈值时,减小第一通道中非拥塞流的报文的传输量,第二阈值大于第一阈值。上述可能的实现方式中,通过控制第一通道或第二通道中数据流的传输量,可以尽可能地在保证非拥塞流具有较低时延的情况下,避免该寄存器组发生溢出的问题。In a possible implementation manner of the first aspect, the method further includes: when the occupancy rate of the register group is greater than the first threshold, reducing the transmission amount of packets of the congested flow in the second channel; When the occupancy rate of the first channel is greater than the second threshold, the transmission amount of the packets of the non-congested flow in the first channel is reduced, and the second threshold is greater than the first threshold. In the above possible implementation manner, by controlling the transmission amount of the data flow in the first channel or the second channel, the problem of overflow of the register group can be avoided as much as possible while ensuring that the non-congested flow has a lower delay.
在第一方面的一种可能的实现方式中,该方法还包括:根据片内缓存的占用率、片外缓存的占用率、第一通道的占用率或第二通道的占用率中的至少一个项,调节拥塞流的传输量和/或非拥塞流的传输量。上述可能的实现方式中,可以尽可能地在保证非拥塞流具有较低时延的情况下,避免第一通道和/或第二通道的过度占用,从而避免该网卡的超负荷工作。In a possible implementation manner of the first aspect, the method further includes: according to at least one of the occupancy rate of the on-chip cache, the occupancy rate of the off-chip cache, the occupancy rate of the first channel, or the occupancy rate of the second channel item that adjusts the throughput of congested streams and/or the throughput of non-congested streams. In the above possible implementation manners, the over-occupancy of the first channel and/or the second channel can be avoided as much as possible while ensuring that the non-congested flow has a lower delay, thereby avoiding the overloaded work of the network card.
第二方面,提供一种数据流传输装置,该装置与片外缓存耦合,该装置中包括片内缓存、第一通道和第二通道,第一通道的优先级高于第二通道的优先级(即在第一通道和第二通道均有数据输出时,该网卡优先服务第一通道),该装置还包括:接收单元,用于接收第一数据流的第一报文,第一数据流可以包括多个报文,第一报文是这多个报文中的任一报文,第一报文中可以包括用于指示第一数据流的第一队列索引;确定单元,用于根据第一数据流的业务类型或者第一数据流的队列长度确定第一数据流为非拥塞流或者拥塞流;调度单元,用于确定第一数据流为非拥塞流(比如,第一数据流是视频通话、远程操控或自动驾驶等对时延要求比较高的业务的数据流),或者确定第一数据流为非拥塞流(比如,第一数据流是网页浏览或文件下载等对时延和丢包不敏感的业务的数据流);写入单元,用于若第一数据流为非拥塞流,将第一报文存储在该片内缓存中,若第一数据流为拥塞流,将第一报文存储在该片外缓存中;该调度单元,还用于触发第一数据流的调度指令;读取单元,用于若第一数据流为非拥塞流,从该片内缓存中读取第一数据流的第一报文并通过第一通道输出,若第一数据流为拥塞流,从该片外缓存中读取第一数据流的第一报文并通过第二通道输出。In a second aspect, a data stream transmission device is provided, the device is coupled to an off-chip cache, the device includes an on-chip cache, a first channel and a second channel, and the priority of the first channel is higher than the priority of the second channel (that is, when both the first channel and the second channel have data output, the network card preferentially serves the first channel), the device further includes: a receiving unit, configured to receive the first packet of the first data stream, the first data stream It may include multiple packets, the first packet is any one of the multiple packets, and the first packet may include a first queue index used to indicate the first data stream; the determining unit is used for determining according to the The service type of the first data flow or the queue length of the first data flow determines that the first data flow is a non-congested flow or a congested flow; the scheduling unit is configured to determine that the first data flow is a non-congested flow (for example, the first data flow is video call, remote control, or automatic driving and other services that require relatively high latency), or determine that the first data stream is a non-congested stream (for example, the first data stream is web browsing or file download, etc. The data flow of the service that is not sensitive to packet loss); the writing unit is used to store the first packet in the on-chip cache if the first data flow is a non-congested flow, and if the first data flow is a congested flow, write the The first message is stored in the off-chip cache; the scheduling unit is also used for triggering a scheduling instruction of the first data stream; the reading unit is used for, if the first data stream is a non-congested stream, from the on-chip cache Read the first packet of the first data stream and output it through the first channel. If the first data stream is a congested stream, read the first packet of the first data stream from the off-chip buffer and output it through the second channel .
在第二方面的一种可能的实现方式中,调度单元还用于:若第一数据流的业务类型为时延要求小于第一时延的业务类型,则确定第一数据流为非拥塞流;若第一数据流的业务类型为时延要求大于第二时延的业务类型,则确定第一数据流为拥塞流,第二时延大于第一时延。进一步的,当该网卡根据第一数据流的业务类型确定第一数据流不是非拥塞流时,调度单元还用于:根据第一数据流对应的端口、用户优先级、和/或实时队列长度确定第一数据流是拥塞流或者非拥塞流。比如,若第一数据流对应的端口的传输速率较大、用户优先级较高或者实时队列较短,该调度单元可以确定第一数据流为非拥塞流,若第一数据流对应的端口的传输速率较小、用户优先级较低或者实时队列较长,该调度单元可以确定第一数据流为拥塞流。In a possible implementation manner of the second aspect, the scheduling unit is further configured to: if the service type of the first data flow is a service type whose delay requirement is less than the first delay, determine that the first data flow is a non-congested flow ; if the service type of the first data flow is a service type whose delay requirement is greater than the second delay, it is determined that the first data flow is a congested flow, and the second delay is greater than the first delay. Further, when the network card determines that the first data flow is not a non-congested flow according to the service type of the first data flow, the scheduling unit is further configured to: according to the corresponding port, user priority, and/or real-time queue length of the first data flow It is determined whether the first data flow is a congested flow or a non-congested flow. For example, if the transmission rate of the port corresponding to the first data stream is relatively high, the user priority is relatively high, or the real-time queue is relatively short, the scheduling unit may determine that the first data stream is a non-congested stream. When the transmission rate is low, the user priority is low, or the real-time queue is long, the scheduling unit may determine that the first data flow is a congested flow.
在第二方面的一种可能的实现方式中,当第一数据流从该非拥塞流转换为该拥塞 流时,比如,第一数据流在前一时间段内被确定为非拥塞流,在后一时间段内被确定为拥塞流:该写入单元,还用于当该接收单元接收到第一数据流的第二报文时,将第二报文存储在该片外缓存中,第二报文的第二序列号大于第一报文的第一序列号,第一报文可以是第一数据流从非拥塞流转换为拥塞流之前的一个报文,第二报文可以是第一数据流从非拥塞流转换为拥塞流之后的一个报文,每个报文的序列号可用于指示该报文在第一数据流中的位置(也可以称为发送顺序);该读取单元,还用于在第一数据流中序列号小于第二序列号的报文通过第一通道输出之后,即在第二报文之前接收到的第一数据流的报文全部输出之后,从该片外缓存中读取第二报文并通过第二通道输出。In a possible implementation manner of the second aspect, when the first data flow is converted from the non-congested flow to the congested flow, for example, the first data flow is determined to be a non-congested flow in the previous time period, the It is determined as a congested flow in the latter time period: the writing unit is further configured to store the second packet in the off-chip cache when the receiving unit receives the second packet of the first data stream, and the first The second sequence number of the second packet is greater than the first sequence number of the first packet. The first packet may be a packet before the first data flow is converted from a non-congested flow to a congested flow, and the second packet may be the first packet. A packet after a data stream is converted from a non-congested stream to a congested stream, the sequence number of each packet can be used to indicate the position of the packet in the first data stream (also referred to as the sending order); the read The unit is further configured to, after the packets with the sequence number smaller than the second sequence number in the first data stream are output through the first channel, that is, after all the packets of the first data stream received before the second packet are output, from The second message is read from the off-chip cache and output through the second channel.
在第二方面的一种可能的实现方式中,该装置还包括:第一计数器,用于当第一数据流的第一报文输入第一通道时,将第一通道中第一数据流的报文的输入数量加一;第二计数器,用于当第一报文从第一通道输出时,将第一通道中第一数据流的报文的输出数量加一;当第二报文输入第二通道时,将该输入数量携带在第二报文的控制信息中;其中,当该输出数量大于或等于第二报文的控制信息携带的该输入数量时,第一数据流中序列号小于第二序列号的报文已通过第一通道输出。In a possible implementation manner of the second aspect, the apparatus further includes: a first counter, configured to, when the first packet of the first data stream is input to the first channel, count the value of the first data stream in the first channel The input quantity of the message is increased by one; the second counter is used to increase the output quantity of the message of the first data stream in the first channel by one when the first message is output from the first channel; when the second message is input When the second channel is used, the input quantity is carried in the control information of the second packet; wherein, when the output quantity is greater than or equal to the input quantity carried in the control information of the second packet, the sequence number in the first data stream A packet smaller than the second sequence number has been output through the first channel.
在第二方面的一种可能的实现方式中,当第一数据流从该拥塞流转换为该非拥塞流时:该写入单元,还用于当该接收单元接收到第一数据流的第三报文时,将第三报文存储在该片内缓存中,第三报文是第一数据流从拥塞流转换为非拥塞流之后的一个报文;该读取单元,还用于若第二通道中第一数据流的报文未全部输出,从该片内缓存中读取第三报文并通过第二通道输出;该读取单元,还用于若第二通道中第一数据流的报文全部输出,从该片内缓存中读取第三报文并通过第一通道输出。In a possible implementation manner of the second aspect, when the first data stream is converted from the congested stream to the non-congested stream: the writing unit is further configured to, when the receiving unit receives the first data stream of the first data stream When there are three packets, the third packet is stored in the on-chip cache, and the third packet is a packet after the first data stream is converted from a congested stream to a non-congested stream; the reading unit is also used if the If the packets of the first data stream in the second channel are not all output, the third packet is read from the on-chip buffer and output through the second channel; the reading unit is also used if the first data in the second channel All the packets of the flow are output, and the third packet is read from the on-chip buffer and output through the first channel.
在第二方面的一种可能的实现方式中,第二通道中第一数据流的每个报文对应一个输入输出信息,该读取单元还用于:当第一数据流的第一报文输入第二通道或从第二通道输出时,记录第一报文的输入输出信息,该输入输出信息用于确定第二通道中的第一数据流的报文是否全部输出。In a possible implementation manner of the second aspect, each packet of the first data stream in the second channel corresponds to one input and output information, and the reading unit is further configured to: when the first packet of the first data stream When input to or output from the second channel, the input and output information of the first packet is recorded, and the input and output information is used to determine whether all the packets of the first data stream in the second channel are output.
在第二方面的一种可能的实现方式中,该输入输出信息为第二通道中第一数据流的报文数量,该读取单元还用于:当第一数据流的第一报文输入第二通道时,将该报文数量加一;当第一数据流的第一报文从第二通道输出时,将该报文数量减一;其中,当该报文数量为0时,第二通道中第一数据流的报文已全部输出;当该报文数量不为0时,第二通道中第一数据流的报文未全部输出。In a possible implementation manner of the second aspect, the input and output information is the number of packets of the first data stream in the second channel, and the reading unit is further configured to: when the first packet of the first data stream is input When the second channel is used, the number of packets is increased by one; when the first packet of the first data stream is output from the second channel, the number of packets is reduced by one; when the number of packets is 0, the number of packets is 0. All the packets of the first data stream in the second channel have been output; when the number of the packets is not 0, the packets of the first data stream in the second channel have not been all output.
在第二方面的一种可能的实现方式中,该输入输出信息包括输入标志位和流标识位,该读取单元还用于:当第一数据流的第一报文输入第二通道时,将第一报文对应的输入标志位置为有效、该流标识位置为第一数据流的流标识;当第一数据流的第一报文从第二通道输出时,将第一报文对应的输入标志位置为无效;其中,当该输入输出信息中第一数据流的流标识对应的所有输入标志位均为无效时,第二通道中第一数据流的报文全部输出;当该输入输出信息中第一数据流的流标识对应的所有输入标志位中存在有效的输入标志位时,第二通道中第一数据流的报文未全部输出。In a possible implementation manner of the second aspect, the input and output information includes an input flag bit and a stream flag bit, and the reading unit is further configured to: when the first packet of the first data stream is input to the second channel, The position of the input flag corresponding to the first packet is valid, and the position of the stream identifier is the stream identifier of the first data stream; when the first packet of the first data stream is output from the second channel, the corresponding value of the first packet is set. The input flag position is invalid; wherein, when all the input flag bits corresponding to the stream identifier of the first data stream in the input and output information are invalid, all the messages of the first data stream in the second channel are output; when the input and output information When there are valid input flag bits in all input flag bits corresponding to the flow identifier of the first data stream in the information, not all packets of the first data stream in the second channel are output.
在第二方面的一种可能的实现方式中,该装置包括寄存器组,该寄存器组中的每个寄存器用于存储一个报文的输入输出信息,该寄存器组的深度与片外最大读延迟、 要求带宽和满足要求性能时的最小包长有关。In a possible implementation manner of the second aspect, the device includes a register group, each register in the register group is used to store input and output information of a message, and the depth of the register group is related to the off-chip maximum read delay, The required bandwidth is related to the minimum packet length required to meet the required performance.
在第二方面的一种可能的实现方式中,该调度单元还用于:当该寄存器组的占用率大于第一阈值时,减小该拥塞流的传输量;当该寄存器组的占用率大于第二阈值时,减小该非拥塞流的传输量,第二阈值大于第一阈值。In a possible implementation manner of the second aspect, the scheduling unit is further configured to: when the occupancy rate of the register group is greater than the first threshold, reduce the transmission amount of the congested flow; when the occupancy rate of the register group is greater than the first threshold When the second threshold is used, the transmission amount of the non-congested flow is reduced, and the second threshold is greater than the first threshold.
在第二方面的一种可能的实现方式中,该调度单元还用于:根据片内缓存的占用率、片外缓存的占用率、第一通道的占用率或第二通道的占用率中的至少一个项,调节拥塞流的传输量和/或非拥塞流的传输量。In a possible implementation manner of the second aspect, the scheduling unit is further configured to: according to the occupancy rate of the on-chip cache, the occupancy rate of the off-chip cache, the occupancy rate of the first channel, or the occupancy rate of the second channel At least one item adjusts the throughput of congested flows and/or the throughput of non-congested flows.
在本申请的另一方面,还提供一种芯片,该芯片包括上述第二方面或者第二方面的任一种可能的实现方式所提供的数据流传输装置,比如,该芯片为网卡。In another aspect of the present application, a chip is also provided. The chip includes the data stream transmission device provided by the second aspect or any possible implementation manner of the second aspect. For example, the chip is a network card.
在本申请的又一方面,提供一种网络设备,该网络设备包括网卡和处理器,该处理器可用于向该网卡发送数据流,该网卡包括上述第二方面或者第二方面的任一种可能的实现方式所提供的数据流传输装置。可选的,该网络设备可以为接入网、城域网、骨干网或者局域网中的终端设备、路由器或者交换机等。In yet another aspect of the present application, a network device is provided, the network device includes a network card and a processor, the processor can be configured to send a data stream to the network card, and the network card includes the second aspect or any of the second aspects. Possible implementations of the provided data streaming device. Optionally, the network device may be a terminal device, a router, a switch, or the like in an access network, a metropolitan area network, a backbone network, or a local area network.
在本申请的又一方面,提供一种计算机可读存储介质,该计算机可读存储介质中存储有指令,当该指令在设备上运行时,使得该设备执行上述第一方面或者第一方面的任一种可能的实现方式所提供的数据流传输方法。In yet another aspect of the present application, a computer-readable storage medium is provided, where instructions are stored in the computer-readable storage medium, and when the instructions are executed on a device, the device causes the device to perform the above first aspect or the first aspect. A data streaming method provided by any possible implementation.
在本申请的又一方面,提供一种计算机程序产品,当该计算机程序产品在设备上运行时,使得该设备执行上述第一方面或者第一方面的任一种可能的实现方式所提供的数据流传输方法。In yet another aspect of the present application, a computer program product is provided, which, when the computer program product runs on a device, enables the device to execute the data provided by the first aspect or any possible implementation manner of the first aspect Streaming method.
可以理解地,上述提供的任一种数据流传输装置、芯片、网络设备、计算机存储介质或者计算机程序产品均用于执行上文所提供的数据流传输方法,因此,其所能达到的有益效果可参考上文所提供的数据流传输方法中的有益效果,此处不再赘述。It can be understood that any data stream transmission device, chip, network device, computer storage medium or computer program product provided above are all used to execute the data stream transmission method provided above, and therefore, the beneficial effects that can be achieved. The beneficial effects in the data stream transmission method provided above can be referred to, and details are not repeated here.
附图说明Description of drawings
图1为本申请实施例提供的一种网络设备的结构示意图;FIG. 1 is a schematic structural diagram of a network device according to an embodiment of the present application;
图2为本申请实施例提供的一种网卡的结构示意图;FIG. 2 is a schematic structural diagram of a network card according to an embodiment of the present application;
图3为本申请实施例提供的一种数据流传输方法的流程示意图;3 is a schematic flowchart of a data stream transmission method according to an embodiment of the present application;
图4为本申请实施例提供的另一种数据流传输方法的流程示意图;4 is a schematic flowchart of another data stream transmission method provided by an embodiment of the present application;
图5为本申请实施例提供的又一种数据流传输方法的流程示意图;FIG. 5 is a schematic flowchart of another data stream transmission method provided by an embodiment of the present application;
图6为本申请实施例提供的一种寄存器组的示意图;FIG. 6 is a schematic diagram of a register group provided by an embodiment of the present application;
图7为本申请实施例提供的一种数据流传输装置的流程示意图;FIG. 7 is a schematic flowchart of a data stream transmission apparatus provided by an embodiment of the present application;
图8为本申请实施例提供的另一种数据流传输装置的流程示意图。FIG. 8 is a schematic flowchart of another data stream transmission apparatus provided by an embodiment of the present application.
具体实施方式Detailed ways
本申请中,“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一项(个)”或其类似表达,是指的这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a,b,或c中的至少一项(个),可以表示:a,b,c,a-b,a-c,b-c,或a-b-c,其中a,b,c可以是单个,也可以是多个。另外,本申请实施例采用了“第 一”、“第二”等字样对功能和作用基本相同的相同项或相似项进行区分。例如,第一阈值和第二阈值仅仅是为了区分不同的阈值,并不对其先后顺序进行限定。本领域技术人员可以理解“第一”、“第二”等字样并不对数量和执行次序进行限定。In this application, "at least one" means one or more, and "plurality" means two or more. "And/or", which describes the association relationship of the associated objects, indicates that there can be three kinds of relationships, for example, A and/or B, which can indicate: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A, B can be singular or plural. The character "/" generally indicates that the associated objects are an "or" relationship. "At least one item(s) below" or similar expressions thereof refer to any combination of these items, including any combination of single item(s) or plural items(s). For example, at least one (a) of a, b, or c can represent: a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, c may be single or multiple . In addition, in the embodiments of the present application, words such as "first" and "second" are used to distinguish the same items or similar items with substantially the same functions and functions. For example, the first threshold and the second threshold are only used to distinguish different thresholds, and the sequence of the first threshold is not limited. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order.
需要说明的是,本申请中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其他实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。It should be noted that, in this application, words such as "exemplary" or "for example" are used to represent examples, illustrations or illustrations. Any embodiment or design described in this application as "exemplary" or "such as" should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present the related concepts in a specific manner.
在介绍本申请实施例之前,为便于理解,首先对本申请实施例所涉及的数据流的高低优先级、非拥塞流、拥塞流、片内缓存和片外缓存的概念进行解释说明。Before introducing the embodiments of the present application, for ease of understanding, the concepts of high and low priorities of data streams, non-congested streams, congested streams, on-chip buffers and off-chip buffers involved in the embodiments of the present application are first explained.
数据流的高低优先级可以是按照数据流对应的业务的优先级划分的。高优先级的业务通常是指对带宽和时延有较高要求的业务,比如,该业务可以包括语音通话、视频通话、远程操控和自动驾驶等。低优先级的业务通常是指对时延和丢包不敏感的业务,比如,该低优先级的业务可以包括网页浏览和文件下载等。The high and low priorities of the data streams may be divided according to the priorities of the services corresponding to the data streams. High-priority services usually refer to services that have higher requirements on bandwidth and delay. For example, the services can include voice calls, video calls, remote control, and automatic driving. A low-priority service usually refers to a service that is not sensitive to delay and packet loss. For example, the low-priority service may include web browsing and file downloading.
非拥塞流和拥塞流可以是按照端口、用户、队列调度优先级、实时队列长度和缓存占用状态等状态划分的。在实际应用中,非拥塞流可以包括高优先级的数据流和一些数据量较小的低优先级的数据流,拥塞流可以包括一些数据量较大的低优先级的数据流;此外,随着一些因素的变化,非拥塞流和拥塞流也会发生转换,比如,非拥塞流可以转换为拥塞流,拥塞流也可以转换为非拥塞流,二者并不是固定不变的。示例性的,以端口区分非拥塞流和拥塞流为例,如果一个端口只有低优先级的数据流,但该端口的数据流量并没有超过端口最大处理带宽,则该低优先级的数据流可以认为是非拥塞流;此外,大部分应用场景下高优先级的数据流量不会超过端口最大处理带宽,从而高优先级的数据流基本都是非拥塞流。The non-congested flow and the congested flow can be divided according to the status of ports, users, queue scheduling priority, real-time queue length and buffer occupancy status. In practical applications, non-congested flows may include high-priority data flows and some low-priority data flows with smaller data volumes, and congested flows may include some low-priority data flows with larger data volumes; With the change of some factors, the non-congested flow and the congested flow will also be converted. For example, the non-congested flow can be converted into a congested flow, and the congested flow can also be converted into a non-congested flow. The two are not fixed. Exemplarily, taking a port to distinguish a non-congested flow from a congested flow as an example, if a port has only a low-priority data flow, but the data flow of the port does not exceed the maximum processing bandwidth of the port, the low-priority data flow can be It is considered to be a non-congested flow; in addition, in most application scenarios, the high-priority data flow will not exceed the maximum processing bandwidth of the port, so the high-priority data flow is basically a non-congested flow.
片内缓存也可以称为本地缓存(local buffer),是指集成在网卡内部的缓存。片内缓存的空间较小,但读延迟很小,在本申请中可用于非拥塞流的快速转发,在快速转发的情况下缓存空间能够快速释放,提高缓存空间利用率。The on-chip cache can also be called the local buffer, which refers to the cache integrated inside the network card. The space of the on-chip cache is small, but the read delay is small, which can be used for fast forwarding of non-congested flows in this application. In the case of fast forwarding, the cache space can be quickly released, and the utilization rate of the cache space can be improved.
片外缓存是指位于网卡芯片之外的缓存,即独立于网卡存在。片外缓存的空间较大,但读延迟较大,并且不同的片外缓存支持的访问带宽也可能各不相同,通常用于队列发生拥塞累积后使用,或者对于缓存时间长度有需求的业务使用。Off-chip cache refers to the cache located outside the network card chip, that is, independent of the network card. The off-chip cache has a large space, but the read delay is large, and the access bandwidth supported by different off-chip caches may vary. It is usually used after queue congestion accumulates, or for services that require the length of the cache. .
图1为申请实施例提供的一种网络设备的结构示意图,该网络设备可以为接入网、城域网、骨干网或者局域网中的终端设备、路由器或者交换机等。为便于描述,本申请实施例中将上述设备统称为网络设备。如图1所示,该网络设备可以包括处理器101、存储器102、网卡103和总线104,处理器101、存储器102和网卡103通过总线104耦合。FIG. 1 is a schematic structural diagram of a network device provided by an embodiment of the application. The network device may be a terminal device, a router, or a switch in an access network, a metropolitan area network, a backbone network, or a local area network. For convenience of description, the foregoing devices are collectively referred to as network devices in the embodiments of the present application. As shown in FIG. 1 , the network device may include a processor 101 , a memory 102 , a network card 103 and a bus 104 , and the processor 101 , the memory 102 and the network card 103 are coupled through the bus 104 .
其中,处理器101通过运行或执行存储在存储器102内的软件程序和/或模块,以及调用存储在存储器102内的数据,执行该网络设备的各种功能。处理器101可以包括一个或者多个模块,比如,处理器101可以包括中央处理器单元(central processing unit,CPU),以及诸如网络处理器(network processor,NP)、数字信号处理器、人工智能处理器、微控制器或微处理器等其他各类通用处理器。进一步的,处理器101还可以包括其他硬件电路或加速器,比如,专用集成电路(application specific integrated  circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合等。The processor 101 executes various functions of the network device by running or executing software programs and/or modules stored in the memory 102 and calling data stored in the memory 102 . The processor 101 may include one or more modules, for example, the processor 101 may include a central processing unit (CPU), and processing such as a network processor (NP), a digital signal processor, an artificial intelligence other types of general-purpose processors such as microcontrollers, microcontrollers, or microprocessors. Further, the processor 101 may also include other hardware circuits or accelerators, such as an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, transistors Logic devices, hardware components, or any combination thereof, etc.
存储器102可用于存储数据、软件程序以及模块,可以由任何类型的易失性或非易失性存储器或者它们的组合实现。比如,存储器102可以包括随机存取存储器(random access memory,RAM),双倍速率(double data rate,DDR)的同步动态或者同步静态RAM,非易失性随机访问存储器(non-volatile random access memory,NVRAM),电可擦除可编程只读存储器,可擦除可编程只读存储器,可编程只读存储器,只读存储器,高带宽存储器(high band memory,HBM)、磁存储器,快闪存储器,磁盘或光盘等。在本申请实施例中,存储器102包括的多个存储器或模块可以全部集成在一起,也可以部分集成在一起。可选的,存储器102包括的多个存储器或模块中的部分存储器或模块集成在一起,另一部分存储器或者模块作为独立的芯片与网卡103合封在一起。示例性的,存储器102包括DDR和HBM,该DDR可以集成在存储器102的芯片中,该HBM可以作为一个独立的芯片与网卡103合封在一起。Memory 102 may be used to store data, software programs, and modules, and may be implemented by any type of volatile or non-volatile memory or combinations thereof. For example, the memory 102 may include random access memory (RAM), double data rate (DDR) synchronous dynamic or synchronous static RAM, non-volatile random access memory (non-volatile random access memory) , NVRAM), Electrically Erasable Programmable Read-Only Memory, Erasable Programmable Read-Only Memory, Programmable Read-Only Memory, Read-Only Memory, High Band Memory (HBM), Magnetic Memory, Flash Memory , disk or CD, etc. In this embodiment of the present application, the multiple memories or modules included in the memory 102 may all be integrated together, or may be partially integrated together. Optionally, some of the multiple memories or modules included in the memory 102 are integrated together, and another part of the memories or modules are packaged together with the network card 103 as an independent chip. Exemplarily, the memory 102 includes DDR and HBM, the DDR can be integrated in the chip of the memory 102, and the HBM can be packaged together with the network card 103 as an independent chip.
网卡103可以为网络接口卡(network interface card,NIC),该网络设备可以通过网卡103发送数据流,也可以通过网卡103接收数据流。总线104可以是外设部件互连标准(peripheral component interconnect,PCI)总线或扩展工业标准结构(extended industry standard architecture,EISA)总线等。总线104可以分为地址总线、数据总线、控制总线等。为便于表示,图1中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The network card 103 can be a network interface card (NIC), and the network device can send a data stream through the network card 103, and can also receive a data stream through the network card 103. The bus 104 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus or the like. The bus 104 can be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, only one thick line is used in FIG. 1, but it does not mean that there is only one bus or one type of bus.
进一步的,如图2所示,网卡103可以包括报文写控制器(packet write controller,PWC)、调度器(scheduler,SCH)、报文读控制器(packet read controller,PRC)、片内缓存。其中,该SCH可用于区分输入数据流中的非拥塞(non-congested,NC)流和拥塞(congested,CG)流,比如,根据端口、用户、实时队列长度和队列调度优先级、以及缓存占用状态等。该PWC可用于根据该SCH的调度将输入的数据流写入片外缓存或者片内缓存,该片外缓存(比如,DDR或者HBM)与网卡103耦合,比如,该PWC可以将非拥塞流写入片内缓存、将拥塞流写入片外缓存。该PRC中可以包括第一通道CH1和第二通道CH2,CH1的优先级可以高于CH2的优先级,该PWC可用于根据该SCH的调度从片外缓存和片内缓存中按照先入先出(first in first out,FIFO)的顺序读取数据流,并通过CH1和CH2输出数据流,图2中的CG-FIFO可以表示拥塞流在缓存中的存储指针,NC-FIFO可以表示非拥塞流在缓存中的存储指针,CG-FIFO和NC-FIFO具体可以由该SCH发送给该PRC。Further, as shown in FIG. 2, the network card 103 may include a packet write controller (packet write controller, PWC), a scheduler (scheduler, SCH), a packet read controller (packet read controller, PRC), an on-chip cache . Among them, the SCH can be used to distinguish non-congested (NC) flows and congested (congested, CG) flows in the input data flow, for example, according to ports, users, real-time queue length and queue scheduling priority, and buffer occupancy status, etc. The PWC can be used to write the input data stream into the off-chip buffer or on-chip buffer according to the scheduling of the SCH. The off-chip buffer (eg, DDR or HBM) is coupled to the network card 103. For example, the PWC can write the non-congested stream to Enter the on-chip cache and write the congested stream to the off-chip cache. The PRC may include a first channel CH1 and a second channel CH2, the priority of CH1 may be higher than that of CH2, and the PWC may be used to select the off-chip buffer and the on-chip buffer according to the SCH scheduling according to the first-in, first-out ( First in first out, FIFO) reads the data stream sequentially, and outputs the data stream through CH1 and CH2. The CG-FIFO in Figure 2 can represent the storage pointer of the congested stream in the cache, and the NC-FIFO can represent the non-congested stream in the buffer. The storage pointers in the buffer, the CG-FIFO and the NC-FIFO can be specifically sent to the PRC by the SCH.
本领域技术人员可以理解的是,图1示出的网络设备和图2所示的网卡并不构成对网络设备结构和网卡结构的限定。在实际应用中,网络设备和网卡还可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。Those skilled in the art can understand that the network device shown in FIG. 1 and the network card shown in FIG. 2 do not constitute limitations on the structure of the network device and the network card. In practical applications, the network device and the network card may also include more or less components than shown, or combine some components, or arrange different components.
图3为本申请实施例提供的一种数据流传输方法的流程示意图,该方法可应用于网卡中,该网卡与片外缓存耦合,该网卡包括片内缓存、第一通道和第二通道,第一通道的优先级高于第二通道的优先级。参见图3,该方法包括以下步骤。3 is a schematic flowchart of a data stream transmission method provided by an embodiment of the present application, the method can be applied to a network card, the network card is coupled to an off-chip cache, and the network card includes an on-chip cache, a first channel and a second channel, The priority of the first channel is higher than the priority of the second channel. Referring to Figure 3, the method includes the following steps.
S301:接收第一数据流的第一报文,并根据第一数据流的业务类型确定第一数据流为非拥塞流或者拥塞流。S301: Receive a first packet of a first data flow, and determine, according to a service type of the first data flow, that the first data flow is a non-congested flow or a congested flow.
其中,第一数据流可以是指该网卡所在的网络设备中的处理器发送给该网卡的。比如,当该网络设备需要向其他网络设备发送一个或者多个数据流时,该处理器可以向该网卡发送这一个或者多个数据流,从而使得该网卡将这一个或者多个数据流发送给其他网络设备,第一数据流可以是该这一个或者多个数据流中的任一数据流。Wherein, the first data stream may refer to what is sent to the network card by a processor in the network device where the network card is located. For example, when the network device needs to send one or more data streams to other network devices, the processor can send the one or more data streams to the network card, so that the network card can send the one or more data streams to For other network devices, the first data stream may be any one of the one or more data streams.
另外,第一数据流可以包括多个报文(也可以称为数据包),第一报文可以是这多个报文中的任一报文。第一数据流的多个报文中的每个报文均可以包括流标志位,该流标志位可用于指示第一数据流,即第一数据流的每个报文中的流标志位可用于指示该报文是第一数据流的报文。比如,当使用一个数据流的队列索引(即存储该数据流的队列的索引)来标识该数据流时,第一数据流可通过第一队列索引(queue index,QID)来标识,第一数据流的每个报文中的流标志位可以为第一QID。In addition, the first data stream may include multiple packets (also referred to as data packets), and the first packet may be any one of the multiple packets. Each of the multiple packets of the first data stream may include a stream flag bit, and the stream flag bit may be used to indicate the first data stream, that is, the stream flag bit in each packet of the first data stream is available to indicate that the message is a message of the first data stream. For example, when using the queue index of a data stream (that is, the index of the queue storing the data stream) to identify the data stream, the first data stream can be identified by the first queue index (queue index, QID). The flow flag bit in each packet of the flow may be the first QID.
具体的,当该网络设备中的处理器向该网卡发送第一数据流时,该网卡可以接收到第一数据流的一个或者多个报文,第一报文可以是这一个或者多个报文中的任一报文。此外,该网卡可以根据第一数据流的业务类型确定第一数据流是拥塞流或者非拥塞流,具体确定第一数据流是拥塞流或者非拥塞流的步骤可以由图2所示的网卡中的调度器SCH来执行。示例性的,当第一数据流是诸如视频通话、远程操控和自动驾驶等对时延要求比较高的业务的数据流时,该调度器SCH可以确定第一数据流是非拥塞流;当第一数据流是诸如网页浏览和文件下载等对时延和丢包不敏感的业务的数据流时,该调度器SCH可以确定第一数据流是拥塞流。其中,若确定第一数据流是非拥塞流,则执行下述步骤S302a-S303a;若确定第一数据流是拥塞流,则执行下述步骤S302b-S303b。Specifically, when the processor in the network device sends the first data stream to the network card, the network card may receive one or more packets of the first data stream, and the first packet may be the one or more packets. any message in the text. In addition, the network card can determine whether the first data stream is a congested stream or a non-congested stream according to the service type of the first data stream, and the specific step of determining whether the first data stream is a congested stream or a non-congested stream can be performed by the network card shown in FIG. 2 . The scheduler SCH to execute. Exemplarily, when the first data stream is a data stream of services that require relatively high latency, such as video calls, remote control, and automatic driving, the scheduler SCH may determine that the first data stream is a non-congested stream; when the first data stream is a non-congested stream When the data flow is a data flow of services that are not sensitive to delay and packet loss, such as web browsing and file download, the scheduler SCH may determine that the first data flow is a congested flow. Wherein, if it is determined that the first data stream is a non-congested stream, the following steps S302a-S303a are performed; if it is determined that the first data stream is a congested stream, the following steps S302b-S303b are performed.
进一步的,该网卡根据第一数据流的业务类型确定第一数据流为非拥塞流或者拥塞流可以包括:若第一数据流的业务类型为时延要求小于第一时延的业务类型,则确定第一数据流为非拥塞流;若第一数据流的业务类型为时延要求大于第二时延的业务类型,则确定第一数据流为拥塞流,第二时延大于第一时延。进一步的,当该网卡根据第一数据流的业务类型确定第一数据流不是非拥塞流时,该方法还可以包括:该网卡根据第一数据流对应的端口、用户优先级、和/或实时队列长度确定第一数据流是拥塞流或者非拥塞流。比如,若第一数据流对应的端口的传输速率较大、用户优先级较高或者实时队列较短,该网卡可以确定第一数据流为非拥塞流,若第一数据流对应的端口的传输速率较小、用户优先级较低或者实时队列较长,该网卡可以确定第一数据流为拥塞流。Further, the network card determining that the first data flow is a non-congested flow or a congested flow according to the service type of the first data flow may include: if the service type of the first data flow is a service type with a delay requirement less than the first delay, then Determine that the first data flow is a non-congested flow; if the service type of the first data flow is a service type with a delay requirement greater than the second delay, then determine that the first data flow is a congested flow, and the second delay is greater than the first delay . Further, when the network card determines that the first data stream is not a non-congested stream according to the service type of the first data stream, the method may further include: the network card determines according to the port, user priority, and/or real-time corresponding to the first data stream. The queue length determines whether the first data flow is a congested flow or a non-congested flow. For example, if the transmission rate of the port corresponding to the first data stream is high, the user priority is high, or the real-time queue is short, the network card can determine that the first data stream is a non-congested stream. If the rate is low, the user priority is low, or the real-time queue is long, the network card may determine that the first data flow is a congested flow.
需要说明的是,该网卡根据第一数据流对应的端口、用户优先级、和/或实时队列长度等信息确定第一数据流是拥塞流或者是非拥塞流的具体过程可以参见相关技术中的描述,本申请实施例对此不作具体限制。It should be noted that, for the specific process of determining whether the first data flow is a congested flow or a non-congested flow according to information such as the port corresponding to the first data flow, the user priority, and/or the real-time queue length, etc., please refer to the description in the related art , which is not specifically limited in the embodiments of the present application.
S302a:若第一数据流为非拥塞流,将第一报文存储在片内缓存中。S302a: If the first data flow is a non-congested flow, store the first packet in the on-chip cache.
具体的,当该网卡中的调度器SCH确定第一数据流是非拥塞流时,该调度器SCH可以向该网卡中的报文写控制器PWC发送第一指示信息,第一指示信息可以用于指示第一数据流是非拥塞流,还可以用于指示第一报文对应的缓存地址。这样,当该报文写控制器PWC接收到第一指示信息时,可以根据该缓存地址将第一报文存储在片内缓存中。进一步的,当该网卡接收到第一数据流的其他报文时,该网卡也可以按照 上述方式将该其他报文也存储在片内缓存中。也即是,当第一数据流为非拥塞流时,该网卡可以将接收到的第一数据流的报文存储在片内缓存中。Specifically, when the scheduler SCH in the network card determines that the first data stream is a non-congested stream, the scheduler SCH can send first indication information to the packet writing controller PWC in the network card, and the first indication information can be used for Indicating that the first data flow is a non-congested flow can also be used to indicate a cache address corresponding to the first packet. In this way, when the message writing controller PWC receives the first indication information, it can store the first message in the on-chip cache according to the cache address. Further, when the network card receives other messages of the first data stream, the network card can also store the other messages in the on-chip cache according to the above method. That is, when the first data flow is a non-congested flow, the network card can store the received packets of the first data flow in the on-chip cache.
S303a:在触发第一数据流的调度指令时,从片内缓存中读取第一数据流的第一报文并通过第一通道输出。S303a: When the scheduling instruction of the first data stream is triggered, read the first packet of the first data stream from the on-chip buffer and output it through the first channel.
其中,第一数据流的调度指令可以由该网卡中的调度器SCH触发并发送给该网卡中的报文读取控制器PRC,该调度指令可用于调度该报文读取控制器PRC读取第一数据流的报文,第一数据流的调度指令中可以携带第一数据流在片内缓存中的存储地址或者存储指针。Wherein, the scheduling instruction of the first data stream can be triggered by the scheduler SCH in the network card and sent to the message reading controller PRC in the network card, and the scheduling instruction can be used to schedule the message reading controller PRC to read In the packet of the first data stream, the scheduling instruction of the first data stream may carry the storage address or storage pointer of the first data stream in the on-chip cache.
具体的,当该网卡中的调度器SCH触发第一数据流的调度指令,并将该调度指令发送给该报文读取控制器PRC时,该报文读取控制器PRC可以基于该调度指令从片内缓存中读取第一数据流的报文(包括第一报文),若片内缓存中包括第一数据流的多个报文,则该报文读取控制器PRC可以按照先入先出FIFO的顺序依次读取该多个报文,并存放在第一通道中,以通过第一通道将该多个报文输出。第一通道的优先级高于第二通道的优先级,这样该网卡可以在网络拥塞时可以优先服务第一通道,以保证非拥塞流的报文能够快速地通过第一通道输出,从而使得非拥塞流获取极低时延。Specifically, when the scheduler SCH in the network card triggers the scheduling instruction of the first data stream, and sends the scheduling instruction to the message reading controller PRC, the message reading controller PRC can be based on the scheduling instruction Read the message of the first data stream (including the first message) from the on-chip cache. If the on-chip cache includes multiple messages of the first data stream, the message read controller PRC can read the message according to the first-in The multiple packets are sequentially read in the order of the first-out FIFO, and stored in the first channel, so as to output the multiple packets through the first channel. The priority of the first channel is higher than the priority of the second channel, so that the network card can serve the first channel preferentially when the network is congested, so as to ensure that the packets of the non-congested flow can be quickly output through the first channel, so that the non-congested flow can be quickly output. Congested flow gets extremely low latency.
S302b:若第一数据流为拥塞流,将第一报文存储在片外缓存中。S302b: If the first data flow is a congested flow, store the first packet in the off-chip cache.
具体的,当该网卡中的调度器SCH确定第一数据流是拥塞流时,该调度器SCH可以向该网卡中的报文写控制器PWC发送第二指示信息,第二指示信息可以用于指示第一数据流是拥塞流,还可以用于指示第一报文对应的缓存地址。这样,当该报文写控制器PWC接收到第二指示信息时,可以根据该缓存地址将第二报文存储在片外缓存中。进一步的,当该网卡接收到第一数据流的其他报文时,该网卡也可以按照上述方式将该其他报文也存储在片外缓存中。也即是,当第一数据流为拥塞流时,该网卡可以将接收到的第一数据流的报文存储在片外缓存中。Specifically, when the scheduler SCH in the network card determines that the first data stream is a congested stream, the scheduler SCH can send second indication information to the packet writing controller PWC in the network card, and the second indication information can be used for Indicating that the first data flow is a congested flow may also be used to indicate a cache address corresponding to the first packet. In this way, when the message writing controller PWC receives the second indication information, it can store the second message in the off-chip cache according to the cache address. Further, when the network card receives other packets of the first data stream, the network card may also store the other packets in the off-chip cache according to the above method. That is, when the first data flow is a congested flow, the network card can store the received packets of the first data flow in the off-chip cache.
S303b:在触发第一数据流的调度指令时,从片外缓存中读取第一数据流的第一报文并通过第二通道输出。S303b: When the scheduling instruction of the first data stream is triggered, read the first packet of the first data stream from the off-chip cache and output it through the second channel.
其中,第一数据流的调度指令可以由该网卡中的调度器SCH触发并发送给该网卡中的报文读取控制器PRC,该调度指令可用于调度该报文读取控制器PRC读取第一数据流的报文,第一数据流的调度指令中可以携带第一数据流在片外缓存中的存储地址或者存储指针。Wherein, the scheduling instruction of the first data stream can be triggered by the scheduler SCH in the network card and sent to the message reading controller PRC in the network card, and the scheduling instruction can be used to schedule the message reading controller PRC to read In the packet of the first data stream, the scheduling instruction of the first data stream may carry the storage address or storage pointer of the first data stream in the off-chip cache.
具体的,当该网卡中的调度器SCH触发第一数据流的调度指令,并将该调度指令发送给该报文读取控制器PRC时,该报文读取控制器PRC可以基于该调度指令从片外缓存中读取第一数据流的报文(包括第一报文);若片外缓存中包括第一数据流的多个报文,则该报文读取控制器PRC可以按照先入先出FIFO的顺序依次读取该多个报文以存放在第二通道中,并通过第二通道将该多个报文输出。第二通道的优先级低于第一通道的优先级,这样该网卡可以在网络拥塞时可以优先服务第一通道,以保证非拥塞流中高低优先级和低优先级的数据流均能够被快速输出,从而使得非拥塞流获取极低时延,进而在一定程度上也提高了片内缓存的利用率。Specifically, when the scheduler SCH in the network card triggers the scheduling instruction of the first data stream, and sends the scheduling instruction to the message reading controller PRC, the message reading controller PRC can be based on the scheduling instruction Read the message of the first data stream (including the first message) from the off-chip cache; if the off-chip cache includes multiple messages of the first data stream, the message reading controller PRC can read the message according to the first-in The multiple packets are sequentially read in a first-out FIFO order to be stored in the second channel, and the multiple packets are output through the second channel. The priority of the second channel is lower than the priority of the first channel, so that the network card can serve the first channel preferentially when the network is congested, so as to ensure that the high-low priority and low-priority data flows in the non-congested flow can be quickly output, so that the non-congested flow obtains extremely low latency, which in turn improves the utilization of the on-chip cache to a certain extent.
进一步的,如图4所示,在S302a之后,若第一数据流从非拥塞流转换为拥塞流(比如,第一数据流在前一时间段内被确定为非拥塞流,在后一时间段内被确定为拥 塞流),该网卡还接收到第一数据流的第二报文,则该方法还可以包括S304a,S304a与S303a可以不分先后顺序,图4中以S304a位于S303a之后为例进行说明。Further, as shown in FIG. 4, after S302a, if the first data flow is converted from a non-congested flow to a congested flow (for example, the first data flow is determined to be a non-congested flow It is determined as a congested flow in the segment), and the network card also receives the second message of the first data flow, then the method may also include S304a, and S304a and S303a may be in no particular order. In FIG. 4, S304a is located after S303a as example to illustrate.
S304a:当接收到第一数据流的第二报文时,将第二报文存储在片外缓存中。S304a: When receiving the second packet of the first data stream, store the second packet in the off-chip cache.
具体的,在第一数据流从非拥塞流转换为拥塞流之后,若该网卡接收到第一数据流的第二报文,该网卡可以根据拥塞流的报文存储在片外缓存的原则,将第二报文存储在片外缓存中。比如,当该网卡接收到第一数据流的第二报文时,该网卡中调度器SCH可以向报文写控制器PWC发送第二指示信息,第二指示信息可以用于指示第一数据流是拥塞流,还可以用于指示第二报文对应的缓存地址,这样当该报文写控制器PWC接收到第二指示信息时,可以根据该缓存地址将第二报文存储在片外缓存中。进一步,在该网卡转换为拥塞流之后,若该网卡还接收到第一数据流的其他报文时,该网卡也可以按照上述第二报文对应的方式,将该其他报文也存储在片外缓存中。Specifically, after the first data flow is converted from a non-congested flow to a congested flow, if the network card receives the second packet of the first data flow, the network card can store the packet of the congested flow in the off-chip cache according to the principle, Store the second message in the off-chip cache. For example, when the network card receives the second packet of the first data stream, the scheduler SCH in the network card may send second indication information to the packet writing controller PWC, and the second indication information may be used to indicate the first data stream It is a congested flow, and can also be used to indicate the cache address corresponding to the second packet, so that when the packet writing controller PWC receives the second indication information, it can store the second packet in the off-chip cache according to the cache address. middle. Further, after the network card is converted into a congested stream, if the network card also receives other packets of the first data stream, the network card can also store the other packets in the chip according to the method corresponding to the second packet. in the external cache.
相应的,如图4所示,在触发第一数据流的调度指令之后,即在S303a之后,该方法还可以包括S305a。Correspondingly, as shown in FIG. 4 , after triggering the scheduling instruction of the first data stream, that is, after S303a, the method may further include S305a.
S305a:在第一数据流中序列号小于第二序列号的报文通过第一通道输出之后,从片外缓存中读取第二报文并通过第二通道输出。S305a: After the packet with the sequence number smaller than the second sequence number in the first data stream is output through the first channel, read the second packet from the off-chip cache and output through the second channel.
其中,第一报文可以是第一数据流从非拥塞流转换为拥塞流之前的一个报文,第二报文可以是第一数据流从非拥塞流转换为拥塞流之后的一个报文。第一序列号可用于指示第一报文在第一数据流中的位置(也可以称为发送顺序),第二序列号可用于指示第二报文在第一数据流中的位置。第二报文在第一数据流中的位置位于第一报文之后,即第二序列号大于第一序列号。The first packet may be a packet before the first data flow is converted from a non-congested flow to a congested flow, and the second packet may be a packet after the first data flow is converted from a non-congested flow to a congested flow. The first sequence number may be used to indicate the position of the first packet in the first data stream (may also be referred to as a sending order), and the second sequence number may be used to indicate the position of the second packet in the first data stream. The position of the second packet in the first data stream is located after the first packet, that is, the second sequence number is greater than the first sequence number.
另外,每个报文的序列号可以携带在该报文中,该网卡在接收到每个报文时,可以从每个报文中获取该报文的序列号。比如,该网卡在接收到第一数据流的第一报文时,可以从第一报文中获取第一序列号;在接收到第二报文时,可以从第二报文中获取第二序列号。In addition, the serial number of each packet can be carried in the packet, and when the network card receives each packet, the serial number of the packet can be obtained from each packet. For example, when the network card receives the first packet of the first data stream, it can obtain the first sequence number from the first packet; when receiving the second packet, it can obtain the second sequence number from the second packet. serial number.
具体的,当第一数据流从非拥塞流转换为拥塞流时,该网卡接收到的第一数据流的报文的存储位置也从片内缓存对应切换为片外缓存,且片内缓存中第一数据流的报文的序列号小于片外缓存中第一数据流的报文的序列号。该网卡在调度输出第一数据流时,为了保证第一数据流的报文在输出时不发生乱序,需要保证片内缓存中存储的第一数据流的报文输出之后,再输出片外缓存中存储的第一数据流的报文。因此,该网卡可以在通过第一通道将第一数据流中序列号小于第二序列号的报文输出之后,即将第二报文之前接收到的第一数据流的报文全部输出之后,再从片外缓存中读取第二报文并通过第二通道输出。Specifically, when the first data flow is converted from a non-congested flow to a congested flow, the storage location of the packets of the first data flow received by the network card is also correspondingly switched from the on-chip cache to the off-chip cache, and the on-chip cache is stored in the on-chip cache. The sequence number of the packet of the first data stream is smaller than the sequence number of the packet of the first data stream in the off-chip cache. When the network card schedules the output of the first data stream, in order to ensure that the packets of the first data stream are not out of order during the output, it is necessary to ensure that the packets of the first data stream stored in the on-chip cache are output before outputting the off-chip packets. The message of the first data stream stored in the cache. Therefore, the network card can output all the packets of the first data stream received before the second packet after outputting the packets in the first data stream whose sequence number is smaller than the second sequence number through the first channel. The second packet is read from the off-chip buffer and output through the second channel.
比如,当第一数据流为非拥塞流时,该网卡将接收到的第一数据流的报文packet.1和packet.2存储在片内缓存中,当第一数据流从非拥塞流转换为拥塞流时,该网卡将接收到的第一数据流的报文packet.3存储在片外缓存中。若packet.1和packet.2对应的序列号分别为NO.1和NO.2、packet.3对应的序列号为NO.3,则该网卡在调度输出第一数据流时,可以在第一数据流中序列号小于NO.3的两个报文packet.1和packet.2通过第一通道输出之后,再从片外缓存中读取packet.3以通过第二通道输出。For example, when the first data stream is a non-congested stream, the network card stores the received packets of the first data stream packet.1 and packet.2 in the on-chip cache, and when the first data stream is converted from the non-congested stream When the flow is congested, the network card stores the received packet packet.3 of the first data flow in the off-chip cache. If the serial numbers corresponding to packet.1 and packet.2 are NO.1 and NO.2 respectively, and the serial number corresponding to packet.3 is NO.3, the network card can schedule the output of the first data stream in the first After the two packets, packet.1 and packet.2, whose sequence numbers are smaller than NO.3 in the data stream, are output through the first channel, packet.3 is read from the off-chip cache to be output through the second channel.
可选的,该网卡可以通过分别记录第一通道中第一数据流的报文的输入数量和输 出数量,来确定第一数据流中序列号小于第二序列号的报文是否已通过第一通道输出,即确定第一通道中的第一数据流的报文是否已全部输出。具体的,以第一数据流的第一报文为例,当第一数据流的第一报文输入第一通道时,将第一通道中第一数据流的报文的输入数量加一;当第一报文从第一通道输出时,将第一通道中第一数据流的报文的输出数量加一。示例性的,该网卡中可以包括两个计数器,这两个计数器可以为第一计数器和第二计数器,第一计数器可用于记录第一通道中输入的第一数据流的报文的数量,第二计数器可用于记录第一通道中输出的第一数据流的报文的数量,这两个计数器可以位于该网卡的报文读取控制器PRC中。Optionally, the network card may determine whether the packets with the sequence number smaller than the second sequence number in the first data stream have passed through the first channel by recording the input quantity and output quantity of the packets of the first data stream respectively. Channel output, that is, to determine whether all the packets of the first data stream in the first channel have been output. Specifically, taking the first packet of the first data stream as an example, when the first packet of the first data stream is input to the first channel, the number of input packets of the first data stream in the first channel is increased by one; When the first packet is output from the first channel, the output quantity of the packets of the first data stream in the first channel is increased by one. Exemplarily, the network card may include two counters, the two counters may be a first counter and a second counter, the first counter may be used to record the number of packets of the first data stream input in the first channel, the Two counters may be used to record the number of packets of the first data stream output from the first channel, and the two counters may be located in the packet reading controller PRC of the network card.
此外,当第一数据流从非拥塞流转换为拥塞流,且该网卡接收到转换为拥塞流后的第二报文(比如,第二报文为第一数据流转换为拥塞流后的一个报文)时,该网卡将第二报文输入第二通道时,可以将当前第一通道对应的第一数据流的报文的输入数量携带在第二报文的控制信息(也可以称为随路控制信息)中,第二报文的控制信息携带的输入数量可用于表示第二报文之前对应输入第一通道的第一数据流的报文的数量,也即是,该网卡在第二报文之前接收到的第一数据流的报文的数量。这样,该网卡在通过第二通道输出第二报文之前,可以根据第二报文的控制信息携带的输入数量和当前第一通道对应的输出数量确定第一数据流中序列号小于第二序列号的报文是否已通过第一通道输出;若该输出数量大于或等于第二报文的控制信息携带的输入数量时,则确定第一数据流中序列号小于第二序列号的报文已通过第一通道输出;若该输出数量小于第二报文的控制信息携带的输入数量时,则第一数据流中序列号小于第二序列号的报文未全部通过第一通道输出,此时该网卡可以继续通过第一通道输出第一数据流的报文,直至该输出数量大于或等于第二报文的控制信息携带的输入数量。In addition, when the first data stream is converted from a non-congested stream to a congested stream, and the network card receives a second packet converted to a congested stream (for example, the second packet is a packet after the first data stream is converted to a congested stream) packet), when the network card inputs the second packet into the second channel, it can carry the input quantity of the packets of the first data stream corresponding to the current first channel in the control information of the second packet (also referred to as the control information of the second packet). In the associated control information), the number of inputs carried by the control information of the second message can be used to represent the number of messages corresponding to the first data stream input to the first channel before the second message. The number of packets of the first data flow received before the second packet. In this way, before outputting the second packet through the second channel, the network card can determine that the sequence number in the first data stream is smaller than the second sequence number according to the number of inputs carried in the control information of the second packet and the number of outputs corresponding to the current first channel Whether the packets with the number of the packets have been output through the first channel; if the output quantity is greater than or equal to the input quantity carried by the control information of the second packet, it is determined that the packets with the sequence number smaller than the second sequence number in the first data stream have been Output through the first channel; if the output quantity is less than the input quantity carried by the control information of the second packet, then the packets whose sequence number is smaller than the second sequence number in the first data stream are not all output through the first channel. The network card may continue to output the packets of the first data stream through the first channel until the output quantity is greater than or equal to the input quantity carried by the control information of the second packet.
需要说明的是,第一计数器和第二计数器在计数过程中,存在第一计数器先溢出并翻转为0、而第二计数器仍未溢出的情况,此时根据该输出数量和报文的控制信息携带的输入数量进行判断时,可能会出现报文乱序的问题。为此,本申请实施例中可以在第一计数器的计数满足第一数值(比如,8K)时,可以同时将第一计数器的计数和第二计数器的计数同时减去第二数值(比如,2K),以避免因为计数器的溢出而出现报文乱序的问题。其中,第一数值和第二数值可以是事先设置的,本申请实施例对此不作具体限制。It should be noted that, during the counting process of the first counter and the second counter, there is a situation that the first counter overflows first and rolls over to 0, but the second counter still does not overflow. At this time, according to the output quantity and the control information of the message When judging the number of inputs carried, the problem of out-of-order packets may occur. Therefore, in this embodiment of the present application, when the count of the first counter satisfies the first value (for example, 8K), the count of the first counter and the count of the second counter may be simultaneously subtracted by the second value (for example, 2K). ) to avoid the problem of out-of-order packets due to counter overflow. The first numerical value and the second numerical value may be set in advance, which are not specifically limited in this embodiment of the present application.
进一步的,如图5所示,在S302b之后,若第一数据流从拥塞流转换为非拥塞流(比如,第一数据流在前一时间段内被确定为拥塞流,在后一时间段内被确定为非拥塞流),该网卡还接收到第一数据流的第二报文,则该方法还可以包括S304b,S304b与S303b可以不分先后顺序,图5中以S304b位于S303b之后为例进行说明。Further, as shown in FIG. 5 , after S302b, if the first data flow is converted from a congested flow to a non-congested flow (for example, the first data flow is determined to be a congested flow in a is determined to be a non-congested flow), and the network card also receives the second packet of the first data flow, then the method may further include S304b, and S304b and S303b may be in no particular order. In FIG. 5, S304b is located after S303b as example to illustrate.
S304b:当接收到第一数据流的第三报文时,将第三报文存储在片内缓存中。S304b: When the third packet of the first data stream is received, store the third packet in the on-chip cache.
其中,第一报文可以是第一数据流从拥塞流转换为非拥塞流之前的一个报文,第三报文可以是第一数据流从拥塞流转换为非拥塞流之后的一个报文。第一序列号可用于指示第一报文在第一数据流中的位置(也可以称为发送顺序),第三序列号可用于指示第三报文在第一数据流中的位置。第三序列号大于第一序列号可以用于表示第三报文在第一数据流中的位置位于第一报文之后。The first packet may be a packet before the first data flow is converted from a congested flow to a non-congested flow, and the third packet may be a packet after the first data flow is converted from a congested flow to a non-congested flow. The first sequence number may be used to indicate the position of the first packet in the first data stream (it may also be referred to as a sending order), and the third sequence number may be used to indicate the position of the third packet in the first data stream. The third sequence number greater than the first sequence number may be used to indicate that the position of the third packet in the first data stream is located after the first packet.
另外,每个报文的序列号可以携带在该报文中,该网卡在接收到每个报文时,可 以从每个报文中获取该报文的序列号。比如,该网卡在接收到第一数据流的第一报文时,可以从第一报文中获取第一序列号;在接收到第三报文时,可以从第三报文中获取第二序列号。In addition, the serial number of each packet can be carried in the packet, and when the network card receives each packet, the serial number of the packet can be obtained from each packet. For example, when the network card receives the first packet of the first data stream, it can obtain the first sequence number from the first packet; when receiving the third packet, it can obtain the second sequence number from the third packet. serial number.
具体的,在第一数据流从拥塞流转换为非拥塞流之后,若该网卡接收到第一数据流的第三报文,该网卡可以根据非拥塞流的报文存储在片内缓存的原则,将第三报文存储在片内缓存中。比如,当该网卡接收到第一数据流的第三报文时,该网卡中调度器SCH可以向报文写控制器PWC发送第三指示信息,第三指示信息可以用于指示第一数据流是非拥塞流,还可以用于指示第三报文对应的缓存地址,这样当该报文写控制器PWC接收到第三指示信息时,可以根据该缓存地址将第三报文存储在片内缓存中。进一步,在该网卡转换为拥塞流之后,若该网卡还接收到第一数据流的其他报文时,该网卡也可以按照上述第三报文对应的方式,将该其他报文也存储在片内缓存中。Specifically, after the first data flow is converted from a congested flow to a non-congested flow, if the network card receives the third packet of the first data flow, the network card can store the packets of the non-congested flow in the on-chip cache according to the principle of , and store the third message in the on-chip cache. For example, when the network card receives the third packet of the first data stream, the scheduler SCH in the network card may send third indication information to the packet writing controller PWC, and the third indication information may be used to indicate the first data stream It is a non-congested flow, and can also be used to indicate the cache address corresponding to the third packet, so that when the packet writing controller PWC receives the third indication information, it can store the third packet in the on-chip cache according to the cache address. middle. Further, after the network card is converted into a congested stream, if the network card also receives other packets of the first data stream, the network card can also store the other packets in the chip according to the method corresponding to the third packet. in the internal cache.
相应的,如图5所示,在触发第一数据流的调度指令之后,即在S303b之后,该方法还可以包括S305b或S305c。Correspondingly, as shown in FIG. 5 , after triggering the scheduling instruction of the first data stream, that is, after S303b, the method may further include S305b or S305c.
S305b:若第二通道中第一数据流的报文未全部输出,从片内缓存中读取第三报文并通过第二通道输出。S305b: If the packets of the first data stream in the second channel are not all output, read the third packet from the on-chip buffer and output through the second channel.
S305c:若第二通道中第一数据流的报文全部输出,从片内缓存中读取第三报文并通过第一通道输出。S305c: If all the packets of the first data stream in the second channel are output, read the third packet from the on-chip buffer and output through the first channel.
其中,当第一数据流从拥塞流转换为非拥塞流时,该网卡接收到的第一数据流的报文的存储位置也从片外缓存对应切换为片内缓存,且片外缓存中第一数据流的报文的序列号大于片内缓存中第一数据流的报文的序列号。该网卡在调度输出第一数据流时,为了保证第一数据流的报文在输出时不发生乱序,需要保证片外缓存中存储的第一数据流的报文输出之后,再输出片内缓存中存储的第一数据流的报文。因此,该网卡可以在输出第三报文之前,确定第二通道中第一数据流的报文是否已全部输出;若已全部输出则从片内缓存中读取第三报文并通过第一通道输出;若未全部输出则从片内缓存中读取第三报文并通过第二通道输出,读取的第三报文位于第二通道中第一数据流的其他报文(即从片内读取的第一数据流的报文,比如第一报文)之后,这样按照先入先出的顺序,在该其他报文输出之后,第三报文即可通过第二通道输出,从而保证了第一数据流的报文在输出时不发生乱序。Wherein, when the first data flow is converted from a congested flow to a non-congested flow, the storage location of the packets of the first data flow received by the network card is also correspondingly switched from the off-chip cache to the on-chip cache, and the No. The sequence number of the packet of one data stream is greater than the sequence number of the packet of the first data stream in the on-chip cache. When the network card schedules the output of the first data stream, in order to ensure that the packets of the first data stream are not out of order during the output, it needs to ensure that the packets of the first data stream stored in the off-chip buffer are output before outputting the on-chip packets. The message of the first data stream stored in the cache. Therefore, before outputting the third packet, the network card can determine whether all the packets of the first data stream in the second channel have been output; Channel output; if not all output, read the third packet from the on-chip buffer and output through the second channel, the read third packet is located in other packets of the first data stream in the second channel (that is, from the chip After the message of the first data stream read in the internal data stream, such as the first message), according to the order of first-in, first-out, after the other messages are output, the third message can be output through the second channel, so as to ensure Packets with the first data stream are not out of sequence when output.
比如,当第一数据流为拥塞流时,该网卡将接收到的第一数据流的报文packet.1和packet.2存储在片外缓存中,当第一数据流从拥塞流转换为非拥塞流时,该网卡将接收到的第一数据流的报文packet.3存储在片内缓存中。若packet.1和packet.2对应的序列号分别为NO.1和NO.2、packet.3对应的序列号为NO.3,则该网卡在调度输出第一数据流时,可以确定第一数据流中序列号小于NO.3的两个报文packet.1和packet.2是否已全部通过第二通道输出,若已全部输出则从片外缓存中读取packet.3并通过第一通道输出,若未全部输出则从片外缓存中读取packet.3排列在packet.2之后,这样可以在packet.2通过第二通道输出之后,输出packet.3。For example, when the first data flow is a congested flow, the network card stores the received packets packet.1 and packet.2 of the first data flow in the off-chip cache. When the first data flow is converted from a congested flow to a non-congested flow When the flow is congested, the network card stores the received packet packet.3 of the first data flow in the on-chip cache. If the serial numbers corresponding to packet.1 and packet.2 are NO.1 and NO.2 respectively, and the serial number corresponding to packet.3 is NO.3, the network card can determine the first data stream when scheduling the output of the first data stream. Whether the two packets, packet.1 and packet.2, whose serial numbers are less than NO.3 in the data stream, have all been output through the second channel, if they have been output, read packet.3 from the off-chip cache and pass through the first channel Output, if not all output, read packet.3 from the off-chip cache and arrange it after packet.2, so that packet.3 can be output after packet.2 is output through the second channel.
进一步的,第二通道中第一数据流的报文可以对应有输入输出信息,该网卡可以通过记录第二通道中第一数据流的报文的输入输出信息来确定第二通道中第一数据流的报文是否已全部输出,即确定第二通道中第三报文之前接收到的第一数据流的报文 是否已全部输出。Further, the messages of the first data stream in the second channel may correspond to input and output information, and the network card may determine the first data in the second channel by recording the input and output information of the messages of the first data stream in the second channel. Whether all the packets of the flow have been output, that is, it is determined whether all the packets of the first data flow received before the third packet in the second channel have been output.
在一种可能的实施例中,该输入输出信息可以为第二通道中第一数据流的报文数量,以第一数据流的第一报文为例,记录该报文数量的过程可以为:当第一数据流的第一报文输入第二通道时,将第二通道中第一数据流的报文数量加一;当第一报文从第二通道输出时,将该报文数量减一。示例性的,该网卡中可以包括第三计数器,第三计数器可用于记录第二通道中第一数据流的报文数量,比如,第三计数器可以在第一报文进入第二通道时加一,在第一报文从第二通道输出时减一,第三计数器可以位于该网卡的报文读取控制器PRC中;此外,记录的该报文数量可以存储在该网卡包括的存储器中,比如该存储器可以为一个2R2W的存储器,在第三计算器每次将该报文数量加一或者减一之后,该网卡可以根据第三计算器对应的数量来更新该存储器。这样,该网卡在输出第三报文之前,可以读取该存储器中存储的报文数量并进行判断;若该报文数量不为0,则表示第二通道中第一数据流的报文未全部输出,此时从片内缓存中读取第三报文并通过第二通道输出;若该报文数量为0时,则表示第二通道中第一数据流的报文已全部输出,此时从片内缓存中读取第三报文并通过第一通道输出。In a possible embodiment, the input and output information may be the number of packets of the first data stream in the second channel. Taking the first packet of the first data stream as an example, the process of recording the number of packets may be as follows : When the first packet of the first data stream is input to the second channel, add one to the number of packets of the first data stream in the second channel; when the first packet is output from the second channel, add the number of packets to the second channel minus one. Exemplarily, the network card may include a third counter, and the third counter may be used to record the number of packets of the first data flow in the second channel. For example, the third counter may be incremented by one when the first packet enters the second channel. , when the first message is output from the second channel, the third counter can be located in the message reading controller PRC of the network card; in addition, the recorded number of messages can be stored in the memory included in the network card, For example, the memory may be a 2R2W memory, and after the third calculator increases or decreases the number of packets by one each time, the network card may update the memory according to the number corresponding to the third calculator. In this way, before outputting the third packet, the network card can read and judge the number of packets stored in the memory; if the number of packets is not 0, it means that the packets of the first data stream in the second channel are not All output, at this time, the third packet is read from the on-chip cache and output through the second channel; if the number of packets is 0, it means that all the packets of the first data stream in the second channel have been output. When the third message is read from the on-chip cache and output through the first channel.
其中,上述记录该报文数量的方案可以适用于系统规格的数据流的数量较少,以及在处理性能方面只要求一个时钟周期只处理一个报文的场景中。可选的,若系统规格的数据流的数量较大,比如,数据流的数量大于2R2W的存储器的深度,还可以通过哈希算法将多个数据流对应的该报文数量映射在该存储器的同一个条目(entry)中来存储。The above solution of recording the number of packets may be applicable to scenarios where the number of data streams of the system specification is small and only one packet is required to be processed in one clock cycle in terms of processing performance. Optionally, if the number of data streams of the system specification is large, for example, the number of data streams is greater than the depth of the 2R2W memory, the number of packets corresponding to multiple data streams can also be mapped to the memory of the memory through a hash algorithm. stored in the same entry.
在另一种可能的实施例中,该输入输出信息可以包括输入标志位和流标识位,以第一数据流的第一报文为例,记录第一报文的输入输出信息的过程可以为:当第一报文输入第二通道时,将第一报文对应的输入标志位置为有效、流标识位置为第一数据流的流标识;当第一报文从第二通道输出时,将第一报文对应的输入标志位置为无效。示例性的,该网卡中可以包括寄存器组,如图6所示,该寄存器组的结构可以表示为depth*{VLD,QID},即该寄存器组中的每个寄存器可以包括一个输入标志位VLD和一个流标识位QID,enq-addr表示入队指针,deq-addr表示出队指针。具体的,假设第一数据流的流标识表示为QID1,若第一报文对应的入队指针enq-addr在位置1,则在第一报文输入第二通道时,可以与将位置1的寄存器中的VLD置为1(比如,置为1时有效、置为0时无效)、将QID置为QID1,之后该入队指针enq-addr可以加一;若第一报文对应的出队指针deq-addr在位置2,则在第一报文从第二通道输出时,可以将位置2的寄存器中的VLD置为0(比如,置为1时有效、置为0时无效),还可以将QID置为0(可选的),之后该出队指针deq-addr可以加一。这样,该网卡在输出第三报文之前,可以通过该寄存器组中存储的输入信息来判断第二通道中第一数据流的报文是否已全部输出;若该寄存器组(即寄存器组中存储的输入输出信息)中第一数据流的流标识对应的所有输入标志位均为无效时,则确定第二通道中第一数据流的报文全部输出;若该输入输出信息中第一数据流的流标识对应的所有输入标志位中存在有效的输入标志位时,则确定第二通道中第一数据流的报文未全部输出。需要说明的是,入队指针enq-addr和出队指针deq-addr可以从0开始递增,直到递增至该寄存组的深度depth后,再重新从0开始循环。In another possible embodiment, the input and output information may include an input flag bit and a flow flag bit. Taking the first packet of the first data stream as an example, the process of recording the input and output information of the first packet may be as follows : When the first message is input to the second channel, the input flag position corresponding to the first message is set to be valid, and the flow ID position is the flow ID of the first data stream; when the first message is output from the second channel, the The input flag position corresponding to the first packet is invalid. Exemplarily, the network card may include a register group. As shown in FIG. 6 , the structure of the register group may be expressed as depth*{VLD, QID}, that is, each register in the register group may include an input flag bit VLD. And a stream identification bit QID, enq-addr represents the enqueue pointer, and deq-addr represents the dequeue pointer. Specifically, assuming that the stream identifier of the first data stream is represented as QID1, if the enqueue pointer enq-addr corresponding to the first packet is at position 1, when the first packet is input to the second channel, it can be combined with the one whose position is 1 when the first packet is input to the second channel. The VLD in the register is set to 1 (for example, it is valid when set to 1, invalid when set to 0), and QID is set to QID1, and then the enq-addr of the enqueue pointer can be increased by one; if the first message corresponds to the dequeue If the pointer deq-addr is at position 2, when the first message is output from the second channel, the VLD in the register at position 2 can be set to 0 (for example, it is valid when set to 1, invalid when set to 0), and also The QID can be set to 0 (optional), after which the deque-addr can be incremented by one. In this way, before outputting the third packet, the network card can judge whether all the packets of the first data stream in the second channel have been output through the input information stored in the register group; When all the input flag bits corresponding to the stream identifier of the first data stream in the input and output information) are invalid, it is determined that all the messages of the first data stream in the second channel are output; if the first data stream in the input and output information is invalid When there is a valid input flag bit in all the input flag bits corresponding to the stream identifier of , it is determined that the packets of the first data stream in the second channel are not all output. It should be noted that the enqueue pointer enq-addr and the dequeue pointer deq-addr can be incremented from 0 until the depth of the register group is incremented, and then the cycle starts from 0 again.
其中,在通过该寄存器组记录第二通道中存储的每个报文的输入输出信息时,该寄存器组包括的寄存器的数量(也可以称为寄存器组的深度(depth))可以较大,比如该数量可以达到几十万甚至上百万,也可以在满足该网卡的处理性能要求的情况下根据第二通道中所需要存储的报文总数量设置满足该网卡的覆盖片外读延迟即可。可选的,根据不同的性能规格要求以及所使用的片外缓存的最大延迟等计算出该寄存器组所需要的最大深度。在一种示例性中,该寄存器组的深度depth与片外最大读延迟(即片外缓存的最大读延迟)τ、规格要求带宽W和规格要求的满足性能要求时的最小包长L有关。示例性的,depth=τ×W/L,若以τ为4us、规格要求165字节(byte,B)以上达到500Gbps为例,则在W为500Gbps、L为165B×8bits时,depth等于1515。另外,由于第二通路中通常可以拼包使用片外缓存,即将多个报文拼接为一个报文,若按两个报文拼接为一个报文为例,则该depth=1515/2=757.5,即该寄存器组的深度在758以上即可满足性能需求。Wherein, when the input and output information of each message stored in the second channel is recorded through the register group, the number of registers included in the register group (also referred to as the depth of the register group) may be larger, for example The number can reach hundreds of thousands or even millions, or it can be set to meet the off-chip read delay of the network card according to the total number of packets that need to be stored in the second channel under the condition that the processing performance requirements of the network card are met. . Optionally, the required maximum depth of the register group is calculated according to different performance specification requirements and the maximum delay of the used off-chip cache. In an example, the depth of the register group is related to the maximum off-chip read delay (ie the maximum read delay of the off-chip cache) τ, the bandwidth W required by the specification, and the minimum packet length L required by the specification when meeting the performance requirement. Exemplarily, depth=τ×W/L. If τ is 4us and the specification requires 165 bytes (byte, B) or more to reach 500Gbps as an example, then when W is 500Gbps and L is 165B×8bits, depth is equal to 1515 . In addition, in the second channel, off-chip buffering can usually be used to consolidate packets, that is, to concatenate multiple packets into one packet. If two packets are concatenated into one packet as an example, the depth=1515/2=757.5 , that is, the depth of the register group is more than 758 to meet the performance requirements.
进一步的,为防止极端情况下,寄存器组或者存储器占用溢出,还可以增加控制机制,以实时控制寄存器组或者存储器的占用情况,当寄存器组或者存储器的占用超过保护阈值后,可以对控制平面(比如,网卡中的调度器SCH)起反压,避免寄存器组或者存储器的进一步占用。示例性的,以寄存器组为例,该控制机制可以包括:当该寄存器组的占用率大于第一阈值时,减小第二通道中拥塞流的报文的传输量,比如,该网卡中的调度器SCH可以减少拥塞流的调度,以减少该网卡中的报文读控制器PRC从片外缓存中读取的拥塞流的流量,从而减小第二通道中拥塞流的报文的传输量。或者,当该寄存器组的占用率大于第二阈值时,减小第一通道中非拥塞流的报文的传输量,比如,该网卡中的调度器SCH可以减少非拥塞流的调度,以减少该网卡中的报文读控制器PRC从片内缓存中读取的非拥塞流的流量,从而减小第一通道中非拥塞流的报文的传输量,第二阈值大于第一阈值。类似的,该网卡还可以根据片内缓存的占用率、片外缓存的占用率、第一通道的占用率、第二通道的占用率、第一通道对应的NC-FIFO、和/或第二通道对应的CG-FIFO,分别通过不同的阈值来减小拥塞流或非拥塞流的传输量,以实现拥塞流和非拥塞流的传输控制。根据上述方式,通过在持续拥塞或者片外缓存较小或性能不足的情况下,控制拥塞流的传输可以保证非拥塞流的正常传输,从而使得非拥塞流能够持续获得低时延,进而提高用户体验。Further, in order to prevent the overflow of register bank or memory occupancy in extreme cases, a control mechanism can be added to control the occupancy of register bank or memory in real time. When the occupancy of register bank or memory exceeds the protection threshold, the control plane ( For example, the scheduler SCH) in the network card acts as a back pressure to avoid further occupation of the register set or memory. Exemplarily, taking the register group as an example, the control mechanism may include: when the occupancy rate of the register group is greater than the first threshold, reducing the transmission amount of the packets of the congested flow in the second channel, for example, the network card in the The scheduler SCH can reduce the scheduling of the congested flow to reduce the flow of the congested flow read from the off-chip cache by the packet read controller PRC in the network card, thereby reducing the transmission volume of the congested flow in the second channel. . Or, when the occupancy rate of the register group is greater than the second threshold, reduce the transmission volume of the packets of the non-congested flow in the first channel. For example, the scheduler SCH in the network card can reduce the scheduling of the non-congested flow to reduce the The packet reading controller PRC in the network card reads the traffic of the non-congested flow from the on-chip cache, thereby reducing the transmission volume of the non-congested flow in the first channel, and the second threshold is greater than the first threshold. Similarly, the network card can also be based on the occupancy rate of the on-chip cache, the occupancy rate of the off-chip cache, the occupancy rate of the first channel, the occupancy rate of the second channel, the NC-FIFO corresponding to the first channel, and/or the occupancy rate of the second channel. The CG-FIFO corresponding to the channel reduces the transmission amount of the congested flow or the non-congested flow through different thresholds, so as to realize the transmission control of the congested flow and the non-congested flow. According to the above method, the normal transmission of non-congested streams can be ensured by controlling the transmission of congested streams in the case of continuous congestion or small off-chip buffers or insufficient performance, so that non-congested streams can continue to obtain low latency, thereby improving user performance. experience.
在本申请实施例中,当该网卡接收到第一数据流的报文时,若第一数据流为非拥塞流,则将第一数据流的报文存储在片内缓存中,并在调度第一数据流时从片内缓存中读出后通过高优先级的第一通道输出,由于片内缓存的读延迟小,因此可以保证非拥塞流中高优先级和低优先级的数据流均能够被快速输出,从而在一定程度上提高了片内缓存的分配和释放的效率,进而提高片内缓存的利用率。此外,若第一数据流为拥塞流,则将第一数据流的报文存储在片外缓存中,并在调度第一数据流时从片外缓存中读出后通过低优先级的第二通道输出,由于片外缓存的空间较大,从而可以保证对于拥塞流的缓存需求。进一步的,当第一数据流从非拥塞流转换为拥塞流或者从拥塞流转换为非拥塞流时,还可以通过一定的保序逻辑实现同一数据流的多个报文的有序传输,从而提高用户体验。In the embodiment of the present application, when the network card receives the message of the first data flow, if the first data flow is a non-congested flow, the message of the first data flow is stored in the on-chip cache, and is scheduled in the scheduling When the first data stream is read from the on-chip cache, it is output through the high-priority first channel. Since the read delay of the on-chip cache is small, it can ensure that both high-priority and low-priority data streams in non-congested streams can be It is quickly output, thereby improving the allocation and release efficiency of the on-chip cache to a certain extent, thereby improving the utilization of the on-chip cache. In addition, if the first data stream is a congested stream, the packets of the first data stream are stored in the off-chip cache, and are read from the off-chip cache when the first data stream is scheduled and passed through the second low-priority second stream. For channel output, due to the large off-chip buffer space, the buffer requirements for congested flows can be guaranteed. Further, when the first data stream is converted from a non-congested stream to a congested stream or from a congested stream to a non-congested stream, orderly transmission of multiple packets of the same data stream can also be implemented through a certain order-preserving logic. Improve user experience.
上述主要从网卡的角度对本申请实施例提供的方案进行了介绍。可以理解的是, 该网卡为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所公开的实施例描述的各示例的网元及算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。The foregoing mainly introduces the solutions provided by the embodiments of the present application from the perspective of a network card. It can be understood that, in order to realize the above-mentioned functions, the network card includes corresponding hardware structures and/or software modules for executing each function. Those skilled in the art should easily realize that the present application can be implemented in hardware or a combination of hardware and computer software with reference to the network elements and algorithm steps of each example described in the embodiments disclosed herein. Whether a function is performed by hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of this application.
本申请实施例可以根据上述方法示例对网卡进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。需要说明的是,本申请实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。In this embodiment of the present application, the network card may be divided into functional modules according to the foregoing method examples. For example, each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module. The above-mentioned integrated modules can be implemented in the form of hardware, and can also be implemented in the form of software function modules. It should be noted that, the division of modules in the embodiments of the present application is schematic, and is only a logical function division, and there may be other division manners in actual implementation.
在采用对应各个功能划分各个功能模块的情况下,图7示出了上述实施例中所涉及的数据流传输装置的一种可能的结构示意图,该装置可以为网卡,该装置包括:接收单元401、调度单元402、写入单元403和读取单元404。其中,接收单元401用于执行上述方法实施例的S301、接收第一数据流的第二报文和/或第三报文的步骤等;调度单元402用于执行上述方法实施例中确定第一数据流为非拥塞流或者拥塞流、以及触发第一数据流的调度指令的步骤;写入单元403用于执行上述方法实施例中的S302a、S302b、S304a或者S304b中的一个或者多个步骤;读取单元404用于执行上述方法实施例中的S303a、S303b、S305a、S305b或者S305c中的一个或者多个步骤。进一步的,该装置所示的功能结构与图2所示的网卡的各单元之间的对应关系可以为:接收单元401和写入单元403可以对应图2中的报文写控制器PWC,调度单元402可以对应图2中的调度器SCH,读取单元404可以对应图2中的报文读控制器PRC。In the case where each functional module is divided according to each function, FIG. 7 shows a possible schematic structural diagram of the data stream transmission device involved in the above embodiment, the device may be a network card, and the device includes: a receiving unit 401 , scheduling unit 402 , writing unit 403 and reading unit 404 . Wherein, the receiving unit 401 is configured to perform S301 in the above method embodiments, the step of receiving the second packet and/or the third packet of the first data stream, etc.; the scheduling unit 402 is configured to perform the above method embodiments determining the first The data flow is a non-congested flow or a congested flow, and the step of triggering the scheduling instruction of the first data flow; the writing unit 403 is configured to execute one or more steps in S302a, S302b, S304a or S304b in the above method embodiments; The reading unit 404 is configured to perform one or more steps of S303a, S303b, S305a, S305b or S305c in the above method embodiments. Further, the corresponding relationship between the functional structure shown in the device and each unit of the network card shown in FIG. 2 may be: the receiving unit 401 and the writing unit 403 may correspond to the message writing controller PWC in FIG. The unit 402 may correspond to the scheduler SCH in FIG. 2 , and the reading unit 404 may correspond to the message reading controller PRC in FIG. 2 .
在硬件实现上,上述调度单元402、写入单元403和读取单元404可以为处理器,接收单元401可以为接收器,接收器与发送器通常可以构成收发器,该收发器可以称为通信接口。In terms of hardware implementation, the above-mentioned scheduling unit 402, writing unit 403 and reading unit 404 may be processors, the receiving unit 401 may be a receiver, and the receiver and the transmitter may generally constitute a transceiver, which may be called communication interface.
图8所示,为本申请实施例提供的上述实施例中所涉及的数据流传输装置的一种可能的结构示意图,该装置可以为网卡,该装置包括:处理器412、通信接口413、存储器411以及总线414。处理器412、通信接口413以及存储器411通过总线414相互连接。在本申请实施例中,处理器412用于对该装置的动作进行控制管理,例如,处理器412用于执行上述方法实施例中的S302a-S305a、S302b-S305c,和/或用于本文所描述的技术的其他过程。通信接口413用于支持该装置进行通信,比如,支持该装置接收第一报文、第二报文和/或第三报文等。存储器411,用于存储该装置的程序代码和数据,比如,存储器411可用于存储该网卡接收到的数据流的报文。As shown in FIG. 8, a possible schematic structural diagram of the data stream transmission device involved in the above embodiment provided by the embodiment of the present application, the device may be a network card, and the device includes: a processor 412, a communication interface 413, a memory 411 and bus 414. The processor 412 , the communication interface 413 , and the memory 411 are connected to each other through a bus 414 . In this embodiment of the present application, the processor 412 is configured to control and manage the actions of the device. For example, the processor 412 is configured to execute S302a-S305a, S302b-S305c in the above method embodiments, and/or used in the methods described herein. Other procedures of the described technique. The communication interface 413 is used to support the device to communicate, for example, to support the device to receive the first message, the second message and/or the third message, and the like. The memory 411 is used to store the program codes and data of the device. For example, the memory 411 may be used to store the packets of the data stream received by the network card.
其中,处理器412可以是微处理器、专用集成电路,现场可编程门阵列或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。其可以实现或执行结合本申请公开内容所描述的各种示例性的逻辑方框,模块和电路。所述处理器也可以是实现计算功能的组合,例如包含一个或多个微处理器组合,数字信号处理器和微处理器的组合等等。总线414可以是外设部件互连标准(peripheral component interconnect,PCI)总线或扩展工业标准结构(extended industry standard architecture, EISA)总线等。The processor 412 may be a microprocessor, an application specific integrated circuit, a field programmable gate array or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute the various exemplary logical blocks, modules and circuits described in connection with this disclosure. The processor may also be a combination that performs computing functions, such as a combination comprising one or more microprocessors, a combination of a digital signal processor and a microprocessor, and the like. The bus 414 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus or the like.
在本申请实施例中,当该网卡接收到第一数据流的报文时,若第一数据流为非拥塞流,则将第一数据流的报文存储在片内缓存中,并在调度第一数据流时从片内缓存中读出后通过高优先级的第一通道输出,由于片内缓存的读延迟小,因此可以保证非拥塞流中高优先级和低优先级的数据流均能够被快速输出,从而在一定程度上提高了片内缓存的分配和释放的效率,进而提高片内缓存的利用率。此外,若第一数据流为拥塞流,则将第一数据流的报文存储在片外缓存中,并在调度第一数据流时从片外缓存中读出后通过低优先级的第二通道输出,由于片外缓存的空间较大,从而可以保证对于拥塞流的缓存需求。In the embodiment of the present application, when the network card receives the message of the first data flow, if the first data flow is a non-congested flow, the message of the first data flow is stored in the on-chip cache, and is scheduled in the scheduling When the first data stream is read from the on-chip cache, it is output through the high-priority first channel. Since the read delay of the on-chip cache is small, it can ensure that both high-priority and low-priority data streams in non-congested streams can be It is quickly output, thereby improving the allocation and release efficiency of the on-chip cache to a certain extent, thereby improving the utilization of the on-chip cache. In addition, if the first data stream is a congested stream, the packets of the first data stream are stored in the off-chip cache, and are read from the off-chip cache when the first data stream is scheduled and passed through the second low-priority second stream. For channel output, due to the large off-chip buffer space, the buffer requirements for congested flows can be guaranteed.
需要说明的是,上述方法实施例涉及的各步骤的所有相关内容均可以援引到对应功能模块的功能描述,在此不再赘述。It should be noted that, all relevant contents of the steps involved in the above method embodiments can be cited in the functional description of the corresponding functional module, which will not be repeated here.
在本申请的另一实施例中,还提供一种芯片,该芯片用于执行本文所提供的数据流传输方法。比如,该芯片可以为图2所示的网卡,或者该芯片包括图7或者图8所示的数据流传输装置。In another embodiment of the present application, a chip is also provided, and the chip is used for executing the data stream transmission method provided herein. For example, the chip may be the network card shown in FIG. 2 , or the chip may include the data stream transmission device shown in FIG. 7 or FIG. 8 .
在本申请的另一实施例中,还提供一种网络设备,该网络设备的结构可以如图1所示,即该网络设备可以包括处理器101和网卡103;其中,处理器101可用于向网卡103发送数据流,网卡103可以为上文所提供的任一种网卡或者数据流传输装置,用于执行本文所提供的数据流传输方法。可选的,该网络设备还可以包括存储器102。In another embodiment of the present application, a network device is also provided, and the structure of the network device may be as shown in FIG. 1 , that is, the network device may include a processor 101 and a network card 103; wherein, the processor 101 may be used to The network card 103 sends the data stream, and the network card 103 can be any of the network cards or data stream transmission devices provided above, and is used to execute the data stream transmission method provided herein. Optionally, the network device may further include a memory 102 .
在本申请的另一实施例中,还提供一种计算机可读存储介质,该计算机可读存储介质中存储有指令,当设备的至少一个处理器执行该指令时,使得该设备执行本文所提供的数据流传输方法。In another embodiment of the present application, a computer-readable storage medium is also provided, and instructions are stored in the computer-readable storage medium, and when at least one processor of a device executes the instructions, the device causes the device to execute the instructions provided herein. data streaming method.
在本申请的另一实施例中,还提供一种计算机程序产品,该计算机程序产品包括计算机执行指令,该计算机执行指令存储在计算机可读存储介质中;设备的至少一个处理器可以从计算机可读存储介质读取该计算机执行指令,至少一个处理器执行该计算机执行指令使得设备实施本文所提供的数据流传输方法。In another embodiment of the present application, a computer program product is also provided, the computer program product includes computer-executable instructions, and the computer-executable instructions are stored in a computer-readable storage medium; at least one processor of the device can be obtained from a computer-readable storage medium. Reading the storage medium reads the computer-executable instructions, which are executed by at least one processor to cause a device to implement the data streaming methods provided herein.
最后应说明的是:以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。Finally, it should be noted that: the above are only specific embodiments of the present application, but the protection scope of the present application is not limited to this, and any changes or replacements within the technical scope disclosed in the present application should be covered by the present application. within the scope of protection of the application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims (22)

  1. 一种数据流传输方法,其特征在于,应用于网卡中,所述网卡与片外缓存耦合,所述网卡包括片内缓存、第一通道和第二通道,所述第一通道的优先级高于所述第二通道的优先级,所述方法包括:A data stream transmission method, characterized in that it is applied to a network card, the network card is coupled to an off-chip cache, the network card includes an on-chip cache, a first channel and a second channel, and the first channel has a higher priority Regarding the priority of the second channel, the method includes:
    接收第一数据流的第一报文,并根据所述第一数据流的业务类型确定所述第一数据流为非拥塞流或者拥塞流;receiving the first packet of the first data flow, and determining that the first data flow is a non-congested flow or a congested flow according to the service type of the first data flow;
    若所述第一数据流为所述非拥塞流,将所述第一报文存储在所述片内缓存中,并在触发所述第一数据流的调度指令时,从所述片内缓存中读取所述第一数据流的所述第一报文并通过所述第一通道输出;If the first data stream is the non-congested stream, store the first packet in the on-chip cache, and when triggering the scheduling instruction of the first data stream, store the first packet from the on-chip cache read the first message of the first data stream and output it through the first channel;
    若所述第一数据流为所述拥塞流,将所述第一报文存储在所述片外缓存中,并在触发所述第一数据流的调度指令时,从所述片外缓存中读取所述第一数据流的所述第一报文并通过所述第二通道输出。If the first data stream is the congested stream, the first packet is stored in the off-chip cache, and when the scheduling instruction of the first data stream is triggered, the off-chip cache is sent from the off-chip cache. The first packet of the first data stream is read and output through the second channel.
  2. 根据权利要求1所述的方法,其特征在于,当所述第一数据流从所述非拥塞流转换为所述拥塞流时,所述方法还包括:The method of claim 1, wherein when the first data flow is converted from the non-congested flow to the congested flow, the method further comprises:
    当接收到所述第一数据流的第二报文时,将所述第二报文存储在所述片外缓存中,所述第二报文的第二序列号大于所述第一报文的第一序列号;When a second packet of the first data stream is received, the second packet is stored in the off-chip cache, and the second sequence number of the second packet is greater than that of the first packet The first serial number of;
    在所述第一数据流中序列号小于所述第二报文的第二序列号的报文通过所述第一通道输出之后,从所述片外缓存中读取所述第二报文并通过所述第二通道输出。After a packet in the first data stream whose sequence number is smaller than the second sequence number of the second packet is output through the first channel, the second packet is read from the off-chip cache, and output through the second channel.
  3. 根据权利要求2所述的方法,其特征在于,所述方法还包括:The method according to claim 2, wherein the method further comprises:
    当所述第一数据流的第一报文输入所述第一通道时,将所述第一通道中所述第一数据流的报文的输入数量加一;When the first packet of the first data stream is input to the first channel, add one to the input number of packets of the first data stream in the first channel;
    当所述第一报文从所述第一通道输出时,将所述第一通道中所述第一数据流的报文的输出数量加一;When the first packet is output from the first channel, add one to the output number of packets of the first data stream in the first channel;
    当所述第二报文输入所述第二通道时,将所述输入数量携带在所述第二报文的控制信息中;When the second packet is input to the second channel, the input quantity is carried in the control information of the second packet;
    其中,当所述输出数量大于或等于所述第二报文的控制信息携带的所述输入数量时,所述第一数据流中序列号小于所述第二序列号的报文已通过所述第一通道输出。Wherein, when the output quantity is greater than or equal to the input quantity carried in the control information of the second packet, the packet with the sequence number smaller than the second sequence number in the first data stream has passed the The first channel output.
  4. 根据权利要求1所述的方法,其特征在于,当所述第一数据流从所述拥塞流转换为所述非拥塞流时,所述方法还包括:The method according to claim 1, wherein when the first data flow is converted from the congested flow to the non-congested flow, the method further comprises:
    当接收到所述第一数据流的第三报文时,将所述第三报文存储在所述片内缓存中;When receiving the third packet of the first data stream, storing the third packet in the on-chip cache;
    若所述第二通道中所述第一数据流的报文未全部输出,从所述片内缓存中读取所述第三报文并通过所述第二通道输出;If not all the packets of the first data stream in the second channel are output, read the third packet from the on-chip buffer and output through the second channel;
    若所述第二通道中所述第一数据流的报文全部输出,从所述片内缓存中读取所述第三报文并通过所述第一通道输出。If all the packets of the first data stream in the second channel are output, the third packet is read from the on-chip buffer and output through the first channel.
  5. 根据权利要求4所述的方法,其特征在于,所述第二通道中所述第一数据流的每个报文对应一个输入输出信息,所述方法还包括:The method according to claim 4, wherein each packet of the first data stream in the second channel corresponds to one input and output information, and the method further comprises:
    当所述第一数据流的第一报文输入所述第二通道或从所述第二通道输出时,记录所述第一报文的输入输出信息,所述输入输出信息用于确定所述第二通道中的所述第 一数据流的报文是否全部输出。When the first packet of the first data stream is input to or output from the second channel, the input and output information of the first packet is recorded, and the input and output information is used to determine the Whether all the packets of the first data flow in the second channel are output.
  6. 根据权利要求5所述的方法,其特征在于,所述输入输出信息为所述第二通道中所述第一数据流的报文数量,所述当所述第一数据流的第一报文输入所述第二通道或从所述第二通道输出时,记录所述第一报文的输入输出信息,包括:The method according to claim 5, wherein the input and output information is the number of packets of the first data stream in the second channel, and when the first packet of the first data stream is When input to the second channel or output from the second channel, record the input and output information of the first packet, including:
    当所述第一数据流的第一报文输入所述第二通道时,将所述报文数量加一;When the first packet of the first data stream is input to the second channel, add one to the number of packets;
    当所述第一数据流的第一报文从所述第二通道输出时,将所述报文数量减一;When the first packet of the first data stream is output from the second channel, reduce the number of packets by one;
    其中,当所述报文数量为0时,所述第二通道中所述第一数据流的报文已全部输出;当所述报文数量不为0时,所述第二通道中所述第一数据流的报文未全部输出。Wherein, when the number of packets is 0, all the packets of the first data stream in the second channel have been output; when the number of packets is not 0, the packets in the second channel are all output. Not all packets of the first data stream are output.
  7. 根据权利要求5所述的方法,其特征在于,所述输入输出信息包括输入标志位和流标识位,所述当所述第一数据流的第一报文输入所述第二通道或从所述第二通道输出时,记录所述第一报文的输入输出信息,包括:The method according to claim 5, wherein the input and output information includes an input flag bit and a stream flag bit, and when the first packet of the first data stream is input to the second channel or from all When the second channel is output, record the input and output information of the first message, including:
    当所述第一数据流的第一报文输入所述第二通道时,将所述第一报文对应的输入标志位置为有效、所述流标识位置为所述第一数据流的流标识;When the first packet of the first data stream is input to the second channel, the input flag position corresponding to the first packet is set to be valid, and the flow ID position is the flow ID of the first data stream ;
    当所述第一数据流的第一报文从所述第二通道输出时,将所述第一报文对应的输入标志位置为无效;When the first packet of the first data stream is output from the second channel, setting the input flag position corresponding to the first packet as invalid;
    其中,当所述输入输出信息中所述第一数据流的流标识对应的所有输入标志位均为无效时,所述第二通道中所述第一数据流的报文全部输出;当所述输入输出信息中所述第一数据流的流标识对应的所有输入标志位中存在有效的输入标志位时,所述第二通道中所述第一数据流的报文未全部输出。Wherein, when all the input flag bits corresponding to the stream identifier of the first data stream in the input and output information are invalid, all the packets of the first data stream in the second channel are output; when the When there are valid input flag bits in all input flag bits corresponding to the flow identifier of the first data stream in the input and output information, not all packets of the first data stream in the second channel are output.
  8. 根据权利要求7所述的方法,其特征在于,所述网卡包括寄存器组,所述寄存器组中的每个寄存器用于存储一个报文的输入输出信息,所述寄存器组的深度与片外最大读延迟、要求带宽和满足要求性能时的最小包长有关。The method according to claim 7, wherein the network card comprises a register group, each register in the register group is used to store the input and output information of a message, and the depth of the register group is the same as the off-chip maximum Read latency, required bandwidth, and minimum packet length to meet required performance are related.
  9. 根据权利要求7所述的方法,其特征在于,所述方法还包括:The method according to claim 7, wherein the method further comprises:
    当所述寄存器组的占用率大于第一阈值时,减小所述第二通道中拥塞流的报文的传输量;When the occupancy rate of the register group is greater than the first threshold, reducing the transmission amount of packets of the congested flow in the second channel;
    当所述寄存器组的占用率大于第二阈值时,减小所述第一通道中非拥塞流的报文的传输量,所述第二阈值大于所述第一阈值。When the occupancy rate of the register group is greater than a second threshold, the transmission amount of the packets of the non-congested flow in the first channel is reduced, and the second threshold is greater than the first threshold.
  10. 根据权利要求1-9任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1-9, wherein the method further comprises:
    根据所述片内缓存的占用率、所述片外缓存的占用率、所述第一通道的占用率和/或所述第二通道的占用率,调节所述拥塞流的传输量和/或所述非拥塞流的传输量。According to the occupancy rate of the on-chip cache, the occupancy rate of the off-chip cache, the occupancy rate of the first channel and/or the occupancy rate of the second channel, the transmission amount of the congested stream and/or the occupancy rate is adjusted. The amount of traffic for the non-congested flow.
  11. 一种数据流传输装置,其特征在于,所述装置与片外缓存耦合,所述装置中包括片内缓存、第一通道和第二通道,所述第一通道的优先级高于所述第二通道的优先级,所述装置还包括:A data stream transmission device, characterized in that the device is coupled to an off-chip cache, the device includes an on-chip cache, a first channel and a second channel, the first channel has a higher priority than the first channel Two-channel priority, the device further includes:
    接收单元,用于接收第一数据流的第一报文;a receiving unit, configured to receive the first message of the first data stream;
    调度单元,用于根据所述第一数据流的业务类型,确定所述第一数据流为非拥塞流或者为拥塞流;a scheduling unit, configured to determine whether the first data flow is a non-congested flow or a congested flow according to the service type of the first data flow;
    写入单元,用于若所述第一数据流为所述非拥塞流,将所述第一报文存储在所述片内缓存中,若所述第一数据流为所述拥塞流,将所述第一报文存储在所述片外缓存中;a writing unit, configured to store the first packet in the on-chip cache if the first data stream is the non-congested stream, and store the first packet in the on-chip cache if the first data stream is the congested stream the first message is stored in the off-chip cache;
    所述调度单元,还用于触发所述第一数据流的调度指令;the scheduling unit, further configured to trigger a scheduling instruction of the first data stream;
    读取单元,用于若所述第一数据流为非拥塞流,从所述片内缓存中读取所述第一数据流的所述第一报文并通过所述第一通道输出,若所述第一数据流为拥塞流,从所述片外缓存中读取所述第一数据流的所述第一报文并通过所述第二通道输出。a reading unit, configured to read the first packet of the first data stream from the on-chip cache and output it through the first channel if the first data stream is a non-congested stream, if The first data stream is a congested stream, and the first packet of the first data stream is read from the off-chip cache and output through the second channel.
  12. 根据权利要求11所述的装置,其特征在于,当所述第一数据流从所述非拥塞流转换为所述拥塞流时:The apparatus of claim 11, wherein when the first data flow is converted from the non-congested flow to the congested flow:
    所述写入单元,还用于当所述接收单元接收到所述第一数据流的第二报文时,将所述第二报文存储在所述片外缓存中,所述第二报文的第二序列号大于所述第一报文的第一序列号;The writing unit is further configured to store the second packet in the off-chip cache when the receiving unit receives the second packet of the first data stream, and the second packet is stored in the off-chip cache. The second sequence number of the message is greater than the first sequence number of the first message;
    所述读取单元,还用于在所述第一数据流中序列号小于所述第二序列号的报文所述第一通道输出之后,从所述片外缓存中读取所述第二报文并通过所述第二通道输出。The reading unit is further configured to read the second data stream from the off-chip cache after the first channel of the message whose serial number is smaller than the second serial number is output from the first data stream. The message is output through the second channel.
  13. 根据权利要求12所述的装置,其特征在于,所述装置还包括:The apparatus of claim 12, wherein the apparatus further comprises:
    第一计数器,用于当所述第一数据流的第一报文输入所述第一通道时,将所述第一通道中所述第一数据流的报文的输入数量加一;a first counter, configured to add one to the input number of the packets of the first data stream in the first channel when the first packet of the first data stream is input to the first channel;
    第二计数器,用于当所述第一报文从所述第一通道输出时,将所述第一通道中所述第一数据流的报文的输出数量加一;a second counter, configured to add one to the output quantity of the packets of the first data stream in the first channel when the first packet is output from the first channel;
    当所述第二报文输入所述第二通道时,将所述输入数量携带在所述第二报文的控制信息中;When the second packet is input to the second channel, the input quantity is carried in the control information of the second packet;
    其中,当所述输出数量大于或等于所述第二报文的控制信息携带的所述输入数量时,所述第一数据流中序列号小于所述第二序列号的报文已通过所述第一通道输出。Wherein, when the output quantity is greater than or equal to the input quantity carried by the control information of the second packet, the packet with the sequence number smaller than the second sequence number in the first data stream has passed the The first channel output.
  14. 根据权利要求11所述的装置,其特征在于,当所述第一数据流从所述拥塞流转换为所述非拥塞流时:The apparatus of claim 11, wherein when the first data flow is converted from the congested flow to the non-congested flow:
    所述写入单元,还用于当所述接收单元接收到所述第一数据流的第三报文时,将所述第三报文存储在所述片内缓存中;The writing unit is further configured to store the third packet in the on-chip cache when the receiving unit receives the third packet of the first data stream;
    所述读取单元,还用于若所述第二通道中所述第一数据流的报文未全部输出,从所述片内缓存中读取所述第三报文并通过所述第二通道输出;The reading unit is further configured to read the third packet from the on-chip cache and pass the second packet if the packets of the first data stream in the second channel are not all output. channel output;
    所述读取单元,还用于若所述第二通道中所述第一数据流的报文全部输出,从所述片内缓存中读取所述第三报文并通过所述第一通道输出。The reading unit is further configured to read the third packet from the on-chip cache and pass through the first channel if all the packets of the first data stream in the second channel are output output.
  15. 根据权利要求14所述的装置,其特征在于,所述第二通道中所述第一数据流的每个报文对应一个输入输出信息,所述读取单元还用于:The device according to claim 14, wherein each message of the first data stream in the second channel corresponds to one input and output information, and the reading unit is further configured to:
    当所述第一数据流的第一报文输入所述第二通道或从所述第二通道输出时,记录所述第一报文的输入输出信息,所述输入输出信息用于确定所述第二通道中的所述第一数据流的报文是否全部输出。When the first packet of the first data stream is input to or output from the second channel, the input and output information of the first packet is recorded, and the input and output information is used to determine the Whether all the packets of the first data flow in the second channel are output.
  16. 根据权利要求15所述的装置,其特征在于,所述输入输出信息为所述第二通道中所述第一数据流的报文数量,所述读取单元还用于:The device according to claim 15, wherein the input and output information is the number of packets of the first data stream in the second channel, and the reading unit is further configured to:
    当所述第一数据流的第一报文输入所述第二通道时,将所述报文数量加一;When the first packet of the first data stream is input to the second channel, add one to the number of packets;
    当所述第一数据流的第一报文从所述第二通道输出时,将所述报文数量减一;When the first packet of the first data stream is output from the second channel, reduce the number of packets by one;
    其中,当所述报文数量为0时,所述第二通道中所述第一数据流的报文已全部输出;当所述报文数量不为0时,所述第二通道中所述第一数据流的报文未全部输出。Wherein, when the number of packets is 0, all the packets of the first data stream in the second channel have been output; when the number of packets is not 0, the packets in the second channel are all output. Not all packets of the first data stream are output.
  17. 根据权利要求15所述的装置,其特征在于,所述输入输出信息包括输入标志位和流标识位,所述读取单元还用于:The device according to claim 15, wherein the input and output information includes an input flag bit and a stream flag bit, and the reading unit is further configured to:
    当所述第一数据流的第一报文输入所述第二通道时,将所述第一报文对应的输入标志位置为有效、所述流标识位置为所述第一数据流的流标识;When the first packet of the first data stream is input to the second channel, the input flag position corresponding to the first packet is set to be valid, and the flow ID position is the flow ID of the first data stream ;
    当所述第一数据流的第一报文从所述第二通道输出时,将所述第一报文对应的输入标志位置为无效;When the first packet of the first data stream is output from the second channel, setting the input flag position corresponding to the first packet as invalid;
    其中,当所述输入输出信息中所述第一数据流的流标识对应的所有输入标志位均为无效时,所述第二通道中所述第一数据流的报文全部输出;当所述输入输出信息中所述第一数据流的流标识对应的所有输入标志位中存在有效的输入标志位时,所述第二通道中所述第一数据流的报文未全部输出。Wherein, when all the input flag bits corresponding to the stream identifier of the first data stream in the input and output information are invalid, all the packets of the first data stream in the second channel are output; when the When there are valid input flag bits in all the input flag bits corresponding to the flow identifier of the first data stream in the input and output information, not all packets of the first data stream in the second channel are output.
  18. 根据权利要求17所述的装置,其特征在于,所述装置包括寄存器组,所述寄存器组中的每个寄存器用于存储一个报文的输入输出信息,所述寄存器组的深度与片外最大读延迟、要求带宽和满足要求性能时的最小包长有关。The device according to claim 17, wherein the device comprises a register group, each register in the register group is used to store the input and output information of a message, and the depth of the register group is the same as the off-chip maximum Read latency, required bandwidth, and minimum packet length to meet required performance are related.
  19. 根据权利要求17所述的装置,其特征在于,所述调度单元还用于:The apparatus according to claim 17, wherein the scheduling unit is further configured to:
    当所述寄存器组的占用率大于第一阈值时,减小所述拥塞流的传输量;When the occupancy rate of the register group is greater than the first threshold, reducing the transmission amount of the congested flow;
    当所述寄存器组的占用率大于第二阈值时,减小所述非拥塞流的传输量,所述第二阈值大于所述第一阈值。When the occupancy rate of the register group is greater than a second threshold, the transmission amount of the non-congested flow is reduced, and the second threshold is greater than the first threshold.
  20. 根据权利要求11-19任一项所述的装置,其特征在于,所述调度单元还用于:The device according to any one of claims 11-19, wherein the scheduling unit is further configured to:
    根据所述片内缓存的占用率、所述片外缓存的占用率、所述第一通道的占用率或所述第二通道的占用率中的至少一个项,调节所述拥塞流的传输量和/或所述非拥塞流的传输量。Adjust the transmission amount of the congested stream according to at least one of the occupancy rate of the on-chip cache, the occupancy rate of the off-chip cache, the occupancy rate of the first channel, or the occupancy rate of the second channel and/or the transmission volume of the non-congested flow.
  21. 一种网络设备,其特征在于,所述网络设备包括相互耦合的处理器和网卡,所述处理器包括片外缓存,所述网卡包括权利要求11-20任一项所述的数据流传输装置。A network device, characterized in that the network device includes a processor and a network card that are coupled to each other, the processor includes an off-chip cache, and the network card includes the data stream transmission device according to any one of claims 11-20 .
  22. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有指令,当所述指令被设备运行时,使得所述设备执行如权利要求1-10任一项所述的数据流传输方法。A computer-readable storage medium, wherein instructions are stored on the computer-readable storage medium, and when the instructions are executed by a device, the device is made to execute the method according to any one of claims 1-10. Data streaming method.
PCT/CN2021/077239 2021-02-22 2021-02-22 Data stream transmission method and apparatus, and network device WO2022174444A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2021/077239 WO2022174444A1 (en) 2021-02-22 2021-02-22 Data stream transmission method and apparatus, and network device
CN202180092641.2A CN116889024A (en) 2021-02-22 2021-02-22 Data stream transmission method, device and network equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/077239 WO2022174444A1 (en) 2021-02-22 2021-02-22 Data stream transmission method and apparatus, and network device

Publications (1)

Publication Number Publication Date
WO2022174444A1 true WO2022174444A1 (en) 2022-08-25

Family

ID=82931930

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/077239 WO2022174444A1 (en) 2021-02-22 2021-02-22 Data stream transmission method and apparatus, and network device

Country Status (2)

Country Link
CN (1) CN116889024A (en)
WO (1) WO2022174444A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117134932A (en) * 2023-04-06 2023-11-28 荣耀终端有限公司 Data stream scheduling method and electronic equipment

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07283814A (en) * 1994-04-07 1995-10-27 Matsushita Electric Ind Co Ltd Flow control system
CN101854660A (en) * 2009-03-30 2010-10-06 大唐移动通信设备有限公司 Congestion control method and device
CN102216911A (en) * 2011-05-31 2011-10-12 华为技术有限公司 Data managing method, apparatus, and data chip
CN102244568A (en) * 2011-06-24 2011-11-16 华南理工大学 Wireless network congestion control method with attached-type cross-layer design
CN103916331A (en) * 2013-01-08 2014-07-09 友讯科技股份有限公司 Connection method for analyzing data packet to select connection path
CN105376172A (en) * 2014-08-29 2016-03-02 华平信息技术股份有限公司 Method for controlling network congestion
CN106851727A (en) * 2017-01-23 2017-06-13 西安电子科技大学 The method that MANET congestion control is realized based on multipath routing protocols
CN107454017A (en) * 2017-06-05 2017-12-08 上海交通大学 Mixed data flow coordinated dispatching method in a kind of cloud data center network
CN109714267A (en) * 2018-12-26 2019-05-03 清华大学 Manage the transfer control method and system of reversed queue
CN111328148A (en) * 2020-03-11 2020-06-23 展讯通信(上海)有限公司 Data transmission method and device
WO2020236293A1 (en) * 2019-05-23 2020-11-26 Cray Inc. Systems and methods for adaptive routing in the presence of persistent flows

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07283814A (en) * 1994-04-07 1995-10-27 Matsushita Electric Ind Co Ltd Flow control system
CN101854660A (en) * 2009-03-30 2010-10-06 大唐移动通信设备有限公司 Congestion control method and device
CN102216911A (en) * 2011-05-31 2011-10-12 华为技术有限公司 Data managing method, apparatus, and data chip
CN102244568A (en) * 2011-06-24 2011-11-16 华南理工大学 Wireless network congestion control method with attached-type cross-layer design
CN103916331A (en) * 2013-01-08 2014-07-09 友讯科技股份有限公司 Connection method for analyzing data packet to select connection path
CN105376172A (en) * 2014-08-29 2016-03-02 华平信息技术股份有限公司 Method for controlling network congestion
CN106851727A (en) * 2017-01-23 2017-06-13 西安电子科技大学 The method that MANET congestion control is realized based on multipath routing protocols
CN107454017A (en) * 2017-06-05 2017-12-08 上海交通大学 Mixed data flow coordinated dispatching method in a kind of cloud data center network
CN109714267A (en) * 2018-12-26 2019-05-03 清华大学 Manage the transfer control method and system of reversed queue
WO2020236293A1 (en) * 2019-05-23 2020-11-26 Cray Inc. Systems and methods for adaptive routing in the presence of persistent flows
CN111328148A (en) * 2020-03-11 2020-06-23 展讯通信(上海)有限公司 Data transmission method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117134932A (en) * 2023-04-06 2023-11-28 荣耀终端有限公司 Data stream scheduling method and electronic equipment

Also Published As

Publication number Publication date
CN116889024A (en) 2023-10-13

Similar Documents

Publication Publication Date Title
US8248930B2 (en) Method and apparatus for a network queuing engine and congestion management gateway
US8218546B2 (en) Interleaved processing of dropped packets in a network device
US8059671B2 (en) Switching device
CN108243116B (en) Flow control method and switching equipment
US20100265954A1 (en) Method, System, and Computer Program Product for High-Performance Bonding Resequencing
US20140098818A1 (en) Internal Cut-Through For Distributed Switches
US20150215226A1 (en) Device and Method for Packet Processing with Memories Having Different Latencies
US8576850B2 (en) Band control apparatus, band control method, and storage medium
EP4175232A1 (en) Congestion control method and device
WO2020134425A1 (en) Data processing method, apparatus, and device, and storage medium
CN110830388B (en) Data scheduling method, device, network equipment and computer storage medium
US8792511B2 (en) System and method for split ring first in first out buffer memory with priority
US8599694B2 (en) Cell copy count
WO2022174444A1 (en) Data stream transmission method and apparatus, and network device
WO2018000820A1 (en) Method and device for queue management
US8879578B2 (en) Reducing store and forward delay in distributed systems
CN114531488A (en) High-efficiency cache management system facing Ethernet exchanger
US8995458B1 (en) Method and apparatus for delay jitter reduction in networking device
WO2022213617A1 (en) Method and apparatus for dynamic traffic shaping
CN115955441A (en) Management scheduling method and device based on TSN queue
US7729259B1 (en) Reducing latency jitter in a store-and-forward buffer for mixed-priority traffic
CN113765796A (en) Flow forwarding control method and device
US8842696B1 (en) Guaranteed rate port scheduler
US20080228823A1 (en) Frame transfer apparatus
CN112737970A (en) Data transmission method and related equipment

Legal Events

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

Ref document number: 21926161

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 202180092641.2

Country of ref document: CN

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21926161

Country of ref document: EP

Kind code of ref document: A1