2007-02-25 04:13:12

by Alex Davis

[permalink] [raw]
Subject: Patch to allow specification of interface name prefix

This patch will allow you to specify the interface name prefix of wireless devices.

On my machine, the wireless devices under the bcm43xx driver are named 'ethx'; I
would really rather have them called 'wlanx', like bcm43xx-d80211 does.

I have this as an option to bcm43xx in modprobe.conf.

Usage: modprobe bcm43xx ifprefix=wlan
Your wireless devices will now be called 'wlan0', 'wlan1', etc.

This patch is against Larry's combined-2.6.20.1.patch

Signed-off by: Alex Davis <alex14641 at yahoo dot com>

--- drivers/net/wireless/bcm43xx/bcm43xx_main.c 2007-02-24 22:22:48.000000000 -0500
+++ ../linux-2.6.20.1-lwf/drivers/net/wireless/bcm43xx/bcm43xx_main.c 2007-02-24
22:44:46.000000000 -0500
@@ -103,6 +103,9 @@
# define modparam_fwpostfix ""
#endif /* CONFIG_BCM43XX_DEBUG*/

+static char modparam_ifprefix[IFNAMSIZ - 4];
+module_param_string(ifprefix, modparam_ifprefix, IFNAMSIZ - 4, 0444);
+MODULE_PARM_DESC(ifprefix, "Prefix for interface names (e.g; wlan).");

/* If you want to debug with just a single device, enable this,
* where the string is the pci device ID (as given by the kernel's
@@ -4123,6 +4126,10 @@
goto out;
}
/* initialize the net_device struct */
+ if ( strlen(modparam_ifprefix) > 0 ) {
+ strcpy(net_dev->name, modparam_ifprefix);
+ strcat(net_dev->name, "%d");
+ }
SET_MODULE_OWNER(net_dev);
SET_NETDEV_DEV(net_dev, &pdev->dev);


I code, therefore I am



____________________________________________________________________________________
Have a burning question?
Go to http://www.Answers.yahoo.com and get answers from real people who know.


2007-02-27 18:40:48

by Ben Greear

[permalink] [raw]
Subject: Re: Patch to allow specification of interface name prefix

Stephen Hemminger wrote:
> On Tue, 27 Feb 2007 11:16:44 +0100
> Jiri Benc <[email protected]> wrote:
>
>> [removed bcm43xx-dev list]
>>
>> On Mon, 26 Feb 2007 15:02:41 -0800, Stephen Hemminger wrote:
>>> This was hashed out on netdev 2+ years ago and decided that both ethernet
>>> and wireless devices should show up as 'eth%d'. For inclusion d80211 needs to conform
>>> to existing mainline kernel practice. If this means breaking the expectation of older
>>> out of tree wireless support (ie madwifi), sorry.
>> Decided? I remember just you and hch saying "all existing wireless drivers
>> do that, so everybody should". When pointing out that just two drivers do
>> that (I think ipw and prism) and everybody else use something different
>> (wlan%d most often) there was no reply. "ipw and one other driver do that
>> so everybody should" doesn't sound like a strong argument to me.
>
> Don't put too much stock in what I said. Really don't care about such
> a trivial matter as naming. Jeff and Christoph seem to care, I don't

Regardless of the name, it would be nice to have some quick way to determine
if a network device is wireless or not. This could be an IOCTL, something
in /proc/ or similar. Even if you name them to be wlanX by default, folks
can rename them, so applications that care about the type of the network
device can't key off of names reliably...

Thanks,
Ben

--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com


2007-02-27 02:06:02

by John W. Linville

[permalink] [raw]
Subject: Re: Patch to allow specification of interface name prefix

On Mon, Feb 26, 2007 at 03:02:41PM -0800, Stephen Hemminger wrote:

> This was hashed out on netdev 2+ years ago and decided that both ethernet
> and wireless devices should show up as 'eth%d'. For inclusion d80211 needs to conform
> to existing mainline kernel practice. If this means breaking the expectation of older
> out of tree wireless support (ie madwifi), sorry.

