Data transmission method, device, electronic device and computer readable storage medium

By preprocessing the first type of data packet before receiving the uplink authorization instruction, and grouping the two types of data packets after receiving the uplink authorization instruction, transmitting them to the physical layer, the problem of excessive CPU load caused by traditional data transmission methods is solved, and the effect of reducing CPU load and improving data transmission efficiency is achieved.

CN114666836BActive Publication Date: 2025-04-04GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210232561.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-09
Publication Date
2025-04-04
Estimated Expiration
2042-03-09

AI Technical Summary

Technical Problem

Traditional data transmission methods lead to excessive CPU load, affecting the performance of electronic devices.

Method used

By receiving the first and second types of data packets sent by the application layer, the first type of data packets are preprocessed before receiving the uplink authorization instruction, and after receiving the uplink authorization instruction, the two types of data packets are grouped and transmitted to the physical layer.

Benefits of technology

It reduces the CPU load, improves data transmission efficiency, and avoids problems such as heating and lag in electronic devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114666836B_ABST
    Figure CN114666836B_ABST
Patent Text Reader

Abstract

The present application relates to a data transmission method and device, an electronic device, and a computer-readable storage medium, the method comprising: receiving a first-class data packet and a second-class data packet sent by an application layer; the data volume of the first-class data packet is less than the data volume of the second-class data packet. Before receiving an uplink authorization instruction, the first-class data packet is preprocessed to obtain a preprocessed first-class data packet; after receiving the uplink authorization instruction, the preprocessed first-class data packet is packaged to obtain a first-class target data packet, and the second-class data packet is processed and packaged to obtain a second-class target data packet. The first-class target data packet and the second-class target data packet are transmitted to the physical layer. For the first-class data packets and the second-class data packets with different data volumes, different data processing methods are used for preprocessing and packaging to generate the first-class target data packet and the second-class target data packet, which can reduce the CPU load to a certain extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a data transmission method, device, electronic device and computer-readable storage medium. Background Art

[0002] With the rapid development of Internet technology and mobile communication technology, electronic devices can provide users with more diverse business services. And with the emergence of various services, the amount of business data that electronic devices need to process has also shown explosive growth. Massive business data has put forward higher requirements on the data transmission efficiency of electronic devices.

[0003] When using traditional data transmission methods to transmit business data, there is a problem of excessive CPU load, which seriously affects the performance of electronic equipment. Summary of the invention

[0004] The embodiments of the present application provide a data transmission method, device, electronic device, and computer-readable storage medium, which can reduce the CPU load to a certain extent.

[0005] In one aspect, a data transmission method is provided, comprising:

[0006] receiving a first-category data packet and a second-category data packet sent by an application layer; the data volume of the first-category data packet is smaller than the data volume of the second-category data packet;

[0007] Before receiving the uplink authorization instruction, preprocessing the first category data packet to obtain a preprocessed first category data packet; after receiving the uplink authorization instruction, assembling the preprocessed first category data packet to obtain a first category target data packet, and processing and assembling the second category data packet to obtain a second category target data packet;

[0008] The first-category target data packets and the second-category target data packets are transmitted to a physical layer.

[0009] In another aspect, a data transmission device is provided, comprising:

[0010] A data receiving module, used for receiving a first type of data packet and a second type of data packet sent by an application layer; the data volume of the first type of data packet is smaller than the data volume of the second type of data packet;

[0011] A data processing module, configured to pre-process the first category data packets before receiving an uplink authorization instruction to obtain a pre-processed first category data packet; after receiving the uplink authorization instruction, assemble the pre-processed first category data packets to obtain a first category target data packet, and process and assemble the second category data packets to obtain a second category target data packet;

[0012] A data transmission module is used to transmit the first-category target data packets and the second-category target data packets to the physical layer.

[0013] On the other hand, an electronic device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the focus control method as described above.

[0014] On the other hand, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method described above are implemented.

[0015] In another aspect, a computer program product is provided, comprising a computer program, which implements the steps of the method described above when executed by a processor.

[0016] The above-mentioned data transmission method and device, electronic device, and computer-readable storage medium receive the first-class data packet and the second-class data packet sent by the application layer; the data volume of the first-class data packet is less than the data volume of the second-class data packet. Before receiving the uplink authorization instruction, the first-class data packet is preprocessed to obtain the preprocessed first-class data packet; after receiving the uplink authorization instruction, the preprocessed first-class data packet is packaged to obtain the first-class target data packet, and the second-class data packet is processed and packaged to obtain the second-class target data packet. The first-class target data packet and the second-class target data packet are transmitted to the physical layer.

[0017] The first type of data packet is preprocessed before receiving the uplink authorization instruction, that is, the operation of preprocessing the first type of data packet is performed in advance before receiving the uplink authorization instruction. Obviously, it can greatly reduce the CPU load after receiving the uplink authorization instruction. For the second type of data packet, after receiving the uplink authorization instruction, one or more second type of data packets are preprocessed and packaged to obtain the second type of target data packet. Since the second type of data packet has a large amount of data, and it is not necessary to process and package the second type of data packet before receiving the uplink authorization instruction, it is not necessary to store the second type of data packet with a large amount of data at one time. Therefore, the CPU load can be reduced to a certain extent.

[0018] In summary, for the first-category data packets and the second-category data packets with different data volumes, different data processing methods are used for preprocessing and packet assembly to generate the first-category target data packets and the second-category target data packets, which can reduce the CPU load to a certain extent. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0020] Figure 1 is an application environment diagram of a data transmission method in an embodiment;

[0021] Figure 2 is a flow chart of a traditional data transmission method;

[0022] Figure 3 is a flow chart of another conventional data transmission method;

[0023] Figure 4 is a flow chart of a data transmission method in one embodiment;

[0024] Figure 5 A flowchart of a method for performing packet data convergence protocol sequence number processing and encryption processing on a first-category data packet to obtain a pre-processed first-category data packet in an embodiment;

[0025] Figure 6 for Figure 5 A flowchart of a method for adding a packet data convergence protocol sequence number to a first type of data packet at a PDCP layer to obtain a first type of initial data packet;

[0026] Figure 7 A flowchart of a method for processing and grouping second-category data packets to obtain second-category target data packets in one embodiment;

[0027] Figure 8 A flowchart of a method for transmitting a first-category target data packet and a second-category target data packet to a physical layer in order of priority from high to low in one embodiment;

[0028] Fig. 9 for Figure 8 A flowchart of a method for transmitting a first number of first-category target data packets and a second number of second-category target data packets to a physical layer in a transmission cycle in descending order of priority;

[0029] Fig.10 A schematic diagram of a data transmission method in a specific embodiment;

[0030] Fig.11 is a structural block diagram of a data transmission device in one embodiment;

[0031] Fig.12 for Fig.11 The structural block diagram of the data processing module;

[0032] Fig.13 for Fig.11 The structural block diagram of the data processing module;

[0033] Fig.14 FIG. 1 is a schematic diagram of the internal structure of an electronic device in an embodiment. DETAILED DESCRIPTION

[0034] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0035] It is understood that the terms "first", "second", etc. used in this application may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish a first element from another element. For example, without departing from the scope of this application, a first type of data packet may be referred to as a second type of data packet, and similarly, a second type of data packet may be referred to as a first type of data packet. Both the first type of data packet and the second type of data packet are a type of data packet, but they are not the same type of data packets.

[0036] Figure 1 FIG. 1 is a schematic diagram of an application environment of a data transmission method in an embodiment. Figure 1As shown, the application environment includes an electronic device 120 and a network device 140, and the electronic device 120 and the network device 140 are connected via a network. Among them, the electronic device 120 can receive the first type of data packet and the second type of data packet sent by the application layer; the data volume of the first type of data packet is less than the data volume of the second type of data packet. Before receiving the uplink authorization instruction, the first type of data packet is preprocessed to obtain the preprocessed first type of data packet; after receiving the uplink authorization instruction, the preprocessed first type of data packet is packaged to obtain the first type of target data packet, and the second type of data packet is processed and packaged to obtain the second type of target data packet. The first type of target data packet and the second type of target data packet are transmitted to the physical layer. Then, the physical layer transmits it to the antenna of the electronic device, and the antenna transmits it to the network device 140. Among them, the electronic device 120 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. Among them, network devices are physical entities connected to the network, and there are many types of network devices. Basic network devices include: computers (can be personal computers or servers), hubs, switches, bridges, routers, gateways, network interface cards (NICs), wireless access points (WAPs), printers and modems, fiber optic transceivers, optical cables, etc.

[0037] With the rapid development of Internet technology and mobile communication technology, electronic devices can provide users with more abundant and diverse business services. And with the emergence of various services, the amount of business data that electronic devices need to process has also shown explosive growth. In order to adapt to the transmission of massive business data, higher requirements are placed on the data transmission rate in both the uplink and downlink. For example, in the uplink, that is, in the process of electronic devices transmitting data to network devices, higher requirements are placed on the transmission rate of electronic devices so that data can be transmitted to network devices in a timely manner.

[0038] One of the traditional data transmission methods, such as Figure 2As shown, in the uplink, the application layer 220 sends the data packet to the data link layer 240. The data link layer 240 generally needs to perform a series of data processing and packet assembly on the service data packet after the uplink authorization instruction arrives, and then sends the assembled data packet to the physical layer 260, and then the physical layer 260 sends it to the antenna of the electronic device, and then the antenna of the electronic device sends the data packet to the network device (such as a base station, etc.). Specifically, the data link layer 240 includes a packet data convergence protocol PDCP layer, a radio link control layer protocol (RadioLink Control, RLC) layer, and a medium access control layer (Medium Access Control, MAC) layer. Among them, the packet assembly process includes: adding header data based on the PDCP protocol to each data packet at the PDCP layer, and then transmitting the data packet with the header data of the PDCP protocol added to the RLC layer. At the RLC layer, the data packet with the header data of the PDCP protocol added continues to add header data based on the RLC protocol, and then transmits the data packet with the header data of the RLC protocol added to the MAC layer. The MAC layer adds header data based on the MAC protocol to the data packet to which the header data of the RLC protocol is added. Then, the data packet to be encrypted is encrypted at the MAC layer, and the encrypted data packet and the data packet that does not need to be encrypted are transmitted to the physical layer 260 by means of memory copy.

[0039] However, because a series of data processing and packetization can only be started for the service data packet after the uplink authorization instruction arrives, but the time period between the uplink authorization instruction arrival time and the uplink authorization sending time is very short, so here it is necessary to complete a series of data processing and packetization for the service data packet in a very short time period (the time period between the uplink authorization instruction arrival time and the uplink authorization sending time), and then start data transmission at the uplink authorization sending time. Obviously, this will seriously increase the CPU load of the electronic device, causing the electronic device to heat up seriously or even freeze. Among them, the uplink authorization sending time here refers to the time specified in the protocol to start the uplink business data transmission after the uplink authorization instruction arrives. For example, the protocol specifies that the uplink business data transmission starts 0.2ms after the uplink authorization instruction arrives. Then, the time period between the uplink authorization instruction arrival time and the uplink authorization sending time is 0.2ms.

