Execution priority scheduling method and device, electronic equipment, medium and product

By dynamically adjusting the priority of packet handlers and using bytecode files, the flexibility and maintainability issues of eBPF program scheduling are resolved, enabling flexible program insertion and priority scheduling in cloud network environments.

CN120935119APending Publication Date: 2025-11-11BEIJING ZITIAO NETWORK TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511097503.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-06
Publication Date
2025-11-11

AI Technical Summary

Technical Problem

In existing technologies, packet processing program scheduling methods based on static priorities and dynamic rules suffer from poor maintainability, poor flexibility, and limited orchestration capabilities. This is especially true in cloud network environments, where the scheduling complexity of eBPF programs is high, making it difficult to flexibly adjust and insert new programs.

Method used

By obtaining the program position and scheduling type in the program scheduling chain, the priority of the data packet processing program is dynamically adjusted. Reentrancy is achieved using bytecode files, avoiding priority reservation, enabling continuous allocation and seamless insertion of programs, and reducing code modification costs.

Benefits of technology

It improves the scheduling flexibility and maintainability of the packet processing program, reduces scheduling complexity, and enables dynamic adjustment and insertion of new programs under lossless traffic conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120935119A_ABST
    Figure CN120935119A_ABST
Patent Text Reader

Abstract

The invention discloses an execution priority scheduling method and device, electronic equipment, a medium and a product, and relates to the technical field of network control, the method comprises the steps that a program scheduling chain is acquired, the program scheduling chain comprises a plurality of program point locations, and each program point location corresponds to a data packet processing program; when the target data packet processing program is scheduled in the program scheduling chain, obtaining a program scheduling type corresponding to the target data packet processing program; according to the scheduling strategy corresponding to the program scheduling type, the priority of at least one data packet processing program in the program scheduling chain is adjusted to obtain the target priority corresponding to each data packet processing program, so that the flexibility and maintainability of priority scheduling of the data packet processing programs are improved; and thus, the complexity of priority scheduling of the data packet processing program is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of network control technology, and specifically to scheduling methods, apparatuses, electronic devices, media, and products for execution priority. Background Technology

[0002] Multiple packet handlers, such as eBPF, can be mounted on the same network device. These packet handlers can be scheduled according to static priorities or according to dynamic rules.

[0003] However, scheduling the priorities of each packet processing program based on static priorities has problems such as poor maintainability, poor flexibility, and limited priority orchestration capabilities; scheduling the priorities of multiple packet processing programs based on dynamic rules has problems such as high component code modification costs and poor maintainability. Summary of the Invention

[0004] In view of this, the present disclosure provides a scheduling method, apparatus, electronic device, medium and product for execution priority, in order to solve the problem that the priority scheduling flexibility and maintainability of each data packet processing program in the program scheduling chain are poor.

[0005] In a first aspect, this disclosure provides a scheduling method for execution priority, comprising: obtaining a program scheduling chain, the program scheduling chain including multiple program points, each program point corresponding to a data packet processing program; when scheduling a target data packet processing program in the program scheduling chain, obtaining the program scheduling type corresponding to the target data packet processing program; and adjusting the priority of at least one data packet processing program in the program scheduling chain according to the scheduling strategy corresponding to the program scheduling type, thereby obtaining the target priority corresponding to each data packet processing program.

[0006] Secondly, this disclosure provides a scheduling device for execution priority, comprising: a first acquisition module for acquiring a program scheduling chain, the program scheduling chain including multiple program points, each program point corresponding to a data packet processing program; a second acquisition module for acquiring the program scheduling type corresponding to the target data packet processing program when scheduling the target data packet processing program in the program scheduling chain; and an adjustment module for adjusting the priority of at least one data packet processing program in the program scheduling chain according to the scheduling strategy corresponding to the program scheduling type, thereby obtaining the target priority corresponding to each data packet processing program.

[0007] Thirdly, this disclosure provides an electronic device, including: a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the execution priority scheduling method of the first aspect or any corresponding embodiment described above.

[0008] Fourthly, this disclosure provides a computer-readable storage medium storing computer instructions for causing a computer to execute the execution priority scheduling method of the first aspect or any corresponding embodiment described above.

[0009] Fifthly, this disclosure provides a computer program product, including computer instructions, which are used to cause a computer to execute the execution priority scheduling method of the first aspect or any corresponding embodiment described above.

[0010] The execution priority scheduling method provided in this disclosure can dynamically adjust the priority of one or more related packet processing programs according to the scheduling strategy corresponding to the program scheduling type. It does not require pre-planning the static priority of each packet processing program, nor does it require reserving priority between adjacent packet processing programs to add new packet processing programs. That is, the priority of the packet processing programs in this disclosure can be continuously allocated according to the execution order, which solves the problem that new packet processing programs cannot be inserted due to insufficient reserved priority. Moreover, it does not require users to modify the code. All packet processing programs are explicitly mounted to each program point, thereby improving the flexibility and maintainability of packet processing program priority scheduling, and thus reducing the complexity of packet processing program priority scheduling. Attached Figure Description

[0011] To more clearly illustrate the technical solutions in the specific embodiments or related technologies of this disclosure, the accompanying drawings used in the description of the specific embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0012] Figure 1 This is a schematic diagram of a program scheduling chain;

[0013] Figure 2 This is a diagram showing two eBPF programs running at the same time in the program scheduling chain.

[0014] Figure 3 This is a diagram showing that there is no eBPF program at a certain point in the program scheduling chain;

[0015] Figure 4This is a diagram illustrating that a new eBPF program cannot be added between two adjacent priorities in the program scheduling chain;

[0016] Figure 5 This is a diagram illustrating the prioritization of multiple packet processing programs based on dynamic rules.

[0017] Figure 6 This is a schematic diagram illustrating an application scenario according to an embodiment of this disclosure;

[0018] Figure 7 This is a flowchart illustrating a scheduling method for execution priority according to an embodiment of the present disclosure;

[0019] Figure 8 This is a flowchart illustrating another execution priority scheduling method according to an embodiment of the present disclosure;

[0020] Figure 9 This is a schematic diagram illustrating the insertion of ProgB into the program scheduling chain according to an embodiment of the present disclosure;

[0021] Figure 10 This is a schematic diagram illustrating the insertion of ProgC into the program scheduling chain according to an embodiment of this disclosure;

[0022] Figure 11 This is a schematic diagram illustrating the insertion of ProgD into the program scheduling chain according to an embodiment of the present disclosure;

[0023] Figure 12 This is a schematic diagram illustrating the removal of ProgD from the program scheduling chain according to an example of this disclosure;

[0024] Figure 13 This is a flowchart illustrating another execution priority scheduling method according to an embodiment of the present disclosure;

[0025] Figure 14 This is a schematic diagram of a 32-bit program identifier according to an embodiment of the present disclosure;

