aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rndis_wlan.c
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@mbnet.fi>2009-07-30 12:41:47 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-08-04 16:44:16 -0400
commit27b7b5c131a1df6701a96e10d1056de8e3b15aa9 (patch)
tree77298aaa152109d284eb37f0470153a81af49d13 /drivers/net/wireless/rndis_wlan.c
parente5a11a822e1758b05b987e3a5041ef1029aa6cec (diff)
rndis_wlan: add rndis_set/query_oid debugging
Add better debugging for failed OID queries. Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rndis_wlan.c')
-rw-r--r--drivers/net/wireless/rndis_wlan.c86
1 files changed, 84 insertions, 2 deletions
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index 974f72497862..f6dcbb168b78 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -100,7 +100,6 @@ MODULE_PARM_DESC(workaround_interval,
100#define OID_GEN_RCV_ERROR cpu_to_le32(0x00020104) 100#define OID_GEN_RCV_ERROR cpu_to_le32(0x00020104)
101#define OID_GEN_RCV_NO_BUFFER cpu_to_le32(0x00020105) 101#define OID_GEN_RCV_NO_BUFFER cpu_to_le32(0x00020105)
102 102
103#define OID_802_3_PERMANENT_ADDRESS cpu_to_le32(0x01010101)
104#define OID_802_3_CURRENT_ADDRESS cpu_to_le32(0x01010102) 103#define OID_802_3_CURRENT_ADDRESS cpu_to_le32(0x01010102)
105#define OID_802_3_MULTICAST_LIST cpu_to_le32(0x01010103) 104#define OID_802_3_MULTICAST_LIST cpu_to_le32(0x01010103)
106#define OID_802_3_MAXIMUM_LIST_SIZE cpu_to_le32(0x01010104) 105#define OID_802_3_MAXIMUM_LIST_SIZE cpu_to_le32(0x01010104)
@@ -478,6 +477,68 @@ static u32 get_bcm4320_power_dbm(struct rndis_wlan_private *priv)
478} 477}
479 478
480 479
480#ifdef DEBUG
481static const char *oid_to_string(__le32 oid)
482{
483 switch (oid) {
484#define OID_STR(oid) case oid: return(#oid)
485 /* from rndis_host.h */
486 OID_STR(OID_802_3_PERMANENT_ADDRESS);
487 OID_STR(OID_GEN_MAXIMUM_FRAME_SIZE);
488 OID_STR(OID_GEN_CURRENT_PACKET_FILTER);
489 OID_STR(OID_GEN_PHYSICAL_MEDIUM);
490
491 /* from rndis_wlan.c */
492 OID_STR(OID_GEN_LINK_SPEED);
493 OID_STR(OID_GEN_RNDIS_CONFIG_PARAMETER);
494
495 OID_STR(OID_GEN_XMIT_OK);
496 OID_STR(OID_GEN_RCV_OK);
497 OID_STR(OID_GEN_XMIT_ERROR);
498 OID_STR(OID_GEN_RCV_ERROR);
499 OID_STR(OID_GEN_RCV_NO_BUFFER);
500
501 OID_STR(OID_802_3_CURRENT_ADDRESS);
502 OID_STR(OID_802_3_MULTICAST_LIST);
503 OID_STR(OID_802_3_MAXIMUM_LIST_SIZE);
504
505 OID_STR(OID_802_11_BSSID);
506 OID_STR(OID_802_11_SSID);
507 OID_STR(OID_802_11_INFRASTRUCTURE_MODE);
508 OID_STR(OID_802_11_ADD_WEP);
509 OID_STR(OID_802_11_REMOVE_WEP);
510 OID_STR(OID_802_11_DISASSOCIATE);
511 OID_STR(OID_802_11_AUTHENTICATION_MODE);
512 OID_STR(OID_802_11_PRIVACY_FILTER);
513 OID_STR(OID_802_11_BSSID_LIST_SCAN);
514 OID_STR(OID_802_11_ENCRYPTION_STATUS);
515 OID_STR(OID_802_11_ADD_KEY);
516 OID_STR(OID_802_11_REMOVE_KEY);
517 OID_STR(OID_802_11_ASSOCIATION_INFORMATION);
518 OID_STR(OID_802_11_PMKID);
519 OID_STR(OID_802_11_NETWORK_TYPES_SUPPORTED);
520 OID_STR(OID_802_11_NETWORK_TYPE_IN_USE);
521 OID_STR(OID_802_11_TX_POWER_LEVEL);
522 OID_STR(OID_802_11_RSSI);
523 OID_STR(OID_802_11_RSSI_TRIGGER);
524 OID_STR(OID_802_11_FRAGMENTATION_THRESHOLD);
525 OID_STR(OID_802_11_RTS_THRESHOLD);
526 OID_STR(OID_802_11_SUPPORTED_RATES);
527 OID_STR(OID_802_11_CONFIGURATION);
528 OID_STR(OID_802_11_BSSID_LIST);
529#undef OID_STR
530 }
531
532 return "?";
533}
534#else
535static const char *oid_to_string(__le32 oid)
536{
537 return "?";
538}
539#endif
540
541
481/* translate error code */ 542/* translate error code */
482static int rndis_error_status(__le32 rndis_status) 543static int rndis_error_status(__le32 rndis_status)
483{ 544{
@@ -533,11 +594,21 @@ static int rndis_query_oid(struct usbnet *dev, __le32 oid, void *data, int *len)
533 u.get->oid = oid; 594 u.get->oid = oid;
534 595
535 ret = rndis_command(dev, u.header, buflen); 596 ret = rndis_command(dev, u.header, buflen);
597 if (ret < 0)
598 devdbg(dev, "rndis_query_oid(%s): rndis_command() failed, %d "
599 "(%08x)", oid_to_string(oid), ret,
600 le32_to_cpu(u.get_c->status));
601
536 if (ret == 0) { 602 if (ret == 0) {
537 ret = le32_to_cpu(u.get_c->len); 603 ret = le32_to_cpu(u.get_c->len);
538 *len = (*len > ret) ? ret : *len; 604 *len = (*len > ret) ? ret : *len;
539 memcpy(data, u.buf + le32_to_cpu(u.get_c->offset) + 8, *len); 605 memcpy(data, u.buf + le32_to_cpu(u.get_c->offset) + 8, *len);
540 ret = rndis_error_status(u.get_c->status); 606 ret = rndis_error_status(u.get_c->status);
607
608 if (ret < 0)
609 devdbg(dev, "rndis_query_oid(%s): device returned "
610 "error, 0x%08x (%d)", oid_to_string(oid),
611 le32_to_cpu(u.get_c->status), ret);
541 } 612 }
542 613
543 mutex_unlock(&priv->command_lock); 614 mutex_unlock(&priv->command_lock);
@@ -583,9 +654,20 @@ static int rndis_set_oid(struct usbnet *dev, __le32 oid, void *data, int len)
583 memcpy(u.buf + sizeof(*u.set), data, len); 654 memcpy(u.buf + sizeof(*u.set), data, len);
584 655
585 ret = rndis_command(dev, u.header, buflen); 656 ret = rndis_command(dev, u.header, buflen);
586 if (ret == 0) 657 if (ret < 0)
658 devdbg(dev, "rndis_set_oid(%s): rndis_command() failed, %d "
659 "(%08x)", oid_to_string(oid), ret,
660 le32_to_cpu(u.set_c->status));
661
662 if (ret == 0) {
587 ret = rndis_error_status(u.set_c->status); 663 ret = rndis_error_status(u.set_c->status);
588 664
665 if (ret < 0)
666 devdbg(dev, "rndis_set_oid(%s): device returned error, "
667 "0x%08x (%d)", oid_to_string(oid),
668 le32_to_cpu(u.set_c->status), ret);
669 }
670
589 mutex_unlock(&priv->command_lock); 671 mutex_unlock(&priv->command_lock);
590 672
591 if (u.buf != priv->command_buffer) 673 if (u.buf != priv->command_buffer)