[0040] Another traditional data transmission method, such as Figure 3As shown, in the uplink, the application layer 220 sends the data packet to the data link layer 240. The data link layer 240 generally needs to perform a series of data processing and encryption on the service data packet before the uplink authorization instruction arrives. Then, after the uplink authorization instruction arrives, the encrypted data packet is assembled and the assembled data packet is sent to the physical layer 260, which is then sent to the antenna of the electronic device by the physical layer 260, and then the antenna of the electronic device sends the data packet to the network device (such as a base station, etc.). Specifically, the data link layer 240 includes a packet data convergence protocol PDCP layer, a radio link control layer protocol (Radio Link Control, RLC) layer, and a medium access control layer (Medium Access Control, MAC) layer. Among them, the specific process of packet assembly is the same as above and will not be repeated here.

[0041] In order to solve the problem that traditional data transmission methods will seriously increase the CPU load of electronic devices, causing serious heating of electronic devices and even freezing, a new data transmission method is proposed in the embodiment of the present application to solve this problem. Figure 4 FIG. 1 is a flow chart of a data transmission method in an embodiment. The data transmission method in this embodiment is based on running Figure 1 The electronic device in the example is used to describe. Figure 4 As shown, the data transmission method includes steps 420 to 460, wherein:

[0042] Step 420, receiving a first-category data packet and a second-category data packet sent by the application layer; the data volume of the first-category data packet is smaller than the data volume of the second-category data packet.

[0043] In the uplink, the electronic device may be in the TCP / IP layer, dividing the service data packets into the first category data packets and the second category data packets according to the data volume. Then, the first category data packets and the second category data packets are sent to the application layer through the TCP / IP layer, and then the application layer sends the first category data packets and the second category data packets to the data link layer through different data streams. The electronic device receives the first category data packets and the second category data packets sent by the application layer through different data streams at the data link layer. Specifically, the first category data packets may be sent from the application layer to the data link layer through one data stream, and the second category data packets may be sent from the application layer to the data link layer through another data stream. The data link layer may identify the received data packets as the first category data packets and the second category data packets through the identifiers of different data streams.

[0044] Among them, the data volume of the first type of data packet is less than the data volume of the second type of data packet, and both the first type of data packet and the second type of data packet are business data packets. The business data packet here refers to a data packet generated in the application layer of the electronic device and needs to be transmitted to the network device. For example, the business data packet includes business data generated by various applications and various services in the application layer. Of course, this is not limited in this application. The first type of data packet includes at least one of a message arrival confirmation packet based on the transmission control protocol TCP (Transmission Control Protocol), a data packet based on the control message protocol ICMP (Internet Control Message Protocol), a data packet based on the rohc protocol, and a data packet based on the urllc protocol. The second type of data packet includes at least one of a data packet based on the user datagram protocol UDP (User Datagram Protocol) and a data packet based on the transmission control protocol TCP excluding the message arrival confirmation packet. This application does not limit the first type of data packet and the second type of data packet.

[0045] Step 440, before receiving the uplink authorization instruction, preprocess the first category data packets to obtain preprocessed first category data packets; after receiving the uplink authorization instruction, assemble the preprocessed first category data packets to obtain first category target data packets, and process and assemble the second category data packets to obtain second category target data packets.

[0046] After receiving the first-class data packet and the second-class data packet, and before receiving the uplink authorization instruction, the data link layer preprocesses the first-class data packet to obtain the preprocessed first-class data packet. At this time, the second-class data packet is not preprocessed. Then, wait for the uplink authorization instruction to arrive, and after receiving the uplink authorization instruction, assemble one or more preprocessed first-class data packets to obtain the first-class target data packet, and process and assemble the second-class data packet to obtain the second-class target data packet. The preprocessed first-class data packet is assembled to obtain the first-class target data packet, and one or more second-class data packets are preprocessed and assembled together to obtain the second-class target data packet. Here, the first-class data packet and the second-class data packet can be processed synchronously or asynchronously, and this application does not limit this.

[0047] In other words, after receiving the first-class data packets and the second-class data packets, the data link layer starts to preprocess the first-class data packets before receiving the uplink authorization instruction, and obtains the preprocessed first-class data packets. Then, the data link layer waits for the uplink authorization instruction to arrive, and after receiving the uplink authorization instruction, it assembles one or more preprocessed first-class data packets to obtain the first-class target data packets. For the second-class data packets, before receiving the uplink authorization instruction, the second-class data packets are not preprocessed. Instead, it waits for the uplink authorization instruction to arrive, and after receiving the uplink authorization instruction, it preprocesses and assembles one or more second-class data packets to obtain the second-class target data packets.

[0048] Among them, preprocessing includes adding identification to the data packet, encrypting, removing invalid data packets, removing duplicate data packets, etc., of course, this application does not limit this. Packet assembly refers to the process of cascading or segmenting multiple data packets based on the authorization size carried in the uplink authorization instruction.

[0049] Step 460: Transmit the first type of target data packets and the second type of target data packets to the physical layer.

[0050] The electronic device transmits the first-class target data packet obtained by grouping one or more preprocessed first-class data packets and the second-class target data packet obtained by preprocessing and grouping one or more second-class data packets to the physical layer through the data link layer. Finally, the physical layer transmits it to the antenna of the electronic device, and then transmits it to the network device (such as a base station) by the antenna.

[0051] In an embodiment of the present application, an electronic device receives a first class data packet and a second class data packet sent by an application layer. For the first class data packet, before receiving the uplink authorization instruction, the first class data packet is preprocessed to obtain a preprocessed first class data packet. At this time, it is necessary to store the newly generated preprocessed first class data packet. Then, after receiving the uplink authorization instruction, one or more preprocessed first class data packets are grouped to obtain a first class target data packet. Since the data volume of the first class data packet is small, storing the newly generated preprocessed first class data packet will not significantly increase the load on the electronic device CPU. However, the first class data packet is preprocessed before receiving the uplink authorization instruction, that is, the operation of preprocessing the first class data packet is performed in advance before receiving the uplink authorization instruction. Obviously, it can significantly reduce the CPU load after receiving the uplink authorization instruction.

[0052] For the second type of data packets, after receiving the uplink authorization instruction, one or more second type of data packets are pre-processed and grouped together to obtain the second type of target data packets. Since the second type of data packets have a large amount of data, and before receiving the uplink authorization instruction, the second type of data packets do not need to be processed and grouped, so there is no need to store the second type of data packets with a large amount of data at one time, so the CPU load can be reduced to a certain extent.

[0053] In summary, for the first-category data packets and the second-category data packets with different data volumes, different data processing methods are used for preprocessing and packet assembly to generate the first-category target data packets and the second-category target data packets, which can reduce the CPU load to a certain extent.

[0054] In the previous embodiment, the process of using different data processing methods to perform preprocessing and packet assembly for first-class data packets and second-class data packets with different data volumes to generate first-class target data packets and second-class target data packets is described. In this embodiment, the preprocessing includes adding packet data convergence protocol sequence number processing and encryption processing, and the specific implementation steps of preprocessing the first-class data packets to obtain the preprocessed first-class data packets are described in detail, including:

[0055] The first type of data packets are subjected to a packet data convergence protocol sequence number adding process and an encryption process to obtain the pre-processed first type of data packets.

[0056] Among them, before receiving the uplink authorization instruction, when the first type of target data packets are pre-processed at the data link layer, if the first type of target data packets are all data packets to be encrypted, the pre-processing may include adding packet data convergence protocol sequence number processing and encryption processing. Among them, the Packet Data Convergence Protocol (PDCP) is a wireless transmission protocol stack in UMTS. The PDCP layer is responsible for compressing and decompressing the IP header, transmitting user data, and maintaining the sequence number of the wireless bearer set for the lossless radio network service subsystem (SRNS). The Packet Data Convergence Protocol Serial Number (PDCP SN) is a sequence number based on the Packet Data Convergence Protocol. Encryption processing refers to the process of encrypting a data packet using a secret key. This application does not limit the specific encryption method.

[0057] Of course, if the first category of target data packets includes not only data packets to be encrypted, but also data packets that do not need to be encrypted, then for the data packets that do not need to be encrypted, the preprocessing only includes adding the packet data convergence protocol sequence number processing, and for the data packets to be encrypted, the preprocessing may include adding the packet data convergence protocol sequence number processing and encryption processing. If the first category of target data packets only includes data packets that do not need to be encrypted, then for the data packets that do not need to be encrypted, the preprocessing only includes adding the packet data convergence protocol sequence number processing. This application does not limit this.

[0058] Specifically, before receiving the uplink authorization instruction, the first-category data packet is subjected to packet data convergence protocol sequence number processing and encryption processing at the data link layer to obtain the preprocessed first-category data packet. If the first-category data packet includes first-category data packets to be encrypted and first-category data packets that do not need to be encrypted, then for the first-category data packets to be encrypted in the first-category data packets, the packet data convergence protocol sequence number processing is added to the first-category data packets to be encrypted and encryption processing is performed to obtain the preprocessed first-category data packets. For the first-category data packets that do not need to be encrypted in the first-category data packets, the packet data convergence protocol sequence number processing is added to the first-category data packets that do not need to be encrypted to obtain the preprocessed first-category data packets.

[0059] If the first category data packets only include first category data packets to be encrypted, then for the first category data packets to be encrypted in the first category data packets, packet data convergence protocol sequence number processing and encryption processing are added to the first category data packets to be encrypted at the data link layer to obtain preprocessed first category data packets.

[0060] If the first category data packets only include first category data packets that do not need to be encrypted, the first category data packets that do not need to be encrypted are processed by adding packet data convergence protocol sequence numbers at the data link layer to obtain preprocessed first category data packets.

[0061] At this time, the newly generated preprocessed first-category data packet needs to be stored in the memory of the electronic device by copying.

[0062] In the embodiment of the present application, for the first type of data packets with a small amount of data, before receiving the uplink authorization instruction, the first type of data packets are added with the packet data convergence protocol sequence number processing and encryption processing at the data link layer to obtain the pre-processed first type of data packets. Since the data volume of the first type of data packets is small, storing the newly generated pre-processed first type of data packets will not significantly increase the load of the electronic device CPU. However, before receiving the uplink authorization instruction, the first type of data packets are added with the packet data convergence protocol sequence number processing and encryption processing, that is, the operation of pre-processing the first type of data packets is performed in advance before receiving the uplink authorization instruction. Obviously, it can significantly reduce the CPU load after receiving the uplink authorization instruction.

[0063] In the previous embodiment, the process of preprocessing the first-class data packet at the data link layer to obtain the preprocessed first-class data packet is described before receiving the uplink authorization instruction. Figure 5 As shown, in this embodiment, the specific implementation steps of adding packet data convergence protocol sequence number processing and encryption processing to the first type of data packet to obtain the pre-processed first type of data packet are described in detail, including:

[0064] Step 520: Add a packet data convergence protocol sequence number to the first type of data packet at the packet data convergence protocol PDCP layer to obtain a first type of initial data packet.

[0065] The data link layer includes the packet data convergence protocol PDCP layer, the radio link control layer protocol (RadioLink Control, RLC) layer, and the medium access control layer (Medium Access Control, MAC) layer. Specifically, the PDCP layer is responsible for compressing and decompressing the IP header, transmitting user data, and maintaining the sequence number of the radio bearer set for the lossless radio network service subsystem (SRNS). The RLC layer is located above the MAC layer and is part of the data link layer. It provides segmentation and retransmission services for user and control data. The MAC layer refers to the sublayer that provides authentication, key exchange, and encryption functions.

