RE: [PATCH net-next] Name NICs based on vmbus offer and enable async probe by default

From: Haiyang Zhang
Date: Tue Jul 09 2019 - 21:04:12 EST




> -----Original Message-----
> From: Stephen Hemminger <stephen@xxxxxxxxxxxxxxxxxx>
> Sent: Tuesday, July 9, 2019 7:47 PM
> To: Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>
> Cc: sashal@xxxxxxxxxx; linux-hyperv@xxxxxxxxxxxxxxx;
> netdev@xxxxxxxxxxxxxxx; KY Srinivasan <kys@xxxxxxxxxxxxx>; Stephen
> Hemminger <sthemmin@xxxxxxxxxxxxx>; olaf@xxxxxxxxx; vkuznets
> <vkuznets@xxxxxxxxxx>; davem@xxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH net-next] Name NICs based on vmbus offer and enable
> async probe by default
>
> On Tue, 9 Jul 2019 22:56:30 +0000
> Haiyang Zhang <haiyangz@xxxxxxxxxxxxx> wrote:
>
> > - VRSS_CHANNEL_MAX);
> > + if (probe_type == PROBE_PREFER_ASYNCHRONOUS) {
> > + snprintf(name, IFNAMSIZ, "eth%d", dev->channel->dev_num);
>
> What about PCI passthrough or VF devices that are also being probed and
> consuming the ethN names. Won't there be a collision?

VF usually shows up a few seconds later than the synthetic NIC. Faster probing
will reduce the probability of collision.
Even if a collision happens, the code below will re-register the NIC with "eth%d":
+ if (ret == -EEXIST) {
+ pr_info("NIC name %s exists, request another name.\n",
+ net->name);
+ strlcpy(net->name, "eth%d", IFNAMSIZ);
+ ret = register_netdevice(net);
+ }

Thanks,
- Haiyang