[0026] Figure 15 This is a schematic diagram illustrating the downgrading of the priority of ProgA according to an embodiment of this disclosure;

[0027] Figure 16 This is a structural block diagram of a scheduling device for execution priority according to an embodiment of the present disclosure;

[0028] Figure 17 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present disclosure. Detailed Implementation

[0029] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.

[0030] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0031] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.

[0032] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0033] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.

[0034] It is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.

[0035] Extended Berkeley Packet Filter (eBPF) is a revolutionary technology in the Linux kernel that allows users to run eBPF programs securely and efficiently in specific contexts without modifying the kernel source code or loading kernel modules. While traditional Berkeley Packet Filter (BPF) can be used for packet filtering, current eBPF programs have been extended to multiple areas such as performance analysis, security monitoring, and flow control.

[0036] Traffic Control (TC) is a network traffic control mechanism in the Linux kernel, primarily used for traffic classification, priority scheduling, traffic shaping, and policy enforcement. The TC subsystem also supports mounting eBPF programs, allowing network packets to be processed directly in kernel space at Layer 2 (data link layer) without going through multiple Internet Protocol (IP) stack layers or requiring multiple kernel / user space copies. Therefore, TC is widely used in cloud-native scenarios for deep analysis and intelligent control of network traffic, such as load balancing and Distributed Denial of Service (DDoS) attack defense.

[0037] For mounting eBPF applications of type BPF_PROG_TYPE_SCHED_CLS / BPF_PROG_TYPE_SCHED_ACT, it is necessary to declare the hook points, priorities, and handles to be mounted. The hook points include ingress and egress. Ingress is triggered by incoming packets to the network device, and egress is triggered by outgoing packets from the network device. The lower the priority value of the eBPF application, the higher its priority; higher-priority eBPF applications will be executed first. Additionally, each mounted eBPF application has a unique handle for location. Multiple eBPF applications can be mounted on the same network device, and these applications can be arranged according to priority, meaning higher-priority eBPF applications are executed first. However, not all priority eBPF applications will be executed; instead, the execution of the next priority eBPF application is determined by the return value of the currently executing eBPF application, as detailed in Table 1 and [Table 2]. Figure 1As shown. If multiple eBPF programs are mounted at the entry point of a network device, data packets will be processed by an eBPF program before entering the network device. For example, the data packet will first enter eBPF program 1 (eBPFProg1) with priority 1; if eBPF program 1 returns TC_ACT_UNSPEC, the TC subsystem can then call eBPF program 2 (eBPFProg2) with priority 2 to continue processing the data packet; if eBPF program 1 returns TC_ACT_OK, the data packet is handed over to the network device and enters the upper-layer protocol stack for processing, and will not enter subsequent eBPFProg2 and eBPFProg3; if eBPF program 1 returns TC_ACT_SHOT, the TC subsystem will discard the data packet; if eBPF program 1 returns TC_ACT_REDIRECT, the TC subsystem can redirect the data packet to other network devices. Another special case is that the current eBPF program can also call the standard helper func: bpf_tail_call to execute a new eBPF program directly in the current context, instead of relying on the return value of the current eBPF program to determine whether to enter the next eBPF program. Of course, after processing the packet, the new eBPF program can use its return value to determine its next action.

[0038] Table 1: Operations Corresponding to eBPF Program Return Values

[0039]

[0040] When multiple eBPF programs are orchestrated according to a certain priority on a network device in the TC subsystem, a call chain of eBPF programs is formed (e.g., ...). Figure 1(As shown). From the perspective of a single component, the number of eBPF programs that need to be mounted at the same hook point on the same network device is usually small, typically only one or two. The expected functionality of the component can be achieved through simple priority planning and on-demand mounting. However, in actual production environments, multiple components use eBPF programs to observe and manipulate the traffic of a particular network device. When the number of eBPF programs is large, priority scheduling and allocation become more complex. For example, in cloud networks, each physical machine's primary network interface card (NIC) will have an Access Control List (ACL) firewall component, a Quality of Service (QoS) traffic component, a traffic observation component, and a container network traffic routing component mounted on it. Each component will correspond to one or more eBPF programs. Therefore, how to schedule these eBPF programs so that network traffic passes through each component according to reasonable expectations becomes particularly important. Currently, multiple eBPF programs can be scheduled based on static priority planning or dynamic orchestration based on bpf_tail_call.

[0041] For priority-based static planning, in a production environment, the priority allocation of eBPF programs for different components can be pre-negotiated, and the TC subsystem can determine the execution order of eBPF programs based on priority, thus forming a program call chain. While this approach has some effectiveness, it suffers from the following problems:

[0042] 1. Poor maintainability: It requires a lot of manpower and communication costs for static planning. If a component is attached to an arbitrary priority without communication, it will produce unexpected behavior. For example, traffic may be prematurely transferred to the device and kernel network protocol stack, or the eBPF program may bypass low-priority components and send traffic from the device in advance.

