What Are MAC Queues/Buffers?
At its heart, a MAC (Medium Access Control) buffer is a temporary storage area where data packets wait before being transmitted over the radio interface. Think of it like a post office sorting room — letters (data packets) arrive from different senders (upper layers like RLC), get sorted by priority, and are sent out in a controlled, organized manner rather than all at once.
The MAC layer sits between the RLC (Radio Link Control) layer above it and the PHY (Physical) layer below it. Since the radio channel can only carry a limited amount of data per time interval, the buffer acts as a “waiting room” that holds excess data until the scheduler decides to send it.
The Protocol Stack Context
To understand why buffers exist, you need to picture the LTE/5G protocol stack layers:
- PDCP (top) — handles compression and security.
- RLC — handles segmentation/reassembly and retransmissions.
- MAC — handles scheduling, multiplexing, and buffer management ← we are here.
- PHY — handles actual radio transmission.
Data flows downward from PDCP → RLC → MAC → PHY. The RLC layer breaks large packets into segments and feeds them into MAC buffers. The MAC scheduler then reads from these buffers and decides when, how much, and to whom to transmit each subframe (every 1 ms in LTE).
Logical Channels and Separate Queues
Not all data is treated equally. The MAC layer organizes data by Logical Channels, which represent different types of traffic (e.g., signaling, voice, video, web browsing). Each logical channel gets its own dedicated queue/buffer.
Key logical channel types:
- CCCH (Common Control Channel) — for signaling when a device first connects.
- DCCH (Dedicated Control Channel) — for device-specific control messages.
- DTCH (Dedicated Traffic Channel) — for actual user data (voice, video, etc.).
This separation ensures that high-priority control messages are never stuck behind a large video download waiting in the same queue.
Logical Channel Groups (LCGs)
Because reporting the status of every individual logical channel separately would waste overhead, the standard groups them into Logical Channel Groups (LCGs). In 5G NR, a UE can have up to 8 LCGs, and each LCG bundles logical channels of similar priority together.
For example:
- LCG 0 — Signaling/control messages (highest priority).
- LCG 1 — Voice data.
- LCG 2 — Web browsing / video streaming.
- LCG 3+ — Background downloads (lowest priority).
The MAC scheduler at the base station (eNB/gNB) sees the buffer occupancy per LCG, not per individual channel. This allows it to make smart decisions about which type of traffic to serve first.linkedin+1
Buffer Status Report (BSR) — The “I Have Data!” Signal
This is one of the most important concepts. In the uplink direction (UE → base station), the base station has no idea how much data is sitting in your phone’s buffer. To solve this, the UE sends a Buffer Status Report (BSR) — a small MAC control message that says: _“Hey gNB, I have X bytes waiting in my uplink buffer, please give me radio resources to transmit them.”
BSR Types
| BSR Type | When Used | Coverage |
|---|---|---|
| Short BSR | Only one LCG has data | Reports 1 LCG using 5-bit field (up to ~150,000 bytes) |
| Long BSR | Multiple LCGs have data | Reports all LCGs using 8-bit field (up to ~81 MB) |
| Short Truncated BSR | Multiple LCGs have data, but only room for a short report | Reports only the highest-priority LCG |
| Periodic BSR | Sent at regular timer intervals | Keeps gNB updated even when no new data arrives |
A BSR is triggered when new uplink data arrives in a higher-priority LCG, when the retxBSR-Timer expires, or when there is padding space available in an uplink transmission.
The Scheduler Reads the Buffer
Once the gNB receives a BSR, its MAC scheduler knows how much data each UE has pending. The scheduler then decides:
- Who gets radio resources (which UE).
- How many Resource Blocks (RBs) to allocate.
- When to schedule the transmission (which subframe/slot).
The scheduler sends a UL Grant back to the UE authorizing it to transmit a certain number of bytes. The UE then pulls exactly that many bytes from its buffer and sends them.
In the downlink direction (base station → UE), the eNB/gNB already knows how full its own buffers are, so no BSR is needed — the scheduler directly reads the RLC buffer occupancy per UE and decides scheduling.
What Happens When a Buffer Gets Too Full?
Buffer overflow is a real problem. When too much data arrives faster than the radio channel can transmit it, the buffer fills up. Consequences include:
- Packet drops — new packets are discarded when the queue is full.
- High latency (bufferbloat) — packets sit in the queue for a long time, causing delay-sensitive applications (like voice or gaming) to suffer.
- Congestion — overflow can cascade and degrade overall network performance.
To combat this, techniques like Active Queue Management (AQM) are used in the RLC buffer. AQM proactively drops or marks packets before the buffer becomes completely full, signaling congestion early and preventing worst-case delay spikes.
Virtual Buffers vs. Real Buffers
In implementations (like in simulation frameworks), there are often two types of buffer structures:
- Real MAC buffer (
mbuf_) — holds the actual packet data waiting to be transmitted. - Virtual buffer — holds only lightweight metadata (packet size, timestamp) used to quickly calculate buffer occupancy for scheduling decisions without copying full packets around.
This is a performance optimization: the scheduler only needs to know how much data is pending (from the virtual buffer), not actually touch the raw data until transmission time.
Summary of the Full Flow
Here is the end-to-end picture for uplink data:
- An app on your phone generates data → it goes down through PDCP → RLC → arrives at the MAC buffer, organized by logical channel.
- The MAC layer groups logical channels into LCGs and tracks how full each LCG’s buffer is.
- When the buffer fills above a threshold, MAC sends a BSR to the gNB: “I have N bytes to send”.
- The gNB’s MAC scheduler evaluates the BSR alongside all other UEs’ requests, channel quality, and QoS requirements.
- The gNB sends a UL Grant back: “You may transmit X bytes in slot Y”.
- The UE pulls X bytes from its MAC buffer and transmits them via the PHY.