# ATM Adaptation Layer 2

ATM Adaptation Layer 2 (AAL2) is an Asynchronous Transfer Mode (ATM) adaptation layer, used primarily in telecommunications; for example, it is used for the Iu interfaces in the Universal Mobile Telecommunications System, and is also used for transporting digital voice. The standard specifications related to AAL2 are ITU standards I.363.2 and I366.1.

## What is AAL2?

AAL2 is a variable-bitrate connection-oriented low-latency service originally intended to adapt voice for transmission over ATM. Like other ATM adaptation layers, AAL2 defines segmentation and reassembly of higher-layer packets into ATM cells, in this case packets of data containing voice and control information. AAL2 is further separated into two sub-layers that help with the mapping from upper-layer services to ATM cells. These are named Service Specific Convergence Sub-layer (SSCS) and Common Part Sub-layer (CPS).
The AAL2 protocol improves on other ATM Adaptation Layers, by packing lots of small packets efficiently into one standard-sized ATM cell of 53 bytes. A one-byte packet thus no longer has an overhead ratio of 52 unused bytes out of 53 (i.e. 98%). Potentially, total of 11 one-byte CPS packets (plus 3/4 of a 12th CPS packet) could squeeze into a single cell. Of course, CPS packets can come in other sizes with other CIDs, too. When the transmission is ready, the CPS packets are all multiplexed together into a single cell and transported over standard ATM network infrastructure.
The transport networks for ATM are well standardized fiber optic (SDH/Sonet, i.e. STM-1/OC-3 or higher) or copper cable (PDH, i.e. E1/T1/JT1 or higher bandwidth fixed lines) based synchronous networks with built-in redundancy and OAM-related network features which Ethernet networks never had originally (in order to keep things simple) but are sorely missed in metro Ethernet standard networks.
Efforts to improve Ethernet networks are in a sense trying to reinvent the wheel à la ATM. AAL2 is one example of a useful benefit of ATM, as a general standard for Layer 2 protocols. ATM/AAL2's efficient handling of small packets contrasts with Ethernet's minimum payload of 46 bytes vs the 1-byte minimum size for an AAL2 CPS packet.
AAL2 is the standard layer 2 protocol used in all Iu interfaces, i.e. the interfaces between UMTS base stations and UMTS Radio Network Controllers (RNCs) (Iu-B), inter-RNCs (Iu-R), UMTS RNCs and UMTS Serving GPRS Support Nodes (SGSNs) (Iu-PS), and UMTS RNCs and media gateways (MGWs) (Iu-CS).

## AAL2 and the ATM Cell

The basic component of AAL2 is the CPS packet. A CPS packet is an unanchored unit of data that can cross ATM cells and can start from anywhere in the payload of the ATM cell, other than the start field (STF). The STF is the first byte of the 48-byte ATM payload. The STF gives the byte index into the ATM cell where the first CPS packet in this cell begins. Byte 0 is the STF. The data from byte 1 ... (STF+1), would be the straddled remainder of the previous ATM cell's final CPS packet. If there is no remainder from the previous cell, the STF is 0, and the first byte of the cell after the STF is also the location of the start of the first CPS packet.
The format for the 1 byte STF at the beginning of the ATM cell is:
* 6 bits - offset field (OSF)
* 1 bit - sequence number (SN)
* 1 bit - parity (P)

### OSF

The Offset Field carries the binary value of the offset, in octets, between the end of the P bit and the start of the CPCS-PDU Payload. Values of greater than 47 are not allowed.

### SN

The Sequence Number numbers the stream of CPCS-PDUs.

### P

The Parity bit is used to detect error in the OSF and SN fields.
If the ATM cell has fewer than 47 bytes, the remainder will be filled by padding.

## AAL2u

One common adaptation of AAL2, AAL2u, doesn't use the STF field at all. In this case, one single CPS packet is aligned to the beginning of the cell. AAL2u is not used in standardized interfaces, but rather in proprietary equipment implementations where the multiplexing/demultiplexing, etc. that needs to be done for standard AAL2 either is too strenuous, is unsupported, or requires too much overhead (i.e. the 1 byte of STF) from the internal system's point of view. Most computer chips do not support AAL2, so stripping this layer away makes it easier to interwork between the ATM interface and the rest of the network.

## ATM AAL2 Cell Diagram

The following is diagram of the AAL2 ATM cell:

## AAL2 and the CPS Packet

A CPS packet has a 3-byte header and a payload of between one and 45 octets. The standard also defines a 64-octet mode, but this is not commonly used in real 3G networks.
The 3-byte CPS header has following fields:
* 8 bits - channel identifier (CID)
* 6 bits - length indicator (LI)
* 5 bits - user to user indication (UUI)
* 5 bits - header error control (HEC)

### CID

The Channel Identifier identifies the user of the channel. The AAL2 channel is a bi-directional channel and the same channel identification value is used for both directions. The maximum number of multiplexed user channels is 248. As some channels are reserved for other uses, such as peer-to-peer layer management.
CE : Channel Element CID = CE -E + ID

### LI

The Length Indicator indicates the length (in number of octets) of the CPS information field, and can have a value between 1 and 45 (default) or sometimes between 1 and 64. For a given CID all channels must be of the same maximum length (either 45 or 64 octets) NB: the LI is one less than the actual length of the payload, so 0 corresponds to the minimum length of 1 octet, and 0x3f to 64 octets.

### UUI

User to User Indication conveys specific information transparently between the users. For example, in SSSAR, UUI is used to indicate that this is the final CPS packet for the SSSAR PDU.

### HEC

This is Header Error Control and checks for errors in the CID, LI and UUI fields. The generator polynomial for the CPS HEC is:
$G(x)=x^{5}+x^{2}+1$

## ATM AAL2 CPS Packet Diagram

The following is a diagram of the CPS packet: