From: Arnd Bergmann <arnd@arndb.de>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: Steve Calfee <stevecalfee@gmail.com>,
Michal Nazarewicz <mnazarewicz@gmail.com>,
Randy Dunlap <rdunlap@xenotime.net>,
broonie@opensource.wolfsonmicro.com,
lkml <linux-kernel@vger.kernel.org>,
Nicolas Pitre <nicolas.pitre@linaro.org>,
Greg KH <greg@kroah.com>,
David Brownell <dbrownell@users.sourceforge.net>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
grant.likely@secretlab.ca,
Linux USB list <linux-usb@vger.kernel.org>,
andy.green@linaro.org, netdev@vger.kernel.org,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
roger.quadros@nokia.com,
Jaswinder Singh <jaswinder.singh@linaro.org>,
patches@linaro.org
Subject: Re: [RFC] usbnet: use eth%d name for known ethernet devices
Date: Thu, 24 Mar 2011 14:15:44 +0100 [thread overview]
Message-ID: <201103241415.45115.arnd@arndb.de> (raw)
In-Reply-To: <201103241413.54599.arnd@arndb.de>
The documentation for the USB ethernet devices suggests that
only some devices are supposed to use usb0 as the network interface
name instead of eth0. The logic used there, and documented in
Kconfig for CDC is that eth0 will be used when the mac address
is a globally assigned one, but usb0 is used for the locally
managed range that is typically used on point-to-point links.
Unfortunately, this has caused a lot of pain on the smsc95xx
device that is used on the popular pandaboard without an
EEPROM to store the MAC address, which causes the driver to
call random_ether_address().
Obviously, there should be a proper MAC addressed assigned to
the device, and discussions are ongoing about how to solve
this, but this patch at least makes sure that the default
interface naming gets a little saner and matches what the
user can expect based on the documentation, including for
new devices.
The approach taken here is to flag whether a device might be a
point-to-point link with the new FLAG_PTP setting in the usbnet
driver_info. A driver can set both FLAG_PTP and FLAG_ETHER if
it is not sure (e.g. cdc_ether), or just one of the two.
The usbnet framework only looks at the MAC address for device
naming if both flags are set, otherwise it trusts the flag.
Signed-off-by: Arnd Bergmann <arnd.bergmann@linaro.org>
Cc: Andy Green <andy.green@linaro.org>
Cc: patches@linaro.org
---
drivers/net/usb/cdc_eem.c | 2 +-
drivers/net/usb/cdc_ether.c | 2 +-
drivers/net/usb/cdc_ncm.c | 2 +-
drivers/net/usb/cdc_subset.c | 8 ++++++++
drivers/net/usb/gl620a.c | 2 +-
drivers/net/usb/net1080.c | 2 +-
drivers/net/usb/plusb.c | 2 +-
drivers/net/usb/rndis_host.c | 2 +-
drivers/net/usb/usbnet.c | 3 ++-
drivers/net/usb/zaurus.c | 8 ++++----
include/linux/usb/usbnet.h | 2 ++
11 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c
index 5f3b976..8f12854 100644
--- a/drivers/net/usb/cdc_eem.c
+++ b/drivers/net/usb/cdc_eem.c
@@ -340,7 +340,7 @@ next:
static const struct driver_info eem_info = {
.description = "CDC EEM Device",
- .flags = FLAG_ETHER,
+ .flags = FLAG_ETHER | FLAG_POINTTOPOINT,
.bind = eem_bind,
.rx_fixup = eem_rx_fixup,
.tx_fixup = eem_tx_fixup,
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 9a60e41..98b2bbd 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -450,7 +450,7 @@ static int cdc_manage_power(struct usbnet *dev, int on)
static const struct driver_info cdc_info = {
.description = "CDC Ethernet Device",
- .flags = FLAG_ETHER,
+ .flags = FLAG_ETHER | FLAG_POINTTOPOINT,
// .check_connect = cdc_check_connect,
.bind = cdc_bind,
.unbind = usbnet_cdc_unbind,
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 7113168..967371f 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -1237,7 +1237,7 @@ static int cdc_ncm_manage_power(struct usbnet *dev, int status)
static const struct driver_info cdc_ncm_info = {
.description = "CDC NCM",
- .flags = FLAG_NO_SETINT | FLAG_MULTI_PACKET,
+ .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET,
.bind = cdc_ncm_bind,
.unbind = cdc_ncm_unbind,
.check_connect = cdc_ncm_check_connect,
diff --git a/drivers/net/usb/cdc_subset.c b/drivers/net/usb/cdc_subset.c
index ca39ace..fc5f13d 100644
--- a/drivers/net/usb/cdc_subset.c
+++ b/drivers/net/usb/cdc_subset.c
@@ -89,6 +89,7 @@ static int always_connected (struct usbnet *dev)
static const struct driver_info ali_m5632_info = {
.description = "ALi M5632",
+ .flags = FLAG_POINTTOPOINT,
};
#endif
@@ -110,6 +111,7 @@ static const struct driver_info ali_m5632_info = {
static const struct driver_info an2720_info = {
.description = "AnchorChips/Cypress 2720",
+ .flags = FLAG_POINTTOPOINT,
// no reset available!
// no check_connect available!
@@ -132,6 +134,7 @@ static const struct driver_info an2720_info = {
static const struct driver_info belkin_info = {
.description = "Belkin, eTEK, or compatible",
+ .flags = FLAG_POINTTOPOINT,
};
#endif /* CONFIG_USB_BELKIN */
@@ -157,6 +160,7 @@ static const struct driver_info belkin_info = {
static const struct driver_info epson2888_info = {
.description = "Epson USB Device",
.check_connect = always_connected,
+ .flags = FLAG_POINTTOPOINT,
.in = 4, .out = 3,
};
@@ -173,6 +177,7 @@ static const struct driver_info epson2888_info = {
#define HAVE_HARDWARE
static const struct driver_info kc2190_info = {
.description = "KC Technology KC-190",
+ .flags = FLAG_POINTTOPOINT,
};
#endif /* CONFIG_USB_KC2190 */
@@ -200,16 +205,19 @@ static const struct driver_info kc2190_info = {
static const struct driver_info linuxdev_info = {
.description = "Linux Device",
.check_connect = always_connected,
+ .flags = FLAG_POINTTOPOINT,
};
static const struct driver_info yopy_info = {
.description = "Yopy",
.check_connect = always_connected,
+ .flags = FLAG_POINTTOPOINT,
};
static const struct driver_info blob_info = {
.description = "Boot Loader OBject",
.check_connect = always_connected,
+ .flags = FLAG_POINTTOPOINT,
};
#endif /* CONFIG_USB_ARMLINUX */
diff --git a/drivers/net/usb/gl620a.c b/drivers/net/usb/gl620a.c
index dcd57c3..c4cfd1d 100644
--- a/drivers/net/usb/gl620a.c
+++ b/drivers/net/usb/gl620a.c
@@ -193,7 +193,7 @@ static int genelink_bind(struct usbnet *dev, struct usb_interface *intf)
static const struct driver_info genelink_info = {
.description = "Genesys GeneLink",
- .flags = FLAG_FRAMING_GL | FLAG_NO_SETINT,
+ .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_GL | FLAG_NO_SETINT,
.bind = genelink_bind,
.rx_fixup = genelink_rx_fixup,
.tx_fixup = genelink_tx_fixup,
diff --git a/drivers/net/usb/net1080.c b/drivers/net/usb/net1080.c
index ba72a72..01db460 100644
--- a/drivers/net/usb/net1080.c
+++ b/drivers/net/usb/net1080.c
@@ -560,7 +560,7 @@ static int net1080_bind(struct usbnet *dev, struct usb_interface *intf)
static const struct driver_info net1080_info = {
.description = "NetChip TurboCONNECT",
- .flags = FLAG_FRAMING_NC,
+ .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_NC,
.bind = net1080_bind,
.reset = net1080_reset,
.check_connect = net1080_check_connect,
diff --git a/drivers/net/usb/plusb.c b/drivers/net/usb/plusb.c
index 08ad269..823c537 100644
--- a/drivers/net/usb/plusb.c
+++ b/drivers/net/usb/plusb.c
@@ -96,7 +96,7 @@ static int pl_reset(struct usbnet *dev)
static const struct driver_info prolific_info = {
.description = "Prolific PL-2301/PL-2302",
- .flags = FLAG_NO_SETINT,
+ .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT,
/* some PL-2302 versions seem to fail usb_set_interface() */
.reset = pl_reset,
};
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index dd8a4ad..5994a25 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -573,7 +573,7 @@ EXPORT_SYMBOL_GPL(rndis_tx_fixup);
static const struct driver_info rndis_info = {
.description = "RNDIS device",
- .flags = FLAG_ETHER | FLAG_FRAMING_RN | FLAG_NO_SETINT,
+ .flags = FLAG_ETHER | FLAG_POINTTOPOINT | FLAG_FRAMING_RN | FLAG_NO_SETINT,
.bind = rndis_bind,
.unbind = rndis_unbind,
.status = rndis_status,
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 95c41d5..c5b6cfb 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1376,7 +1376,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
// else "eth%d" when there's reasonable doubt. userspace
// can rename the link if it knows better.
if ((dev->driver_info->flags & FLAG_ETHER) != 0 &&
- (net->dev_addr [0] & 0x02) == 0)
+ ((dev->driver_info->flags & FLAG_POINTTOPOINT) == 0 ||
+ (net->dev_addr [0] & 0x02) == 0))
strcpy (net->name, "eth%d");
/* WLAN devices should always be named "wlan%d" */
if ((dev->driver_info->flags & FLAG_WLAN) != 0)
diff --git a/drivers/net/usb/zaurus.c b/drivers/net/usb/zaurus.c
index 3eb0b16..241756e 100644
--- a/drivers/net/usb/zaurus.c
+++ b/drivers/net/usb/zaurus.c
@@ -102,7 +102,7 @@ static int always_connected (struct usbnet *dev)
static const struct driver_info zaurus_sl5x00_info = {
.description = "Sharp Zaurus SL-5x00",
- .flags = FLAG_FRAMING_Z,
+ .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_Z,
.check_connect = always_connected,
.bind = zaurus_bind,
.unbind = usbnet_cdc_unbind,
@@ -112,7 +112,7 @@ static const struct driver_info zaurus_sl5x00_info = {
static const struct driver_info zaurus_pxa_info = {
.description = "Sharp Zaurus, PXA-2xx based",
- .flags = FLAG_FRAMING_Z,
+ .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_Z,
.check_connect = always_connected,
.bind = zaurus_bind,
.unbind = usbnet_cdc_unbind,
@@ -122,7 +122,7 @@ static const struct driver_info zaurus_pxa_info = {
static const struct driver_info olympus_mxl_info = {
.description = "Olympus R1000",
- .flags = FLAG_FRAMING_Z,
+ .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_Z,
.check_connect = always_connected,
.bind = zaurus_bind,
.unbind = usbnet_cdc_unbind,
@@ -258,7 +258,7 @@ bad_desc:
static const struct driver_info bogus_mdlm_info = {
.description = "pseudo-MDLM (BLAN) device",
- .flags = FLAG_FRAMING_Z,
+ .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_Z,
.check_connect = always_connected,
.tx_fixup = zaurus_tx_fixup,
.bind = blan_mdlm_bind,
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 44842c8..1ef9aa0 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -97,6 +97,8 @@ struct driver_info {
#define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */
+#define FLAG_POINTTOPOINT 0x1000 /* possibly use "usb%d" names */
+
/*
* Indicates to usbnet, that USB driver accumulates multiple IP packets.
* Affects statistic (counters) and short packet handling.
next prev parent reply other threads:[~2011-03-24 13:16 UTC|newest]
Thread overview: 156+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-11 9:50 RFC: Platform data for onboard USB assets Andy Green
2011-03-11 12:31 ` Arnd Bergmann
2011-03-11 12:44 ` Andy Green
2011-03-11 14:42 ` Roger Quadros
2011-03-11 15:12 ` Roger Quadros
2011-03-11 15:22 ` Arnd Bergmann
2011-03-11 15:50 ` Roger Quadros
2011-03-11 15:55 ` Arnd Bergmann
2011-03-11 15:29 ` Mark Brown
2011-03-11 15:54 ` Arnd Bergmann
2011-03-11 16:03 ` Mark Brown
2011-03-11 16:14 ` Greg KH
2011-03-11 16:27 ` Mark Brown
2011-03-11 16:35 ` Greg KH
2011-03-11 16:48 ` Mark Brown
2011-03-11 16:56 ` Greg KH
2011-03-11 17:08 ` Mark Brown
2011-03-11 17:23 ` Greg KH
2011-03-11 17:41 ` Mark Brown
2011-03-17 2:14 ` Nicolas Pitre
2011-03-17 20:13 ` Greg KH
2011-03-17 20:18 ` Mark Brown
2011-03-17 20:26 ` Greg KH
2011-03-17 21:24 ` Mark Brown
2011-03-17 21:31 ` Greg KH
2011-03-17 21:40 ` Mark Brown
2011-03-17 21:47 ` Greg KH
2011-03-17 22:33 ` Arnd Bergmann
2011-03-17 22:53 ` Greg KH
2011-03-17 23:18 ` Andy Green
2011-03-17 23:25 ` Greg KH
2011-03-18 7:42 ` Andy Green
2011-03-18 22:54 ` Benjamin Herrenschmidt
2011-03-18 22:57 ` Andy Green
2011-03-18 4:54 ` Grant Likely
2011-03-18 8:19 ` Arnd Bergmann
2011-03-17 23:22 ` Andy Green
2011-03-18 15:00 ` Arnd Bergmann
2011-03-18 15:15 ` Mark Brown
2011-03-18 17:52 ` Andy Green
2011-03-18 18:20 ` David Anders
2011-03-18 18:25 ` Mark Brown
2011-03-18 20:02 ` Andy Green
2011-03-18 21:11 ` Arnd Bergmann
2011-03-18 21:17 ` Andy Green
2011-03-18 20:06 ` Arnd Bergmann
2011-03-18 21:33 ` Andy Green
2011-03-18 23:25 ` Mark Brown
2011-03-18 23:33 ` Andy Green
2011-03-18 21:36 ` Grant Likely
2011-03-18 22:47 ` Benjamin Herrenschmidt
2011-03-18 21:28 ` Grant Likely
2011-03-18 23:04 ` Andy Green
2011-03-18 22:37 ` Benjamin Herrenschmidt
2011-03-18 22:39 ` Andy Green
2011-03-17 23:27 ` Grant Likely
2011-03-18 7:49 ` Andy Green
2011-03-18 8:25 ` Arnd Bergmann
2011-03-18 8:38 ` Andy Green
2011-03-17 22:11 ` Arnd Bergmann
2011-03-17 22:20 ` Greg KH
2011-03-18 8:42 ` Roger Quadros
2011-03-18 9:01 ` Arnd Bergmann
2011-03-18 9:55 ` Roger Quadros
2011-03-18 10:09 ` Andy Green
2011-03-17 21:03 ` Nicolas Pitre
2011-03-17 21:32 ` Greg KH
2011-03-11 16:26 ` Andy Green
2011-03-11 16:45 ` Alan Stern
2011-03-11 16:51 ` Andy Green
2011-03-11 17:08 ` Greg KH
2011-03-11 18:09 ` Andy Green
2011-03-11 19:12 ` Alan Stern
2011-03-11 20:05 ` Andy Green
2011-03-11 20:21 ` Greg KH
2011-03-11 21:07 ` Andy Green
2011-03-11 21:44 ` Greg KH
2011-03-11 22:24 ` Andy Green
2011-03-12 16:00 ` Alan Stern
2011-03-12 23:02 ` Andy Green
2011-03-11 19:37 ` Greg KH
2011-03-11 16:53 ` Mark Brown
2011-03-11 16:08 ` Greg KH
2011-03-11 16:20 ` Andy Green
2011-03-11 16:36 ` Greg KH
2011-03-11 16:41 ` Andy Green
2011-03-11 22:07 ` Benjamin Herrenschmidt
2011-03-11 21:52 ` Benjamin Herrenschmidt
2011-03-11 22:45 ` Grant Likely
2011-03-11 22:47 ` Andy Green
2011-03-11 23:39 ` Grant Likely
2011-03-14 14:54 ` Arnd Bergmann
2011-03-22 15:05 ` Jaswinder Singh
2011-03-22 16:04 ` Andy Green
2011-03-22 18:19 ` Jaswinder Singh
2011-03-22 18:37 ` Andy Green
2011-03-22 18:59 ` Jaswinder Singh
2011-03-22 19:35 ` Andy Green
[not found] ` <AANLkTim=ezye=1fQP_1a2SWbPnbENP9B+k27Z3AkS=zf@mail.gmail.com>
2011-03-22 15:12 ` Mark Brown
2011-03-22 15:23 ` Jaswinder Singh
2011-03-24 18:56 ` Grant Likely
2011-03-22 21:08 ` Benjamin Herrenschmidt
2011-03-22 22:37 ` Andy Green
2011-03-23 1:03 ` Benjamin Herrenschmidt
2011-03-23 2:26 ` Nicolas Pitre
2011-03-23 3:23 ` Benjamin Herrenschmidt
2011-03-23 4:21 ` Nicolas Pitre
2011-03-23 4:56 ` Greg KH
2011-03-23 5:44 ` Benjamin Herrenschmidt
2011-03-23 9:38 ` Alan Cox
2011-03-23 10:53 ` Mark Brown
2011-03-23 15:04 ` Greg KH
2011-03-23 15:10 ` Mark Brown
2011-03-23 15:24 ` Andy Green
2011-03-23 15:45 ` Arnd Bergmann
2011-03-23 15:38 ` Nicolas Pitre
2011-03-23 9:31 ` Andy Green
2011-03-23 9:47 ` Alan Cox
2011-03-23 10:06 ` Andy Green
2011-03-23 10:32 ` Arnd Bergmann
2011-03-23 10:39 ` Andy Green
2011-03-23 10:56 ` Alan Cox
2011-03-23 11:13 ` Andy Green
2011-03-23 11:34 ` Alan Cox
2011-03-23 12:02 ` Andy Green
2011-03-23 15:08 ` Greg KH
2011-03-23 16:12 ` Arnd Bergmann
2011-03-23 16:22 ` Greg KH
2011-03-23 16:34 ` Andy Green
2011-03-23 16:56 ` [RFC] usbnet: use eth%d name for known ethernet devices Arnd Bergmann
2011-03-23 17:04 ` Andy Green
2011-03-23 17:11 ` Arnd Bergmann
2011-03-24 10:45 ` Andy Green
2011-03-23 17:13 ` Arnd Bergmann
2011-03-23 17:54 ` David Anders
2011-03-23 18:46 ` Greg KH
2011-03-23 19:35 ` Arnd Bergmann
[not found] ` <AANLkTim7hPfTv3gDYnh+jGxHBg0OvX=r1FKYoHnH7H_o@mail.gmail.com>
2011-03-23 19:57 ` Arnd Bergmann
2011-03-23 19:59 ` Randy Dunlap
2011-03-23 23:17 ` Michal Nazarewicz
2011-03-23 23:19 ` Randy Dunlap
2011-03-23 23:38 ` Steve Calfee
2011-03-24 0:01 ` Ben Hutchings
2011-03-24 13:13 ` Arnd Bergmann
2011-03-24 13:15 ` Arnd Bergmann [this message]
2011-03-24 13:44 ` Andy Green
2011-03-24 13:56 ` Alan Stern
2011-03-24 17:20 ` Alexey Orishko
2011-03-25 11:57 ` Arnd Bergmann
2011-03-25 16:26 ` Alexey Orishko
2011-03-25 16:43 ` Arnd Bergmann
2011-03-24 19:17 ` RFC: Platform data for onboard USB assets Grant Likely
2011-03-24 20:10 ` Andy Green
2011-03-23 14:55 ` Nicolas Pitre
2011-03-23 10:22 ` Benjamin Herrenschmidt
2011-03-23 15:11 ` Nicolas Pitre
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=201103241415.45115.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=andy.green@linaro.org \
--cc=benh@kernel.crashing.org \
--cc=bhutchings@solarflare.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=dbrownell@users.sourceforge.net \
--cc=grant.likely@secretlab.ca \
--cc=greg@kroah.com \
--cc=jaswinder.singh@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mnazarewicz@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nicolas.pitre@linaro.org \
--cc=patches@linaro.org \
--cc=rdunlap@xenotime.net \
--cc=roger.quadros@nokia.com \
--cc=stevecalfee@gmail.com \
/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