]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
hv_netvsc: defer queue selection to VF
authorStephen Hemminger <stephen@networkplumber.org>
Fri, 2 Mar 2018 21:49:07 +0000 (13:49 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 5 Mar 2018 03:18:20 +0000 (22:18 -0500)
When VF is used for accelerated networking it will likely have
more queues (and different policy) than the synthetic NIC.
This patch defers the queue policy to the VF so that all the
queues can be used. This impacts workloads like local generate UDP.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/hyperv/netvsc_drv.c

index fa6cf18e77194866a059f8a389e936ef6ffcf833..5299cfb16ce267cde0b06d0270c3cdd98434611a 100644 (file)
@@ -298,8 +298,19 @@ static u16 netvsc_select_queue(struct net_device *ndev, struct sk_buff *skb,
        rcu_read_lock();
        vf_netdev = rcu_dereference(ndc->vf_netdev);
        if (vf_netdev) {
-               txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) : 0;
-               qdisc_skb_cb(skb)->slave_dev_queue_mapping = skb->queue_mapping;
+               const struct net_device_ops *vf_ops = vf_netdev->netdev_ops;
+
+               if (vf_ops->ndo_select_queue)
+                       txq = vf_ops->ndo_select_queue(vf_netdev, skb,
+                                                      accel_priv, fallback);
+               else
+                       txq = fallback(vf_netdev, skb);
+
+               /* Record the queue selected by VF so that it can be
+                * used for common case where VF has more queues than
+                * the synthetic device.
+                */
+               qdisc_skb_cb(skb)->slave_dev_queue_mapping = txq;
        } else {
                txq = netvsc_pick_tx(ndev, skb);
        }