* [RFC] usbnet: use eth%d name for known ethernet devices
[not found] ` <20110323162251.GA9367@kroah.com>
@ 2011-03-23 16:56 ` Arnd Bergmann
2011-03-23 17:04 ` Andy Green
` (2 more replies)
0 siblings, 3 replies; 22+ messages in thread
From: Arnd Bergmann @ 2011-03-23 16:56 UTC (permalink / raw)
To: Greg KH
Cc: andy.green, Alan Cox, Benjamin Herrenschmidt, Nicolas Pitre,
Jaswinder Singh, Linux USB list, lkml, broonie, roger.quadros,
grant.likely, netdev, David Brownell
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>
---
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/smsc75xx.c | 2 +-
drivers/net/usb/smsc95xx.c | 2 +-
drivers/net/usb/usbnet.c | 3 ++-
drivers/net/usb/zaurus.c | 8 ++++----
drivers/usb/serial/usb_wwan.c | 2 +-
include/linux/usb/usbnet.h | 2 ++
Not tested yet, could someone try this out on a panda board
and ideally on a CDC device as well?
diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c
index 5f3b976..4d6bcb8 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_PTP,
.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..6dc89d0 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_PTP,
// .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..a6a026a 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_PTP | 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..fbe2b1b 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_PTP,
};
#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_PTP,
// 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_PTP,
};
#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_PTP,
.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_PTP,
};
#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_PTP,
};
static const struct driver_info yopy_info = {
.description = "Yopy",
.check_connect = always_connected,
+ .flags = FLAG_PTP,
};
static const struct driver_info blob_info = {
.description = "Boot Loader OBject",
.check_connect = always_connected,
+ .flags = FLAG_PTP,
};
#endif /* CONFIG_USB_ARMLINUX */
diff --git a/drivers/net/usb/gl620a.c b/drivers/net/usb/gl620a.c
index dcd57c3..972ee83 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_PTP | 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..f8a294e 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_PTP | 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..0ac7845 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_PTP | 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..bf2ab6e 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_PTP | FLAG_FRAMING_RN | FLAG_NO_SETINT,
.bind = rndis_bind,
.unbind = rndis_unbind,
.status = rndis_status,
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index 753ee6e..404a475 100644
--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -1244,7 +1244,7 @@ static const struct driver_info smsc75xx_info = {
.rx_fixup = smsc75xx_rx_fixup,
.tx_fixup = smsc75xx_tx_fixup,
.status = smsc75xx_status,
- .flags = FLAG_ETHER | FLAG_SEND_ZLP,
+ .flags = FLAG_ETHER | FLAG_SEND_ZLP | FLAG_REALLY_ETHER,
};
static const struct usb_device_id products[] = {
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index bc86f4b..c98d3a7 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -1231,7 +1231,7 @@ static const struct driver_info smsc95xx_info = {
.rx_fixup = smsc95xx_rx_fixup,
.tx_fixup = smsc95xx_tx_fixup,
.status = smsc95xx_status,
- .flags = FLAG_ETHER | FLAG_SEND_ZLP,
+ .flags = FLAG_ETHER | FLAG_SEND_ZLP | FLAG_REALLY_ETHER,
};
static const struct usb_device_id products[] = {
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 95c41d5..b339d3f 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_PTP) == 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..e906700 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_PTP | 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_PTP | 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_PTP | 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_PTP | 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..5ecd8e7 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_PTP 0x1000 /* maybe use "usb%d" names */
+
/*
* Indicates to usbnet, that USB driver accumulates multiple IP packets.
* Affects statistic (counters) and short packet handling.
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [RFC] usbnet: use eth%d name for known ethernet devices
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-23 17:13 ` Arnd Bergmann
2011-03-23 18:46 ` Greg KH
2 siblings, 1 reply; 22+ messages in thread
From: Andy Green @ 2011-03-23 17:04 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Greg KH, Alan Cox, Benjamin Herrenschmidt, Nicolas Pitre,
Jaswinder Singh, Linux USB list, lkml, broonie, roger.quadros,
grant.likely, netdev, David Brownell
On 03/23/2011 04:56 PM, Somebody in the thread at some point said:
> 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.
> diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
> index bc86f4b..c98d3a7 100644
> --- a/drivers/net/usb/smsc95xx.c
> +++ b/drivers/net/usb/smsc95xx.c
> @@ -1231,7 +1231,7 @@ static const struct driver_info smsc95xx_info = {
> - .flags = FLAG_ETHER | FLAG_SEND_ZLP,
> + .flags = FLAG_ETHER | FLAG_SEND_ZLP | FLAG_REALLY_ETHER,
> if ((dev->driver_info->flags& FLAG_ETHER) != 0&&
> + ((dev->driver_info->flags& FLAG_PTP) == 0 ||
> + (net->dev_addr [0]& 0x02) == 0))
> strcpy (net->name, "eth%d");
So it just takes the approach that all smsc95xx are going to be eth%d?
Sounds good to me.
-Andy
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC] usbnet: use eth%d name for known ethernet devices
2011-03-23 17:04 ` Andy Green
@ 2011-03-23 17:11 ` Arnd Bergmann
[not found] ` <201103231811.54290.arnd-r2nGTMty4D4@public.gmane.org>
0 siblings, 1 reply; 22+ messages in thread
From: Arnd Bergmann @ 2011-03-23 17:11 UTC (permalink / raw)
To: andy.green
Cc: Greg KH, Alan Cox, Benjamin Herrenschmidt, Nicolas Pitre,
Jaswinder Singh, Linux USB list, lkml, broonie, roger.quadros,
grant.likely, netdev, David Brownell
On Wednesday 23 March 2011, Andy Green wrote:
> > diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
> > index bc86f4b..c98d3a7 100644
> > --- a/drivers/net/usb/smsc95xx.c
> > +++ b/drivers/net/usb/smsc95xx.c
> > @@ -1231,7 +1231,7 @@ static const struct driver_info smsc95xx_info = {
>
> > - .flags = FLAG_ETHER | FLAG_SEND_ZLP,
> > + .flags = FLAG_ETHER | FLAG_SEND_ZLP | FLAG_REALLY_ETHER,
>
> > if ((dev->driver_info->flags& FLAG_ETHER) != 0&&
> > + ((dev->driver_info->flags& FLAG_PTP) == 0 ||
> > + (net->dev_addr [0]& 0x02) == 0))
> > strcpy (net->name, "eth%d");
>
> So it just takes the approach that all smsc95xx are going to be eth%d?
Right, and all other drivers that are obviously ethernet-only, including
future drivers.
Arnd
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC] usbnet: use eth%d name for known ethernet devices
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:13 ` Arnd Bergmann
2011-03-23 17:54 ` David Anders
2011-03-23 18:46 ` Greg KH
2 siblings, 1 reply; 22+ messages in thread
From: Arnd Bergmann @ 2011-03-23 17:13 UTC (permalink / raw)
To: Greg KH
Cc: andy.green, Alan Cox, Benjamin Herrenschmidt, Nicolas Pitre,
Jaswinder Singh, Linux USB list, lkml, broonie, roger.quadros,
grant.likely, netdev, David Brownell
On Wednesday 23 March 2011, Arnd Bergmann wrote:
> --- a/drivers/net/usb/smsc75xx.c
> +++ b/drivers/net/usb/smsc75xx.c
> @@ -1244,7 +1244,7 @@ static const struct driver_info smsc75xx_info = {
> .rx_fixup = smsc75xx_rx_fixup,
> .tx_fixup = smsc75xx_tx_fixup,
> .status = smsc75xx_status,
> - .flags = FLAG_ETHER | FLAG_SEND_ZLP,
> + .flags = FLAG_ETHER | FLAG_SEND_ZLP | FLAG_REALLY_ETHER,
> };
>
> static const struct usb_device_id products[] = {
> diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
> index bc86f4b..c98d3a7 100644
> --- a/drivers/net/usb/smsc95xx.c
> +++ b/drivers/net/usb/smsc95xx.c
> @@ -1231,7 +1231,7 @@ static const struct driver_info smsc95xx_info = {
> .rx_fixup = smsc95xx_rx_fixup,
> .tx_fixup = smsc95xx_tx_fixup,
> .status = smsc95xx_status,
> - .flags = FLAG_ETHER | FLAG_SEND_ZLP,
> + .flags = FLAG_ETHER | FLAG_SEND_ZLP | FLAG_REALLY_ETHER,
> };
>
These two hunks are from an earlier version of the patch and should not
be there, they break compilation. I'll wait for more comments and
then send a fixed version.
Arnd
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC] usbnet: use eth%d name for known ethernet devices
2011-03-23 17:13 ` Arnd Bergmann
@ 2011-03-23 17:54 ` David Anders
0 siblings, 0 replies; 22+ messages in thread
From: David Anders @ 2011-03-23 17:54 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Greg KH, andy.green@linaro.org, Alan Cox, Benjamin Herrenschmidt,
Nicolas Pitre, Jaswinder Singh, Linux USB list, lkml,
broonie@opensource.wolfsonmicro.com, roger.quadros@nokia.com,
grant.likely@secretlab.ca, netdev@vger.kernel.org, David Brownell
On 03/23/2011 12:13 PM, Arnd Bergmann wrote:
> On Wednesday 23 March 2011, Arnd Bergmann wrote:
>
>> --- a/drivers/net/usb/smsc75xx.c
>> +++ b/drivers/net/usb/smsc75xx.c
>> @@ -1244,7 +1244,7 @@ static const struct driver_info smsc75xx_info = {
>> .rx_fixup = smsc75xx_rx_fixup,
>> .tx_fixup = smsc75xx_tx_fixup,
>> .status = smsc75xx_status,
>> - .flags = FLAG_ETHER | FLAG_SEND_ZLP,
>> + .flags = FLAG_ETHER | FLAG_SEND_ZLP | FLAG_REALLY_ETHER,
>> };
>>
>> static const struct usb_device_id products[] = {
>> diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
>> index bc86f4b..c98d3a7 100644
>> --- a/drivers/net/usb/smsc95xx.c
>> +++ b/drivers/net/usb/smsc95xx.c
>> @@ -1231,7 +1231,7 @@ static const struct driver_info smsc95xx_info = {
>> .rx_fixup = smsc95xx_rx_fixup,
>> .tx_fixup = smsc95xx_tx_fixup,
>> .status = smsc95xx_status,
>> - .flags = FLAG_ETHER | FLAG_SEND_ZLP,
>> + .flags = FLAG_ETHER | FLAG_SEND_ZLP | FLAG_REALLY_ETHER,
>> };
>>
>>
> These two hunks are from an earlier version of the patch and should not
> be there, they break compilation. I'll wait for more comments and
> then send a fixed version.
>
> Arnd
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
tested with 2.6.38 using omap2plus_defconfig with EHCI and smsc95xx
turned on minus the FLAG_REALLY_ETHER. appears to work properly, assigns
as eth0.
i ran some basic net tests with no issues.
Dave Anders
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC] usbnet: use eth%d name for known ethernet devices
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:13 ` Arnd Bergmann
@ 2011-03-23 18:46 ` Greg KH
2011-03-23 19:35 ` Arnd Bergmann
2 siblings, 1 reply; 22+ messages in thread
From: Greg KH @ 2011-03-23 18:46 UTC (permalink / raw)
To: Arnd Bergmann
Cc: andy.green, Alan Cox, Benjamin Herrenschmidt, Nicolas Pitre,
Jaswinder Singh, Linux USB list, lkml, broonie, roger.quadros,
grant.likely, netdev, David Brownell
On Wed, Mar 23, 2011 at 05:56:39PM +0100, Arnd Bergmann wrote:
> 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>
Looks good to me, but some questions:
> drivers/usb/serial/usb_wwan.c | 2 +-
You don't modify this file in the diff, what caused this to show up in
the diffstat?
> --- 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_PTP 0x1000 /* maybe use "usb%d" names */
"PTP"? What does that stand for?
curious,
greg k-h
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC] usbnet: use eth%d name for known ethernet devices
2011-03-23 18:46 ` Greg KH
@ 2011-03-23 19:35 ` Arnd Bergmann
[not found] ` <AANLkTim7hPfTv3gDYnh+jGxHBg0OvX=r1FKYoHnH7H_o@mail.gmail.com>
0 siblings, 1 reply; 22+ messages in thread
From: Arnd Bergmann @ 2011-03-23 19:35 UTC (permalink / raw)
To: Greg KH
Cc: andy.green, Alan Cox, Benjamin Herrenschmidt, Nicolas Pitre,
Jaswinder Singh, Linux USB list, lkml, broonie, roger.quadros,
grant.likely, netdev, David Brownell
On Wednesday 23 March 2011 19:46:50 Greg KH wrote:
> Looks good to me, but some questions:
>
> > drivers/usb/serial/usb_wwan.c | 2 +-
>
> You don't modify this file in the diff, what caused this to show up in
> the diffstat?
A stale change I had to do to get the kernel to build on my
machine. The original problem seems fixed now. I had removed
this hunk from the patch but forgot to remove it from the diffstat.
> > --- 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_PTP 0x1000 /* maybe use "usb%d" names */
>
> "PTP"? What does that stand for?
point-to-point, I'll improve the comment to spell it out when I send the
fixed version.
Arnd
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC] usbnet: use eth%d name for known ethernet devices
[not found] ` <AANLkTim7hPfTv3gDYnh+jGxHBg0OvX=r1FKYoHnH7H_o@mail.gmail.com>
@ 2011-03-23 19:57 ` Arnd Bergmann
2011-03-23 19:59 ` Randy Dunlap
0 siblings, 1 reply; 22+ messages in thread
From: Arnd Bergmann @ 2011-03-23 19:57 UTC (permalink / raw)
To: Michał Nazarewicz
Cc: broonie, lkml, Nicolas Pitre, Greg KH, David Brownell, Alan Cox,
grant.likely, Linux USB list, andy.green, netdev,
Benjamin Herrenschmidt, roger.quadros, Jaswinder Singh
On Wednesday 23 March 2011 20:53:13 Michał Nazarewicz wrote:
> On Mar 23, 2011 8:36 PM, "Arnd Bergmann" <arnd@arndb.de> wrote:
> >
> > On Wednesday 23 March 2011 19:46:50 Greg KH wrote:
> > > > @@ -97,6 +97,8 @@ struct driver_info {
> > > >
> > > > #define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */
> > > >
> > > > +#define FLAG_PTP 0x1000 /* maybe use "usb%d" names */
> > >
> > > "PTP"? What does that stand for?
> >
> > point-to-point, I'll improve the comment to spell it out when I send the
> > fixed version.
>
> I think P2P could be better.
Yes, good idea.
Arnd
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC] usbnet: use eth%d name for known ethernet devices
2011-03-23 19:57 ` Arnd Bergmann
@ 2011-03-23 19:59 ` Randy Dunlap
2011-03-23 23:17 ` Michal Nazarewicz
0 siblings, 1 reply; 22+ messages in thread
From: Randy Dunlap @ 2011-03-23 19:59 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Michał Nazarewicz, broonie, lkml, Nicolas Pitre, Greg KH,
David Brownell, Alan Cox, grant.likely, Linux USB list,
andy.green, netdev, Benjamin Herrenschmidt, roger.quadros,
Jaswinder Singh
On Wed, 23 Mar 2011 20:57:18 +0100 Arnd Bergmann wrote:
> On Wednesday 23 March 2011 20:53:13 Michał Nazarewicz wrote:
> > On Mar 23, 2011 8:36 PM, "Arnd Bergmann" <arnd@arndb.de> wrote:
> > >
> > > On Wednesday 23 March 2011 19:46:50 Greg KH wrote:
> > > > > @@ -97,6 +97,8 @@ struct driver_info {
> > > > >
> > > > > #define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */
> > > > >
> > > > > +#define FLAG_PTP 0x1000 /* maybe use "usb%d" names */
> > > >
> > > > "PTP"? What does that stand for?
> > >
> > > point-to-point, I'll improve the comment to spell it out when I send the
> > > fixed version.
> >
> > I think P2P could be better.
>
> Yes, good idea.
that's peer-to-peer.
OTOH, I knew that PTP was point-to-point.
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC] usbnet: use eth%d name for known ethernet devices
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
0 siblings, 2 replies; 22+ messages in thread
From: Michal Nazarewicz @ 2011-03-23 23:17 UTC (permalink / raw)
To: Randy Dunlap
Cc: Arnd Bergmann, Michał Nazarewicz, broonie, lkml,
Nicolas Pitre, Greg KH, David Brownell, Alan Cox, grant.likely,
Linux USB list, andy.green, netdev, Benjamin Herrenschmidt,
roger.quadros, Jaswinder Singh
[-- Attachment #1: Type: text/plain, Size: 1284 bytes --]
>>>>>> @@ -97,6 +97,8 @@ struct driver_info {
>>>>>>
>>>>>> #define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */
>>>>>>
>>>>>> +#define FLAG_PTP 0x1000 /* maybe use "usb%d" names */
>>>> On Wednesday 23 March 2011 19:46:50 Greg KH wrote:
>>>>> "PTP"? What does that stand for?
>>> On Mar 23, 2011 8:36 PM, "Arnd Bergmann" <arnd@arndb.de> wrote:
>>>> point-to-point, I'll improve the comment to spell it out when
>>>> I send the fixed version.
>> On Wednesday 23 March 2011 20:53:13 Michał Nazarewicz wrote:
>>> I think P2P could be better.
> On Wed, 23 Mar 2011 20:57:18 +0100 Arnd Bergmann wrote:
>> Yes, good idea.
Randy Dunlap <rdunlap@xenotime.net> writes:
> that's peer-to-peer.
>
> OTOH, I knew that PTP was point-to-point.
It can be any of that, depending on context. For me PTP is more like
Picture Transport Protocol, whereas "2" between two letters is usually
"to".
Just my two cents though, no strong feelings or anything.
--
Best regards, _ _
.o. | Liege of Serenly Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michal "mina86" Nazarewicz (o o)
ooo +-<mina86-mina86.com>-<jid:mina86-jabber.org>--ooO--(_)--Ooo--
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC] usbnet: use eth%d name for known ethernet devices
2011-03-23 23:17 ` Michal Nazarewicz
@ 2011-03-23 23:19 ` Randy Dunlap
2011-03-23 23:38 ` Steve Calfee
1 sibling, 0 replies; 22+ messages in thread
From: Randy Dunlap @ 2011-03-23 23:19 UTC (permalink / raw)
To: Michal Nazarewicz
Cc: Arnd Bergmann, broonie, lkml, Nicolas Pitre, Greg KH,
David Brownell, Alan Cox, grant.likely, Linux USB list,
andy.green, netdev, Benjamin Herrenschmidt, roger.quadros,
Jaswinder Singh
On Thu, 24 Mar 2011 00:17:34 +0100 Michal Nazarewicz wrote:
> >>>>>> @@ -97,6 +97,8 @@ struct driver_info {
> >>>>>>
> >>>>>> #define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */
> >>>>>>
> >>>>>> +#define FLAG_PTP 0x1000 /* maybe use "usb%d" names */
>
> >>>> On Wednesday 23 March 2011 19:46:50 Greg KH wrote:
> >>>>> "PTP"? What does that stand for?
>
> >>> On Mar 23, 2011 8:36 PM, "Arnd Bergmann" <arnd@arndb.de> wrote:
> >>>> point-to-point, I'll improve the comment to spell it out when
> >>>> I send the fixed version.
>
> >> On Wednesday 23 March 2011 20:53:13 Michał Nazarewicz wrote:
> >>> I think P2P could be better.
>
> > On Wed, 23 Mar 2011 20:57:18 +0100 Arnd Bergmann wrote:
> >> Yes, good idea.
>
> Randy Dunlap <rdunlap@xenotime.net> writes:
> > that's peer-to-peer.
> >
> > OTOH, I knew that PTP was point-to-point.
>
> It can be any of that, depending on context. For me PTP is more like
> Picture Transport Protocol, whereas "2" between two letters is usually
> "to".
>
> Just my two cents though, no strong feelings or anything.
Agreed.
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC] usbnet: use eth%d name for known ethernet devices
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
1 sibling, 1 reply; 22+ messages in thread
From: Steve Calfee @ 2011-03-23 23:38 UTC (permalink / raw)
To: Michal Nazarewicz
Cc: Randy Dunlap, Arnd Bergmann, broonie, lkml, Nicolas Pitre,
Greg KH, David Brownell, Alan Cox, grant.likely, Linux USB list,
andy.green, netdev, Benjamin Herrenschmidt, roger.quadros,
Jaswinder Singh
On 03/23/11 16:17, Michal Nazarewicz wrote:
>>>>>>> @@ -97,6 +97,8 @@ struct driver_info {
>>>>>>>
>>>>>>> #define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */
>>>>>>>
>>>>>>> +#define FLAG_PTP 0x1000 /* maybe use "usb%d" names */
>
>>>>> On Wednesday 23 March 2011 19:46:50 Greg KH wrote:
>>>>>> "PTP"? What does that stand for?
>
>>>> On Mar 23, 2011 8:36 PM, "Arnd Bergmann"<arnd@arndb.de> wrote:
>>>>> point-to-point, I'll improve the comment to spell it out when
>>>>> I send the fixed version.
>
>>> On Wednesday 23 March 2011 20:53:13 Michał Nazarewicz wrote:
>>>> I think P2P could be better.
>
>> On Wed, 23 Mar 2011 20:57:18 +0100 Arnd Bergmann wrote:
>>> Yes, good idea.
>
> Randy Dunlap<rdunlap@xenotime.net> writes:
>> that's peer-to-peer.
>>
>> OTOH, I knew that PTP was point-to-point.
>
> It can be any of that, depending on context. For me PTP is more like
> Picture Transport Protocol, whereas "2" between two letters is usually
> "to".
>
Well, my 2 cents, picture transport protocol is so obviously different
than flags for network interfaces it does not cause a mental collision.
However P2P is about to become a huge wifi issue, which definitely is in
the network space. So don't confuse things in the near future, don't use
P2P.
Maybe a completely different, not so overused flag name would be better.
Regards, Steve
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC] usbnet: use eth%d name for known ethernet devices
2011-03-23 23:38 ` Steve Calfee
@ 2011-03-24 0:01 ` Ben Hutchings
2011-03-24 13:13 ` Arnd Bergmann
0 siblings, 1 reply; 22+ messages in thread
From: Ben Hutchings @ 2011-03-24 0:01 UTC (permalink / raw)
To: Steve Calfee
Cc: Michal Nazarewicz, Randy Dunlap, Arnd Bergmann, broonie, lkml,
Nicolas Pitre, Greg KH, David Brownell, Alan Cox, grant.likely,
Linux USB list, andy.green, netdev, Benjamin Herrenschmidt,
roger.quadros, Jaswinder Singh
On Wed, 2011-03-23 at 16:38 -0700, Steve Calfee wrote:
> On 03/23/11 16:17, Michal Nazarewicz wrote:
> >>>>>>> @@ -97,6 +97,8 @@ struct driver_info {
> >>>>>>>
> >>>>>>> #define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */
> >>>>>>>
> >>>>>>> +#define FLAG_PTP 0x1000 /* maybe use "usb%d" names */
> >
> >>>>> On Wednesday 23 March 2011 19:46:50 Greg KH wrote:
> >>>>>> "PTP"? What does that stand for?
> >
> >>>> On Mar 23, 2011 8:36 PM, "Arnd Bergmann"<arnd@arndb.de> wrote:
> >>>>> point-to-point, I'll improve the comment to spell it out when
> >>>>> I send the fixed version.
> >
> >>> On Wednesday 23 March 2011 20:53:13 Michał Nazarewicz wrote:
> >>>> I think P2P could be better.
> >
> >> On Wed, 23 Mar 2011 20:57:18 +0100 Arnd Bergmann wrote:
> >>> Yes, good idea.
> >
> > Randy Dunlap<rdunlap@xenotime.net> writes:
> >> that's peer-to-peer.
> >>
> >> OTOH, I knew that PTP was point-to-point.
> >
> > It can be any of that, depending on context. For me PTP is more like
> > Picture Transport Protocol, whereas "2" between two letters is usually
> > "to".
> >
> Well, my 2 cents, picture transport protocol is so obviously different
> than flags for network interfaces it does not cause a mental collision.
PTP is also Precision Time Protocol, which *is* used on network
interfaces (maybe not USB-connected interfaces though).
Anyway, these USB cable interfaces can presumably be bridged to standard
Ethernet, so they are really no more point-to-point than any other
Ethernet link has been since the demise of the hub.
> However P2P is about to become a huge wifi issue, which definitely is in
> the network space. So don't confuse things in the near future, don't use
> P2P.
>
> Maybe a completely different, not so overused flag name would be better.
How about FLAG_NON_IEEE, meaning that the physical layer is not based on
an IEEE 802.3, 802.11 or other standard physical layer.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC] usbnet: use eth%d name for known ethernet devices
[not found] ` <201103231811.54290.arnd-r2nGTMty4D4@public.gmane.org>
@ 2011-03-24 10:45 ` Andy Green
0 siblings, 0 replies; 22+ messages in thread
From: Andy Green @ 2011-03-24 10:45 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Greg KH, Alan Cox, Benjamin Herrenschmidt, Nicolas Pitre,
Jaswinder Singh, Linux USB list, lkml,
broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E,
roger.quadros-xNZwKgViW5gAvxtiuMwx3w,
grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
netdev-u79uwXL29TY76Z2rM5mHXA, David Brownell
On 03/23/2011 05:11 PM, Somebody in the thread at some point said:
> On Wednesday 23 March 2011, Andy Green wrote:
>>> diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
>>> index bc86f4b..c98d3a7 100644
>>> --- a/drivers/net/usb/smsc95xx.c
>>> +++ b/drivers/net/usb/smsc95xx.c
>>> @@ -1231,7 +1231,7 @@ static const struct driver_info smsc95xx_info = {
>>
>>> - .flags = FLAG_ETHER | FLAG_SEND_ZLP,
>>> + .flags = FLAG_ETHER | FLAG_SEND_ZLP | FLAG_REALLY_ETHER,
>>
>>> if ((dev->driver_info->flags& FLAG_ETHER) != 0&&
>>> + ((dev->driver_info->flags& FLAG_PTP) == 0 ||
>>> + (net->dev_addr [0]& 0x02) == 0))
>>> strcpy (net->name, "eth%d");
>>
>> So it just takes the approach that all smsc95xx are going to be eth%d?
>
> Right, and all other drivers that are obviously ethernet-only, including
> future drivers.
I moved my tree over to using this patch now, it's working fine on Panda
/ smsc95xx as one would expect. Guys with pluggable smsc95xx are going
to find their device comes as eth%d not usb%d but that seems perfectly
defensible as how it always should have been.
So, nice job.
-Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC] usbnet: use eth%d name for known ethernet devices
2011-03-24 0:01 ` Ben Hutchings
@ 2011-03-24 13:13 ` Arnd Bergmann
2011-03-24 13:15 ` Arnd Bergmann
0 siblings, 1 reply; 22+ messages in thread
From: Arnd Bergmann @ 2011-03-24 13:13 UTC (permalink / raw)
To: Ben Hutchings
Cc: Steve Calfee, Michal Nazarewicz, Randy Dunlap, broonie, lkml,
Nicolas Pitre, Greg KH, David Brownell, Alan Cox, grant.likely,
Linux USB list, andy.green, netdev, Benjamin Herrenschmidt,
roger.quadros, Jaswinder Singh
On Thursday 24 March 2011, Ben Hutchings wrote:
> On Wed, 2011-03-23 at 16:38 -0700, Steve Calfee wrote:
> > On 03/23/11 16:17, Michal Nazarewicz wrote:
> > >>> On Wednesday 23 March 2011 20:53:13 Michał Nazarewicz wrote:
> > >>>> I think P2P could be better.
> > >>
> > >> OTOH, I knew that PTP was point-to-point.
> > >
> > > It can be any of that, depending on context. For me PTP is more like
> > > Picture Transport Protocol, whereas "2" between two letters is usually
> > > "to".
> > >
> > Well, my 2 cents, picture transport protocol is so obviously different
> > than flags for network interfaces it does not cause a mental collision.
>
> PTP is also Precision Time Protocol, which *is* used on network
> interfaces (maybe not USB-connected interfaces though).
>
> How about FLAG_NON_IEEE, meaning that the physical layer is not based on
> an IEEE 802.3, 802.11 or other standard physical layer.
I think that doesn't really express the meaning, since FLAG_WWAN is
presumably also not IEEE, right?
Thanks for the bike shedding everyone, I'll just use my own color then
and call it FLAG_POINTTOPOINT.
Arnd
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC] usbnet: use eth%d name for known ethernet devices
2011-03-24 13:13 ` Arnd Bergmann
@ 2011-03-24 13:15 ` Arnd Bergmann
2011-03-24 13:44 ` Andy Green
` (2 more replies)
0 siblings, 3 replies; 22+ messages in thread
From: Arnd Bergmann @ 2011-03-24 13:15 UTC (permalink / raw)
To: Ben Hutchings
Cc: Steve Calfee, Michal Nazarewicz, Randy Dunlap, broonie, lkml,
Nicolas Pitre, Greg KH, David Brownell, Alan Cox, grant.likely,
Linux USB list, andy.green, netdev, Benjamin Herrenschmidt,
roger.quadros, Jaswinder Singh, patches
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.
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [RFC] usbnet: use eth%d name for known ethernet devices
2011-03-24 13:15 ` Arnd Bergmann
@ 2011-03-24 13:44 ` Andy Green
[not found] ` <201103241415.45115.arnd-r2nGTMty4D4@public.gmane.org>
2011-03-24 17:20 ` Alexey Orishko
2 siblings, 0 replies; 22+ messages in thread
From: Andy Green @ 2011-03-24 13:44 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Ben Hutchings, Steve Calfee, Michal Nazarewicz, Randy Dunlap,
broonie, lkml, Nicolas Pitre, Greg KH, David Brownell, Alan Cox,
grant.likely, Linux USB list, netdev, Benjamin Herrenschmidt,
roger.quadros, Jaswinder Singh, patches
On 03/24/2011 01:15 PM, Somebody in the thread at some point said:
> 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
For Panda case at least,
Tested-by: Andy Green <andy.green@linaro.org>
-Andy
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC] usbnet: use eth%d name for known ethernet devices
[not found] ` <201103241415.45115.arnd-r2nGTMty4D4@public.gmane.org>
@ 2011-03-24 13:56 ` Alan Stern
0 siblings, 0 replies; 22+ messages in thread
From: Alan Stern @ 2011-03-24 13:56 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Ben Hutchings, Steve Calfee, Michal Nazarewicz, Randy Dunlap,
broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E, lkml,
Nicolas Pitre, Greg KH, David Brownell, Alan Cox,
grant.likely-s3s/WqlpOiPyB63q8FvJNQ, Linux USB list,
andy.green-QSEj5FYQhm4dnm+yROfE0A, netdev-u79uwXL29TY76Z2rM5mHXA,
Benjamin Herrenschmidt, roger.quadros-xNZwKgViW5gAvxtiuMwx3w,
Jaswinder Singh, patches-QSEj5FYQhm4dnm+yROfE0A
On Thu, 24 Mar 2011, Arnd Bergmann wrote:
> 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
You updated the flag name in the patch but not in the description.
> 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.
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC] usbnet: use eth%d name for known ethernet devices
2011-03-24 13:15 ` Arnd Bergmann
2011-03-24 13:44 ` Andy Green
[not found] ` <201103241415.45115.arnd-r2nGTMty4D4@public.gmane.org>
@ 2011-03-24 17:20 ` Alexey Orishko
2011-03-25 11:57 ` Arnd Bergmann
2 siblings, 1 reply; 22+ messages in thread
From: Alexey Orishko @ 2011-03-24 17:20 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Ben Hutchings, Steve Calfee, Michal Nazarewicz, Randy Dunlap,
broonie, lkml, Nicolas Pitre, Greg KH, David Brownell, Alan Cox,
grant.likely, Linux USB list, andy.green, netdev,
Benjamin Herrenschmidt, roger.quadros, Jaswinder Singh, patches
On Thu, Mar 24, 2011 at 2:15 PM, Arnd Bergmann <arnd@arndb.de> wrote:
>
> 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.
Should this paragraph above be a clue for the flag name?
Sorry for late comment, but having flag called FLAG_POINTTOPOINT is really
confusing. ptp, p2p terms are heavily used and will mislead folks.
Would it be better to call it something like IGNORE_MAC_ADDRESS if this is the
feature you are targeting?
/Alexey
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC] usbnet: use eth%d name for known ethernet devices
2011-03-24 17:20 ` Alexey Orishko
@ 2011-03-25 11:57 ` Arnd Bergmann
2011-03-25 16:26 ` Alexey Orishko
0 siblings, 1 reply; 22+ messages in thread
From: Arnd Bergmann @ 2011-03-25 11:57 UTC (permalink / raw)
To: Alexey Orishko
Cc: Ben Hutchings, Steve Calfee, Michal Nazarewicz, Randy Dunlap,
broonie, lkml, Nicolas Pitre, Greg KH, David Brownell, Alan Cox,
grant.likely, Linux USB list, andy.green, netdev,
Benjamin Herrenschmidt, roger.quadros, Jaswinder Singh, patches
On Thursday 24 March 2011, Alexey Orishko wrote:
> On Thu, Mar 24, 2011 at 2:15 PM, Arnd Bergmann <arnd@arndb.de> wrote:
>
> >
> > 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.
>
> Should this paragraph above be a clue for the flag name?
> Sorry for late comment, but having flag called FLAG_POINTTOPOINT is really
> confusing. ptp, p2p terms are heavily used and will mislead folks.
>
> Would it be better to call it something like IGNORE_MAC_ADDRESS if this is the
> feature you are targeting?
That would be a different way of looking at it. FLAG_POINTTOPOINT
describes what the device is (a USB cable connecting two hosts), and
that flag can be used for various things, where the only thing
we currently do is the netif naming.
FLAG_IGNORE_MAC_ADDRESS as you suggest describes the implementation
of the device naming, not why that is done.
The intent here was to some something that makes sense next to
FLAG_ETHER, FLAG_WWAN and FLAG_WLAN. I think FLAG_POINTTOPOINT
describes this best, although I'd also be happy with FLAG_PTP,
FLAG_P2P, FLAG_CABLE or FLAG_USBCABLE.
Arnd
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC] usbnet: use eth%d name for known ethernet devices
2011-03-25 11:57 ` Arnd Bergmann
@ 2011-03-25 16:26 ` Alexey Orishko
2011-03-25 16:43 ` Arnd Bergmann
0 siblings, 1 reply; 22+ messages in thread
From: Alexey Orishko @ 2011-03-25 16:26 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Ben Hutchings, Steve Calfee, Michal Nazarewicz, Randy Dunlap,
broonie, lkml, Nicolas Pitre, Greg KH, David Brownell, Alan Cox,
grant.likely, Linux USB list, andy.green, netdev,
Benjamin Herrenschmidt, roger.quadros, Jaswinder Singh, patches
On Fri, Mar 25, 2011 at 12:57 PM, Arnd Bergmann <arnd@arndb.de> wrote:
>
> That would be a different way of looking at it. FLAG_POINTTOPOINT
> describes what the device is (a USB cable connecting two hosts), and
> that flag can be used for various things, where the only thing
> we currently do is the netif naming.
>
For example, cdc_ether and cdc-ncm drivers can be used in different use cases:
a) when device terminates the IP traffic
or
b) where device is a wireless router.
In both cases ethernet frames are sent over usb cable and terminated
in device (eth header stripped), so it is point-to-point link for ethernet, but
looking from IP layer is not p2p link for case b).
Please, explain, based on your idea, do we set this flag in both cases or not?
Do you want to use the same netif name for both use cases described above?
/alexey
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [RFC] usbnet: use eth%d name for known ethernet devices
2011-03-25 16:26 ` Alexey Orishko
@ 2011-03-25 16:43 ` Arnd Bergmann
0 siblings, 0 replies; 22+ messages in thread
From: Arnd Bergmann @ 2011-03-25 16:43 UTC (permalink / raw)
To: Alexey Orishko
Cc: Ben Hutchings, Steve Calfee, Michal Nazarewicz, Randy Dunlap,
broonie, lkml, Nicolas Pitre, Greg KH, David Brownell, Alan Cox,
grant.likely, Linux USB list, andy.green, netdev,
Benjamin Herrenschmidt, roger.quadros, Jaswinder Singh, patches
On Friday 25 March 2011, Alexey Orishko wrote:
> On Fri, Mar 25, 2011 at 12:57 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> >
> > That would be a different way of looking at it. FLAG_POINTTOPOINT
> > describes what the device is (a USB cable connecting two hosts), and
> > that flag can be used for various things, where the only thing
> > we currently do is the netif naming.
> >
>
> For example, cdc_ether and cdc-ncm drivers can be used in different use cases:
> a) when device terminates the IP traffic
> or
> b) where device is a wireless router.
>
> In both cases ethernet frames are sent over usb cable and terminated
> in device (eth header stripped), so it is point-to-point link for ethernet, but
> looking from IP layer is not p2p link for case b).
>
> Please, explain, based on your idea, do we set this flag in both cases or not?
> Do you want to use the same netif name for both use cases described above?
>
Most importantly, I want to keep the current rules, so that nothing breaks
for existing users.
For cdc_ether and cdc-ncm devices, my patch always sets both FLAG_ETHER and
FLAG_POINTTOPOINT, because the driver has no way to find out which of the
two is actually there.
The usb-net core driver interprets this as meaning that it has to decide
for the name based on something else, and that happens to be the presence
of a globally assigned MAC address. I don't think that keying off the MAC
address here is a particularly good idea, but that's what the driver has
always done.
Arnd
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2011-03-25 16:43 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <4D79F068.2080009@linaro.org>
[not found] ` <201103231712.06184.arnd@arndb.de>
[not found] ` <20110323162251.GA9367@kroah.com>
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
[not found] ` <201103231811.54290.arnd-r2nGTMty4D4@public.gmane.org>
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
2011-03-24 13:44 ` Andy Green
[not found] ` <201103241415.45115.arnd-r2nGTMty4D4@public.gmane.org>
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).