/[packages]/cauldron/kernel/current/PATCHES/patches/0009-hv_netvsc-fix-vf-serial-matching-with-pci-slot-info.patch
ViewVC logotype

Contents of /cauldron/kernel/current/PATCHES/patches/0009-hv_netvsc-fix-vf-serial-matching-with-pci-slot-info.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1329221 - (show annotations) (download)
Fri Nov 9 22:05:45 2018 UTC (5 years, 10 months ago) by tmb
File size: 2467 byte(s)
add fixes from sashas autosel queue
1 From 9db7036cef0f2b387c4716fec33f5cb0c84d0fa7 Mon Sep 17 00:00:00 2001
2 From: Haiyang Zhang <haiyangz@microsoft.com>
3 Date: Mon, 15 Oct 2018 19:06:15 +0000
4 Subject: [PATCH 009/145] hv_netvsc: fix vf serial matching with pci slot info
5
6 [ Upstream commit 005479556197f80139771960dda0dfdcd2d2aad5 ]
7
8 The VF device's serial number is saved as a string in PCI slot's
9 kobj name, not the slot->number. This patch corrects the netvsc
10 driver, so the VF device can be successfully paired with synthetic
11 NIC.
12
13 Fixes: 00d7ddba1143 ("hv_netvsc: pair VF based on serial number")
14 Reported-by: Vitaly Kuznetsov <vkuznets@redhat.com>
15 Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
16 Reviewed-by: Stephen Hemminger <sthemmin@microsoft.com>
17 Signed-off-by: David S. Miller <davem@davemloft.net>
18 Signed-off-by: Sasha Levin <sashal@kernel.org>
19 ---
20 drivers/net/hyperv/netvsc_drv.c | 15 +++++++++++----
21 1 file changed, 11 insertions(+), 4 deletions(-)
22
23 diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
24 index 3af6d8d15233..1c37a821895b 100644
25 --- a/drivers/net/hyperv/netvsc_drv.c
26 +++ b/drivers/net/hyperv/netvsc_drv.c
27 @@ -2022,14 +2022,15 @@ static void netvsc_vf_setup(struct work_struct *w)
28 rtnl_unlock();
29 }
30
31 -/* Find netvsc by VMBus serial number.
32 - * The PCI hyperv controller records the serial number as the slot.
33 +/* Find netvsc by VF serial number.
34 + * The PCI hyperv controller records the serial number as the slot kobj name.
35 */
36 static struct net_device *get_netvsc_byslot(const struct net_device *vf_netdev)
37 {
38 struct device *parent = vf_netdev->dev.parent;
39 struct net_device_context *ndev_ctx;
40 struct pci_dev *pdev;
41 + u32 serial;
42
43 if (!parent || !dev_is_pci(parent))
44 return NULL; /* not a PCI device */
45 @@ -2040,16 +2041,22 @@ static struct net_device *get_netvsc_byslot(const struct net_device *vf_netdev)
46 return NULL;
47 }
48
49 + if (kstrtou32(pci_slot_name(pdev->slot), 10, &serial)) {
50 + netdev_notice(vf_netdev, "Invalid vf serial:%s\n",
51 + pci_slot_name(pdev->slot));
52 + return NULL;
53 + }
54 +
55 list_for_each_entry(ndev_ctx, &netvsc_dev_list, list) {
56 if (!ndev_ctx->vf_alloc)
57 continue;
58
59 - if (ndev_ctx->vf_serial == pdev->slot->number)
60 + if (ndev_ctx->vf_serial == serial)
61 return hv_get_drvdata(ndev_ctx->device_ctx);
62 }
63
64 netdev_notice(vf_netdev,
65 - "no netdev found for slot %u\n", pdev->slot->number);
66 + "no netdev found for vf serial:%u\n", serial);
67 return NULL;
68 }
69
70 --
71 2.19.1
72

  ViewVC Help
Powered by ViewVC 1.1.30