Any chance you could provide a pointer to that discussion in the archives?

John
--
John W. Linville
[email protected]

2007-02-28 08:53:05

by Johannes Berg

[permalink] [raw]
Subject: Re: Patch to allow specification of interface name prefix

On Tue, 2007-02-27 at 20:25 -0500, John W. Linville wrote:
> What about monitor mode?
>
> Doesn't airo use "wifiX" for its monitor interfaces? For monitor
> interfaces, should we adopt that convention as well?

We don't need a convention for monitor mode. Either the user sets an
existing interface to monitor mode (we don't touch the name) or the user
creates a new monitor interface (they get to choose the name up front)

johannes


Attachments:
signature.asc (190.00 B)
This is a digitally signed message part

2007-02-28 16:54:55

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: Patch to allow specification of interface name prefix

On 2/28/07, Johannes Berg <[email protected]> wrote:
> On Wed, 2007-02-28 at 08:44 -0800, Jouni Malinen wrote:
>
> > What's wrong with wlan#?
>
> Some people are anal about changing user-visible properties when one
> driver replaces another.

Nothing is wrong with it, that's perfectly fine. This is just a matter
of adopting a default convention for all wireless devices and sticking
to it. Old drivers used eth%d as the drivers mangled ethernet frames
and not wireless frames. With mac80211 wmaster handles wireless frames
directly but wlan%d handles ethernet frames. If we care more about
announcing a device is a wireless device is WLAN then lets go with
wlan%d, if we care more about implying what type of frames are being
passed to the device then eth%d seems more appropriate.

Luis

2007-02-27 17:41:51

by Stephen Hemminger

[permalink] [raw]
Subject: Re: Patch to allow specification of interface name prefix

On Tue, 27 Feb 2007 11:16:44 +0100
Jiri Benc <[email protected]> wrote:

> [removed bcm43xx-dev list]
>
> On Mon, 26 Feb 2007 15:02:41 -0800, Stephen Hemminger wrote:
> > This was hashed out on netdev 2+ years ago and decided that both ethernet
> > and wireless devices should show up as 'eth%d'. For inclusion d80211 needs to conform
> > to existing mainline kernel practice. If this means breaking the expectation of older
> > out of tree wireless support (ie madwifi), sorry.
>
> Decided? I remember just you and hch saying "all existing wireless drivers
> do that, so everybody should". When pointing out that just two drivers do
> that (I think ipw and prism) and everybody else use something different
> (wlan%d most often) there was no reply. "ipw and one other driver do that
> so everybody should" doesn't sound like a strong argument to me.

Don't put too much stock in what I said. Really don't care about such
a trivial matter as naming. Jeff and Christoph seem to care, I don't

> Wireless devices need different handling (setting SSID, etc.) than Ethernet
> ones. I think it's not so bad idea to show that difference by using a
> different default name. Everybody else who is in some kind different from
> Ethernet use different name than eth%d. I think we should conform to
> existing mainline practice by using something different than eth%d too.

As long as the tools work it shouldn't matter. There are some tools like
irqbalance that seem to have in bred assumptions.

A bigger issue for me would be getting NAPI to work right for wireless.



--
Stephen Hemminger <[email protected]>

2007-02-28 19:22:07

by Jouni Malinen

[permalink] [raw]
Subject: Re: Patch to allow specification of interface name prefix

On Wed, Feb 28, 2007 at 01:35:35PM -0500, John W. Linville wrote:
> On Wed, Feb 28, 2007 at 08:44:37AM -0800, Jouni Malinen wrote:
> > Why would we need to change anything now? What's wrong with wlan#?
>
> See the earlier parts of the thread... :-)

