Skip to contentSkip to conversation

l2tp: ppp: remove unused backlog callback

PATCH Applied Qingfang Deng 2 participants 3 messages Nov 3 – Nov 5

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 l2tp: ppp: remove unused backlog callback

PPPoL2TP sessions receive packets through pppol2tp_recv(), which passes packets directly to PPP or queues them on sk_receive_queue. No receive path queues packets on the session socket backlog or calls sk_receive_skb() with that socket, so pppol2tp_backlog_recv() is unused.

Remove the unused callback. L2TP/IP control sockets retain their separate backlog callbacks.

---
v2: repost after net-next is open, and add Sashiko's report

v1: https://lore.kernel.org/netdev/[email protected]/

---
 net/l2tp/l2tp_ppp.c | 12 ------------
 1 file changed, 12 deletions(-)
net/l2tp/l2tp_ppp.c +0 -12
index 4f311d473a64..15e02864bfd5 100644
@@ -454,17 +454,6 @@ static struct proto pppol2tp_sk_proto = {
 	.obj_size = sizeof(struct pppox_sock),
 };
 
-static int pppol2tp_backlog_recv(struct sock *sk, struct sk_buff *skb)
-{
-	int rc;
-
-	rc = l2tp_udp_encap_recv(sk, skb);
-	if (rc)
-		kfree_skb(skb);
-
-	return NET_RX_SUCCESS;
-}
-
 /* socket() handler. Initialize a new struct sock.
  */
 static int pppol2tp_create(struct net *net, struct socket *sock, int kern)
@@ -482,7 +471,6 @@ static int pppol2tp_create(struct net *net, struct socket *sock, int kern)
 	sock->state  = SS_UNCONNECTED;
 	sock->ops    = &pppol2tp_ops;
 
-	sk->sk_backlog_rcv = pppol2tp_backlog_recv;
 	sk->sk_protocol	   = PX_PROTO_OL2TP;
 	sk->sk_family	   = PF_PPPOX;
 	sk->sk_state	   = PPPOX_NONE;
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 2/2 l2tp: unexport l2tp_udp_encap_recv()

Removing pppol2tp_backlog_recv() eliminated the only caller outside l2tp_core.c. Make l2tp_udp_encap_recv() static and remove its export and declaration from l2tp_core.h.

---
v2: new patch

---
 net/l2tp/l2tp_core.c | 3 +--
 net/l2tp/l2tp_core.h | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)
net/l2tp/l2tp_core.c +1 -2
index 7e042a3e648c..d575ebb97577 100644
@@ -1009,7 +1009,7 @@ static void l2tp_session_queue_purge(struct l2tp_session *session)
 }
 
 /* UDP encapsulation receive handler. See net/ipv4/udp.c for details. */
-int l2tp_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
+static int l2tp_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
 {
 	struct l2tp_session *session = NULL;
 	struct l2tp_tunnel *tunnel = NULL;
@@ -1108,7 +1108,6 @@ int l2tp_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
 
 	return 1;
 }
-EXPORT_SYMBOL_GPL(l2tp_udp_encap_recv);
 
 /* UDP encapsulation receive error handler. See net/ipv4/udp.c for details. */
 static void l2tp_udp_encap_err_recv(struct sock *sk, struct sk_buff *skb, int err,
net/l2tp/l2tp_core.h +0 -1
index 25ae4c25d3ef..371aea239705 100644
@@ -254,7 +254,6 @@ void l2tp_session_delete(struct l2tp_session *session);
 void l2tp_recv_common(struct l2tp_session *session, struct sk_buff *skb,
 		      unsigned char *ptr, unsigned char *optr, u16 hdrflags,
 		      int length);
-int l2tp_udp_encap_recv(struct sock *sk, struct sk_buff *skb);
 
 /* Transmit path helpers for sending packets over the tunnel socket. */
 int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb);
Signature · 1 line
2.43.0
#2 lore raw
In reply to Qingfang Deng
This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Quoted 9 lines · On Tue, 3 Nov 2026 13:56:11 +0800 you wrote:

PPPoL2TP sessions receive packets through pppol2tp_recv(), which passes packets directly to PPP or queues them on sk_receive_queue. No receive path queues packets on the session socket backlog or calls sk_receive_skb() with that socket, so pppol2tp_backlog_recv() is unused.

Remove the unused callback. L2TP/IP control sockets retain their separate backlog callbacks.

[...]

Here is the summary with links:
- [net-next,v2,1/2] l2tp: ppp: remove unused backlog callback

    https://git.kernel.org/netdev/net-next/c/7c43105da5fc
  - [net-next,v2,2/2] l2tp: unexport l2tp_udp_encap_recv()
    https://git.kernel.org/netdev/net-next/c/ae54bc28fc9e

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html