* [PATCH net-next v3 1/2] pppoe: pass bound packets directly to generic PPP
@ 2026-10-30 4:59 Qingfang Deng
2026-10-30 4:59 ` [PATCH net-next v3 2/2] pppoe: queue unbound packets directly Qingfang Deng
0 siblings, 1 reply; 2+ messages in thread
From: Qingfang Deng @ 2026-10-30 4:59 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Qingfang Deng, Simon Horman,
Asim Viladi Oglu Manizada, Eric Woudstra, Felix Fietkau, netdev,
linux-kernel
Cc: Julius Bairaktaris
Bound PPPoE sockets pass received frames to the generic PPP layer. They
currently do so through __sk_receive_skb(), which takes the socket BH
lock and serializes calls to ppp_input().
The lock originally prevented ppp_input() from racing with
ppp_unregister_channel(). Commit ec4215683e47 ("ppp: defer channel free
to an RCU grace period to fix pppol2tp RX UAF") now keeps the generic
PPP channel alive until in-flight RCU readers have completed, so bound
packets can be passed directly to ppp_input() from pppoe_rcv().
The direct bound receive path also skips the socket filter check in
__sk_receive_skb(). This does not affect normal pppd PPPoE operation:
pppd uses the kernel PPP channel and does not attach a receive filter to
a socket. Instead, it uses the generic PPP pass and active filters,
installed through PPPIOCSPASS and PPPIOCSACTIVE, unaffected by this
change.
Signed-off-by: Qingfang Deng <qingfang.deng@linux.dev>
---
A local receive-path benchmark sends 1492-byte IPv4 packets through
multiqueue TAP -> PPPoE -> PPP in a 16-vCPU x86-64 QEMU KVM guest.
Senders are pinned to distinct guest CPUs. This synchronous TAP receive
path does not use GRO. The generic PPP receive lock (ppp->rlock) is
retained in both variants. Median throughput over 12 samples per cell
across four boots, expressed as IP-layer Gbps:
Senders Before After Change
1 19.08 19.63 +2.89%
2 31.52 33.77 +7.15%
4 53.67 63.48 +18.28%
8 39.79 51.50 +29.42%
16 49.40 61.33 +24.15%
Repeating the test with a separate benchmark-only change that removes
the generic PPP receive lock:
Senders Before After Change
1 19.45 19.89 +2.23%
2 33.29 34.92 +4.90%
4 61.72 67.01 +8.57%
8 44.46 123.76 +178.35%
16 54.62 220.48 +303.69%
Eight and sixteen senders perform worse than four whenever at least
one receive lock remains. With both locks removed, throughput
rises from 67.01 Gbps with four senders to 123.76 Gbps with eight
and 220.48 Gbps with sixteen.
GPT Codex assisted in the benchmarks.
---
v3:
- Update the benchmark results. Code remains unchanged.
- Sashiko reported a potential dangling skb->dev pointer in v2:
https://sashiko.dev/#/patchset/20261028030509.23294-1-qingfang.deng%40linux.dev?part=1
That requires a very specific and uncommon setup. Both extensions
require a non NULL skb->dev, so I doubt anyone had hit that path.
PPPoL2TP also bypasses __sk_receive_skb().
v2: https://lore.kernel.org/netdev/20261028030509.23294-1-qingfang.deng@linux.dev/
- Split out the synchronize_net() change (already in net tree e7b01bc0202a)
- Do not change the banner comment
- Include the benchmark results
v1: https://lore.kernel.org/netdev/20260804074452.75548-1-qingfang.deng@linux.dev/
---
drivers/net/ppp/pppoe.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
index 67c28ac763ef..a1ed756a6220 100644
--- a/drivers/net/ppp/pppoe.c
+++ b/drivers/net/ppp/pppoe.c
@@ -415,6 +415,10 @@ static int pppoe_rcv(struct sk_buff *skb, struct net_device *dev,
if (!po)
goto drop;
+ if (likely(po->sk.sk_state & PPPOX_BOUND)) {
+ ppp_input(&po->chan, skb);
+ return NET_RX_SUCCESS;
+ }
return __sk_receive_skb(&po->sk, skb, 0, 1, false);
drop:
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* [PATCH net-next v3 2/2] pppoe: queue unbound packets directly
2026-10-30 4:59 [PATCH net-next v3 1/2] pppoe: pass bound packets directly to generic PPP Qingfang Deng
@ 2026-10-30 4:59 ` Qingfang Deng
0 siblings, 0 replies; 2+ messages in thread
From: Qingfang Deng @ 2026-10-30 4:59 UTC (permalink / raw)
To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Qingfang Deng, Simon Horman, Felix Fietkau,
Asim Viladi Oglu Manizada, Eric Woudstra, netdev, linux-kernel
Cc: Julius Bairaktaris
Queue unbound packets directly with sock_queue_rcv_skb() and remove
the unused backlog callback.
Previously, __sk_receive_skb() serialized receive processing with
PPPIOCGCHAN through the socket lock. Receivers either finished before
the ioctl acquired ownership or ran from the backlog after PPPOX_BOUND
was set.
The new lockless path relies on synchronize_net() from commit
92c1bf630abf ("pppox: drain queued packets on channel handoff").
After setting PPPOX_BOUND, PPPIOCGCHAN waits for receivers that saw
the old state to finish queueing before draining sk_receive_queue
into PPP. This prevents packets from being stranded after handoff.
SOCK_RCU_FREE protects the socket lifetime during teardown.
Signed-off-by: Qingfang Deng <qingfang.deng@linux.dev>
---
v3: no changes
v2: https://lore.kernel.org/netdev/20261028030509.23294-2-qingfang.deng@linux.dev/
---
drivers/net/ppp/pppoe.c | 40 ++++++----------------------------------
1 file changed, 6 insertions(+), 34 deletions(-)
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
index a1ed756a6220..6bd7d4b4da6e 100644
--- a/drivers/net/ppp/pppoe.c
+++ b/drivers/net/ppp/pppoe.c
@@ -340,35 +340,7 @@ static struct notifier_block pppoe_notifier = {
/************************************************************************
*
- * Do the real work of receiving a PPPoE Session frame.
- *
- ***********************************************************************/
-static int pppoe_rcv_core(struct sock *sk, struct sk_buff *skb)
-{
- struct pppox_sock *po = pppox_sk(sk);
-
- /* Backlog receive. Semantics of backlog rcv preclude any code from
- * executing in lock_sock()/release_sock() bounds; meaning sk->sk_state
- * can't change.
- */
-
- if (sk->sk_state & PPPOX_BOUND) {
- ppp_input(&po->chan, skb);
- } else {
- if (sock_queue_rcv_skb(sk, skb))
- goto abort_kfree;
- }
-
- return NET_RX_SUCCESS;
-
-abort_kfree:
- kfree_skb(skb);
- return NET_RX_DROP;
-}
-
-/************************************************************************
- *
- * Receive wrapper called in BH context.
+ * Receive a PPPoE Session frame.
*
***********************************************************************/
static int pppoe_rcv(struct sk_buff *skb, struct net_device *dev,
@@ -415,11 +387,12 @@ static int pppoe_rcv(struct sk_buff *skb, struct net_device *dev,
if (!po)
goto drop;
- if (likely(po->sk.sk_state & PPPOX_BOUND)) {
+ if (likely(po->sk.sk_state & PPPOX_BOUND))
ppp_input(&po->chan, skb);
- return NET_RX_SUCCESS;
- }
- return __sk_receive_skb(&po->sk, skb, 0, 1, false);
+ else if (sock_queue_rcv_skb(&po->sk, skb))
+ goto drop;
+
+ return NET_RX_SUCCESS;
drop:
kfree_skb(skb);
@@ -526,7 +499,6 @@ static int pppoe_create(struct net *net, struct socket *sock, int kern)
sock->state = SS_UNCONNECTED;
sock->ops = &pppoe_ops;
- sk->sk_backlog_rcv = pppoe_rcv_core;
sk->sk_destruct = pppoe_destruct;
sk->sk_state = PPPOX_NONE;
sk->sk_type = SOCK_STREAM;
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-30 5:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-30 4:59 [PATCH net-next v3 1/2] pppoe: pass bound packets directly to generic PPP Qingfang Deng
2026-10-30 4:59 ` [PATCH net-next v3 2/2] pppoe: queue unbound packets directly Qingfang Deng
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.