I've seen a somewhat vague comment about some sort of decision on this
front, but no one seems to be able to point to any level of details on
what was agreed on and if yes, when and by whom. I have seen number of
discussions on the topic of what the interfaces should be named, but
none of those seem to be going anywhere and I have not seen any
consensus on this topic. As such, the best thing to do seems to be not
to do anything, i.e., not rename wlan# to anything else. If someone
claims that d80211 is changing the existing behavior, I would just like
to point out that wlan# is already used in the current mainline kernel
and that argument does not sound reasonable.

--
Jouni Malinen PGP id EFC895FA

2007-02-27 10:16:51

by Jiri Benc

[permalink] [raw]
Subject: Re: Patch to allow specification of interface name prefix

[removed bcm43xx-dev list]

On Mon, 26 Feb 2007 15:02:41 -0800, Stephen Hemminger wrote:
> This was hashed out on netdev 2+ years ago and decided that both ethernet
> and wireless devices should show up as 'eth%d'. For inclusion d80211 needs to conform
> to existing mainline kernel practice. If this means breaking the expectation of older
> out of tree wireless support (ie madwifi), sorry.

Decided? I remember just you and hch saying "all existing wireless drivers
do that, so everybody should". When pointing out that just two drivers do
that (I think ipw and prism) and everybody else use something different
(wlan%d most often) there was no reply. "ipw and one other driver do that
so everybody should" doesn't sound like a strong argument to me.

Wireless devices need different handling (setting SSID, etc.) than Ethernet
ones. I think it's not so bad idea to show that difference by using a
different default name. Everybody else who is in some kind different from
Ethernet use different name than eth%d. I think we should conform to
existing mainline practice by using something different than eth%d too.

Jiri

--
Jiri Benc
SUSE Labs

2007-02-27 18:52:24

by Pavel Roskin

[permalink] [raw]
Subject: Re: Patch to allow specification of interface name prefix

On Tue, 2007-02-27 at 10:21 -0800, Ben Greear wrote:

> Regardless of the name, it would be nice to have some quick way to
> determine
> if a network device is wireless or not. This could be an IOCTL, something
> in /proc/ or similar. Even if you name them to be wlanX by default, folks
> can rename them, so applications that care about the type of the network
> device can't key off of names reliably...

iwconfig can do it using ioctl. Shell scripts can do it using
"wireless" directory in sysfs:

