Example of PDU session between UE and Data Network
A PDU session is a logical connection between UE to the 5GC (more precisely with UPF in the 5GC) that connects users to any Data Network (DN). The DN may be the internet, IMS, or any enterprise network.
There are two components of a PDU session:
The UE to NG-RAN connection is called Data Radio Bearer (DRB)
NG-RAN gNB to UPF connection in 5GC is an N3 tunnel.
The SMF manages the PDU session.
Each PDU session has its own N3 tunnel between NGRAN and 5GC. For example, if there are two PDU sessions, there would be two N3 tunnels.
One or more PDU sessions from a UE could be connected to the same UPF.
The data that flows through PDU session is mapped to a QoS Flow. QoS Flow determines how user packets are treated as per QoS requirements.
One PDU session can have multiple QoS flows. (QoS Flow is the lowest granularity of a traffic flow where QoS and charging can be applied. QoS Flow is identified by QFI within a PDU session.)
In the figure below, there are two QoS flows, hence two DRBs
(e.g. one QoS Flow for IMS, the other for a voice call). But there is only one N3 tunnel that transports both QoS flows. (N3 tunnel is established when a UE connects to a DN and is maintained till it goes idle.)
I have tried to create a flow diagram, read the text below and refer to the flow diagram as well side-by-side. It’s a complicated procedure which I have not fully understood yet. But following is a 1000-meter-high sky view.
PDU Session Establishment Flow
When a UE wants to connect with a DN to access services, it sends a NAS message PDU Session Establishment Request to AMF. This message includes Data Network name (DNN), Network Slice ID that UE wants to use, and the UE-generated PDU session ID.
Since SMF manages the PDU sessions, and hence AMF selects an SMF and sends a Create Session Management Context Request message. The SMF selection depends on multiple criteria like network clice, the DN UE wants service from, and load balancing decisions across several SMFs. (The AMF uses the NRF to select an SMF to serve this user.)
The SMF retrieves the user subscription data from the UDM. This information contains default PDU session policy parameters for the DN and the Network Slice associated with it.
Then SMF selects a PCF (again using AMF, NRF) and retrieves the default policy and charging rules and the QoS parameters that is needed for the PDU session.
SMF then allocates addresses like IP address or Ethernet MAC address for the UE for this PDU session and it selects the UPF that is going to serve the UE to connect to the DN. The SMF sends the QoS Flow Indicator (QFI) to UPF. The QFI identifies the data flow for the service and the QoS parameters that need to be enforced.
The UPF creates a tunnel endpoint ID (TEID) and sends the information back to the SMF. Now, one end of the tunnel between the gNB and UPF is created.
When the session management context is created, the SMF sends the session management context identifier to the AMF in the Create Session Management Context Response message. The SMF sends an N1N2 Message to the AMF which contains both N1 and N2 msgs destined for the UE and gNB, respectively. (The N1 msg is the session management NAS msg, PDU Session Establishment Accept. The N2 msg carries N3 tunnel information as well as QoS flow information for the gNB.)
The AMF forwards this info from SMF to the gNB. It also includes the UPF tunnel endpoint and the QoS parameters that need to be enforced at the gNB. Once the QoS flow and QoS rules reach gNB, the gNB creates a DRB. The gNB also forwards the NAS msg to the UE (over already created SRBs), with the allocated IP address and QoS params.
The UE accepts the DRB setup.
Now that a DRB is created between a UE and the gNB, the QoS is enforced and UE can start sending data in the Uplink direction over the DRB. The gNB forwards UL data to the known tunnel endpoint of the UPF and onto the DN.
The final step left is the gNB tunnel endpoint information to be sent to the gNB. The gNB assigns a tunnel endpoint ID for its side of the N3 tunnel and sends this info to the AMF, and SMF. (N3 tunnel exists between gNB and UPF over N3 interface). Then the SMF sends Session Modification msg to UPF on the N4 interface, informing the TEID of the gNB. (N4 interface exists between SMF and UPF).
The UPF can now pass DL packets from the DN to the UE thru the newly created N3 tunnel.
This completes the PDU session establishment and UE is now connected to the DN.