Skip to contentSkip to conversation

veth: store queue_mapping independently of XDP prog presence

PATCH Applied Maciej Fijalkowski 3 participants 3 messages Mar 3, 2021 – Mar 5, 2021

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

PATCH 1/1 veth: store queue_mapping independently of XDP prog presence

Currently, veth_xmit() would call the skb_record_rx_queue() only when there is XDP program loaded on peer interface in native mode.

If peer has XDP prog in generic mode, then netif_receive_generic_xdp() has a call to netif_get_rxqueue(skb), so for multi-queue veth it will not be possible to grab a correct rxq.

To fix that, store queue_mapping independently of XDP prog presence on peer interface.

Fixes 638264dc9022 ("veth: Support per queue XDP ring")
---
 drivers/net/veth.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/veth.c +1 -2
index aa1a66ad2ce5..34e49c75db42 100644
@@ -302,8 +302,7 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
 	if (rxq < rcv->real_num_rx_queues) {
 		rq = &rcv_priv->rq[rxq];
 		rcv_xdp = rcu_access_pointer(rq->xdp_prog);
-		if (rcv_xdp)
-			skb_record_rx_queue(skb, rxq);
+		skb_record_rx_queue(skb, rxq);
 	}
 
 	skb_tx_timestamp(skb);
Signature · 1 line
2.20.1
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Maciej Fijalkowski

Currently, veth_xmit() would call the skb_record_rx_queue() only when there is XDP program loaded on peer interface in native mode.

If peer has XDP prog in generic mode, then netif_receive_generic_xdp() has a call to netif_get_rxqueue(skb), so for multi-queue veth it will not be possible to grab a correct rxq.

Quoted 5 lines

To fix that, store queue_mapping independently of XDP prog presence on peer interface.

Fixes 638264dc9022 ("veth: Support per queue XDP ring")

I did like this in order to keep the default behavior for non-xdp case, but generic XDP should behave the same as native XDP, so

#2 lore raw
In reply to Maciej Fijalkowski
This patch was applied to bpf/bpf.git (refs/heads/master):

Hello:

This patch was applied to bpf/bpf.git (refs/heads/master):

Quoted 8 lines · On Wed, 3 Mar 2021 16:29:03 +0100 you wrote:

Currently, veth_xmit() would call the skb_record_rx_queue() only when there is XDP program loaded on peer interface in native mode.

If peer has XDP prog in generic mode, then netif_receive_generic_xdp() has a call to netif_get_rxqueue(skb), so for multi-queue veth it will not be possible to grab a correct rxq.

[...]

Here is the summary with links:
- [bpf] veth: store queue_mapping independently of XDP prog presence

    https://git.kernel.org/bpf/bpf/c/edbea9220251

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html