From: "Bjørn Mork" <bjorn@mork.no>
To: Tom Gundersen <teg@jklm.no>
Cc: netdev <netdev@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
David Miller <davem@davemloft.net>,
David Herrmann <dh.herrmann@gmail.com>,
Kay Sievers <kay@vrfy.org>
Subject: Re: [PATCH v7 03/33] net: set name_assign_type in alloc_netdev()
Date: Thu, 10 Jul 2014 13:29:35 +0200 [thread overview]
Message-ID: <87ha2ph2ow.fsf@nemi.mork.no> (raw)
In-Reply-To: <CAG-2HqVvW2dh5y8xn9v-B29ohFTcPGgY3NY-P5y_xZu0SGgG3g@mail.gmail.com> (Tom Gundersen's message of "Thu, 10 Jul 2014 12:21:44 +0200")
Tom Gundersen <teg@jklm.no> writes:
> On Thu, Jul 10, 2014 at 11:16 AM, Bjørn Mork <bjorn@mork.no> wrote:
>> Tom Gundersen <teg@jklm.no> writes:
>>
>>> diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
>>> index 5dc638c..f405e05 100644
>>> --- a/net/ethernet/eth.c
>>> +++ b/net/ethernet/eth.c
>>> @@ -390,7 +390,8 @@ EXPORT_SYMBOL(ether_setup);
>>> struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs,
>>> unsigned int rxqs)
>>> {
>>> - return alloc_netdev_mqs(sizeof_priv, "eth%d", ether_setup, txqs, rxqs);
>>> + return alloc_netdev_mqs(sizeof_priv, "eth%d", NET_NAME_UNKNOWN,
>>> + ether_setup, txqs, rxqs);
>>> }
>>> EXPORT_SYMBOL(alloc_etherdev_mqs);
>>
>> I believe this chunk makes the rest of this exercise pretty pointless.
>>
>> bjorn@nemi:/usr/local/src/git/linux$ git grep alloc_etherdev drivers/net/|wc -l
>> 283
>>
>> I don't care enough to go look, but I'd be surprised if none of those
>> drivers rename the device before registering it.
>
> I did look for that, and I only found devices being renamed to the
> same name assign type as eth%d (wlan%d, etc).
You explain the vlan patch as follows:
"When deriving the name from the real device, inherit the assign type, otherwise
set PREDICTABLE as the name will be uniquely determined by the VLANID."
How come the same doesn't apply here?:
struct net_device * hostap_add_interface(struct local_info *local,
int type, int rtnl_locked,
const char *prefix,
const char *name)
{
struct net_device *dev, *mdev;
struct hostap_interface *iface;
int ret;
dev = alloc_etherdev(sizeof(struct hostap_interface));
if (dev == NULL)
return NULL;
iface = netdev_priv(dev);
iface->dev = dev;
iface->local = local;
iface->type = type;
list_add(&iface->list, &local->hostap_interfaces);
mdev = local->dev;
eth_hw_addr_inherit(dev, mdev);
dev->base_addr = mdev->base_addr;
dev->irq = mdev->irq;
dev->mem_start = mdev->mem_start;
dev->mem_end = mdev->mem_end;
hostap_setup_dev(dev, local, type);
dev->destructor = free_netdev;
sprintf(dev->name, "%s%s", prefix, name);
..
when this is called as
dev = hostap_add_interface(local, HOSTAP_INTERFACE_WDS, rtnl_locked,
local->ddev->name, "wds%d");
..
local->apdev = hostap_add_interface(local, HOSTAP_INTERFACE_AP,
rtnl_locked, local->ddev->name,
"ap");
..
local->stadev = hostap_add_interface(local, HOSTAP_INTERFACE_STA,
rtnl_locked, local->ddev->name,
"sta");
?
Yes, this is an exception. But so are every instance of alloc_netdev
ending up with something different from NET_NAME_ENUM...
How much would this patchset reduce to if you just set
dev->name_assign_type = NET_NAME_UNKNOWN in alloc_netdev() and changed
it only in the few places where you actually *know* the name_assign_type?
My fear wrt this pathset is that the 'name_assign_type' will end up as
yet another useless field like 'addr_assign_type' and 'type'. There is
no way the kernel will be able to set these with 100% confidence, and
the value is therefore next to nothing. If userspace is stupid enough
to trust them, then you end up with extremely hard to fix errors in the
cases where the driver/kernel guesswork is wrong.
Just one example of this, affecting the 'type': Huawei happens to use
the same device IDs for modems requiring userspace management (should
have a wwan_type) and modems with built-in management (should have a
default type). So which 'type' should we choose for this device?
userspace can figure out by careful probing, but if it trusts the 'type'
set by the driver then it will get it wrong. The field provides no value
at all.
But if you limit the scope of the 'name_assign_type' patches to only
those cases where you actually have some information, then I guess it
might provide some value for userspace.
Bjørn
next prev parent reply other threads:[~2014-07-10 11:30 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-10 8:17 [PATCH v7 00/33] Provide netdev naming-policy via sysfs Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 01/33] net: add name_assign_type netdev attribute Tom Gundersen
2014-07-10 15:53 ` Nicolas Dichtel
2014-07-10 20:00 ` Tom Gundersen
2014-07-10 19:58 ` Arend van Spriel
2014-07-10 20:01 ` Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 02/33] net: set name assign type for renamed devices Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 03/33] net: set name_assign_type in alloc_netdev() Tom Gundersen
2014-07-10 9:16 ` Bjørn Mork
2014-07-10 10:21 ` Tom Gundersen
2014-07-10 11:29 ` Bjørn Mork [this message]
2014-07-10 13:02 ` Tom Gundersen
2014-07-10 13:27 ` Bjørn Mork
2014-07-10 8:17 ` [PATCH v7 04/33] net: set name assign type for names assigned using a static template Tom Gundersen
2014-07-10 8:52 ` Marc Kleine-Budde
2014-07-10 8:17 ` [PATCH v7 05/33] net: set name assign type for names assigned using a static string Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 06/33] net: set name assign type for names passed directly from userspace Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 07/33] net: rtnetlink - make create_link take name_assign_type Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 08/33] net: nl80211 - make rdev_add_virtual_intf " Tom Gundersen
2014-07-21 9:40 ` Johannes Berg
2014-07-21 17:03 ` Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 09/33] net: nl802154 - make add_iface take name assign type Tom Gundersen
2014-07-10 10:52 ` Alexander Aring
2014-07-10 8:17 ` [PATCH v7 10/33] net: dummy - set " Tom Gundersen
2014-07-10 9:31 ` Bjørn Mork
2014-07-10 10:12 ` Tom Gundersen
2014-07-10 10:26 ` David Herrmann
2014-07-10 10:33 ` Tom Gundersen
2014-07-10 11:44 ` Bjørn Mork
2014-07-10 12:18 ` Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 11/33] net: af_netrom " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 12/33] net: af_rose " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 13/33] net: mrt " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 14/33] net: caif_serial " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 15/33] net: xen-netback " Tom Gundersen
2014-07-10 8:25 ` Varka Bhadram
2014-07-10 9:01 ` Ian Campbell
2014-07-10 10:46 ` Tom Gundersen
2014-07-10 12:13 ` Ian Campbell
2014-07-10 8:17 ` [PATCH v7 16/33] net: gdm_lte " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 17/33] net: airo " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 18/33] net: arcdev - label alloc_arcdev names Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 19/33] net: isdn - set name assign type Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 20/33] net: irlan " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 21/33] net: batman-adv " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 22/33] net: hamradio " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 23/33] net: openvswitch " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 24/33] net: vlan " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 25/33] net: infiniband - steal ifname label Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 26/33] net: ipoib - set name assign type Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 27/33] net: tile " Tom Gundersen
2014-07-16 17:49 ` Chris Metcalf
2014-07-10 8:17 ` [PATCH v7 28/33] net: dsa " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 29/33] net: brcmfmac " Tom Gundersen
2014-07-10 20:08 ` Arend van Spriel
2014-07-10 20:24 ` Tom Gundersen
2014-07-11 7:45 ` Arend van Spriel
2014-07-15 19:39 ` John W. Linville
2014-07-15 19:57 ` Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 30/33] net: ppp " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 31/33] net: slcan " Tom Gundersen
2014-07-10 8:51 ` Marc Kleine-Budde
2014-07-10 8:17 ` [PATCH v7 32/33] net: x25_asy " Tom Gundersen
2014-07-10 8:17 ` [PATCH v7 33/33] net: slip " Tom Gundersen
2014-07-10 8:43 ` [PATCH v7 00/33] Provide netdev naming-policy via sysfs David Miller
2014-07-10 9:19 ` Tom Gundersen
2014-07-10 19:11 ` Tom Gundersen
2014-07-10 19:19 ` David Miller
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=87ha2ph2ow.fsf@nemi.mork.no \
--to=bjorn@mork.no \
--cc=davem@davemloft.net \
--cc=dh.herrmann@gmail.com \
--cc=kay@vrfy.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=teg@jklm.no \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox