Message transmission method, device, network equipment and readable storage medium
By deleting the fixed information headers of protocol messages in network devices and retaining only the fields that the CPU cares about, the problem of fixed information headers occupying CPU bandwidth is solved and transmission performance is improved.
Patent Information
- Application Number
- CN202211603026.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-13
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2042-12-13
AI Technical Summary
In existing network devices, the fixed information header of the protocol packet is longer, occupying CPU bandwidth, affecting transmission performance.
By deleting the fields in the fixed information header in the protocol packets to be sent to the CPU by the processing unit, only the target preset fields that the CPU cares about are retained, thereby reducing the number of fields in the fixed information header.
It reduces the CPU bandwidth occupied by fixed information headers, improves transmission performance, and improves the processing efficiency of network equipment.
Smart Images

Figure CN116016713B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a message transmission method, apparatus, network equipment and readable storage medium. Background Art
[0002] Network devices such as switches and routers in the current network generally have dedicated switching chips or NP (Network Processor) and other processing units to process data forwarding messages. Protocol messages involving network status maintenance, link establishment, etc. need to be sent to the CPU (Central Processing Unit) for processing. The protocol messages currently sent to the CPU will carry some additional message forwarding information (i.e., fixed information headers), which contain a series of additional information required for internal processing of the processing unit, such as which port it comes from and which port it is to be sent to. At the same time, the fields required for some special scenario applications, such as OAM, PTP, etc., are also included in the fixed information header. Therefore, in complex processing units, the additional information is generally long, generally requiring more than 40 bytes, and even up to 64 bytes. It can be seen from this that the fixed information header of the protocol message currently sent to the CPU has a relatively large overhead and will occupy the CPU bandwidth. Summary of the invention
[0003] The embodiments of the present application provide a message transmission method, apparatus, network device and readable storage medium, which reduce the CPU bandwidth occupied by the fixed information header and improve the transmission performance by deleting the fields in the fixed information header in the protocol message to be sent to the CPU by the processing unit.
[0004] The embodiments of the present application can be implemented as follows:
[0005] In a first aspect, an embodiment of the present application provides a message transmission method, which is applied to a processing unit for processing a data forwarding message in a network device, wherein the network device also includes a central processing unit CPU that is communicatively connected to the processing unit, and the method includes:
[0006] Obtaining a first protocol message that the processing unit needs to send to the CPU;
[0007] According to the target preset uploading field corresponding to the first protocol message, the field in the first fixed information header of the first protocol message is deleted to obtain a first message to be processed, wherein the first fixed information header includes the preset field included in the fixed information header required by the processing unit;
[0008] Sending the first message to be processed to the CPU.
[0009] In a second aspect, an embodiment of the present application provides a message transmission device, which is applied to a processing unit for processing data forwarding messages in a network device, wherein the network device also includes a central processing unit CPU that is communicatively connected to the processing unit, and the device includes:
[0010] A message acquisition module, used for acquiring a first protocol message that the processing unit needs to send to the CPU;
[0011] A processing module, configured to delete fields in a first fixed information header of the first protocol message according to a target preset uploading field corresponding to the first protocol message, so as to obtain a first message to be processed, wherein the first fixed information header includes preset fields included in the fixed information header required by the processing unit;
[0012] The processing module is further configured to send the first message to be processed to the CPU.
[0013] In a third aspect, an embodiment of the present application provides a network device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor can execute the machine executable instructions to implement the message transmission method described in the aforementioned embodiment.
[0014] In a fourth aspect, an embodiment of the present application provides a readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the message transmission method as described in the aforementioned implementation manner.
[0015] The message transmission method, device, network device and readable storage medium provided in the embodiment of the present application first obtain the first protocol message that the processing unit needs to send to the CPU, and then delete the fields in the first fixed information header of the first protocol message according to the target preset sending field corresponding to the first protocol message to obtain the first message to be processed, wherein the first fixed information header includes the preset fields included in the fixed information header required by the processing unit; finally, the first message to be processed is sent to the CPU. In this way, by deleting the fields in the fixed information header of the protocol message to be sent to the CPU by the processing unit, the CPU bandwidth occupation by the fixed information header is reduced, thereby improving the transmission performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 A block diagram of a network device provided in an embodiment of the present application;
[0018] Figure 2 One of the flow diagrams of the message transmission method provided in the embodiment of the present application;
[0019] Figure 3 for Figure 2 A schematic flow chart of the sub-steps included in step S120;
[0020] Figure 4 A second flowchart of the message transmission method provided in an embodiment of the present application;
[0021] Figure 5 for Figure 4 A schematic flow chart of the sub-steps included in step S150;
[0022] Figure 6 One of the schematic diagrams of the message transmission process provided in the embodiment of the present application;
[0023] Figure 7 This is the second schematic diagram of the message transmission process of the embodiment of the present application;
[0024] Figure 8 A block diagram of a message transmission device provided in an embodiment of the present application.
[0025] Icon: 100 - network device; 110 - memory; 120 - processor; 130 - communication unit; 200 - message transmission device; 210 - message acquisition module; 220 - processing module. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution 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 are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.
[0027] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0028] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0029] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0030] Please refer to Figure 1 , Figure 1 A block diagram of a network device 100 provided in an embodiment of the present application. The network device 100 may be, but not limited to, a router, a switch, etc. The network device 100 may include a processing unit, a CPU (Central Processing Unit) and a communication unit 130. The processing unit is used to process data forwarding messages, and the processing unit may be, but not limited to, a switching chip, an NP (Network Processor), etc. The processing unit may include a memory 110 and a processor 120. The CPU is used to process protocol messages such as network status maintenance and link establishment. The processing unit, the CPU and the communication unit 130 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components may be electrically connected to each other via one or more communication buses or signal lines.
[0031] The memory 110 is used to store programs or data. The memory 110 may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc.
[0032] The processor 120 is used to read / write data or programs stored in the memory 110 and perform corresponding functions. For example, the memory 110 stores a message transmission device 200, and the message transmission device 200 includes at least one software function module that can be stored in the memory 110 in the form of software or firmware. The processor 120 executes various functional applications and data processing by running software programs and modules stored in the memory 110, such as the message transmission device 200 in the embodiment of the present application, that is, realizing the message transmission method in the embodiment of the present application.
[0033] The communication unit 130 is used to establish a communication connection between the network device 100 and other communication terminals through the network, and to send and receive data through the network.
[0034] It should be understood that Figure 1 The structure shown is only a schematic diagram of the structure of the network device 100. The network device 100 may also include Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown. Figure 1 Each component shown in the figure can be implemented by hardware, software or a combination thereof.
[0035] Please refer to Figure 2 , Figure 2 One of the flow diagrams of the message transmission method provided in the embodiment of the present application. The method is applied to a processing unit in a network device, the processing unit is used to process data forwarding messages, and the network device also includes a CPU that is communicatively connected to the processing unit. The specific process of the message transmission method is described in detail below. In this embodiment, the method may include steps S110 to S130.
[0036] Step S110, obtaining a first protocol message that the processing unit needs to send to the CPU.
[0037] Step S120: According to the target preset sending field corresponding to the first protocol message, the field in the first fixed information header of the first protocol message is deleted to obtain a first message to be processed.
[0038] Step S130: sending the first message to be processed to the CPU.
[0039] In this embodiment, when the processing unit needs to send a protocol message to the CPU, the protocol message can be first obtained as the first protocol message. The first protocol message is generated by the processing unit based on the first original protocol message (i.e., the message body of the first protocol message) and the additional information required for internal processing of the processing unit, that is, the first fixed information header in the first protocol message includes the preset fields included in the fixed information header required by the processing unit.
[0040] When the first protocol message is obtained, the target preset sending field that needs to be carried when the first protocol message is sent to the CPU can be determined. Then, based on the target preset sending field, the fields in the first fixed information header are deleted, thereby reducing the fields in the first fixed information header, and the processed first protocol message is used as the first message to be processed. It can be understood that the target preset sending field is a field that the CPU is concerned about when processing the protocol message. Finally, the first message to be processed is sent to the CPU.
[0041] In this way, by deleting the fields in the fixed information header of the protocol message to be sent to the CPU by the processing unit, the CPU bandwidth occupied by the fixed information header is reduced, thereby improving the transmission performance.
[0042] Optionally, in this embodiment, the processing unit may store a first rule, which is used to determine the fields included in the fixed information header of the protocol message sent to the CPU. Figure 3 The first message to be processed is obtained in the manner shown. Figure 3 , Figure 3 for Figure 2 Schematic diagram of the flow of sub-steps included in step S120. In this embodiment, step S120 may include sub-steps S121 to S123.
[0043] Sub-step S121, determining the target preset uploading field that needs to be included in the first fixed information header according to the first rule.
[0044] Optionally, the specific storage method of the first rule can be determined in combination with actual needs, for example, the first rule can be stored in a CPUTransToCPU register. The first rule can be used to determine the target preset uploading field that needs to be retained in the first fixed information header.
[0045] As a possible implementation method, the first rule includes the correspondence between different types of protocol messages and preset upload fields, that is, the fields that the CPU is concerned about and that different types of protocol messages need to carry when they are uploaded to the CPU are pre-set. In this case, the first protocol message can be type analyzed to obtain the first type of the first protocol message; then, based on the correspondence between different types of protocol messages and preset upload fields included in the first rule and the first type, the preset upload field corresponding to the first type is obtained, and the preset upload field corresponding to the first type is used as the target preset upload field. In this way, the fields that need to be uploaded can be determined based on the type of the first protocol message, which is more flexible.
[0046] As another possible implementation, the first rule may only include a preset sending field, that is, any type of protocol message needs to include the preset sending field in the first rule when it is sent to the CPU. In this case, the preset sending field in the first rule may be directly determined as the target preset sending field. In this way, the first rule can be quickly set.
[0047] Sub-step S122, determining a field to be deleted according to the preset field required by the processing unit and the target preset uploaded field.
[0048] Sub-step S122: performing field deletion processing on the first protocol message according to the field to be deleted to obtain the first message to be processed.
[0049] When the target preset uploading field is determined, the preset field included in the internal processing requirement of the processing unit can be compared with the target preset uploading field to determine the field to be deleted. That is, the target preset uploading field in the preset field included in the internal processing requirement of the processing unit is the field to be retained, and the remaining fields are the fields to be deleted. Then, the field to be deleted in the first fixed information header of the first protocol message can be deleted to obtain the first message to be processed. Afterwards, the first message to be processed can be sent to the CPU.
[0050] The inventor of the present application has also found through research that when the current CPU sends a protocol message to the processing unit, it will also carry in the message all the preset fields included in the fixed information header required by the processing unit. This will cause the fixed information header in the protocol message sent by the CPU to be relatively long, occupying the CPU's bandwidth.
[0051] To reduce CPU bandwidth usage, the CPU can also determine the fields to be carried when sending protocol messages based on the configuration, if not all the fields required by the processing unit are carried. Figure 4 , Figure 4 The second flowchart of the message transmission method provided in the embodiment of the present application. In this embodiment, the method may further include steps S140 to S160.
[0052] Step S140: receiving a second protocol message sent by the CPU.
[0053] In this embodiment, the CPU generates the second protocol message based on the second original protocol message (i.e., the message body of the second protocol message) and the target preset sending field corresponding to the second original protocol message. The target preset sending field corresponding to the second original protocol message can be determined by the CPU based on pre-configuration. The number of fields of the target preset sending field is less than the number of fields of the preset fields included in the fixed information header required by the processing unit in the current prior art. It can be understood that the target preset sending field is a field that the CPU must carry when sending the message, such as a field regarding message forwarding, which is used to indicate which physical port the message is ultimately forwarded from, how the message is edited inside the switching chip, etc., and can be specifically set in combination with actual needs.
[0054] Step S150: performing field filling processing on the second fixed information header of the second protocol message according to the preset fields included in the fixed information header required by the processing unit to obtain a second message to be processed.
[0055] Step S160: Process the second message to be processed by the processing unit.
[0056] When the second protocol message is obtained, the target preset sending field included in the second protocol message can be determined by analysis. Then, according to the preset field included in the fixed information header required by the processing unit and the target preset sending field, field filling processing is performed to obtain the second message to be processed. The second message to be processed includes the number of fields of the preset fields included in the fixed information header required by the processing unit. Afterwards, the processing unit can process the second message to be processed in the same manner as the data forwarding message. In this way, the CPU bandwidth occupied by the sent protocol message can be reduced, while ensuring that the processing unit can obtain messages that meet its requirements for processing.
[0057] Optionally, in this embodiment, the processing unit may store a second rule, and the second rule is used to determine the fields included in the fixed information header of the protocol message sent by the CPU, which can be obtained by Figure 5 The second message to be processed is obtained in the manner shown. Figure 5 , Figure 5 for Figure 4 Schematic diagram of the flow of sub-steps included in step S150. In this embodiment, step S150 may include sub-steps S151 to S153.
[0058] Sub-step S151: determining the target preset delivery field included in the second fixed information header according to the second rule.
[0059] Optionally, the specific storage method of the second rule can be determined in combination with actual needs, for example, the second rule is stored in the CPUTransFromCPU register. In this way, there is no need to perform fixed information header field analysis on the second protocol message, but the target preset delivery field included in the second protocol message is determined based on the second rule.
[0060] As a possible implementation, the second rule includes a correspondence between different types of protocol messages and preset delivery fields, that is, the fields that different types of protocol messages need to carry when they are delivered by the CPU are preset. In this case, the second protocol message can be type analyzed to obtain the second type of the second protocol message; then, according to the correspondence between different types of protocol messages and preset delivery fields included in the second rule and the second type, the preset delivery field corresponding to the second type is obtained, and the preset delivery field corresponding to the second type is used as the target preset delivery field. In this way, the field carried when delivering can be determined according to the type of the second protocol message.
[0061] Correspondingly, the CPU may also store the above-mentioned second rule, which may determine the target preset sending field corresponding to the second original protocol message according to the correspondence between different types of protocol messages and the preset sending fields and the second original protocol message, and then generate the second protocol message based on the second original protocol message and the target preset sending field.
[0062] As another possible implementation, the second rule may include only a preset delivery field, that is, any type of protocol message needs to include the preset delivery field in the second rule when it is delivered. In this case, the preset delivery field in the second rule may be directly determined as the target preset delivery field. In this way, the second rule can be quickly set.
[0063] Correspondingly, the CPU may also store the second rule, and may generate the second protocol message according to the preset delivery field included in the second rule and the second original protocol message.
[0064] Sub-step S152, determining the fields to be filled according to the preset fields required by the processing unit and the target preset delivery fields.
[0065] Sub-step S153: performing field filling processing on the second fixed information header according to the field to be filled, to obtain the second message to be processed.
[0066] When the target preset delivery field is determined, the preset field included in the internal processing requirements of the processing unit can be compared with the target preset delivery field to determine the field to be filled. That is, the field that is not included in the target preset delivery field in the preset field included in the internal processing requirements of the processing unit is the field that needs to be filled. Then, the second protocol message can be analyzed and / or corresponding information can be obtained from other aspects to determine the specific content of the field to be filled, and then the second fixed information header can be processed to fill the field, so as to obtain the second message to be processed. After that, the processing unit can process the second message to be processed according to the normal process.
[0067] Optionally, in this embodiment, any protocol message sent to the CPU or any protocol message sent by the CPU includes a message source port and a message destination port. Optionally, the fixed information header of the protocol message sent to the CPU may also include the reason why the message is sent to the CPU, and the fixed information header of the protocol message sent by the CPU may also include a field for indicating whether to skip the internal logic of the processing unit. Among them, the reason why the message is sent to the CPU facilitates the CPU to directly determine the processing method of the message based on the reason without the need for cause analysis.
[0068] Optionally, the fields that need to be carried when the message is sent to the CPU and the fields that are required when the message is sent by the CPU can also be set according to actual needs. For example, whether to send to the CPU can be configured for the following fields: svlan_id, cvlan_id_valid. The following fields can also be configured to determine whether to send to the CPU or send by the CPU: message color field color_valid, message priority field priority_valid, message cos field src_cos_valid, message ttl field ttl_valid, message fid field fid_valid, message isolation isolation_id_valid, cvlan operation field ctag_op_valid, svlan operation field stag_op_valid, message timestamp field ingress_ts_valid, etc.
[0069] Generally, the current fixed information header directly uses the fields for transmitting messages between the forwarding modules inside the processing unit. The overhead of the fixed information header is relatively large, wasting the transmission bandwidth of the CPU. However, the embodiment of the present application filters the interactive transmission information between the modules inside the ASIC (Application-Specific Integrated Circuit) and only extracts the fields that the CPU is concerned about, thereby improving the transmission performance.
[0070] Combine the following Figure 6 and Figure 7 The above message transmission method is described with examples.
[0071] Assuming that a protocol message normally sent by the switch chip to the CPU is 64 bytes, and carries an additional 40 bytes of PacketInfo (ie, a fixed information header), the actual bandwidth effective utilization rate is 64 / (40+64)=61.5%.
[0072] And as Figure 6 As shown, a CPUTrans module is added to the switching chip to determine the fields that need to be carried in the fixed information header when sending to the CPU according to the type of message. For example, ordinary messages only carry the source port and destination port of the CPU; others, such as OAM messages, need to carry additional OAM-related information, such as OAM message type, reporting time, etc. Based on the determined fields that need to be carried, the fields that the CPU does not care about in PacketInfo are removed, and only the fields that are concerned are retained. The fixed information header after deletion is 20Bytes, and the utilization rate is increased to 64 / (20+64)=76.2%. It can be seen that this method can greatly improve the bandwidth and transmission performance of the CPU.
[0073] After the processing is completed, the processed message including the fixed information header can be sent to the CPU. The message can be sent to the CPU via DMA (Direct Memory Access) or CPU MAC, which can be determined based on actual needs.
[0074] When the CPU sends a message, Figure 7 As shown, the CPU only needs to carry the necessary message forwarding information. For example, the fixed information header of the message sent by the CPU only includes fields for indicating which physical port to go out from and how to edit the message inside the switching chip. Therefore, only basic additional 20 bytes of information are required. After the chip CPUTrans module, the 20Bytes of information in the sent message will be converted into the 40Btyes information required inside the switching chip, that is, it is filled. In this way, the bandwidth utilization rate is also increased to 64 / (20+64)=76.2%.
[0075] Among them, the CPUTransToCPU register and the CPUTransFromCPU register can be configured in advance to indicate the fields carried in the message sent down by the switching chip and the fields carried in the message sent up. Optionally, the user can configure in advance which specific fields need to be sent to the CPU and which specific fields need to be carried when the CPU sends down the message according to their own needs.
[0076] In this way, by adding a CPUTrans module inside the switching chip, the PacketInfo carried by the CPU for transmission and reception is compressed PacketInfo, which reduces the size of the PacketInfo carried when interacting with the CPU, thereby significantly improving the performance of sending and receiving messages in some high-speed message sending and receiving scenarios such as CPU soft forwarding.
[0077] In order to execute the corresponding steps in the above embodiments and various possible methods, a method for implementing a message transmission device 200 is provided below. Optionally, the message transmission device 200 may adopt the above Figure 1 The device structure of the network device 100 shown in FIG. Figure 8 , Figure 8A block diagram of a message transmission device 200 provided in an embodiment of the present application. It should be noted that the basic principle and technical effects of the message transmission device 200 provided in this embodiment are the same as those of the above-mentioned embodiments. For the sake of brief description, for parts not mentioned in this embodiment, reference can be made to the corresponding contents in the above-mentioned embodiments. The message transmission device 200 is applied to a processing unit for processing data forwarding messages in a network device. The network device also includes a CPU that is communicatively connected to the processing unit. The message transmission device 200 includes: a message acquisition module 210 and a processing module 220.
[0078] The message acquisition module 210 is used to obtain a first protocol message that the processing unit needs to send to the CPU.
[0079] The processing module 220 is used to delete the fields in the first fixed information header of the first protocol message according to the target preset sending field corresponding to the first protocol message to obtain the first message to be processed. The first fixed information header includes the preset fields included in the fixed information header required by the processing unit.
[0080] The processing module 220 is further configured to send the first message to be processed to the CPU.
[0081] Optionally, in this embodiment, the message acquisition module 210 is also used to receive a second protocol message sent by the CPU, wherein the second protocol message is generated by the CPU based on the second original protocol message and the target preset sending field corresponding to the second original protocol message, and the number of fields of the target preset sending field is less than the number of fields of the preset fields included in the fixed information header required by the processing unit. The processing module 220 is also used to: perform field filling processing on the second fixed information header of the second protocol message according to the preset fields included in the fixed information header required by the processing unit to obtain a second message to be processed; and process the second message to be processed by the processing unit.
[0082] Optionally, the above modules can be stored in the form of software or firmware. Figure 1 The memory 110 shown in FIG. Figure 1 Meanwhile, the data and program codes required for executing the above modules may be stored in the memory 110.
[0083] An embodiment of the present application also provides a readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the message transmission method is implemented.
[0084] In summary, the embodiments of the present application provide a message transmission method, device, network device and readable storage medium, firstly obtaining a first protocol message that the processing unit needs to send to the CPU, and then deleting the fields in the first fixed information header of the first protocol message according to the target preset sending field corresponding to the first protocol message, to obtain a first message to be processed, wherein the first fixed information header includes the preset fields included in the fixed information header required by the processing unit; finally, the first message to be processed is sent to the CPU. In this way, by deleting the fields in the fixed information header of the protocol message to be sent to the CPU by the processing unit, the CPU bandwidth occupied by the fixed information header is reduced, thereby improving the transmission performance.
[0085] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0086] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0087] 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 can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0088] The above description is only an optional embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A message transmission method, characterized in that: A processing unit for processing data forwarding messages applied to a network device, wherein the processing unit is a switching chip, and the network device also includes a central processing unit CPU that is communicatively connected to the processing unit, and the method includes: Obtaining a first protocol message that the processing unit needs to send to the CPU; According to the target preset sending field corresponding to the first protocol message, the field in the first fixed information header of the first protocol message is deleted to obtain a first message to be processed, wherein the first fixed information header includes the preset field included in the fixed information header required by the processing unit, and the target preset sending field is a field in the first fixed information header that is retained during the deletion; Sending the first message to be processed to the CPU; The processing unit stores a first rule, the first rule being used to determine the fields included in the fixed information header of the protocol message sent to the CPU, and the fields in the first fixed information header of the first protocol message are deleted according to the target preset sending field corresponding to the first protocol message to obtain the first message to be processed, including: Determine, according to the first rule, a target preset uploading field that needs to be included in the first fixed information header; Determine a field to be deleted according to the preset field required by the processing unit and the target preset field to be sent; According to the field to be deleted, performing field deletion processing on the first protocol message to obtain the first message to be processed; Among them, the first rule includes the correspondence between different types of protocol messages and preset sending fields, and determining the target preset sending field that needs to be included in the first fixed information header according to the first rule includes: obtaining a first type of the first protocol message; determining the target preset sending field according to the correspondence between different types of protocol messages and preset sending fields and the first type.
2. The method according to claim 1, characterized in that The first rule includes a preset uploading field, and determining, according to the first rule, a target preset uploading field that needs to be included in the first fixed information header includes: The preset sending field included in the first rule is determined as the target preset sending field.
3. The method according to any one of claims 1 to 2, characterized in that: The method further comprises: receiving a second protocol message sent by the CPU, wherein the second protocol message is generated by the CPU based on a second original protocol message and a target preset sending field corresponding to the second original protocol message, and the number of fields of the target preset sending field is less than the number of fields of the preset fields included in the fixed information header required by the processing unit; According to the preset fields included in the fixed information header required by the processing unit, a field filling process is performed on the second fixed information header of the second protocol message to obtain a second message to be processed; The second message to be processed is processed by the processing unit.
4. The method according to claim 3, characterized in that: The processing unit stores a second rule, the second rule being used to determine a field included in a fixed information header of a protocol message sent by the CPU, and performing field filling processing on a second fixed information header of the second protocol message according to a preset field included in the fixed information header required by the processing unit to obtain a second message to be processed, including: Determine, according to the second rule, a target preset delivery field included in the second fixed information header; Determine the fields to be filled according to the preset fields required by the processing unit and the target preset delivered fields; According to the fields to be filled, field filling processing is performed on the second fixed information header to obtain the second message to be processed.
5. The method according to claim 3, characterized in that: The fixed information header of the protocol message sent to the CPU and / or the protocol message sent by the CPU includes a message source port and a message destination port. The fixed information header of the protocol message sent to the CPU also includes the reason for sending the message to the CPU. The fixed information header of the protocol message sent by the CPU also includes a field for indicating whether to skip the internal logic of the processing unit.
6. A message transmission device, characterized in that: A processing unit for processing data forwarding messages applied to a network device, wherein the processing unit is a switching chip, and the network device also includes a central processing unit CPU that is communicatively connected to the processing unit, and the device includes: A message acquisition module, used for acquiring a first protocol message that the processing unit needs to send to the CPU; A processing module, configured to delete fields in a first fixed information header of the first protocol message according to a target preset uploading field corresponding to the first protocol message, to obtain a first message to be processed, wherein the first fixed information header includes preset fields included in the fixed information header required by the processing unit, and the target preset uploading field is a field in the first fixed information header that is retained during deletion; The processing module is further configured to send the first message to be processed to the CPU; The processing unit stores a first rule, the first rule being used to determine a field included in a fixed information header of a protocol message sent to the CPU, and the processing module is specifically used to: Determine, according to the first rule, a target preset uploading field that needs to be included in the first fixed information header; Determine a field to be deleted according to the preset field required by the processing unit and the target preset field to be sent; According to the field to be deleted, performing field deletion processing on the first protocol message to obtain the first message to be processed; Among them, the first rule includes the correspondence between different types of protocol messages and preset uploading fields, and the processing module is specifically used to: obtain the first type of the first protocol message; determine the target preset uploading field according to the correspondence between different types of protocol messages and preset uploading fields and the first type.
7. A network device, characterized in that: It includes a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor can execute the machine executable instructions to implement the message transmission method described in any one of claims 1-5.
8. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the message transmission method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Point-to-point protocol (PPP) hardware acceleration system and achieving method thereof
CN102932458A
Message transmission method and device and sender equipment
CN110381071A