[0043] 2. Poor Flexibility: The TC subsystem lacks the ability to perform atomic operations to modify the priority of eBPF programs. Once an eBPF program is mounted according to its planned priority, its priority cannot be adjusted again. If it's necessary to adjust the priority of an eBPF program, it's required to either mount the lower-priority eBPF program first and then unmount the higher-priority version, or unmount the higher-priority eBPF program first and then mount the lower-priority version. Neither of these methods can be executed seamlessly, and different operation sequences will lead to unexpected behavior. For example, ... Figure 2 As shown, first mount ProgA' ( ) to the program point corresponding to priority N+1. Figure 2 As shown in step 1, mount ProgA' and then unmount ProgA with priority N. Figure 2 As shown in step 2. Uninstall ProgA). Figure 2It can be observed that mounting an eBPF program with a lower priority and then unmounting it with a higher priority will result in a point in time where the same eBPF program has two priorities. Since eBPF programs are not reentrant, this will cause data packets to be processed twice by the same eBPF program. For example, ... Figure 3 As shown, first unload ProgA with priority N ( Figure 3 As shown in step 1, uninstall ProgA, then mount ProgA at the program point with priority N+1. Figure 3 It can be seen that unloading a high-priority eBPF program first and then mounting the same eBPF program on a low-priority program will result in a point in time when there is no eBPF program, causing data packets to be unable to be processed by the eBPF program ProgA.

[0044] 3. Limited orchestration capabilities: Because sufficient free priority needs to be reserved between two adjacent eBPF procedures in the call chain to allow for the insertion of new eBPF procedures, the priority of component eBPF procedures cannot be arranged continuously. Furthermore, if all reserved priority is occupied, it prevents the insertion of new eBPF procedures between two adjacent eBPF procedures. For example, ... Figure 4 As shown, the first eBPF program (eBPF Prog1) has a priority of 1, while the second eBPF program (eBPFProg 2) has a priority of 2. At this time, there is no available priority between eBPFProg 1 and eBPFProg 2, and the insertion of a new eBPF program fails.

[0045] To dynamically adjust the priority of eBPF programs, an eBPF program provides a helper function `bpf_tail_call`. Explicitly calling this function allows for dynamic execution within the context of the next eBPF program. The next eBPF program to execute after each jump can be dynamically controlled by the user-space process. While this provides sufficient flexibility, it has the following limitations:

[0046] 1. High component code modification cost: bpf_tail_call depends on a Prog Array, and all eBPF programs need to be modified to change the direct return to calling bpf_tail_call with the Prog array as the parameter.

[0047] 2. Poor maintainability: such as Figure 5 As shown, only the first eBPF program with priority 1 (eBPFProg1) will be displayed and mounted on the network device. Other eBPF programs will not be directly mounted to the mount point, but will be loaded directly into the Prog Array through a user-space process.

[0048] In view of this, the present disclosure provides a scheduling method, apparatus, device, medium, and product for execution priority. The method includes: obtaining a program scheduling chain, the program scheduling chain including multiple program points, each program point corresponding to a data packet processing program; when scheduling a target data packet processing program in the program scheduling chain, obtaining the program scheduling type corresponding to the target data packet processing program; adjusting the priority of at least one data packet processing program in the program scheduling chain according to the scheduling strategy corresponding to the program scheduling type, to obtain the target priority corresponding to each data packet processing program.

[0049] The execution priority scheduling method disclosed herein can dynamically adjust the priority of one or more related packet processing programs according to the scheduling strategy corresponding to the program scheduling type. It does not require pre-planning the static priority of each packet processing program, nor does it require reserving priority between adjacent packet processing programs to add new packet processing programs. That is, the priority of the packet processing programs disclosed herein can be continuously allocated according to the execution order, solving the problem of not being able to insert new packet processing programs due to insufficient reserved priority. Moreover, it does not require users to modify the code, as all packet processing programs are explicitly mounted to each program point, thereby improving the flexibility and maintainability of packet processing program priority scheduling, and thus reducing the complexity of packet processing program priority scheduling.

[0050] As an optional application scenario of this disclosure embodiment, firstly, before scheduling the execution priority of each packet handler, the TC subsystem can obtain the original code of each packet handler and compile it to obtain binary files of each packet handler, and then inject bytecode files into the binary files of each packet handler. After the bytecode files are injected into the corresponding packet handlers, an instruction set for that packet handler is generated, and then the instruction set is inserted into the corresponding binary file of the packet handler, enabling the packet handler to have reentrancy capability, that is, a packet will only be executed once if it passes through two identical packet handlers consecutively. The bytecode file injection method can realize the modification of packet handlers without the user's notice, provide reentrancy logic for each packet handler, and adjust the priority of each packet handler without loss of traffic, thereby realizing the dynamic adjustment of the execution order of multiple packet handlers on the same mount point.

[0051] Subsequently, according to the pre-assigned priorities of each packet handler, each packet handler is mounted to the entry point of the main network interface card of the electronic device where the TC subsystem is deployed, such as a physical server. See, for details, as shown below. Figure 6As shown, at any given time, the execution order Index(Prog X) and priority (Prog X) of each packet handler are numerically equal, such as... Figure 6 The packet handler shown has a priority of 1 and an execution order of 1, packet handler 2 has a priority of 2 and an execution order of 2, and packet handler 3 has a priority of 3 and an execution order of 3. Subsequently, the execution priority scheduling method of this disclosure can be used to schedule the target packet handler on the program scheduling chain, adjusting the priorities of one or more related packet handlers.

[0052] It should be understood that electronic devices can store and maintain data. Examples of electronic devices may include supercomputers, personal computers, laptops, in-vehicle computing devices, mobile devices (such as smartphones, tablets, etc.), or combinations thereof. It should be understood that the electronic devices described herein are merely exemplary and not limiting; other different types of electronic devices may also be used.

[0053] According to an embodiment of this disclosure, a scheduling method for execution priority is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0054] This embodiment provides a scheduling method for execution priority, which can be used in electronic devices. Figure 7 This is a flowchart of a scheduling method for execution priority according to an embodiment of the present disclosure, such as... Figure 7 As shown, the process includes the following steps:

[0055] Step S701: Obtain the program scheduling chain. The program scheduling chain includes multiple program points, and each program point corresponds to a data packet processing program.

[0056] A program scheduling chain can be an ordered sequence of multiple packet handlers arranged according to a pre-defined priority order at a specific device hook point in a system component, such as the TC subsystem. Furthermore, each program point in the scheduling chain has a strict one-to-one correspondence with a single packet handler; that is, each program point is occupied by only one packet handler, and there are no idle program points without attached packet handlers. This approach eliminates the need to reserve priority between adjacent packet handlers, thus avoiding the problem of insufficient priority slots preventing the insertion of new eBPF programs.

[0057] A program point is a specific identifier used to determine the scheduling position and execution order of packet processors in a program scheduling chain composed of multiple packet processors. As a specific marker identifying the execution position of each packet processor, program points are distributed sequentially on different nodes of the program scheduling chain according to a preset priority. Each program point corresponds to a packet processor and a priority, and the priority and execution order of each program point remain unchanged. Furthermore, the program points on the program scheduling chain are arranged from high to low priority. For example, if there are N program points in the program scheduling chain, program point 1 has the highest priority, and program point N has the lowest priority. At any given time, the execution order Index(Prog X) and priority Priority(Prog X) of the packet processors are numerically equal (the lower the priority value, the higher the priority).

[0058] As described above, the packet handler disclosed herein can be a packet handler that has been injected into a bytecode file and possesses reentrancy capabilities, as shown above. Furthermore, the packet handler can also intercept, analyze, modify, and forward packets by attaching to kernel network hook points. As a specific example, the packet handler can be an eBPF program.

[0059] As a concrete example, the TC subsystem can obtain the program scheduling chain through queue rules (qdisc), classifiers, and filters.

[0060] Step S702: When scheduling the target data packet processing program in the program scheduling chain, obtain the program scheduling type corresponding to the target data packet processing program.

[0061] The target packet handler can be a packet handler awaiting scheduling in the program scheduling chain. For example, a target packet handler can be inserted into the program scheduling chain, i.e., attached to the program scheduling chain; or it can be removed from the program scheduling chain, i.e., unloaded from the program scheduling chain. Accordingly, in the scenario of inserting a target packet handler, the program scheduling type of the target packet handler is "insertion"; in the scenario of removing a target packet handler, the program scheduling type of the target packet handler is "removal".

[0062] It should be understood that in the scenario of inserting a target packet handler, the target packet handler is not a packet handler that already exists in the program scheduling chain; conversely, in the scenario of removing a target packet handler, the target packet handler is a packet handler that already exists in the program scheduling chain.

[0063] As a specific example, the TC subsystem can obtain the program scheduling type of the target packet handler by parsing the TC configuration, packet handler attribute information, and kernel state.

[0064] Step S703: According to the scheduling strategy corresponding to the program scheduling type, adjust the priority of at least one data packet processing program in the program scheduling chain to obtain the target priority corresponding to each data packet processing program.

[0065] Here, when the program scheduling type is insertion, the corresponding scheduling policy is the insertion-related scheduling policy; when the program scheduling type is removal, the corresponding scheduling policy is the removal-related scheduling policy.

[0066] As mentioned earlier, there are no available program slots between adjacent program points in the program scheduling chain. Therefore, if a target packet handler is to be inserted into any program point in the program scheduling chain, such as the target program point, the priorities of one or more related packet handlers need to be adjusted to obtain an available target program point for insertion. Conversely, removing a target packet handler from the program scheduling chain also requires continuously adjusting the priorities of one or more packet handlers to ensure that there are no available program slots between adjacent program points in the chain.

[0067] The execution priority scheduling method provided in this embodiment can adjust the priority of one or more related packet processing programs according to the scheduling strategy corresponding to the program scheduling type. It does not require pre-planning the static priority of each packet processing program, nor does it require reserving priority between adjacent packet processing programs to add new packet processing programs. That is, the priority of the packet processing programs disclosed in this invention can be continuously allocated according to the execution order, which solves the problem that new packet processing programs cannot be inserted due to insufficient reserved priority. Moreover, it does not require users to modify the code. All packet processing programs are explicitly mounted to each program point, thereby improving the flexibility and maintainability of packet processing program priority scheduling, and thus reducing the complexity of packet processing program priority scheduling.

[0068] This embodiment provides a scheduling method for execution priority, which can be used in electronic devices. Figure 8 This is a flowchart of a scheduling method for execution priority according to an embodiment of the present disclosure, such as... Figure 8 As shown, the process includes the following steps:

[0069] Step S801: Obtain the program scheduling chain. The program scheduling chain includes multiple program points, and each program point corresponds to a data packet processing program. For details, please refer to [link to relevant documentation]. Figure 7Step S701 of the illustrated embodiment will not be described again here.

[0070] Step S802: When scheduling the target packet processing program in the program scheduling chain, obtain the program scheduling type corresponding to the target packet processing program. For details, please refer to [link to relevant documentation]. Figure 7 Step S702 of the illustrated embodiment will not be described again here.

[0071] Step S803: According to the scheduling strategy corresponding to the program scheduling type, adjust the priority of at least one data packet processing program in the program scheduling chain to obtain the target priority corresponding to each data packet processing program.

[0072] As mentioned earlier, there are no free program points between two adjacent program points in the program scheduling chain. Therefore, if the target data packet processor is to be inserted into any program point in the program scheduling chain, such as the target program point, the priority of the data packet processor located at the target program point and the program processor located between the target program point and the last program point in the program scheduling chain needs to be adjusted to obtain a free target program point, and then the target data packet processor can be inserted into the target program point.

[0073] Specifically, step S803 includes:

[0074] Step S8031: Obtain the target program point corresponding to the target data packet processing program.

[0075] In the insertion scenario, the target packet handler is the packet handler to be inserted into the program scheduling chain, as mentioned earlier; it is not a packet handler already attached to the current program scheduling chain. The target program point corresponding to the target packet handler is the program point where the target packet handler will be inserted. For example, as... Figure 9 As shown, the target data packet processing program (such as...) Figure 9 The ProgB shown should be inserted into the program point where the current ProgA is located, so that the program point where ProgA is located becomes the target program point.

[0076] Step S8032: Determine at least one scheduling point, which is any program point between the target program point and the last program point in the program scheduling chain.

[0077] A pending scheduling point is a program point whose priority needs to be adjusted for its corresponding packet handler. By scheduling the packet handler corresponding to the position of the pending scheduling point, an idle target program point can be obtained. It should be understood that both the target program point and the last program point in the program scheduling chain are pending scheduling points. For example, ... Figure 11 As shown, the target data packet processing program (such as...) Figure 11 The ProgD shown is to be inserted into the program point where the current ProgC is located. Thus, the program point where ProgC is located is the target program point. ProgA is the last program point on the program scheduling chain. Therefore, the points to be scheduled are the target program point and the program point corresponding to ProgA.

[0078] Step S8033: In a reverse order, successively degrade the priorities of the data packet processing programs at each point to be scheduled, to obtain the target priorities corresponding to each data packet processing program.

[0079] As shown previously, the program points on the program scheduling chain are arranged in descending order of priority. Therefore, if the target data packet processing program is to be inserted into the target program point, it is necessary to successively move the data packet processing programs at each point to be scheduled backward, that is, degrade the priorities of the data packet processing programs at each point to be scheduled. As a specific example, assume that a program scheduling chain already has N data packet processing programs, and a new data packet processing program, that is, the target data packet processing program, needs to be inserted at the execution order of k (0 < k < N). Then, the priorities of each data packet processing program can be successively adjusted from [N, N - 1, N - 2..., k] to [N + 1, N, N - 1..., k + 1] in a reverse order. Among them, [N + 1, N, N - 1..., k + 1] is the target priority corresponding to each data packet processing program. Then, the target data packet processing program is mounted at the target program point with a priority of k.

[0080] Step S8034: Insert the target data packet processing program into the target program point, to obtain the target priority corresponding to the target data packet processing program.

[0081] The target priority corresponding to the target data processing program here is the target priority corresponding to the target program point. Continuing with the previous example, the target data packet processing program is mounted at the target program point with a priority of k, that is, the target priority of the target data packet processing program is k.

[0082] In the scenario of inserting the target data packet processing program into the program scheduling chain, the points to be scheduled can be accurately determined through the target program point corresponding to the target data packet processing program. Then, in a reverse order, successively reduce the priorities of the data packet processing programs at each point to be scheduled, maintaining the integrity of the program scheduling chain, no idle state, and no breakage, ensuring the priority logic order of high first and low later. Further, it can achieve the smooth insertion of the target data packet processing program and the flexible arrangement of priorities on the premise of lossless traffic.

[0083] In some optional implementation manners, the above step S8033 includes:

[0084] Step a1: For the first data packet processing program corresponding to the first scheduling point, construct the first copy of the first data processing program, insert the first copy into the second scheduling point, the second scheduling point is adjacent to the first scheduling point and the priority of the second scheduling point is lower than the priority of the first scheduling point.

[0085] Step a2: Unload the first data processing program and insert the second data packet processing program at the location of the first scheduling point. The second data packet processing program is a copy of the third scheduling point. The third scheduling point is adjacent to the first scheduling point and the priority of the third scheduling point is higher than that of the first scheduling point.

