Commit 3fe260e0 authored by Gilberto Bertin's avatar Gilberto Bertin Committed by David S. Miller

net: tun: record RX queue in skb before do_xdp_generic()

This allows netif_receive_generic_xdp() to correctly determine the RX
queue from which the skb is coming, so that the context passed to the
XDP program will contain the correct RX queue index.
Signed-off-by: default avatarGilberto Bertin <me@jibi.io>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e6aaeafd
...@@ -1888,6 +1888,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, ...@@ -1888,6 +1888,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
skb_reset_network_header(skb); skb_reset_network_header(skb);
skb_probe_transport_header(skb); skb_probe_transport_header(skb);
skb_record_rx_queue(skb, tfile->queue_index);
if (skb_xdp) { if (skb_xdp) {
struct bpf_prog *xdp_prog; struct bpf_prog *xdp_prog;
...@@ -2459,6 +2460,7 @@ static int tun_xdp_one(struct tun_struct *tun, ...@@ -2459,6 +2460,7 @@ static int tun_xdp_one(struct tun_struct *tun,
skb->protocol = eth_type_trans(skb, tun->dev); skb->protocol = eth_type_trans(skb, tun->dev);
skb_reset_network_header(skb); skb_reset_network_header(skb);
skb_probe_transport_header(skb); skb_probe_transport_header(skb);
skb_record_rx_queue(skb, tfile->queue_index);
if (skb_xdp) { if (skb_xdp) {
err = do_xdp_generic(xdp_prog, skb); err = do_xdp_generic(xdp_prog, skb);
...@@ -2470,7 +2472,6 @@ static int tun_xdp_one(struct tun_struct *tun, ...@@ -2470,7 +2472,6 @@ static int tun_xdp_one(struct tun_struct *tun,
!tfile->detached) !tfile->detached)
rxhash = __skb_get_hash_symmetric(skb); rxhash = __skb_get_hash_symmetric(skb);
skb_record_rx_queue(skb, tfile->queue_index);
netif_receive_skb(skb); netif_receive_skb(skb);
/* No need for get_cpu_ptr() here since this function is /* No need for get_cpu_ptr() here since this function is
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment