All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	KY Srinivasan <kys@microsoft.com>,
	"olaf@aepfle.de" <olaf@aepfle.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"bjorn.helgaas@gmail.com" <bjorn.helgaas@gmail.com>,
	"apw@canonical.com" <apw@canonical.com>,
	"devel@linuxdriverproject.org" <devel@linuxdriverproject.org>,
	"leann.ogasawara@canonical.com" <leann.ogasawara@canonical.com>,
	"jasowang@redhat.com" <jasowang@redhat.com>
Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on serial numbers
Date: Fri, 9 Dec 2016 16:21:48 -0800	[thread overview]
Message-ID: <20161209162148.44887938@xeon-e3> (raw)
In-Reply-To: <BLUPR03MB141281091AFB66BE43A3E607CA870@BLUPR03MB1412.namprd03.prod.outlook.com>

On Fri, 9 Dec 2016 22:35:05 +0000
Haiyang Zhang <haiyangz@microsoft.com> wrote:

> > > >
> > > > Emulated NIC is already excluded in start of netvc notifier handler.
> > > >
> > > > static int netvsc_netdev_event(struct notifier_block *this,
> > > > 			       unsigned long event, void *ptr)
> > > > {
> > > > 	struct net_device *event_dev = netdev_notifier_info_to_dev(ptr);
> > > >
> > > > 	/* Skip our own events */
> > > > 	if (event_dev->netdev_ops == &device_ops)
> > > > 		return NOTIFY_DONE;
> > > >  
> > >
> > > Emulated device is not based on netvsc. It's the native Linux  
> > (dec100M?)  
> > > Driver. So this line doesn't exclude it. And how about other NIC type
> > > may be added in the future?  
> > 
> > Sorry, forgot about that haven't used emulated device in years.
> > The emulated device should appear to be on a PCI bus, but the serial
> > would not match??  
> 
> It's not a vmbus device, not a hv_pci device either. Hv_PCI is a subset
> of vmbus devices. So emulated NIC won't have hv_pci serial number.
> 
> In my patch, the following code ensure, we only try to get serial number
> after confirming it's vmbus and hv_pci device:
> 
> +               if (!dev_is_vmbus(dev))
> +                       continue;
> +
> +               hdev = device_to_hv_device(dev);
> +               if (hdev->device_id != HV_PCIE)
> +                       continue;

Ok, the walk back up the device tree is logically ok, but I don't
know enough about PCI device tree to be assured that it is safe.
Also, you could short circuit away most of the unwanted devices
by making sure the vf_netdev->dev.parent is a PCI device.

Also the loop to look for serial number in the devices on the
hv_pci bus could be made a separate function and have a short circuit
return (although it probably doesn't matter since there will only
be on e PCI VF device per bus there).

  reply	other threads:[~2016-12-10  0:21 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-08  8:33 [PATCH 0/3] Drivers: hv: Implement VF association based on serial number kys
2016-12-08  8:33 ` [PATCH 1/3] hyperv: Move hv_pci_dev and related structs to hyperv.h kys
2016-12-08  8:33   ` [PATCH 2/3] hyperv: Add a function to detect if the device is a vmbus dev kys
2016-12-08  8:33   ` [PATCH 3/3] hv_netvsc: Implement VF matching based on serial numbers kys
2016-12-08 15:56     ` Greg KH
2016-12-09  0:05       ` KY Srinivasan
2016-12-09  7:31         ` Greg KH
2016-12-09 18:20           ` Stephen Hemminger
2016-12-09 20:09             ` Haiyang Zhang
2016-12-09 20:29               ` Stephen Hemminger
2016-12-09 21:31                 ` Haiyang Zhang
2016-12-09 21:45                   ` Stephen Hemminger
2016-12-09 21:53                     ` Haiyang Zhang
2016-12-09 22:05                       ` Stephen Hemminger
2016-12-09 22:35                         ` Haiyang Zhang
2016-12-10  0:21                           ` Stephen Hemminger [this message]
2016-12-10 12:20                             ` Greg KH
2016-12-14 23:18                               ` Haiyang Zhang
2016-12-14 23:27                                 ` Greg KH
2016-12-14 23:51                                   ` Stephen Hemminger
2016-12-16  1:11                                     ` KY Srinivasan
2016-12-16 15:20                                       ` Haiyang Zhang
2016-12-16 18:39                                         ` KY Srinivasan
2016-12-16 16:45                                     ` Greg KH
2016-12-08  9:49   ` [PATCH 1/3] hyperv: Move hv_pci_dev and related structs to hyperv.h kbuild test robot
2016-12-08 15:26     ` KY Srinivasan
2016-12-08 15:56       ` gregkh
2016-12-08 16:54         ` KY Srinivasan
2016-12-08 11:15   ` kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161209162148.44887938@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=apw@canonical.com \
    --cc=bjorn.helgaas@gmail.com \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=haiyangz@microsoft.com \
    --cc=jasowang@redhat.com \
    --cc=kys@microsoft.com \
    --cc=leann.ogasawara@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olaf@aepfle.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.