[0086] Here, the first, second, and third scheduling points can all be any one of the scheduling points mentioned above. Before degradation, the first scheduling point corresponds to the first data packet processing program, the second scheduling point can be understood as an idle program point, and the third scheduling point corresponds to a copy of the second data packet processing program. In the program scheduling chain, the third scheduling point is adjacent to the first scheduling point, and the first scheduling point is adjacent to the second scheduling point. That is, the priority corresponding to the third scheduling point is higher than the priority corresponding to the first scheduling point, and the priority corresponding to the first scheduling point is higher than the priority corresponding to the second scheduling point.

[0087] Since the priority of the first scheduling point is higher than that of the second scheduling point, inserting the first copy into the second scheduling point makes the priority of the second scheduling point the target priority of the first copy. The execution order of the second scheduling point then becomes the execution order of the first copy, effectively downgrading the priority of the first data packet processor. Similarly, since the priority of the third scheduling point is higher than that of the first scheduling point, inserting the second data packet processor into the first scheduling point makes the priority of the first scheduling point the target priority of the second data packet processor. The execution order of the first scheduling point then becomes the execution order of the second data packet processor. Because the second data packet processor is a copy of the third scheduling point, its priority is effectively downgraded, while ensuring that the priorities and execution order of all data packet processors are numerically identical.

[0088] For example, such as Figure 9As shown, assume there is only one packet handler (ProgA) in the program scheduling chain with a priority of 1. In the scenario where the target packet handler (ProgB) is inserted into the program position where the packet handler (ProgA) is located, i.e., the target program position, the first copy of ProgA, i.e., ProgA', is constructed and then ProgA' is inserted at the end of the program scheduling chain (e.g., ...). Figure 9 As shown in step 1, priority downgrade); then unload ProgA to obtain an idle target program point, and finally insert ProgB into the target program point (e.g., Figure 9 (See step 2, Insertion). Therefore, the priority of ProgA is adjusted from 1 to 2, and the priority of ProgB remains 1.

[0089] For example, such as Figure 10 As shown, assume there are two packet handlers, ProgA and ProgB, on the program scheduling chain, where ProgB has a priority of 1 and ProgA has a priority of 2. In the scenario where the target packet handler (ProgC) is inserted at the target program position of the packet handler (ProgA), firstly, a first copy of ProgA, namely ProgA', is constructed and ProgA' is inserted at the end of the program scheduling chain, such as at the program position where ProgA' is located (e.g., ...). Figure 10 As shown in step 1, priority downgrade); then unload ProgA to obtain a free target program point, and finally insert ProgC into the target program point (e.g., Figure 10 As shown in step 2 (insertion).

[0090] For example, such as Figure 11 As shown, assume there are three packet handlers in the program scheduling chain: ProgA, ProgB, and ProgC. ProgB has a priority of 1, ProgC has a priority of 2, and ProgA has a priority of 3. In the scenario where the target packet handler (ProgD) is inserted into the target program position of the packet handler (ProgC), the program positions to be scheduled are the positions of ProgA and ProgC. First, a first copy of ProgA, namely ProgA', needs to be constructed and ProgA' inserted at the end of the program scheduling chain (e.g., ...). Figure 11 As shown in step 1, priority downgrade); then unload ProgA to obtain a free program point; subsequently, construct a second copy of ProgC, namely ProgC', and insert ProgC' into the free program point (e.g., Figure 11 (See step 2, priority downgrading). Then, unload ProgProgC to obtain an idle target program point. Finally, insert ProgD into the target program point (e.g., ...). Figure 11 As shown in step 3 (Insert).

[0091] First, a first copy of the first data packet processing program corresponding to the first scheduling point is constructed. Then, the first copy is inserted into the second scheduling point, and the first data packet processing program of the first scheduling point is unloaded. Finally, the copy corresponding to the third scheduling point is inserted into the first scheduling point. This processing method realizes the downgrading of the priority of each data packet processing program, and further realizes the insertion of the target data packet processing program into the program scheduling chain when there is no free program point between any two adjacent program points.

[0092] As mentioned earlier, there are no idle program points between two adjacent program points in the program scheduling chain. This avoids the situation where the target packet handler is inserted between two program points (if a new packet handler is inserted, steps S8031 to S8034 need to be executed), thus ensuring a continuous and compact line in the program scheduling chain, and ensuring that the execution order and priority of each program point in the program scheduling chain are strictly consistent. Therefore, in the scenario where the target packet handler is removed from the program scheduling chain, after the target packet handler is removed, the priority of the packet handlers corresponding to each scheduled point needs to be upgraded to ensure that the execution order and priority of each program point in the program scheduling chain are strictly consistent.

[0093] Specifically, step S803 above also includes:

[0094] Step S8035: Obtain the target program location corresponding to the target data packet processing program. For details, please refer to step S8031, which will not be repeated here.

[0095] Step S8036: Determine at least one scheduling point. The scheduling point is any program point between the target program point and the last program point in the program scheduling chain. For details, please refer to step S8032, which will not be repeated here.

[0096] Step S8037: In a sequential manner, the priorities of the data packet processing programs at each scheduling point are upgraded to obtain the target priority corresponding to each data packet processing program.

[0097] In the scenario of removing the target data packet handler on the program scheduling chain, in sequential order, the priorities of the data packet handlers at each pending scheduling point are upgraded in turn, which can ensure that the execution order and priority of each program point on the program scheduling chain are strictly consistent. As a specific example, assume that a program scheduling chain already has N data packet handlers, and it is necessary to remove the target data packet handler with the execution order of k (0 < k < N). Then, the priorities of each data packet handler can be adjusted from [k + 1, k + 2,... N] to [k, k + 1,..., N - 1] in sequential order.

[0098] In some optional implementation manners, the above step S8037 includes:

[0099] Step b1, unload the target data packet handler at the position where the target program point is located.

[0100] Step b2, construct a second copy corresponding to the third data packet handler, and insert the second copy into the target program point. The third data packet handler is at the fourth pending scheduling point, and the fourth pending scheduling point is adjacent to the target program point and the priority corresponding to the fourth pending scheduling point is lower than the priority corresponding to the target program point.

[0101] Unloading the target data packet handler corresponding to the target program point here can obtain an idle target program point. The second copy corresponding to the fourth pending scheduling point after the target program point can be mounted to the target program point; then unload the third data packet handler corresponding to the fourth pending scheduling point, obtain an idle fourth pending scheduling point again, construct a copy of the fourth data packet handler after the fourth pending scheduling point, and mount the copy of the fourth data packet handler to the fourth pending scheduling point. Repeat the above steps until the priority upgrade of the data packet handler corresponding to the last program point on the program scheduling chain is completed.

[0102] Since the priority corresponding to the fourth pending scheduling point is lower than the priority corresponding to the target program point, inserting the second copy into the target program point, then the priority corresponding to the target program point becomes the priority corresponding to the second copy, and the execution order corresponding to the target program point becomes the execution order corresponding to the second copy, that is, it is equivalent to upgrading the priority of the third data packet handler, and it can ensure that the priorities and execution orders of each data packet handler are the same numerically.

[0103] Such as Figure 12As shown, there are four packet processing programs in the program scheduling chain: ProgA, ProgB, ProgC, and ProgD. ProgB has a priority of 1, ProgD has a priority of 2, ProgC has a priority of 3, and ProgA has a priority of 4. In the scenario where ProgD is removed from the target program location in the program scheduling chain, ProgD is first unloaded from the target program location to obtain an idle target program location; then, a copy of ProgC, namely ProgC', is constructed and ProgC' is attached to the target program location (e.g., ...). Figure 12 As shown in step 1, priority downgrade is performed; then ProgC is unloaded from the program scheduling chain to obtain an idle program slot; then a copy of ProgA, namely ProgA', is constructed and ProgA' is attached to the program scheduling chain (e.g., ...). Figure 12 As shown in section 2, priority downgrade.

[0104] First, the target packet processing program at the target program point is unloaded, thus obtaining an idle target program point. Then, a second copy of the third packet processing program is mounted to the target program point. This not only achieves safe degradation and smooth transition of the packet processing program without interrupting the packet processing flow, but also avoids the problem of idle program points between two adjacent program points.

[0105] The execution priority scheduling method provided in this embodiment, through the corresponding scheduling strategies in the insertion and removal scenarios, can not only insert the target data packet processing program into the program scheduling chain, but also flexibly arrange each data packet processing program in the program scheduling chain, and avoid the problem of idle program points between two adjacent program points.

[0106] This embodiment provides a scheduling method for execution priority, which can be used in electronic devices. Figure 13 This is a flowchart of a scheduling method for execution priority according to an embodiment of the present disclosure, such as... Figure 13 As shown, the process includes the following steps:

[0107] Step S1301: Obtain the program scheduling chain. The program scheduling chain includes multiple program points, and each program point corresponds to a data packet processing program. For details, please refer to [link to relevant documentation]. Figure 7 Step S701 of the illustrated embodiment will not be described again here.

[0108] Step S1302: When scheduling the target packet processing program in the program scheduling chain, obtain the program scheduling type corresponding to the target packet processing program. For details, please refer to [link to relevant documentation]. Figure 7 Step S702 of the illustrated embodiment will not be described again here.

[0109] Step S1303: According to the scheduling policy corresponding to the program scheduling type, adjust the priority of at least one packet processing program in the program scheduling chain to obtain the target priority for each packet processing program. For details, please refer to [link to relevant documentation]. Figure 7 Step S703 of the illustrated embodiment will not be described again here.

[0110] Step S1304: Obtain the data packet and the data packet identifier corresponding to the identifier field in the data packet.

[0111] The identifier field `sk_buff->mark` is a reserved field (usually of type `int`) in the `struct_sk_buff` data structure in the Linux kernel, used to store metadata related to data packets. As a concrete example, the identifier field `sk_buff->mark` can identify the packet handler that the packet passed through. For instance, after a packet handler with priority 1 processes a packet, it can update its own handler identifier in the identifier field.

[0112] Step S1305: If the data packet identifier is the same as the program identifier of the current data packet handler, then the data packet is sent to the next data packet handler.

[0113] A program identifier (ID) is used to uniquely identify a packet processing program. It should be noted that when the packet processing program is an eBPF program, the program identifier in this disclosure is different from the Handle in the eBPF program. For the Handle, two identical eBPF programs have different Handles, while in this disclosure, two identical eBPF programs have different program identifiers. Thus, by comparing the packet identifier with the program identifier of the current packet processing program, it can be determined whether the current packet processing program is processing the packet.

[0114] If the packet identifier is the same as the program identifier of the current packet handler, it means that the packet has been executed by the previous packet handler that is adjacent to and the same as the current packet handler. Therefore, the current packet handler does not need to process the packet again and can send the packet to the next packet handler.

[0115] Step S1306: Process the data packet using the next data packet processor. The next data packet processor is adjacent to the current data packet processor and has a lower priority than the current data packet processor.

[0116] Here, the program point corresponding to the next packet handler is adjacent to the program point corresponding to the current data handler. For example, in a program scheduling chain, the program point corresponding to the current data handler is k, the execution order is k, and the priority is k, while the program point corresponding to the next packet handler is k+1, the execution order is k+1, and the priority is k+1.

[0117] Step S1307: If the data packet identifier is different from the program identifier of the current data packet processing program, process the data packet using the current data packet processing program.

[0118] The current packet handler can perform operations such as filtering, modifying, monitoring, and redirecting packets. This disclosure does not impose any limitations on these operations.

[0119] If the packet identifier is different from the identifier of the current packet handler, it means that the packet has not been executed by the previous packet handler that is adjacent to and the same as the current packet handler. Therefore, the current packet handler can process the packet.

[0120] In addition, after the current packet handler processes a packet or during packet processing, it can update its own program identifier in the packet's tag field so that the next packet handler can continue to perform the above judgment on the packet.

[0121] If the identifier field `_sk_buff->mark` differs from the program identifier of the current packet handler, then all logic of the current packet handler is executed, and the identifier field is updated to the program identifier of the current packet handler. If the identifier field `_sk_buff->mark` is the same as the program identifier of the current packet handler, it indicates that the logic of the current packet handler has already been executed once at a higher priority, and the execution of the logic of the current packet handler is skipped. Through this judgment logic, in the insertion and removal scenarios described above, even if two identical packet handlers exist at the same time, only one of the two identical packet handlers will process the same packet, preventing unexpected behavior caused by the packet passing through two identical packet handlers.

[0122] In one optional implementation, determining whether the data packet identifier is the same as the program identifier of the current data packet processing program includes: determining, from the program identifier of the current data packet processing program, the status flag bit corresponding to the current data packet processing program and the first target value corresponding to the status flag bit; determining, from the data packet identifier, the second target value corresponding to the status flag bit; if the first target value and the second target value are different, then determining that the data packet identifier is different from the identifier of the current data packet processing program.

[0123] As a specific example, the program identifier of a packet handler can be a name such as Figure 14 The diagram shows a 32-bit program identifier, where each packet handler can assign one status flag bit. For example... Figure 14 The program identifier of the first packet handler in the program scheduling chain shown is 0X1 (in hexadecimal representation), which means that the status flag of the first packet handler is the last bit in the 32-bit binary representation; the program identifier of the second packet handler is 0X2, which means that the status flag of the second packet handler is the second to last bit in the 32-bit binary representation.

[0124] By comparing the first target value corresponding to the status flag bit of the current packet processing program with the second target value corresponding to the status flag bit in the packet flag, the difference in flags can be accurately located, which can improve judgment efficiency, reduce computational overhead, and avoid redundant verification.

[0125] In an alternative implementation, the method further includes updating the second target value in the packet identifier to the first target value.

[0126] If the packet identifier is different from the program identifier of the current packet handler, the second target value in the packet identifier can be updated using the first target value corresponding to the status flag bit of the current packet handler, which can update the packet identifier quickly and accurately.

[0127] The execution priority scheduling method provided in this embodiment processes data packets using the current data packet handler when the packet identifier is different from the current packet handler's identifier; when the packet identifier is the same as the current packet handler, the next packet handler adjacent to the current packet handler processes the packet. This gives the packet handlers a certain degree of reentrancy capability, meaning that a packet will only be executed once if it passes through two identical packet handlers consecutively. Therefore, even in insertion or removal scenarios, no unexpected behavior will occur, even if two identical packet handlers exist.

[0128] As a specific application example of this disclosure, such as Figure 15 As shown, for a program scheduling chain, at the first time point, the program scheduling chain has only one packet processing program ProgA with priority N. At this time, the priority of ProgA needs to be downgraded, that is, the priority is downgraded from N to N+1. In this scenario, firstly, a copy of ProgA, namely ProgA', is built, and then ProgA' is attached to the program point with priority N+1 (e.g., ...). Figure 15As shown in Figure 1, by mounting ProgA', you can obtain... Figure 15 The program scheduling chain corresponding to the second time point is shown. Then, as... Figure 15 At the third time point shown, ProgA is unloaded from the program point with priority N (e.g., Figure 15 The uninstallation of ProgA is shown, thus obtaining the program scheduling chain shown at the fourth time point.

[0129] When a data packet enters ProgA at the first time point, ProgA processes the packet and updates its own program identifier in the packet's identifier field. If ProgA's return value indicates that the packet will proceed to the next packet handler, the packet will enter ProgA' at the second time point. ProgA' will first retrieve the packet identifier from the packet's identifier field and compare it with its own program identifier. If ProgA' determines that the packet identifier matches its own program identifier, it can send the packet to its next packet handler for processing.

[0130] It should be understood that the first, second, third, and fourth time points are consecutive, with the first time point earlier than the second time point, the second time point earlier than the third time point, and the third time point earlier than the fourth time point.

[0131] Therefore, the scheduling method shown in this disclosure will not result in two identical packet handlers having non-adjacent priorities, whether inserting or removing a scenario. Consequently, it will also prevent other packet handlers from updating their own program identifiers to the identifier field of the packet.

[0132] Furthermore, the scheduling method disclosed herein does not require prior negotiation between components. It can dynamically adjust the priority of packet handlers on the program scheduling chain as needed when inserting or removing packet handlers, and assign consecutive priorities to packet handlers according to their execution order. No priority needs to be reserved between adjacent packet handlers, which solves the problem of not being able to insert new packet handlers due to insufficient reserved priority. No user code modification is required, and all packet handlers are explicitly mounted to the program points.

[0133] This embodiment also provides a scheduling device for execution priority, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0134] This embodiment provides a scheduling device for execution priority, such as... Figure 16 As shown, it includes:

