diff options
author | Arnd Bergmann <arnd.bergmann@linaro.org> | 2011-04-01 23:12:02 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-01 23:12:02 -0400 |
commit | c261344d3ce3edac781f9d3c7eabe2e96d8e8fe8 (patch) | |
tree | a0f71fa65dc9b6536a5e03e7621889d6ecf48f79 /drivers | |
parent | 1591cb60838603c8cc2c540192c8244962436539 (diff) |
usbnet: use eth%d name for known ethernet devices
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_POINTTOPOINT setting in
the usbnet driver_info. A driver can set both FLAG_POINTTOPOINT
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>
Tested-by: Andy Green <andy.green@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/usb/cdc_eem.c | 2 | ||||
-rw-r--r-- | drivers/net/usb/cdc_ether.c | 2 | ||||
-rw-r--r-- | drivers/net/usb/cdc_ncm.c | 2 | ||||
-rw-r--r-- | drivers/net/usb/cdc_subset.c | 8 | ||||
-rw-r--r-- | drivers/net/usb/gl620a.c | 2 | ||||
-rw-r--r-- | drivers/net/usb/net1080.c | 2 | ||||
-rw-r--r-- | drivers/net/usb/plusb.c | 2 | ||||
-rw-r--r-- | drivers/net/usb/rndis_host.c | 2 | ||||
-rw-r--r-- | drivers/net/usb/usbnet.c | 3 | ||||
-rw-r--r-- | drivers/net/usb/zaurus.c | 8 |
10 files changed, 21 insertions, 12 deletions
diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c index 5f3b97668e63..8f128541656d 100644 --- a/drivers/net/usb/cdc_eem.c +++ b/drivers/net/usb/cdc_eem.c | |||
@@ -340,7 +340,7 @@ next: | |||
340 | 340 | ||
341 | static const struct driver_info eem_info = { | 341 | static const struct driver_info eem_info = { |
342 | .description = "CDC EEM Device", | 342 | .description = "CDC EEM Device", |
343 | .flags = FLAG_ETHER, | 343 | .flags = FLAG_ETHER | FLAG_POINTTOPOINT, |
344 | .bind = eem_bind, | 344 | .bind = eem_bind, |
345 | .rx_fixup = eem_rx_fixup, | 345 | .rx_fixup = eem_rx_fixup, |
346 | .tx_fixup = eem_tx_fixup, | 346 | .tx_fixup = eem_tx_fixup, |
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 51c259b69278..341f7056a800 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c | |||
@@ -452,7 +452,7 @@ static int cdc_manage_power(struct usbnet *dev, int on) | |||
452 | 452 | ||
453 | static const struct driver_info cdc_info = { | 453 | static const struct driver_info cdc_info = { |
454 | .description = "CDC Ethernet Device", | 454 | .description = "CDC Ethernet Device", |
455 | .flags = FLAG_ETHER, | 455 | .flags = FLAG_ETHER | FLAG_POINTTOPOINT, |
456 | // .check_connect = cdc_check_connect, | 456 | // .check_connect = cdc_check_connect, |
457 | .bind = usbnet_cdc_bind, | 457 | .bind = usbnet_cdc_bind, |
458 | .unbind = usbnet_cdc_unbind, | 458 | .unbind = usbnet_cdc_unbind, |
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 7113168473cf..967371f04454 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) | |||
1237 | 1237 | ||
1238 | static const struct driver_info cdc_ncm_info = { | 1238 | static const struct driver_info cdc_ncm_info = { |
1239 | .description = "CDC NCM", | 1239 | .description = "CDC NCM", |
1240 | .flags = FLAG_NO_SETINT | FLAG_MULTI_PACKET, | 1240 | .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET, |
1241 | .bind = cdc_ncm_bind, | 1241 | .bind = cdc_ncm_bind, |
1242 | .unbind = cdc_ncm_unbind, | 1242 | .unbind = cdc_ncm_unbind, |
1243 | .check_connect = cdc_ncm_check_connect, | 1243 | .check_connect = cdc_ncm_check_connect, |
diff --git a/drivers/net/usb/cdc_subset.c b/drivers/net/usb/cdc_subset.c index ca39ace0b0eb..fc5f13d47ad9 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) | |||
89 | 89 | ||
90 | static const struct driver_info ali_m5632_info = { | 90 | static const struct driver_info ali_m5632_info = { |
91 | .description = "ALi M5632", | 91 | .description = "ALi M5632", |
92 | .flags = FLAG_POINTTOPOINT, | ||
92 | }; | 93 | }; |
93 | 94 | ||
94 | #endif | 95 | #endif |
@@ -110,6 +111,7 @@ static const struct driver_info ali_m5632_info = { | |||
110 | 111 | ||
111 | static const struct driver_info an2720_info = { | 112 | static const struct driver_info an2720_info = { |
112 | .description = "AnchorChips/Cypress 2720", | 113 | .description = "AnchorChips/Cypress 2720", |
114 | .flags = FLAG_POINTTOPOINT, | ||
113 | // no reset available! | 115 | // no reset available! |
114 | // no check_connect available! | 116 | // no check_connect available! |
115 | 117 | ||
@@ -132,6 +134,7 @@ static const struct driver_info an2720_info = { | |||
132 | 134 | ||
133 | static const struct driver_info belkin_info = { | 135 | static const struct driver_info belkin_info = { |
134 | .description = "Belkin, eTEK, or compatible", | 136 | .description = "Belkin, eTEK, or compatible", |
137 | .flags = FLAG_POINTTOPOINT, | ||
135 | }; | 138 | }; |
136 | 139 | ||
137 | #endif /* CONFIG_USB_BELKIN */ | 140 | #endif /* CONFIG_USB_BELKIN */ |
@@ -157,6 +160,7 @@ static const struct driver_info belkin_info = { | |||
157 | static const struct driver_info epson2888_info = { | 160 | static const struct driver_info epson2888_info = { |
158 | .description = "Epson USB Device", | 161 | .description = "Epson USB Device", |
159 | .check_connect = always_connected, | 162 | .check_connect = always_connected, |
163 | .flags = FLAG_POINTTOPOINT, | ||
160 | 164 | ||
161 | .in = 4, .out = 3, | 165 | .in = 4, .out = 3, |
162 | }; | 166 | }; |
@@ -173,6 +177,7 @@ static const struct driver_info epson2888_info = { | |||
173 | #define HAVE_HARDWARE | 177 | #define HAVE_HARDWARE |
174 | static const struct driver_info kc2190_info = { | 178 | static const struct driver_info kc2190_info = { |
175 | .description = "KC Technology KC-190", | 179 | .description = "KC Technology KC-190", |
180 | .flags = FLAG_POINTTOPOINT, | ||
176 | }; | 181 | }; |
177 | #endif /* CONFIG_USB_KC2190 */ | 182 | #endif /* CONFIG_USB_KC2190 */ |
178 | 183 | ||
@@ -200,16 +205,19 @@ static const struct driver_info kc2190_info = { | |||
200 | static const struct driver_info linuxdev_info = { | 205 | static const struct driver_info linuxdev_info = { |
201 | .description = "Linux Device", | 206 | .description = "Linux Device", |
202 | .check_connect = always_connected, | 207 | .check_connect = always_connected, |
208 | .flags = FLAG_POINTTOPOINT, | ||
203 | }; | 209 | }; |
204 | 210 | ||
205 | static const struct driver_info yopy_info = { | 211 | static const struct driver_info yopy_info = { |
206 | .description = "Yopy", | 212 | .description = "Yopy", |
207 | .check_connect = always_connected, | 213 | .check_connect = always_connected, |
214 | .flags = FLAG_POINTTOPOINT, | ||
208 | }; | 215 | }; |
209 | 216 | ||
210 | static const struct driver_info blob_info = { | 217 | static const struct driver_info blob_info = { |
211 | .description = "Boot Loader OBject", | 218 | .description = "Boot Loader OBject", |
212 | .check_connect = always_connected, | 219 | .check_connect = always_connected, |
220 | .flags = FLAG_POINTTOPOINT, | ||
213 | }; | 221 | }; |
214 | 222 | ||
215 | #endif /* CONFIG_USB_ARMLINUX */ | 223 | #endif /* CONFIG_USB_ARMLINUX */ |
diff --git a/drivers/net/usb/gl620a.c b/drivers/net/usb/gl620a.c index dcd57c37ef73..c4cfd1dea881 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) | |||
193 | 193 | ||
194 | static const struct driver_info genelink_info = { | 194 | static const struct driver_info genelink_info = { |
195 | .description = "Genesys GeneLink", | 195 | .description = "Genesys GeneLink", |
196 | .flags = FLAG_FRAMING_GL | FLAG_NO_SETINT, | 196 | .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_GL | FLAG_NO_SETINT, |
197 | .bind = genelink_bind, | 197 | .bind = genelink_bind, |
198 | .rx_fixup = genelink_rx_fixup, | 198 | .rx_fixup = genelink_rx_fixup, |
199 | .tx_fixup = genelink_tx_fixup, | 199 | .tx_fixup = genelink_tx_fixup, |
diff --git a/drivers/net/usb/net1080.c b/drivers/net/usb/net1080.c index ba72a7281cb0..01db4602a39e 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) | |||
560 | 560 | ||
561 | static const struct driver_info net1080_info = { | 561 | static const struct driver_info net1080_info = { |
562 | .description = "NetChip TurboCONNECT", | 562 | .description = "NetChip TurboCONNECT", |
563 | .flags = FLAG_FRAMING_NC, | 563 | .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_NC, |
564 | .bind = net1080_bind, | 564 | .bind = net1080_bind, |
565 | .reset = net1080_reset, | 565 | .reset = net1080_reset, |
566 | .check_connect = net1080_check_connect, | 566 | .check_connect = net1080_check_connect, |
diff --git a/drivers/net/usb/plusb.c b/drivers/net/usb/plusb.c index 08ad269f6b4e..823c53751307 100644 --- a/drivers/net/usb/plusb.c +++ b/drivers/net/usb/plusb.c | |||
@@ -96,7 +96,7 @@ static int pl_reset(struct usbnet *dev) | |||
96 | 96 | ||
97 | static const struct driver_info prolific_info = { | 97 | static const struct driver_info prolific_info = { |
98 | .description = "Prolific PL-2301/PL-2302", | 98 | .description = "Prolific PL-2301/PL-2302", |
99 | .flags = FLAG_NO_SETINT, | 99 | .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT, |
100 | /* some PL-2302 versions seem to fail usb_set_interface() */ | 100 | /* some PL-2302 versions seem to fail usb_set_interface() */ |
101 | .reset = pl_reset, | 101 | .reset = pl_reset, |
102 | }; | 102 | }; |
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c index dd8a4adf48ca..5994a25c56ac 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); | |||
573 | 573 | ||
574 | static const struct driver_info rndis_info = { | 574 | static const struct driver_info rndis_info = { |
575 | .description = "RNDIS device", | 575 | .description = "RNDIS device", |
576 | .flags = FLAG_ETHER | FLAG_FRAMING_RN | FLAG_NO_SETINT, | 576 | .flags = FLAG_ETHER | FLAG_POINTTOPOINT | FLAG_FRAMING_RN | FLAG_NO_SETINT, |
577 | .bind = rndis_bind, | 577 | .bind = rndis_bind, |
578 | .unbind = rndis_unbind, | 578 | .unbind = rndis_unbind, |
579 | .status = rndis_status, | 579 | .status = rndis_status, |
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index cf58b7682565..069c1cf0fdf7 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -1380,7 +1380,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) | |||
1380 | // else "eth%d" when there's reasonable doubt. userspace | 1380 | // else "eth%d" when there's reasonable doubt. userspace |
1381 | // can rename the link if it knows better. | 1381 | // can rename the link if it knows better. |
1382 | if ((dev->driver_info->flags & FLAG_ETHER) != 0 && | 1382 | if ((dev->driver_info->flags & FLAG_ETHER) != 0 && |
1383 | (net->dev_addr [0] & 0x02) == 0) | 1383 | ((dev->driver_info->flags & FLAG_POINTTOPOINT) == 0 || |
1384 | (net->dev_addr [0] & 0x02) == 0)) | ||
1384 | strcpy (net->name, "eth%d"); | 1385 | strcpy (net->name, "eth%d"); |
1385 | /* WLAN devices should always be named "wlan%d" */ | 1386 | /* WLAN devices should always be named "wlan%d" */ |
1386 | if ((dev->driver_info->flags & FLAG_WLAN) != 0) | 1387 | if ((dev->driver_info->flags & FLAG_WLAN) != 0) |
diff --git a/drivers/net/usb/zaurus.c b/drivers/net/usb/zaurus.c index 3eb0b167b5b4..241756e0e86f 100644 --- a/drivers/net/usb/zaurus.c +++ b/drivers/net/usb/zaurus.c | |||
@@ -102,7 +102,7 @@ static int always_connected (struct usbnet *dev) | |||
102 | 102 | ||
103 | static const struct driver_info zaurus_sl5x00_info = { | 103 | static const struct driver_info zaurus_sl5x00_info = { |
104 | .description = "Sharp Zaurus SL-5x00", | 104 | .description = "Sharp Zaurus SL-5x00", |
105 | .flags = FLAG_FRAMING_Z, | 105 | .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_Z, |
106 | .check_connect = always_connected, | 106 | .check_connect = always_connected, |
107 | .bind = zaurus_bind, | 107 | .bind = zaurus_bind, |
108 | .unbind = usbnet_cdc_unbind, | 108 | .unbind = usbnet_cdc_unbind, |
@@ -112,7 +112,7 @@ static const struct driver_info zaurus_sl5x00_info = { | |||
112 | 112 | ||
113 | static const struct driver_info zaurus_pxa_info = { | 113 | static const struct driver_info zaurus_pxa_info = { |
114 | .description = "Sharp Zaurus, PXA-2xx based", | 114 | .description = "Sharp Zaurus, PXA-2xx based", |
115 | .flags = FLAG_FRAMING_Z, | 115 | .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_Z, |
116 | .check_connect = always_connected, | 116 | .check_connect = always_connected, |
117 | .bind = zaurus_bind, | 117 | .bind = zaurus_bind, |
118 | .unbind = usbnet_cdc_unbind, | 118 | .unbind = usbnet_cdc_unbind, |
@@ -122,7 +122,7 @@ static const struct driver_info zaurus_pxa_info = { | |||
122 | 122 | ||
123 | static const struct driver_info olympus_mxl_info = { | 123 | static const struct driver_info olympus_mxl_info = { |
124 | .description = "Olympus R1000", | 124 | .description = "Olympus R1000", |
125 | .flags = FLAG_FRAMING_Z, | 125 | .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_Z, |
126 | .check_connect = always_connected, | 126 | .check_connect = always_connected, |
127 | .bind = zaurus_bind, | 127 | .bind = zaurus_bind, |
128 | .unbind = usbnet_cdc_unbind, | 128 | .unbind = usbnet_cdc_unbind, |
@@ -258,7 +258,7 @@ bad_desc: | |||
258 | 258 | ||
259 | static const struct driver_info bogus_mdlm_info = { | 259 | static const struct driver_info bogus_mdlm_info = { |
260 | .description = "pseudo-MDLM (BLAN) device", | 260 | .description = "pseudo-MDLM (BLAN) device", |
261 | .flags = FLAG_FRAMING_Z, | 261 | .flags = FLAG_POINTTOPOINT | FLAG_FRAMING_Z, |
262 | .check_connect = always_connected, | 262 | .check_connect = always_connected, |
263 | .tx_fixup = zaurus_tx_fixup, | 263 | .tx_fixup = zaurus_tx_fixup, |
264 | .bind = blan_mdlm_bind, | 264 | .bind = blan_mdlm_bind, |