[0066] Before receiving the uplink authorization instruction, the first-class data packet needs to be preprocessed at the data link layer to obtain the preprocessed first-class data packet. Specifically, the packet data convergence protocol sequence number (PDCP SN) is added to the first-class data packet in sequence at the packet data convergence protocol PDCP layer to obtain the first-class initial data packet. For example, based on the order of the time when multiple first-class data packets are received at the PDCP layer, PDCP SN is added to multiple first-class data packets in sequence. For example, if the added PDCP SN for the first received data packet is 1, the added PDCP SN for the second received data packet is 2, and so on, until the PDCP SN is added to the multiple first-class data packets received in sequence, and the first-class initial data packets corresponding to each first-class data packet are obtained.

[0067] Step 540: encrypt the first type of initial data packets to be encrypted in the first type of initial data packets at the PDCP layer to obtain encrypted first type of initial data packets.

[0068] After generating the first-class initial data packets corresponding to each first-class data packet, continue to encrypt the first-class initial data packets to be encrypted in the first-class initial data packets at the PDCP layer to obtain an encrypted first-class initial data packet. Specifically, the first-class initial data packets to be encrypted in the first-class initial data packets are encrypted using a secret key to obtain an encrypted first-class initial data packet. At this time, it is necessary to copy the newly generated encrypted first-class initial data packet to the memory of the electronic device. Because the data volume of the first-class data packet is small, copying the newly generated encrypted first-class initial data packet to the memory of the electronic device will not occupy too much memory and increase the load on the CPU of the electronic device.

[0069] Different keys can be used for encryption processing for different first-class initial data packets to be encrypted. The encryption processing method here is not limited to the encryption method using a hash algorithm. Because the encryption process for the first-class data packets with a small amount of data requires frequent switching of keys, it is obvious that frequent switching of keys has a greater impact on the CPU load of the electronic device, so the encryption process for the first-class data packets is also performed before receiving the authorization instruction to reduce the impact on the CPU load of the electronic device during the subsequent packet assembly process.

[0070] For the first type of initial data packets that do not need to be encrypted, there is no need to perform encryption processing, and therefore, there is no need to store them in the memory of the electronic device.

[0071] However, a discard timer is configured in the PDCP protocol, and the PDCP layer should discard the cached data packets that have timed out to prevent the real-time performance of the data packets from being insufficient. If, before receiving the uplink authorization instruction, the PDCP layer sequentially adds the packet data convergence protocol sequence number (PDCP SN) and performs encryption processing on the first-class data packets, an encrypted first-class initial data packet is obtained. If the uplink authorization instruction has not been received due to problems such as slow authorization, then there will be a problem of timeout of the encrypted first-class initial data packet. Or, even if the uplink authorization instruction is received at this time, but the authorization is too small, so many encrypted first-class initial data packets cannot be sent in one uplink transmission, and there will also be a problem of timeout of the encrypted first-class initial data packet. However, since the PDCP SN has been added to the first-class data packet before receiving the uplink authorization instruction, when the data packet timeout problem occurs, these data packets with the added PDCP SN need to be discarded. As a result, the problem of discontinuous PDCP SN of the data packet will occur, that is, a large PDCP SN gap (PDCP SN interval) will appear in the data packet received by the network device. In turn, the stability and continuity of data transmission will be adversely affected.

[0072] In the embodiment of the present application, the PDCP layer does not discard the timed data packets, thus solving the problem that discarding the timed data packets adversely affects the stability and continuity of data transmission. The timed data packets can be discarded after the network device receives the data packets.

[0073] Step 560: obtaining a preprocessed first-category data packet based on the first-category initial data packets that do not need to be encrypted and the encrypted first-category initial data packets in the first-category initial data packets.

[0074] For the first-category initial data packets that do not need to be encrypted in the first-category initial data packets, there is no need to perform encryption processing, and the first-category initial data packets that do not need to be encrypted are directly obtained, and then the encrypted first-category initial data packets are obtained to obtain the pre-processed first-category data packets. That is, the pre-processed first-category data packets include two parts, one of which is the first-category initial data packets that do not need to be encrypted, and the other is the encrypted first-category initial data packets.

[0075] After receiving the uplink authorization instruction, the pre-processed first-category data packets are grouped to obtain the first-category target data packets. The specific grouping process includes: adding header data based on the PDCP protocol to each pre-processed first-category data packet at the PDCP layer, and then transmitting the data packet with the header data of the PDCP protocol added to the RLC layer. At the RLC layer, the data packet with the header data of the PDCP protocol added is continued to be added with the header data based on the RLC protocol, and then the data packet with the header data of the RLC protocol added is transmitted to the MAC layer. At the MAC layer, the header data based on the MAC protocol is added to the data packet with the header data of the RLC protocol added. In this way, the grouping of the pre-processed first-category data packets is completed to obtain the first-category target data packets.

[0076] At this time, the first-class target data packet needs to be stored in the memory of the electronic device by copying, so as to transmit the first-class target data packet to the physical layer by copying. Obviously, in the process of transmitting the first-class data packet sent by the application layer to the physical layer, a copy is made at the PDCP layer and another copy is made at the MAC layer. However, since the data volume of the first-class data packet is small, storing the newly generated encrypted first-class initial data packet in the memory of the electronic device by copying will not occupy too much memory and thus increase the load of the CPU of the electronic device.

[0077] In an embodiment of the present application, before receiving an uplink authorization instruction, a packet data convergence protocol sequence number is added to a first-class data packet at a packet data convergence protocol PDCP layer to obtain a first-class initial data packet. The first-class initial data packet to be encrypted in the first-class initial data packet is encrypted at the PDCP layer to obtain an encrypted first-class initial data packet. Based on the first-class initial data packets that do not need to be encrypted and the encrypted first-class initial data packets in the first-class initial data packets, a pre-processed first-class data packet is obtained. For first-class data packets with a small amount of data, before receiving an uplink authorization instruction, a packet data convergence protocol sequence number can be added to all first-class data packets to obtain a first-class initial data packet. Then, the first-class initial data packets to be encrypted are encrypted again, and the first-class initial data packets that do not need to be encrypted are not encrypted. Finally, based on the first-class initial data packets that do not need to be encrypted and the encrypted first-class initial data packets in the first-class initial data packets, a pre-processed first-class data packet is obtained. In this way, just before receiving the uplink authorization instruction, the process of preprocessing the first-class data packets with a smaller data volume is implemented. Since the data volume of the first-class data packets is small, storing the newly generated preprocessed first-class data packets will not significantly increase the load of the electronic device CPU. However, before receiving the uplink authorization instruction, the first-class data packets are added with the packet data aggregation protocol sequence number processing and encryption processing, that is, the operation of preprocessing the first-class data packets is performed in advance before receiving the uplink authorization instruction. Obviously, it can significantly reduce the CPU load after receiving the uplink authorization instruction. At the same time, after receiving the uplink authorization instruction, the electronic device can send the first target data packet after packaging to the physical layer in time, and then send it to the network device.

[0078] Continuing from the previous embodiment, Figure 6 As shown, step 520, adding a packet data convergence protocol sequence number to the first type of data packet at the PDCP layer to obtain a first type of initial data packet, including:

[0079] Step 522: For the first type of data packet, obtain the current count value of the global variable corresponding to the packet data convergence protocol sequence number.

[0080] A global variable corresponding to the packet data convergence protocol sequence number is added in the PDCP layer, namely, the PDCP SN global variable. The global variable can be created by a certain object function or anywhere in the program, and the global variable can be referenced by all objects or functions of the program. In the present embodiment, the PDCP SN global variable is used to be referenced by all objects or functions that add the packet data convergence protocol sequence number PDCP SN to the data packet in the PDCP layer. In other words, when adding the PDCP SN to the first type of data packet in the PDCP layer, the PDCP SN global variable is referenced by the object or function. Of course, when adding the PDCP SN to the second type of data packet in the PDCP layer, the PDCP SN global variable is still referenced by the object or function to accumulate the PDCP SN. Therefore, although different data processing methods are used for preprocessing and packet assembly for the first type of data packet and the second type of data packet with different data volumes, the same PDCP SN global variable is referenced when adding the PDCP SN to the first type of data packet and the second type of data packet. In this way, the PDCP SNs of the first type of data packets and the second type of data packets can be uniformly numbered without causing the problem of number confusion.

[0081] Specifically, for the first type of data packets, when the packet data convergence protocol sequence number is added to the first type of data packets at the PDCP layer, the current count value of the global variable corresponding to the packet data convergence protocol sequence number can be obtained.

[0082] Step 524: Add the packet data convergence protocol sequence number to the first type of data packet based on the current count value of the global variable to obtain the first type of initial data packet.

[0083] After obtaining the current count value of the global variable corresponding to the packet data convergence protocol sequence number, the packet data convergence protocol sequence number can be added to the first type of data packet based on the current count value of the global variable (pdcp sn) to obtain the first type of initial data packet. The current count value (pdcp sn) is a positive integer.

[0084] Step 526, after adding one to the current count value of the global variable, the current count value is updated, and the process returns to the step of obtaining the current count value of the global variable corresponding to the packet data convergence protocol sequence number for the first type of data packet;

[0085] Step 528, until the packet data convergence protocol sequence number is added to all the first-category data packets to obtain the first-category initial data packets.

[0086] After the packet data convergence protocol sequence number is added to the first first-class data packet, the current count value (pdcp sn) of the global variable is increased by one to obtain (pdcp sn+1), and the current count value of the global variable is updated by (pdcp sn+1). If there are still first-class data packets in the PDCP layer, the step of returning to the first-class data packet, obtaining the current count value of the global variable corresponding to the packet data convergence protocol sequence number, adding the packet data convergence protocol sequence number to the first-class data packet based on the current count value of the global variable, and obtaining the first-class initial data packet is performed until the packet data convergence protocol sequence number is added to all the first-class data packets to obtain the first-class initial data packet.

[0087] For example, for the first first-class data packet, the current count value (pdcp sn) of the global variable corresponding to the packet data convergence protocol sequence number is obtained, and the packet data convergence protocol sequence number is added to the first-class data packet based on the current count value of the global variable to obtain the first-class initial data packet, and the current count value (pdcp sn) of the global variable is increased by one and then the current count value is updated to (pdcp sn+1). Then, if there are still first-class data packets in the PDCP layer, for the second first-class data packet, the current count value of the global variable corresponding to the packet data convergence protocol sequence number is returned to obtain (pdcp sn+1), and the packet data convergence protocol sequence number is added to the first-class data packet based on the current count value (pdcp sn+1) of the global variable to obtain the first-class initial data packet, and the current count value (pdcp sn+1) of the global variable is increased by one and then the current count value is updated to (pdcp sn+2). In this way, the processing is looped in sequence until the packet data convergence protocol sequence number is added to all first-class data packets to obtain the first-class initial data packets.

[0088] In an embodiment of the present application, for a first-class data packet, the current count value of a global variable corresponding to a packet data convergence protocol sequence number is obtained. Based on the current count value of the global variable, the packet data convergence protocol sequence number is added to the first-class data packet to obtain a first-class initial data packet. The current count value of the global variable is increased by one and then the current count value is updated, and the step of obtaining the current count value of the global variable corresponding to the packet data convergence protocol sequence number for the first-class data packet is returned to be executed until the packet data convergence protocol sequence number is added to all first-class data packets to obtain a first-class initial data packet. Based on the current count value of the global variable, the packet data convergence protocol sequence number is added to the first-class data packet in sequence, and the current count value of the global variable is updated each time the packet data convergence protocol sequence number is added. In this way, the packet data convergence protocol sequence number is added to each first-class data packet in sequence.

[0089] Although different data processing methods are used for preprocessing and packet assembly of first-class data packets and second-class data packets with different data volumes to generate first-class target data packets and second-class target data packets, the same PDCP SN global variable is referenced when adding PDCP SN to the first-class data packets and the second-class data packets. In this way, the PDCP SNs of the first-class data packets and the second-class data packets can be uniformly numbered to avoid the problem of number confusion, which in turn causes the problem of data transmission confusion.

[0090] In the above embodiment, the process of preprocessing and packetizing the first type of data packets and the second type of data packets with different data volumes using different data processing methods to generate the first type of target data packets and the second type of target data packets is described. In this embodiment, the preprocessing includes adding the packet data aggregation protocol sequence number processing and encryption processing; Figure 7 As shown, the specific implementation steps of processing and grouping the second type of data packets to obtain the second type of target data packets are described in detail below, including:

[0091] Step 720: Add a packet data convergence protocol sequence number to the second type of data packet at the PDCP layer to obtain a second type of initial data packet.

[0092] After receiving the uplink authorization instruction, the second-class data packet is processed and packaged to obtain the second-class target data packet. Specifically, the packet data convergence protocol sequence number (PDCP SN) is added to the second-class data packet in sequence at the packet data convergence protocol PDCP layer to obtain the second-class initial data packet. For example, based on the order of the time when multiple second-class data packets are received at the PDCP layer, PDCP SN is added to multiple second-class data packets in sequence. For example, the added PDCP SN for the first received is 1, the added PDCP SN for the second received is 2, and so on, until the PDCP SN is added to the multiple received second-class data packets in sequence, and the second-class initial data packets corresponding to each second-class data packet are obtained.

[0093] Step 740, grouping the second type of initial data packets to obtain the second type of intermediate data packets.

[0094] Specifically, at the PDCP layer, header data based on the PDCP protocol is added to each second-category initial data packet, and then the data packet with the header data of the PDCP protocol added is transmitted to the RLC layer. At the RLC layer, header data based on the RLC protocol is continued to be added to the data packet with the header data of the PDCP protocol added, and then the data packet with the header data of the RLC protocol added is transmitted to the MAC layer. At the MAC layer, header data based on the MAC protocol is added to the data packet with the header data of the RLC protocol added. In this way, the second-category initial data packet is assembled to obtain the second-category intermediate data packet.

[0095] Step 760: encrypt the second-category intermediate data packets to be encrypted in the second-category intermediate data packets at the media access control MAC layer to obtain encrypted second-category intermediate data packets.

[0096] The second intermediate data packet to be encrypted is obtained from the second intermediate data packet, and the second intermediate data packet to be encrypted is encrypted at the MAC layer to obtain the encrypted second intermediate data packet. Specifically, the second intermediate data packet to be encrypted in the second intermediate data packet is encrypted using a secret key to obtain the encrypted second intermediate data packet. At this time, the newly generated encrypted second intermediate data packet needs to be stored in the memory of the electronic device by copying, so as to transmit the second intermediate data packet to the physical layer by copying. Different secret keys can be used for encryption for different second intermediate data packets to be encrypted. The encryption method here is not limited to the method of encryption using a hash algorithm. Because the encryption process for the second intermediate data packet with a large amount of data does not require frequent switching of secret keys, it is obvious that the impact on the CPU load of the electronic device is small, so the process of encrypting the second intermediate data packet is also placed after receiving the uplink authorization instruction, and the load of the electronic device CPU will not be greatly increased. On the contrary, if the process of encrypting the second intermediate data packet is placed before receiving the uplink authorization instruction, the newly generated encrypted second intermediate data packet needs to be stored in the memory of the electronic device by copying. Since the second type of data packet has a large amount of data, copying the newly generated encrypted second type of data packet and storing it in the memory of the electronic device will obviously occupy too much memory and increase the load of the CPU of the electronic device.

[0097] The second type of intermediate data packets that do not need to be encrypted also need to be stored in the memory of the electronic device for transmission to the physical layer.

[0098] Step 780, obtaining a second-category target data packet based on the second-category intermediate data packets that do not need to be encrypted and the encrypted second-category intermediate data packets in the second-category intermediate data packets.

[0099] For the second-category intermediate data packets that do not need to be encrypted, there is no need to perform encryption processing. The second-category intermediate data packets that do not need to be encrypted are directly obtained, and then the encrypted second-category intermediate data packets are obtained to obtain the second-category target data packets. That is, the second-category target data packets include two parts, one of which is the second-category intermediate data packets that do not need to be encrypted, and the other is the encrypted second-category intermediate data packets.

[0100] In an embodiment of the present application, after receiving an uplink authorization instruction, a packet data convergence protocol sequence number is added to the second type of data packet at the PDCP layer to obtain a second type of initial data packet. The second type of initial data packet is assembled to obtain a second type of intermediate data packet, and the second type of intermediate data packet to be encrypted in the second type of intermediate data packet is encrypted at the media access control MAC layer to obtain an encrypted second type of intermediate data packet. Based on the second type of intermediate data packets that do not need to be encrypted and the encrypted second type of intermediate data packets in the second type of intermediate data packets, a second type of target data packet is obtained. In this way, after receiving the uplink authorization instruction, the process of preprocessing and assembling the second type of data packet with a large data volume is realized. Since the data volume of the second type of data packet is large, the process of encrypting the second type of data packet with a large data volume does not require frequent switching of secret keys, and obviously has little impact on the CPU load of the electronic device, so the process of encrypting the second type of data packet is also placed after receiving the uplink authorization instruction, and will not significantly increase the CPU load of the electronic device.

[0101] Continuing from the previous embodiment, step 720, adding a packet data convergence protocol sequence number to the second type of data packet at the PDCP layer to obtain a second type of initial data packet, includes:

[0102] The first step is to obtain, for the second type of data packets, a current count value of a global variable corresponding to a packet data convergence protocol sequence number.

[0103] A global variable corresponding to the packet data convergence protocol sequence number is added in the PDCP layer, namely, the PDCP SN global variable. The global variable can be created by an object function or anywhere in the program, and can be referenced by all objects or functions of the program. In the present embodiment, the PDCP SN global variable is used to be referenced by all objects or functions that add the packet data convergence protocol sequence number PDCP SN to the data packet in the PDCP layer. In other words, when adding the PDCP SN to the second type of data packet in the PDCP layer, the PDCP SN global variable is referenced by an object or function. Of course, when adding the PDCP SN to the second type of data packet in the PDCP layer, the PDCP SN global variable is still referenced by an object or function to accumulate the PDCP SN. Therefore, although different data processing methods are used for preprocessing and packet assembly for the second type of data packet and the second type of data packet with different data volumes to generate the second type of target data packet and the second type of target data packet, when adding the PDCP SN to the second type of data packet and the second type of data packet, the same PDCP SN global variable is referenced. In this way, the second-category data packets and the PDCP SNs of the second-category data packets can be uniformly numbered without causing the problem of number confusion.

[0104] Specifically, for the second type of data packets, when the packet data convergence protocol sequence number is added to the second type of data packets at the PDCP layer, the current count value of the global variable corresponding to the packet data convergence protocol sequence number can be obtained.

[0105] In the second step, based on the current count value of the global variable, a packet data convergence protocol sequence number is added to the second type of data packet to obtain a second type of initial data packet.

[0106] After obtaining the current count value of the global variable corresponding to the packet data convergence protocol sequence number, the packet data convergence protocol sequence number can be added to the second type of data packet based on the current count value of the global variable (PDCP sn) to obtain the second type of initial data packet. The current count value (PDCP sn) is a positive integer.

[0107] The third step is to increase the current count value of the global variable by one and then return to execute the step of obtaining the current count value of the global variable corresponding to the packet data convergence protocol sequence number for the second type of data packet, until the packet data convergence protocol sequence number is added to all the second type of data packets to obtain the second type of initial data packets.

[0108] After the packet data convergence protocol sequence number is added to the first second-class data packet, the current count value (pdcp sn) of the global variable is increased by one to obtain (pdcp sn+1), and the current count value of the global variable is updated by (pdcp sn+1). If there are still second-class data packets in the PDCP layer, the step of returning to the second-class data, obtaining the current count value of the global variable corresponding to the packet data convergence protocol sequence number, adding the packet data convergence protocol sequence number to the second-class data packet based on the current count value of the global variable, and obtaining the second-class initial data packet is performed until the packet data convergence protocol sequence number is added to all the second-class data packets to obtain the second-class initial data packet.

[0109] For example, for the first second-class data packet, the current count value (pdcp sn) of the global variable corresponding to the packet data convergence protocol sequence number is obtained, and the packet data convergence protocol sequence number is added to the second-class data packet based on the current count value of the global variable to obtain the second-class initial data packet, and the current count value (pdcp sn) of the global variable is increased by one and then the current count value is updated to (pdcp sn+1). Then, if there are still second-class data packets in the PDCP layer, for the second second-class data packet, the current count value of the global variable corresponding to the packet data convergence protocol sequence number is returned to obtain (pdcp sn+1), and the packet data convergence protocol sequence number is added to the second-class data packet based on the current count value (pdcp sn+1) of the global variable to obtain the second-class initial data packet, and the current count value (pdcp sn+1) of the global variable is increased by one and then the current count value is updated to (pdcp sn+2). In this way, the processing is looped in sequence until the packet data convergence protocol sequence number is added to all second-class data packets to obtain the second-class initial data packet.

[0110] In an embodiment of the present application, for the second type of data packet, the current count value of the global variable corresponding to the packet data convergence protocol sequence number is obtained. Based on the current count value of the global variable, the packet data convergence protocol sequence number is added to the second type of data packet to obtain a second type of initial data packet. After adding one to the current count value of the global variable, the current count value is updated, and the step of obtaining the current count value of the global variable corresponding to the packet data convergence protocol sequence number for the second type of data is returned to execute until the packet data convergence protocol sequence number is added to all the second type of data packets to obtain a second type of initial data packet. Based on the current count value of the global variable, the packet data convergence protocol sequence number is added to the second type of data packet in sequence, and each time the packet data convergence protocol sequence number is added, the current count value of the global variable is updated. In this way, the packet data convergence protocol sequence number is added to each second type of data packet in sequence.

[0111] Although different data processing methods are used for preprocessing and packet assembly of first-class data packets and second-class data packets with different data volumes to generate first-class target data packets and second-class target data packets, the same PDCP SN global variable is referenced when adding PDCP SN to the first-class data packets and the second-class data packets. In this way, the PDCP SNs of the first-class data packets and the second-class data packets can be uniformly numbered to avoid the problem of number confusion, which in turn causes the problem of data transmission confusion.

[0112] In the above-mentioned embodiments, the process of using different data processing methods to perform preprocessing and packetization for first-class data packets and second-class data packets with different data volumes to generate first-class target data packets and second-class target data packets is described. In this embodiment, the specific implementation steps of transmitting the first-class target data packets and the second-class target data packets to the physical layer are described in detail, including:

[0113] Determine the priority order of the first-category target data packets and the second-category target data packets;

[0114] The first-category target data packets and the second-category target data packets are transmitted to the physical layer in order from high to low priority.

[0115] Specifically, the priority order of the first-class target data packet and the second-class target data packet can be determined according to the importance of the first-class target data packet and the second-class target data packet. For example, if the current importance of the first-class target data packet is higher than the current importance of the second-class target data packet, it is determined that the priority of the first-class target data packet is higher than the priority of the second-class target data packet.

[0116] The priority order of the first-class target data packets and the second-class target data packets can also be determined according to the number of the first-class target data packets and the number of the second-class target data packets. For example, if the number of the first-class target data packets is much larger than the number of the second-class target data packets at this time, it can be determined that the priority of the first-class target data packets is lower than the priority of the second-class target data packets. If the authorization size carried in the received uplink authorization instruction is 1000kb, the data volume size of the first-class target data packets is 60kb, and the number is 20; and the data volume size of the second-class target data packets is 500kb, and the number is 1. Since in this uplink transmission, if the first-class target data packets are sent first, the first-class target data packets will occupy the entire authorization size carried in the uplink authorization instruction, and the second-class target data packets will not be sent, then the second-class target data packets will wait for too long to be sent. If the second-class target data packets are sent preferentially in this uplink transmission, then after sending the second-class target data packets, a part of the first-class target data packets can also be sent in this uplink transmission, ensuring that both the first-class target data packets and the second-class target data packets are sent in one uplink transmission, so that the network device can perform different operations based on the received first-class target data packets and second-class target data packets. Therefore, if the number of the first-class target data packets is much larger than the number of the second-class target data packets at this time, then according to the number of the first-class target data packets and the number of the second-class target data packets, it can be determined that the priority of the first-class target data packets is lower than the priority of the second-class target data packets.

[0117] The priority order of the first-class target data packets and the second-class target data packets can also be determined based on the importance and number of the first-class target data packets and the importance and number of the second-class target data packets. The importance of the first-class target data packets is matched with the corresponding importance values, and then combined with the number of the first-class target data packets, the numerical value corresponding to the priority of the first-class target data packets is calculated. The importance of the second-class target data packets is matched with the corresponding importance values, and then combined with the number of the second-class target data packets, the numerical value corresponding to the priority of the second-class target data packets is calculated. The priority order of the first-class target data packets and the second-class target data packets is determined according to the numerical value corresponding to the priority of the first-class target data packets and the numerical value corresponding to the priority of the second-class target data packets. That is, the target data packets corresponding to the larger numerical value have a higher priority.

[0118] If there are multiple first-category target data packets and multiple second-category target data packets, it is necessary to further determine the priority order within the multiple first-category target data packets and the priority order within the multiple second-category target data packets.

[0119] After determining the priority order of the plurality of first-class target data packets and the plurality of second-class target data packets, the plurality of first-class target data packets and the plurality of second-class target data packets can be transmitted to the physical layer in order of priority from high to low. Specifically, the plurality of first-class target data packets and the plurality of second-class target data packets generated at the MAC layer are transmitted to the physical layer by memory copying.

[0120] In an embodiment of the present application, when transmitting a first-class target data packet and a second-class target data packet to a physical layer, the method includes: determining the priority order of the first-class target data packet and the second-class target data packet; and transmitting the first-class target data packet and the second-class target data packet to the physical layer in order from high to low priority. After determining the priority order of the first-class target data packet and the second-class target data packet, further determining the priority order of a plurality of first-class target data packets and a plurality of second-class target data packets, the plurality of first-class target data packets and a plurality of second-class target data packets can be transmitted to the physical layer in order from high to low priority. Transmitting a plurality of first-class target data packets and a plurality of second-class target data packets to the physical layer in a set order can make data transmission more efficient.

[0121] Continuing from the previous embodiment, the process of determining the priority order of the first-class target data packet and the second-class target data packet and transmitting the first-class target data packet and the second-class target data packet to the physical layer in order of priority from high to low is described. In this embodiment, the priority order includes that the priority of the first-class target data packet is higher than the priority of the second-class target data packet; and within a plurality of first-class target data packets, the priority order of each first-class target data packet is determined based on the data packet generation time of the first-class target data packet; within a plurality of second-class target data packets, the priority order of each second-class target data packet is determined based on the data packet generation time of the second-class target data packet.

[0122] Specifically, after receiving the first-class data packet and the second-class data packet, the data link layer starts to preprocess the first-class data packet for the first-class data packet before receiving the uplink authorization instruction to obtain the preprocessed first-class data packet. Then, the uplink authorization instruction is waited for to arrive, and after receiving the uplink authorization instruction, one or more preprocessed first-class data packets are assembled to obtain the first-class target data packet. For the second-class data packet, the second-class data packet is not preprocessed before receiving the uplink authorization instruction. Instead, the uplink authorization instruction is waited for to arrive, and after receiving the uplink authorization instruction, one or more second-class data packets are preprocessed and assembled to obtain the second-class target data packet. Since the time for preprocessing and assembling the first-class data packet is shorter than the time for processing and assembling the second-class data packet, the first-class data packet has been assembled between the moment of receiving the uplink authorization instruction and the moment of uplink sending. The second-class data packet may not have been assembled. If the second-class data packet is sent first, it is necessary to wait for the second-class data packet to be assembled. If the first type of data packet is sent first, the first type of data packet can be sent directly at the uplink sending time without waiting for the second type of data packet to be packaged. Obviously, giving priority to sending the first type of data packet can reduce the waiting time to a certain extent and improve the data transmission efficiency.

[0123] Therefore, in the process of transmitting the first-class target data packet and the second-class target data packet to the physical layer, first, the priority order of the first-class target data packet and the second-class target data packet is determined. The priority order of the first-class target data packet and the second-class target data packet can be determined according to the importance of the first-class target data packet and the second-class target data packet. For example, if the current importance of the first-class target data packet is higher than the current importance of the second-class target data packet, it is determined that the priority of the first-class target data packet is higher than the priority of the second-class target data packet.

[0124] If there are multiple first-class target data packets and second-class target data packets, it is necessary to further determine the priority order within the multiple first-class target data packets and the priority order within the multiple second-class target data packets. Specifically, within the multiple first-class target data packets, the priority order of each first-class target data packet is determined based on the data packet generation time of the first-class target data packet; within the multiple second-class target data packets, the priority order of each second-class target data packet is determined based on the data packet generation time of the second-class target data packet. Generally, it can be determined that the priority of the target data packet corresponding to the earlier data packet generation time is higher than the target data packet corresponding to the later data packet generation time. In this way, within the multiple first-class target data packets, the priority order of each first-class target data packet is determined based on the data packet generation time of each first-class target data packet. Within the multiple second-class target data packets, the priority order of each second-class target data packet is determined based on the data packet generation time of each second-class target data packet. In this way, the priority order of multiple first-class target data packets and multiple second-class target data packets is obtained.

[0125] In the embodiment of the present application, when determining the priority order of the first-class target data packet and the second-class target data packet, it can be determined that the priority of the first-class target data packet is higher than the priority of the second-class target data packet. Between the moment of receiving the uplink authorization instruction and the uplink sending moment, the first-class data packet has been packaged, while the second-class data packet may not have been packaged. If the first-class data packet is sent first, the first-class data packet can be directly sent at the uplink sending moment without waiting for the second-class data packet to be packaged. Obviously, giving priority to sending the first-class data packet can reduce the waiting time to a certain extent and improve the data transmission efficiency.

[0126] And within multiple first-class target data packets, the priority order of each first-class target data packet is determined based on the data packet generation time of the first-class target data packet; within multiple second-class target data packets, the priority order of each second-class target data packet is determined based on the data packet generation time of the second-class target data packet. It can ensure that within multiple first-class data packets, the first-generated data packet is sent first; it can also ensure that within multiple second-class data packets, the first-generated data packet is sent first, further improving data transmission efficiency.

[0127] Continuing from the previous embodiment, it is described how to determine the priority order of the first-class target data packets and the second-class target data packets in the process of transmitting the first-class target data packets and the second-class target data packets to the physical layer. In this embodiment, Figure 8 As shown, after obtaining the priority order, the specific implementation steps of transmitting the first-class target data packets and the second-class target data packets to the physical layer in order from high to low priority are further described, including:

[0128] Step 820, according to the preset transmission ratio and priority order between the first-class target data packets and the second-class target data packets, for each transmission cycle, determine a first number of first-class target data packets from the first-class target data packets, and determine a second number of second-class target data packets from the second-class target data packets.

[0129] In the process of transmitting the first-class target data packet and the second-class target data packet to the physical layer, first, the priority order of the first-class target data packet and the second-class target data packet is determined. The priority order of the first-class target data packet and the second-class target data packet can be determined according to the importance of the first-class target data packet and the second-class target data packet. For example, if the current importance of the first-class target data packet is higher than the current importance of the second-class target data packet, it is determined that the priority of the first-class target data packet is higher than the priority of the second-class target data packet.

[0130] If there are multiple first-class target data packets and second-class target data packets, it is necessary to further determine the priority order within the multiple first-class target data packets and the priority order within the multiple second-class target data packets. Specifically, within the multiple first-class target data packets, the priority order of each first-class target data packet is determined based on the data packet generation time of the first-class target data packet; within the multiple second-class target data packets, the priority order of each second-class target data packet is determined based on the data packet generation time of the second-class target data packet. Generally, it can be determined that the priority of the target data packet corresponding to the earlier data packet generation time is higher than the target data packet corresponding to the later data packet generation time. In this way, within the multiple first-class target data packets, the priority order of each first-class target data packet is determined based on the data packet generation time of each first-class target data packet. Within the multiple second-class target data packets, the priority order of each second-class target data packet is determined based on the data packet generation time of each second-class target data packet. In this way, the priority order of multiple first-class target data packets and multiple second-class target data packets is obtained.

[0131] Then, according to the preset transmission ratio and priority order between the first-class target data packets and the second-class target data packets, for each transmission cycle, a first number of the first-class target data packets can be determined from the first-class target data packets, and a second number of the second-class target data packets can be determined from the second-class target data packets. Among them, the preset transmission ratio refers to the preset ratio between the number of the first-class target data packets transmitted and the number of the second-class target data packets transmitted in one transmission cycle. Here, the transmission cycle refers to a time period in which both the first-class target data packets and the second-class target data packets are transmitted. The specific duration of the transmission cycle is not limited in this application. The preset transmission ratio here can be any ratio. Of course, in general, because the data volume of the first-class target data packets is smaller than the data volume of the second-class target data packets, the transmission speed of the first-class target data packets is faster. Since the transmission speed of the first-class target data packets is faster, at the same time, in order to avoid the second-class target data packets from not being transmitted all the time, the preset transmission ratio here can be set to n:1, and n≥1, that is, after transmitting n first-class target data packets in one transmission cycle, 1 second-class target data packet is transmitted. So as to increase the data transmission rate while ensuring the uniform transmission of the first-class target data packets and the second-class target data packets. For example, n:1 here is 3:1, 5:1, 10:1, etc., and this application does not limit this.

[0132] Specifically, according to the preset transmission ratio and priority order between the first-category target data packets and the second-category target data packets, for each transmission cycle, a first number of first-category target data packets are determined from the first-category target data packets, and a second number of second-category target data packets are determined from the second-category target data packets. That is, for each transmission cycle, n first-category target data packets are screened out from the first-category target data packets in order from high to low priority; and then 1 second-category target data packet is screened out from the second-category target data packets in order from high to low priority.

[0133] Step 840: During the transmission period, transmit a first number of first-category target data packets and a second number of second-category target data packets to the physical layer in descending order of priority.

[0134] For each transmission cycle, n first-class target data packets are screened out from the first-class target data packets in descending order of priority; then, one second-class target data packet is screened out from the second-class target data packets in descending order of priority. Within the transmission cycle, a first number of first-class target data packets and a second number of second-class target data packets are sequentially transmitted to the physical layer in descending order of priority.

[0135] Specifically, in a transmission cycle, since the priority of the first-class target data packets is higher than the priority of the second-class target data packets in the priority order, the first number of first-class target data packets are preferentially transmitted. And in the process of outputting the first number of first-class target data packets to the physical layer, the first number of first-class target data packets are output to the physical layer in sequence according to the priority order within the first number of first-class target data packets and in a descending order of priority.

[0136] Secondly, the second number of second-class target data packets are transmitted to the physical layer. In the process of outputting the second number of second-class target data packets to the physical layer, the second number of second-class target data packets are output to the physical layer in sequence according to the priority order within the second number of second-class target data packets and in a descending order of priority.

[0137] Assuming that the preset transmission ratio is 10:1, for example, according to the preset transmission ratio and priority order between the first-class target data packets and the second-class target data packets, in the first transmission cycle, 10 first-class target data packets are determined from the first-class target data packets, and 1 second-class target data packet is determined from the second-class target data packets. Then, in the first transmission cycle, the 10 first-class target data packets are first transmitted to the physical layer in descending order of priority, and then the 1 second-class target data packet is transmitted to the physical layer. Specifically, in the process of transmitting the 10 first-class target data packets to the physical layer, according to the priority order within the 10 first-class target data packets, the first-class target data packet a with the highest priority is transmitted to the physical layer in turn; then the first-class target data packet b with the second highest priority is transmitted to the physical layer, and so on, until all 10 first-class target data packets are transmitted to the physical layer. Secondly, the 1 second-class target data packet is transmitted to the physical layer. Finally, the next transmission cycle is entered, and the preset transmission ratio and priority order between the first-class target data packets and the second-class target data packets are cyclically executed. In the first transmission cycle, 10 first-class target data packets are determined from the first-class target data packets, and 1 second-class target data packet is determined from the second-class target data packets. Then, in the first transmission cycle, the steps of first transmitting 10 first-class target data packets to the physical layer and then transmitting 1 second-class target data packet to the physical layer are performed in descending order of priority until all first-class target data packets and all second-class target data packets in the MAC layer are transmitted to the physical layer.

[0138] In the embodiment of the present application, according to the preset transmission ratio and priority order between the first-class target data packets and the second-class target data packets, for each transmission cycle, a first number of first-class target data packets are determined from the first-class target data packets, and a second number of second-class target data packets are determined from the second-class target data packets. During the transmission cycle, the first number of first-class target data packets and the second number of second-class target data packets are sequentially transmitted to the physical layer in order of priority from high to low. From the two dimensions of priority order and preset transmission ratio, on the one hand, the first-class target data packets with higher priority can be preferentially transmitted to the physical layer, and at the same time, the ratio of transmitting the first-class target data packets and the second-class target data packets is adjusted by the preset transmission ratio to avoid the second-class target data packets from not being transmitted. Thereby, while improving the transmission efficiency, the uniform transmission of the first-class target data packets and the second-class target data packets is guaranteed.

[0139] In the previous embodiment, it is described that the first type of target data packets and the second type of target data packets are transmitted to the physical layer in order of priority from high to low from two dimensions of priority order and preset transmission ratio. In the embodiment of the present application, it is further described that the preset transmission ratio is determined based on the data characteristics of the first type of target data packets and the data characteristics of the second type of target data packets; the data characteristics include at least one of the service type and the data volume size.

[0140] Specifically, according to the preset transmission ratio and priority order between the first-category target data packets and the second-category target data packets, for each transmission cycle, a first number of the first-category target data packets are determined from the first-category target data packets, and a second number of the second-category target data packets are determined from the second-category target data packets. Within the transmission cycle, the first number of the first-category target data packets and the second number of the second-category target data packets are sequentially transmitted to the physical layer in descending order of priority.

[0141] The preset transmission ratio refers to the preset ratio between the number of first-class target data packets transmitted and the number of second-class target data packets transmitted in one transmission cycle. The preset transmission ratio can be dynamically determined based on the data characteristics of the first-class target data packets and the real-time data characteristics of the second-class target data packets. The data characteristics include at least one of the business type and the data volume. For example, the preset transmission ratio can be determined based on the business type of the first-class target data packets and the second-class target data packets. The preset transmission ratio can be determined based on the data volume of the first-class target data packets and the second-class target data packets. The preset transmission ratio can also be determined based on the business type and data volume of the first-class target data packets and the second-class target data packets at the same time.

[0142] Specifically, the preset transmission ratio is dynamically determined according to the real-time service types of the first-class target data packets and the second-class target data packets. Among them, the service type of the data packet can be divided according to the specific protocol type on which the data packet depends, or the service type of the data packet can be divided based on the specific application program that generates the data packet. Of course, other division methods can also be included, and this application does not limit this. Specifically, if the service type of the first-class target data packet includes at least one of a message arrival confirmation packet based on the transmission control protocol TCP, a data packet based on the control message protocol ICMP, a data packet based on the rohc protocol, and a data packet based on the urllc protocol, and the service type of the second-class target data packet includes at least one of a data packet based on the user datagram protocol UDP and a data packet based on the transmission control protocol TCP except for the message arrival confirmation packet. Because the transmission priority of these first-class target data packets is higher than that of these second-class target data packets, when dynamically determining the preset transmission ratio, the number of transmissions of the first-class target data packets in a transmission cycle is increased as much as possible. For example, the preset transmission ratio is determined to be 5:1 according to the empirical value, then the number of transmissions of the first-class target data packets in a transmission cycle can be dynamically increased at this time, and the preset transmission ratio is updated to 10:1. Of course, the preset transmission ratio involved in the above dynamic adjustment process is just an example, and this application does not limit it.

[0143] Of course, if the first type of target data packets are data packets generated by calendar and weather applications, and the second type of target data packets are data packets generated by game applications, then it is obvious that the priority of the data packets generated by game applications is higher than the priority of the data packets generated by calendar and weather applications. Therefore, when dynamically determining the preset transmission ratio based on the real-time business types of the first type of target data packets and the second type of target data packets, the number of transmissions of the first type of target data packets in one transmission cycle can be reduced as much as possible. For example, the preset transmission ratio is determined to be 5:1 based on empirical values. At this time, the number of transmissions of the first type of target data packets in one transmission cycle can be dynamically reduced, and the preset transmission ratio can be updated to 3:1 to ensure timely interaction of game applications. Of course, the preset transmission ratio involved in the above dynamic adjustment process is only an example, and this application does not limit this.

[0144] Specifically, the preset transmission ratio can be dynamically determined according to the data volume of the first-class target data packet and the second-class target data packet. For example, the authorization size carried by the received uplink authorization instruction is 1000KB, assuming that the data volume of the first-class target data packet is 60KB, and the data volume of the second-class target data packet is 500KB, and the preset transmission ratio is determined to be 10:1 according to the empirical value, then after 10 first-class target data packets are transmitted in one transmission cycle, the remaining 400KB of the authorization size is not enough to transmit a second-class target data packet. If the second-class target data packet is not transmitted at this time, and only the first-class target data packet is transmitted, the problem of the second-class target data packet not being transmitted for a long time will occur. Therefore, the preset transmission ratio can be dynamically adjusted to 8:1, that is, after 8 first-class target data packets are transmitted in one transmission cycle, the remaining 520KB of the authorization size is enough to transmit a second-class target data packet. It is achieved that both the first-class target data packet and the second-class target data packet are transmitted in one uplink authorization. When determining the preset transmission ratio of the first-category target data packet and the second-category target data packet, the data volume of each of the first-category target data packet and the second-category target data packet may be considered, and the entire authorization size carried by the uplink authorization instruction may be used as much as possible during one uplink transmission. For example, if the authorization size carried by the received uplink authorization instruction is 1000KB, when transmitting the first-category target data packet and the second-category target data packet according to the preset transmission ratio, the authorization size of 1000KB may be used as much as possible.

[0145] Specifically, the preset transmission ratio can also be dynamically determined according to the service type and data volume of the first target data packet and the second target data packet. From the two dimensions of the service type and data volume of the data packet, the transmission ratio of the first target data packet and the second target data packet can be dynamically determined. The above method can be used to dynamically determine the first preset transmission ratio according to the real-time service type of the first target data packet and the second target data packet respectively; the second preset transmission ratio can be dynamically determined according to the data volume of the first target data packet and the second target data packet. Different weights are then configured for the first preset transmission ratio and the second preset transmission ratio, and finally the final transmission ratio is calculated based on the first preset transmission ratio, the second preset transmission ratio and their respective weights. Of course, this application does not limit the specific implementation method of dynamically determining the preset transmission ratio according to the service type and data volume of the first target data packet and the second target data packet.

[0146] In an embodiment of the present application, when determining the preset transmission ratio of the first type of target data packet and the second type of target data packet, the preset transmission ratio can be determined according to the service type of the first type of target data packet and the second type of target data packet. The preset transmission ratio can be determined according to the data volume of the first type of target data packet and the second type of target data packet. The preset transmission ratio can also be determined simultaneously according to the service type and data volume of the first type of target data packet and the second type of target data packet. The preset transmission ratio of the first type of target data packet and the second type of target data packet is dynamically adjusted in multiple dimensions, which can avoid a certain type of data packet from being unable to be transmitted for a long time, while making full use of the authorization size carried in the uplink authorization instruction. Ultimately, the data transmission efficiency between the electronic device and the network device is improved.

[0147] In one embodiment, Fig. 9 As shown, step 840, in a transmission period, sequentially transmitting a first number of first-category target data packets and a second number of second-category target data packets to the physical layer in order of priority from high to low, includes:

[0148] Step 841, during the transmission period, the first type of target data packets in the MAC layer are transmitted to the physical layer in order of priority;

[0149] Step 843, detecting whether the number of first-type target data packets transmitted to the physical layer reaches a first number;

[0150] Specifically, in a transmission cycle, the first-class target data packets are sent first in the order of priority over the second-class target data packets, and the first-class target data packets are transmitted to the physical layer in sequence according to the priority order within the first-class target data packets.

[0151] Because in one transmission cycle, a first number of first-class target data packets and a second number of second-class target data packets are determined from the first-class target data packets and the second-class target data packets according to a preset transmission ratio, and the first number of first-class target data packets and the second number of second-class target data packets are sequentially transmitted to the physical layer in a descending order of priority. Therefore, in the process of transmitting the first-class target data packets, it is detected whether the number of the first-class target data packets transmitted to the physical layer reaches the first number.

[0152] Step 845, if yes, then check whether there is a second type of target data packet in the MAC layer;

[0153] Step 847: If present, transmit a second number of second-category target data packets to the physical layer in order of priority.

[0154] During the transmission of the first type of target data packets, it is detected whether the number of the first type of target data packets transmitted to the physical layer reaches the first number. If the number of the first type of target data packets transmitted to the physical layer reaches the first number, it is prepared to start transmitting the second type of target data packets. If the number of the first type of target data packets transmitted to the physical layer reaches the first number, the first type of target data packets continue to be transmitted. First, it is detected whether there are second type of target data packets in the MAC layer; if so, the second number of second type of target data packets are transmitted to the physical layer according to the priority order. Specifically, the second number of second type of target data packets are transmitted to the physical layer in sequence according to the priority order inside the second type of target data packets. If the number of the second type of target data packets is not enough for the second number, all the second type of target data packets are transmitted to the physical layer.

[0155] In an embodiment of the present application, during a transmission cycle, the first type of target data packets in the MAC layer are transmitted to the physical layer in order of priority. It is detected whether the number of the first type of target data packets that have been transmitted to the physical layer has reached the first number; if so, it is detected whether there are second type of target data packets in the MAC layer, and if so, the second number of second type of target data packets are transmitted to the physical layer in order of priority. It is achieved that during a transmission cycle, in the order that the priority of the first target data packet is higher than the priority of the second type of target data packet, and in combination with a preset transmission ratio, the first number of first target data packets are first transmitted to the physical layer in the order of priority within the first target data packet. Then, the second number of second target data packets are transmitted to the physical layer in the order of priority within the second target data packet. Finally, orderly data transmission is achieved, and the efficiency and accuracy of data transmission are improved.

[0156] Continuing from the previous embodiment, a data transmission method is provided, further comprising:

[0157] Step 848, if it is detected that there is no second-category target data packet in the MAC layer, then continue to detect whether there is a first-category target data packet in the MAC layer;

[0158] Step 849: If present, the first type of target data packets are transmitted to the physical layer in order of priority.

[0159] Specifically, in a transmission period, the first type of target data packets in the MAC layer are transmitted to the physical layer in order of priority. It is detected whether the number of the first type of target data packets transmitted to the physical layer reaches a first number; if so, it is detected whether there are second type of target data packets in the MAC layer, and if so, a second number of second type of target data packets are transmitted to the physical layer in order of priority.

[0160] If it is detected that there is no second-category target data packet in the MAC layer, then continue to detect whether there is a first-category target data packet in the MAC layer; if so, transmit the first-category target data packet to the physical layer according to the priority order.

[0161] In the embodiment of the present application, after the first number of first target data packets are transmitted to the physical layer according to the priority order, if it is detected that there is no second type of target data packet in the MAC layer, there is no need to transmit the second type of target data packet. Therefore, the first type of target data packet can be continuously transmitted. The first type of target data packet and the second type of target data packet are flexibly transmitted to the physical layer based on the priority order and the preset transmission ratio.

[0162] In a specific embodiment, Fig.10 As shown, a data transmission method is provided, comprising:

[0163] Step 1002, the data link layer receives a first-class data packet and a second-class data packet sent by the application layer; the data volume of the first-class data packet is smaller than the data volume of the second-class data packet;

[0164] Step 1004, after receiving the first category data packet and the second category data packet, the data link layer starts to add a packet data convergence protocol sequence number to the first category data packet at the packet data convergence protocol PDCP layer before receiving an uplink authorization instruction, so as to obtain a first category initial data packet;

[0165] Step 1006, encrypting the first type of initial data packet to be encrypted in the first type of initial data packet at the PDCP layer to obtain an encrypted first type of initial data packet;

[0166] Step 1008: obtaining a preprocessed first-category data packet based on the first-category initial data packets that do not need to be encrypted and the encrypted first-category initial data packets in the first-category initial data packets.

[0167] Step 1010, then, wait for the arrival of an uplink authorization instruction, and after receiving the uplink authorization instruction, assemble one or more pre-processed first-category data packets to obtain a first-category target data packet.

[0168] The specific packet assembly process includes: adding header data based on the PDCP protocol to each pre-processed first-category data packet at the PDCP layer, and then transmitting the data packet with the header data of the PDCP protocol added to the RLC layer. At the RLC layer, continue to add header data based on the RLC protocol to the data packet with the header data of the PDCP protocol added, and then transmit the data packet with the header data of the RLC protocol added to the MAC layer. At the MAC layer, add header data based on the MAC protocol to the data packet with the header data of the RLC protocol added. In this way, the pre-processed first-category data packet is assembled to obtain the first-category target data packet.

[0169] Step 1012: For the second type of data packets, before receiving the uplink authorization instruction, the second type of data packets are not pre-processed. Instead, the uplink authorization instruction is waited for to arrive, and after receiving the uplink authorization instruction, the packet data convergence protocol sequence number is added to the second type of data packets at the PDCP layer to obtain the second type of initial data packets;

[0170] Step 1014, grouping the second type of initial data packets to obtain the second type of intermediate data packets;

[0171] Specifically, at the PDCP layer, header data based on the PDCP protocol is added to each second-category initial data packet, and then the data packet with the header data of the PDCP protocol added is transmitted to the RLC layer. At the RLC layer, header data based on the RLC protocol is continued to be added to the data packet with the header data of the PDCP protocol added, and then the data packet with the header data of the RLC protocol added is transmitted to the MAC layer. At the MAC layer, header data based on the MAC protocol is added to the data packet with the header data of the RLC protocol added. In this way, the second-category initial data packet is assembled to obtain the second-category intermediate data packet.

[0172] Step 1016, at the media access control MAC layer, encrypt the second-category intermediate data packets to be encrypted in the second-category intermediate data packets to obtain encrypted second-category intermediate data packets;

[0173] Step 1018, obtaining a second-category target data packet based on the second-category intermediate data packets that do not need to be encrypted and the encrypted second-category intermediate data packets in the second-category intermediate data packets.

[0174] Step 1020, determining the priority order of the first category target data packets and the second category target data packets;

[0175] Step 1022, according to the preset transmission ratio and priority order between the first-category target data packets and the second-category target data packets, for each transmission cycle, determining a first number of the first-category target data packets from the first-category target data packets, and determining a second number of the second-category target data packets from the second-category target data packets;

[0176] Step 1024: During the transmission period, transmit a first number of first-category target data packets and a second number of second-category target data packets to the physical layer in descending order of priority.

[0177] In the embodiment of the present application, for the first type of data packets with a small amount of data, before receiving the uplink authorization instruction, the first type of data packets are added with the packet data convergence protocol sequence number processing and encryption processing at the data link layer to obtain the pre-processed first type of data packets. Since the data volume of the first type of data packets is small, storing the newly generated pre-processed first type of data packets will not significantly increase the load of the electronic device CPU. However, before receiving the uplink authorization instruction, the first type of data packets are added with the packet data convergence protocol sequence number processing and encryption processing, that is, the operation of pre-processing the first type of data packets is performed in advance before receiving the uplink authorization instruction. Obviously, it can significantly reduce the CPU load after receiving the uplink authorization instruction.

[0178] In one embodiment, Fig.11 As shown, a data transmission device 1100 is provided, and the device includes:

[0179] The data receiving module 1120 is used to receive the first type of data packet and the second type of data packet sent by the application layer; the data volume of the first type of data packet is smaller than the data volume of the second type of data packet;

[0180] The data processing module 1140 is used to pre-process the first-category data packet before receiving the uplink authorization instruction to obtain the pre-processed first-category data packet; after receiving the uplink authorization instruction, assemble the pre-processed first-category data packet to obtain the first-category target data packet, and process and assemble the second-category data packet to obtain the second-category target data packet;

[0181] The data transmission module 1160 is used to transmit the first type of target data packets and the second type of target data packets to the physical layer.

[0182] In one embodiment, the preprocessing includes adding packet data convergence protocol sequence number processing and encryption processing; the data processing module 1140 is used to add packet data convergence protocol sequence number processing and encryption processing to the first type of data packet to obtain the preprocessed first type of data packet.

[0183] In one embodiment, Fig.12As shown, the data processing module 1140 includes:

[0184] The sequence number adding unit 1142 is used to add a packet data convergence protocol sequence number to the first type of data packet at the packet data convergence protocol PDCP layer to obtain a first type of initial data packet;

[0185] The encryption unit 1144 is used to perform encryption processing on the first type of initial data packet to be encrypted in the first type of initial data packet at the PDCP layer to obtain an encrypted first type of initial data packet;

[0186] The pre-processed first category data packet generating unit 1146 is used to obtain a pre-processed first category data packet based on the first category initial data packets that do not need to be encrypted and the encrypted first category initial data packets in the first category initial data packets.

[0187] In one embodiment, the sequence number adding unit 1142 is used to obtain the current count value of the global variable corresponding to the packet data convergence protocol sequence number for the first category of data packets; add the packet data convergence protocol sequence number to the first category of data packets based on the current count value of the global variable to obtain the first category of initial data packets; add one to the current count value of the global variable and then update the current count value, return to execute the step of obtaining the current count value of the global variable corresponding to the packet data convergence protocol sequence number for the first category of data packets, until the packet data convergence protocol sequence number is added to all the first category of data packets to obtain the first category of initial data packets.

[0188] In one embodiment, the preprocessing includes adding packet data convergence protocol sequence number processing and encryption processing; Fig.13 As shown, the data processing module 1140 may further include:

[0189] A sequence number adding unit 1142 is used to add a packet data convergence protocol sequence number to the second type of data packet at the PDCP layer to obtain a second type of initial data packet;

[0190] The packetizing unit 1143 is used to packetize the second type of initial data packets to obtain the second type of intermediate data packets;

[0191] The encryption unit 1144 is used to encrypt the second-category intermediate data packet to be encrypted in the second-category intermediate data packet at the media access control MAC layer to obtain an encrypted second-category intermediate data packet;

[0192] The second-category target data packet generating unit 1148 is configured to obtain a second-category target data packet based on the second-category intermediate data packets that do not need to be encrypted and the encrypted second-category intermediate data packets in the second-category intermediate data packets.

[0193] In one embodiment, the sequence number adding unit 1142 is used to obtain the current count value of the global variable corresponding to the packet data convergence protocol sequence number for the second category data packet; add the packet data convergence protocol sequence number to the second category data packet based on the current count value of the global variable to obtain the second category initial data packet; after adding one to the current count value of the global variable, return to execute the step of obtaining the current count value of the global variable corresponding to the packet data convergence protocol sequence number for the second category data packet, until the packet data convergence protocol sequence number is added to all the second category data packets to obtain the second category initial data packet.

[0194] In one embodiment, the data transmission module 1160 includes:

[0195] A priority order determining unit, used to determine the priority order of the first category target data packets and the second category target data packets;

[0196] The data transmission unit is used to transmit the first-category target data packets and the second-category target data packets to the physical layer in order of priority from high to low.

[0197] In one embodiment, the priority order includes that the priority of the first category target data packet is higher than the priority of the second category target data packet; and within multiple first category target data packets, the priority order of each first category target data packet is determined based on the packet generation time of the first category target data packet; within multiple second category target data packets, the priority order of each second category target data packet is determined based on the packet generation time of the second category target data packet.

