For AI agents: this documentation is indexed for you in llms.txt, and all of it in /llms.txt. Every page is also available as markdown: append .md to its address.

3GPP Procedures

The behaviour of GPC procedures, primarily during node restart or peer nodes restart, are documented here. The procedures described here are broadly based on the 3GPP TS 23.007 v16.1.0 Standard. See Chapter 20 for some more information on the Path Management procedures. For the 5G Restoration procedures see 3GPP TS 23.527 v16.2.0.

Note that the document below refers to GTPv2 implementation. Nevertheless, the same mechanism applies to GTPv1. Any special handling of GTPv1 will be explicitly stated.

Context Path Binding & Monitoring

For every SMC GTP interface, a path interface keeps a track of all the GTP context instances. Every context initiated with a GTPv2 Create Session Request (CSReq) is tracked on each GTP port path interface. Therefore, in a GTP-Proxy mode a GTP context will be tracked on the incoming and the outgoing interface.

A GTP Path is primarily identified by the following parameters

  1. GTP Entity
  2. GTP version v1 or v2
  3. Peer IP Address

Once a single GTP context instance (i.e CSReq or CPCPCReq) has been registered on a path it is marked as active (“UP”) and echo messages are initiated towards that interface.

Reception of the optional recovery counter in SMC messages

The recovery restart counter is an optional parameter in GTPv2 messages including CSReq / CSResp. It is usually send when contacting a peer node for the first time (primarily at startup / after restart)

(V)PLMN side restart scenario

If a recovery restart counter is received in an incoming CSreq message from the ingress side (SGW) that is higher than the current stored counter, then it is assumed that the remote incoming peer have restarted. In this case the existing sessions contexts registered on the incoming path are cleared (not monitored) and “Delete Session Requests (DSReqs)” indicating "network failure" are sent to the PGW side.

EPC side restart scenario

In this case when the PGW has restarted, it is possible to receive a CSResp response from the outgoing side with a recovery restart counter.

If this counter is higher than the current stored counter, then it is assumed that the remote outgoing peer is deemed to have restarted.

In this situation, existing registered impacted sessions (contexts) on the path are cleared (not monitored) and “Delete Bearer Requests (DBReqs)” requesting reactivation are sent to the incoming side. The Delete Bearer Requests will eventually trigger delete session requests from Access (MVO) and close the session contexts.

In both the above scenario examples, the corresponding PFCP Sx U-Node connections will also be closed down.

The GTP path reset as the session contexts linked to it are cleared.

The path reset will store a new update restart counter received from the remote peer (first SMC message or echo message) and register subsequent messages.

If no restart counter is received in the GTPv2 messages, the current restart counter value is assumed.

For an active path interface, when a session has ended normally it is deregistered from the paths that are monitoring it and removed.

Echo requests sent to peers

Echo requests are sent to all the peer nodes on both the (V)PLMN and the Mobile Core side.

The echo request is constructed as follows (see 3GPP TS 23.007, section 20.2.1).

Each node is responsible for storing the peer node recovery restart counter it received in the incoming echo request or the echo response message.

Similarly, the echo request / echo response sent out to a peer node will contain the sending node's own recovery restart counter.

There has to be at least one session on the connection path for an echo request to be sent. Having no sessions on the path may be because it is not used any more, hence no point of sending echos on it. Echo sending is restarted one we have sessions on it.

Echo requests timeout

If the number of retries per echo request exceeds the N3 value, the peer node is deemed to be down.

All the sessions linked to that peer node obtained from the path interfaces (see previous section) are cleared and sending of Echo Request to that path is stopped until a new first message is received / sent on that connection. See above.

Depending on which path interface the echo requests have expired the same clean up procedure is performed as follows:

  1. Echos timeout towards the ingress (SGW) interface: DSReq are sent to the egress peer PGW nodes. Note that the DSReq will also remove the session contexts being monitored on the outgoing (egress) interface path towards the GPC.

  2. Echos timeout towards the egress (PGW) interface: DBReq are sent towards the ingress peer SGW node. Note that the DBReq will initiate removal of the session context being monitored on the incoming (ingress) path towards the SGW. The subsequent DSReq received from the ingress SGW will clear the session context from the ingress interface monitoring path.

Please note that in this case the restart counter of the remote node is set to an undefined state as we do not know what the value is. The peer recovery restart counter in the first new SMC message / Echo received in the GTP path interface will be set as the new value.

Echo Response received with updated counter value

Handling is the same as the echo requests timeout except that the incremented recovery restart counter value received in the echo response is used to reset the path and initiate clearing of the linked session contexts.

Echo requests received from peers

Handling is similar to the section Echo Response received with updated counter value, except that the peer recovery restart counter is received in the echo request message for GTPv2. No recovery restart counter is received in the echo request in GTPv1 protocol.

Restart

When the SMC node restarts all existing sessions are cleared and path reset by default and the SMC recovered restart counter (persistent) is updated. Therefore when the echo requests are started towards all the peer nodes, the new updated recovery restart counter is sent.

New paths to monitor GTP instances will be created on all the interfaces.

Note that the echo requests are only started after the first SMC message is received or sent on the interface.

Path Maintenance Procedures

There are two scenarios when Path Maintenance is required for egress connections to the PGW: path active but idle, and path down.

Path active but idle

All sessions on a particular path are tracked. For active outgoing paths, if no sessions are present on it for a specified duration, the path is assumed to be taken out of use and deregistered. This can happen if the DNS has changed the outgoing PGW destination IP address.

Echos are sent regular intervals when the active path is idle.

Path down

When a path goes down all sessions linked to the path are cleared as explained earlier and the down path is then monitored. No further sessions can be sent to the down path. The path will be monitored for a set peer down duration (timeout). If it does not come up in a specified amount of time then it is deregistered.

If DNS lookup is used to get the IP of the outgoing node then it is possible that the down node has been taken out of service.

If configuration is used to define the outgoing node then, after the end of downtime duration (timeout), an attempt will be again made to communicate with the down node.

If the node is still down, the peer down duration timer will restart again and the monitoring process will restart again. If the node comes up within the monitored duration time, then sending of GTP session traffic will again be initiated towards this node.

Path Maintenance configuration

The following parameters control the path maintenance configuration. All of them are relative to the pathManagement.{state} path, where state can be idle, busy, suspect, down. Please refer to the chart configuration for a detailed description.

The following table shows the defaults that the chart sets. All states use a t3 of 10000 ms and an n3 of 5.

With these defaults, an ICMP error does not change the state of a path, and a path never enters suspect. A path goes down only when a peer does not answer an Echo Request after n3 retransmissions.

Load Balance as GTP-Proxy-Controller

SMC supports load balancing across more than one outgoing peer PGW node.

The selection of the outgoing peer PGW nodes is based on an inbuilt Erlang random algorithm.

Draining of ongoing sessions linked to the downed peer node is already supported as per TS 23.007 Restoration Procedures guidelines See chapter 10 (Restoration of data in the GGSN), chapter 17 (Restoration of data in the PGW), chapter 18 (SMC based restart procedures) and Chapter 20 (Path Management Procedures) in the standard.

As specified in section 20.2.1 of chapter 20, the sessions to the peer PGW down node are cleared immediately. Keep of session alive to a PGW node for specified time period in case it recovers (e.g after restart) is not considered due to charging implications.

SMC receives GTPv1 and GTPv2 messages from the SGW, which are then distributed randomly to the outgoing PGW peer nodes.

The following section describe the actions to take on various load distribution scenarios:

  • No response is received for a SMC message from the outgoing peer
  • No responses received after set number of Echos have been sent to the outgoing peer PGW node for GTPv2
  • Echo request is received with restart counter incremented from the outgoing PGW peer after the draining for sessions has been initiated by the GPC itself
  • Echo request is received with restart counter incremented from the outgoing PGW peer by GPC and no draining of the session to that down PGW peer node have been initiated
  • Send of new traffic when the one of the nodes is down
  • One node down and SMC restart happens
  • Monitoring of down node

Scenario: No response is received for a SMC message from the outgoing peer

It is recommended in the standards (TS 23.007, chap 20) that for

GTPv1: Echo requests are sent periodically,

GTPv2: Echo request should only be sent if no response for a previous SMC message has not been received. It is not implemented today.

The sending of echo requests is implementation specific. Current mechanism in ergw is an Echo request with T3 = 10 seconds (response time) and N3 is set to 5. The echos requests are sent every 60 seconds to the active PGW node

