I posted an internationally renowned terminal manufacturer, responsible for the development of Modem chip. At 5G, the development of the terminal data business layer, the core network is responsible for the development of the core data business, and the current lead 6G power network technology standard research.
The blog content is mainly rounded:
5G protocol explanation
Computer network explanation (cloud computing, edge calculation, end calculation)
Advanced C language explanation
RUST language explanation
NR PDCP Protocol Detailed
PDCP:packet data convergence protocol (TS 38.323)
First, PDCP Overview
1.1 PDCP layer main function:
- Maintenance serial number SN;
- The header compression / decompression of user plane data;
- encrypt and decode;
- Integrity protection / integrity verification, NR Adds the integrity protection / verification function of user plane data, which is selectively configured by RRC;
- PDCP SDU discarding based on Timer;
- Packet Duplication, NR New Features, Improve Packet Transmission Reliability;
- Rearrangement and sequential submission;
- No sequential submission, NR new features, this function is selectively configured by RRC, reducing transmission delay;
- Repeated package discard;
- Pre-processing functions, new features of NR, reduce the processing delay of Layer 2, and provide the basis for high-rate transmission;PDCP pretreatment includes the PDCP SDU to preprocessing into a PDCP PDU, and submitting the lower level of the lower layer before receiving the next layer request.)
1.2 LTE PDCP V.S. NR PDCP
- 5G PDCP compared to LTE PDCP,increasePacket duplication and pre-processing function;
- Subscribe to the RLC,Rearrangement function(LTE, since the RLC guarantees sequential submission, the PDCP does not need to perform reordering, the PDCP reordering and repetition detection will only be used when switching is switched.
- In addition,Introducing configurable non-order submission, Reduce transmission delay
Second, PDCP Structure

- RB (except SRB0) and one-on-one relationship with PDCP entitiesThe sender is established based on the upper layer request to establish a PDCP entity for an RB, and set the relevant state variable to the initial value when establishing an entity;
- The channel between the PDCP entity and the RLC entity is RLC Channel (NR new styled, LTE is called SAP); based on RB features (E.G. One-way / two-way or separated / non-separated) and RLC Mode,A PDCP entity can associate one or more RLC entities;
- When the PDCP duplication function is activated, a PDCP entity needs to associate two RLC entities.
Third, PDCP entity

- Head compression:onlyThe user plane data has a head compression function, selectively configured by the RRC;
- Integrity protection:SRB requires integrity protectionThe DRB is used after the RRB selective configuration; (in the LTE, only the control surface data requires integrity protection, the user's surface data is not integrity protection)
- Encryption: After the security function is activated, all RRC indicated PDCP Data PDUs (including SRB, DRB) need to be encrypted;
- Duplication: If the package replication function is activated, the PDCP needs to copy the associated PDCP PDU and submit to different RLC entities.
- Send a PDCP entity: The sub-layer (RLC Layer) is submitted after processing PDCP SDU (equivalent to SDAP PDU) received from the upper layer.
- Receive SDAP entity: Aplication Layer will be submitted after the PDCP PDU (equivalent RLC SDU) received from the lower layer is processed into PDCP SDU.
Fourth, PDCP PDU Format
4.1 PDCP data PDU



- Integrity Protection Part: PDCP Data PDUSub-headed and encrypted data field;
- Encrypted part: PDCP Data PDUData domain (excluding SDAP heads) and Mac-i;(In the LTE, since the user's surface data is not integrity protection, the encryption section does not include Mac-i)
- Mac-i accounts for 32 bits, carrying Message Authentication Code;
- For DRB, PDCP SN is 12bit or 18bit,Configured by RRC to accommodate different transmission rates;
4.2 PDCP Control PDU
FMC: 32bit, indicating that the reordering windowThe first lost PDCP SDU's count value


- PDCP Control PDU is used to transmit PDCP status reports or discrete RoHC feedback;
- Contol PDU for PDCP Status Report only for AM DRBContol PDU for Interspersed Rohc FeedBack for AM DRB and UM DRBs;
- PDCP Control PDU No SNAndDo not useEncryption / decryption, integrity protection / integrity verification function;
Data transfer related variables
SN range value range:
- PDCP PDU uses SN number, [ 0 , 2 [ p d c p − S N − S i z e ] – 1 ] [0, 2^{[pdcp-SN-Size]} – 1] [0,2[pdcp−SN−Size]–1]Value in the range;
state variable range:
- All state variables are all non-negative, the value range is [ 0 , 2 32 − 1 ] [0, 2^{32}-1] [0,232−1]Inside;
Send the status variable that the PDCP entity needs to be maintained:
- TX_NEXT
This status variable indicates the COUNT of the next transmission PDCP SDU (consisting of HFN and PDCP Sn) values. The initial value of this variable is 0;
Receive the status variable that the PDCP entity needs to be maintained:
- RX_NEXT
This variable indicates the next one.ExpectationPDCP SDU's count value. The initial value of this variable is 0.
- RX_DELIV
This variable indicates thatI haven't submitted the upper layer but wars waiting to be submitted. PDCP SDU's count value. The initial value of this variable is 0.
- RX_REORD
This variable indicates the PDCP Data PDU that triggers T-REORDERING TIMER.COUNT+1;
6. Data transmission - send behavior
6.1 Send operation
- When the PDCP SDU is received from the upper layer,OpenDISCARDTIMER (if configured) for this package;
- CorrectEveryPDCP SDU received from the upper layer requires:
- Associate the COUNT value corresponding to the TX_NEXT is associated with the PDCP SDU;
- Head compression (need to ignore the SDAP header);
- Integrity protection, encryption operation based on TX_NEXT;
- Set the SN of the PDCP Data PDU asTX_NEXT modulo 2[pdcp-SN-Size];
- Press step 1 to increase TX_NEXT;
- Submit the resulting PDCP PDU;
6.2 One Send PDCP entity associated with two RLC entities
- If the Duplication function is configured and in the activation state, copy the PDCP Data PDU separate two RLC entities, respectively;PDCP Control PDU does not apply to Packet Duplication, can only be submitted to the primary RLC entity, because RoHC feedback PDCP Control PDU can cause the RoHC state to fail);
- If the two RLC entities associated are different Cell Group and the sum of PDCP Data Volume and RLC Data Volumemore than theA preset threshold UL-DataSplitthReshold, submit the PDCP PDU to the primary RLC entity or auxiliary RLC entity (depending on the specific implementation), otherwise it is submitted to the primary RLC entity;
7. Data transmission - receiving behavior
7.1 receiving operation
- NR PDCP adoptsPush Window + T-REORDERING TIMERThe form of receiving the lower-level PDCP PDU;
About PUSH Window: The receiving window can only depend on the boundary status variable (RX_DELIV) update under the receiving window.
- All state variables are based on the count value and Wrap Around issues for the count value are not considered in the receiving mechanism.Network side guarantees to prevent Wrap Around (if you use DRB Addition / Release);
- After the PDCP receives the PDCP PDU, it is first necessary to determine the correct HFN and COUNT values based on the SN in the PDCP PDU sub-head and the current receiving window state. Decryption and integrity verification based on the obtained COUNT;
- PDCP PDU that is not verified through integrity will be discardedThere is no provision on how the PDCP PDU without decryption is not specified in the agreement.
- The PDCP PDU via integrity verification requires further repetitive detection, only PDCP PDUs detected by repeatability, the corresponding PDCP SDU is placed in the PDCP to receive buffer;
- Sorted PDCP PDU, after removing the PDCP PDU header, needUnzip according to the order of PDCP COUNT numbersPrevent decompression failure caused by RoHC Context to be sequentially updated. The package is compressed and then submits an SDAP layer.
- If the RRC is configured, the PDCP SDU needs to be submitted.First put it in the receiving buffer to record the reception status of the PDCP SDU,thenDirect deliveryAndCannotConfigure head compression function;
- If you do not have sequential submission, PDCP needs to be reordered and lost. If a PDCP PDU is detected, it is not received (the simple understanding is no sequential receiving PDCP PDU), and the reordering timer (I.E T-RORDERING TIMER) is turned on.Timer timeout thinks the GAP packet receive failed;
below PDCP-SN-SIZE = 3bit, Window_Size = 4 (The protocol specifies half of the length of the receiving window for its SN spaceTake an example
Receive example: The following is the initial state of the receiving window

Method for determining the HFN and count values:
-
If the package is received SN <SN (RX_DELIV) - Window_SIZE, then the package corresponding to the HFN = HFN (Rx_Deliv) + 1;

-
If the package is received Sn> = SN (RX_DELIV) + Window_SIZE, then the package corresponding to the HFN = HFN (Rx_Deliv) - 1;

-
Otherwise, the received package corresponds to the HFN = HFN (Rx_Deliv)
After the HFN of the received package is determined, the package can be determinedCOUNT value is [RCVD_HFN, RCVD_SN]。
Receive behavior:
- according toCOUNT ascendingAdd PDCP SDU up to the upper layer;
- Update RX_DELIV to point to the first PDCP SDU that is not submitted to the upper layer;
- Determine if the T-REORDERING timer is to be stopped (if the timer is running and updated RX_DELIV> = RX_REORD, stop timer; if it is not running (Including the stop due to the aforementioned behavior) And updated RX_DELIV <RX_NEXT, start the timer, and set RX_REORD = RX_NEXT)
case 1: Received the PDCP PDU of Sn = RX_DELIV (received a package corresponding to the lower boundary)
As shown in the figure, when SN = 0 is received, RX_DELIVE = 3 is updated. At this time, RX_DELIV> = RX_REORD = 2, the timer is stopped. Due to rx_deliv = rx_next = 3, no restarting scheduler is required
case 2: T-REORDERING Timer Timeout

As shown in the figure, when the timer is timeout, update rx_delive = 3, this time due to rx_deliv = rx_next = 3 (explained no packet loss), no need to restart rearrangement timer
case 3: Reassign T-REORDERING Timer Duration (Instructions that may receive a duplicate timer during T-REORDERING regular operation)

1 Update RX_REORD = RX_NEXT (Ignore GAP);
2 Stop and restart the T-REORDERING timer
Eight, SDU Discard & Duplicated PDU Discard
8.1 SDU discard
The data rate provided by the application layer does not match the data rate provided by the wireless interface, which may generate a large number of cache data to prevent excessive delay and queuing phenomenon to introduce SDU Discard mechanisms.。
DRB
For DRBWhen any of the following conditions are met, send the PDCP entity to delete the PDCP SDU and the corresponding PDCP Data PDU:
- The PDCP SDU corresponds to the discardtimer timeout (only DRB will configure this Timer);
- The PDCP status report determines that a PDCP SDU has been successfully transferred (only for DL DRB);
If the corresponding PDCP PDU has been transferred to the lower layer, the lower layer is discarded;
[Note]: Due to the introduction of preprocessing in NR PDCP, PDCP may discard a PDCP SD that has been associated with SN, causing SN GAP, which in turn increases the re-order time of receiving ends. The GAP can be reduced depending on the UE implementation (such as reassigned to other PDCP SDUs).
SRB
For SRBIf the upper layer requests PDCP SDU Discard, the PDCP entity should be discardedAll storage PDCP SDU and PDCP PDU(For SRB, SDU Discard is an RRC request function.Similar to request PDCP Re-EstablishmentTherefore, when the PDCP receives this request, all stored packages should be discarded)
8.2 Duplicated PDU discard
- NR for the newly introduced features of Packet Duplication;
- If the PDCP PDU is successfully transmitted by one RLC entity, send the PDCP entity indicating another RLC entity to drop the corresponding Duplicated PDCP PDU.Currently used in AM DRB);
- If the PDCP receives the Duplication function deactivation, send the PDCP entity indicating that the RLC entity discards all DuPlicated PDCP Data PDUs;
Nine, PDCP status report
In some cases, the PDCP SDU has successfully received but has not received the corresponding RLC confirmation, in order to avoid unnecessary retransmission, the UE can inform the network side package by the PDCP status (PDCP status report only for DL DRB)
-
In the following case, if the RRC is configured, the receiving PDCP needs to trigger the PDCP status report:
- The upper layer requests PDCP Entity Re-Establishment (such as switching);
- The upper request PDCP Data Recovery bearer type change (such as MCG Split Bearer transform into MCG Bearer)
-
Send PDCP Control PDU for PDCP Statute Report:
- Set the FMC equal to RX_DELIV;
- Assign bitmap domain, the length is equal to the number of count numbers from the first lost PDCP SDU but does not include the PDCP SDU to start to the last femue PDCP SDU, or from the first lost PDCP SDU but not including The PDCP SDU starts to PDCP Control PDU Size is equal to9000bytesThe number of counts;
- forNo successPDCP SDU andNo success decompressionThe PDCP SDU (optional) corresponding to the Bitmap domain is set to "0";
- Set to "1" for the Bitmap domain corresponding to the successful PDCP SDU.
-
Receive PDCP Control PDU for PDCP Statute Report
- It is considered that the COUNT value is less than the FMC or Bitmap set to "1", the PDCP SDU is successfully received;
- Execute SDU Discard
Ten, data transmission - transmitted data (for BSR)
Cache Status Report is performed for the MAC layer (BUFFER SIZE Report, BSR)Apply for uplink authorizationThe UE believes that the following is the PDCP layer propagated data:
- Also has not been processed into PDCP SDUs for PDCP PDU;
- No lower PDCP PDU is not submitted;
- PDCP control PDU;
- For am DRB, PDCP Re-Establishment determines the PDCP SDU that needs to be retransmitted;
- For AM DRB, PDCP Data Recovery, determine the PDCP PDU that needs to be retransmitted
When a PDCP is associatedTwoRLC entity:
- DC split bear: If the PDCP transmitted data and the RLC wait for the initiation of the transmitted data, the MAC represents the MAC to the primary RLC entity to the primary RLC entity, the Mac indicates the PDCP capacity of 0; otherwise, the PDCP is respectively The MAC entity associated with the main / secondary RLC indicates the amount of PDCP;
- DC duplication: The PDCP indicates the amount of PDCP data to the MAC entity associated with the primary RLC, the secondary RLC entity;
- CA Duplication: The amount of PDCP data is required to calculate the logical channel group LCG associated with the main / secondary RLC entity, respectively.
[5G Series] High-level protocol stack - protocol stack architecture
[5G Series] SDAP (Service Data Adaptation Protocol) protocol details
[5G Series] Detailed explanation of RLC (Radio Link Control)
[5G Series] Mac (Medium Access Control) protocol
