[PATCH net-next 2/3] pppoe: bypass sk_receive_skb for PPPOX_BOUND sockets

From: Qingfang Deng
Date: Tue Jun 24 2025 - 23:41:08 EST


When a PPPoE session socket is in PPPOX_BOUND state, the RX path is
fully synchronous and does not require socket receive queueing or
callbacks. Avoid calling sk_receive_skb(), which acquires the socket
lock and adds overhead.

Call ppp_input() directly to reduce lock contention and improve
performance on RX path.

Signed-off-by: Qingfang Deng <dqfext@xxxxxxxxx>
---
drivers/net/ppp/pppoe.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
index 410effa42ade..ba30d7afe9ff 100644
--- a/drivers/net/ppp/pppoe.c
+++ b/drivers/net/ppp/pppoe.c
@@ -413,6 +413,7 @@ static int pppoe_rcv(struct sk_buff *skb, struct net_device *dev,
struct pppoe_hdr *ph;
struct pppox_sock *po;
struct pppoe_net *pn;
+ struct sock *sk;
int len;

if (skb->pkt_type == PACKET_OTHERHOST)
@@ -448,7 +449,14 @@ static int pppoe_rcv(struct sk_buff *skb, struct net_device *dev,
if (!po)
goto drop;

- return sk_receive_skb(sk_pppox(po), skb, 0);
+ sk = sk_pppox(po);
+ if (sk->sk_state & PPPOX_BOUND) {
+ ppp_input(&po->chan, skb);
+ sock_put(sk);
+ return NET_RX_SUCCESS;
+ }
+
+ return sk_receive_skb(sk, skb, 0);

drop:
kfree_skb(skb);
--
2.43.0