CN117499512A - Message processing method and device and electronic equipment - Google Patents

Message processing method and device and electronic equipment Download PDF

Info

Publication number
CN117499512A
CN117499512A CN202311515698.6A CN202311515698A CN117499512A CN 117499512 A CN117499512 A CN 117499512A CN 202311515698 A CN202311515698 A CN 202311515698A CN 117499512 A CN117499512 A CN 117499512A
Authority
CN
China
Prior art keywords
message
processed
descriptor
processing
sub
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.)
Pending
Application number
CN202311515698.6A
Other languages
Chinese (zh)
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.)
Beijing Yushu Huachuang Technology Co ltd
Original Assignee
Beijing Yushu Huachuang Technology 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 Beijing Yushu Huachuang Technology Co ltd filed Critical Beijing Yushu Huachuang Technology Co ltd
Priority to CN202311515698.6A priority Critical patent/CN117499512A/en
Publication of CN117499512A publication Critical patent/CN117499512A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content
    • H04L67/5651Reducing the amount or size of exchanged application data

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application discloses a message processing method, a message processing device and electronic equipment, wherein the method comprises the following steps: receiving a first message to be processed; generating a first message descriptor of a first message to be processed, and storing the first message to be processed into a buffer area; determining a first field to be deleted which needs to be deleted in a first message to be processed; performing invalidation marking on a sub-descriptor used for indicating a first field to be deleted in the first message descriptor to obtain a processed first message descriptor; and reading the first message to be processed from the buffer area, and processing the first message to be processed according to the processed first message descriptor to obtain a first processed message. According to the method and the device, the first message descriptor is marked in an invalid mode, and then the first message to be processed is processed through the processed first message descriptor, so that data movement is not needed for splicing residual data after deleting the field to be deleted in the first message to be processed, and the message processing efficiency is improved.

Description