Scenario: No responses received after set number of Echos have been sent to the outgoing peer PGW node for GTPv2

Clear all sessions linked to the down outgoing peer only as follows:

Send a Delete Bearer Request to the Ingress access side requesting reactivation.

Upon reception of a Delete Session Request, the sessions, only the PFCP Sx connection is release (PFCP Session Delete Request) and no forward delete session is sent in this case.

Echo requests from then on are sent less frequently to check if and when the node has come up for a specified duration after which the node is deemed to be down.

Scenario: Echo request is received with restart counter incremented from the outgoing PGW peer after the draining for sessions has been initiated by the GPC itself

When a successful echo request / response is received from the down node, the recovery counter is updated if it has been incremented and traffic is sent to it again.

New sessions are sent to the restarted active outgoing peer PGW node until all the old sessions linked to the node before restart are being cleared.

Scenario: Echo request is received with restart counter incremented from the outgoing PGW peer by GPC and no draining of the session to that down PGW peer node have been initiated

Increment the remote restart counter linked to the outgoing peer.

Clear existing sessions to the outgoing peer.

Send a Delete Bearer Request to the Ingress access side requesting reactivation. Upon reception of a Delete Session Request, the sessions, the PFCP Sx connection is released (PFCP Session Delete Request) and no forward delete session is sent in this case.

No change of state should take place in this case and new sessions should be sent to the outgoing peers.

Scenario: Send of new traffic when the one of the nodes is down

Once a remote peer PGW node has gone down, all traffic should be distributed to the working remote peer PGW nodes.

Only after the down node comes up, should traffic be sent to it.

Scenario: One node down and SMC restart happens

Do nothing.

Let the SMC attempt to send traffic to all outgoing peers.

Scenario: Monitoring of down node

Infrequent echo will be sent to it for a specified duration, e.g 2 hours. After that the path is cleared. It may be possible that the outgoing peer is not valid and removed. If the path is still valid but down, then the monitoring of the outgoing peer will start again.

Path Management Procedures

The SMC will only try to send GTP requests to GTP peers that it deems to be alive based on:

  • the result of previous GTP-C Echo Request/Response exchange
  • the reception of a valid GTP-C message from that peer

The SMC uses the procedure laid out in TS 23.007, clause 20.2.1 to determine if a peer down:

A peer's IP address specific counter shall be reset each time an Echo Response message is received from that peer's IP address and incremented when the T3-RESPONSE timer expires for an Echo Request message sent to that peer's IP address. The path shall be considered to be down if the counter exceeds N3-REQUESTS.

New GTP-C Peer

A GTP entity is considered to be new when the SMC has no state information about it. Whenever the SMC learns about a new possible GTP peer either through configuration or an API response (DNS, NF-selection, ...) it will immediately attempt to establish the liveliness of that peer by sending a GTP-C Echo Request.

GTP Context establishment will progress as soon as one of the possible candidates has been detect to be alive. It does not wait for any remaining new peers.

Known GTP-C Peer

For GTPv1-C peers the SMC periodically sends an Echo Request message, the resulting Echo Response (or lack thereof) is then used to determine the liveliness of the peer. Reliable delivery is done in accordance with 3GPP TS 29.060Opens in a new tab. A failure to respond to Echo Request after N3-REQUESTS triggers an error indication.

For GTPv2-C peers the SMC periodically sends an Echo Request message, the resulting Echo Response (or lack thereof) is then used to determine the liveliness of the peer. Reliable delivery is done in accordance with 3GPP TS 29.274Opens in a new tab. A failure to respond to Echo Request after N3-REQUESTS triggers an error indication.

The recommendation to send Echo Requests to GTPv2-C peers only after no message has been received from that peer is not implemented in this version.

GTP-C peer state

A known GTP-C peer can be different states. The interval of sending Echo Requests (echo interval) and the response to missing Echo Responses can be configured per state.

Outgoing GTP-C requests from the SMC to a peer first obtaine a lease from the peer state. Only if that lease is granted, a request can be sent.

Events that trigger state transitions are:

  • state timeouts
  • problem indications (missing GTP response, ICMP Error indication),
  • changes to the number of active GTP context established with that peer