[0135] The first acquisition module 1601 is used to acquire the program scheduling chain, which includes multiple program points, each program point corresponding to a data packet processing program.

[0136] The second acquisition module 1602 is used to acquire the program scheduling type corresponding to the target data packet processing program when the target data packet processing program is scheduled in the program scheduling chain.

[0137] The adjustment module 1603 is used to adjust the priority of at least one packet processing program in the program scheduling chain according to the scheduling strategy corresponding to the program scheduling type, so as to obtain the target priority corresponding to each packet processing program.

[0138] In some optional implementations, when the program scheduling type is insertion, the adjustment module 1603 includes:

[0139] The first acquisition unit is used to acquire the target program point corresponding to the target data packet processing program.

[0140] The first determining unit is used to determine at least one scheduling point, which is any program point between the target program point and the last program point in the program scheduling chain.

[0141] The degradation unit is used to downgrade the priority of the packet processing program at each scheduling point in reverse order to obtain the target priority of each packet processing program.

[0142] The insertion unit is used to insert the target data packet processing program into the target program point to obtain the target priority corresponding to the target data packet processing program.

[0143] In some alternative implementations, the degradation unit includes:

[0144] The first insertion subunit is used to construct a first copy of the first data processing program corresponding to the first data packet processing program corresponding to the first scheduling point, and insert the first copy into the second scheduling point. The second scheduling point is adjacent to the first scheduling point and the priority of the second scheduling point is lower than the priority of the first scheduling point.

[0145] The second insertion subunit is used to unload the first data processing program and insert the second data packet processing program at the location of the first scheduling point. The second data packet processing program is a copy of the third scheduling point. The third scheduling point is adjacent to the first scheduling point and the priority of the third scheduling point is higher than the priority of the first scheduling point.

[0146] In some optional implementations, when the program scheduling type is removal, the adjustment module 1603 further includes:

[0147] The first acquisition unit is also used to acquire the target program point corresponding to the target data packet processing program.

[0148] The first determining unit is also used to determine at least one scheduling point, which is any program point between the target program point and the last program point on the program scheduling chain.

[0149] The upgrade unit is used to upgrade the priority of the packet processing program at each scheduling point in sequence to obtain the target priority of each packet processing program.

[0150] In some optional implementations, the upgrade unit further includes:

[0151] The unloading subunit is used to unload the target data packet processing program at the location of the target program point.

[0152] The third insertion subunit is used to construct the second copy corresponding to the third data packet processing program, insert the second copy into the target program point, and the third data packet processing program is located at the fourth scheduling point. The fourth scheduling point is adjacent to the target program point and the priority of the fourth scheduling point is lower than the priority of the target program point.

[0153] In some alternative embodiments, the device further includes:

[0154] The third acquisition module is used to acquire data packets and the data packet identifier corresponding to the identifier field in the data packets.

[0155] The sending module is used to send the data packet to the next data packet handler if the data packet identifier is the same as the program identifier of the current data packet handler.

[0156] The first processing module is used to process data packets using the next data packet handler, which is adjacent to the current data packet handler and has a lower priority than the current data packet handler.

[0157] In some alternative embodiments, the device further includes:

[0158] The second processing module is used to process the data packet using the current data packet processing program if the data packet identifier is different from the program identifier of the current data packet processing program.

[0159] In some alternative implementations, the sending module includes:

[0160] The second determining unit is used to determine the status flag bit corresponding to the current data packet processing program and the first target value corresponding to the status flag bit from the program identifier of the current data packet processing program.

[0161] The third determining unit is used to determine the second target value corresponding to the status identifier bit from the data packet identifier.

[0162] The fourth determining unit is used to determine that the packet identifier is different from the identifier of the current packet processing program if the first target value and the second target value are different.

[0163] In some alternative embodiments, the device further includes:

[0164] The update module is used to update the second target value in the packet identifier to the first target value.

