CN116032861A - Message processing method and device - Google Patents

Message processing method and device Download PDF

Info

Publication number
CN116032861A
CN116032861A CN202310028982.4A CN202310028982A CN116032861A CN 116032861 A CN116032861 A CN 116032861A CN 202310028982 A CN202310028982 A CN 202310028982A CN 116032861 A CN116032861 A CN 116032861A
Authority
CN
China
Prior art keywords
packet
information
memory
descriptor
sending
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN202310028982.4A
Other languages
Chinese (zh)
Other versions
CN116032861B (en
Inventor
龚海东
贾复山
杨八双
王俊杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Centec Communications Co Ltd
Original Assignee
Suzhou Centec Communications Co Ltd
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 Suzhou Centec Communications Co Ltd filed Critical Suzhou Centec Communications Co Ltd
Priority to CN202310028982.4A priority Critical patent/CN116032861B/en
Publication of CN116032861A publication Critical patent/CN116032861A/en
Application granted granted Critical
Publication of CN116032861B publication Critical patent/CN116032861B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本申请提出一种报文处理方法及装置,包括:在信息收发模块接收到报文包时,若收包队列处于非拥挤状态,信息收发模块将报文包的报文头写入第一目标地址段,将报文包的报文主体写入第二目标地址段;信息收发模块将第一地址信息和第二地址信息写入第一目标收包描述符;信息收发模块将第一目标收包描述符标记为占用状态;处理器在按照预设顺序对处于占用状态的收包描述符所对应的报文头进行处理后,基于收包描述符对应的第一地址信息和第二地址信息更新发包队列,以完成报文转发。处理器访问第一存储器的时延小于处理器访问第二存储器的时延。可以降低处理器的访存时延,进而提升整体的转发效率。

Figure 202310028982

This application proposes a message processing method and device, including: when the information sending and receiving module receives the message packet, if the packet receiving queue is not congested, the information sending and receiving module writes the message header of the message packet into the first target address section, write the message body of the message packet into the second target address section; the information sending and receiving module writes the first address information and the second address information into the first target receiving packet descriptor; the information sending and receiving module receives the first target The packet descriptor is marked as occupied; after the processor processes the packet header corresponding to the occupied descriptor in the preset order, based on the first address information and the second address information corresponding to the packet descriptor Update the packet sending queue to complete packet forwarding. The delay for the processor to access the first memory is less than the delay for the processor to access the second memory. It can reduce the memory access delay of the processor, thereby improving the overall forwarding efficiency.

Figure 202310028982

Description

一种报文处理方法及装置A message processing method and device

技术领域technical field

本申请涉及通信技术领域,具体而言,涉及一种报文处理方法及装置。The present application relates to the technical field of communications, and in particular, to a message processing method and device.

背景技术Background technique

随着科学技术的进步,尤其是通信技术的进步,对数据报文的接收、处理和转发越来越受到关注。例如,目前通信技术发展迅速,人们对于通信速率的要求越来越高,需要其具备高速率的特点。极快的网速可以给用户提供高速上传和下载的体验。并且通信网络也将承载越来越多的丰富的业务,在此基础上,必然产生大量的数据流量,对网络转发处理性能提出更高的要求和挑战。With the advancement of science and technology, especially the advancement of communication technology, the receiving, processing and forwarding of data packets has attracted more and more attention. For example, with the rapid development of communication technology at present, people have higher and higher requirements for communication speed, which needs to have the characteristics of high speed. The extremely fast network speed can provide users with high-speed upload and download experience. Moreover, the communication network will also carry more and more rich services. On this basis, a large amount of data traffic will inevitably be generated, which poses higher requirements and challenges to the network forwarding and processing performance.

因此,如何提升网络转发处理性能,成为了本领域技术人员所关注的难题。Therefore, how to improve the performance of network forwarding processing has become a difficult problem that those skilled in the art pay attention to.

发明内容Contents of the invention

本申请的目的在于提供一种报文处理方法及装置,以至少部分改善上述问题。The purpose of the present application is to provide a message processing method and device, so as to at least partially improve the above problems.

为了实现上述目的,本申请实施例采用的技术方案如下:In order to achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:

第一方面,本申请实施例提供一种报文处理方法,应用于报文处理装置,所述报文处理装置包括信息收发模块、处理器、第一存储器以及第二存储器,所述第二存储器中设置有收包队列,所述收包队列包括预先配置的收包描述符,所述方法包括:In the first aspect, the embodiment of the present application provides a message processing method, which is applied to a message processing device, and the message processing device includes an information sending and receiving module, a processor, a first memory, and a second memory, and the second memory A packet receiving queue is set in the packet receiving queue, and the packet receiving queue includes a pre-configured packet receiving descriptor, and the method includes:

在所述信息收发模块接收到报文包时,若所述收包队列处于非拥挤状态,所述信息收发模块将所述报文包的报文头写入第一目标地址段,将所述报文包的报文主体写入第二目标地址段,其中,所述第一目标地址段属于第一存储器,所述第二目标地址段属于第二存储器;When the information transceiver module receives a message packet, if the packet receiving queue is in a non-crowded state, the information transceiver module writes the message header of the message packet into the first target address segment, and writes the The message body of the message packet is written into the second target address segment, wherein the first target address segment belongs to the first memory, and the second target address segment belongs to the second memory;

所述信息收发模块将第一地址信息和第二地址信息写入第一目标收包描述符,其中,所述第一目标收包描述符为收包队列中当前处于空闲状态的任意一个收包描述符,所述第一地址信息为所述报文头的写入地址的标识信息,所述第二地址信息为所述报文主体的写入地址的标识信息;The information transceiving module writes the first address information and the second address information into the first target receiving packet descriptor, wherein the first target receiving packet descriptor is any receiving packet currently in an idle state in the packet receiving queue Descriptor, the first address information is the identification information of the write address of the message header, and the second address information is the identification information of the write address of the message body;

所述信息收发模块将所述第一目标收包描述符标记为占用状态;The information transceiving module marks the first target receiving packet descriptor as an occupied state;

所述处理器在按照预设顺序对处于占用状态的收包描述符所对应的报文头进行处理后,基于所述收包描述符对应的第一地址信息和第二地址信息更新发包队列,以完成报文转发。After the processor processes the packet headers corresponding to the packet receiving descriptors in the occupied state according to a preset order, update the packet sending queue based on the first address information and the second address information corresponding to the packet receiving descriptors, to complete message forwarding.

第二方面,本申请实施例提供一种报文处理方法,应用于报文处理装置,所述报文处理装置包括信息收发模块、处理器、第一存储器以及第二存储器,所述第二存储器中设置有发包队列,所述发包队列包括预先配置的发包描述符,所述方法包括:In the second aspect, the embodiment of the present application provides a message processing method, which is applied to a message processing device, and the message processing device includes an information sending and receiving module, a processor, a first memory, and a second memory, and the second memory A packet sending queue is set in, and the packet sending queue includes a pre-configured packet sending descriptor, and the method includes:

所述处理器对处于占用状态的收包描述符的报文头进行处理后,将所述收包描述符对应的第一地址信息和第二地址信息写入第一目标发包描述符;After the processor processes the packet header of the receiving packet descriptor in the occupied state, writes the first address information and the second address information corresponding to the receiving packet descriptor into the first target sending packet descriptor;

其中,初始写入所述第一目标发包描述符中的第一地址信息属于所述第一存储器,所述第一地址信息为所述收包描述符对应的报文头的写入地址的标识信息,所述第二地址信息为所述收包描述符对应的报文主体的写入地址的标识信息,所述第一目标发包描述符为发包队列中当前处于空闲状态的任意一个发包描述符;Wherein, the first address information initially written into the first target sending packet descriptor belongs to the first memory, and the first address information is an identifier of the writing address of the packet header corresponding to the receiving packet descriptor information, the second address information is the identification information of the write address of the message body corresponding to the packet receiving descriptor, and the first target packet sending descriptor is any packet sending descriptor that is currently idle in the packet sending queue ;

所述处理器将所述第一目标发包描述符调整为占用状态;The processor adjusts the first target send packet descriptor to an occupied state;

所述信息收发模块在所述发包队列处于拥挤状态时,将差额数量的第二目标发包描述符对应的报文头搬移至所述第二存储器,其中,所述第二目标发包描述符为处于占用状态且排序靠后的发包描述符;When the sending packet queue is in a congested state, the information transceiving module moves the message headers corresponding to the second target sending packet descriptor of the difference amount to the second memory, wherein the second target sending packet descriptor is in Sending descriptors that occupy the state and are sorted later;

所述信息收发模块对所述第二目标发包描述符中的第一地址信息进行更新,更新后的第二目标发包描述符中的第一地址信息属于所述第二存储器;The information transceiving module updates the first address information in the second target sending packet descriptor, and the updated first address information in the second target sending packet descriptor belongs to the second memory;

所述信息收发模块基于预设顺序对所述发包队列中处于占用状态的发包描述符进行报文转发。The information transceiving module forwards the packets of the packet sending descriptors in the occupied state in the packet sending queue based on a preset order.

第三方面,本申请实施例提供一种装置,该装置包括:信息收发模块、处理器、第一存储器以及第二存储器,所述装置可以执行上述的报文处理方法。In a third aspect, an embodiment of the present application provides a device, the device includes: an information transceiving module, a processor, a first memory, and a second memory, and the device can execute the above message processing method.

相对于现有技术,本申请实施例所提供的一种报文处理方法及装置,包括:在信息收发模块接收到报文包时,若收包队列处于非拥挤状态,信息收发模块将报文包的报文头写入第一目标地址段,将报文包的报文主体写入第二目标地址段,其中,第一目标地址段属于第一存储器,第二目标地址段属于第二存储器;信息收发模块将第一地址信息和第二地址信息写入第一目标收包描述符,其中,第一目标收包描述符为收包队列中当前处于空闲状态的任意一个收包描述符,第一地址信息为报文头的写入地址的标识信息,第二地址信息为报文主体的写入地址的标识信息;信息收发模块将第一目标收包描述符标记为占用状态;处理器在按照预设顺序对处于占用状态的收包描述符所对应的报文头进行处理后,基于收包描述符对应的第一地址信息和第二地址信息更新发包队列,以完成报文转发。处理器访问第一存储器的时延小于处理器访问第二存储器的时延。可以降低处理器的访存时延,进而提升整体的转发效率。Compared with the prior art, the message processing method and device provided by the embodiment of the present application include: when the information sending and receiving module receives the message packet, if the packet receiving queue is in a non-congested state, the information sending and receiving module sends the message packet The message header of the packet is written into the first target address segment, and the message body of the message packet is written into the second target address segment, wherein the first target address segment belongs to the first memory, and the second target address segment belongs to the second memory ; The information transceiving module writes the first address information and the second address information into the first target receiving packet descriptor, wherein the first target receiving packet descriptor is any receiving packet descriptor currently in an idle state in the packet receiving queue, The first address information is the identification information of the write address of the message header, and the second address information is the identification information of the write address of the message body; the information transceiver module marks the first target receiving packet descriptor as an occupied state; the processor After processing the packet headers corresponding to the packet receiving descriptors in the occupied state according to the preset sequence, the packet sending queue is updated based on the first address information and the second address information corresponding to the packet receiving descriptors, so as to complete packet forwarding. The delay for the processor to access the first memory is less than the delay for the processor to access the second memory. It can reduce the memory access delay of the processor, thereby improving the overall forwarding efficiency.

为使本申请的上述目的、特征和优点能更明显易懂,下文特举较佳实施例,并配合所附附图,作详细说明如下。In order to make the above-mentioned purpose, features and advantages of the present application more comprehensible, preferred embodiments will be described in detail below together with the accompanying drawings.

附图说明Description of drawings

为了更清楚地说明本申请实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本申请的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它相关的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the accompanying drawings used in the embodiments. It should be understood that the following drawings only show some embodiments of the present application, so It should be regarded as a limitation on the scope, and those skilled in the art can also obtain other related drawings based on these drawings without creative work.

图1为本申请实施例提供的报文处理装置的结构示意图;FIG. 1 is a schematic structural diagram of a message processing device provided in an embodiment of the present application;

图2为本申请实施例提供的报文处理方法的流程示意图之一;FIG. 2 is one of the schematic flow charts of the message processing method provided by the embodiment of the present application;

图3为本申请实施例提供的报文处理方法的流程示意图之二;FIG. 3 is the second schematic flow diagram of the message processing method provided by the embodiment of the present application;

图4为本申请实施例提供的报文处理方法的流程示意图之三;FIG. 4 is the third schematic flow diagram of the message processing method provided by the embodiment of the present application;

图5为本申请实施例提供的报文处理方法的流程示意图之四;FIG. 5 is the fourth schematic flow diagram of the message processing method provided by the embodiment of the present application;

图6为本申请实施例提供的报文处理方法的流程示意图之五;FIG. 6 is the fifth schematic flow diagram of the message processing method provided by the embodiment of the present application;

图7为本申请实施例提供的报文处理方法的流程示意图之六。FIG. 7 is a sixth schematic flowchart of a packet processing method provided by an embodiment of the present application.

图中:10-信息收发模块;20-处理器;30-第一存储器;40-第二存储器。In the figure: 10-information transceiver module; 20-processor; 30-first memory; 40-second memory.

具体实施方式Detailed ways

为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。通常在此处附图中描述和示出的本申请实施例的组件可以以各种不同的配置来布置和设计。In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments It is a part of the embodiments of this application, not all of them. The components of the embodiments of the application generally described and illustrated in the figures herein may be arranged and designed in a variety of different configurations.

因此,以下对在附图中提供的本申请的实施例的详细描述并非旨在限制要求保护的本申请的范围,而是仅仅表示本申请的选定实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。Accordingly, the following detailed description of the embodiments of the application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of the application. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of this application.

应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步定义和解释。同时,在本申请的描述中,术语“第一”、“第二”等仅用于区分描述,而不能理解为指示或暗示相对重要性。It should be noted that like numerals and letters denote similar items in the following figures, therefore, once an item is defined in one figure, it does not require further definition and explanation in subsequent figures. Meanwhile, in the description of the present application, the terms "first", "second" and the like are only used to distinguish descriptions, and cannot be understood as indicating or implying relative importance.

需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is a relationship between these entities or operations. There is no such actual relationship or order between them. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.

在本申请的描述中,需要说明的是,术语“上”、“下”、“内”、“外”等指示的方位或位置关系为基于附图所示的方位或位置关系,或者是该申请产品使用时惯常摆放的方位或位置关系,仅是为了便于描述本申请和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此不能理解为对本申请的限制。In the description of the present application, it should be noted that the orientation or positional relationship indicated by the terms "upper", "lower", "inner", "outer" etc. is based on the orientation or positional relationship shown in the drawings, or the The usual orientation or positional relationship of the application product when used is only for the convenience of describing the application and simplifying the description, rather than indicating or implying that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, therefore It should not be construed as a limitation of the application.

在本申请的描述中,还需要说明的是,除非另有明确的规定和限定,术语“设置”、“连接”应做广义理解,例如,可以是固定连接,也可以是可拆卸连接,或一体地连接;可以是机械连接,也可以是电连接;可以是直接相连,也可以通过中间媒介间接相连,可以是两个元件内部的连通。对于本领域的普通技术人员而言,可以具体情况理解上述术语在本申请中的具体含义。In the description of this application, it should also be noted that, unless otherwise clearly stipulated and limited, the terms "setting" and "connection" should be understood in a broad sense, for example, it can be a fixed connection or a detachable connection, or Integral connection; it can be mechanical connection or electrical connection; it can be direct connection or indirect connection through an intermediary, and it can be the internal communication of two components. Those of ordinary skill in the art can understand the specific meanings of the above terms in this application in specific situations.

下面结合附图,对本申请的一些实施方式作详细说明。在不冲突的情况下,下述的实施例及实施例中的特征可以相互组合。Some implementations of the present application will be described in detail below in conjunction with the accompanying drawings. In the case of no conflict, the following embodiments and features in the embodiments can be combined with each other.

本申请实施例提供了一种报文处理装置,例如路由器设备或智能网卡设备。请参照图1,报文处理装置的结构示意图。报文处理装置包括信息收发模块10、处理器20、第一存储器30以及第二存储器40,处理器20分别与信息收发模块10、第一存储器30以及第二存储器40通信连接,信息收发模块10分别与第一存储器30、第二存储器40通信连接。可选地,信息收发模块10、处理器20、第一存储器30以及第二存储器40通过总线连接。第一存储器30例如为静态随机存储器(简称,SRAM),第二存储器40例如为动态随机存取存储器(又称为内存或DRAM),第二存储器40具体可以选择DDR。处理器20访问第一存储器30的时延小于处理器20访问第二存储器40的时延。An embodiment of the present application provides a packet processing device, such as a router device or an intelligent network card device. Please refer to FIG. 1 , which is a schematic structural diagram of a message processing device. The message processing device comprises an information transceiving module 10, a processor 20, a first memory 30 and a second memory 40, and the processor 20 is respectively connected to the information transceiving module 10, the first memory 30 and the second memory 40 in communication, and the information transceiving module 10 They are respectively connected in communication with the first memory 30 and the second memory 40 . Optionally, the information transceiving module 10, the processor 20, the first memory 30 and the second memory 40 are connected through a bus. The first memory 30 is, for example, a static random access memory (SRAM for short), and the second memory 40 is, for example, a dynamic random access memory (also called a memory or DRAM). The second memory 40 may specifically choose DDR. The latency for the processor 20 to access the first memory 30 is less than the latency for the processor 20 to access the second memory 40 .

处理器20可以是中央处理器(Central Processing Unit,简称CPU)、网络处理器(Network Processor,简称NP)等;还可以是数字信号处理器(Digital Signal Processor,简称DSP)、专用集成电路(Application Specific Integrated Circuit,简称ASIC)、现场可编程门阵列(Field-Programmable Gate Array,简称FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。The processor 20 can be a central processing unit (Central Processing Unit, referred to as CPU), a network processor (Network Processor, referred to as NP), etc.; it can also be a digital signal processor (Digital Signal Processor, referred to as DSP), an application-specific integrated circuit (Application Specific Integrated Circuit (ASIC for short), Field Programmable Gate Array (Field-Programmable Gate Array, FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.

信息收发模块10可以是一种硬件设备,例如现场可编程门阵列(Field-Programmable Gate Array,简称FPGA)或网卡。应理解,信息收发模块10可以直接访问第一存储器30和第二存储器40。The information transceiving module 10 may be a hardware device, such as a Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA for short) or a network card. It should be understood that the information transceiving module 10 can directly access the first memory 30 and the second memory 40 .

在一种可选的场景下,本申请实施例提供的报文处理装置的工作流程如下。In an optional scenario, the workflow of the packet processing device provided in the embodiment of the present application is as follows.

第一步,信息收发模块10完成线路侧报文接收和上送;In the first step, the information transceiving module 10 completes the line side message receiving and sending;

第二步,信息收发模块10将报文存入DDR;In the second step, the information transceiver module 10 stores the message into the DDR;

第三步,处理器20通过软件感知报文接收;In the third step, the processor 20 perceives the packet reception through software;

第四步,处理器20通过软件解析报文;In the fourth step, the processor 20 parses the message through software;

第五步,处理器20通过软件进行业务查表;In the fifth step, the processor 20 performs business table lookup through software;

第六步,处理器20通过软件进行业务处理(例如流学习、统计、深度解析、安全策略以及加解密等);In the sixth step, the processor 20 performs business processing through software (such as flow learning, statistics, in-depth analysis, security policies, encryption and decryption, etc.);

第七步,处理器20通过软件进行转发决策(例如确定转发的网口);In the seventh step, the processor 20 performs forwarding decision-making (for example, determining the forwarding network port) through software;

第八步,处理器20通过软件进行报文编辑(例如对报文头进行编辑);In the eighth step, the processor 20 edits the message through software (for example, editing the message header);

第九步,处理器20通过软件下发处理后的报文,通过信息收发模块10完成报文发送。In the ninth step, the processor 20 issues the processed message through the software, and completes the message sending through the information sending and receiving module 10 .

在上述流程中,由于报文接收之后需要基于报文头信息进行识别,再进行软件查表转发。报文头通常在存储器件,比如DDR中,DDR为DRAM中的一种。处理器20(CPU)访问DRAM存在时延,如果需要处理的报文速率较高,比如达到Mpps级别,CPU访存时延是影响转发性能的关键点。In the above process, after the message is received, it needs to be identified based on the message header information, and then the software looks up the table and forwards it. The message header is usually in a storage device, such as DDR, which is a type of DRAM. There is a delay in accessing the DRAM by the processor 20 (CPU). If the packet rate to be processed is high, for example reaching the Mpps level, the CPU access delay is a key point affecting the forwarding performance.

在一种可选的场景下,为了提升转发效率,可以将将部分关键业务卸载到硬件(信息收发模块10)中执行,信息收发模块10完成解析查表报文编辑等事项。In an optional scenario, in order to improve the forwarding efficiency, some key services can be offloaded to the hardware (information transceiving module 10) for execution, and the information transceiving module 10 completes matters such as parsing table lookup messages and editing.

但是,路由器业务规格较大,硬件表项通常存放在SRAM,导致硬件代价较高。并且该方式只能卸载一部分业务,比如接入路由器硬件表项通常在MB(million byte)级别以下,大量的业务表项还是在DDR上,DDR上的表项条目可以轻易达到M/甚至是G级别,大部分业务还是只能上送CPU处理,导致整体的转发效率仍然较低。However, routers have large service specifications, and hardware entries are usually stored in SRAM, resulting in high hardware costs. And this method can only offload some services. For example, the access router hardware entries are usually below the MB (million byte) level, and a large number of service entries are still on the DDR. The entries on the DDR can easily reach M/even G level, most services can only be sent to the CPU for processing, resulting in low overall forwarding efficiency.

为了克服以上问题,本申请实施例提供了一种报文处理方法,其基于前后级第一存储器30和第二存储器40的报文转发架构,配合收包专用的CPU Core进行收包或发包任务分发,可有效提升软转发的整体性能。In order to overcome the above problems, the embodiment of the present application provides a message processing method, which is based on the message forwarding architecture of the front and rear first memory 30 and the second memory 40, and cooperates with the CPU Core dedicated to receiving packets to perform packet receiving or sending tasks Distribution can effectively improve the overall performance of soft forwarding.

在本申请实施例中,第二存储器40中设置有收包队列和发包队列,收包队列包括预先配置的收包描述符,发包队列包括预先配置的发包描述符。In the embodiment of the present application, the second memory 40 is provided with a packet receiving queue and a packet sending queue, the packet receiving queue includes a preconfigured packet receiving descriptor, and the packet sending queue includes a preconfigured packet sending descriptor.

可选地,在第一存储器30设置有队列空间,可以是循环队列(Ring Buffer),用于存储一部分报文包的报文头(header)。Optionally, a queue space is set in the first memory 30, which may be a circular queue (Ring Buffer), and is used to store a header of a part of the packet.

应当理解的是,图1所示的结构仅为报文处理装置的部分的结构示意图,报文处理装置还可包括比图1中所示更多或者更少的组件,或者具有与图1所示不同的配置。图1中所示的各组件可以采用硬件、软件或其组合实现。It should be understood that the structure shown in FIG. 1 is only a schematic structural diagram of a part of the message processing device, and the message processing device may also include more or less components than those shown in FIG. different configurations. Each component shown in Fig. 1 may be implemented by hardware, software or a combination thereof.

本申请实施例提供的一种报文处理方法,可以但不限于应用于图1所示的报文处理装置,具体的流程,请参考图2,报文处理方法包括:S115、S117、S118以及S211,具体阐述如下。A message processing method provided in the embodiment of the present application can be applied to, but not limited to, the message processing device shown in Figure 1. For the specific process, please refer to Figure 2. The message processing method includes: S115, S117, S118, and S211, specifically described as follows.

S115,在信息收发模块接收到报文包时,若收包队列处于非拥挤状态,信息收发模块将报文包的报文头写入第一目标地址段,将报文包的报文主体写入第二目标地址段。S115, when the information sending and receiving module receives the message packet, if the packet receiving queue is in a non-crowded state, the information sending and receiving module writes the message header of the message packet into the first target address segment, and writes the message body of the message packet Enter the second target address segment.

其中,第一目标地址段属于第一存储器,第二目标地址段属于第二存储器。Wherein, the first target address segment belongs to the first memory, and the second target address segment belongs to the second memory.

需要说明的是,在处理器20进行业务处理时,仅需要对报文包中的报文头进行编辑。信息收发模块10将报文包的报文头写入第一存储器30中的第一目标地址段,将报文包的报文主体写入第二存储器40中的第二目标地址段。处理器20在进行处理时,可以直接访问第一存储器30,不需要访问第二存储器40,因为处理器20访问第一存储器30的时延小于处理器20访问第二存储器40的时延。所以通过S115可以降低处理器20的访存时延,进而提升整体的转发效率。It should be noted that when the processor 20 performs service processing, it only needs to edit the packet header in the packet. The information transceiving module 10 writes the packet header into the first target address segment in the first memory 30 , and writes the message body of the packet into the second target address segment in the second memory 40 . When processing, the processor 20 can directly access the first memory 30 without accessing the second memory 40 , because the delay for the processor 20 to access the first memory 30 is shorter than the delay for the processor 20 to access the second memory 40 . Therefore, through S115, the memory access delay of the processor 20 can be reduced, thereby improving the overall forwarding efficiency.

在一种可能的场景下,当报文包较短时,可能进行需要存储对应的报文头,不需要存储报文主体,则可以将第二目标地址段配置为空。In a possible scenario, when the message packet is short, it may be necessary to store the corresponding message header, but the message body does not need to be stored, so the second destination address segment can be configured as empty.

S117,信息收发模块将第一地址信息和第二地址信息写入第一目标收包描述符。S117. The information transceiving module writes the first address information and the second address information into the first target packet receiving descriptor.

其中,第一目标收包描述符为收包队列中当前处于空闲状态的任意一个收包描述符,第一地址信息为报文头的写入地址的标识信息,第二地址信息为报文主体的写入地址的标识信息。Wherein, the first target packet receiving descriptor is any packet receiving descriptor that is currently idle in the packet receiving queue, the first address information is the identification information of the write address of the message header, and the second address information is the message body The identification information of the write address.

可选地,在收包队列中预先配置一定数量的收包描述符,每一个收包描述符均设置有第一字段和第二字段,第一字段用于填写第一地址信息,第二字段用于填写第二地址信息。以使处理器20在进行业务处理时,可以通过第一地址信息获取到收包描述符对应的报文头。第二地址信息用于在转发时获取报文主体(body)。Optionally, a certain number of packet receiving descriptors are pre-configured in the packet receiving queue, and each packet receiving descriptor is set with a first field and a second field, the first field is used to fill in the first address information, and the second field Used to fill in the second address information. So that the processor 20 can obtain the packet header corresponding to the packet receiving descriptor through the first address information when performing service processing. The second address information is used to obtain the message body (body) during forwarding.

可选的,第一地址信息可以是用于存储报文头的存储地址段的起始地址,第二地址信息可以是用于存储报文主体的存储地址段的起始地址。在收包队列处于非拥挤状态的情况下,写入的第一地址信息属于第一存储器30,在收包队列处于拥挤状态的情况下,写入的第一地址信息可能属于第二存储器40,具体请见下文。因为在业务处理的过程中,处理器20并不需要使用报文主体,所以无论收包队列处于什么状态,写入的第二地址信息均属于第二存储器40。Optionally, the first address information may be the start address of the storage address segment used to store the message header, and the second address information may be the start address of the storage address segment used to store the message body. When the packet receiving queue is in a non-congested state, the written first address information belongs to the first memory 30, and when the packet receiving queue is in a crowded state, the written first address information may belong to the second memory 40, See below for details. Since the processor 20 does not need to use the message body during service processing, the written second address information belongs to the second memory 40 no matter what state the packet receiving queue is in.

可选的,信息收发模块10可以访问收包队列,进而知晓收包队列中各个收包描述符的当前状态。可选地,信息收发模块10在确定收包队列中最近一个切换为占用状态的收包描述符后,将排列在其后面的第一个处于空闲状态的收包描述符确定为第一目标收包描述符。Optionally, the information transceiving module 10 may access the packet receiving queue, and then know the current state of each packet receiving descriptor in the packet receiving queue. Optionally, after determining the last packet receiving descriptor in the packet receiving queue that is switched to the occupied state, the information transceiving module 10 determines the first packet receiving descriptor that is in the idle state behind it as the first target receiving descriptor. package descriptor.

可选的,每一个收包描述符均设置有第三字段,第三字段用于存储偏移量,报文头的实际写入地址与存储报文头的存储地址段的起始地址的偏移量。应理解,处理器20在对报文头进行编辑时,报文头的长度可能会发生变化,例如变长或变短,所以需要在存储报文头的存储地址段预留一定的空间,即该偏移量。Optionally, each receiving packet descriptor is provided with a third field, and the third field is used to store the offset, the offset between the actual write address of the message header and the starting address of the storage address segment storing the message header. displacement. It should be understood that when the processor 20 edits the message header, the length of the message header may change, such as becoming longer or shorter, so it is necessary to reserve a certain space in the storage address segment for storing the message header, that is, the offset.

通过将偏移量写入第一目标收包描述符,便于CPU处理时快速确定报文头开始部分。By writing the offset into the first target packet receiving descriptor, it is convenient for the CPU to quickly determine the beginning of the packet header during processing.

可选地,第一偏移量表征报文头的实际写入地址与第一起始地址的偏移量;第二偏移量表征处理后的报文头的实际写入地址与第一起始地址的偏移量。Optionally, the first offset represents the offset between the actual write address of the message header and the first start address; the second offset represents the actual write address of the processed message header and the first start address offset.

S118,信息收发模块将第一目标收包描述符标记为占用状态。S118. The information transceiving module marks the first target packet receiving descriptor as occupied.

可选地,将第一目标收包描述符标记为占用状态的目的是,便于告知处理器20:第一目标收包描述符中地址段所存储的信息需要进行收包处理。Optionally, the purpose of marking the first target packet receiving descriptor as an occupied state is to inform the processor 20 that the information stored in the address segment of the first target packet receiving descriptor needs to be processed for packet receiving.

S211,处理器在按照预设顺序对处于占用状态的收包描述符所对应的报文头进行处理后,基于收包描述符对应的第一地址信息和第二地址信息更新发包队列,以完成报文转发。S211. After the processor processes the packet headers corresponding to the packet receiving descriptors in the occupied state according to the preset sequence, it updates the packet sending queue based on the first address information and the second address information corresponding to the packet receiving descriptors, so as to complete Packet forwarding.

可选地,信息收发模块10在更新完一批收包描述符的状态后,可以向处理器20发送第一类触发指令。处理器20(CPU)可以在收到第一类触发指令时或按照一个周期去确定收包队列中是否有占用状态的收包描述符,若有,则进行处理。Optionally, the information transceiving module 10 may send the first type of trigger instruction to the processor 20 after updating the status of a received packet descriptor. The processor 20 (CPU) can determine whether there is an occupied packet receiving descriptor in the packet receiving queue when receiving the first type of trigger instruction or according to one cycle, and if so, process it.

应理解,处理器20在进行处理时,可以直接访问第一存储器30,不需要访问第二存储器40,因为处理器20访问第一存储器30的时延小于处理器20访问第二存储器40的时延。可以降低处理器20的访存时延,进而提升整体的转发效率。It should be understood that when the processor 20 is processing, it can directly access the first memory 30 without accessing the second memory 40, because the time delay for the processor 20 to access the first memory 30 is shorter than the time for the processor 20 to access the second memory 40 delay. The memory access delay of the processor 20 can be reduced, thereby improving the overall forwarding efficiency.

可选的,基于收包描述符对应的第一地址信息、第二地址信息以及第二偏移量更新发包队列,以完成报文转发。Optionally, the packet sending queue is updated based on the first address information, the second address information and the second offset corresponding to the packet receiving descriptor, so as to complete packet forwarding.

综上所述,本申请实施例提供了一种报文处理方法,包括:在信息收发模块接收到报文包时,若收包队列处于非拥挤状态,信息收发模块将报文包的报文头写入第一目标地址段,将报文包的报文主体写入第二目标地址段,其中,第一目标地址段属于第一存储器,第二目标地址段属于第二存储器;信息收发模块将第一地址信息和第二地址信息写入第一目标收包描述符,其中,第一目标收包描述符为收包队列中当前处于空闲状态的任意一个收包描述符,第一地址信息为报文头的写入地址的标识信息,第二地址信息为报文主体的写入地址的标识信息;信息收发模块将第一目标收包描述符标记为占用状态;处理器在按照预设顺序对处于占用状态的收包描述符所对应的报文头进行处理后,基于收包描述符对应的第一地址信息和第二地址信息更新发包队列,以完成报文转发。处理器访问第一存储器的时延小于处理器访问第二存储器的时延。可以降低处理器的访存时延,进而提升整体的转发效率。To sum up, the embodiment of the present application provides a message processing method, including: when the information sending and receiving module receives the message packet, if the packet receiving queue is in a non-congested state, the information sending and receiving module sends the message of the message packet The header is written into the first target address segment, and the message body of the message packet is written into the second target address segment, wherein the first target address segment belongs to the first memory, and the second target address segment belongs to the second memory; the information transceiver module Write the first address information and the second address information into the first target packet receiving descriptor, wherein the first target packet receiving descriptor is any packet receiving descriptor that is currently idle in the packet receiving queue, and the first address information It is the identification information of the write address of the message header, and the second address information is the identification information of the write address of the message body; the information sending and receiving module marks the first target receiving packet descriptor as an occupied state; After sequentially processing the packet headers corresponding to the packet receiving descriptors in the occupied state, the packet sending queue is updated based on the first address information and the second address information corresponding to the packet receiving descriptors, so as to complete packet forwarding. The delay for the processor to access the first memory is less than the delay for the processor to access the second memory. It can reduce the memory access delay of the processor, thereby improving the overall forwarding efficiency.

可选地,关于在接收到报文时,如何完成报文信息的写入,本申请实施例还提供了一种可选的实施方式,请参考图3,报文处理方法还包括:S111、S112、S113、S114以及S116,具体阐述如下。Optionally, regarding how to complete writing of message information when a message is received, this embodiment of the present application also provides an optional implementation manner, please refer to FIG. 3 , the message processing method further includes: S111, S112, S113, S114 and S116 are specifically described as follows.

S111,在信息收发模块接收到报文包时,信息收发模块确定收包队列是否处于拥挤状态。若是,则执行S113;若否,则执行S112。S111. When the information sending and receiving module receives the packet, the information sending and receiving module determines whether the packet receiving queue is in a crowded state. If yes, execute S113; if not, execute S112.

可选地,在收包队列上可以设置一个状态标识位,用于表征收包队列是否处于拥挤状态,信息收发模块10可以通过读取状态标识位确定其是否处于拥挤状态,不需要重复计算门限比较。Optionally, a status flag can be set on the packet receiving queue to indicate whether the packet receiving queue is in a congested state, and the information transceiving module 10 can determine whether it is in a congested state by reading the status flag, without repeatedly calculating the threshold Compare.

若其处于拥挤状态,表示第一存储器30(SRAM)中存储的报文头信息较多,为了避免过分占用第一存储器30的资源,需要将报文头存储至第二存储器40(内存,DRAM)中,所以执行S113。若处于非拥挤状态,为了节省处理器20在进行业务处理时的访存时延,可以直接将将报文头存储至第一存储器30,即执行S112。If it is in a crowded state, it means that the header information stored in the first memory 30 (SRAM) is more, in order to avoid excessive occupation of the resources of the first memory 30, the header needs to be stored in the second memory 40 (internal memory, DRAM) ), so execute S113. If it is in a non-congested state, in order to save the memory access delay of the processor 20 when performing business processing, the packet header may be directly stored in the first memory 30, that is, S112 is executed.

S112,信息收发模块将第一存储器中的第一目标地址段确定为报文头的写入地址。S112. The information transceiving module determines the first target address segment in the first memory as the write address of the packet header.

可选地,报文处理装置中还设置有地址管理器,地址管理器可以查询收包队列和发包队列,基于其中的收包描述符和发包描述符的状态,确定是否已归还其占用的地址,进而可以确定出第一存储器30中的空闲地址段,将其作为第一目标地址。Optionally, an address manager is also provided in the message processing device, and the address manager can query the packet receiving queue and the packet sending queue, and determine whether the address occupied by it has been returned based on the state of the packet receiving descriptor and the packet sending descriptor therein , and then a free address segment in the first memory 30 can be determined and used as the first target address.

S113,信息收发模块将第二存储器中的第三目标地址段确定为报文头的写入地址。S113. The information transceiving module determines the third target address segment in the second memory as the write address of the packet header.

可选地,地址管理器可以查询收包队列和发包队列,基于其中的收包描述符和发包描述符的状态,确定是否已归还其占用的地址,进而可以确定出第二存储器40中的空闲地址段,将其作为第三目标地址。Optionally, the address manager can query the packet receiving queue and the packet sending queue, and determine whether the occupied address has been returned based on the state of the packet receiving descriptor and the packet sending descriptor therein, and then can determine the idle address in the second memory 40. The address segment is used as the third target address.

S114,信息收发模块将第二存储器中的第二目标地址段确定为报文主体的写入地址。S114. The information transceiving module determines the second target address segment in the second memory as the write address of the message body.

可选地,地址管理器在接收到信息收发模块10对应的地址分发请求时,可以向其发送对应的第一目标地址段、第二目标地址段以及第三目标地址段。Optionally, when the address manager receives the address distribution request corresponding to the information transceiving module 10, it may send the corresponding first target address segment, second target address segment, and third target address segment to it.

需要说明的是S114可以在接收到报文时直接执行,也可以在S112或S113之前执行,也可以与其同步执行,在此并不限定其执行顺序。在执行S112和S114之后,执行S115;在执行S113和S114之后,执行S116。It should be noted that S114 may be executed directly when the message is received, or may be executed before S112 or S113, or may be executed synchronously therewith, and the execution sequence thereof is not limited here. After executing S112 and S114, execute S115; after executing S113 and S114, execute S116.

S116,信息收发模块将报文包的报文头写入第三目标地址段,将报文包的报文主体写入第二目标地址段。S116. The information transceiving module writes the message header of the message packet into the third target address segment, and writes the message body of the message packet into the second target address segment.

应理解,在处于拥挤状态时,信息收发模块10将报文包的报文头写入第三目标地址段,将报文包的报文主体写入第二目标地址段,以避免过多占用第一存储器30中的空间。It should be understood that, when in a crowded state, the information transceiving module 10 writes the message header of the message packet into the third target address segment, and writes the message body of the message packet into the second target address segment, so as to avoid excessive occupation space in the first memory 30 .

在收包队列处于拥挤状态下,关于如何进一步降低时延,本申请实施例还提供了一种可选的实施方式,请参考图4,在收包队列处于拥挤状态的情况下,报文处理方法还包括:S121和S122,具体阐述如下。When the packet receiving queue is in a congested state, regarding how to further reduce the delay, the embodiment of the present application also provides an optional implementation, please refer to Figure 4, in the case of a congested packet receiving queue, the message processing The method also includes: S121 and S122, specifically described as follows.

S121,若处理器将处于占用状态的收包描述符更新为空闲状态,则信息收发模块将第二目标收包描述符所对应的报文头从第二存储器搬移至第一存储器。S121. If the processor updates the packet receiving descriptor in the occupied state to the idle state, the information transceiving module moves the packet header corresponding to the second target packet receiving descriptor from the second memory to the first memory.

其中,第二目标收包描述符为所对应的报文头存储与第二存储器的描述符。Wherein, the second target packet receiving descriptor is a descriptor stored in the corresponding packet header and stored in the second memory.

可选地,处理器20将处于占用状态的收包描述符更新为空闲状态,即处理器20在收包队列处于拥挤状态时归还了任意一个收包描述符,此时可以将第二目标收包描述符所对应的报文头从第二存储器40搬移至第一存储器30。具体地搬移目标地址可以是信息收发模块10向地址管理器请求获取的。Optionally, the processor 20 updates the packet receiving descriptor in the occupied state to the idle state, that is, the processor 20 returns any packet receiving descriptor when the packet receiving queue is in a crowded state, and at this time, the second target receiving The packet header corresponding to the packet descriptor is moved from the second memory 40 to the first memory 30 . Specifically, the transfer target address may be acquired by the information transceiving module 10 upon request from the address manager.

应理解,在搬移后,第二目标收包描述符所对应的报文头在第二存5储器40中的原占用地址就被释放归还了,处于空闲状态。It should be understood that after the move, the original occupied address of the packet header corresponding to the second target receiving packet descriptor in the second memory 40 is released and returned, and is in an idle state.

S122,信息收发模块对第二目标收包描述符中的第一地址信息进行更新。S122. The information transceiving module updates the first address information in the second target packet receiving descriptor.

可选地,将第二目标收包描述符中的第一地址信息由原占用地址的标识信息变更为搬移目标地址的标识信息。Optionally, the first address information in the second target receiving packet descriptor is changed from the identification information of the original occupied address to the identification information of the moving target address.

0应理解,随着处理器20将处于占用状态的收包描述符更新为空闲状态,信息收发模块10会将所有的第二目标收包描述符所对应的报文头从第二存储器40搬移至第一存储器30。所以在处理器20进行业务处理时,始终访问的是第一存储器30,进而可以缩减时延,提升整体转发效率。It should be understood that as the processor 20 updates the receiving packet descriptor in the occupied state to the idle state, the information transceiving module 10 will move the packet headers corresponding to all the second target receiving packet descriptors from the second memory 40 to the first memory 30. Therefore, when the processor 20 performs business processing, it always accesses the first memory 30, thereby reducing the time delay and improving the overall forwarding efficiency.

5应理解,在初始时刻,收包队列处于非拥挤状态,关于收包队列如何切换,本申请实施例还提供了一种可能的实现方式,请参考图5,报文处理方法还包括:S131和S132,具体阐述如下。5. It should be understood that at the initial moment, the packet receiving queue is in a non-congested state. Regarding how to switch the packet receiving queue, this embodiment of the present application also provides a possible implementation. Please refer to FIG. 5. The message processing method also includes: S131 and S132, specifically described as follows.

S131,在收包队列处于非拥挤状态的情况下,信息收发模块在监测量大于预设的第一阈值时,将收包队列标记为拥挤状态。S131. When the packet receiving queue is in a non-congested state, the information transceiving module marks the packet receiving queue as a congested state when the monitored amount is greater than a preset first threshold.

0其中,监测量为收包队列中处于占用状态的收包描述符的数量,或者为第一存储器中存储的报文头的数量,或者为报文包所占用的存储单元的数量。第一阈值可以是全局配置或per队列配置。0 Wherein, the monitoring amount is the number of packet receiving descriptors in the occupied state in the packet receiving queue, or the number of packet headers stored in the first memory, or the number of storage units occupied by the packet. The first threshold can be a global configuration or a per queue configuration.

应理解,在收包队列处于非拥挤状态的情况下,报文头均写入第一存储器30中。It should be understood that, when the packet receiving queue is in a non-congested state, all packet headers are written into the first memory 30 .

S132,在收包队列处于拥挤状态的情况下,信息收发模块在第二存储器中未存储收包描述符对应的报文头时,将收包队列标记为非拥挤状态。S132. When the packet receiving queue is in a congested state, the information transceiving module marks the packet receiving queue as a non-congested state when the packet header corresponding to the packet receiving descriptor is not stored in the second memory.

可选地,在收包队列处于拥挤状态的情况下,新接收到的报文头均写入第二存储器40中,在经过S121的逐次搬移后,当第二存储器40中未存储收包描述符对应的报文头时,将收包队列标记为非拥挤状态。Optionally, when the packet receiving queue is in a congested state, all newly received headers are written into the second memory 40. After the successive moves of S121, when the packet receiving description is not stored in the second memory 40 When the packet header corresponding to the symbol is used, the packet receiving queue is marked as non-congested.

需要说明的是,本申请实施例中报文主体可以存入第二存储器40上的一段连续空间,或者多段空间(地址的link-list)。当存储在多段空间时,收包描述符对应的第二地址信息可以包括多个子信息,每一个子信息分别表示一段空间的标识信息。It should be noted that, in the embodiment of the present application, the message body may be stored in a continuous space on the second memory 40, or in multiple spaces (link-list of addresses). When stored in multiple spaces, the second address information corresponding to the packet receiving descriptor may include a plurality of sub-information, and each sub-information represents identification information of a space.

可选地,在第一存储器30和第二存储器40中按照收包队列设置有对应的RingBuffer用于存放报文头。Ring Buffer可以被划分为预设数量的子段,第一存储器30中的空闲的子段可以作为第一目标地址段,第二存储器40中的空闲的子段可以作为第三目标地址段。本申请实施例中的报文头和报文主体分开存储。每一个子段均设置有一个预留空间(Headroom),即偏移量,在收包写入报文头时,报文头从headroom后开始写入。Optionally, corresponding RingBuffers are set in the first memory 30 and the second memory 40 according to packet receiving queues for storing packet headers. The Ring Buffer can be divided into a preset number of sub-segments, the idle sub-segments in the first memory 30 can be used as the first target address segment, and the idle sub-segments in the second memory 40 can be used as the third target address segment. In this embodiment of the application, the message header and the message body are stored separately. Each sub-section is set with a reserved space (Headroom), that is, the offset. When the packet is received and written to the header, the header is written from the headroom.

可选地,本申请实施例还提供了报文处理方法,请参考图6,报文处理方法还包括:S221、S222、S143、S144以及S146,具体阐述如下。Optionally, the embodiment of the present application further provides a message processing method. Please refer to FIG. 6 . The message processing method further includes: S221, S222, S143, S144, and S146, which are described in detail as follows.

S221,处理器对处于占用状态的收包描述符的报文头进行处理后,将收包描述符对应的第一地址信息和第二地址信息写入第一目标发包描述符。S221. After the processor processes the packet header of the packet receiving descriptor in the occupied state, writes the first address information and the second address information corresponding to the packet receiving descriptor into the first target sending packet descriptor.

其中,初始写入第一目标发包描述符中的第一地址信息属于第一存储器,第二地址信息属于第二存储器,第一地址信息为收包描述符对应的报文头的写入地址的标识信息,第二地址信息为收包描述符对应的报文主体的写入地址的标识信息,第一目标发包描述符为发包队列中当前处于空闲状态的任意一个发包描述符。Wherein, the first address information initially written in the first target sending packet descriptor belongs to the first memory, the second address information belongs to the second memory, and the first address information is the write address of the message header corresponding to the receiving packet descriptor. The identification information, the second address information is the identification information of the write address of the message body corresponding to the receiving packet descriptor, and the first target sending packet descriptor is any sending packet descriptor that is currently idle in the sending packet queue.

可选的,处理器20可以访问发包队列,进而知晓发包队列中各个发包描述符的当前状态。可选地,处理器20在确定发包队列中最近一个切换为占用状态的发包描述符后,将排列在其后面的第一个处于空闲状态的发包描述符确定为第一目标发包描述符。Optionally, the processor 20 may access the packet sending queue, and then know the current state of each packet sending descriptor in the packet sending queue. Optionally, after the processor 20 determines the latest packet sending descriptor switched to the occupied state in the packet sending queue, it determines the first packet sending descriptor that is in the idle state behind it as the first target packet sending descriptor.

可选地,发包描述符也设置有第一字段、第二字段以及第三字段,其作用与上述收包描述符中的第一字段、第二字段以及第三字段相同。Optionally, the packet sending descriptor is also provided with a first field, a second field and a third field, whose functions are the same as those of the first field, second field and third field in the above packet receiving descriptor.

应理解,处理器20最初写入第一目标发包描述符的第一字段中的第一地址信息属于第一存储器。即初始的报文头均存储与第一存储器30中。It should be understood that the first address information initially written by the processor 20 into the first field of the first target send packet descriptor belongs to the first memory. That is, the initial packet headers are all stored in the first memory 30 .

在一种可能的实现方式中,处理器20还会将第二偏移量写入第一目标发包描述符的第三字段。In a possible implementation manner, the processor 20 also writes the second offset into the third field of the first target send packet descriptor.

可选地,处理器20还会将转发决策(转发网口)写入第一目标发包描述符的第四字段。Optionally, the processor 20 also writes the forwarding decision (forwarding network port) into the fourth field of the first target sending packet descriptor.

S222,处理器将第一目标发包描述符调整为占用状态。S222. The processor adjusts the first target sending descriptor to an occupied state.

可选地,将第一目标发包描述符调整为占用状态的目的是,便于告知信息收发模块10:第一目标发包描述符中地址段所存储的信息需要进行发包处理。Optionally, the purpose of adjusting the first target packet sending descriptor to the occupied state is to facilitate notifying the information transceiving module 10 that the information stored in the address segment of the first target sending packet descriptor needs to be sent a packet.

应理解,信息收发模块10会按照发包队列中的排列顺序对处于占用状态的发包描述符进行发包处理。但是信息收发模块10的发包速度可能小于处理器20的收包速度,从可能导致发包队列处于拥挤状态。如果忽略该状态,可能会导致第一存储器30中的空间被过度占用,导致无法将新接收到的报文写入第一存储器30中,使得处理器20无法处理后续的报文。为了克服该问题,需要执行S143。It should be understood that the information transceiving module 10 will perform packet sending processing on the packet sending descriptors in the occupied state according to the order in which they are arranged in the packet sending queue. However, the packet sending speed of the information transceiving module 10 may be lower than the packet receiving speed of the processor 20, which may cause the packet sending queue to be in a congested state. If this state is ignored, the space in the first memory 30 may be over-occupied, resulting in the inability to write a newly received message into the first memory 30, so that the processor 20 cannot process subsequent messages. In order to overcome this problem, it is necessary to execute S143.

S143,信息收发模块在发包队列处于拥挤状态时,将差额数量的第二目标发包描述符对应的报文头搬移至第二存储器。S143. When the packet sending queue is in a crowded state, the information sending and receiving module moves the message headers corresponding to the second target sending packet descriptors with a difference amount to the second memory.

应理解,通过将差额数量的第二目标发包描述符对应的报文头从第一存储器30搬移至第二存储器40。可以释放第一存储器30的空间,用于接收新的报文信息,使得处理器20可以继续处理后续的报文。It should be understood that the packet headers corresponding to the second target sending packet descriptors of the difference amount are moved from the first memory 30 to the second memory 40 . The space of the first memory 30 can be released for receiving new message information, so that the processor 20 can continue to process subsequent messages.

可选地,信息收发模块10在什么情况下,会判断发包队列处于拥挤状态,本申请实施例还提供了一种可能的实现方。信息收发模块10可以按照预定周期对发包队列进行查询,通过轮询的凡是确定其状态。Optionally, under what circumstances will the information transceiving module 10 determine that the packet sending queue is in a congested state, and this embodiment of the present application also provides a possible implementation. The information transceiving module 10 may query the packet sending queue according to a predetermined period, and determine its status by polling everything.

应理解,不停的轮询会占用信息收发模块10的硬件资源,为了避免占用硬件资源,本申请实施例还提供了一种可能的实现方式,可以是处理器20在执行S222,更新发包描述符后,向信息收发模块10发送第二类触发指令,以使信息收发模块10判断发包队列是否处于拥挤状态。It should be understood that non-stop polling will occupy the hardware resources of the information transceiving module 10. In order to avoid occupying hardware resources, the embodiment of the present application also provides a possible implementation method, which may be that the processor 20 is executing S222 to update the packet sending description After the symbol, send the second type of trigger instruction to the information transceiving module 10, so that the information transceiving module 10 can determine whether the packet sending queue is in a crowded state.

在一种可能的场景下,第二类触发指令还包括当前更新的发包描述符的数量;进而信息收发模块10可以基于当前更新数量和原本剩余未发送的发包描述符的数量,确定出差额数量,将排序靠后的差额数量的搬移至第二存储器40。In a possible scenario, the second type of trigger instruction also includes the number of currently updated packet sending descriptors; furthermore, the information transceiving module 10 can determine the amount of difference based on the current update amount and the number of original remaining unsent packet sending descriptors , and move the difference quantity of the lower sort to the second memory 40 .

应理解,搬移的目的地址可以是信息收发模块10向地址管理器发出请求,由地址管理器分配的差额数量的目的地址。It should be understood that the destination address of the transfer may be the destination address of the difference amount allocated by the address manager after the information transceiving module 10 sends a request to the address manager.

S144,信息收发模块对第二目标发包描述符中的第一地址信息进行更新,更新后的第二目标发包描述符中的第一地址信息属于第二存储器。S144. The information transceiving module updates the first address information in the second target packet sending descriptor, and the updated first address information in the second target packet sending descriptor belongs to the second memory.

其中,第二目标发包描述符为处于占用状态且排序靠后的发包描述符。Wherein, the second target packet sending descriptor is a packet sending descriptor that is in an occupied state and is sorted lower.

应理解,为了保障发包内容的正确性,需要对第二目标发包描述符中的第一地址信息进行更新,具体地,将用新分配的目的地址替换其中第一字段中原始的第一地址信息,更新后的第二目标发包描述符中的第一地址信息属于第二存储器。It should be understood that in order to ensure the correctness of the content of the packet, the first address information in the second target packet descriptor needs to be updated, specifically, the original first address information in the first field will be replaced with the newly allocated destination address , the updated first address information in the second target sending packet descriptor belongs to the second memory.

可选地,在完成更新后,可以释放第一存储器30的空间,原占用的地址空间就变为空闲可用状态,地址管理器可以再次对其进行分配。例如用于接收新的报文信息,使得处理器20可以继续处理后续的报文。Optionally, after the update is completed, the space of the first memory 30 may be released, and the originally occupied address space becomes free and available, and the address manager may allocate it again. For example, it is used to receive new message information, so that the processor 20 can continue to process subsequent messages.

S146,信息收发模块基于预设顺序对发包队列中处于占用状态的发包描述符进行报文转发。S146. The information transceiving module forwards the packets of the packet sending descriptors in the occupied state in the packet sending queue based on the preset sequence.

可选地,在完成报文转发后,可以归还对应的第一存储器30或第二存储器40中的占用空间,原占用的地址空间就变为空闲可用状态,地址管理器可以再次对其进行分配。Optionally, after the message forwarding is completed, the occupied space in the corresponding first memory 30 or the second memory 40 can be returned, and the originally occupied address space becomes free and available, and the address manager can allocate it again .

在图6的基础上,本申请实施例还提供了一种可选的实施方式,请参考图7,报文处理方法还包括:S141、S142以及S145,具体阐述如下。On the basis of FIG. 6 , this embodiment of the present application also provides an optional implementation manner. Referring to FIG. 7 , the message processing method further includes: S141 , S142 and S145 , which are described in detail as follows.

S141,信息收发模块确定发包队列中第三目标发包描述符的数量是否大于预设的第二阈值。若是,则执行S142;若否,则执行S145。S141. The information transceiving module determines whether the number of third target packet sending descriptors in the packet sending queue is greater than a preset second threshold. If yes, execute S142; if not, execute S145.

其中,第三目标发包描述符为处于占用状态且对应的报文头存储于第一存储器的发包描述符。第二阈值可以是全局配置或per队列配置,当然地,也可以是固定值。Wherein, the third target packet sending descriptor is a packet sending descriptor that is in an occupied state and whose corresponding packet header is stored in the first memory. The second threshold may be a global configuration or a per queue configuration, and of course, may also be a fixed value.

可选地,S141并不一定在S222之后执行,可以是在信息收发模块10接收到第二类触发指令时,执行S141。Optionally, S141 is not necessarily executed after S222, and S141 may be executed when the information transceiving module 10 receives the second type of trigger instruction.

S142,确定发包队列处于拥挤状态。S142. Determine that the packet sending queue is in a congested state.

S145,确定发包队列处于非拥挤状态。S145. Determine that the packet sending queue is in a non-congested state.

在S142之后,执行S143,在S145之后,可以直接执行S146。After S142, execute S143, and after S145, directly execute S146.

可选地,S146和前述步骤之间是独立的,不论是否搬移,信息收发模块10都会基于预设顺序对发包队列中处于占用状态的发包描述符进行报文转发。Optionally, S146 is independent from the preceding steps. Regardless of whether the information is moved or not, the information transceiving module 10 will forward packets based on the preset sequence to the packet sending descriptors in the packet sending queue that are occupied.

应理解,本申请提供的报文处理方法,通过专用集成电路硬件(ApplicationSpecific Integrated Circuit,ASIC)辅助,处理器20(CPU)在感知到报文接收的时候,报文头已经在第一存储器30(SRAM)中,CPU在完成发包DMA TX描述符填写后,硬件自动释放报文头所在SRAM空间。可以有效减少CPU处理报文时的访存时延,减少CPU等待时间,从而大大提高软转发效率,提高整体转发带宽。It should be understood that the message processing method provided in the present application is assisted by application specific integrated circuit hardware (Application Specific Integrated Circuit, ASIC). (SRAM), after the CPU finishes filling out the packet sending DMA TX descriptor, the hardware automatically releases the SRAM space where the packet header is located. It can effectively reduce the memory access delay when the CPU processes packets and reduce the CPU waiting time, thereby greatly improving the soft forwarding efficiency and increasing the overall forwarding bandwidth.

下面提供一种报文处理装置,例如路由器设备或智能网卡设备。该报文处理装置如图1所示,可以实现上述的报文处理方法;具体的,该报文处理装置包括:信息收发模块10、处理器20、第一存储器30以及第二存储器40。处理器20可以是CPU。报文处理装置可以执行上述实施例的报文处理方法。A packet processing device, such as a router device or an intelligent network card device, is provided below. As shown in FIG. 1 , the message processing device can implement the above message processing method; specifically, the message processing device includes: an information transceiving module 10 , a processor 20 , a first memory 30 and a second memory 40 . Processor 20 may be a CPU. The packet processing device may execute the packet processing method in the foregoing embodiments.

在本申请所提供的实施例中,应该理解到,所揭露的装置和方法,也可以通过其它的方式实现。以上所描述的装置实施例仅仅是示意性的,例如,附图中的流程图和框图显示了根据本申请的多个实施例的装置、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或代码的一部分,所述模块、程序段或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现方式中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。In the embodiments provided in this application, it should be understood that the disclosed devices and methods may also be implemented in other ways. The device embodiments described above are only illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the architecture, functions and possible implementations of devices, methods and computer program products according to multiple embodiments of the present application. operate. In this regard, each block in a flowchart or block diagram may represent a module, program segment, or part of code that includes one or more Executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved. It should also be noted that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented by a dedicated hardware-based system that performs the specified function or action , or may be implemented by a combination of dedicated hardware and computer instructions.

另外,在本申请各个实施例中的各功能模块可以集成在一起形成一个独立的部分,也可以是各个模块单独存在,也可以两个或两个以上模块集成形成一个独立的部分。In addition, each functional module in each embodiment of the present application may be integrated to form an independent part, each module may exist independently, or two or more modules may be integrated to form an independent part.

所述功能如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc., which can store program codes. .

以上所述仅为本申请的优选实施例而已,并不用于限制本申请,对于本领域的技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。The above descriptions are only preferred embodiments of the present application, and are not intended to limit the present application. For those skilled in the art, there may be various modifications and changes in the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of this application shall be included within the protection scope of this application.

对于本领域技术人员而言,显然本申请不限于上述示范性实施例的细节,而且在不背离本申请的精神或基本特征的情况下,能够以其它的具体形式实现本申请。因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本申请的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化囊括在本申请内。不应将权利要求中的任何附图标记视为限制所涉及的权利要求。It will be apparent to those skilled in the art that the present application is not limited to the details of the exemplary embodiments described above, but that the present application can be implemented in other specific forms without departing from the spirit or essential characteristics of the present application. Therefore, the embodiments should be regarded as exemplary and not restrictive in all points of view, and the scope of the application is defined by the appended claims rather than the foregoing description, and it is intended that the scope of the present application be defined by the appended claims rather than by the foregoing description. All changes within the meaning and range of equivalents of the elements are embraced in this application. Any reference sign in a claim should not be construed as limiting the claim concerned.

Claims (10)

1.一种报文处理方法,其特征在于,应用于报文处理装置,所述报文处理装置包括信息收发模块、处理器、第一存储器以及第二存储器,所述第二存储器中设置有收包队列,所述收包队列包括预先配置的收包描述符,所述方法包括:1. A message processing method, characterized in that it is applied to a message processing device, and the message processing device includes an information transceiver module, a processor, a first memory and a second memory, and the second memory is provided with A packet receiving queue, the packet receiving queue includes a pre-configured packet receiving descriptor, and the method includes: 在所述信息收发模块接收到报文包时,若所述收包队列处于非拥挤状态,所述信息收发模块将所述报文包的报文头写入第一目标地址段,将所述报文包的报文主体写入第二目标地址段,其中,所述第一目标地址段属于第一存储器,所述第二目标地址段属于第二存储器;When the information transceiver module receives a message packet, if the packet receiving queue is in a non-crowded state, the information transceiver module writes the message header of the message packet into the first target address segment, and writes the The message body of the message packet is written into the second target address segment, wherein the first target address segment belongs to the first memory, and the second target address segment belongs to the second memory; 所述信息收发模块将第一地址信息和第二地址信息写入第一目标收包描述符,其中,所述第一目标收包描述符为收包队列中当前处于空闲状态的任意一个收包描述符,所述第一地址信息为所述报文头的写入地址的标识信息,所述第二地址信息为所述报文主体的写入地址的标识信息;The information transceiving module writes the first address information and the second address information into the first target receiving packet descriptor, wherein the first target receiving packet descriptor is any receiving packet currently in an idle state in the packet receiving queue Descriptor, the first address information is the identification information of the write address of the message header, and the second address information is the identification information of the write address of the message body; 所述信息收发模块将所述第一目标收包描述符标记为占用状态;The information transceiving module marks the first target receiving packet descriptor as an occupied state; 所述处理器在按照预设顺序对处于占用状态的收包描述符所对应的报文头进行处理后,基于所述收包描述符对应的第一地址信息和第二地址信息更新发包队列,以完成报文转发。After the processor processes the packet headers corresponding to the packet receiving descriptors in the occupied state according to a preset order, update the packet sending queue based on the first address information and the second address information corresponding to the packet receiving descriptors, to complete message forwarding. 2.如权利要求1所述的报文处理方法,其特征在于,所述方法还包括:2. The message processing method according to claim 1, wherein the method further comprises: 在所述信息收发模块接收到报文包时,所述信息收发模块确定所述收包队列是否处于拥挤状态;When the information transceiver module receives a message packet, the information transceiver module determines whether the packet receiving queue is in a crowded state; 若收包队列处于非拥挤状态,则所述信息收发模块将所述第一存储器中的第一目标地址段确定为所述报文头的写入地址;If the packet receiving queue is in a non-congested state, the information transceiving module determines the first target address segment in the first memory as the write address of the packet header; 所述信息收发模块将所述第二存储器中的第二目标地址段确定为所述报文主体的写入地址。The information transceiving module determines the second target address segment in the second memory as the write address of the message body. 3.如权利要求2所述的报文处理方法,其特征在于,所述方法还包括:3. The message processing method according to claim 2, wherein the method further comprises: 若收包队列处于拥挤状态,则所述信息收发模块将所述第二存储器中的第三目标地址段确定为所述报文头的写入地址;If the packet receiving queue is in a crowded state, the information transceiving module determines the third target address segment in the second memory as the write address of the message header; 所述信息收发模块将所述第二存储器中的第二目标地址段确定为所述报文主体的写入地址;The information transceiving module determines the second target address segment in the second memory as the write address of the message body; 所述信息收发模块将所述报文包的报文头写入第三目标地址段,将所述报文包的报文主体写入第二目标地址段。The information transceiving module writes the message header of the message packet into the third target address segment, and writes the message body of the message packet into the second target address segment. 4.如权利要求3所述的报文处理方法,其特征在于,在所述收包队列处于拥挤状态的情况下,所述方法还包括:4. The message processing method according to claim 3, wherein, when the packet receiving queue is in a crowded state, the method further comprises: 若所述处理器将处于占用状态的收包描述符更新为空闲状态,则所述信息收发模块将第二目标收包描述符所对应的报文头从所述第二存储器搬移至所述第一存储器;If the processor updates the receiving packet descriptor in the occupied state to the idle state, the information sending and receiving module moves the packet header corresponding to the second target receiving packet descriptor from the second memory to the first a memory; 所述信息收发模块对所述第二目标收包描述符中的第一地址信息进行更新。The information transceiving module updates the first address information in the second target packet receiving descriptor. 5.如权利要求1所述的报文处理方法,其特征在于,在所述收包队列处于非拥挤状态的情况下,所述方法还包括:5. The message processing method according to claim 1, wherein, when the packet receiving queue is in a non-crowded state, the method further comprises: 所述信息收发模块在监测量大于预设的第一阈值时,将所述收包队列标记为拥挤状态,其中,所述监测量为所述收包队列中处于占用状态的收包描述符的数量,或者为所述第一存储器中存储的报文头的数量,或者为报文包所占用的存储单元的数量。The information transceiving module marks the packet receiving queue as a congested state when the monitored amount is greater than a preset first threshold, wherein the monitored amount is the number of packet receiving descriptors in the occupied state in the packet receiving queue The quantity is either the quantity of packet headers stored in the first memory, or the quantity of storage units occupied by the packet. 6.如权利要求5所述的报文处理方法,其特征在于,在所述收包队列处于拥挤状态的情况下,所述方法还包括:6. The message processing method according to claim 5, wherein, when the packet receiving queue is in a crowded state, the method further comprises: 所述信息收发模块在所述第二存储器中未存储收包描述符对应的报文头时,将所述收包队列标记为非拥挤状态。The information transceiving module marks the packet receiving queue as a non-congested state when the packet header corresponding to the packet receiving descriptor is not stored in the second memory. 7.一种报文处理方法,其特征在于,应用于报文处理装置,所述报文处理装置包括信息收发模块、处理器、第一存储器以及第二存储器,所述第二存储器中设置有发包队列,所述发包队列包括预先配置的发包描述符,所述方法包括:7. A message processing method, characterized in that it is applied to a message processing device, and the message processing device includes an information transceiver module, a processor, a first memory and a second memory, and the second memory is provided with A packet sending queue, the packet sending queue includes a pre-configured packet sending descriptor, and the method includes: 所述处理器对处于占用状态的收包描述符的报文头进行处理后,将所述收包描述符对应的第一地址信息和第二地址信息写入第一目标发包描述符;After the processor processes the packet header of the receiving packet descriptor in the occupied state, writes the first address information and the second address information corresponding to the receiving packet descriptor into the first target sending packet descriptor; 其中,初始写入所述第一目标发包描述符中的第一地址信息属于所述第一存储器,所述第一地址信息为所述收包描述符对应的报文头的写入地址的标识信息,所述第二地址信息为所述收包描述符对应的报文主体的写入地址的标识信息,所述第一目标发包描述符为发包队列中当前处于空闲状态的任意一个发包描述符;Wherein, the first address information initially written into the first target sending packet descriptor belongs to the first memory, and the first address information is an identifier of the writing address of the packet header corresponding to the receiving packet descriptor information, the second address information is the identification information of the write address of the message body corresponding to the packet receiving descriptor, and the first target packet sending descriptor is any packet sending descriptor that is currently idle in the packet sending queue ; 所述处理器将所述第一目标发包描述符调整为占用状态;The processor adjusts the first target send packet descriptor to an occupied state; 所述信息收发模块在所述发包队列处于拥挤状态时,将差额数量的第二目标发包描述符对应的报文头搬移至所述第二存储器,其中,所述第二目标发包描述符为处于占用状态且排序靠后的发包描述符;When the sending packet queue is in a congested state, the information transceiving module moves the message headers corresponding to the second target sending packet descriptor of the difference amount to the second memory, wherein the second target sending packet descriptor is in Sending descriptors that occupy the state and are sorted later; 所述信息收发模块对所述第二目标发包描述符中的第一地址信息进行更新,更新后的第二目标发包描述符中的第一地址信息属于所述第二存储器;The information transceiving module updates the first address information in the second target sending packet descriptor, and the updated first address information in the second target sending packet descriptor belongs to the second memory; 所述信息收发模块基于预设顺序对所述发包队列中处于占用状态的发包描述符进行报文转发。The information transceiving module forwards the packets of the packet sending descriptors in the occupied state in the packet sending queue based on a preset sequence. 8.如权利要求7所述的报文处理方法,其特征在于,在所述将差额数量的第二目标发包描述符对应的报文头搬移至所述第二存储器之前,所述方法还包括:8. The message processing method according to claim 7, characterized in that, before moving the message headers corresponding to the second target sending packet descriptors of the difference amount to the second memory, the method further comprises : 所述信息收发模块在所述发包队列中第三目标发包描述符的数量大于预设的第二阈值时,确定所述发包队列处于拥挤状态;The information transceiving module determines that the packet sending queue is in a congested state when the number of third target sending packet descriptors in the sending packet queue is greater than a preset second threshold; 其中,所述第三目标发包描述符为处于占用状态且对应的报文头存储于所述第一存储器的发包描述符。Wherein, the third target packet sending descriptor is a packet sending descriptor that is in an occupied state and whose corresponding packet header is stored in the first memory. 9.如权利要求8所述的报文处理方法,其特征在于,所述方法还包括:9. The message processing method according to claim 8, wherein the method further comprises: 在所述信息收发模块在所述发包队列处于非拥挤状态时,所述信息收发模块直接基于预设顺序对所述发包队列中处于占用状态的发包描述符进行报文转发。When the information transceiving module is in the non-congested state in the packet sending queue, the information sending and receiving module directly forwards the packets of the packet sending descriptors in the occupied state in the packet sending queue based on a preset order. 10.一种报文处理装置,其特征在于,包括:信息收发模块、处理器、第一存储器以及第二存储器,所述报文处理用于执行权利要求1-9中任意一项所述的报文处理方法。10. A message processing device, characterized in that it comprises: an information transceiving module, a processor, a first memory, and a second memory, and the message processing is used to execute the method described in any one of claims 1-9. Packet processing method.
CN202310028982.4A 2023-01-09 2023-01-09 A message processing method and device Active CN116032861B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310028982.4A CN116032861B (en) 2023-01-09 2023-01-09 A message processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310028982.4A CN116032861B (en) 2023-01-09 2023-01-09 A message processing method and device

Publications (2)

Publication Number Publication Date
CN116032861A true CN116032861A (en) 2023-04-28
CN116032861B CN116032861B (en) 2025-03-07

Family

ID=86070984

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310028982.4A Active CN116032861B (en) 2023-01-09 2023-01-09 A message processing method and device

Country Status (1)

Country Link
CN (1) CN116032861B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117076353A (en) * 2023-10-16 2023-11-17 苏州元脑智能科技有限公司 Descriptor configuration method and descriptor configuration device
CN117193669A (en) * 2023-11-06 2023-12-08 格创通信(浙江)有限公司 Discrete storage method, device and equipment for message descriptors and storage medium
CN118138547A (en) * 2024-05-07 2024-06-04 珠海星云智联科技有限公司 Method, computer device and medium for packet descriptor acquisition

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4755986A (en) * 1985-09-13 1988-07-05 Nec Corporation Packet switching system
CN107547417A (en) * 2016-06-29 2018-01-05 中兴通讯股份有限公司 A kind of message processing method, device and base station
CN108055202A (en) * 2017-12-07 2018-05-18 锐捷网络股份有限公司 A kind of message processor and method
US20200259766A1 (en) * 2017-07-31 2020-08-13 New H3C Technologies Co., Ltd. Packet processing

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4755986A (en) * 1985-09-13 1988-07-05 Nec Corporation Packet switching system
CN107547417A (en) * 2016-06-29 2018-01-05 中兴通讯股份有限公司 A kind of message processing method, device and base station
US20200259766A1 (en) * 2017-07-31 2020-08-13 New H3C Technologies Co., Ltd. Packet processing
CN108055202A (en) * 2017-12-07 2018-05-18 锐捷网络股份有限公司 A kind of message processor and method

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117076353A (en) * 2023-10-16 2023-11-17 苏州元脑智能科技有限公司 Descriptor configuration method and descriptor configuration device
CN117076353B (en) * 2023-10-16 2024-02-02 苏州元脑智能科技有限公司 Descriptor configuration method and descriptor configuration device
CN117193669A (en) * 2023-11-06 2023-12-08 格创通信(浙江)有限公司 Discrete storage method, device and equipment for message descriptors and storage medium
CN117193669B (en) * 2023-11-06 2024-02-06 格创通信(浙江)有限公司 Discrete storage method, device and equipment for message descriptors and storage medium
CN118138547A (en) * 2024-05-07 2024-06-04 珠海星云智联科技有限公司 Method, computer device and medium for packet descriptor acquisition

Also Published As

Publication number Publication date
CN116032861B (en) 2025-03-07

Similar Documents

Publication Publication Date Title
CN116032861A (en) Message processing method and device
WO2021254330A1 (en) Memory management method and system, client, server and storage medium
CN110851371B (en) Message processing methods and related equipment
CN108667739A (en) Congestion control method, device and system
EP3883210B1 (en) Method and apparatus for determining forwarding port in information centeric network
US20150172413A1 (en) Data relay apparatus and method, server apparatus, and data sending method
CN114885045B (en) Method and device for saving DMA channel resources in high-speed intelligent network card/DPU
CN112118167B (en) Method for quickly transmitting cross-network tunnel data
CN109729022B (en) A data transmission method, device and system based on software-defined network
CN108270687A (en) A kind of load balance process method and device
CN107071015A (en) A kind of document transmission method and device applied to vehicular ad hoc network
WO2023098050A1 (en) Remote data access method and apparatus
WO2023125380A1 (en) Data management method and corresponding apparatus
CN110312283A (en) An information processing method and device
CN114244752A (en) Flow statistical method, device and equipment
CN115967687A (en) Method for fast forwarding message, network device, storage medium and computer program product
WO2019033891A1 (en) Rdma-based network traffic determination method and device
CN109726144B (en) Data message processing method and device
WO2022017454A1 (en) Message processing method, network device and related device
CN116074250B (en) Stream table processing method, system, device and storage medium
WO2014067055A1 (en) Method and device for refreshing flow table
CN102098221A (en) Message query method and device
CN112003796A (en) Broadcast message processing method, system, equipment and computer storage medium
CN116132532A (en) A message processing method, device and electronic equipment
CN117221225A (en) Network congestion notification method, device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant