# 5G NR MAC

## Summary


The MAC sublayer of 5G NR protocol stack interfaces to RLC sublayer from above and PHY layer from below. It maps information between logical and transport channels. Logical channels are about the type of information carried whereas transport channels are about how such information is carried. 

Data on a transport channel are packaged into **Transport Blocks (TBs)** whose configuration are determined by **Transport Formats (TFs)**. A transport block has a dynamic size. Except in some scenarios, only one transport block is transmitted by MAC in an interval called **Transmission Time Interval (TTI)**. 

MAC is configured by RRC layer. In the simplest case, a UE has a single MAC entity. However, there are some scenarios when a UE has multiple MAC entities. MAC sublayer is specified from a UE perspective in TS 38.321.

## Discussion

### What logical/transport channels are relevant to 5G NR MAC?

Transport channels are the Service Access Points (SAPs) between MAC and PHY. Likewise, logical channels are the SAPs between RLC and MAC. In other words, MAC sublayer provides data transfer services on logical channels based on type of information carried, and uses transport channels to interface to PHY. 

MAC handles the following channels, mentioned here as "transport channel (logical channels)": 

    + **Uplink**: RACH (-), UL-SCH (CCCH, DCCH, DTCH)
    + **Downlink**: BCH (BCCH), PCH (PCCH), DL-SCH (BCCH, CCCH, DCCH, DTCH)
    + **Sidelink**: SL-BCH (SBCCH), SL-SCH (SCCH, STCH)RACH has no mapping to a logical channel since its information originates/terminates at MAC. In fact, RACH doesn't carry any transport blocks. BCCH is a logical channel that maps to either BCH or DL-SCH. Traffic channels include DTCH and STCH, all others being control channels. 


### Which are the main functions of 5G NR MAC?

RLC need not worry about when and how data is transmitted on the air interface. Data transfer and radio resource allocation is the job of MAC. 

In the transmit direction, MAC sublayer maps logical channels coming from RLC sublayer to transport channels going to PHY layer. Multiple logical channels can be multiplexed within a transport block. In the receive direction, MAC does demultiplexing. 

Other than multiplexing/demultiplexing MAC SDUs, MAC also has in-band signalling. These are called MAC Control Elements (CEs). In fact, MAC CEs and MAC SDUs can be multiplexed in a single MAC PDU. 

In the downlink, a UE is informed on PDCCH about an imminent scheduled transmission on DL-SCH. In the uplink, UE MAC must first make a Scheduling Request (SR) on PUCCH. UE typically gets a grant on PDCCH or Random Access Response. Semi-persistent grant via RRC signalling is also possible. 

MAC also does scheduling information reporting, error correction through HARQ, logical channel prioritisation, dynamic scheduling across UEs (DL only), and priority handling between overlapping resources of one UE. 


### Which are the main procedures of 5G NR MAC?

When a UE is making its initial access to the network, **Random Access** procedure is essential. This procedure is also invoked in many other scenarios. It's of type 4-step or 2-step. Each type can be Contention-Based Random Access (CBRA) or Contention-Free Random Access (CFRA). 

Random access procedure establishes timing advance, so that uplink transmission is properly time-aligned when it reaches gNB. Maintenance of this **uplink time alignment** is another procedure. 

**Data transfer** in downlink and uplink channels involve DL assignments, UL scheduling requests and UL grants. Data transfer involves multiplexing/demultiplexing of data, prioritization, and retransmission and error correction due to HARQ. Similar procedures exist for sidelink channels. 

MAC CEs enable **signalling**. Examples include activation/deactivation of SCells, activation/deactivation of PDCP duplication, recommending bit rates to the UE, and many more. 

UE also **reports** buffer status and power headroom to help gNB make resourcing decisions. 

Discontinuous Reception (DRX), Bandwidth Part (BWP) switching, reset/reconfiguration, beam failure detection and recovery, handling measurement gaps, data inactivity monitoring are some more MAC procedures.  


### When can a 5G UE have multiple MAC entities?

If a 5G UE is connected to the Master Cell Group (MCG) and the Secondary Cell Group (SCG), then there's a MAC entity for each cell group. Each entity operates independently, that is, their serving cell, timers, parameters, radio bearers, logical channels and HARQ entities are all independent. 

Dual Connectivity (DC) is a feature in which a UE can be connected to both MCG and SCG. For example, MCG could be an 4G/LTE cell and SCG could be a 5G NR cell. Another scenario is Dual Active Protocol Stack (DAPS) handover in which there's one MAC entity for the source cell and one for the target cell. 

A single MAC entity can support multiple numerologies, transmission timings and cells. However, RRC can restrict the mapping of a logical channel to a subset of cells, numerologies or other configurations. This is one way to reduce latency to serve URLLC services. 


### What's the role of 5G NR MAC in Carrier Aggregation?

MAC plays an important role in Carrier Aggregation (CA). It distributes MAC PDUs and CEs across different Component Carriers (CCs) and generates one TB per TTI per CC. Moreover, each CC has its own HARQ entity within MAC. 

Though CA involves multiple carriers or cells, they all come under the same cell group. A single MAC entity serves all cells involved in CA within the cell group. Aggregation happens over one Primary Cell (PCell) and one or more Secondary Cells (SCells). Within a single MAC entity there can be multiple instances of transport channels: one DL-SCH, UL-SCH and RACH for Special Cell (SpCell); one DL-SCH per SCell; and optionally one UL-SCH and RACH per SCell. SpCell is the PCell of either MCG or SCG. This implies that CA can be combined with DC. 


### In 5G NR, what do you mean by High-MAC and Low-MAC?

In practical deployments, a 5G base station or gNB is not a monolith located at the cell site. It's often disaggregated into Radio Unit (RU), Distributed Unit (DU) and Centralized Unit (CU). 5G allows multiple ways in which gNB functions can be split across RU, DU and CU. 

One way is to split MAC sublayer into two parts: High-MAC and Low-MAC. Such a split is called **Intra-MAC Split (Option 5)**. With this split, High-MAC, RLC, PDCP and RRC will be in the CU. Low-MAC will be in the DU. The DU-CU interface is commonly called **midhaul**. 

Multiplexing/demultiplexing are done in High-MAC. High-level scheduling decisions are part of High-MAC. Inter-cell interference coordination as needed in CoMP can be done in High-MAC in a more centralized manner. Time-critical processing such as HARQ, random access control, scheduling-related information processing and reporting are in Low-MAC.  

## Milestones

Apr  
2017

3GPP publishes version 0.0.1 of MAC specification TS 38.321. By September, this evolves to version 1.0.0. 

Dec  
2017

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

Jun  
2018

3GPP publishes Release 15 "main drop". MAC changes part of this release include beam failure recovery timer, prioritized random access, and PDCP duplication. 

Dec  
2018

In version 15.4.0 of MAC specification, **data inactivity timer** is introduced. 

Jul  
2020

3GPP publishes Release 16 specifications. Main MAC enhancements or additions in this release include Integrated Access and Backhaul (IAB), dormant BWP operation, eMIMO, 2-step RACH procedure, New Radio Unlicensed (NR-U), eURLLC, Industrial IoT, UE power saving, V2X with NR Sidelink, NR positioning, and a new MAC subheader for MAC CEs.