UPF vs SGW/PGW
In the original 4G EPC, user data passes through two gateways. The SGW (Serving Gateway) is the anchor while the UE moves between eNBs. The PGW (PDN Gateway) is the exit to the internet or IMS: it allocates the UE's IP address, enforces policy and produces charging data. Each gateway did both control and forwarding in one node.
Release 14 split them with CUPS (Control and User Plane Separation). SGW-C and PGW-C kept the signaling, SGW-U and PGW-U kept the packets, and a new protocol, PFCP, linked the halves over the Sxa and Sxb interfaces.
The 5G UPF (User Plane Function) is the direct descendant of SGW-U and PGW-U. It's one generic forwarding function that can play either role, or both, controlled by the SMF over N4, which is PFCP again. What 5G adds is flexibility in the path: several UPFs can be chained in one PDU session, with uplink classifiers and branching points sending some traffic to a local edge.
| Aspect | SGW / PGW (4G EPC, incl. CUPS) | UPF (5G Core) |
|---|---|---|
| Controlled by | Itself in the classic EPC; SGW-C and PGW-C over Sxa/Sxb with CUPS | The SMF, over N4 |
| Control protocol | GTPv2-C on S11 and S5/S8; PFCP on Sx with CUPS | PFCP on N4 (TS 29.244) |
| From the RAN | S1-U from the eNB to the SGW (GTP-U) | N3 from the gNB to the UPF (GTP-U) |
| Between user-plane nodes | S5 (home) or S8 (roaming) between SGW and PGW | N9 between UPFs, for chaining and home-routed roaming |
| To the data network | SGi, from the PGW | N6, from the anchor (PSA) UPF |
| Tunnel granularity | One GTP-U tunnel per EPS bearer | One N3 tunnel per PDU session; QoS flows marked by QFI inside it |
| Mobility anchor | SGW for moves between eNBs; the PGW keeps the IP address | The PDU Session Anchor (PSA) UPF; the SMF adds an intermediate UPF when needed |
| Local breakout | By choosing a nearby gateway (SIPTO), for the whole PDN connection | An uplink classifier or IPv6 branching point sends selected traffic to a local PSA |
| Downlink data for an idle UE | SGW buffers it and sends a Downlink Data Notification to the MME | UPF reports to the SMF over N4; the SMF asks the AMF to page |
From gateways to one forwarding function
The SGW and PGW were defined as nodes with jobs. The UPF is defined as a function that follows rules. Over N4 the SMF installs a set of rules per PDU session, and the UPF applies them to every packet:
- PDR (Packet Detection Rule): which packets this is about, matched on tunnel, IP 5-tuple or application.
- FAR (Forwarding Action Rule): forward, drop, buffer or notify the SMF, and where to send the packet.
- QER (QoS Enforcement Rule): gating, rate limits and QFI marking.
- URR (Usage Reporting Rule): volume and time counts for charging.
The same rule types already existed in CUPS for SGW-U and PGW-U. That's why vendors often ship one user-plane product that runs as SGW-U, PGW-U and UPF at once; in a combined core you'll see a PGW-U+UPF behind an SMF+PGW-C, serving LTE and 5G sessions from the same box. When a PFCP Session Establishment fails, the cause and the rule IDs in the response usually point straight at the misconfigured piece.
Chaining UPFs: ULCL, branching points and N9
In 4G, a PDN connection has one PGW and all its traffic leaves there. In 5G, one PDU session can pass through several UPFs joined by N9, and the SMF decides the topology.
The PDU Session Anchor (PSA) is the UPF that faces the data network over N6 and holds on to the UE's IP address. When the UE moves far from it, the SMF can insert an intermediate UPF near the new gNB, much as an SGW worked in LTE.
For edge computing, the SMF can add an uplink classifier (ULCL): a UPF that inspects uplink traffic and sends packets for chosen destinations to a local PSA at the edge, while everything else continues to the central PSA. For IPv6 multi-homing, a branching point does a similar job based on the source prefix. The UE sees none of this. Its traffic to a local MEC server simply takes a shorter path.
Where you will meet them
Most live networks run both. A 5G NSA user's data goes from the eNB or en-gNB to the SGW-U and PGW-U, because NSA uses the EPC. A 5G SA user's data goes from the gNB to a UPF over N3. Converged products blur the line, but the interfaces in your trace tell you which world you're in: S1-U and S5 are EPC, N3 and N9 are 5GC.
When users report "connected but no data," the user plane is where to look. Check that the GTP-U tunnel IDs (TEIDs) match at both ends of S1-U or N3, that the PFCP session exists with the expected rules, and that the UPF's N6 routing reaches the data network. GTP-U uses UDP port 2152 and PFCP uses UDP port 8805, which makes both easy to filter in a capture.
The bottom line
The UPF replaces both SGW-U and PGW-U, not just one of them. In 4G you had two gateways with fixed roles. In 5G you have one function that the SMF places wherever it's needed: an anchor in the core, an intermediate UPF near the RAN, a classifier at the edge. The control protocol barely changed, since PFCP came from CUPS. If you've worked on CUPS, you already know half of the UPF. The new half is the topology.
Frequently asked questions
- Does 5G have an SGW?
- Not as a separate node. The UPF covers the SGW user-plane job. When a UE moves out of range of its anchor UPF, the SMF can insert an intermediate UPF, which plays much the same role an SGW played in LTE.
- What is PFCP?
- The Packet Forwarding Control Protocol, defined in TS 29.244. It runs over UDP port 8805 between a control function and a user-plane function: on Sxa and Sxb in 4G CUPS, and on N4 between the SMF and the UPF in 5G.
- What is the difference between N3 and N9?
- N3 connects the gNB to a UPF. N9 connects two UPFs, for example an intermediate UPF to the anchor UPF, or a visited UPF to a home UPF in roaming. Both carry user data in GTP-U tunnels.
- What is a ULCL?
- An uplink classifier: a UPF that the SMF inserts into a PDU session to send uplink traffic for selected destinations to a local anchor UPF, typically for edge computing, while the rest goes to the central anchor.
- What was CUPS in 4G?
- Control and User Plane Separation, introduced in Release 14. It split the SGW and PGW into control parts (SGW-C, PGW-C) and user-plane parts (SGW-U, PGW-U), linked by PFCP. The 5G SMF and UPF follow the same idea.