[0198] In one embodiment, a data transmission unit is used to determine a first number of first-class target data packets from the first-class target data packets and a second number of second-class target data packets from the second-class target data packets for each transmission cycle according to a preset transmission ratio and priority order between the first-class target data packets and the second-class target data packets; within the transmission cycle, the first number of first-class target data packets and the second number of second-class target data packets are transmitted to the physical layer in descending order of priority.

[0199] In one embodiment, the preset transmission ratio is determined based on data characteristics of the first type of target data packets and data characteristics of the second type of target data packets; the data characteristics include at least one of a service type and a data volume.

[0200] In one embodiment, the data transmission unit is also used to transmit the first type of target data packets in the MAC layer to the physical layer in order of priority within the transmission period; detect whether the number of the first type of target data packets transmitted to the physical layer has reached a first number; if so, detect whether there are second type of target data packets in the MAC layer; if so, transmit a second number of second type of target data packets to the physical layer in order of priority.

[0201] In one embodiment, the data transmission unit is further used to continue to detect whether there is a first-class target data packet in the MAC layer if it is detected that there is no second-class target data packet in the MAC layer; if so, transmit the first-class target data packet to the physical layer in order of priority.

[0202] It should be understood that, although the various steps in the above-mentioned flow chart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the above-mentioned flow chart may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0203] The division of the various modules in the above-mentioned data transmission device is only for illustration. In other embodiments, the data transmission device may be divided into different modules as needed to complete all or part of the functions of the above-mentioned data transmission device.

[0204] For the specific definition of the data transmission device, please refer to the definition of the data transmission method above, which will not be repeated here. Each module in the above-mentioned data transmission device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0205] Fig.14Schematic diagram of the internal structure of an electronic device in an embodiment. The electronic device can be any terminal device such as a mobile phone, a tablet computer, a laptop computer, a desktop computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), a car computer, a wearable device, etc. The electronic device includes a processor and a memory connected via a system bus. Among them, the processor may include one or more processing units. The processor may be a CPU (Central Processing Unit) or a DSP (Digital Signal Processing), etc. The memory may include a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The computer program can be executed by the processor to implement a data transmission method provided in each of the following embodiments. The internal memory provides a cache operating environment for the operating system computer program in the non-volatile storage medium.

[0206] The implementation of each module in the data transmission device provided in the embodiment of the present application can be in the form of a computer program. The computer program can be run on an electronic device. The program module constituted by the computer program can be stored in the memory of the electronic device. When the computer program is executed by the processor, the steps of the method described in the embodiment of the present application are implemented.

[0207] The embodiment of the present application also provides a computer-readable storage medium. One or more non-volatile computer-readable storage media containing computer-executable instructions, when the computer-executable instructions are executed by one or more processors, the processors execute the steps of the data transmission method.

[0208] The embodiment of the present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the data transmission method.

[0209] Any reference to memory, storage, database or other medium used in this application may include non-volatile and / or volatile memory. Non-volatile memory may include ROM (Read-Only Memory), PROM (Programmable Read-only Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-only Memory) or flash memory. Volatile memory may include RAM (Random Access Memory), which is used as an external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as SRAM (Static Random Access Memory), DRAM (Dynamic Random Access Memory), SDRAM (Synchronous Dynamic Random Access Memory), Double Data Rate DDRSDRAM (Double Data Rate Synchronous Dynamic Random Access memory), ESDRAM (Enhanced Synchronous Dynamic Random Access memory), SLDRAM (Sync Link Dynamic Random Access Memory), RDRAM (Rambus Dynamic Random Access Memory), and DRDRAM (Direct Rambus Dynamic Random Access Memory).

[0210] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A data transmission method, characterized in that: The method comprises: receiving a first type of data packet and a second type of data packet sent by an application layer; the data volume of the first type of data packet is less than the data volume of the second type of data packet; the first type of data packet and the second type of data packet are service data packets divided according to the data volume in the TCP / IP layer and sent to the application layer; Before receiving the uplink authorization instruction, preprocessing the first category data packet to obtain a preprocessed first category data packet; after receiving the uplink authorization instruction, assembling the preprocessed first category data packet to obtain a first category target data packet, and processing and assembling the second category data packet to obtain a second category target data packet; Transmitting the first-category target data packets and the second-category target data packets to a physical layer; The transmitting the first-category target data packets and the second-category target data packets to the physical layer comprises: determining the priority order of the first-category target data packets and the second-category target data packets; transmitting the first-category target data packets and the second-category target data packets to the physical layer in order of priority from high to low; The method of transmitting the first-category target data packets and the second-category target data packets to the physical layer in order of priority from high to low comprises: determining a first number of first-category target data packets from the first-category target data packets and a second number of second-category target data packets from the second-category target data packets for each transmission cycle according to a preset transmission ratio between the first-category target data packets and the second-category target data packets and the priority sequence; and transmitting the first number of first-category target data packets and the second number of second-category target data packets to the physical layer in order of priority from high to low within the transmission cycle; The preset transmission ratio refers to the preset ratio between the number of the first type of target data packets transmitted and the number of the second type of target data packets transmitted in one transmission cycle; the preset transmission ratio is determined based on the data characteristics of the first type of target data packets and the data characteristics of the second type of target data packets; the data characteristics include the service type and the data volume; The priority order includes that the priority of the first category target data packet is higher than the priority of the second category target data packet; and within multiple first category target data packets, the priority order of each first category target data packet is determined based on the packet generation time of the first category target data packet; within the multiple second category target data packets, the priority order of each second category target data packet is determined based on the packet generation time of the second category target data packet.

2. The method according to claim 1, characterized in that The preprocessing of the first category data packets to obtain the preprocessed first category data packets includes: The first-category data packets are subjected to packet data convergence protocol sequence number adding processing and encryption processing to obtain preprocessed first-category data packets.

3. The method according to claim 2, characterized in that The adding of packet data convergence protocol sequence number processing and encryption processing to the first type of data packets to obtain the pre-processed first type of data packets includes: Adding a packet data convergence protocol sequence number to the first type of data packet at a packet data convergence protocol PDCP layer to obtain a first type of initial data packet; Performing encryption processing on the first-category initial data packet to be encrypted in the first-category initial data packet at the PDCP layer to obtain an encrypted first-category initial data packet; Based on the first-category initial data packets that do not need to be encrypted in the first-category initial data packets and the encrypted first-category initial data packets, a preprocessed first-category data packet is obtained.

4. The method according to claim 3, characterized in that The adding a packet data convergence protocol sequence number to the first type of data packet at the PDCP layer to obtain a first type of initial data packet includes: For the first type of data packets, obtaining a current count value of a global variable corresponding to the packet data convergence protocol sequence number; Adding a packet data convergence protocol sequence number to the first type of data packet based on the current count value of the global variable to obtain a first type of initial data packet; After adding one to the current count value of the global variable, the current count value is updated, and the step of obtaining the current count value of the global variable corresponding to the packet data convergence protocol sequence number for the first type of data packet is returned to be executed until the packet data convergence protocol sequence number is added to all the first type of data packets to obtain the first type of initial data packets.

5. The method according to any one of claims 1 to 4, characterized in that The preprocessing includes adding packet data convergence protocol sequence number processing and encryption processing; the processing and grouping of the second type of data packets to obtain the second type of target data packets includes: Adding a packet data convergence protocol sequence number to the second type of data packet at the PDCP layer to obtain a second type of initial data packet; Packaging the second-category initial data packets to obtain second-category intermediate data packets; At the media access control MAC layer, encrypting the second-category intermediate data packets to be encrypted in the second-category intermediate data packets to obtain encrypted second-category intermediate data packets; Based on the second-category intermediate data packets that do not need to be encrypted in the second-category intermediate data packets and the encrypted second-category intermediate data packets, a second-category target data packet is obtained.

6. The method according to claim 5, characterized in that The adding a packet data convergence protocol sequence number to the second type of data packet at the PDCP layer to obtain a second type of initial data packet includes: For the second type of data packets, obtaining a current count value of a global variable corresponding to the packet data convergence protocol sequence number; Adding a packet data convergence protocol sequence number to the second type of data packet based on the current count value of the global variable to obtain a second type of initial data packet; After adding one to the current count value of the global variable, the step of obtaining the current count value of the global variable corresponding to the packet data convergence protocol sequence number for the second type of data packet is returned to execute until the packet data convergence protocol sequence number is added to all the second type of data packets to obtain the second type of initial data packets.

7. The method according to claim 1, characterized in that The step of transmitting the first number of first-category target data packets and the second number of second-category target data packets to the physical layer in descending order of priority during the transmission period includes: In the transmission period, transmitting the first type of target data packets in the MAC layer to the physical layer according to the priority order; detecting whether the number of the first type of target data packets transmitted to the physical layer reaches the first number; If yes, detecting whether the second type of target data packet exists in the MAC layer; If so, the second number of the second-category target data packets are transmitted to the physical layer according to the priority order.

8. The method according to claim 7, characterized in that The method further comprises: If it is detected that the second type of target data packet does not exist in the MAC layer, continue to detect whether the first type of target data packet exists in the MAC layer; If so, the first-category target data packet is transmitted to the physical layer according to the priority order.

9. A data transmission device, characterized in that: The device comprises: A data receiving module is used to receive a first type of data packet and a second type of data packet sent by an application layer; the data volume of the first type of data packet is less than the data volume of the second type of data packet; the first type of data packet and the second type of data packet are obtained by dividing the service data packets according to the data volume in the TCP / IP layer and sending them to the application layer; A data processing module, configured to pre-process the first category data packets before receiving an uplink authorization instruction to obtain a pre-processed first category data packet; after receiving the uplink authorization instruction, assemble the pre-processed first category data packets to obtain a first category target data packet, and process and assemble the second category data packets to obtain a second category target data packet; A data transmission module, used for transmitting the first type of target data packets and the second type of target data packets to a physical layer; The data transmission module comprises a priority order determination unit and a data transmission unit; the priority order determination unit is used to determine the priority order of the first type of target data packets and the second type of target data packets; the data transmission unit is used to transmit the first type of target data packets and the second type of target data packets to the physical layer in order from high to low priority; The data transmission unit is specifically configured to determine, for each transmission cycle, a first number of first-class target data packets from the first-class target data packets and a second number of second-class target data packets from the second-class target data packets according to a preset transmission ratio between the first-class target data packets and the second-class target data packets and the priority order; and within the transmission cycle, sequentially transmit the first number of first-class target data packets and the second number of second-class target data packets to the physical layer in a descending order of priority; The preset transmission ratio refers to the preset ratio between the number of the first type of target data packets transmitted and the number of the second type of target data packets transmitted in one transmission cycle; the preset transmission ratio is determined based on the data characteristics of the first type of target data packets and the data characteristics of the second type of target data packets; the data characteristics include the service type and the data volume; The priority order includes that the priority of the first category target data packet is higher than the priority of the second category target data packet; and within multiple first category target data packets, the priority order of each first category target data packet is determined based on the packet generation time of the first category target data packet; within the multiple second category target data packets, the priority order of each second category target data packet is determined based on the packet generation time of the second category target data packet.

10. An electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the computer program is executed by the processor, the processor is caused to perform the steps of the data transmission method according to any one of claims 1 to 8.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the data transmission method according to any one of claims 1 to 8 are implemented.

12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Long term evolution base station and method for processing data service thereof

    CN102217365A

  • Uploading data transmission method and device

    CN102655447A

  • Data transmission method

    CN106413095A