Message processing method and device and electronic equipment
Technical Field
The present disclosure relates to the field of data processing technologies, and in particular, to a method and an apparatus for processing a message, and an electronic device.
Background
In network cards, data processors (Data Processing Unit, DPU) and other devices, in order to improve data processing efficiency, a network processor (Network Processing Unit, NPU) hardware processing unit is adopted to take on the task of hardware acceleration on a packet data stream. In the process of deleting the message data, the message data is directly deleted, and then the operations such as data alignment, header offset splicing and the like are carried out to obtain the first processed message.
However, since the arrangement of the fields in the message is right aligned, the whole is required to shift to the right after deleting the message data to achieve compact concatenation, so that the more the field to be deleted is located at the head, the larger the amount of data movement task to be performed, resulting in a decrease in processing efficiency.
Disclosure of Invention
In view of the above, the present application provides a message processing method, a device, an electronic apparatus, and a computer storage medium, so as to solve the technical problem that the efficiency of the message processing method in the conventional scheme is not ideal.
The first aspect of the present application provides a method for processing a message, including: receiving a first message to be processed; generating a first message descriptor of the first message to be processed, and storing the first message to be processed into a buffer area; determining a first field to be deleted which needs to be deleted in the first message to be processed; performing invalidation marking on the sub-descriptor used for indicating the first field to be deleted in the first message descriptor to obtain a processed first message descriptor; and reading the first message to be processed from the buffer area, and processing the first message to be processed according to the processed first message descriptor to obtain a first processed message.
Optionally, the process of marking the sub-descriptor for indicating the first field to be deleted in the first message descriptor to obtain the processed first message descriptor may further include: determining a sub-descriptor needing to be marked in an invalid way from the first message descriptor according to the first field to be deleted; and marking the sub-descriptors needing to be marked invalid in the first message descriptors as invalid in sequence to obtain the processed first message descriptors.
Optionally, the first message descriptor includes a plurality of descriptor layers; correspondingly, the process of marking the sub-descriptor for indicating the first field to be deleted in the first message descriptor to be invalid to obtain the processed first message descriptor may further include: determining a plurality of descriptor layers to be processed from the plurality of descriptor layers according to the first field to be deleted, wherein each descriptor layer to be processed comprises at least one sub-descriptor needing to be marked in an invalid way; processing the plurality of descriptor layers to be processed in parallel so as to respectively mark sub-descriptors needing to be marked invalid in each descriptor layer to be processed as invalid; and splicing the processing results of the plurality of descriptor layers to be processed to obtain the processed first message descriptor.
Optionally, the method further comprises: acquiring a second message to be processed; generating a second message descriptor of the second message to be processed, and storing the second message to be processed into a buffer area; determining a second field to be deleted in the second message to be processed, and determining a plurality of second descriptor layers to be processed from a plurality of descriptor layers of the second message to be processed, wherein each second descriptor layer to be processed comprises at least one sub-descriptor needing to be marked in an invalid way, and the second descriptor layers to be processed are at least partially identical to the first descriptor layers to be processed; processing the plurality of second to-be-processed descriptor layers in parallel through a plurality of packet processing engines, and processing the same descriptor layers in the second to-be-processed descriptor layers as the descriptor layers in the first to-be-processed descriptor layers through the same packet processing engines so as to respectively mark sub-descriptors needing to be marked invalid in each second to-be-processed descriptor layer as invalid; splicing the processing results of the plurality of second descriptor layers to be processed to obtain the processed second message descriptors; and reading the second message to be processed from the buffer area, and processing the second message to be processed according to the processed second message descriptor to obtain a second processed message.
Optionally, the process of processing the first message to be processed according to the processed first message descriptor to obtain the first processed message may further include: deleting a field indicated by each sub-descriptor from the first message to be processed according to each sub-descriptor marked as invalid in the first message descriptor after processing; and splicing the remaining fields in the first message to be processed to obtain a first processed message.
Optionally, the process of processing the first message to be processed according to the processed first message descriptor to obtain the first processed message may further include: and carrying out shift processing on the field marked by the sub-descriptor in the first message to be processed according to each sub-descriptor marked as invalid in the first message descriptor after processing, so that the field indicated by the sub-descriptor marked as invalid in the first message descriptor after processing is positioned in the field indicated by the sub-descriptor not marked as invalid in the first message descriptor after processing, and obtaining the first message after processing.
Optionally, the message processing process may further include: deleting the sub-descriptors marked as invalid in the processed first message descriptor, and splicing the remaining sub-descriptors in the processed first message descriptor to obtain a target descriptor; and associating the target descriptor with the first processed message and outputting the first processed message.
Optionally, the process of reading the first message to be processed from the buffer may further include: determining the data length of the first message to be processed; and directly reading the buffer area according to the data length of the first message to be processed to obtain the first message to be processed.
A second aspect of the present application provides a message processing apparatus, including: the receiving module is used for receiving a first message to be processed; the generation module is used for generating a first message descriptor of the first message to be processed and storing the first message to be processed into a buffer area; the determining module is used for determining a first field to be deleted which needs to be deleted in the first message to be processed; the deleting module is used for carrying out invalid marking on the sub-descriptor used for indicating the first field to be deleted in the first message descriptor to obtain a processed first message descriptor; and the processing module is used for reading the first message to be processed from the buffer area, and processing the first message to be processed according to the processed first message descriptor to obtain a first processed message.
According to a third aspect of embodiments of the present application, there is provided an electronic device, including: the device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the memory and the communication interface are communicated with each other through the communication bus; the memory is configured to store at least one executable instruction, where the executable instruction causes the processor to perform operations corresponding to the method according to the first aspect of the embodiment.
According to the method and the device, the first message descriptor is marked in an invalid mode, and then the first message to be processed is processed through the processed first message descriptor, so that data movement is not needed for splicing residual data after deleting the field to be deleted in the first message to be processed, and the message processing efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following description will briefly introduce the drawings that are required to be used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are only some embodiments described in the embodiments of the present application, and other drawings may also be obtained according to these drawings for a person having ordinary skill in the art.
FIG. 1 is a flow chart illustrating steps of a message processing method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a first message descriptor processing procedure according to an embodiment of the present application;
FIG. 3 is a schematic diagram illustrating a first message descriptor processing procedure according to another embodiment of the present application
FIG. 4 is a flowchart illustrating steps of a first message descriptor processing method according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a first message descriptor processing procedure according to another embodiment of the present application;
FIG. 6 is a schematic diagram of a message processing apparatus according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to better understand the technical solutions in the embodiments of the present application, the following descriptions will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present application, but not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the embodiments of the present application shall fall within the scope of protection of the embodiments of the present application.
The terminology used in the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the present application. As used in this application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any or all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used herein to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first message may also be referred to as a second message, and similarly, a second message may also be referred to as a first message, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "at … …" or "responsive to a determination", depending on the context.
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application. The various embodiments described below and their technical features can be combined with each other without conflict.
In the prior art, the arrangement mode of the fields in the message is right alignment, and after deleting the message data, the whole is required to shift rightwards to realize compact splicing, so that the more the field to be deleted is positioned at the head part, the larger the data moving task amount to be done is, and the processing efficiency is reduced. For example, taking the first message to be processed as ETH- > VLAN1- > VLAN2- > IPV4 as an example, two VLANs 1 and 2 need to be deleted through table lookup, in the prior art, lengths of VLAN1 and VLAN2 are calculated first, then ETH layer data is read out, and according to lengths of VLAN1 and VLAN2, right offset is performed on the ETH layer data to rewrite the buffer area. The more later the field to be deleted is located in the header, the greater the amount of data movement tasks to be performed. Therefore, there is a need for an efficient message processing method to increase the efficiency of message processing.
Fig. 1 is a flowchart illustrating steps of a message processing method according to an embodiment of the present application, as shown in fig. 1. The message processing method comprises the following steps:
step 101, a first message to be processed is received.
For example, a first message to be processed may be received by a packet receiving module, where the first message to be processed may be obtained by a data processor (Data Processing Unit, DPU) from an external device or other data sender via a network.
Step 102, generating a first message descriptor of a first message to be processed, and storing the first message to be processed in a buffer area.
After the first message to be processed is received, the first message to be processed can be analyzed through the packet receiving unit to obtain a first message descriptor, and a sub-descriptor in the first message descriptor and a field in the first message to be processed have a fixed mapping relation. And simultaneously storing the first message to be processed into a Buffer (PB).
Step 103, determining a first field to be deleted in the first message to be processed.
The first field to be deleted in the first message to be processed may be determined in a manner of receiving a deletion instruction or the like acquired by the data processor from the external device or other data transmitting end through the network.
And 104, carrying out invalidation marking on the sub-descriptor used for indicating the first field to be deleted in the first message descriptor to obtain the processed first message descriptor.
After determining the first field to be deleted, because the sub-descriptor in the first message descriptor has a fixed mapping relation with the field in the first message to be processed, the sub-descriptor for indicating the first field to be deleted can be determined according to the first field to be deleted, and then the generated sub-descriptor for indicating the first field to be deleted in the first message descriptor can be marked in an invalid way through a packet processing engine (Packet Processing Engine, PPE) to obtain the processed first message descriptor with a part of invalid marks.
Step 105, reading the first message to be processed from the buffer area, and processing the first message to be processed according to the processed first message descriptor to obtain a first processed message.
After the processed first message descriptor is obtained, the first message to be processed stored in the previous step is completely read from the buffer area, and then corresponding operation is carried out on the first message to be processed according to the processed first message descriptor so as to obtain the first message after processing.
In the embodiment of the application, the first message descriptor is marked in an invalid way, and then the first message to be processed is processed by the processed first message descriptor, so that data movement is not required to be carried out for splicing residual data after deleting the field to be deleted in the first message to be processed, and the efficiency of message processing is further improved.
In one possible implementation manner, the process of marking the sub-descriptor for indicating the first field to be deleted in the first message descriptor to obtain the processed first message descriptor may further include: and determining the sub-descriptors needing to be marked invalid from the first message descriptors according to the first field to be deleted, and then marking the sub-descriptors needing to be marked invalid in the first message descriptors as invalid in sequence to obtain the processed first message descriptors.
When the first message descriptor is marked in an invalid way, determining sub-descriptors needing to be marked in an invalid way according to the mapping relation between the field in the first message to be processed and the first message descriptor and the first field to be deleted, and then marking the sub-descriptors as invalid in sequence in the first message to be processed by a packet processing engine according to the sequence of the sub-descriptors needing to be marked in the first message to be processed, so as to obtain the processed first message descriptor.
For example, as shown in fig. 2, the first message descriptor processing procedure may be that the first message descriptor to be processed includes three layers of to-be-processed descriptor layers of L2, L3 and L4, each of the descriptor layers includes a plurality of sub-descriptors, and it is determined that the second sub-descriptor of L2, the second sub-descriptor of L3 and the third sub-descriptor of L4 need to be marked for invalidation according to the first to-be-deleted field, then in the packet processing engine, the second sub-descriptor of L2 is marked as invalid in sequence, then the second sub-descriptor of L3 is marked as invalid, and finally the third sub-descriptor of L4 is marked as invalid.
In the embodiment of the application, the first field to be deleted in the first message descriptor is marked in sequence, so that the integrity of the processing of the first message descriptor can be ensured. The first message to be processed can be processed in a mode of marking the first field to be deleted through the processed first message descriptor, so that the processing efficiency of the first message to be processed is improved.
In one possible implementation manner, the process of processing the first message to be processed according to the processed first message descriptor to obtain the first processed message may further include: and deleting the field indicated by the sub-descriptor from the first message to be processed according to each sub-descriptor marked as invalid in the first message descriptor after processing, and then splicing the remaining fields in the first message to be processed to obtain the first message after processing.
In the existing means, in the manner of processing the first message to be processed, the first field to be deleted in the first message to be processed cannot be directly deleted because of no mark of the first message descriptor, for the first message to be processed, the data length of the first field to be deleted and the position of the first field to be deleted in the first message to be processed need to be acquired first, then the first bit of the first message to be processed is read out, and the first bit is shifted according to the data length of the deleted field and the position of the first field to be processed, so that the deletion of the first field to be deleted can be realized. The first bit of the first message to be processed needs to be read, so that the reading process is limited, and secondly, the more the first field to be deleted is positioned in the first message to be processed, the more the bit number for shifting the first bit is, so that larger resources are required to be consumed. And deleting the field indicated by the sub-descriptor from the first message to be processed according to each sub-descriptor marked as invalid in the processed first message descriptor, wherein the first message to be processed can be read without first in the reading process, and the first field to be deleted can be directly deleted because the sub-descriptor marked as invalid is used for marking the first field to be deleted in the deleting process.
In the embodiment of the application, the first field to be deleted in the first message to be processed is deleted by the sub-descriptor marked as invalid in the first message descriptor after processing, so that the accuracy is higher, and the processing efficiency of the first message to be processed can be improved.
In one possible implementation manner, the process of processing the first message to be processed according to the processed first message descriptor to obtain the first processed message may further include: and carrying out shift processing on the field marked by the sub-descriptor in the first message to be processed according to each sub-descriptor marked as invalid in the first message descriptor after processing, so that the field indicated by the sub-descriptor marked as invalid in the first message descriptor after processing is positioned in the field indicated by the sub-descriptor not marked as invalid in the first message descriptor after processing, and obtaining the first message after processing.
The method of processing the fields corresponding to the sub-descriptors marked as invalid in the first to-be-processed message may further be that after the fields are moved back to the fields corresponding to the sub-descriptors not marked as invalid, taking the first to-be-processed message as an example, where the fields indicated by the sub-descriptors marked as invalid are all fields under the VLAN1 layer, and after all the fields under the VLAN1 layer are moved back to the fields of the IPV4 layer, the first to-be-processed message is obtained as follows: ETH- > VLAN2- > IPV4- > VLAN1.
In the embodiment of the application, after the fields indicated by the sub-descriptors marked as invalid in the processed first message descriptor are moved back to other fields in the first message to be processed, the data length of the first processed message can be ensured to be consistent with the data length of the first message to be processed, and the complexity of the data processor using the first processed message after being output to the data processor is reduced.
In one possible implementation, the process of processing the message may further include: deleting the sub-descriptors marked as invalid in the processed first message descriptor, splicing the remaining sub-descriptors in the processed first message descriptor to obtain a target descriptor, and then associating the target descriptor with the first processed message and outputting the first processed message.
For example, taking the example that the first message descriptor is ETH- > VLAN1- > VLAN2- > IPV4, the sub-descriptors marked as invalid in the first message descriptor after processing are all sub-descriptors under the VLAN1 layer and the VLAN2 layer, a processing procedure of the first message descriptor after processing may be as shown in fig. 3, delete all sub-descriptors marked as invalid under the VLAN1 layer and the VLAN2 layer in the first message descriptor after processing, and then splice the ETH layer with the IPV4 layer, where a splicing manner may be to right shift the ETH layer, so as to obtain the target descriptor. And then, the target descriptor is associated with the first processed message and then output.
In the embodiment of the application, the sub-descriptors marked as invalid in the processed first message descriptor are deleted and associated with the first processed message, when the message processing result is output, the target descriptor and the first processed message are output together, and for the receiving end, the first processed message can be known through the target descriptor and is convenient to further process.
In one possible implementation manner, the process of reading the first message to be processed from the buffer area may further include: and determining the data length of the first message to be processed, and then directly reading the buffer area according to the data length of the first message to be processed to obtain the first message to be processed.
Because only the first message descriptor is processed, and the first message to be processed is processed according to the first message descriptor, when the first message to be processed is read from the buffer, the first message to be processed is completely read, and therefore, the first message to be processed can be read from the buffer only by the data length of the first message to be processed.
In the embodiment of the application, the first message to be processed is read from the buffer area through the data length of the first message to be processed, and the first message to be processed in the buffer area can be read without aligning the first position of the first message to be processed, so that the efficiency of reading the first message to be processed is improved.
Fig. 4 is a step flowchart of a first message descriptor processing method according to an embodiment of the present application, as shown in fig. 4, the first message descriptor processing method includes the following steps:
step 201, determining a plurality of descriptor layers to be processed from the plurality of descriptor layers according to the first field to be deleted.
The first message descriptor may include a plurality of descriptor layers. Each of the pending descriptor layers includes at least one sub-descriptor that requires invalidation tagging.
The first message descriptor may include a plurality of descriptor layers, for example, the first message descriptor includes three layers of to-be-processed descriptor layers of L2, L3 and L4, and it is determined that the third sub-descriptor of L2, the second sub-descriptor of L3 and the second sub-descriptor of L4 need to be marked invalid according to the first to-be-deleted field.
And 202, processing the plurality of descriptor layers to be processed in parallel so as to respectively mark sub-descriptors needing to be marked invalid in each descriptor layer to be processed as invalid.
For example, as shown in fig. 5, the processing manner of the descriptors to be processed may be that each of the descriptor layers to be processed is processed in parallel by a plurality of packet processing engines, the third sub-descriptor of L2 is marked as invalid by the packet processing engine 1, the second sub-descriptor of L3 is marked as invalid by the packet processing engine 2, and the second sub-descriptor of L4 is marked as invalid by the packet processing engine 3.
And 203, splicing the processing results of the plurality of descriptor layers to be processed to obtain a first message descriptor after processing.
For example, after the packet processing engine 1, the packet processing engine 2 and the packet processing engine 3 process the L2, the L3 and the L4 to-be-processed descriptor layers simultaneously, the processing results of the packet processing engine 1, the packet processing engine 2 and the packet processing engine 3 are spliced to obtain the processed first message descriptor.
In the embodiment of the application, the processing efficiency of the descriptors to be processed can be improved by processing the descriptor layers to be processed in parallel.
In one possible implementation, the process of processing the message may further include: obtaining a second message to be processed, generating a second message descriptor of the second message to be processed, storing the second message to be processed in a buffer area, determining a second field to be deleted in the second message to be processed, determining a plurality of second descriptor layers to be processed from a plurality of descriptor layers of the second message to be processed, processing the plurality of second descriptor layers in parallel through a plurality of packet processing engines, and processing the same descriptor layers in the second descriptor layers to be processed as the descriptor layers in the first descriptor layer through the same packet processing engine so as to mark sub-descriptors needing to be marked invalid in each second descriptor layer to be invalid. And splicing the processing results of the plurality of second to-be-processed descriptor layers to obtain a processed second message descriptor, finally reading the second to-be-processed message from the buffer area, and processing the second to-be-processed message according to the processed second message descriptor to obtain a second processed message.
Each second descriptor layer to be processed comprises at least one sub-descriptor needing to be marked invalid, and the second descriptor layers to be processed are at least partially identical to the first descriptor layers to be processed. For example, the first to-be-processed descriptor layer is L2, L3 and L4, the third sub-descriptor of L2, the second sub-descriptor of L3 and the second sub-descriptor of L4 are determined to be invalid according to the first to-be-deleted field, the second to-be-processed descriptor layer is two layers of L2 and L3, and the second sub-descriptor of L2 and the third sub-descriptor of L3 are determined to be invalid according to the second to-be-deleted field, then when the first to-be-processed descriptor layer is processed, the third sub-descriptor of L2 is marked as invalid by the packet processing engine 1, the second sub-descriptor of L3 is marked as invalid by the packet processing engine 2, and the second sub-descriptor of L4 is marked as invalid by the packet processing engine 3. In this process, the packet processing engine 1 is determined to be fixedly processing the L2 layer, the packet processing engine 2 is determined to be fixedly processing the L3 layer, and the packet processing engine 3 is determined to be fixedly processing the L3 layer, so that when the second descriptor layer to be processed is processed, the second sub-descriptor of L2 is marked as invalid by the packet processing engine 1, while the third sub-descriptor of L3 is marked as invalid by the packet processing engine 2. The manner of processing the second message to be processed is similar to the rest of the steps when the first message to be processed is processed, and will not be described in detail here.
In the embodiment of the application, the processing efficiency of the descriptor layers to be processed can be improved by determining that each packet processing engine processes the same descriptor layer in all the messages to be processed.
Fig. 6 is a schematic structural diagram of a message processing apparatus according to an embodiment of the present application, as shown in fig. 6, the message processing apparatus 300 includes: a receiving module 301, a generating module 302, a determining module 303, a deleting module 304 and a processing module 305.
The receiving module 301 is configured to receive a first message to be processed.
For example, the receiving module 301 may receive, through a packet receiving unit, a first message to be processed, which is acquired by a data processor (Data Processing Unit, DPU) from an external device or other data transmitting end through a network.
The generating module 302 is configured to generate a first message descriptor of the first message to be processed, and store the first message to be processed in a buffer.
After the receiving module 301 receives the first message to be processed, the generating module 302 may parse the first message to be processed through the packet receiving module to obtain a first message descriptor, where a sub-descriptor in the first message descriptor has a fixed mapping relationship with a field in the first message to be processed. And simultaneously storing the first message to be processed into the buffer memory area.
A determining module 303, configured to determine a first field to be deleted in the first to-be-processed packet.
The determining module 303 may determine the first field to be deleted in the first message to be processed in a manner of receiving a deletion instruction obtained by the data processor from an external device or other data transmitting end through a network, and the like.
And the deletion module 304 is configured to perform invalidation marking on the sub-descriptor used for indicating the first field to be deleted in the first message descriptor, so as to obtain a processed first message descriptor.
After the determining module 303 determines the first field to be deleted, since the sub-descriptors in the first message descriptor and the fields in the first message to be processed have a fixed mapping relationship, the deleting module 304 may determine the sub-descriptor for indicating the first field to be deleted according to the first field to be deleted, and then may perform invalidation marking on the generated sub-descriptor for indicating the first field to be deleted in the first message descriptor by using the packet processing engine, to obtain the processed first message descriptor with a part of invalidation marking.
And the processing module 305 is configured to read the first message to be processed from the buffer, and process the first message to be processed according to the processed first message descriptor, so as to obtain a first processed message.
After the deletion module 304 obtains the processed first message descriptor, the processing module 305 completely reads the first message to be processed stored in the foregoing step from the buffer, and then performs a corresponding operation on the first message to be processed according to the processed first message descriptor, so as to obtain a first processed message.
In this embodiment of the present application, the deletion module 304 is used to perform the invalidation marking on the first message descriptor, and then the processing module 305 performs processing on the first message to be processed by using the processed first message descriptor, so that it is not necessary to perform data movement for splicing residual data after deleting the field to be deleted in the first message to be processed, thereby improving the efficiency of message processing.
It should be noted that, since the content of the receiving module 301, the generating module 302, the determining module 303, the deleting module 304, the processing module 305, and the information interaction and the executing process in the above-mentioned message processing apparatus 300 are based on the same concept as the embodiment of the above-mentioned message processing method, specific content can be referred to the description in the embodiment of the above-mentioned message processing method, and the details are not repeated here.
In this embodiment, an electronic device 400 is provided, as shown in fig. 7, the electronic device 400 may include: a processor 401, a communication interface (Communications Interface) 402, a memory 403, and a communication bus 404. Wherein:
Processor 401, communication interface 402, and memory 403 accomplish communication with each other via communication bus 404.
A communication interface 402 for communicating with other electronic devices or servers.
The processor 401 is configured to execute the program 405, and may specifically perform relevant steps in the foregoing embodiments of the message processing method.
In particular, the program 405 may include program code including computer operating instructions.
The processor 401 may be a CPU or a specific integrated circuit ASIC (Application Specific Integrated Circuit) or one or more integrated circuits configured to implement embodiments of the present application. The one or more processors comprised by the smart device may be the same type of processor, such as one or more CPUs; but may also be different types of processors such as one or more CPUs and one or more ASICs.
A memory 403 for storing a program 405. Memory 403 may comprise high-speed RAM memory and may also comprise non-volatile memory (non-volatile memory), such as at least one disk memory.
The program 405 may be specifically used to cause the processor 401 to execute the question asking method in the foregoing embodiment.
The specific implementation of each step in the procedure 405 may refer to the corresponding step and corresponding description in the unit in the foregoing embodiment of the message processing method, which is not described herein in detail. It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the apparatus and modules described above may refer to corresponding procedure descriptions in the foregoing method embodiments, which are not repeated herein.
According to the electronic device 400, the first message descriptor is marked in an invalid mode, and then the first message to be processed is processed by the processed first message descriptor, so that data movement is not required to be carried out for splicing residual data after deleting the field to be deleted in the first message to be processed, and the efficiency of message processing is improved.
In this embodiment, a computer-readable storage medium is provided storing instructions for causing a machine to perform a message processing method as herein. Specifically, a system or apparatus provided with a storage medium on which a software program code realizing the functions of any of the above embodiments is stored, and a computer (or CPU or MPU) of the system or apparatus may be caused to read out and execute the program code stored in the storage medium.
In this case, the program code itself read from the storage medium may realize the functions of any of the above-described embodiments, and thus the program code and the storage medium storing the program code form part of the present application.
Examples of the storage medium for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (e.g., CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), a magnetic tape, a nonvolatile memory card, and a ROM. Alternatively, the program code may be downloaded from a server computer by a communication network.
In this embodiment, a computer program product is provided that includes computer instructions that instruct a computing device to perform operations corresponding to any one of the method embodiments described above.
It should be noted that, according to implementation requirements, each component/step described in the embodiments of the present application may be split into more components/steps, and two or more components/steps or part of operations of the components/steps may be combined into new components/steps, so as to achieve the purposes of the embodiments of the present application.
The above-described methods according to embodiments of the present application may be implemented in hardware, firmware, or as software or computer code storable in a recording medium such as a CD ROM, RAM, floppy disk, hard disk, or magneto-optical disk, or as computer code originally stored in a remote recording medium or a non-transitory machine-readable medium and to be stored in a local recording medium downloaded through a network, so that the methods described herein may be stored on such software processes on a recording medium using a general purpose computer, special purpose processor, or programmable or special purpose hardware such as an ASIC or FPGA. It is understood that a computer, processor, microprocessor controller, or programmable hardware includes a memory component (e.g., RAM, ROM, flash memory, etc.) that can store or receive software or computer code that, when accessed and executed by the computer, processor, or hardware, performs the methods described herein. Furthermore, when a general purpose computer accesses code for implementing the methods illustrated herein, execution of the code converts the general purpose computer into a special purpose computer for performing the methods illustrated herein. Although the present application has been shown and described with respect to one or more implementations, equivalent alterations and modifications will occur to others skilled in the art based upon a reading and understanding of this specification and the annexed drawings. This application is intended to cover all such modifications and variations, and is limited only by the scope of the appended claims. In particular regard to the various functions performed by the above described components, the terms used to describe such components are intended to correspond, unless otherwise indicated, to any component which performs the specified function of the described component (e.g., that is functionally equivalent), even though not structurally equivalent to the disclosed structure which performs the function in the herein illustrated exemplary implementations of the specification.
That is, the foregoing embodiments are merely examples of the present application, and are not intended to limit the scope of the patent application, and all equivalent structures or equivalent processes using the descriptions and the contents of the present application, such as the combination of technical features of the embodiments, or direct or indirect application to other related technical fields, are included in the scope of the patent protection of the present application.
In addition, the terms "first," "second," are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more features. In the description of the present application, the meaning of "a plurality" is two or more, unless explicitly defined otherwise.
The previous description is provided to enable any person skilled in the art to make or use the present application. In the above description, various details are set forth for purposes of explanation. It will be apparent to one of ordinary skill in the art that the present application may be practiced without these specific details. In other instances, well-known processes have not been described in detail in order to avoid unnecessarily obscuring the description of the present application. Thus, the present application is not intended to be limited to the embodiments shown, but is to be accorded the widest scope consistent with the principles and features disclosed herein.
It should be noted that, on the premise of no conflict, the embodiments described in the present application and/or technical features in the embodiments may be arbitrarily combined with each other, and the technical solutions obtained after the combination should also fall into the protection scope of the present application.
It should be understood that the specific examples in the embodiments of the present application are only for helping those skilled in the art to better understand the embodiments of the present application, and not limit the scope of the embodiments of the present application, and those skilled in the art may make various improvements and modifications based on the above embodiments, and these improvements or modifications fall within the protection scope of the present application.
The foregoing is merely specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the present application, and the changes and substitutions are intended to be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A method for processing a message, comprising:
receiving a first message to be processed;
generating a first message descriptor of the first message to be processed, and storing the first message to be processed into a buffer area;
Determining a first field to be deleted which needs to be deleted in the first message to be processed;
performing invalidation marking on the sub-descriptor used for indicating the first field to be deleted in the first message descriptor to obtain a processed first message descriptor;
and reading the first message to be processed from the buffer area, and processing the first message to be processed according to the processed first message descriptor to obtain a first processed message.
2. The method of claim 1, wherein the invalidating the sub-descriptor for indicating the first field to be deleted in the first message descriptor to obtain the processed first message descriptor includes:
determining a sub-descriptor needing to be marked in an invalid way from the first message descriptor according to the first field to be deleted;
and marking the sub-descriptors needing to be marked invalid in the first message descriptors as invalid in sequence to obtain the processed first message descriptors.
3. The method of claim 1, wherein the first message descriptor comprises a plurality of descriptor layers;
correspondingly, the invalidating the sub-descriptor for indicating the first field to be deleted in the first message descriptor to obtain a processed first message descriptor includes:
Determining a plurality of first to-be-processed descriptor layers from the plurality of descriptor layers according to the first to-be-deleted field, wherein each first to-be-processed descriptor layer comprises at least one sub-descriptor needing to be marked in an invalid mode;
processing the plurality of first to-be-processed descriptor layers in parallel to respectively mark sub-descriptors needing to be marked invalid in each first to-be-processed descriptor layer as invalid;
and splicing the processing results of the plurality of first descriptor layers to be processed to obtain the processed first message descriptor.
4. A method according to claim 3, characterized in that the method further comprises:
acquiring a second message to be processed;
generating a second message descriptor of the second message to be processed, and storing the second message to be processed into a buffer area;
determining a second field to be deleted in the second message to be processed, and determining a plurality of second descriptor layers to be processed from a plurality of descriptor layers of the second message to be processed, wherein each second descriptor layer to be processed comprises at least one sub-descriptor needing to be marked in an invalid way, and the second descriptor layers to be processed are at least partially identical to the first descriptor layers to be processed;
Processing the plurality of second to-be-processed descriptor layers in parallel through a plurality of packet processing engines, and processing the same descriptor layers in the second to-be-processed descriptor layers as the descriptor layers in the first to-be-processed descriptor layers through the same packet processing engines so as to respectively mark sub-descriptors needing to be marked invalid in each second to-be-processed descriptor layer as invalid;
splicing the processing results of the plurality of second descriptor layers to be processed to obtain the processed second message descriptors;
and reading the second message to be processed from the buffer area, and processing the second message to be processed according to the processed second message descriptor to obtain a second processed message.
5. The method according to claim 1, wherein the processing the first message to be processed according to the processed first message descriptor to obtain a first processed message includes:
deleting a field indicated by each sub-descriptor from the first message to be processed according to each sub-descriptor marked as invalid in the first message descriptor after processing;
and splicing the remaining fields in the first message to be processed to obtain a first processed message.
6. The method according to claim 1, wherein the processing the first message to be processed according to the processed first message descriptor to obtain a first processed message includes:
and carrying out shift processing on the field marked by the sub-descriptor in the first message to be processed according to each sub-descriptor marked as invalid in the first message descriptor after processing, so that the field indicated by the sub-descriptor marked as invalid in the first message descriptor after processing is positioned in the field indicated by the sub-descriptor not marked as invalid in the first message descriptor after processing, and obtaining the first message after processing.
7. The method of claim 5, wherein the method further comprises:
deleting the sub-descriptors marked as invalid in the processed first message descriptor, and splicing the remaining sub-descriptors in the processed first message descriptor to obtain a target descriptor;
and associating the target descriptor with the first processed message and outputting the first processed message.
8. The method according to any one of claims 1-7, wherein the reading the first message to be processed from the buffer comprises:
Determining the data length of the first message to be processed;
and directly reading the buffer area according to the data length of the first message to be processed to obtain the first message to be processed.
9. A message processing apparatus, comprising:
the receiving module is used for receiving a first message to be processed;
the generation module is used for generating a first message descriptor of the first message to be processed and storing the first message to be processed into a buffer area;
the determining module is used for determining a first field to be deleted which needs to be deleted in the first message to be processed;
the deleting module is used for carrying out invalid marking on the sub-descriptor used for indicating the first field to be deleted in the first message descriptor to obtain a processed first message descriptor;
and the processing module is used for reading the first message to be processed from the buffer area, and processing the first message to be processed according to the processed first message descriptor to obtain a first processed message.
10. An electronic device, comprising: the device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the memory and the communication interface are communicated with each other through the communication bus;
The memory is configured to store at least one executable instruction that causes the processor to perform operations corresponding to the method of any one of claims 1-7.
CN202311515698.6A 2023-11-14 2023-11-14 Message processing method and device and electronic equipment Pending CN117499512A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311515698.6A CN117499512A (en) 2023-11-14 2023-11-14 Message processing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311515698.6A CN117499512A (en) 2023-11-14 2023-11-14 Message processing method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN117499512A true CN117499512A (en) 2024-02-02

