Encryption method and device of dual-mode communication system, medium and equipment
By dynamically creating and adjusting instance queues, the problem of limited encryption accelerator resources under 5G and 4G dual-mode protocol stacks is solved, encryption processing efficiency and throughput are improved, and CPU load is reduced.
Patent Information
- Application Number
- CN202410625515.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-20
- Publication Date
- 2024-09-10
AI Technical Summary
In the case of 5G and 4G dual-mode protocol stack deployment, encryption accelerator resources are limited, resulting in low encryption processing efficiency, and unknown errors are prone to occur when driving the accelerator at the same time.
Dynamically create multiple instances, associate each instance with an initial queue, add data to the queue in real time, and adjust the number of queues based on the amount of data to achieve load balancing and improve accelerator resource utilization.
When the encryption accelerator resources are limited, the resource utilization of the encryption accelerator is improved, the CPU load is reduced, the throughput of the entire protocol stack system is improved, and complex encryption requirements are solved.
Smart Images

Figure CN118632235A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to an encryption method, device, medium and equipment for a dual-mode communication system. Background Art
[0002] Whether it is 4G or 5G communication, encryption and integrity protection have always been very important functions of the PDCP (Packet Data Convergence Protocol) layer of the communication protocol stack. In addition, for security reasons, base stations will not transmit data directly on the Internet. During transmission, IPSec (Internet Protocol Security) encryption and decryption are also required. IPSec is a collection of protocols and services that provide security for IP networks.
[0003] In the 5G protocol stack solution, in order to speed up the sending and receiving of data packets, DPDK (Data Plane Development Kit) is usually added, and the high-performance data processing library of DPDK is used to achieve high throughput of base stations. Because of some functional features of DPDK and in order to reuse the encryption and decryption framework of DPDK to accelerate the encryption and decryption of data, it is necessary to deploy and run PDCP encryption and decryption and IPSec in the user state of Linux. In order to be compatible with old products, in the 4G base station protocol stack implementation solution, the encryption and decryption and integrity protection of 4G PDCP are usually deployed and run in the user state of Linux, while 4G IPSec is deployed and works based on the kernel state of Linux.
[0004] Based on the above usage scenarios, it is necessary to implement a set of hardware encryption accelerator drivers in kernel mode and user mode respectively, and take into account the PDCP encryption and decryption and integrity protection data of the 5G and 4G protocol stacks that are processed at the same time. However, in theory, the same accelerator resource is either driven in Linux user mode or in Linux kernel mode at the same time. If driven at the same time, the accelerator will generally have unknown errors. Therefore, when running the 4G and 5G dual-mode protocol stacks, how to perform data encryption processing with limited encryption accelerators is a problem that needs to be solved. Summary of the invention
[0005] In order to solve the problems of the prior art, the embodiments of the present invention provide an encryption method, device, medium and equipment for a dual-mode communication system, and the technical solution is as follows:
[0006] In a first aspect, an encryption method for a dual-mode communication system is provided, the method comprising:
[0007] In response to receiving a startup instruction for a communication base station system, multiple instances are established, and the states of the multiple instances are all set to an idle state, wherein the multiple instances include a 5G communication protocol stack packet data convergence protocol PDCP layer data encryption instance, a 5G communication protocol stack PDCP layer data decryption instance, a 5G communication protocol stack PDCP layer data integrity calculation instance, a 5G communication protocol stack PDCP layer data integrity verification instance, a 5G communication protocol stack PDCP layer signaling integrity calculation instance, a 5G communication protocol stack PDCP layer signaling integrity verification instance, a 5G communication protocol stack IPSec encryption instance, a 5G communication protocol stack IPSec decryption instance, a 4G communication protocol stack PDCP layer data encryption instance, a 4G communication protocol stack PDCP layer data decryption instance, a 4G communication protocol stack PDCP layer data integrity calculation instance, a 4G communication protocol stack PDCP layer data integrity verification instance, a 4G communication protocol stack PDCP layer signaling integrity calculation instance, a 4G communication protocol stack PDCP layer signaling integrity verification instance, a 4G communication protocol stack IPSec encryption instance, and a 4G communication protocol stack IPSec decryption instance;
[0008] In response to receiving an instruction to turn on the encryption and decryption switch and the integrity protection switch in the communication base station system, reading configuration files of the multiple instances respectively, and changing the states of the multiple instances from an idle state to an execution state;
[0009] For each of the instances, create an initial queue corresponding to the instance, and associate the instance with the corresponding initial queue;
[0010] For instances other than the 4G communication protocol stack IPSec encryption instance and the 4G communication protocol stack IPSec decryption instance, enqueue the data of the instance into the corresponding initial queue in real time, and adjust the associated queue according to the amount of data of the instance;
[0011] Determine the target instance to be processed currently. If the target instance is an instance other than the 4G communication protocol stack IPSec encryption instance and the 4G communication protocol stack IPSec decryption instance, send the data in the queue associated with the target instance to the target encryption accelerator, so that the target encryption accelerator encrypts the data in the queue associated with the target instance.
[0012] In a second aspect, an encryption device for a dual-mode communication system is provided, the device comprising:
[0013] An establishment module, configured to establish multiple instances in response to receiving a startup instruction for a communication base station system, and set the states of the multiple instances to an idle state, wherein the multiple instances include a 5G communication protocol stack packet data convergence protocol PDCP layer data encryption instance, a 5G communication protocol stack PDCP layer data decryption instance, a 5G communication protocol stack PDCP layer data integrity calculation instance, a 5G communication protocol stack PDCP layer data integrity verification instance, a 5G communication protocol stack PDCP layer signaling integrity calculation instance, a 5G communication protocol stack PDCP layer signaling integrity verification instance, a 5G communication protocol stack IPSec encryption instance, a 5G communication protocol stack IPSec decryption instance, a 4G communication protocol stack PDCP layer data encryption instance, a 4G communication protocol stack PDCP layer data decryption instance, a 4G communication protocol stack PDCP layer data integrity calculation instance, a 4G communication protocol stack PDCP layer data integrity verification instance, a 4G communication protocol stack PDCP layer signaling integrity calculation instance, a 4G communication protocol stack PDCP layer signaling integrity verification instance, a 4G communication protocol stack IPSec encryption instance, and a 4G communication protocol stack IPSec decryption instance;
[0014] a reading module, configured to, in response to receiving an instruction to turn on the encryption and decryption switch and the integrity protection switch in the communication base station system, read the configuration files of the multiple instances respectively, and change the states of the multiple instances from an idle state to an execution state;
[0015] An associating module, used for creating an initial queue corresponding to each instance, and associating the instance with the corresponding initial queue;
[0016] An adjustment module, for enqueuing data of instances other than the 4G communication protocol stack IPSec encryption instance and the 4G communication protocol stack IPSec decryption instance into the corresponding initial queue in real time, and adjusting the associated queue according to the amount of data of the instance;
[0017] A determination module is used to determine the target instance to be processed currently. If the target instance is an instance other than the 4G communication protocol stack IPSec encryption instance and the 4G communication protocol stack IPSec decryption instance, the data in the queue associated with the target instance is sent to the target encryption accelerator, so that the target encryption accelerator encrypts the data in the queue associated with the target instance.
[0018] According to a third aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the steps of the method provided in the first aspect are implemented.
[0019] In a fourth aspect, an electronic device is provided, including:
[0020] a memory having a computer program stored thereon;
[0021] A processor is used to execute the computer program in the memory to implement the steps of the method provided in the first aspect.
[0022] The technical solution provided by the embodiment of the present invention has the following beneficial effects:
[0023] Through the above technical solution, when the encryption accelerator resources are limited, multiple instances are dynamically created, and different instances perform different calculations. For each instance, an initial queue corresponding to the instance is created. Each instance is associated with at least one queue, and the data of the instance is queued to the corresponding initial queue in real time, and the associated queue is adjusted according to the amount of data in the instance, that is, the number of queues is dynamically increased or decreased according to the amount of data carried by the queues in the instance to achieve load balancing and improve the utilization of accelerator resources. When the hardware encryption accelerator resources on the base station chip are limited, the complex encryption requirements in the deployment of the 5G+4G dual-mode protocol stack are solved, the resource utilization of the encryption accelerator is improved, the CPU load is reduced, and the throughput of the entire protocol stack system is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0025] Figure 1 is a flowchart exemplarily showing an encryption method for a dual-mode communication system;
[0026] Figure 2 is a flowchart exemplarily illustrating a method for determining current priority information of an instance;
[0027] Figure 3 The figure is a block diagram showing an encryption device of a dual-mode communication system by way of example. DETAILED DESCRIPTION
[0028] In order to make the objectives, technical solutions and advantages of the present invention more clear, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
[0029] As described in the background technology, encryption accelerator resources are usually limited. If there are many accelerator resources, for example, there are 8 accelerators, four accelerators are driven in the user state of DPDK, and are used for integrity protection calculation, decryption and integrity protection verification of 5G data encryption and signaling, and encryption and decryption of IPSec. Two of the other four accelerators are driven in the user state, and are used for encryption and decryption, integrity protection calculation, decryption and integrity protection verification of 4G. The other two are driven in the kernel state for encryption and decryption of IPSec data. However, in actual chip design, due to chip size, layout and cost considerations, so many encryption accelerator resources will not be provided at one time.
[0030] In view of this, the present invention provides an encryption method, device, medium and equipment for a dual-mode communication system, which can meet the needs of simultaneously executing data encryption of 5G and 4G protocol stacks when the resources of the hardware encryption accelerator are limited, and achieve the purpose of improving throughput and reducing the overall CPU load.
[0031] Figure 1 is a flowchart showing an encryption method for a dual-mode communication system. Figure 1 As shown, the method may include steps 11 to 15.
[0032] Step 11: In response to receiving a startup instruction for the communication base station system, multiple instances are established, and the states of the multiple instances are all set to an idle state.
[0033] Among them, multiple instances include a 5G communication protocol stack packet data convergence protocol PDCP layer data encryption instance, a 5G communication protocol stack PDCP layer data decryption instance, a 5G communication protocol stack PDCP layer data integrity calculation instance, a 5G communication protocol stack PDCP layer data integrity verification instance, a 5G communication protocol stack PDCP layer signaling integrity calculation instance, a 5G communication protocol stack PDCP layer signaling integrity verification instance, a 5G communication protocol stack IPSec encryption instance, a 5G communication protocol stack IPSec decryption instance, a 4G communication protocol stack PDCP layer data encryption instance, a 4G communication protocol stack PDCP layer data decryption instance, a 4G communication protocol stack PDCP layer data integrity calculation instance, a 4G communication protocol stack PDCP layer data integrity verification instance, a 4G communication protocol stack PDCP layer signaling integrity calculation instance, a 4G communication protocol stack PDCP layer signaling integrity verification instance, a 4G communication protocol stack IPSec encryption instance, and a 4G communication protocol stack IPSec decryption instance.
[0034] Among them, when the communication base station system is started and the protocol stack is initialized, 16 instances are established by default. The instances can also be called jobs, and each instance is set to an idle state.
[0035] Step 12: In response to receiving an instruction to turn on the encryption and decryption switch and the integrity protection switch in the communication base station system, the configuration files of the multiple instances are read respectively, and the states of the multiple instances are changed from an idle state to an execution state.
[0036] Step 13: For each instance, create an initial queue corresponding to the instance and associate the instance with the corresponding initial queue.
[0037] If the encryption, decryption or integrity protection switches have been turned on in the OAM system on the base station side, the communication protocol stack initialization will read the corresponding configuration files, which may include encryption algorithms, decryption algorithms, integrity protection algorithms, algorithms used by IPSec, etc. For example, the configuration file of the 5G communication protocol stack PDCP layer data decryption instance may include the 5G communication protocol stack PDCP layer data decryption algorithm, and the configuration file of the 5G communication protocol stack PDCP layer data integrity calculation instance may include the 5G communication protocol stack PDCP layer data integrity protection algorithm. At the same time, the state of the instance is set to the execution state, that is, the Run state, and is associated with the queue corresponding to the instance. If the encryption and decryption switch is turned on midway after the base station protocol stack is started, the corresponding queue will also be queried, the state of the instance will be set to the execution state, and the corresponding queue will be associated.
[0038] Step 14: For instances other than the 4G communication protocol stack IPSec encryption instance and the 4G communication protocol stack IPSec decryption instance, the data of the instance is queued into the corresponding initial queue in real time, and the associated queue is adjusted according to the amount of data of the instance.
[0039] Step 15: Determine the target instance to be processed currently. If the target instance is an instance other than the 4G communication protocol stack IPSec encryption instance and the 4G communication protocol stack IPSec decryption instance, send the data in the queue associated with the target instance to the target encryption accelerator, so that the target encryption accelerator encrypts the data in the queue associated with the target instance.
[0040] Among them, the method in the present invention can be applied to the user state of Linux, and the 4G communication protocol stack IPSec encryption instance and the 4G communication protocol stack IPSec decryption instance are applied to the kernel state. Therefore, for other instances except the 4G communication protocol stack IPSec encryption instance and the 4G communication protocol stack IPSec decryption instance, the data in the associated queue can be sent to the target encryption accelerator, so that the target encryption accelerator can encrypt the data in the queue associated with the target instance.
[0041] Through the above technical solution, when the encryption accelerator resources are limited, multiple instances are dynamically created, and different instances perform different calculations. For each instance, an initial queue corresponding to the instance is created. Each instance is associated with at least one queue, and the data of the instance is queued to the corresponding initial queue in real time, and the associated queue is adjusted according to the amount of data in the instance, that is, the number of queues is dynamically increased or decreased according to the amount of data carried by the queues in the instance to achieve load balancing and improve the utilization of accelerator resources. When the hardware encryption accelerator resources on the base station chip are limited, the complex encryption requirements in the deployment of the 5G+4G dual-mode protocol stack are solved, the resource utilization of the encryption accelerator is improved, the CPU load is reduced, and the throughput of the entire protocol stack system is improved.
[0042] In the present invention, the method further comprises:
[0043] If the target instance is the 4G communication protocol stack IPSec encryption instance or the 4G communication protocol stack IPSec decryption instance, the data of the target instance is sent to the base station kernel, so that the base station kernel encrypts the data of the target instance.
[0044] Among them, the 4G communication protocol stack IPSec encryption instance and the 4G communication protocol stack IPSec decryption instance are special. No data is queued in the queues associated with these two instances, but they participate in the scheduling of the entire instance. Because 4G IPSec is deployed and runs in the Linux kernel state, IPSec encrypted and decrypted data are also queued and managed in the kernel state. When scheduling to the 4G communication protocol stack IPSec encryption instance and the 4G communication protocol stack IPSec decryption instance, the instance scheduling module will send a message to the kernel, and the kernel will take over the driver of the hardware encryption accelerator. After processing the data to be encrypted and decrypted, it will notify the instance scheduling module, and the instance scheduling module will continue to take over the driver of the hardware encryption accelerator in the user state to schedule other instances.
[0045] In the present invention, the target encryption accelerator is determined by:
[0046] When an encryption accelerator is provided in the base station, the encryption accelerator is used as the target encryption accelerator;
[0047] In the case where a PDCP encryption accelerator and an IPSec encryption accelerator are provided in the base station, if the target instance is one of the following, the PDCP encryption accelerator is used as the target encryption accelerator: a 5G communication protocol stack packet data convergence protocol PDCP layer data encryption instance, a 5G communication protocol stack PDCP layer data decryption instance, a 5G communication protocol stack PDCP layer data integrity calculation instance, a 5G communication protocol stack PDCP layer data integrity verification instance, a 5G communication protocol stack PDCP layer signaling integrity calculation instance, a 5G communication protocol stack PDCP layer signaling integrity verification instance, a 4G communication protocol stack PDCP layer data encryption instance, a 4G communication protocol stack PDCP layer data decryption instance, a 4G communication protocol stack PDCP layer data integrity calculation instance, a 4G communication protocol stack PDCP layer data integrity verification instance, a 4G communication protocol stack PDCP layer signaling integrity calculation instance, a 4G communication protocol stack PDCP layer signaling integrity verification instance;
[0048] If the target instance is one of the following, the IPSec encryption accelerator is used as the target encryption accelerator: 5G communication protocol stack IPSec encryption instance, 5G communication protocol stack IPSec decryption instance.
[0049] The present invention completes the encryption of protocol stack data when there are only two or even one encryption accelerator resources. If there are two encryption accelerators, one encryption accelerator is responsible for processing PDCP layer data, and the other encryption accelerator is responsible for IPSec data processing.
[0050] In step 14, the data of the instance is queued into the corresponding initial queue in real time, and the associated queue is adjusted according to the amount of data of the instance, which may include:
[0051] Enqueue the instance data into the currently specified queue in real time, where the currently specified queue is initially the initial queue;
[0052] Determine whether the amount of data in the current specified queue reaches a first amount threshold;
[0053] When the first quantity threshold is reached, another queue corresponding to the instance is created, the other queue is associated with the instance, and the other queue is used as a new current designated queue, and the steps of enqueuing the data of the instance to the current designated queue in real time to determining whether the amount of data in the current designated queue reaches the first quantity threshold are re-executed;
[0054] When the data of the instance is queued, determining whether the amount of data in the current designated queue is less than a second amount threshold, wherein the second amount threshold is less than the first amount threshold;
[0055] If it is less than the second quantity threshold, determine whether there are other queues associated with the instance that meet the preset conditions. If so, store the data in the currently specified queue in the other queues, release the association between the instance and the currently specified queue, and delete the currently specified queue, wherein the preset conditions include that the amount of data in the queue is less than the difference between the first quantity threshold and the amount of data in the currently specified queue.
[0056] Among them, for example, the first quantity threshold is set to 1024, and the second quantity threshold is set to 128. When the 5G and 4G protocol stacks are running respectively, the data and signaling to be encrypted and integrity protected will be queued into the queue of the corresponding instance respectively. When the number of queued data exceeds the first quantity threshold, the first quantity threshold is set to 1024, for example, that is, when the number of data in the current designated queue exceeds 1024, a new queue will be created and associated with the instance. When the number of queued data is less than the second quantity threshold, the second quantity threshold is set to 128, for example, the current designated queue will be disassociated from the instance, and the data in the current designated queue will be appended to other queues of the instance that meet the preset conditions, wherein the preset conditions include that the number of data in the queue is less than the difference between the first quantity threshold and the number of data in the current designated queue, so that other queues can accommodate the data in the current designated queue. In the entire process of creating and separating queues, it must be ensured that each instance is associated with at least one queue.
[0057] Two implementation methods of step 15 are described below.
[0058] In one embodiment, step 15 may include:
[0059] Determine a target instance from the multiple instances in a preset order until the multiple instances have been processed, wherein, when the target instance is an instance other than the 4G communication protocol stack IPSec encryption instance and the 4G communication protocol stack IPSec decryption instance, perform the following steps for the target instance:
[0060] Determine the target queue that has not been processed from the queues associated with the target instance;
[0061] Determine whether the current amount of data in the target queue is less than or equal to the dequeue quantity threshold corresponding to the target instance;
[0062] If it is less than or equal to the dequeue quantity threshold, all current data in the target queue is taken out and sent to the target encryption accelerator;
[0063] If it is greater than the dequeue quantity threshold, the current data in the target queue is taken out according to the dequeue quantity threshold and sent to the target encryption accelerator;
[0064] Determine whether all queues associated with the target instance have been processed;
[0065] If the processing is not completed, the step of determining the target queue that has not been processed from the queues associated with the target instance to the step of determining whether all the queues associated with the target instance have been processed is re-executed.
[0066] Among them, the dequeue quantity thresholds corresponding to the 5G communication protocol stack PDCP layer signaling integrity calculation instance, the 5G communication protocol stack PDCP layer signaling integrity verification instance, the 4G communication protocol stack PDCP layer signaling integrity calculation instance, and the 4G communication protocol stack PDCP layer signaling integrity verification instance are all the first dequeue quantity thresholds, and the dequeue quantity thresholds corresponding to the 5G communication protocol stack packet data convergence protocol PDCP layer data encryption instance, the 5G communication protocol stack PDCP layer data decryption instance, the 5G communication protocol stack PDCP layer data integrity calculation instance, the 5G communication protocol stack PDCP layer data integrity verification instance, the 5G communication protocol stack IPSec encryption instance, the 5G communication protocol stack IPSec decryption instance, the 4G communication protocol stack PDCP layer data encryption instance, the 4G communication protocol stack PDCP layer data decryption instance, the 4G communication protocol stack PDCP layer data integrity calculation instance, and the 4G communication protocol stack PDCP layer data integrity verification instance are all the second dequeue quantity thresholds, and the first dequeue quantity threshold is less than the second dequeue quantity threshold.
[0067] Among them, this implementation method is to schedule each instance queue based on polling. Multiple instances can be pre-sorted in a certain order, and the instances can be processed in sequence according to the preset order. Because the throughput of the queues corresponding to different instances is different, such as the 5G communication protocol stack PDCP layer signaling integrity calculation instance, the 5G communication protocol stack PDCP layer signaling integrity verification instance, the 4G communication protocol stack PDCP layer signaling integrity calculation instance, and the 4G communication protocol stack PDCP layer signaling integrity verification instance, the data volume is very small, and the maximum threshold value for taking a packet from the queue each time is 2, that is, the first dequeue quantity threshold is set to 2, for example. Other examples, namely, the 5G communication protocol stack packet data convergence protocol PDCP layer data encryption example, the 5G communication protocol stack PDCP layer data decryption example, the 5G communication protocol stack PDCP layer data integrity calculation example, the 5G communication protocol stack PDCP layer data integrity verification example, the 5G communication protocol stack IPSec encryption example, the 5G communication protocol stack IPSec decryption example, the 4G communication protocol stack PDCP layer data encryption example, the 4G communication protocol stack PDCP layer data decryption example, the 4G communication protocol stack PDCP layer data integrity calculation example, the 4G communication protocol stack PDCP layer data integrity verification example, the maximum threshold value for taking a packet from the queue each time is 64, that is, the second dequeue quantity threshold is set to 64, for example, so the maximum amount of data taken out of the corresponding queues of different instances and sent to the accelerator at one time may be different. If the existing number in the queue is less than the corresponding dequeue quantity threshold, all of them are taken out and sent to the target encryption accelerator for processing. After the data of all queues associated with the current instance are dequeued, the dequeue processing of all queues of the next instance is performed and sent to the target encryption accelerator.
[0068] In another embodiment, step 15 may include:
[0069] For each instance, determining current priority information of the instance;
[0070] Determine the sorting information of the multiple instances according to the current priority information corresponding to the instance and the number of queues associated with the instance;
[0071] Process the instances in sequence according to the sorting information, and use the currently processed instance as the target instance until the current execution cycle ends;
[0072] When the target instance is an instance other than the 4G communication protocol stack IPSec encryption instance and the 4G communication protocol stack IPSec decryption instance, the data in the queue associated with the target instance is sent to the target encryption accelerator.
[0073] Figure 2 is a flowchart exemplarily illustrating a method for determining current priority information of an instance. Figure 2 As shown, it includes steps 21 to 23.
[0074] Step 21: Get the initial priority information of the instance.
[0075] Step 22: If the amount of data in the instance is greater than the first amount threshold, the current priority information of the instance is adjusted to a high priority.
[0076] Step 23: For a high-priority instance, if the number of queues associated with the instance decreases, the current priority information of the instance is adjusted to the initial priority information of the instance.
[0077] Among them, the initial priority information of the 5G communication protocol stack PDCP layer signaling integrity calculation instance, the 5G communication protocol stack PDCP layer signaling integrity verification instance, the 4G communication protocol stack PDCP layer signaling integrity calculation instance, and the 4G communication protocol stack PDCP layer signaling integrity verification instance are all low priority; the initial priority information of the 5G communication protocol stack Packet Data Convergence Protocol PDCP layer data encryption instance, the 5G communication protocol stack PDCP layer data decryption instance, the 5G communication protocol stack PDCP layer data integrity calculation instance, the 5G communication protocol stack PDCP layer data integrity verification instance, the 5G communication protocol stack IPSec encryption instance, the 5G communication protocol stack IPSec decryption instance, the 4G communication protocol stack PDCP layer data encryption instance, the 4G communication protocol stack PDCP layer data decryption instance, the 4G communication protocol stack PDCP layer data integrity calculation instance, the 4G communication protocol stack PDCP layer data integrity verification instance, the 4G communication protocol stack IPSec encryption instance, and the 4G communication protocol stack IPSec decryption instance are all medium priority.
[0078] Each instance corresponds to a priority level, for example, there are three priorities: high, low, and medium. Low priority is set for instances with low timing requirements, and medium priority is set by default for instances with high timing and throughput requirements. When the number of data carried in the queue corresponding to the instance increases and exceeds the first quantity threshold, such as 1024, in addition to the increase in the number of queues, its priority will also be automatically updated to high priority. Similarly, when the data carried in the queue decreases by more than a certain threshold, the number of queues will decrease and its priority will be adjusted to the initial priority information.
[0079] In this embodiment, for the queue scheduling method based on execution weight and cycle, the scheduling module first calculates the execution weight according to the current priority information of each instance and its queue number. The execution weight can be calculated by weighting the current priority information and its queue number, for example. Then, the instances are sorted from large to small according to the result of the execution weight. The execution cycle is the same as the time slot time configured for the entire protocol stack system, such as setting the execution cycle to 500us. In the configured execution cycle, the encryption module sequentially dequeues the data from the sorted instances and sends them to the target encryption accelerator for encryption or integrity protection. If at the end of the execution cycle, there are still data in the queue of the instance that is ranked later that has not been dequeued, the dequeuing of the instance queue data in this cycle is abandoned. And the calculation and sorting of the execution weight of the next cycle are continued. In the previous cycle, if the data in the instance queue is not dequeued from the queue, due to the entry of new data packets, after reaching a certain threshold, its priority or queue number will increase accordingly, and the calculated execution weight will also increase. It will be ranked higher in the new cycle, which means that the data in the queue of its instance will be sent to the target encryption accelerator first, thus ensuring the service quality of the entire protocol stack system.
[0080] Based on the same inventive concept, the present invention also provides an encryption device for a dual-mode communication system. Figure 3 is a block diagram of an encryption device for a dual-mode communication system, as shown in FIG. Figure 3 As shown, the device 30 may include:
[0081] Establishing module 31, for establishing multiple instances in response to receiving a startup instruction for a communication base station system, and setting the states of the multiple instances to an idle state, wherein the multiple instances include a 5G communication protocol stack packet data convergence protocol PDCP layer data encryption instance, a 5G communication protocol stack PDCP layer data decryption instance, a 5G communication protocol stack PDCP layer data integrity calculation instance, a 5G communication protocol stack PDCP layer data integrity verification instance, a 5G communication protocol stack PDCP layer signaling integrity calculation instance, a 5G communication protocol stack PDCP layer signaling integrity verification instance, a 5G communication protocol stack IPSec encryption instance, a 5G communication protocol stack IPSec decryption instance, a 4G communication protocol stack PDCP layer data encryption instance, a 4G communication protocol stack PDCP layer data decryption instance, a 4G communication protocol stack PDCP layer data integrity calculation instance, a 4G communication protocol stack PDCP layer data integrity verification instance, a 4G communication protocol stack PDCP layer signaling integrity calculation instance, a 4G communication protocol stack PDCP layer signaling integrity verification instance, a 4G communication protocol stack IPSec encryption instance, and a 4G communication protocol stack IPSec decryption instance;
[0082] A reading module 32, configured to, in response to receiving an instruction to turn on the encryption and decryption switch and the integrity protection switch in the communication base station system, read the configuration files of the multiple instances respectively, and change the states of the multiple instances from an idle state to an execution state;
[0083] An association module 33, configured to create, for each of the instances, an initial queue corresponding to the instance, and associate the instance with the corresponding initial queue;
[0084] The adjustment module 34 is used to queue the data of the instances other than the 4G communication protocol stack IPSec encryption instance and the 4G communication protocol stack IPSec decryption instance into the corresponding initial queue in real time, and adjust the associated queue according to the amount of data of the instance;
[0085] The determination module 35 is used to determine the target instance to be processed currently. If the target instance is an instance other than the 4G communication protocol stack IPSec encryption instance and the 4G communication protocol stack IPSec decryption instance, the data in the queue associated with the target instance is sent to the target encryption accelerator, so that the target encryption accelerator encrypts the data in the queue associated with the target instance.
[0086] Optionally, the adjustment module 34 includes:
[0087] An enqueue submodule, used to enqueue the data of the instance into a currently designated queue in real time, wherein the currently designated queue is initially the initial queue;
[0088] A first judgment submodule, used to judge whether the amount of data in the current designated queue reaches a first amount threshold;
[0089] a creation submodule, configured to, when the first quantity threshold is reached, create another queue corresponding to the instance, associate the another queue with the instance, and use the another queue as a new current designated queue, triggering the queue entry submodule to re-execute the process of enqueuing the data of the instance to the current designated queue in real time until the first judgment submodule judges whether the quantity of data in the current designated queue reaches the first quantity threshold;
[0090] A second judgment submodule is used to judge whether the amount of data in the current designated queue is less than a second amount threshold when the data enqueue of the instance is completed, wherein the second amount threshold is less than the first amount threshold;
[0091] A third judgment submodule is configured to judge whether there are other queues associated with the instance that meet the preset conditions if the number is less than the second number threshold; if so, store the data in the currently specified queue in the other queues, release the association between the instance and the currently specified queue, and delete the currently specified queue, wherein the preset conditions include that the number of data in the queue is less than the difference between the first number threshold and the number of data in the currently specified queue.
[0092] Optionally, the determining module 35 includes:
[0093] A first determination submodule is configured to determine the target instance from the multiple instances in a preset order until the multiple instances have been processed, wherein, when the target instance is an instance other than the 4G communication protocol stack IPSec encryption instance and the 4G communication protocol stack IPSec decryption instance, the target instance is processed by the following modules:
[0094] A second determining submodule is used to determine an unprocessed target queue from the queues associated with the target instance;
[0095] The third determination submodule is used to determine whether the amount of current data in the target queue is less than or equal to the dequeue quantity threshold corresponding to the target instance, wherein the 5G communication protocol stack PDCP layer signaling integrity calculation instance, the 5G communication protocol stack PDCP layer signaling integrity verification instance, the 4G communication protocol stack PDCP layer signaling integrity calculation instance, and the dequeue quantity threshold corresponding to the 4G communication protocol stack PDCP layer signaling integrity verification instance are all the first dequeue quantity threshold, the 5G communication protocol stack packet data convergence protocol PDCP layer data encryption instance, the 5G communication protocol stack PDCP layer data decryption instance, and the The dequeue quantity thresholds corresponding to the 5G communication protocol stack PDCP layer data integrity calculation instance, the 5G communication protocol stack PDCP layer data integrity verification instance, the 5G communication protocol stack IPSec encryption instance, the 5G communication protocol stack IPSec decryption instance, the 4G communication protocol stack PDCP layer data encryption instance, the 4G communication protocol stack PDCP layer data decryption instance, the 4G communication protocol stack PDCP layer data integrity calculation instance, and the 4G communication protocol stack PDCP layer data integrity verification instance are all the second dequeue quantity threshold, and the first dequeue quantity threshold is less than the second dequeue quantity threshold;
[0096] A first sending submodule, configured to take out all current data in the target queue and send them to the target encryption accelerator if the number of data is less than or equal to the dequeue quantity threshold;
[0097] A second sending submodule, configured to fetch the current data in the target queue according to the dequeue quantity threshold and send the data to the target encryption accelerator if the current data is greater than the dequeue quantity threshold;
[0098] The fourth judgment submodule is used to judge whether all queues associated with the target instance have been processed;
[0099] The triggering submodule is used to trigger the second determining submodule to re-execute the process of determining the target queue that has not been processed from the queues associated with the target instance to the fourth judging submodule to judge whether all the queues associated with the target instance have been processed if the process has not been completed.
[0100] Optionally, the determining module 35 includes:
[0101] A fourth determination submodule, configured to determine, for each of the instances, current priority information of the instance;
[0102] a fifth determining submodule, configured to determine the sorting information of the multiple instances according to the current priority information corresponding to the instance and the number of queues associated with the instance;
[0103] A processing submodule, configured to process the instances in sequence according to the sorting information, and use the instance currently being processed as the target instance until the current execution cycle ends;
[0104] The third sending submodule is used to send the data in the queue associated with the target instance to the target encryption accelerator when the target instance is an instance other than the 4G communication protocol stack IPSec encryption instance and the 4G communication protocol stack IPSec decryption instance.
[0105] Optionally, the fourth determining submodule includes:
[0106] an acquisition submodule, used to acquire the initial priority information of the instance, wherein the initial priority information of the 5G communication protocol stack PDCP layer signaling integrity calculation instance, the 5G communication protocol stack PDCP layer signaling integrity verification instance, the 4G communication protocol stack PDCP layer signaling integrity calculation instance, and the 4G communication protocol stack PDCP layer signaling integrity verification instance are all low priority, and the initial priority information of the 5G communication protocol stack packet data convergence protocol PDCP layer data encryption instance, the 5G communication protocol stack PDCP layer data decryption instance, the 5G communication protocol stack PDCP layer data integrity calculation instance, the 5G communication protocol stack PDCP layer data integrity verification instance, the 5G communication protocol stack IPSec encryption instance, the 5G communication protocol stack IPSec decryption instance, the 4G communication protocol stack PDCP layer data encryption instance, the 4G communication protocol stack PDCP layer data decryption instance, the 4G communication protocol stack PDCP layer data integrity calculation instance, the 4G communication protocol stack PDCP layer data integrity verification instance, the 4G communication protocol stack IPSec encryption instance, and the 4G communication protocol stack IPSec decryption instance are all medium priority;
[0107] A first adjustment submodule, configured to adjust the current priority information of the instance to a high priority if the amount of data in the instance is greater than a first amount threshold;
[0108] The second adjustment submodule is used to adjust the current priority information of a high-priority instance to the initial priority information of the instance if the number of queues associated with the instance decreases.
[0109] Optionally, the device 30 further includes:
[0110] A sending module is used to send the data of the target instance to the base station kernel if the target instance is the 4G communication protocol stack IPSec encryption instance or the 4G communication protocol stack IPSec decryption instance, so that the base station kernel encrypts the data of the target instance.
[0111] Optionally, the target encryption accelerator is determined by the following modules:
[0112] A first accelerator determination module, configured to use an encryption accelerator as the target encryption accelerator when an encryption accelerator is provided in the base station;
[0113] A second accelerator determination module is used for, in the case where a PDCP encryption accelerator and an IPSec encryption accelerator are provided in the base station, if the target instance is one of the following, then the PDCP encryption accelerator is used as the target encryption accelerator: the 5G communication protocol stack packet data convergence protocol PDCP layer data encryption instance, the 5G communication protocol stack PDCP layer data decryption instance, the 5G communication protocol stack PDCP layer data integrity calculation instance, the 5G communication protocol stack PDCP layer data integrity verification instance, the 5G communication protocol stack PDCP layer signaling integrity calculation instance, the 5G communication protocol stack PDCP layer signaling integrity verification instance, the 4G communication protocol stack PDCP layer data encryption instance, the 4G communication protocol stack PDCP layer data decryption instance, the 4G communication protocol stack PDCP layer data integrity calculation instance, the 4G communication protocol stack PDCP layer data integrity verification instance, the 4G communication protocol stack PDCP layer signaling integrity calculation instance, the 4G communication protocol stack PDCP layer signaling integrity verification instance;
[0114] The third accelerator determination module is used to use the IPSec encryption accelerator as the target encryption accelerator if the target instance is one of the following: the 5G communication protocol stack IPSec encryption instance, the 5G communication protocol stack IPSec decryption instance.
[0115] The present invention also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the encryption method for the dual-mode communication system provided by any embodiment of the present invention are implemented.
[0116] The present invention also provides an electronic device, comprising:
[0117] a memory having a computer program stored thereon;
[0118] The processor is used to execute the computer program in the memory to implement the steps of the encryption method of the dual-mode communication system provided in any embodiment of the present invention.
[0119] It should be noted that: the encryption device of the dual-mode communication system provided in the above embodiment only uses the division of the above functional modules as an example when performing encryption of the dual-mode communication system. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the encryption device of the dual-mode communication system provided in the above embodiment and the encryption method embodiment of the dual-mode communication system belong to the same concept. The specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0120] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0121] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0122] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. An encryption method for a dual-mode communication system, characterized in that: The method comprises: In response to receiving a startup instruction for a communication base station system, multiple instances are established, and the states of the multiple instances are all set to an idle state, wherein the multiple instances include a 5G communication protocol stack packet data convergence protocol PDCP layer data encryption instance, a 5G communication protocol stack PDCP layer data decryption instance, a 5G communication protocol stack PDCP layer data integrity calculation instance, a 5G communication protocol stack PDCP layer data integrity verification instance, a 5G communication protocol stack PDCP layer signaling integrity calculation instance, a 5G communication protocol stack PDCP layer signaling integrity verification instance, a 5G communication protocol stack IPSec encryption instance, a 5G communication protocol stack IPSec decryption instance, a 4G communication protocol stack PDCP layer data encryption instance, a 4G communication protocol stack PDCP layer data decryption instance, a 4G communication protocol stack PDCP layer data integrity calculation instance, a 4G communication protocol stack PDCP layer data integrity verification instance, a 4G communication protocol stack PDCP layer signaling integrity calculation instance, a 4G communication protocol stack PDCP layer signaling integrity verification instance, a 4G communication protocol stack IPSec encryption instance, and a 4G communication protocol stack IPSec decryption instance; In response to receiving an instruction to turn on the encryption and decryption switch and the integrity protection switch in the communication base station system, reading configuration files of the multiple instances respectively, and changing the states of the multiple instances from an idle state to an execution state; For each of the instances, create an initial queue corresponding to the instance, and associate the instance with the corresponding initial queue; For instances other than the 4G communication protocol stack IPSec encryption instance and the 4G communication protocol stack IPSec decryption instance, enqueue the data of the instance into the corresponding initial queue in real time, and adjust the associated queue according to the amount of data of the instance; Determine the target instance to be processed currently. If the target instance is an instance other than the 4G communication protocol stack IPSec encryption instance and the 4G communication protocol stack IPSec decryption instance, send the data in the queue associated with the target instance to the target encryption accelerator, so that the target encryption accelerator encrypts the data in the queue associated with the target instance.
2. The method according to claim 1, characterized in that The step of enqueuing the data of the instance into the corresponding initial queue in real time and adjusting the associated queue according to the amount of the data of the instance includes: Enqueue the data of the instance into a currently designated queue in real time, wherein the currently designated queue is initially the initial queue; Determine whether the amount of data in the currently specified queue reaches a first amount threshold; When the first quantity threshold is reached, another queue corresponding to the instance is created, the another queue is associated with the instance, the another queue is used as a new current designated queue, and the step of enqueuing the data of the instance into the current designated queue in real time to the step of determining whether the amount of data in the current designated queue reaches the first quantity threshold is re-executed; When the data of the instance is completed in the queue, determining whether the amount of data in the current designated queue is less than a second amount threshold, wherein the second amount threshold is less than the first amount threshold; If it is less than the second quantity threshold, determine whether there are other queues associated with the instance that meet the preset conditions; if so, store the data in the currently specified queue in the other queues, release the association between the instance and the currently specified queue, and delete the currently specified queue, wherein the preset conditions include that the amount of data in the queue is less than the difference between the first quantity threshold and the amount of data in the currently specified queue.
3. The method according to claim 1, characterized in that The determining of the target instance to be processed currently, if the target instance is an instance other than the 4G communication protocol stack IPSec encryption instance and the 4G communication protocol stack IPSec decryption instance, sending the data in the queue associated with the target instance to the target encryption accelerator, includes: Determine the target instance from the multiple instances in a preset order until the multiple instances have been processed, wherein, when the target instance is an instance other than the 4G communication protocol stack IPSec encryption instance and the 4G communication protocol stack IPSec decryption instance, perform the following steps for the target instance: Determine a target queue that has not been processed from queues associated with the target instance; Determine whether the amount of current data in the target queue is less than or equal to the dequeue quantity threshold corresponding to the target instance, wherein the 5G communication protocol stack PDCP layer signaling integrity calculation instance, the 5G communication protocol stack PDCP layer signaling integrity verification instance, the 4G communication protocol stack PDCP layer signaling integrity calculation instance, and the dequeue quantity threshold corresponding to the 4G communication protocol stack PDCP layer signaling integrity verification instance are all first dequeue quantity thresholds, the 5G communication protocol stack packet data convergence protocol PDCP layer data encryption instance, the 5G communication protocol stack PDCP layer data decryption instance, and the 5G communication The dequeue quantity thresholds corresponding to the protocol stack PDCP layer data integrity calculation instance, the 5G communication protocol stack PDCP layer data integrity verification instance, the 5G communication protocol stack IPSec encryption instance, the 5G communication protocol stack IPSec decryption instance, the 4G communication protocol stack PDCP layer data encryption instance, the 4G communication protocol stack PDCP layer data decryption instance, the 4G communication protocol stack PDCP layer data integrity calculation instance, and the 4G communication protocol stack PDCP layer data integrity verification instance are all the second dequeue quantity threshold, and the first dequeue quantity threshold is less than the second dequeue quantity threshold; If it is less than or equal to the dequeue quantity threshold, all current data in the target queue is taken out and sent to the target encryption accelerator; If it is greater than the dequeue quantity threshold, taking out the current data in the target queue according to the dequeue quantity threshold and sending it to the target encryption accelerator; Determine whether all queues associated with the target instance have been processed; If the processing is not completed, the step of determining the target queue that has not been processed from the queues associated with the target instance to the step of determining whether all the queues associated with the target instance have been processed are re-executed.
4. The method according to claim 1, characterized in that: The determining of the target instance to be processed currently, if the target instance is an instance other than the 4G communication protocol stack IPSec encryption instance and the 4G communication protocol stack IPSec decryption instance, sending the data in the queue associated with the target instance to the target encryption accelerator, includes: For each of the instances, determining current priority information of the instance; Determining sorting information of the multiple instances according to current priority information corresponding to the instance and the number of queues associated with the instance; Processing the instances in sequence according to the sorting information, and taking the currently processed instance as the target instance until the current execution cycle ends; In the case where the target instance is an instance other than the 4G communication protocol stack IPSec encryption instance and the 4G communication protocol stack IPSec decryption instance, the data in the queue associated with the target instance is sent to the target encryption accelerator.
5. The method according to claim 4, characterized in that The determining of the current priority information of the instance includes: Obtaining initial priority information of the instance, wherein the initial priority information of the 5G communication protocol stack PDCP layer signaling integrity calculation instance, the 5G communication protocol stack PDCP layer signaling integrity verification instance, the 4G communication protocol stack PDCP layer signaling integrity calculation instance, and the 4G communication protocol stack PDCP layer signaling integrity verification instance are all low priority, and the initial priority information of the 5G communication protocol stack Packet Data Convergence Protocol PDCP layer data encryption instance, the 5G communication protocol stack PDCP layer data decryption instance, the 5G communication protocol stack PDCP layer data integrity calculation instance, the 5G communication protocol stack PDCP layer data integrity verification instance, the 5G communication protocol stack IPSec encryption instance, the 5G communication protocol stack IPSec decryption instance, the 4G communication protocol stack PDCP layer data encryption instance, the 4G communication protocol stack PDCP layer data decryption instance, the 4G communication protocol stack PDCP layer data integrity calculation instance, the 4G communication protocol stack PDCP layer data integrity verification instance, the 4G communication protocol stack IPSec encryption instance, and the 4G communication protocol stack IPSec decryption instance are all medium priority; If the amount of data in the instance is greater than a first amount threshold, adjusting the current priority information of the instance to a high priority; For a high-priority instance, if the number of queues associated with the instance decreases, the current priority information of the instance is adjusted to the initial priority information of the instance.
6. The method according to claim 1, characterized in that The method further comprises: If the target instance is the 4G communication protocol stack IPSec encryption instance or the 4G communication protocol stack IPSec decryption instance, the data of the target instance is sent to the base station kernel, so that the base station kernel encrypts the data of the target instance.
7. The method according to claim 1, characterized in that The target encryption accelerator is determined by: In the case where an encryption accelerator is provided in the base station, the encryption accelerator is used as the target encryption accelerator; In the case where a PDCP encryption accelerator and an IPSec encryption accelerator are provided in the base station, if the target instance is one of the following, the PDCP encryption accelerator is used as the target encryption accelerator: the 5G communication protocol stack packet data convergence protocol PDCP layer data encryption instance, the 5G communication protocol stack PDCP layer data decryption instance, the 5G communication protocol stack PDCP layer data integrity calculation instance, the 5G communication protocol stack PDCP layer data integrity verification instance, the 5G communication protocol stack PDCP layer signaling integrity calculation instance, the 5G communication protocol stack PDCP layer signaling integrity verification instance, the 4G communication protocol stack PDCP layer data encryption instance, the 4G communication protocol stack PDCP layer data decryption instance, the 4G communication protocol stack PDCP layer data integrity calculation instance, the 4G communication protocol stack PDCP layer data integrity verification instance, the 4G communication protocol stack PDCP layer signaling integrity calculation instance, the 4G communication protocol stack PDCP layer signaling integrity verification instance; If the target instance is one of the following, the IPSec encryption accelerator is used as the target encryption accelerator: the 5G communication protocol stack IPSec encryption instance, the 5G communication protocol stack IPSec decryption instance.
8. An encryption device for a dual-mode communication system, characterized in that: The device comprises: An establishment module, configured to establish multiple instances in response to receiving a startup instruction for a communication base station system, and set the states of the multiple instances to an idle state, wherein the multiple instances include a 5G communication protocol stack packet data convergence protocol PDCP layer data encryption instance, a 5G communication protocol stack PDCP layer data decryption instance, a 5G communication protocol stack PDCP layer data integrity calculation instance, a 5G communication protocol stack PDCP layer data integrity verification instance, a 5G communication protocol stack PDCP layer signaling integrity calculation instance, a 5G communication protocol stack PDCP layer signaling integrity verification instance, a 5G communication protocol stack IPSec encryption instance, a 5G communication protocol stack IPSec decryption instance, a 4G communication protocol stack PDCP layer data encryption instance, a 4G communication protocol stack PDCP layer data decryption instance, a 4G communication protocol stack PDCP layer data integrity calculation instance, a 4G communication protocol stack PDCP layer data integrity verification instance, a 4G communication protocol stack PDCP layer signaling integrity calculation instance, a 4G communication protocol stack PDCP layer signaling integrity verification instance, a 4G communication protocol stack IPSec encryption instance, and a 4G communication protocol stack IPSec decryption instance; a reading module, configured to, in response to receiving an instruction to turn on the encryption and decryption switch and the integrity protection switch in the communication base station system, read the configuration files of the multiple instances respectively, and change the states of the multiple instances from an idle state to an execution state; An associating module, used for creating an initial queue corresponding to each instance, and associating the instance with the corresponding initial queue; An adjustment module, for enqueuing data of instances other than the 4G communication protocol stack IPSec encryption instance and the 4G communication protocol stack IPSec decryption instance into the corresponding initial queue in real time, and adjusting the associated queue according to the amount of data of the instance; A determination module is used to determine the target instance to be processed currently. If the target instance is an instance other than the 4G communication protocol stack IPSec encryption instance and the 4G communication protocol stack IPSec decryption instance, the data in the queue associated with the target instance is sent to the target encryption accelerator, so that the target encryption accelerator encrypts the data in the queue associated with the target instance.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method described in any one of claims 1 to 7 are implemented.
10. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the method according to any one of claims 1 to 7.