for i in /sys/class/net/*; do
if test -d $i/wireless; then
echo `basename $i`
fi
done

--
Regards,
Pavel Roskin


2007-02-25 04:39:21

by Larry Finger

[permalink] [raw]
Subject: Re: Patch to allow specification of interface name prefix

Pavel Roskin wrote:
> Quoting Alex Davis <[email protected]>:
>
>> This patch will allow you to specify the interface name prefix of wireless
>> devices.
>>
>> On my machine, the wireless devices under the bcm43xx driver are named
>> 'ethx'; I
>> would really rather have them called 'wlanx', like bcm43xx-d80211 does.
>
> You can use ifrename from wireless tools. Use the option that checks the
> ethtool information.
>
> Jean has just released Wireless Tools 29-pre12, which can read symlinks in
> sysfs. That would allow renaming d80211 based network devices by checking the
> "driver" symlinks in sysfs. I asked Jean to do that with bcm43xx_d80211 in
> mind.
>
> It's not that I'm against your patch. I'm rather ambivalent. But I think using
> ifrename could reduce the need in kernel support for interface renaming.

NACK.

On my system (openSUSE 10.2), one sets the name in /etc/udev/rules.d/30-net_persistent_names.rule. I
feel that interface renaming is handled perfectly well in userland, and kernel support is not needed.

Larry

2007-02-28 01:35:23

by John W. Linville

[permalink] [raw]
Subject: Re: Patch to allow specification of interface name prefix

On Tue, Feb 27, 2007 at 01:55:07PM -0500, Luis R. Rodriguez wrote:

> adopt eth%d convention. With SoftMAC (mac80211) things are a bit
> different -- wmaster handles 802.11 frames and wlan%d handles 802.3
> frames. The name does not matter much but it does imply at least that
> I think. As such perhaps mac80211 should change to use eth%d by
> default.

Hopefully wmaster will fall off the user's radar soon. Regarding the
current wlanX interfaces, most modes will be using ethernet framing,
so maybe ethX is fine. What about monitor mode?

Doesn't airo use "wifiX" for its monitor interfaces? For monitor
interfaces, should we adopt that convention as well?

John
--
John W. Linville
[email protected]

2007-02-28 16:56:23

by Jouni Malinen

[permalink] [raw]
Subject: Re: Patch to allow specification of interface name prefix

On Wed, Feb 28, 2007 at 05:50:52PM +0100, Johannes Berg wrote:
> On Wed, 2007-02-28 at 08:44 -0800, Jouni Malinen wrote:
> > What's wrong with wlan#?
>
> Some people are anal about changing user-visible properties when one
> driver replaces another.

So? Some drivers in the current mainline kernel are using wlan#.

--
Jouni Malinen PGP id EFC895FA

2007-02-28 19:06:39

by John W. Linville

[permalink] [raw]
Subject: Re: Patch to allow specification of interface name prefix

On Wed, Feb 28, 2007 at 08:44:37AM -0800, Jouni Malinen wrote:
> On Tue, Feb 27, 2007 at 08:25:00PM -0500, John W. Linville wrote:
>
> > Hopefully wmaster will fall off the user's radar soon. Regarding the
> > current wlanX interfaces, most modes will be using ethernet framing,
> > so maybe ethX is fine.
>
> Why would we need to change anything now? What's wrong with wlan#?

See the earlier parts of the thread... :-)

--
John W. Linville
[email protected]

2007-02-25 04:30:03

by Pavel Roskin

[permalink] [raw]
Subject: Re: Patch to allow specification of interface name prefix

Quoting Alex Davis <[email protected]>:

> This patch will allow you to specify the interface name prefix of wireless
> devices.
>
> On my machine, the wireless devices under the bcm43xx driver are named
> 'ethx'; I
> would really rather have them called 'wlanx', like bcm43xx-d80211 does.

You can use ifrename from wireless tools. Use the option that checks the
ethtool information.

Jean has just released Wireless Tools 29-pre12, which can read symlinks in
sysfs. That would allow renaming d80211 based network devices by checking the
"driver" symlinks in sysfs. I asked Jean to do that with bcm43xx_d80211 in
mind.

It's not that I'm against your patch. I'm rather ambivalent. But I think using
ifrename could reduce the need in kernel support for interface renaming.

--
Regards,
Pavel Roskin

2007-02-28 16:51:50

by Johannes Berg

[permalink] [raw]
Subject: Re: Patch to allow specification of interface name prefix

On Wed, 2007-02-28 at 08:44 -0800, Jouni Malinen wrote:

> What's wrong with wlan#?

Some people are anal about changing user-visible properties when one
driver replaces another.

johannes


Attachments:
signature.asc (190.00 B)
This is a digitally signed message part

2007-02-27 19:15:38

by Johannes Berg

[permalink] [raw]
Subject: Re: Patch to allow specification of interface name prefix

On Tue, 2007-02-27 at 13:52 -0500, Pavel Roskin wrote:

> Shell scripts can do it using
> "wireless" directory in sysfs:

No, that's wrong. The 'wireless' directory there is bound to disappear
since it's created by d80211. The sysfs interface is still subject to
discussion.

I think (but also subject to discussion) the way we'll want to do is
take note of the 'wiphy' link. But to do that globally cfg80211 will
need to be taught to create that link instead of mac80211 which requires
knowledge about netdevs in cfg80211 and we still haven't quite figured
that out.

For legacy devices not using cfg80211, the only way will be to invoke
legacy wext calls on them.

johannes


Attachments:
signature.asc (190.00 B)
This is a digitally signed message part

2007-02-26 23:03:24

by Stephen Hemminger

[permalink] [raw]
Subject: Re: Patch to allow specification of interface name prefix

On Sat, 24 Feb 2007 22:39:19 -0600
Larry Finger <[email protected]> wrote:

> Pavel Roskin wrote:
> > Quoting Alex Davis <[email protected]>:
> >
> >> This patch will allow you to specify the interface name prefix of wireless
> >> devices.
> >>
> >> On my machine, the wireless devices under the bcm43xx driver are named
> >> 'ethx'; I
> >> would really rather have them called 'wlanx', like bcm43xx-d80211 does.
> >
> > You can use ifrename from wireless tools. Use the option that checks the
> > ethtool information.
> >
> > Jean has just released Wireless Tools 29-pre12, which can read symlinks in
> > sysfs. That would allow renaming d80211 based network devices by checking the
> > "driver" symlinks in sysfs. I asked Jean to do that with bcm43xx_d80211 in
> > mind.
> >
> > It's not that I'm against your patch. I'm rather ambivalent. But I think using
> > ifrename could reduce the need in kernel support for interface renaming.
>
> NACK.
>
> On my system (openSUSE 10.2), one sets the name in /etc/udev/rules.d/30-net_persistent_names.rule. I
> feel that interface renaming is handled perfectly well in userland, and kernel support is not needed.
>

This was hashed out on netdev 2+ years ago and decided that both ethernet
and wireless devices should show up as 'eth%d'. For inclusion d80211 needs to conform
to existing mainline kernel practice. If this means breaking the expectation of older
out of tree wireless support (ie madwifi), sorry.


--
Stephen Hemminger <[email protected]>

2007-02-27 18:55:14

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: Patch to allow specification of interface name prefix

On 2/27/07, Jiri Benc <[email protected]> wrote:
> [removed bcm43xx-dev list]
>
> On Mon, 26 Feb 2007 15:02:41 -0800, Stephen Hemminger wrote:
> > This was hashed out on netdev 2+ years ago and decided that both ethernet
> > and wireless devices should show up as 'eth%d'. For inclusion d80211 needs to conform
> > to existing mainline kernel practice. If this means breaking the expectation of older
> > out of tree wireless support (ie madwifi), sorry.
>
> Decided? I remember just you and hch saying "all existing wireless drivers
> do that, so everybody should". When pointing out that just two drivers do
> that (I think ipw and prism) and everybody else use something different
> (wlan%d most often) there was no reply. "ipw and one other driver do that
> so everybody should" doesn't sound like a strong argument to me.
>
> Wireless devices need different handling (setting SSID, etc.) than Ethernet
> ones. I think it's not so bad idea to show that difference by using a
> different default name. Everybody else who is in some kind different from
> Ethernet use different name than eth%d. I think we should conform to
> existing mainline practice by using something different than eth%d too.

FWIW I remember the discussion too and it wasn't something very
settling. One main reason to keep eth%d convention was the fact that
the wireless net devices at that time (FullMAC) handled and managed
raw ethernet frames and not wireless frames and as such its relfected
with eth%d convention. This was the main reasoning for prism54 to
adopt eth%d convention. With SoftMAC (mac80211) things are a bit
different -- wmaster handles 802.11 frames and wlan%d handles 802.3
frames. The name does not matter much but it does imply at least that
I think. As such perhaps mac80211 should change to use eth%d by
default.

Luis

2007-02-28 16:44:53

by Jouni Malinen

[permalink] [raw]
Subject: Re: Patch to allow specification of interface name prefix

On Tue, Feb 27, 2007 at 08:25:00PM -0500, John W. Linville wrote:

> Hopefully wmaster will fall off the user's radar soon. Regarding the
> current wlanX interfaces, most modes will be using ethernet framing,
> so maybe ethX is fine.

Why would we need to change anything now? What's wrong with wlan#?

--
Jouni Malinen PGP id EFC895FA