A spontaneous packet forwarding method and device, electronic equipment and storage medium
By marking and collecting information from self-generated packets in the packet sending pipeline to form target self-generated packets, the problems of timeliness in self-generated packet collection and server load are solved, information sharing and full collection are realized, and the timeliness and forwarding efficiency of information are guaranteed.
Patent Information
- Application Number
- CN202310814963.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-03
- Publication Date
- 2026-03-17
- Estimated Expiration
- 2043-07-03
AI Technical Summary
In existing technologies, the timeliness of spontaneous packet collection is poor and the server processing burden is heavy. Existing methods read device information on the control plane or send it to the forwarding plane for independent reading, which increases the processing burden on the analysis server.
By marking self-sent packets in the uplink module of the packet sending pipeline to form self-sent packets to be forwarded, and collecting information between pipelines, the collected information is written into the packets to form target self-sent packets for forwarding, thereby realizing information sharing and full collection.
It effectively reduces the processing burden on the server, ensures the timeliness of information, and completes the collection of all information without increasing hardware resources, without affecting the efficiency of message forwarding.
Smart Images

Figure CN116708327B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of switch technology, and in particular to a method, apparatus, electronic device, and storage medium for self-generated packet forwarding. Background Technology
[0002] In addition to forwarding packets, network communication devices also need to be able to actively generate and send packets in specific application scenarios. Typical application scenarios include detection packets, such as BFDs; and device information collection packets, which need to be periodically sent to analysis servers for analysis.
[0003] Programmable switch forwarding chips employ a pipeline concept. A pipeline can be functionally divided into uplink and downlink, with uplink handling data reception and downlink handling data transmission. To improve the parallel processing efficiency of the forwarding chip, there is usually more than one pipeline. Pipelines are typically used for sending and forwarding packets. However, current switches can also generate their own packets and collect information from the chip through these self-generated packets.
[0004] Existing self-sending methods can read information from each pipeline on the device at the control plane, which can satisfy the full information reading, but this method is not timely enough; or it can send packets to the forwarding plane and read them independently for each pipeline, sending one packet for each pipeline. This method will greatly increase the processing burden on the analysis server, and increase the difficulty of packet analysis and processing. Summary of the Invention
[0005] This invention provides a method, apparatus, electronic device, and storage medium for forwarding self-generated packets, in order to solve the problems of poor timeliness in information collection through self-generated packets and heavy server processing burden.
[0006] According to one aspect of the present invention, a self-sending packet forwarding method is provided, applied to a switch, the switch comprising: at least two pipelines, one of the at least two pipelines being a packet sending pipeline; the method comprising:
[0007] After receiving the self-sent packet, the uplink module of the packet sending pipeline marks the self-sent packet to form a self-sent packet to be forwarded.
[0008] The uplink module of the packet sending pipeline collects message information based on the packet to be forwarded from the packet sending message;
[0009] The uplink module of the packet sending pipeline writes the collected information into the self-sent packet to be forwarded, forming the first self-sent packet, and redirects the first self-sent packet to the module of the next pipeline.
[0010] The next pipeline module collects pipeline information, and after collecting information from all pipelines, it forms a target spontaneous packet and forwards the target spontaneous packet.
[0011] According to another aspect of the present invention, a self-sending packet forwarding device is provided, applied to a switch, the switch comprising: at least two pipelines, one of the at least two pipelines being a packet sending pipeline, each of the pipelines comprising an uplink module and a downlink module, the uplink module of the packet sending pipeline comprising a first parsing module, an uplink information acquisition module and a redirection module;
[0012] The first parsing module in the uplink module of the packet sending pipeline is used to mark the self-sent packet after obtaining it, and form a self-sent packet to be forwarded.
[0013] The uplink information acquisition module in the uplink module of the packet sending pipeline is used to collect message information based on the packet to be forwarded from the packet sending module.
[0014] The redirection module in the uplink module of the packet sending pipeline is used to write the collected information into the self-sent packet to be forwarded, forming a first self-sent packet, and redirecting the first self-sent packet to the module of the next pipeline.
[0015] The module of the next pipeline is used to collect information from the pipeline, and after collecting information from all pipelines, to form a target spontaneous packet and forward the target spontaneous packet.
[0016] According to another aspect of the present invention, an electronic device is provided, which, when functioning as a switch, includes:
[0017] At least one processor; and
[0018] A memory communicatively connected to the at least one processor; wherein,
[0019] The memory stores a computer program that can be executed by the at least one processor, which is then executed by the at least one processor to enable the at least one processor to perform the self-sending packet forwarding method according to any embodiment of the present invention.
[0020] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions, the computer instructions being configured to cause a processor to execute and implement the self-sending packet forwarding method according to any embodiment of the present invention.
[0021] The technical solution of this invention involves the following steps: First, after acquiring a self-generated packet, the uplink module of the packet transmission pipeline marks the self-generated packet to form a self-generated packet to be forwarded. The uplink module then collects packet information based on this self-generated packet. Next, the uplink module writes the collected information into the self-generated packet to form a first self-generated packet, and redirects this first self-generated packet to the next pipeline module until information from all pipelines has been collected. Finally, the next pipeline, after collecting information from all pipelines, forms a target self-generated packet and forwards it. This solution addresses the issues of poor timeliness and server processing burden when collecting information from self-generated packets. To address the significant challenges, this application uses a pipeline to forward spontaneously generated packets. Spontaneous packets are marked to form packets to be forwarded. Information is collected from these packets and written into them to form the first spontaneously generated packet. In this embodiment, the collected information is carried in the packet to be forwarded, and information from all pipelines is collected through redirection to form a target spontaneously generated packet for forwarding. This target packet carries information from all pipelines. Since there is only one spontaneously generated packet, the server's processing load is effectively reduced. Furthermore, the forwarding of spontaneously generated packets across pipelines ensures timely information collection. In this application, the spontaneously generated packets and forwarded packets share the same pipeline, without affecting forwarding efficiency, and comprehensive collection based on the forwarding plane information can be achieved without additional hardware resources.
[0022] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a flowchart of a self-sent packet forwarding method provided in Embodiment 1 of the present invention;
[0025] Figure 2 This is a flowchart of a self-sent packet forwarding method provided in Embodiment 2 of the present invention;
[0026] Figure 3This is a schematic diagram of the structure of a self-sending packet forwarding device according to Embodiment 3 of the present invention;
[0027] Figure 4 This is a schematic diagram of the structure of a switch according to Embodiment 3 of the present invention;
[0028] Figure 5 This is an example diagram illustrating how a switch forwards spontaneously generated packets according to Embodiment 3 of the present invention.
[0029] Figure 6 This is a schematic diagram of the structure of an electronic device that implements the self-sent packet forwarding method of this invention. Detailed Implementation
[0030] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0031] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0032] Example 1
[0033] Figure 1 This is a flowchart of a self-sent packet forwarding method provided in Embodiment 1 of the present invention. This embodiment is applicable to situations where information collection is achieved by forwarding self-sent packets. This method can be applied to a switch, which includes at least two pipelines, one of which is a packet sending pipeline. Figure 1 As shown, the method includes:
[0034] S101. After obtaining the self-sent packet, the uplink module of the packet sending pipeline marks the self-sent packet to form a self-sent packet to be forwarded.
[0035] Each pipeline in this embodiment includes an uplink and a downlink. The uplink refers to data transmission to the execution device, which can be achieved through a specific port. The downlink refers to data leaving the execution device, which can be achieved through a specific port and transmitted to other devices. Both the uplink and downlink of the pipeline include corresponding modules that perform corresponding functions to achieve data processing; or, it can be understood that the uplink and downlink of the pipeline are composed of corresponding modules to achieve corresponding uplink and downlink functions. In this embodiment, the modules in the uplink of the pipeline are designated as uplink modules, and the modules in the downlink are designated as downlink modules. Each uplink and downlink module includes at least one module. Both the uplink and downlink modules are modules capable of performing data processing functions.
[0036] In this embodiment, the self-sent packet to be forwarded can be specifically understood as a self-sent packet that requires forwarding between different pipelines of the switch. In this embodiment, the packet-sending pipeline can be any pipeline in the switch, and the packet-sending pipeline can be pre-configured.
[0037] Specifically, when collecting information, the switch generates self-generated packets and sends them to the uplink module of the packet pipeline for information collection. Upon receiving the self-generated packets, the uplink module of the packet pipeline marks them. Marking can be done by adding preset characters or other information to the packet header. The marked self-generated packets are then used as self-generated packets to be forwarded.
[0038] S102, The uplink module of the packet sending pipeline collects message information based on the self-sent packets to be forwarded.
[0039] The uplink module of the packet sending pipeline processes the packets to be forwarded by parsing them to determine the types of information to be collected, and then collects the corresponding packet information, such as real-time forwarding information on the forwarding path. For example, the information collected may be the forwarding traffic volume, forwarding delay information, device information, packet loss information, etc.
[0040] S103, the uplink module of the packet sending pipeline writes the collected information into the self-sent packet to be forwarded, forming the first self-sent packet, and redirects the first self-sent packet to the module of the next pipeline.
[0041] In this embodiment, the first spontaneously generated packet can be specifically understood as a spontaneously generated packet carrying the collected information. In this embodiment, the first spontaneously generated packet is formed by information collection by the uplink module of the packet generation pipeline. The next pipeline can be specifically understood as the next pipeline to which the packet in the packet generation pipeline flows, which is a pipeline in the switch. The uplink module of the pipeline has a redirection function, which can redirect packets from the current pipeline to other pipelines.
[0042] After collecting information, the uplink module of the packet sending pipeline writes the information into the self-sent packet to be forwarded according to pre-set rules. For example, the pre-set rules could be writing into pre-defined fields, such as each pipeline having its corresponding field; or writing into specified fields sequentially, such as pre-setting multiple empty fields and writing the information into them sequentially after collection. The collected information is then written into the self-sent packet to be forwarded to form the first self-sent packet. The first self-sent packet is then redirected to the next pipeline, and the packet information collection is repeated until the packet has flowed through all pipelines and information from all pipelines has been collected. During redirection, the next pipeline corresponding to the packet sending pipeline can be pre-determined, and the first self-sent packet can be redirected to the module of that next pipeline.
[0043] S104. The next pipeline module collects pipeline information, and after collecting information from all pipelines, it forms a target spontaneous packet and forwards the target spontaneous packet.
[0044] In this embodiment, the target spontaneous packet can be specifically understood as a spontaneous packet carrying information collected from all pipelines.
[0045] The next pipeline module includes an uplink module and a downlink module. The uplink and downlink modules of the next pipeline collect message information using the methods described above. After collecting information from all pipelines, a target spontaneous packet is formed. In this embodiment, as the spontaneous packet flows through each pipeline, the collected information is sequentially written into this packet. Therefore, the formed target spontaneous packet can include information from all pipelines, achieving comprehensive information collection. The target spontaneous packet, containing full information from all pipelines, is then forwarded normally.
[0046] This invention provides a method for forwarding self-generated packets, solving the problems of poor timeliness and high server processing burden when collecting information through self-generated packets. The method forwards self-generated packets through a pipeline, marking them to form a self-generated packet to be forwarded. Information is collected from this self-generated packet and written into it to form a first self-generated packet. This embodiment carries the collected information in the self-generated packet to be forwarded and uses redirection to collect information from all pipelines, forming a target self-generated packet for forwarding. The target self-generated packet carries information from all pipelines. Since there is only one self-generated packet, the server processing burden is effectively reduced. Furthermore, the forwarding of self-generated packets in each pipeline ensures timely information collection. The self-generated packets and forwarded packets used in this application share the pipeline, without affecting packet forwarding efficiency, and comprehensive collection based on forwarding plane information can be completed without additional hardware resources.
[0047] Example 2
[0048] Figure 2 This is a flowchart of a self-sent packet forwarding method provided in Embodiment 2 of the present invention. This embodiment is a refinement based on the above embodiments. Figure 2 As shown, the method includes:
[0049] S201, The uplink module of the packet sending pipeline receives and parses the message to be forwarded.
[0050] In this embodiment, the message to be forwarded can be specifically understood as a message that needs to be forwarded through the pipeline. The message to be forwarded can be a normal forwarding message or a self-generated message; among them, the forwarding message mainly refers to the message forwarded by the current switch. The forwarding message arrives at the uplink module of the pipeline from the inlet, and at this time the message is called an uplink message. After being processed by the uplink module, the pipeline where the exit is located is found, and then it is transmitted to the downlink module of the pipeline where the exit is located. At this time the message is called a downlink message. After being processed by the downlink module, it is transmitted out through the exit; the self-generated message mainly refers to the message generated by the current switch itself.
[0051] In this embodiment, the data volume of the self-generated packets is relatively small. Therefore, when the switch forwards the self-generated packets through a pipeline, the pipeline used is the same pipeline used when forwarding forwarded packets. That is, in this embodiment, the pipeline used for forwarding self-generated packets and forwarding forwarded packets is shared.
[0052] The uplink module of the packet sending pipeline can receive packets to be forwarded transmitted to this pipeline through its port. It then parses these packets, for example, parsing all fields or specific fields and headers. Based on the parsing results, it determines whether the packet to be forwarded is a self-sent packet. The packet received in this step can be either a forwarded packet or a self-sent packet.
[0053] The switch also includes a control plane or packet sending module. Accordingly, before the uplink module of the packet sending pipeline receives and parses the message to be forwarded, the control plane or packet sending module constructs a self-sent packet when the current time meets the message construction time condition or detects that the trigger condition is met, and sends it to the uplink module of the packet sending pipeline through a predetermined packet sending port.
[0054] In this embodiment, the current time can be specifically understood as the time for determining whether to construct a self-generated packet; the packet construction time condition can be that the time difference between the current time and the last self-generated packet is equal to a preset value, or that the current time is a pre-set time, etc.; the triggering condition can be that the switch is congested, or that a signal sent by another device is received, or that an operation triggered by the user is received, etc.
[0055] Both the control plane and the packet sending module of the forwarding chip in the switch can generate self-generated packets. The control plane or the packet sending module obtains the current time and determines whether the current time meets the packet construction time condition. If it does, it constructs a self-generated packet according to the pre-set self-generated packet construction rules; or, when a trigger condition is detected, it constructs a self-generated packet according to the pre-set self-generated packet construction rules. In this embodiment, after generating self-generated packets, the control plane and the packet sending module can send them to the uplink module of the packet pipeline through their respective packet sending ports. The corresponding packet sending ports of the control plane and the packet sending module can be pre-set. For example, self-generated packets generated by the control plane are generally sent through the downlink CPU port of the switch chip, i.e., the downlink CPU port of the chip is pre-set as the packet sending port; packets generated by the packet sending module are usually sent through the reserved port inside the forwarding chip of the switch, i.e., the reserved port inside the forwarding chip is pre-set as the packet sending port.
[0056] S202. When the uplink module of the packet sending pipeline determines that the packet to be forwarded meets the self-sending condition, it determines that the packet to be forwarded is a self-sending packet.
[0057] In this embodiment, the self-sent packet condition can be specifically understood as the condition for determining whether a packet is a self-sent packet. The self-sent packet condition can be preset. The self-sent packet condition includes at least one of the following: the packet to be forwarded includes a self-sent packet marker, and the port number information in the packet to be forwarded is preset port number information. The self-sent packet marker can be specific information; the port number information can be specifically understood as the information of the port that sent the packet to be forwarded. The port number information can uniquely identify a port and can be numbers, letters, etc.; the preset port number information can be specifically understood as the port number information that has been preset.
[0058] After parsing the packet to be forwarded, the uplink module of the packet transmission pipeline determines whether the packet meets the self-sending condition based on the parsed information. For example, it checks whether the packet contains a self-sending flag, or it identifies the port number information in the packet and determines whether the port number information carried in the packet is a preset port number. If the packet contains a self-sending flag and / or the port number information in the packet is a preset port number, the packet is determined to meet the self-sending condition and is therefore identified as a self-sending packet.
[0059] In this embodiment of the application, since self-generated packets are sent through the CPU port or the port of the forwarding chip, the packets can be distinguished by identifying the port number information; or the control plane or packet sending module can directly carry a self-generated packet tag in the self-generated packet when forming the self-generated packet.
[0060] S203. After the uplink module of the packet sending pipeline obtains the self-sent packet, it marks the self-sent packet to form a self-sent packet to be forwarded.
[0061] After determining that the received message to be forwarded is a self-sent message, the uplink module of the packet sending pipeline marks the self-sent message, for example, by adding the msgsend mark to the message header. Subsequently, when the message is transferred and information is collected and processed in each pipeline, it is identified as such a self-sent message by the msgsend mark.
[0062] S204. When the uplink module of the self-sent packet pipeline determines that the self-sent packet to be forwarded has a tag, it determines the type of information to be collected based on the self-sent packet to be forwarded.
[0063] In this embodiment, the type of information to be collected can be specifically understood as the type of information to be collected during information collection, such as forwarding traffic size, forwarding delay information, packet loss information, etc. When the uplink module of the self-sent packet pipeline determines that the self-sent packet to be forwarded has the msgsend tag, it can then determine that information collection will be performed through the self-sent packet to be forwarded. The self-sent packet to be forwarded is parsed to determine the type of information to be collected. The self-sent packet to be forwarded may include the type of information to be collected. In this case, the type of information to be collected can be determined directly by parsing the self-sent packet to be forwarded; or the information type and its associated data can be predefined, the self-sent packet to be forwarded can be parsed to determine the data in the self-sent packet to be forwarded, and the type of information to be collected can be determined based on the association between the data and the information type.
[0064] As an optional embodiment of this example, this optional embodiment further optimizes the uplink module of the self-sending packet pipeline to determine the type of information to be collected based on the self-sending packets to be forwarded, as follows:
[0065] A1. The uplink module of the self-sent packet pipeline parses the self-sent packet to be forwarded and determines the self-sent packet tag and / or forwarding flow characteristic information.
[0066] In this embodiment, the forwarding flow feature information can be specifically understood as the information of the forwarding flow collected when the packet is forwarded between pipelines. The uplink module of the self-sent packet pipeline parses specific fields or all fields of the self-sent packet to be forwarded to obtain the self-sent packet tag and / or forwarding flow feature information.
[0067] A2. The uplink module of the self-generated packet pipeline determines the type of information to be collected based on the self-generated packet tag and / or forwarding flow characteristic information.
[0068] The types of information to be collected can be pre-set according to the self-generated packet markers. After determining the self-generated packet markers, the uplink module of the self-generated packet pipeline determines the corresponding types of information to be collected based on the self-generated packet markers and the pre-set correspondence. For example, the self-generated packet markers can mark device information, and the types of information to be collected that can be determined based on the self-generated packet markers can be device port congestion, buffer usage, etc. The forwarding flow feature information can include the device's five-tuple, packet loss information of a certain pipeline, latency information, etc. After determining the forwarding flow feature information, the uplink module of the self-generated packet pipeline can directly determine the types of information to be collected based on the forwarding flow feature information.
[0069] S205. The uplink module of the self-generating packet pipeline collects message information according to the type of information to be collected.
[0070] After determining the type of information to be collected, the uplink module of the self-contained packet pipeline collects the corresponding type of information. In this embodiment, message information collection can collect at least one type of information; that is, the number of information types to be collected can be one or more, or the information types to be collected can include one or more information types.
[0071] S206. The uplink module of the packet sending pipeline writes the collected information into the self-sent packet to be forwarded, forming the first self-sent packet.
[0072] S207. The uplink module of the packet sending pipeline redirects the first self-sent packet to the downlink module of the next pipeline.
[0073] The uplink module of the packet sending pipeline has a redirection function, which redirects the first self-sent packet to the downlink module of the next pipeline to collect downlink information.
[0074] As an optional embodiment of this embodiment, this optional embodiment further optimizes the uplink module of the packet sending pipeline to redirect the first self-sent packet to the downlink module of the next pipeline as follows: the uplink module of the packet sending pipeline queries a pre-determined redirection mapping table, determines the next pipeline, and redirects the first self-sent packet to the downlink module of the next pipeline.
[0075] In this embodiment, the redirection mapping table can be understood as a data table storing which pipeline each pipeline redirects to. The redirection mapping table is pre-generated to ensure that packets can flow to all pipelines. To prevent duplicate data collection, in this embodiment, the pipelines are connected end-to-end when generating the redirection mapping table, ensuring that data can enter from the first pipeline and exit from the last pipeline, having passed through all pipelines in the switch. The uplink module of the sending pipeline queries the redirection mapping table to determine the next pipeline corresponding to the sending pipeline, and redirects the first self-sent packet to the downlink module of the next pipeline.
[0076] S208. The downlink module of the next pipeline collects message information based on the first self-generated packet message, writes the collected information into the first self-generated packet message, and forms the second self-generated packet message.
[0077] In this embodiment, the second spontaneous packet can be specifically understood as a spontaneous packet carrying information collected during the packet collection process. In this embodiment, the second spontaneous packet is formed by the downlink module of the pipeline for information collection.
[0078] When the downlink module in the next pipeline receives the first spontaneously generated packet, it parses the packet. If the packet contains the `msgsend` flag, it further parses it to determine the type of information to be collected. This type can be determined based on the spontaneously generated packet flag and / or forwarding flow characteristics. Then, it collects packet information according to this type. The collected information is written into the first spontaneously generated packet according to certain writing rules, forming the second spontaneously generated packet.
[0079] It should be noted that in this embodiment, the principle by which the downlink module of the next pipeline forms the second self-sent packet is the same as the principle by which the uplink module of the packet sending pipeline forms the first self-sent packet. The specific implementation method can be referred to the above implementation method, and will not be repeated here.
[0080] S209. When the downlink module of the next pipeline is not the downlink module of the packet sending pipeline, the downlink module of the next pipeline will loop back the second self-sent packet to the uplink module of the next pipeline.
[0081] If the downlink module of the next pipeline is not the downlink module of the packet sending pipeline, the collection of message information continues. The downlink module of the next pipeline loops the second self-sent packet back to the uplink module of the next pipeline and continues to collect message information.
[0082] In this embodiment, to save hardware resources, the forwarding information of the packet forwarding path based on the programmable pipeline generally only exists within the pipeline of the forwarding path. The packet forwarding path is usually cross-pipeline forwarding, meaning the uplink pipeline and the downlink pipeline are not the same pipeline. Self-generated packets are always sent from a unified CPU port or a reserved internal packet sending port on the chip. Therefore, it is necessary to collect real-time forwarding information along the entire forwarding path, such as the forwarding path of a certain data stream, the forwarding traffic volume, forwarding latency, etc. Without adding additional hardware resources, relying on the internal loopback channel of the chip, a unified full information lookup is performed on all uplink and downlink pipelines, and then the information is sequentially assembled into self-generated packets and sent out uniformly. The loopback channel is an internal physical channel of the programmable switch; each loopback channel has a physical number within the chip, called the loopback port. Each pipeline has an independent loopback channel, which can loop back the messages processed in the downlink module of one pipeline to the uplink module of the same pipeline. In other words, messages can reach the uplink module of the same pipeline through the loopback channel of the same pipeline. The loopback channel does not cross pipelines.
[0083] S210, the uplink module of the next pipeline collects message information based on the second self-generated packet, writes the collected information into the second self-generated packet to form a new first self-generated packet, redirects the new first self-generated packet to the downlink module of the new next pipeline, and returns to execute step S208.
[0084] The principle behind forming the new first self-generated packet in this step is the same as that of forming the first self-generated packet by the uplink module of the packet sending pipeline, and will not be repeated here. After forming the new first self-generated packet, a new next pipeline is determined. The uplink module of the next pipeline redirects the new first self-generated packet to the downlink module of the new next pipeline and returns to execute step S208 to repeat the packet information collection and form the second self-generated packet.
[0085] As an optional embodiment of this example, this optional embodiment further optimizes the uplink module of the next pipeline to redirect the new first spontaneous packet to the downlink module of the new next pipeline as follows: the uplink module of the next pipeline queries the pre-determined redirection mapping table, determines the new next pipeline, and redirects the new first spontaneous packet to the downlink module of the new next pipeline.
[0086] The uplink module of the next pipeline queries the redirection mapping table to determine the new next pipeline corresponding to the next pipeline, and redirects the second spontaneous packet to the downlink module of the new next pipeline.
[0087] This embodiment of the application implements redirection through a redirection mapping table. By mapping the loopback interface to a certain downstream pipeline, it achieves the goal of sequentially redirecting from the upstream module of the pipeline to the downstream module of the pipeline, thereby completing the collection of all information. The first redirection points to the downstream module of the first pipeline, and subsequent redirections sequentially select the downstream module of the next pipeline. Note that the packet sending pipeline needs to be skipped, and the downstream module of the packet sending pipeline is set as the object of the last redirection so that after the last loopback, it can return to the upstream module of the packet sending pipeline to find the forwarding table entry and send the self-sent packet.
[0088] S211 When the downstream module of the next pipeline is the downstream module of the outgoing pipeline, the downstream module of the outgoing pipeline determines that it has collected information from all pipelines.
[0089] When all pipeline information is collected, the operation of S212 is executed to form the target self-sent packet and forward it. At this time, the next pipeline is the packet sending pipeline, and the downlink module of the packet sending pipeline forms the target self-sent packet.
[0090] S212. The downlink module of the packet pipeline de-marks the generated second self-generated packet to obtain the target self-generated packet, and loops the target self-generated packet back to the uplink module of the packet pipeline. The uplink module of the packet pipeline sends the target self-generated packet to the forwarding module of the switch for forwarding.
[0091] In this embodiment, the forwarding module can be specifically understood as a functional module in the switch used to send messages to external devices.
[0092] Specifically, when the downlink module of the next pipeline becomes the downlink module of the packet sending pipeline, that is, when a message carrying information collected from each pipeline flows to the downlink module of the packet sending pipeline, the message has already collected information from the entire pipeline. The received second spontaneous packet is then de-tagged, removing the `msgsend` flag to obtain the target spontaneous packet. After forming the target spontaneous packet, the downlink module of the packet sending pipeline loops the target spontaneous packet back to the uplink module of the packet sending pipeline via the loopback interface. Upon receiving the target spontaneous packet, the uplink module of the packet sending pipeline determines that the `msgsend` flag has been removed. At this point, it can end the packet loopback, complete the data collection, and send the target spontaneous packet to the forwarding module.
[0093] This embodiment of the application achieves loop-breaking processing of message data through de-marking, enabling subsequent normal transmission of messages instead of being limited to an infinite loop. The uplink module of the packet transmission pipeline determines that the target self-sent packet has undergone loop-breaking processing by parsing it, ends the loopback, and sends the target self-sent packet to the forwarding module for forwarding. In this embodiment, the self-sent packet circulates between pipelines through the chip loopback port. The uplink module determines which downlink module to go to, and the downlink module determines when to end the loopback.
[0094] S213. The forwarding module queries the forwarding table entries based on the destination information in the target self-sent packet and forwards the target self-sent packet.
[0095] In this embodiment, a forwarding table entry can be understood as a data table that stores rules on how to forward packet data. Destination information can be understood as information about the destination to which the target self-initiated packet needs to be sent.
[0096] A forwarding table is pre-formed, storing forwarding paths and other forwarding information for different addresses that the packet can reach. When the control plane or packet sending module generates a self-generated packet, it encapsulates the destination information within the packet. The destination information can be the address of an analysis server or other detection device. Therefore, the forwarding module can determine the destination information by parsing the target self-generated packet, query the forwarding table based on the destination information, determine the corresponding forwarding information, and forward the target self-generated packet using the forwarding information. In this embodiment, the target self-generated packet can be sent to the analysis server or other detection device via the forwarding module, so that the analysis server or other detection device can perform real-time analysis of the pipeline based on the target self-generated packet.
[0097] This invention provides a method for forwarding self-generated packets, solving the problems of poor timeliness and heavy server processing burden when collecting information through self-generated packets. It forwards marked self-generated packets through a pipeline, collecting information at each pipeline stage and writing the collected information into the self-generated packets. As the self-generated packets flow through each pipeline, information is collected and written into the packets sequentially, achieving full information collection. This information is then sequentially written into target self-generated packets for forwarding. The target self-generated packets carry information from all pipeline stages, effectively reducing the server's processing burden. Furthermore, the forwarding of self-generated packets across pipelines ensures timely information collection. The self-generated packets and forwarded packets used in this application share the pipeline, without affecting forwarding efficiency, and comprehensive information collection based on the forwarding plane can be completed without additional hardware resources. Moreover, by performing loop-breaking processing in the downlink module of the packet sending pipeline to de-mark the self-generated packets, message looping is prevented.
[0098] Example 3
[0099] Figure 3 This is a schematic diagram of a self-sending packet forwarding device according to Embodiment 3 of the present invention. This self-sending packet forwarding device is applied to a switch. Figure 4 A schematic diagram of a switch is provided, such as... Figure 4 As shown, the switch includes: at least two pipelines, one of which is a packet sending pipeline, each pipeline includes an uplink module and a downlink module, and the uplink module 31 of the packet sending pipeline includes a first parsing module 311, an uplink module information acquisition module 312 and a redirection module 313;
[0100] The first parsing module 311 in the uplink module of the packet sending pipeline 31 is used to mark the self-sent packet after obtaining it, and form a self-sent packet to be forwarded.
[0101] The uplink information acquisition module 312 in the uplink module of the packet sending pipeline 31 is used to collect message information based on the packet to be forwarded from the packet sending module.
[0102] The redirection module 313 in the uplink module of the packet sending pipeline 31 is used to write the collected information into the self-sent packet to be forwarded to form a first self-sent packet, and redirect the first self-sent packet to the module 32 of the next pipeline.
[0103] The module 30 of the next pipeline is used to collect information from the pipeline, and after collecting information from all pipelines, it forms a target spontaneous packet and forwards the target spontaneous packet.
[0104] This invention provides a self-generated packet forwarding device, solving the problems of poor timeliness and heavy server processing burden when collecting information through self-generated packets. It forwards self-generated packets through a pipeline, marking them to form a self-generated packet to be forwarded. Information is collected from this self-generated packet and written into it to form a first self-generated packet. This embodiment carries the collected information in the self-generated packet to be forwarded and uses redirection to collect information from all pipelines, forming a target self-generated packet for forwarding. The target self-generated packet carries information from all pipelines. Since there is only one self-generated packet, the server processing burden is effectively reduced. Furthermore, the forwarding of self-generated packets in each pipeline ensures timely information collection. The self-generated packets and forwarded packets used in this application share the pipeline, without affecting packet forwarding efficiency, and comprehensive collection based on forwarding plane information can be completed without additional hardware resources.
[0105] Optionally, the first parsing module 311 in the uplink module 31 of the packet sending pipeline 31 is specifically used to receive and parse the message to be forwarded; when it is determined that the message to be forwarded meets the self-sending condition, the message to be forwarded is determined to be a self-sending message.
[0106] Optionally, the conditions for spontaneous packet generation include at least one of the following: the packet to be forwarded includes a spontaneous packet marker, and the port number information in the packet to be forwarded is preset port number information.
[0107] Optionally, the switch may also include: a control plane or a packet sending module;
[0108] Correspondingly, the control plane or packet sending module is used to construct a self-sent packet when the packet construction time condition is met or the trigger condition is detected, and send it to the uplink module of the packet sending pipeline through a predetermined packet sending port.
[0109] This step can directly send the self-generated packet to the first parsing module 311 in the uplink module 31 of the packet sending pipeline.
[0110] Optionally, the uplink information acquisition module 312 in the uplink module 31 of the packet sending pipeline includes:
[0111] The information type determination unit is used to determine the information type to be collected based on the packet to be forwarded when it is determined that the packet to be forwarded has a tag.
[0112] The information collection unit is used to collect message information according to the type of information to be collected.
[0113] Optionally, the information type determination unit is specifically used to parse the spontaneous packet to be forwarded, determine the spontaneous packet marker and / or forwarding flow characteristic information, and determine the information type to be collected based on the spontaneous packet marker and / or forwarding flow characteristic information.
[0114] Optionally, the redirection module 313 in the uplink module of the packet sending pipeline 31 is specifically used to redirect the first self-sent packet to the downlink module of the next pipeline.
[0115] Optionally, the next-generation module 30 includes: an uplink module and a downlink module;
[0116] Optionally, the downlink module of the next pipeline is specifically used to collect message information based on the first self-generated packet, and write the collected information into the first self-generated packet to form a second self-generated packet.
[0117] When the downlink module of the next pipeline is not the downlink module of the packet sending pipeline, the downlink module of the next pipeline is specifically used to loop back the second self-sent packet to the uplink module of the next pipeline;
[0118] The uplink module of the next pipeline is used to collect message information based on the second self-generated packet, write the collected information into the second self-generated packet to form a new first self-generated packet, redirect the new first self-generated packet to the downlink module of the new next pipeline, and return to execute the step of the downlink module of the next pipeline collecting message information based on the first self-generated packet.
[0119] When the downstream module of the next pipeline is the downstream module of the outgoing pipeline, the downstream module of the outgoing pipeline determines that it has collected all pipeline information.
[0120] Optionally, when the downlink module of the next pipeline is the downlink module of the packet sending pipeline, the downlink module of the packet sending pipeline is used to de-tagged the formed second self-sent packet to obtain the target self-sent packet, and loop the target self-sent packet back to the uplink module of the packet sending pipeline. The uplink module of the packet sending pipeline sends the target self-sent packet to the forwarding module of the switch for forwarding.
[0121] Optionally, the redirection module 313 of the uplink module 31 of the packet sending pipeline is specifically used to query a pre-determined redirection mapping table, determine the next pipeline, and redirect the first self-sent packet to the downlink module of the next pipeline.
[0122] Optionally, the uplink module of the next pipeline is specifically used to query a pre-determined redirection mapping table, determine the new next pipeline, and redirect the new first spontaneous packet to the downlink module of the new next pipeline.
[0123] Optionally, a forwarding module is used to query forwarding table entries based on the destination information in the target spontaneous packet and forward the target spontaneous packet.
[0124] For example, Figure 5 A schematic diagram is provided to illustrate the implementation of a switch forwarding self-generated packets. The switch includes at least two pipelines, each pipeline including an uplink module and a downlink module. The uplink module of the pipeline includes a first parsing module, an uplink module information acquisition module, and a redirection module. The downlink module of the pipeline includes a second parsing module, a downlink module information acquisition module, and a loopback module. When the pipeline is used as a packet sending pipeline, its downlink module also includes a loop breaking module. Figure 5 Taking two pipelines as an example, one is a packet sending pipeline, and the other is a normal pipeline. The uplink module 41 of the packet sending pipeline includes a first parsing module 411, an uplink module information acquisition module 412, and a redirection module 413. The downlink module 42 of the packet sending pipeline 41 includes a second parsing module 414, a downlink module information acquisition module 415, a loop-breaking module 416, and a loopback module 417. The uplink module 43 of the normal pipeline includes a first parsing module 421, an uplink information acquisition module 422, and a redirection module 423. The downlink module 44 of the pipeline includes a second parsing module 424, a downlink information acquisition module 425, and a loopback module 426. The switch also includes a packet sending module 45 and a forwarding module 46.
[0125] Step 1: The packet sending module 45 constructs a self-sending packet and sends it to the uplink module 41 of the packet sending pipeline through a predetermined packet sending port;
[0126] Step 2: The first parsing module 411 in the uplink module 41 of the packet sending pipeline receives the self-sent packet, performs packet header parsing, identifies it as a self-sent packet, sets the msgsend flag, and forms a self-sent packet to be forwarded;
[0127] Step 3: For the self-sent packet to be forwarded marked with msgsend, the uplink information acquisition module 412 in the uplink module 41 of the packet sending pipeline collects the packet information and writes the collected information into the self-sent packet to be forwarded to form the first self-sent packet.
[0128] Step 4: For the first spontaneously sent packet marked with the msgsend tag, the redirection module 413 of the uplink module 41 of the packet sending pipeline looks up the redirection mapping table and redirects it to the downlink module 44 of the next pipeline.
[0129] It is important to know that, due to Figure 5 Taking two production lines as an example, the next production line is the other production line outside the outsourcing production line; at the same time, this production line is the next production line after the outsourcing production line.
[0130] Step 5: The second parsing module 424 of the pipeline's downlink module 44 parses the first spontaneous packet and obtains the msgsend flag;
[0131] Step 6: The downlink information acquisition module 425 of the downlink module 44 of the pipeline collects the message information of the first spontaneous packet marked with msgsend, and writes the collected information into the first spontaneous packet to form the second spontaneous packet.
[0132] Step 7: For the second spontaneous packet tagged with msgsend, the loopback module 426 of the pipeline's downlink module 44 loops back to the uplink module of pipeline 42.
[0133] Step 8: The first parsing module 421 of the pipeline's uplink module 43 receives the second spontaneous packet, performs packet header parsing, and identifies it as a spontaneous packet.
[0134] Step 9: The uplink information acquisition module 422 of the uplink module 43 of the pipeline collects the message information of the second spontaneous packet marked with msgsend, and writes the collected information into the second spontaneous packet to form a new first spontaneous packet.
[0135] Step 10: For a new first spontaneous packet tagged with msgsend, the redirection module 423 of the pipeline's uplink module 43 looks up the redirection mapping table and redirects the packet sending to the downlink module 42 of the pipeline.
[0136] At this point, the pipeline is the last pipeline and cannot be redirected to the next pipeline. Therefore, it needs to continue redirecting to the downstream module 42 of the packet sending pipeline.
[0137] Step 11: The second parsing module 414 of the downlink module 42 of the packet sending pipeline parses the new first self-sent packet and obtains the msgsend flag;
[0138] Step 12: The downlink information acquisition module 415 of the downlink module 42 of the packet sending pipeline collects the message information of the new first spontaneous packet marked with msgsend, and writes the collected information into the new first spontaneous packet to form a new second spontaneous packet.
[0139] Step 13: The destructive module 416 of the downlink module 42 of the packet sending pipeline deletes the msgsend flag in the new second self-sent packet message to form the target self-sent packet module;
[0140] Step 14: The loopback module 417 of the downlink module 42 of the packet sending pipeline sends the target self-sent packet to the uplink module 41 of the packet sending pipeline;
[0141] In this step, the loopback module 417 can loop back the target self-sent packet to the first parsing module 411 in the uplink module 41.
[0142] Step 15: The uplink module 41 of the packet sending pipeline sends the target self-sent packet to the forwarding module 46;
[0143] Since the message received by the first parsing module 411 of the uplink module 41 of the packet sending pipeline has already been de-circulated, no redirection is performed, and the target self-sent packet is directly sent to the forwarding module 45 for processing.
[0144] Step 16: Forwarding module 46 performs the normal forwarding process on the target self-sent packet, and forwards it by looking up the forwarding table entry.
[0145] For devices on more production lines, simply repeat steps 4-7, repeating the loopback and redirection operations until information collection is complete on all production lines.
[0146] It should be noted that in this embodiment, the packet sending module and the forwarding module of the switch can be either hardware processing modules or software processing modules within the switch. When implementing their respective functions, the packet sending module and the forwarding module can also be implemented by virtual modules within the self-sending packet forwarding device; alternatively, the packet sending module and the forwarding module can be incorporated as part of the self-sending packet forwarding device.
[0147] The switch provided in the embodiments of the present invention can execute the self-sent packet forwarding method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the method.
[0148] Example 4
[0149] Figure 6 A schematic diagram of an electronic device 50 that can be used to implement embodiments of the present invention is shown. The electronic device may function as a switch. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the invention described and / or claimed herein.
[0150] like Figure 6 As shown, the electronic device 50 includes at least one processor 51 and a memory, such as a read-only memory (ROM) 52 and a random access memory (RAM) 53, communicatively connected to the at least one processor 51. The memory stores computer programs executable by the at least one processor. The processor 51 can perform various appropriate actions and processes based on the computer program stored in the ROM 52 or loaded into the RAM 53 from storage unit 58. The RAM 53 can also store various programs and data required for the operation of the electronic device 50. The processor 51, ROM 52, and RAM 53 are interconnected via a bus 54. An input / output (I / O) interface 55 is also connected to the bus 54.
[0151] Multiple components in electronic device 50 are connected to I / O interface 55, including: input unit 56, such as keyboard, mouse, etc.; output unit 57, such as various types of monitors, speakers, etc.; storage unit 58, such as disk, optical disk, etc.; and communication unit 59, such as network card, modem, wireless transceiver, etc. Communication unit 59 allows electronic device 50 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0152] Processor 51 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 51 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 51 performs the various methods and processes described above, such as the spontaneous packet forwarding method.
[0153] In some embodiments, the spontaneous packet forwarding method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 58. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 50 via ROM 52 and / or communication unit 59. When the computer program is loaded into RAM 53 and executed by processor 51, one or more steps of the spontaneous packet forwarding method described above may be performed. Alternatively, in other embodiments, processor 51 may be configured to perform the spontaneous packet forwarding method by any other suitable means (e.g., by means of firmware).
[0154] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0155] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0156] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0157] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0158] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0159] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0160] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0161] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for spontaneously packet forwarding, applied to a switch, the switch comprising: At least two pipelines, characterized in that one pipeline in the at least two pipelines is a packet sending pipeline; the method comprises: The uplink module of the packet sending pipeline marks the self-generated packet after obtaining the self-generated packet, to form a to-be-transmitted self-generated packet; The uplink module of the packet sending pipeline collects packet information according to the to-be-transmitted self-generated packet; The uplink module of the packet sending pipeline writes the collected information into the to-be-transmitted self-generated packet to form a first self-generated packet, and redirects the first self-generated packet to a module of a next pipeline; The module of the next pipeline collects information of the pipeline, and forms a target self-generated packet after collecting information of all the pipelines and processes the target self-generated packet for transmission; The uplink module of the packet sending pipeline redirects the first self-generated packet to a module of a next pipeline, which comprises: The uplink module of the packet sending pipeline redirects the first self-generated packet to a downlink module of a next pipeline; Correspondingly, the module of the next pipeline collects information of the pipeline, which comprises: The downlink module of the next pipeline collects packet information according to the first self-generated packet, and writes the collected information into the first self-generated packet to form a second self-generated packet; When the downlink module of the next pipeline is not a downlink module of a packet sending pipeline, the downlink module of the next pipeline loops back the second self-generated packet to the uplink module of the next pipeline; The uplink module of the next pipeline collects packet information according to the second self-generated packet, writes the collected information into the second self-generated packet to form a new first self-generated packet, redirects the new first self-generated packet to a downlink module of a new next pipeline, and returns to execute the step of collecting packet information according to the first self-generated packet by the downlink module of the next pipeline; When the downlink module of the next pipeline is a downlink module of a packet sending pipeline, the downlink module of the packet sending pipeline determines that information of all the pipelines is collected.
2. The method of claim 1, wherein, Before the uplink module of the packet sending pipeline obtains the self-generated packet, the method further comprises: The uplink module of the packet sending pipeline receives and analyzes a to-be-transmitted packet; The uplink module of the packet sending pipeline determines that the to-be-transmitted packet is a self-generated packet when it is determined that the to-be-transmitted packet meets a self-generated packet condition.
3. The method of claim 2, wherein, The self-generated packet condition comprises at least one of the following: the to-be-transmitted packet comprises a self-generated packet mark, and port number information in the to-be-transmitted packet is preset port number information.
4. The method of claim 2, wherein, The switch further comprises a control plane or a packet sending module, and correspondingly, before the uplink module of the packet sending pipeline receives and analyzes a to-be-transmitted packet, the method further comprises: The control plane or the packet sending module constructs a self-generated packet when a current time meets a packet construction time condition or a trigger condition is detected, and sends the self-generated packet to the uplink module of the packet sending pipeline through a predetermined packet sending port.
5. The method of claim 1, wherein, The uplink module of the packet sending pipeline collects packet information according to the to-be-transmitted self-generated packet, which comprises: The uplink module of the packet sending pipeline determines the type of information to be collected according to the self-generated packet to be forwarded when it is determined that the self-generated packet to be forwarded has a mark; The uplink module of the packet sending pipeline collects packet information according to the type of information to be collected.
6. The method of claim 5, wherein, The uplink module of the packet sending pipeline determines the type of information to be collected according to the self-generated packet to be forwarded, including: The uplink module of the packet sending pipeline analyzes the self-generated packet to be forwarded to determine the self-generated packet mark and / or the forwarding flow characteristic information; The uplink module of the packet sending pipeline determines the type of information to be collected according to the self-generated packet mark and / or the forwarding flow characteristic information.
7. The method of claim 1, wherein, The module of the next pipeline forms a target self-generated packet and performs forwarding processing on the target self-generated packet, including: When the downlink module of the next pipeline is the downlink module of the packet sending pipeline, the downlink module of the packet sending pipeline performs a de-marking process on the formed second self-generated packet to obtain a target self-generated packet, and loops back the target self-generated packet to the uplink module of the packet sending pipeline, and the uplink module of the packet sending pipeline sends the target self-generated packet to the forwarding module of the switch for forwarding.
8. The method of claim 1, wherein, The uplink module of the packet sending pipeline redirects the first self-generated packet to the downlink module of the next pipeline, including: The uplink module of the packet sending pipeline queries a pre-determined redirection mapping table to determine the next pipeline and redirects the first self-generated packet to the downlink module of the next pipeline; The uplink module of the next pipeline redirects the new first self-generated packet to the downlink module of the new next pipeline, including: The uplink module of the next pipeline queries a pre-determined redirection mapping table to determine the new next pipeline and redirects the new first self-generated packet to the downlink module of the new next pipeline.
9. The method of claim 7, wherein, The forwarding module forwards the target self-generated packet, including: The forwarding module queries a forwarding table item according to the destination information in the target self-generated packet to forward the target self-generated packet.
10. A self-encapsulating packet forwarding device, applied to a switch, the switch comprising: At least two pipelines, characterized in that one of the at least two pipelines is a packet sending pipeline, each of the pipelines includes an uplink module and a downlink module, and the uplink module of the packet sending pipeline includes a first analysis module, an uplink information collection module, and a redirection module; The first analysis module in the uplink module of the packet sending pipeline is configured to mark a self-generated packet after obtaining the self-generated packet to form a self-generated packet to be forwarded; The uplink information collection module in the uplink module of the packet sending pipeline is configured to collect packet information according to the self-generated packet to be forwarded; The redirection module in the uplink module of the packet sending pipeline is configured to write the collected information into the self-generated packet to be forwarded to form a first self-generated packet, and redirect the first self-generated packet to a module of a next pipeline; The module of the next pipeline is configured to collect information of the pipeline, and form a target self-generated packet and perform forwarding processing on the target self-generated packet after collecting information of all the pipelines; The redirecting module in the uplink module of the packet sending pipeline is specifically configured to redirect the first self-generated packet message to a downlink module of a next pipeline. The module of the next pipeline comprises an uplink module and a downlink module. The downlink module of the next pipeline is specifically configured to collect message information according to the first self-generated packet message, write the collected information into the first self-generated packet message, and form a second self-generated packet message. When the downlink module of the next pipeline is not a downlink module of a packet sending pipeline, the downlink module of the next pipeline is specifically configured to loop back the second self-generated packet message to the uplink module of the next pipeline. The uplink module of the next pipeline is configured to collect message information according to the second self-generated packet message, write the collected information into the second self-generated packet message, form a new first self-generated packet message, redirect the new first self-generated packet message to a downlink module of a new next pipeline, and return to the step of collecting message information according to the first self-generated packet message by the downlink module of the next pipeline. When the downlink module of the next pipeline is a downlink module of a packet sending pipeline, the downlink module of the packet sending pipeline determines that all pipeline information is collected.
11. An electronic device, comprising: When the electronic device is used as a switch, the electronic device comprises: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the self-generated packet message forwarding method in any one of claims 1-9.
12. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions for enabling the processor to execute the self-generated packet message forwarding method in any one of claims 1-9 when executed by the processor.
Citation Information
Patent Citations
Message processing method and switching equipment
CN112532544A
Network transmission method and device, equipment, storage medium and program product
CN113949651A