The values for any timeouts, the T3-TIMEOUT and N3-REQUESTS settings are configurable per state and can be overriden on a per peer IP address basis.

For this version known problem indications are icmp_error and echo_timeout. The classification of indication severities of type critical (requiring a immediate action), warning (actions are delayed pending verification of the peers states) and info is configurable.

Note:

In this version, problem indication are only logged at level debug. This is done to ensure that a peer can not overwhelm our logging by accidentally or intentionally triggering large amounts of log messages.

States:

  • idle

    A peer is idle when the SMC does not have any active contexts established with it. Echo Requests are being sent in this state. The peer process and all state information about the peer is removed after state timeout. Any GTP-C message (other that a Echo Request or Response) from that peer restarts the state timeout. Granted leases will prevent a state timeout from removing the peer, however they will not extend the state timeout beyond the end of the request. However, a GTP-C answer message will (see above). Any GTP request or response from a peer other than Echos will keep a peer in this state. This ensures that any peer that acts a pure message router, but does not manage contexts, will not be removed.

  • busy

    A peer is busy when the SMC has determined that it is alive and it has active contexts established with it. This state has no timeout and only transitions to another state when either all context are removed or a problem indication is triggered.

  • down

    A peer transitions into the down state when a problem indication with severity critical is triggered. This transition removes all context that have been established with that peer. Echo Requests are being sent in this state. All information about the peer is removed after a configurable state timeout. The reception of any GTP-C message from that peer after the peer went down triggers a transition into idle. For details, see Messages received before a path went down.

    Sending any kind of GTP-C Request except for Echo and Delete on path that is down is not possbile (no 'lease' will be granted. Any attempt by GTP context to do so, will terminate that context. This is safety mechanism to prevent context from getting stuck.

  • suspect

    A peer enters the suspect state when a problem indication with severity warning is triggered. Echo Request are being sent in this state. A peer transitions to down after state timeout. A Echo Response triggers a transitions to either idle or busy (depending on whether there are context established or not).

Transitions into down and suspect are always triggered by some interaction with the peer (usually a message that was sent to the peer and got no response or triggered an ICMP error). Therefore no immediate recheck of the condition is needed.

Note:

In this version, peer state transitions are only logged at level debug. This is done to ensure that a peer can not overwhelm logging by accidentally or intentionally triggering large amounts of log messages.

However, to prevent short, transient network problems to block a peer for a longer time, a progressive recheck scheme is used. The first Echo Request after transitioning into the state will be triggered after an initial echo interval, the interval for follow up Echo Requests (should the previous request fall) will be scaled up by applying a scaleFactor (min. 2) to the interval of the previous attempt till the max echo interval for the state is reached. This progressive echo interval is configurable for the suspect and down state only.

The reception of any GTP-C message from an yet unknown peers causes the creation of a peer entity in the state idle.

Note:

This creates the potential for DoS attacks and should only be used on trustworthy networks. It therefor is configurable and is disabled by default.

The following diagram summarizes the states and transitions.

State Diagram
State Diagram

Messages received before a path went down

Any GTP-C message from a peer counts as activity on the path of its source IP address. This includes a request, a response, an Echo Request, and the Echo Response to the current Echo Request. Activity brings a suspect or down path back up.

SMC records the time when it receives each GTP-C message, and the time when a path goes down. Activity that SMC received before the path went down does not bring the path back up. SMC cannot know when the peer sent a message, so only the time of reception counts.

The socket and the session processes report activity to the path asynchronously. The path can go down while such a report still waits to be processed. Without this check, a message that SMC received just before the path went down would bring the path back up right after it went down.

These examples show the effect:

  • SMC sends a Delete Bearer Request. The path goes down because the peer does not answer Echo Requests. Then the Delete Bearer Response arrives. SMC received it after the path went down, so it brings the path back up.
  • A response arrives a moment before the path goes down, but its activity report reaches the path after the path went down. SMC received it before the path went down, so the path stays down.

SMC still answers an Echo Request that it received before the path went down, and applies its Restart counter, but the path stays down.

A request that creates a session on a down path, or moves a tunnel to it, fails. The exception is a request that comes from the IP address of that path and that SMC received after the path went down. That request is activity, so it brings the path up and SMC accepts the session.

GTP based Restart Procedures

3GPP TS 23.007, Clause 18Opens in a new tab states:

The GTP-C entity that receives a Recovery Information Element in an Echo Response or in another GTP-C message from a peer, shall compare the received remote Restart counter value with the previous Restart counter value stored for that peer entity.

  • If no previous value was stored the Restart counter value received in the Echo Response or in the GTP-C message shall be stored for the peer.

  • If the value of a Restart counter previously stored for a peer is smaller than the Restart counter value received in the Echo Response message or the GTP-C message, taking the integer roll-over into account, this indicates that the entity that sent the Echo Response or the GTP-C message has restarted. The received, new Restart counter value shall be stored by the receiving entity, replacing the value previously stored for the peer.

  • If the value of a Restart counter previously stored for a peer is larger than the Restart counter value received in the Echo Response message or the GTP-C message, taking the integer roll-over into account, this indicates a possible race condition (newer message arriving before the older one). The received new Restart counter value shall be discarded and an error may be logged.

This is implemented with the following choices:

  • integer roll-over

    The Restart counter is 8 bit valued, therefor any value falling into range (current value + 127) module 256 will be considered larger than the current value. Other values are considered as smaller.

  • path that the Restart counter applies to

    3GPP TS 23.007, Clause 18Opens in a new tab associates the Restart counter in a GTP-C message with the peer that the Sender F-TEID or the SGSN/GGSN Address for Control Plane identifies. If the message carries neither, the clause associates the Restart counter with the source IP address of the message.

    SMC applies the Restart counter on the path of the tunnel that the message belongs to, not on the path of the source IP address. A message for an existing session without a Sender F-TEID or GSN Address, and most responses, also use the path of their tunnel, because the TEID identifies the peer of the session. Echo Requests and Echo Responses have no tunnel, so SMC applies their Restart counter on the path of the source IP address.

    A Restart counter change does not change the state of a path. SMC ends the sessions that it bound on the path under the old Restart counter, and the path stays in its state.

  • logging possible conditions

    A possible race condition is logged.

  • delaying restart action based on operator policy

    The specification gives the option to delay restart actions and to verifiy the restart counter by sending a Echo Request and/or inspecting other GTP requests for Restart counter values.

    This option is not implemented for this version.

GTP context removal

A context is said to "established with a peer" when a GTP-C message that contains a IE that specifies the GTP-C IP of that peer is recieved. For GTPv1-C that means a GGSN Address for Control Plane IE and for GTPv2-C a Sender F-TEID for Control Plane IE. The outer transport IP for GTP-C message is not considered for this.

Multiple causes can trigger a mass removal of GTP context. In order to aviod processing or signaling overload the removal strategy is configurable on per triggering cause and handler. It can be overridden on per peer (FQDN or IP) basis.

Triggers are:

  • GTP path transition to down state
  • GTP peer restart indication

Note:

The following triggers will also result in mass GTP context removal, but configuration options for these is not supported in this version:

  • PFCP path transition to down state
  • PFCP peer restart indication

Configurable values are:

  • rate limits

    A jobsOpens in a new tab queue is used to determine the behavior. Care has to be taken when drafting the jobs queue configuration to avoid the loss of delete requests due to queue limits. For compatibility to old configuration, the queue is named path_restart.

  • removal strategy

    GGSNs, P-GW and SAE-GW handlers do not have to send GTP requests out if they detect a peer failure. They only remove the local context and tear down the PFCP context.

    For GGSN and P-GW proxies, the stategies can be configured per peer. The strategy is taken from the triggering peer and applied to all other peers.

    Strategies are:

    • active: send delete request
      This sents the appropriate GTP delete message to peer, causing a immediate removal of the context from the peer.

    • silent: silent drop
      This simply removes the context from the SMC and UPF, but does not tell other GTP entities about that. The next GTP-U packets that arrives triggers a GTP-U Error Indication, causing the context to be removed from the peer.

    The configuration parameter pathManagement.down.notify controls this behaviour.

Care must be taken when configuring the context removal to avoid unexpected interactions with entities like OFCS, OCS and PCRF. Using low removal rates can lead to unexpected state collions in those entities (e.g. session block in OCS when a new reconnect request arrives).