For layer 2 let us first take a look into the uplink.
Data transmission is handled through the protocol stack according to the following flow:
1. Data is generated by either signaling control protocols (RRC, NAS) or by some application on the UE’s IP stack. An associated chunk of bits is sent to layer 2 within the appropriate radio bearer.
2. The first protocol that handles the data frame is PDCP. For IP datagrams it will compress the IP (or IP/TCP, IP/UDP, IP/UDP/RTP) header according RFC 3095 (ROHC). Note that this is not applicable to signaling radio bearers. The second step within PDCP is encryption of the data packet.
3. Next comes RLC. For all radio bearers the associated RLC instance has to
perform segmentation or concatenation or padding to generate bit frames (RLC
PDU) that will fit into the transport channels. If the RLC entity of a radio bearer
works in acknowledged mode (AM), then the data is sent through the ARQ
function, which will buffer the packet in a retransmission buffer until the frame has been positively acknowledged. If the RLC entity is not in acknowledged mode, this step is obviously skipped.
4. RLC PDUs from all logical channels arrive then at the MAC protocol. Here the UE’s uplink scheduler has to decide, which logical channel will be served and multiplexed onto a transport channel. It is possible to combine several data units from different logical channels in one transport block, a multiplexer handles this.
5. The lower part of the MAC entity is the HARQ (Hybrid Automatic Retransmission on reQuest) entity. Note that only certain transport channel types (UL-SCH) can have this unit. Here the assembled transport block from the multiplexer will be stored in one of the HARQ’s buffers and simultaneously sent to the physical layer. If the eNB receives the transport block correctly, it will send an ACK indication via a special physical channel. This would delete the transport channel from the buffer. If no indication or a NACK indication is received, the HARQ entity will retransmit the transport block. Each retransmission can be done with different encoding in the physical layer. Therefore MAC will tell the physical layer, whether a transport block is new or is the nth retransmission.
6. The physical layer takes the transport block and encodes it for transmission on air.