# 5G NR MAC PDU

## Summary


An RLC PDU (Protocol Data Unit) consists of an RLC header and an RLC payload. At MAC sublayer, such an RLC PDU is called MAC SDU (Service Data Unit). MAC adds a **subheader** to this to construct a **MAC subPDU**. 

MAC also sends/receives Control Elements (CEs), each with its own subheader. Signalling via MAC CEs complements RRC signalling by enabling dynamic configuration changes. 

Multiple MAC SDUs and CEs can be part of a single **MAC PDU**. A MAC PDU is packaged as a Transport Block (TB) and sent on a transport channel to PHY layer for transmission.

While 5G NR MAC has a general structure for its PDUs, there are differences across downlink, uplink and sidelink channels. Random access procedure has a specialized MAC PDU structure.

## Discussion

### How does a 5G NR MAC PDU differ from a LTE MAC PDU?

A MAC PDU in LTE has a **single header** that has all the necessary information for decoding the entire PDU. In 5G, the MAC PDU has **one or more subheaders**, each subheader providing information to decode its corresponding MAC subPDU. 

This redesign reduces latency in 5G NR. In LTE UE, a MAC PDU can't be assembled until uplink grant is available, since this determines the TB size. In 5G, MAC subPDUs can be assembled in advance. As soon as the grant is available, MAC simply adds necessary padding and concatenates subPDUs. NR design also allows MAC to process its PDU from the back. 

There's a particular RLC detail that improves latency in 5G NR. In LTE, RLC does concatenation of RLC SDUs into a single RLC PDU. Hence, LTE UE can't construct its RLC PDU until uplink grant is received. **5G NR RLC doesn't do concatenation**. An RLC data PDU contains only one RLC SDU. Multiplexing/demultiplexing of RLC PDUs (regardless of the radio bearer) happens at MAC. 


### What are some essential facts about MAC PDUs?

A MAC PDU consists of **one or more MAC subPDUs**. A MAC subPDU always starts with a subheader. Subheader is followed by a MAC SDU, a MAC CE or padding. When a set of MAC subPDUs doesn't exactly fill a TB, a MAC subPDU with padding is included. A MAC subPDU with only a subheader implies zero-length padding. Only one MAC PDU is allowed in a TB. 

MAC SDUs, CEs and subheaders are all **byte aligned and in multiples of 8 bits**. Leftmost bit is the most significant bit. 

The **order of subPDUs** in a MAC PDU is defined. In sidelink and uplink, the order of concatenation is MAC SDUs, CEs and padding. In downlink, the order is MAC CEs, SDUs and padding. In all cases, padding is the last subPDU. 

MAC SDUs are of variable **size**, except for an SDU carrying UL CCCH. Some MAC CEs are of fixed size while others are of variable size. 

In **transparent MAC** (BCH, PCH, BCCH on DL-SCH, SL-BCH), there's no MAC subheader. One MAC SDU is aligned to TB size. 


### Which are the main fields of a 5G NR MAC subheader?

The MAC subheader consists of the following fields: 

    + **Reserved**: R bit is set to 0. It may be used in future updates to MAC.
    + **Format**: F bit indicates size of the Length field L. For F=0, L is 8 bits, else L is 16 bits.
    + **Length**: L field indicates the length in bytes of either a MAC SDU or a variable-sized CE. This field is absent when not necessary, such as fixed-size CE, padding or MAC SDU containing UL CCCH. UL CCCH MAC SDU is of fixed size: 64 bits if LCID=0, 48 bits if LCID=52.
    + **Logical Channel ID (LCID)**: This 6-bit field identifies the logical channel carried in a MAC subPDU, a specific CE or padding.
    + **Extended Logical Channel ID (eLCID)**: This extends the range of the LCID field. It's size is 1 byte if LCID=34, 2 bytes if LCID=33. Two-byte eLCID is used only on IAB backhaul links.

### Could you describe the LCID field carried in a 5G NR MAC PDU?

LCID values and meaning differ for downlink, uplink and sidelink. We note briefly some of these values. 

In DL-SCH, LCID=0 indicates CCCH. In UL-SCH, LCID values 0 or 52 indicate CCCH. 

In both DL and UL, values 1-32 indicate identity of the logical channel since MAC does the multiplexing/demultiplexing of RLC PDUs coming via logical channels. Many other values indicate that a MAC subPDU contains MAC CE. LCID=63 is for padding. Values 33 or 34 imply that eLCID field is present in the subheader. 

Some DL CEs pertain to DRX, Timing Advance, recommended bit rate, UE Contention Resolution Identity, and activation/deactivation of various protocol features. Some UL CEs pertain to Buffer Status Report (BSR), Power Headroom Report (PHR), Listen Before Talk (LBT), C-RNTI and recommended bit rate query. 


### What's the structure of a 5G NR MAC PDU for random access procedure?

MAC PDUs have one or more MAC subPDUs and optional padding. There are two types of PDUs: 

    + **Random Access Response (RAR)**: Each MAC subPDU has a subheader followed by Backoff Indicator (BI), Random Access Preamble Identifier (RAPID), and RAPID plus RAR. If present, a BI subPDU comes at the start of a MAC PDU and padding comes at the end. Padding is not part of a subPDU. The MAC subheader is different for BI and RAPID.
    + **MsgB**: This is applicable in 2-step procedure. Each MAC subPDU has its own subheader plus BI, fallbackRAR, successRAR, MAC SDU for CCCH or DCCH, or padding. If the PDU contains MAC SDUs, padding is encapsulated within the last subPDU.Among the subheader fields are extension E, type T/T1/T2, reserved bits R, S field, BI, and RAPID. The contents of fallbackRAR and successRAR are defined in the standard. MAC RAR includes Timing Advance Command, UL Grant and Temporary C-RNTI. 

During random access procedure, MAC CEs are used to transfer C-RNTI and UE Contention Resolution Identity. 


### What's the structure of a 5G NR MAC PDU for the Sidelink Shared Channel?

SL-SCH MAC PDUs are not very different from DL-SCH or UL-SCH MAC PDUs. They too are contain one or more MAC subPDUs, each subPDU containing a subheader. Order of concatenation is same as in uplink: MAC SDUs, MAC CEs and padding. 

The main addition is the **SL-SCH subheader**. It's of fixed size (4 bytes) containing the following: 

    + **Version Number**: V field is of 4 bits. In Release 15 and 16, this is set to 0.
    + **Reserved**: There are 4 R bits set to 0 in the SL-SCH subheader.
    + **Source**: SRC field if 16 bits long and contains the 16 most significant bits of Source Layer-2 ID given by upper layers.
    + **Destination**: DST field if 8 bits long and contains the 8 most significant bits of Destination Layer-2 ID given by upper layers.SL-SCH subheader doesn't itself have an LCID field but the subheader of each MAC subPDU contains the LCID field. Values 4-19 indicate identity of the logical channel. LCID=62 is for Sidelink CSI Reporting. LCID=63 is for padding. eLCID field is not applicable for sidelink. 

## Milestones

Dec  
2017

3GPP publishes Release 15 "early drop". MAC specification TS 38.321 is upgraded to version 15.0.0. 

Mar  
2018

MAC specification version 15.1.0 is published. A change request titled *Introduction of MAC CEs for NR MIMO* adds many MAC Control Elements to this release.  

Jul  
2020

3GPP publishes Release 16 specifications. Changes include MsgB MAC PDU format and Absolute Timing Advance Command MAC CE for 2-step RACH procedure.