]> git.ipfire.org Git - thirdparty/linux.git/commit
ppp: don't store tx skb in the fastpath
authorQingfang Deng <dqfext@gmail.com>
Tue, 3 Mar 2026 09:32:19 +0000 (17:32 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 5 Mar 2026 12:26:46 +0000 (13:26 +0100)
commit70836c8d0fe046400de8cdcf0613b2f1f6bddde3
tree14f95a8ba394bf9eabce48fd331b443bea51e2d8
parent0172f8d80220d2255cae00eb5131a864047433f7
ppp: don't store tx skb in the fastpath

Currently, ppp->xmit_pending is used in ppp_send_frame() to pass a skb
to ppp_push(), and holds the skb when a PPP channel cannot immediately
transmit it. This state is redundant because the transmit queue
(ppp->file.xq) can already handle the backlog. Furthermore, during
normal operation, an skb is queued in file.xq only to be immediately
dequeued, causing unnecessary overhead.

Refactor the transmit path to avoid stashing the skb when possible:
- Remove ppp->xmit_pending.
- Rename ppp_send_frame() to ppp_prepare_tx_skb(), and don't call
  ppp_push() in it. It returns 1 if the skb is consumed
  (dropped/handled) or 0 if it can be passed to ppp_push().
- Update ppp_push() to accept the skb. It returns 1 if the skb is
  consumed, or 0 if the channel is busy.
- Optimize __ppp_xmit_process():
  - Fastpath: If the queue is empty, attempt to send the skb directly
    via ppp_push(). If busy, queue it.
  - Slowpath: If the queue is not empty, process the backlog in
    file.xq. Split dequeuing loop into a separate function
    ppp_xmit_flush() so ppp_channel_push() uses that directly instead of
    passing a NULL skb to __ppp_xmit_process().

This simplifies the states and reduces locking in the fastpath.

Signed-off-by: Qingfang Deng <dqfext@gmail.com>
Link: https://patch.msgid.link/20260303093219.234403-1-dqfext@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ppp/ppp_generic.c