[0165] The execution priority scheduling device provided in this disclosure can execute the execution priority scheduling method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of the execution method. This disclosure eliminates the need for pre-planning the static priorities of each data packet processing program, and also eliminates the need to reserve priorities between adjacent data packet processing programs to add new data packet processing programs. This solves the problem of insufficient reserved priorities preventing the insertion of new data packet processing programs, and also eliminates the need for user code modification. All data packet processing programs are explicitly mounted to each program point, thereby improving the flexibility and maintainability of data packet processing program priority scheduling, and thus reducing the complexity of data packet processing program priority scheduling. Further functional descriptions of the above modules and units are the same as in the corresponding embodiments described above, and will not be repeated here.

[0166] Figure 17 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure.

[0167] The following is a detailed reference. Figure 17The diagram illustrates a structural schematic suitable for implementing an electronic device according to embodiments of the present disclosure. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 1701, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 1702 or a program loaded from memory 1708 into random access memory (RAM) 1703. The RAM 1703 also stores various programs and data required for the operation of the electronic device. The processor 1701, ROM 1702, and RAM 1703 are interconnected via a bus 1704. An input / output (I / O) interface 1705 is also connected to the bus 1704.

[0168] Typically, the following devices can be connected to I / O interface 1705: input devices 1706 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 1707 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 1708 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1709. Communication device 1709 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 17 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.

[0169] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 1709, or installed from memory 1708, or installed from ROM 1702. When the computer program is executed by processor 1701, it performs the functions defined in the execution priority scheduling method of embodiments of this disclosure.

[0170] Figure 17 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0171] This disclosure also provides a computer-readable storage medium in which the methods described in this disclosure can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code downloaded over a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and subsequently stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium may also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the execution priority scheduling method shown in the above embodiments.

[0172] A portion of this disclosure can be applied to computer program products, such as computer program instructions, which, when executed by a computer, can invoke or provide methods and / or technical solutions according to this disclosure through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, and installation package files. Accordingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions; the computer compiling the instructions and then executing the corresponding compiled program; the computer reading and executing the instructions; or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.

[0173] Although embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations all fall within the scope defined by the appended claims.

Claims

1. A scheduling method for execution priority, characterized in that, include: Obtain a program scheduling chain, wherein the program scheduling chain includes multiple program points, and each program point corresponds to a data packet processing program; When scheduling a target data packet processing program in the program scheduling chain, obtain the program scheduling type corresponding to the target data packet processing program; According to the scheduling strategy corresponding to the program scheduling type, the priority of at least one of the packet processing programs in the program scheduling chain is adjusted to obtain the target priority corresponding to each packet processing program.

2. The method according to claim 1, characterized in that, When the program scheduling type is insertion, adjusting the priority of at least one packet processing program in the program scheduling chain according to the scheduling strategy corresponding to the program scheduling type to obtain the target priority corresponding to each packet processing program includes: Obtain the target program point corresponding to the target data packet processing program; Determine at least one scheduling point, wherein the scheduling point is any one of the program points between the target program point and the last program point on the program scheduling chain; In reverse order, the priorities of the data packet processing programs located at each of the scheduled points are downgraded sequentially to obtain the target priorities corresponding to each of the data packet processing programs. The target data packet processing program is inserted into the target program point to obtain the target priority corresponding to the target data packet processing program.

3. The method according to claim 2, characterized in that, The step of downgrading the priority of the data packet processing programs located at each of the scheduled points in reverse order to obtain the target priority corresponding to each data packet processing program includes: For the first data packet processing program corresponding to the first scheduling point, a first copy of the first data processing program is constructed, and the first copy is inserted into the second scheduling point. The second scheduling point is adjacent to the first scheduling point and the priority of the second scheduling point is lower than the priority of the first scheduling point. The first data processing program is unloaded and a second data packet processing program is inserted at the location of the first scheduling point. The second data packet processing program is a copy of the third scheduling point. The third scheduling point is adjacent to the first scheduling point and the priority of the third scheduling point is higher than the priority of the first scheduling point.

4. The method according to claim 1, characterized in that, When the program scheduling type is removal, the step of adjusting the priority of at least one packet processing program in the program scheduling chain according to the scheduling policy corresponding to the program scheduling type to obtain the target priority corresponding to each packet processing program includes: Obtain the target program point corresponding to the target data packet processing program; Determine at least one scheduling point, wherein the scheduling point is any one of the program points between the target program point and the last program point on the program scheduling chain; In a sequential manner, the priorities of the data packet processing programs located at each of the scheduled points are upgraded to obtain the target priorities corresponding to each data packet processing program.

5. The method according to claim 4, characterized in that, The step of sequentially upgrading the priority of the data packet processing programs at each of the scheduled locations to obtain the target priority for each data packet processing program includes: Unload the target data packet processing program at the location of the target program point; A second copy of the third data packet processing program is constructed and inserted into the target program point. The third data packet processing program is located at a fourth scheduling point. The fourth scheduling point is adjacent to the target program point and the priority of the fourth scheduling point is lower than the priority of the target program point.

6. The method according to any one of claims 1 to 5, characterized in that, The method further includes: Obtain the data packet and the data packet identifier corresponding to the identifier field in the data packet; If the packet identifier is the same as the program identifier of the current packet handler, then the packet is sent to the next packet handler. The data packet is processed using the next data packet handler, which is adjacent to the current data packet handler and has a lower priority than the current data packet handler.

7. The method according to claim 6, characterized in that, The method further includes: If the packet identifier is different from the program identifier of the current packet processing program, the packet is processed using the current packet processing program.

8. The method according to claim 6, characterized in that, Determining whether the packet identifier is the same as the program identifier of the current packet processing program includes: From the program identifier of the current data packet processing program, determine the status flag bit corresponding to the current data packet processing program and the first target value corresponding to the status flag bit; Determine the second target value corresponding to the status flag bit from the data packet identifier; If the first target value and the second target value are not the same, then it is determined that the packet identifier is not the same as the identifier of the current packet processing program.

9. The method according to claim 8, characterized in that, The method further includes: Update the second target value in the packet identifier to the first target value.

10. A scheduling device for execution priority, characterized in that, include: The first acquisition module is used to acquire a program scheduling chain, wherein the program scheduling chain includes multiple program points, and each program point corresponds to a data packet processing program. The second acquisition module is used to acquire the program scheduling type corresponding to the target data packet processing program when the target data packet processing program is scheduled in the program scheduling chain; The adjustment module is used to adjust the priority of at least one of the data packet processing programs in the program scheduling chain according to the scheduling strategy corresponding to the program scheduling type, so as to obtain the target priority corresponding to each of the data packet processing programs.

11. An electronic device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the computer instructions to perform the scheduling method of execution priority according to any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to execute the scheduling method for execution priority as described in any one of claims 1 to 9.

13. A computer program product, characterized in that, Includes computer instructions for causing a computer to execute the scheduling method for execution priority as described in any one of claims 1 to 9.