Re: [PATCH net] xdp: use multi-buff only if receive queue supports page pool

From
Jakub Kicinski <kuba@kernel.org>
Date
2025-09-26 02:12:20
Also in
bpf
Reply to
Maciej Fijalkowski, 2025-09-25
On Thu, 25 Sep 2025 11:42:04 +0200 Maciej Fijalkowski wrote:
On Thu, Sep 25, 2025 at 12:53:53AM -0700, Octavian Purdila wrote:
quoted
On Wed, Sep 24, 2025 at 5:09 PM Jakub Kicinski [off-list ref] wrote:  
quoted
On Wed, 24 Sep 2025 06:08:42 +0000 Octavian Purdila wrote:  
 [...]  
quoted
quoted
This can also happen on veth, right? And veth re-stamps the Rx queues.  
What do you mean by 're-stamps' in this case?
quoted
I am not sure if re-stamps will have ill effects.

The allocation and deallocation for this issue happens while
processing the same packet (receive skb -> skb_pp_cow_data ->
page_pool alloc ... __bpf_prog_run ->  bpf_xdp_adjust_tail).

IIUC, if the veth re-stamps the RX queue to MEM_TYPE_PAGE_POOL
skb_pp_cow_data will proceed to allocate from page_pool and
bpf_xdp_adjust_tail will correctly free from page_pool.  
netif_get_rxqueue() gives you a pointer the netstack queue, not the driver
one. Then you take the xdp_rxq from there. Do we even register memory
model for these queues? Or am I missing something here.

We're in generic XDP hook where driver specifics should not matter here
IMHO.
Well, IDK how helpful the flow below would be but:

veth_xdp_xmit() -> [ptr ring] -> veth_xdp_rcv() -> veth_xdp_rcv_one() 
                                                               |
                            | xdp_convert_frame_to_buff()   <-'
    ( "re-stamps" ;) ->     | xdp->rxq = &rq->xdp_rxq;
  can eat frags but now rxq | bpf_prog_run_xdp()
         is veth's          |

I just glanced at the code so >50% changes I'm wrong, but that's what 
I meant.
Thread (10 messages) 10 messages, 3 authors, last reply 2025-09-30
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help