Family

ID=89668760

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311515698.6A Pending CN117499512A (en) 2023-11-14 2023-11-14 Message processing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN117499512A (en)

Similar Documents

Publication Publication Date Title
CN109558525B (en) Test data set generation method, device, equipment and storage medium
CN106469049B (en) File scanning method and device
CN113079198A (en) Method and device for converting cloud platform interface protocol
CN111935081A (en) Data packet desensitization method and device
CN113126986A (en) Dynamic data-based form item rendering method, system, equipment and storage medium
CN113568604B (en) Method and device for updating wind control strategy and computer readable storage medium
CN111414339B (en) File processing method, system, device, equipment and medium
CN110058952B (en) Method and system for verifying embedded equipment file
CN117499512A (en) Message processing method and device and electronic equipment
CN115514759B (en) File forwarding method, electronic device and storage medium
CN109062880B (en) Electronic book file production method, electronic device, server and storage medium
CN106293862B (en) A kind of analysis method and device of expandable mark language XML data
CN115562686A (en) Lightweight packaging method, system, terminal and storage medium for Springboot project
EP3507689B1 (en) Java card application package used as a library package
CN105700825A (en) Thumbnail storage method and device based on Android system
CN114422624A (en) Data receiving method
US20010018732A1 (en) Parallel processor and parallel processing method
CN109347747B (en) Data processing method and device
CN113824637A (en) Method and device for forwarding message
CN113411234B (en) Interface testing method, system and computer readable storage medium
CN114679425B (en) Message processing method, network equipment and storage medium under 5G network
JP3661386B2 (en) Print control device
CN116954518B (en) Data processing method and device, electronic equipment and storage medium
CN112965833B (en) Log processing method and device
CN113568620B (en) Code file processing method, device, equipment and 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