aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/rndis_host.c
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@mbnet.fi>2008-01-27 16:34:33 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-31 22:26:59 -0500
commit039ee17d1baabaa21783a0d5ab3e8c6d8c794bdf (patch)
tree245fafd78aa16a002b7aa7d539f517172d256338 /drivers/net/usb/rndis_host.c
parent5d6ecf6c5d4994198527496fa51ea119030400e0 (diff)
rndis_host: Add RNDIS physical medium checking into generic_rndis_bind()
Add RNDIS physical medium checking into generic_rndis_bind() and also make rndis_host to be only bind on every medium except wireless. Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi> Acked-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb/rndis_host.c')
-rw-r--r--drivers/net/usb/rndis_host.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index 800c9d02c3f..0606e11510a 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -271,7 +271,8 @@ response_error:
271 return -EDOM; 271 return -EDOM;
272} 272}
273 273
274int generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf) 274int
275generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
275{ 276{
276 int retval; 277 int retval;
277 struct net_device *net = dev->net; 278 struct net_device *net = dev->net;
@@ -287,7 +288,7 @@ int generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf)
287 struct rndis_set_c *set_c; 288 struct rndis_set_c *set_c;
288 struct rndis_halt *halt; 289 struct rndis_halt *halt;
289 } u; 290 } u;
290 u32 tmp; 291 u32 tmp, *phym;
291 int reply_len; 292 int reply_len;
292 unsigned char *bp; 293 unsigned char *bp;
293 294
@@ -358,6 +359,30 @@ int generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf)
358 dev->driver_info->early_init(dev) != 0) 359 dev->driver_info->early_init(dev) != 0)
359 goto halt_fail_and_release; 360 goto halt_fail_and_release;
360 361
362 /* Check physical medium */
363 reply_len = sizeof *phym;
364 retval = rndis_query(dev, intf, u.buf, OID_GEN_PHYSICAL_MEDIUM,
365 0, (void **) &phym, &reply_len);
366 if (retval != 0)
367 /* OID is optional so don't fail here. */
368 *phym = RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED;
369 if ((flags & FLAG_RNDIS_PHYM_WIRELESS) &&
370 *phym != RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) {
371 if (netif_msg_probe(dev))
372 dev_dbg(&intf->dev, "driver requires wireless "
373 "physical medium, but device is not.\n");
374 retval = -ENODEV;
375 goto halt_fail_and_release;
376 }
377 if ((flags & FLAG_RNDIS_PHYM_NOT_WIRELESS) &&
378 *phym == RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) {
379 if (netif_msg_probe(dev))
380 dev_dbg(&intf->dev, "driver requires non-wireless "
381 "physical medium, but device is wireless.\n");
382 retval = -ENODEV;
383 goto halt_fail_and_release;
384 }
385
361 /* Get designated host ethernet address */ 386 /* Get designated host ethernet address */
362 reply_len = ETH_ALEN; 387 reply_len = ETH_ALEN;
363 retval = rndis_query(dev, intf, u.buf, OID_802_3_PERMANENT_ADDRESS, 388 retval = rndis_query(dev, intf, u.buf, OID_802_3_PERMANENT_ADDRESS,
@@ -403,6 +428,11 @@ fail:
403} 428}
404EXPORT_SYMBOL_GPL(generic_rndis_bind); 429EXPORT_SYMBOL_GPL(generic_rndis_bind);
405 430
431static int rndis_bind(struct usbnet *dev, struct usb_interface *intf)
432{
433 return generic_rndis_bind(dev, intf, FLAG_RNDIS_PHYM_NOT_WIRELESS);
434}
435
406void rndis_unbind(struct usbnet *dev, struct usb_interface *intf) 436void rndis_unbind(struct usbnet *dev, struct usb_interface *intf)
407{ 437{
408 struct rndis_halt *halt; 438 struct rndis_halt *halt;
@@ -518,7 +548,7 @@ EXPORT_SYMBOL_GPL(rndis_tx_fixup);
518static const struct driver_info rndis_info = { 548static const struct driver_info rndis_info = {
519 .description = "RNDIS device", 549 .description = "RNDIS device",
520 .flags = FLAG_ETHER | FLAG_FRAMING_RN | FLAG_NO_SETINT, 550 .flags = FLAG_ETHER | FLAG_FRAMING_RN | FLAG_NO_SETINT,
521 .bind = generic_rndis_bind, 551 .bind = rndis_bind,
522 .unbind = rndis_unbind, 552 .unbind = rndis_unbind,
523 .status = rndis_status, 553 .status = rndis_status,
524 .rx_fixup = rndis_rx_fixup, 554 .rx_fixup = rndis_rx_fixup,