diff options
Diffstat (limited to 'drivers/net/wireless/rndis_wlan.c')
-rw-r--r-- | drivers/net/wireless/rndis_wlan.c | 373 |
1 files changed, 181 insertions, 192 deletions
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index 748a89de50d0..c5404eb82b2f 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c | |||
@@ -88,49 +88,6 @@ module_param_named(workaround_interval, modparam_workaround_interval, | |||
88 | MODULE_PARM_DESC(workaround_interval, | 88 | MODULE_PARM_DESC(workaround_interval, |
89 | "set stall workaround interval in msecs (0=disabled) (default: 0)"); | 89 | "set stall workaround interval in msecs (0=disabled) (default: 0)"); |
90 | 90 | ||
91 | |||
92 | /* various RNDIS OID defs */ | ||
93 | #define OID_GEN_LINK_SPEED cpu_to_le32(0x00010107) | ||
94 | #define OID_GEN_RNDIS_CONFIG_PARAMETER cpu_to_le32(0x0001021b) | ||
95 | |||
96 | #define OID_GEN_XMIT_OK cpu_to_le32(0x00020101) | ||
97 | #define OID_GEN_RCV_OK cpu_to_le32(0x00020102) | ||
98 | #define OID_GEN_XMIT_ERROR cpu_to_le32(0x00020103) | ||
99 | #define OID_GEN_RCV_ERROR cpu_to_le32(0x00020104) | ||
100 | #define OID_GEN_RCV_NO_BUFFER cpu_to_le32(0x00020105) | ||
101 | |||
102 | #define OID_802_3_CURRENT_ADDRESS cpu_to_le32(0x01010102) | ||
103 | #define OID_802_3_MULTICAST_LIST cpu_to_le32(0x01010103) | ||
104 | #define OID_802_3_MAXIMUM_LIST_SIZE cpu_to_le32(0x01010104) | ||
105 | |||
106 | #define OID_802_11_BSSID cpu_to_le32(0x0d010101) | ||
107 | #define OID_802_11_SSID cpu_to_le32(0x0d010102) | ||
108 | #define OID_802_11_INFRASTRUCTURE_MODE cpu_to_le32(0x0d010108) | ||
109 | #define OID_802_11_ADD_WEP cpu_to_le32(0x0d010113) | ||
110 | #define OID_802_11_REMOVE_WEP cpu_to_le32(0x0d010114) | ||
111 | #define OID_802_11_DISASSOCIATE cpu_to_le32(0x0d010115) | ||
112 | #define OID_802_11_AUTHENTICATION_MODE cpu_to_le32(0x0d010118) | ||
113 | #define OID_802_11_PRIVACY_FILTER cpu_to_le32(0x0d010119) | ||
114 | #define OID_802_11_BSSID_LIST_SCAN cpu_to_le32(0x0d01011a) | ||
115 | #define OID_802_11_ENCRYPTION_STATUS cpu_to_le32(0x0d01011b) | ||
116 | #define OID_802_11_ADD_KEY cpu_to_le32(0x0d01011d) | ||
117 | #define OID_802_11_REMOVE_KEY cpu_to_le32(0x0d01011e) | ||
118 | #define OID_802_11_ASSOCIATION_INFORMATION cpu_to_le32(0x0d01011f) | ||
119 | #define OID_802_11_CAPABILITY cpu_to_le32(0x0d010122) | ||
120 | #define OID_802_11_PMKID cpu_to_le32(0x0d010123) | ||
121 | #define OID_802_11_NETWORK_TYPES_SUPPORTED cpu_to_le32(0x0d010203) | ||
122 | #define OID_802_11_NETWORK_TYPE_IN_USE cpu_to_le32(0x0d010204) | ||
123 | #define OID_802_11_TX_POWER_LEVEL cpu_to_le32(0x0d010205) | ||
124 | #define OID_802_11_RSSI cpu_to_le32(0x0d010206) | ||
125 | #define OID_802_11_RSSI_TRIGGER cpu_to_le32(0x0d010207) | ||
126 | #define OID_802_11_FRAGMENTATION_THRESHOLD cpu_to_le32(0x0d010209) | ||
127 | #define OID_802_11_RTS_THRESHOLD cpu_to_le32(0x0d01020a) | ||
128 | #define OID_802_11_SUPPORTED_RATES cpu_to_le32(0x0d01020e) | ||
129 | #define OID_802_11_CONFIGURATION cpu_to_le32(0x0d010211) | ||
130 | #define OID_802_11_POWER_MODE cpu_to_le32(0x0d010216) | ||
131 | #define OID_802_11_BSSID_LIST cpu_to_le32(0x0d010217) | ||
132 | |||
133 | |||
134 | /* Typical noise/maximum signal level values taken from ndiswrapper iw_ndis.h */ | 91 | /* Typical noise/maximum signal level values taken from ndiswrapper iw_ndis.h */ |
135 | #define WL_NOISE -96 /* typical noise level in dBm */ | 92 | #define WL_NOISE -96 /* typical noise level in dBm */ |
136 | #define WL_SIGMAX -32 /* typical maximum signal level in dBm */ | 93 | #define WL_SIGMAX -32 /* typical maximum signal level in dBm */ |
@@ -149,12 +106,6 @@ MODULE_PARM_DESC(workaround_interval, | |||
149 | #define BCM4320_DEFAULT_TXPOWER_DBM_50 10 | 106 | #define BCM4320_DEFAULT_TXPOWER_DBM_50 10 |
150 | #define BCM4320_DEFAULT_TXPOWER_DBM_25 7 | 107 | #define BCM4320_DEFAULT_TXPOWER_DBM_25 7 |
151 | 108 | ||
152 | |||
153 | /* codes for "status" field of completion messages */ | ||
154 | #define RNDIS_STATUS_ADAPTER_NOT_READY cpu_to_le32(0xc0010011) | ||
155 | #define RNDIS_STATUS_ADAPTER_NOT_OPEN cpu_to_le32(0xc0010012) | ||
156 | |||
157 | |||
158 | /* Known device types */ | 109 | /* Known device types */ |
159 | #define RNDIS_UNKNOWN 0 | 110 | #define RNDIS_UNKNOWN 0 |
160 | #define RNDIS_BCM4320A 1 | 111 | #define RNDIS_BCM4320A 1 |
@@ -515,7 +466,7 @@ struct rndis_wlan_private { | |||
515 | int infra_mode; | 466 | int infra_mode; |
516 | bool connected; | 467 | bool connected; |
517 | u8 bssid[ETH_ALEN]; | 468 | u8 bssid[ETH_ALEN]; |
518 | __le32 current_command_oid; | 469 | u32 current_command_oid; |
519 | 470 | ||
520 | /* encryption stuff */ | 471 | /* encryption stuff */ |
521 | u8 encr_tx_key_index; | 472 | u8 encr_tx_key_index; |
@@ -670,63 +621,63 @@ static int rndis_akm_suite_to_key_mgmt(u32 akm_suite) | |||
670 | } | 621 | } |
671 | 622 | ||
672 | #ifdef DEBUG | 623 | #ifdef DEBUG |
673 | static const char *oid_to_string(__le32 oid) | 624 | static const char *oid_to_string(u32 oid) |
674 | { | 625 | { |
675 | switch (oid) { | 626 | switch (oid) { |
676 | #define OID_STR(oid) case oid: return(#oid) | 627 | #define OID_STR(oid) case oid: return(#oid) |
677 | /* from rndis_host.h */ | 628 | /* from rndis_host.h */ |
678 | OID_STR(OID_802_3_PERMANENT_ADDRESS); | 629 | OID_STR(RNDIS_OID_802_3_PERMANENT_ADDRESS); |
679 | OID_STR(OID_GEN_MAXIMUM_FRAME_SIZE); | 630 | OID_STR(RNDIS_OID_GEN_MAXIMUM_FRAME_SIZE); |
680 | OID_STR(OID_GEN_CURRENT_PACKET_FILTER); | 631 | OID_STR(RNDIS_OID_GEN_CURRENT_PACKET_FILTER); |
681 | OID_STR(OID_GEN_PHYSICAL_MEDIUM); | 632 | OID_STR(RNDIS_OID_GEN_PHYSICAL_MEDIUM); |
682 | 633 | ||
683 | /* from rndis_wlan.c */ | 634 | /* from rndis_wlan.c */ |
684 | OID_STR(OID_GEN_LINK_SPEED); | 635 | OID_STR(RNDIS_OID_GEN_LINK_SPEED); |
685 | OID_STR(OID_GEN_RNDIS_CONFIG_PARAMETER); | 636 | OID_STR(RNDIS_OID_GEN_RNDIS_CONFIG_PARAMETER); |
686 | 637 | ||
687 | OID_STR(OID_GEN_XMIT_OK); | 638 | OID_STR(RNDIS_OID_GEN_XMIT_OK); |
688 | OID_STR(OID_GEN_RCV_OK); | 639 | OID_STR(RNDIS_OID_GEN_RCV_OK); |
689 | OID_STR(OID_GEN_XMIT_ERROR); | 640 | OID_STR(RNDIS_OID_GEN_XMIT_ERROR); |
690 | OID_STR(OID_GEN_RCV_ERROR); | 641 | OID_STR(RNDIS_OID_GEN_RCV_ERROR); |
691 | OID_STR(OID_GEN_RCV_NO_BUFFER); | 642 | OID_STR(RNDIS_OID_GEN_RCV_NO_BUFFER); |
692 | 643 | ||
693 | OID_STR(OID_802_3_CURRENT_ADDRESS); | 644 | OID_STR(RNDIS_OID_802_3_CURRENT_ADDRESS); |
694 | OID_STR(OID_802_3_MULTICAST_LIST); | 645 | OID_STR(RNDIS_OID_802_3_MULTICAST_LIST); |
695 | OID_STR(OID_802_3_MAXIMUM_LIST_SIZE); | 646 | OID_STR(RNDIS_OID_802_3_MAXIMUM_LIST_SIZE); |
696 | 647 | ||
697 | OID_STR(OID_802_11_BSSID); | 648 | OID_STR(RNDIS_OID_802_11_BSSID); |
698 | OID_STR(OID_802_11_SSID); | 649 | OID_STR(RNDIS_OID_802_11_SSID); |
699 | OID_STR(OID_802_11_INFRASTRUCTURE_MODE); | 650 | OID_STR(RNDIS_OID_802_11_INFRASTRUCTURE_MODE); |
700 | OID_STR(OID_802_11_ADD_WEP); | 651 | OID_STR(RNDIS_OID_802_11_ADD_WEP); |
701 | OID_STR(OID_802_11_REMOVE_WEP); | 652 | OID_STR(RNDIS_OID_802_11_REMOVE_WEP); |
702 | OID_STR(OID_802_11_DISASSOCIATE); | 653 | OID_STR(RNDIS_OID_802_11_DISASSOCIATE); |
703 | OID_STR(OID_802_11_AUTHENTICATION_MODE); | 654 | OID_STR(RNDIS_OID_802_11_AUTHENTICATION_MODE); |
704 | OID_STR(OID_802_11_PRIVACY_FILTER); | 655 | OID_STR(RNDIS_OID_802_11_PRIVACY_FILTER); |
705 | OID_STR(OID_802_11_BSSID_LIST_SCAN); | 656 | OID_STR(RNDIS_OID_802_11_BSSID_LIST_SCAN); |
706 | OID_STR(OID_802_11_ENCRYPTION_STATUS); | 657 | OID_STR(RNDIS_OID_802_11_ENCRYPTION_STATUS); |
707 | OID_STR(OID_802_11_ADD_KEY); | 658 | OID_STR(RNDIS_OID_802_11_ADD_KEY); |
708 | OID_STR(OID_802_11_REMOVE_KEY); | 659 | OID_STR(RNDIS_OID_802_11_REMOVE_KEY); |
709 | OID_STR(OID_802_11_ASSOCIATION_INFORMATION); | 660 | OID_STR(RNDIS_OID_802_11_ASSOCIATION_INFORMATION); |
710 | OID_STR(OID_802_11_CAPABILITY); | 661 | OID_STR(RNDIS_OID_802_11_CAPABILITY); |
711 | OID_STR(OID_802_11_PMKID); | 662 | OID_STR(RNDIS_OID_802_11_PMKID); |
712 | OID_STR(OID_802_11_NETWORK_TYPES_SUPPORTED); | 663 | OID_STR(RNDIS_OID_802_11_NETWORK_TYPES_SUPPORTED); |
713 | OID_STR(OID_802_11_NETWORK_TYPE_IN_USE); | 664 | OID_STR(RNDIS_OID_802_11_NETWORK_TYPE_IN_USE); |
714 | OID_STR(OID_802_11_TX_POWER_LEVEL); | 665 | OID_STR(RNDIS_OID_802_11_TX_POWER_LEVEL); |
715 | OID_STR(OID_802_11_RSSI); | 666 | OID_STR(RNDIS_OID_802_11_RSSI); |
716 | OID_STR(OID_802_11_RSSI_TRIGGER); | 667 | OID_STR(RNDIS_OID_802_11_RSSI_TRIGGER); |
717 | OID_STR(OID_802_11_FRAGMENTATION_THRESHOLD); | 668 | OID_STR(RNDIS_OID_802_11_FRAGMENTATION_THRESHOLD); |
718 | OID_STR(OID_802_11_RTS_THRESHOLD); | 669 | OID_STR(RNDIS_OID_802_11_RTS_THRESHOLD); |
719 | OID_STR(OID_802_11_SUPPORTED_RATES); | 670 | OID_STR(RNDIS_OID_802_11_SUPPORTED_RATES); |
720 | OID_STR(OID_802_11_CONFIGURATION); | 671 | OID_STR(RNDIS_OID_802_11_CONFIGURATION); |
721 | OID_STR(OID_802_11_POWER_MODE); | 672 | OID_STR(RNDIS_OID_802_11_POWER_MODE); |
722 | OID_STR(OID_802_11_BSSID_LIST); | 673 | OID_STR(RNDIS_OID_802_11_BSSID_LIST); |
723 | #undef OID_STR | 674 | #undef OID_STR |
724 | } | 675 | } |
725 | 676 | ||
726 | return "?"; | 677 | return "?"; |
727 | } | 678 | } |
728 | #else | 679 | #else |
729 | static const char *oid_to_string(__le32 oid) | 680 | static const char *oid_to_string(u32 oid) |
730 | { | 681 | { |
731 | return "?"; | 682 | return "?"; |
732 | } | 683 | } |
@@ -736,7 +687,7 @@ static const char *oid_to_string(__le32 oid) | |||
736 | static int rndis_error_status(__le32 rndis_status) | 687 | static int rndis_error_status(__le32 rndis_status) |
737 | { | 688 | { |
738 | int ret = -EINVAL; | 689 | int ret = -EINVAL; |
739 | switch (rndis_status) { | 690 | switch (le32_to_cpu(rndis_status)) { |
740 | case RNDIS_STATUS_SUCCESS: | 691 | case RNDIS_STATUS_SUCCESS: |
741 | ret = 0; | 692 | ret = 0; |
742 | break; | 693 | break; |
@@ -755,7 +706,7 @@ static int rndis_error_status(__le32 rndis_status) | |||
755 | return ret; | 706 | return ret; |
756 | } | 707 | } |
757 | 708 | ||
758 | static int rndis_query_oid(struct usbnet *dev, __le32 oid, void *data, int *len) | 709 | static int rndis_query_oid(struct usbnet *dev, u32 oid, void *data, int *len) |
759 | { | 710 | { |
760 | struct rndis_wlan_private *priv = get_rndis_wlan_priv(dev); | 711 | struct rndis_wlan_private *priv = get_rndis_wlan_priv(dev); |
761 | union { | 712 | union { |
@@ -782,9 +733,9 @@ static int rndis_query_oid(struct usbnet *dev, __le32 oid, void *data, int *len) | |||
782 | mutex_lock(&priv->command_lock); | 733 | mutex_lock(&priv->command_lock); |
783 | 734 | ||
784 | memset(u.get, 0, sizeof *u.get); | 735 | memset(u.get, 0, sizeof *u.get); |
785 | u.get->msg_type = RNDIS_MSG_QUERY; | 736 | u.get->msg_type = cpu_to_le32(RNDIS_MSG_QUERY); |
786 | u.get->msg_len = cpu_to_le32(sizeof *u.get); | 737 | u.get->msg_len = cpu_to_le32(sizeof *u.get); |
787 | u.get->oid = oid; | 738 | u.get->oid = cpu_to_le32(oid); |
788 | 739 | ||
789 | priv->current_command_oid = oid; | 740 | priv->current_command_oid = oid; |
790 | ret = rndis_command(dev, u.header, buflen); | 741 | ret = rndis_command(dev, u.header, buflen); |
@@ -839,7 +790,7 @@ exit_unlock: | |||
839 | return ret; | 790 | return ret; |
840 | } | 791 | } |
841 | 792 | ||
842 | static int rndis_set_oid(struct usbnet *dev, __le32 oid, const void *data, | 793 | static int rndis_set_oid(struct usbnet *dev, u32 oid, const void *data, |
843 | int len) | 794 | int len) |
844 | { | 795 | { |
845 | struct rndis_wlan_private *priv = get_rndis_wlan_priv(dev); | 796 | struct rndis_wlan_private *priv = get_rndis_wlan_priv(dev); |
@@ -866,9 +817,9 @@ static int rndis_set_oid(struct usbnet *dev, __le32 oid, const void *data, | |||
866 | mutex_lock(&priv->command_lock); | 817 | mutex_lock(&priv->command_lock); |
867 | 818 | ||
868 | memset(u.set, 0, sizeof *u.set); | 819 | memset(u.set, 0, sizeof *u.set); |
869 | u.set->msg_type = RNDIS_MSG_SET; | 820 | u.set->msg_type = cpu_to_le32(RNDIS_MSG_SET); |
870 | u.set->msg_len = cpu_to_le32(sizeof(*u.set) + len); | 821 | u.set->msg_len = cpu_to_le32(sizeof(*u.set) + len); |
871 | u.set->oid = oid; | 822 | u.set->oid = cpu_to_le32(oid); |
872 | u.set->len = cpu_to_le32(len); | 823 | u.set->len = cpu_to_le32(len); |
873 | u.set->offset = cpu_to_le32(sizeof(*u.set) - 8); | 824 | u.set->offset = cpu_to_le32(sizeof(*u.set) - 8); |
874 | u.set->handle = cpu_to_le32(0); | 825 | u.set->handle = cpu_to_le32(0); |
@@ -908,7 +859,7 @@ static int rndis_reset(struct usbnet *usbdev) | |||
908 | 859 | ||
909 | reset = (void *)priv->command_buffer; | 860 | reset = (void *)priv->command_buffer; |
910 | memset(reset, 0, sizeof(*reset)); | 861 | memset(reset, 0, sizeof(*reset)); |
911 | reset->msg_type = RNDIS_MSG_RESET; | 862 | reset->msg_type = cpu_to_le32(RNDIS_MSG_RESET); |
912 | reset->msg_len = cpu_to_le32(sizeof(*reset)); | 863 | reset->msg_len = cpu_to_le32(sizeof(*reset)); |
913 | priv->current_command_oid = 0; | 864 | priv->current_command_oid = 0; |
914 | ret = rndis_command(usbdev, (void *)reset, CONTROL_BUFFER_SIZE); | 865 | ret = rndis_command(usbdev, (void *)reset, CONTROL_BUFFER_SIZE); |
@@ -994,7 +945,7 @@ static int rndis_set_config_parameter(struct usbnet *dev, char *param, | |||
994 | } | 945 | } |
995 | #endif | 946 | #endif |
996 | 947 | ||
997 | ret = rndis_set_oid(dev, OID_GEN_RNDIS_CONFIG_PARAMETER, | 948 | ret = rndis_set_oid(dev, RNDIS_OID_GEN_RNDIS_CONFIG_PARAMETER, |
998 | infobuf, info_len); | 949 | infobuf, info_len); |
999 | if (ret != 0) | 950 | if (ret != 0) |
1000 | netdev_dbg(dev->net, "setting rndis config parameter failed, %d\n", | 951 | netdev_dbg(dev->net, "setting rndis config parameter failed, %d\n", |
@@ -1031,9 +982,9 @@ static int rndis_start_bssid_list_scan(struct usbnet *usbdev) | |||
1031 | { | 982 | { |
1032 | __le32 tmp; | 983 | __le32 tmp; |
1033 | 984 | ||
1034 | /* Note: OID_802_11_BSSID_LIST_SCAN clears internal BSS list. */ | 985 | /* Note: RNDIS_OID_802_11_BSSID_LIST_SCAN clears internal BSS list. */ |
1035 | tmp = cpu_to_le32(1); | 986 | tmp = cpu_to_le32(1); |
1036 | return rndis_set_oid(usbdev, OID_802_11_BSSID_LIST_SCAN, &tmp, | 987 | return rndis_set_oid(usbdev, RNDIS_OID_802_11_BSSID_LIST_SCAN, &tmp, |
1037 | sizeof(tmp)); | 988 | sizeof(tmp)); |
1038 | } | 989 | } |
1039 | 990 | ||
@@ -1042,7 +993,8 @@ static int set_essid(struct usbnet *usbdev, struct ndis_80211_ssid *ssid) | |||
1042 | struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); | 993 | struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); |
1043 | int ret; | 994 | int ret; |
1044 | 995 | ||
1045 | ret = rndis_set_oid(usbdev, OID_802_11_SSID, ssid, sizeof(*ssid)); | 996 | ret = rndis_set_oid(usbdev, RNDIS_OID_802_11_SSID, |
997 | ssid, sizeof(*ssid)); | ||
1046 | if (ret < 0) { | 998 | if (ret < 0) { |
1047 | netdev_warn(usbdev->net, "setting SSID failed (%08X)\n", ret); | 999 | netdev_warn(usbdev->net, "setting SSID failed (%08X)\n", ret); |
1048 | return ret; | 1000 | return ret; |
@@ -1059,7 +1011,8 @@ static int set_bssid(struct usbnet *usbdev, const u8 *bssid) | |||
1059 | { | 1011 | { |
1060 | int ret; | 1012 | int ret; |
1061 | 1013 | ||
1062 | ret = rndis_set_oid(usbdev, OID_802_11_BSSID, bssid, ETH_ALEN); | 1014 | ret = rndis_set_oid(usbdev, RNDIS_OID_802_11_BSSID, |
1015 | bssid, ETH_ALEN); | ||
1063 | if (ret < 0) { | 1016 | if (ret < 0) { |
1064 | netdev_warn(usbdev->net, "setting BSSID[%pM] failed (%08X)\n", | 1017 | netdev_warn(usbdev->net, "setting BSSID[%pM] failed (%08X)\n", |
1065 | bssid, ret); | 1018 | bssid, ret); |
@@ -1083,7 +1036,8 @@ static int get_bssid(struct usbnet *usbdev, u8 bssid[ETH_ALEN]) | |||
1083 | int ret, len; | 1036 | int ret, len; |
1084 | 1037 | ||
1085 | len = ETH_ALEN; | 1038 | len = ETH_ALEN; |
1086 | ret = rndis_query_oid(usbdev, OID_802_11_BSSID, bssid, &len); | 1039 | ret = rndis_query_oid(usbdev, RNDIS_OID_802_11_BSSID, |
1040 | bssid, &len); | ||
1087 | 1041 | ||
1088 | if (ret != 0) | 1042 | if (ret != 0) |
1089 | memset(bssid, 0, ETH_ALEN); | 1043 | memset(bssid, 0, ETH_ALEN); |
@@ -1094,8 +1048,9 @@ static int get_bssid(struct usbnet *usbdev, u8 bssid[ETH_ALEN]) | |||
1094 | static int get_association_info(struct usbnet *usbdev, | 1048 | static int get_association_info(struct usbnet *usbdev, |
1095 | struct ndis_80211_assoc_info *info, int len) | 1049 | struct ndis_80211_assoc_info *info, int len) |
1096 | { | 1050 | { |
1097 | return rndis_query_oid(usbdev, OID_802_11_ASSOCIATION_INFORMATION, | 1051 | return rndis_query_oid(usbdev, |
1098 | info, &len); | 1052 | RNDIS_OID_802_11_ASSOCIATION_INFORMATION, |
1053 | info, &len); | ||
1099 | } | 1054 | } |
1100 | 1055 | ||
1101 | static bool is_associated(struct usbnet *usbdev) | 1056 | static bool is_associated(struct usbnet *usbdev) |
@@ -1119,7 +1074,9 @@ static int disassociate(struct usbnet *usbdev, bool reset_ssid) | |||
1119 | int i, ret = 0; | 1074 | int i, ret = 0; |
1120 | 1075 | ||
1121 | if (priv->radio_on) { | 1076 | if (priv->radio_on) { |
1122 | ret = rndis_set_oid(usbdev, OID_802_11_DISASSOCIATE, NULL, 0); | 1077 | ret = rndis_set_oid(usbdev, |
1078 | RNDIS_OID_802_11_DISASSOCIATE, | ||
1079 | NULL, 0); | ||
1123 | if (ret == 0) { | 1080 | if (ret == 0) { |
1124 | priv->radio_on = false; | 1081 | priv->radio_on = false; |
1125 | netdev_dbg(usbdev->net, "%s(): radio_on = false\n", | 1082 | netdev_dbg(usbdev->net, "%s(): radio_on = false\n", |
@@ -1181,8 +1138,9 @@ static int set_auth_mode(struct usbnet *usbdev, u32 wpa_version, | |||
1181 | return -ENOTSUPP; | 1138 | return -ENOTSUPP; |
1182 | 1139 | ||
1183 | tmp = cpu_to_le32(auth_mode); | 1140 | tmp = cpu_to_le32(auth_mode); |
1184 | ret = rndis_set_oid(usbdev, OID_802_11_AUTHENTICATION_MODE, &tmp, | 1141 | ret = rndis_set_oid(usbdev, |
1185 | sizeof(tmp)); | 1142 | RNDIS_OID_802_11_AUTHENTICATION_MODE, |
1143 | &tmp, sizeof(tmp)); | ||
1186 | if (ret != 0) { | 1144 | if (ret != 0) { |
1187 | netdev_warn(usbdev->net, "setting auth mode failed (%08X)\n", | 1145 | netdev_warn(usbdev->net, "setting auth mode failed (%08X)\n", |
1188 | ret); | 1146 | ret); |
@@ -1208,8 +1166,9 @@ static int set_priv_filter(struct usbnet *usbdev) | |||
1208 | else | 1166 | else |
1209 | tmp = cpu_to_le32(NDIS_80211_PRIV_ACCEPT_ALL); | 1167 | tmp = cpu_to_le32(NDIS_80211_PRIV_ACCEPT_ALL); |
1210 | 1168 | ||
1211 | return rndis_set_oid(usbdev, OID_802_11_PRIVACY_FILTER, &tmp, | 1169 | return rndis_set_oid(usbdev, |
1212 | sizeof(tmp)); | 1170 | RNDIS_OID_802_11_PRIVACY_FILTER, &tmp, |
1171 | sizeof(tmp)); | ||
1213 | } | 1172 | } |
1214 | 1173 | ||
1215 | static int set_encr_mode(struct usbnet *usbdev, int pairwise, int groupwise) | 1174 | static int set_encr_mode(struct usbnet *usbdev, int pairwise, int groupwise) |
@@ -1234,8 +1193,9 @@ static int set_encr_mode(struct usbnet *usbdev, int pairwise, int groupwise) | |||
1234 | encr_mode = NDIS_80211_ENCR_DISABLED; | 1193 | encr_mode = NDIS_80211_ENCR_DISABLED; |
1235 | 1194 | ||
1236 | tmp = cpu_to_le32(encr_mode); | 1195 | tmp = cpu_to_le32(encr_mode); |
1237 | ret = rndis_set_oid(usbdev, OID_802_11_ENCRYPTION_STATUS, &tmp, | 1196 | ret = rndis_set_oid(usbdev, |
1238 | sizeof(tmp)); | 1197 | RNDIS_OID_802_11_ENCRYPTION_STATUS, &tmp, |
1198 | sizeof(tmp)); | ||
1239 | if (ret != 0) { | 1199 | if (ret != 0) { |
1240 | netdev_warn(usbdev->net, "setting encr mode failed (%08X)\n", | 1200 | netdev_warn(usbdev->net, "setting encr mode failed (%08X)\n", |
1241 | ret); | 1201 | ret); |
@@ -1255,8 +1215,9 @@ static int set_infra_mode(struct usbnet *usbdev, int mode) | |||
1255 | __func__, priv->infra_mode); | 1215 | __func__, priv->infra_mode); |
1256 | 1216 | ||
1257 | tmp = cpu_to_le32(mode); | 1217 | tmp = cpu_to_le32(mode); |
1258 | ret = rndis_set_oid(usbdev, OID_802_11_INFRASTRUCTURE_MODE, &tmp, | 1218 | ret = rndis_set_oid(usbdev, |
1259 | sizeof(tmp)); | 1219 | RNDIS_OID_802_11_INFRASTRUCTURE_MODE, |
1220 | &tmp, sizeof(tmp)); | ||
1260 | if (ret != 0) { | 1221 | if (ret != 0) { |
1261 | netdev_warn(usbdev->net, "setting infra mode failed (%08X)\n", | 1222 | netdev_warn(usbdev->net, "setting infra mode failed (%08X)\n", |
1262 | ret); | 1223 | ret); |
@@ -1282,8 +1243,9 @@ static int set_rts_threshold(struct usbnet *usbdev, u32 rts_threshold) | |||
1282 | rts_threshold = 2347; | 1243 | rts_threshold = 2347; |
1283 | 1244 | ||
1284 | tmp = cpu_to_le32(rts_threshold); | 1245 | tmp = cpu_to_le32(rts_threshold); |
1285 | return rndis_set_oid(usbdev, OID_802_11_RTS_THRESHOLD, &tmp, | 1246 | return rndis_set_oid(usbdev, |
1286 | sizeof(tmp)); | 1247 | RNDIS_OID_802_11_RTS_THRESHOLD, |
1248 | &tmp, sizeof(tmp)); | ||
1287 | } | 1249 | } |
1288 | 1250 | ||
1289 | static int set_frag_threshold(struct usbnet *usbdev, u32 frag_threshold) | 1251 | static int set_frag_threshold(struct usbnet *usbdev, u32 frag_threshold) |
@@ -1296,8 +1258,9 @@ static int set_frag_threshold(struct usbnet *usbdev, u32 frag_threshold) | |||
1296 | frag_threshold = 2346; | 1258 | frag_threshold = 2346; |
1297 | 1259 | ||
1298 | tmp = cpu_to_le32(frag_threshold); | 1260 | tmp = cpu_to_le32(frag_threshold); |
1299 | return rndis_set_oid(usbdev, OID_802_11_FRAGMENTATION_THRESHOLD, &tmp, | 1261 | return rndis_set_oid(usbdev, |
1300 | sizeof(tmp)); | 1262 | RNDIS_OID_802_11_FRAGMENTATION_THRESHOLD, |
1263 | &tmp, sizeof(tmp)); | ||
1301 | } | 1264 | } |
1302 | 1265 | ||
1303 | static void set_default_iw_params(struct usbnet *usbdev) | 1266 | static void set_default_iw_params(struct usbnet *usbdev) |
@@ -1333,7 +1296,9 @@ static int set_channel(struct usbnet *usbdev, int channel) | |||
1333 | dsconfig = ieee80211_dsss_chan_to_freq(channel) * 1000; | 1296 | dsconfig = ieee80211_dsss_chan_to_freq(channel) * 1000; |
1334 | 1297 | ||
1335 | len = sizeof(config); | 1298 | len = sizeof(config); |
1336 | ret = rndis_query_oid(usbdev, OID_802_11_CONFIGURATION, &config, &len); | 1299 | ret = rndis_query_oid(usbdev, |
1300 | RNDIS_OID_802_11_CONFIGURATION, | ||
1301 | &config, &len); | ||
1337 | if (ret < 0) { | 1302 | if (ret < 0) { |
1338 | netdev_dbg(usbdev->net, "%s(): querying configuration failed\n", | 1303 | netdev_dbg(usbdev->net, "%s(): querying configuration failed\n", |
1339 | __func__); | 1304 | __func__); |
@@ -1341,8 +1306,9 @@ static int set_channel(struct usbnet *usbdev, int channel) | |||
1341 | } | 1306 | } |
1342 | 1307 | ||
1343 | config.ds_config = cpu_to_le32(dsconfig); | 1308 | config.ds_config = cpu_to_le32(dsconfig); |
1344 | ret = rndis_set_oid(usbdev, OID_802_11_CONFIGURATION, &config, | 1309 | ret = rndis_set_oid(usbdev, |
1345 | sizeof(config)); | 1310 | RNDIS_OID_802_11_CONFIGURATION, |
1311 | &config, sizeof(config)); | ||
1346 | 1312 | ||
1347 | netdev_dbg(usbdev->net, "%s(): %d -> %d\n", __func__, channel, ret); | 1313 | netdev_dbg(usbdev->net, "%s(): %d -> %d\n", __func__, channel, ret); |
1348 | 1314 | ||
@@ -1359,8 +1325,10 @@ static struct ieee80211_channel *get_current_channel(struct usbnet *usbdev, | |||
1359 | 1325 | ||
1360 | /* Get channel and beacon interval */ | 1326 | /* Get channel and beacon interval */ |
1361 | len = sizeof(config); | 1327 | len = sizeof(config); |
1362 | ret = rndis_query_oid(usbdev, OID_802_11_CONFIGURATION, &config, &len); | 1328 | ret = rndis_query_oid(usbdev, |
1363 | netdev_dbg(usbdev->net, "%s(): OID_802_11_CONFIGURATION -> %d\n", | 1329 | RNDIS_OID_802_11_CONFIGURATION, |
1330 | &config, &len); | ||
1331 | netdev_dbg(usbdev->net, "%s(): RNDIS_OID_802_11_CONFIGURATION -> %d\n", | ||
1364 | __func__, ret); | 1332 | __func__, ret); |
1365 | if (ret < 0) | 1333 | if (ret < 0) |
1366 | return NULL; | 1334 | return NULL; |
@@ -1413,8 +1381,9 @@ static int add_wep_key(struct usbnet *usbdev, const u8 *key, int key_len, | |||
1413 | ret); | 1381 | ret); |
1414 | } | 1382 | } |
1415 | 1383 | ||
1416 | ret = rndis_set_oid(usbdev, OID_802_11_ADD_WEP, &ndis_key, | 1384 | ret = rndis_set_oid(usbdev, |
1417 | sizeof(ndis_key)); | 1385 | RNDIS_OID_802_11_ADD_WEP, &ndis_key, |
1386 | sizeof(ndis_key)); | ||
1418 | if (ret != 0) { | 1387 | if (ret != 0) { |
1419 | netdev_warn(usbdev->net, "adding encryption key %d failed (%08X)\n", | 1388 | netdev_warn(usbdev->net, "adding encryption key %d failed (%08X)\n", |
1420 | index + 1, ret); | 1389 | index + 1, ret); |
@@ -1504,9 +1473,10 @@ static int add_wpa_key(struct usbnet *usbdev, const u8 *key, int key_len, | |||
1504 | get_bssid(usbdev, ndis_key.bssid); | 1473 | get_bssid(usbdev, ndis_key.bssid); |
1505 | } | 1474 | } |
1506 | 1475 | ||
1507 | ret = rndis_set_oid(usbdev, OID_802_11_ADD_KEY, &ndis_key, | 1476 | ret = rndis_set_oid(usbdev, |
1508 | le32_to_cpu(ndis_key.size)); | 1477 | RNDIS_OID_802_11_ADD_KEY, &ndis_key, |
1509 | netdev_dbg(usbdev->net, "%s(): OID_802_11_ADD_KEY -> %08X\n", | 1478 | le32_to_cpu(ndis_key.size)); |
1479 | netdev_dbg(usbdev->net, "%s(): RNDIS_OID_802_11_ADD_KEY -> %08X\n", | ||
1510 | __func__, ret); | 1480 | __func__, ret); |
1511 | if (ret != 0) | 1481 | if (ret != 0) |
1512 | return ret; | 1482 | return ret; |
@@ -1594,14 +1564,16 @@ static int remove_key(struct usbnet *usbdev, u8 index, const u8 *bssid) | |||
1594 | memset(remove_key.bssid, 0xff, | 1564 | memset(remove_key.bssid, 0xff, |
1595 | sizeof(remove_key.bssid)); | 1565 | sizeof(remove_key.bssid)); |
1596 | 1566 | ||
1597 | ret = rndis_set_oid(usbdev, OID_802_11_REMOVE_KEY, &remove_key, | 1567 | ret = rndis_set_oid(usbdev, |
1598 | sizeof(remove_key)); | 1568 | RNDIS_OID_802_11_REMOVE_KEY, |
1569 | &remove_key, sizeof(remove_key)); | ||
1599 | if (ret != 0) | 1570 | if (ret != 0) |
1600 | return ret; | 1571 | return ret; |
1601 | } else { | 1572 | } else { |
1602 | keyindex = cpu_to_le32(index); | 1573 | keyindex = cpu_to_le32(index); |
1603 | ret = rndis_set_oid(usbdev, OID_802_11_REMOVE_WEP, &keyindex, | 1574 | ret = rndis_set_oid(usbdev, |
1604 | sizeof(keyindex)); | 1575 | RNDIS_OID_802_11_REMOVE_WEP, |
1576 | &keyindex, sizeof(keyindex)); | ||
1605 | if (ret != 0) { | 1577 | if (ret != 0) { |
1606 | netdev_warn(usbdev->net, | 1578 | netdev_warn(usbdev->net, |
1607 | "removing encryption key %d failed (%08X)\n", | 1579 | "removing encryption key %d failed (%08X)\n", |
@@ -1626,14 +1598,14 @@ static void set_multicast_list(struct usbnet *usbdev) | |||
1626 | char *mc_addrs = NULL; | 1598 | char *mc_addrs = NULL; |
1627 | int mc_count; | 1599 | int mc_count; |
1628 | 1600 | ||
1629 | basefilter = filter = RNDIS_PACKET_TYPE_DIRECTED | | 1601 | basefilter = filter = cpu_to_le32(RNDIS_PACKET_TYPE_DIRECTED | |
1630 | RNDIS_PACKET_TYPE_BROADCAST; | 1602 | RNDIS_PACKET_TYPE_BROADCAST); |
1631 | 1603 | ||
1632 | if (usbdev->net->flags & IFF_PROMISC) { | 1604 | if (usbdev->net->flags & IFF_PROMISC) { |
1633 | filter |= RNDIS_PACKET_TYPE_PROMISCUOUS | | 1605 | filter |= cpu_to_le32(RNDIS_PACKET_TYPE_PROMISCUOUS | |
1634 | RNDIS_PACKET_TYPE_ALL_LOCAL; | 1606 | RNDIS_PACKET_TYPE_ALL_LOCAL); |
1635 | } else if (usbdev->net->flags & IFF_ALLMULTI) { | 1607 | } else if (usbdev->net->flags & IFF_ALLMULTI) { |
1636 | filter |= RNDIS_PACKET_TYPE_ALL_MULTICAST; | 1608 | filter |= cpu_to_le32(RNDIS_PACKET_TYPE_ALL_MULTICAST); |
1637 | } | 1609 | } |
1638 | 1610 | ||
1639 | if (filter != basefilter) | 1611 | if (filter != basefilter) |
@@ -1646,7 +1618,7 @@ static void set_multicast_list(struct usbnet *usbdev) | |||
1646 | netif_addr_lock_bh(usbdev->net); | 1618 | netif_addr_lock_bh(usbdev->net); |
1647 | mc_count = netdev_mc_count(usbdev->net); | 1619 | mc_count = netdev_mc_count(usbdev->net); |
1648 | if (mc_count > priv->multicast_size) { | 1620 | if (mc_count > priv->multicast_size) { |
1649 | filter |= RNDIS_PACKET_TYPE_ALL_MULTICAST; | 1621 | filter |= cpu_to_le32(RNDIS_PACKET_TYPE_ALL_MULTICAST); |
1650 | } else if (mc_count) { | 1622 | } else if (mc_count) { |
1651 | int i = 0; | 1623 | int i = 0; |
1652 | 1624 | ||
@@ -1669,27 +1641,28 @@ static void set_multicast_list(struct usbnet *usbdev) | |||
1669 | goto set_filter; | 1641 | goto set_filter; |
1670 | 1642 | ||
1671 | if (mc_count) { | 1643 | if (mc_count) { |
1672 | ret = rndis_set_oid(usbdev, OID_802_3_MULTICAST_LIST, mc_addrs, | 1644 | ret = rndis_set_oid(usbdev, |
1673 | mc_count * ETH_ALEN); | 1645 | RNDIS_OID_802_3_MULTICAST_LIST, |
1646 | mc_addrs, mc_count * ETH_ALEN); | ||
1674 | kfree(mc_addrs); | 1647 | kfree(mc_addrs); |
1675 | if (ret == 0) | 1648 | if (ret == 0) |
1676 | filter |= RNDIS_PACKET_TYPE_MULTICAST; | 1649 | filter |= cpu_to_le32(RNDIS_PACKET_TYPE_MULTICAST); |
1677 | else | 1650 | else |
1678 | filter |= RNDIS_PACKET_TYPE_ALL_MULTICAST; | 1651 | filter |= cpu_to_le32(RNDIS_PACKET_TYPE_ALL_MULTICAST); |
1679 | 1652 | ||
1680 | netdev_dbg(usbdev->net, "OID_802_3_MULTICAST_LIST(%d, max: %d) -> %d\n", | 1653 | netdev_dbg(usbdev->net, "RNDIS_OID_802_3_MULTICAST_LIST(%d, max: %d) -> %d\n", |
1681 | mc_count, priv->multicast_size, ret); | 1654 | mc_count, priv->multicast_size, ret); |
1682 | } | 1655 | } |
1683 | 1656 | ||
1684 | set_filter: | 1657 | set_filter: |
1685 | ret = rndis_set_oid(usbdev, OID_GEN_CURRENT_PACKET_FILTER, &filter, | 1658 | ret = rndis_set_oid(usbdev, RNDIS_OID_GEN_CURRENT_PACKET_FILTER, &filter, |
1686 | sizeof(filter)); | 1659 | sizeof(filter)); |
1687 | if (ret < 0) { | 1660 | if (ret < 0) { |
1688 | netdev_warn(usbdev->net, "couldn't set packet filter: %08x\n", | 1661 | netdev_warn(usbdev->net, "couldn't set packet filter: %08x\n", |
1689 | le32_to_cpu(filter)); | 1662 | le32_to_cpu(filter)); |
1690 | } | 1663 | } |
1691 | 1664 | ||
1692 | netdev_dbg(usbdev->net, "OID_GEN_CURRENT_PACKET_FILTER(%08x) -> %d\n", | 1665 | netdev_dbg(usbdev->net, "RNDIS_OID_GEN_CURRENT_PACKET_FILTER(%08x) -> %d\n", |
1693 | le32_to_cpu(filter), ret); | 1666 | le32_to_cpu(filter), ret); |
1694 | } | 1667 | } |
1695 | 1668 | ||
@@ -1748,9 +1721,10 @@ static struct ndis_80211_pmkid *get_device_pmkids(struct usbnet *usbdev) | |||
1748 | pmkids->length = cpu_to_le32(len); | 1721 | pmkids->length = cpu_to_le32(len); |
1749 | pmkids->bssid_info_count = cpu_to_le32(max_pmkids); | 1722 | pmkids->bssid_info_count = cpu_to_le32(max_pmkids); |
1750 | 1723 | ||
1751 | ret = rndis_query_oid(usbdev, OID_802_11_PMKID, pmkids, &len); | 1724 | ret = rndis_query_oid(usbdev, RNDIS_OID_802_11_PMKID, |
1725 | pmkids, &len); | ||
1752 | if (ret < 0) { | 1726 | if (ret < 0) { |
1753 | netdev_dbg(usbdev->net, "%s(): OID_802_11_PMKID(%d, %d)" | 1727 | netdev_dbg(usbdev->net, "%s(): RNDIS_OID_802_11_PMKID(%d, %d)" |
1754 | " -> %d\n", __func__, len, max_pmkids, ret); | 1728 | " -> %d\n", __func__, len, max_pmkids, ret); |
1755 | 1729 | ||
1756 | kfree(pmkids); | 1730 | kfree(pmkids); |
@@ -1776,10 +1750,10 @@ static int set_device_pmkids(struct usbnet *usbdev, | |||
1776 | 1750 | ||
1777 | debug_print_pmkids(usbdev, pmkids, __func__); | 1751 | debug_print_pmkids(usbdev, pmkids, __func__); |
1778 | 1752 | ||
1779 | ret = rndis_set_oid(usbdev, OID_802_11_PMKID, pmkids, | 1753 | ret = rndis_set_oid(usbdev, RNDIS_OID_802_11_PMKID, pmkids, |
1780 | le32_to_cpu(pmkids->length)); | 1754 | le32_to_cpu(pmkids->length)); |
1781 | if (ret < 0) { | 1755 | if (ret < 0) { |
1782 | netdev_dbg(usbdev->net, "%s(): OID_802_11_PMKID(%d, %d) -> %d" | 1756 | netdev_dbg(usbdev->net, "%s(): RNDIS_OID_802_11_PMKID(%d, %d) -> %d" |
1783 | "\n", __func__, len, num_pmkids, ret); | 1757 | "\n", __func__, len, num_pmkids, ret); |
1784 | } | 1758 | } |
1785 | 1759 | ||
@@ -1801,8 +1775,8 @@ static struct ndis_80211_pmkid *remove_pmkid(struct usbnet *usbdev, | |||
1801 | count = max_pmkids; | 1775 | count = max_pmkids; |
1802 | 1776 | ||
1803 | for (i = 0; i < count; i++) | 1777 | for (i = 0; i < count; i++) |
1804 | if (!compare_ether_addr(pmkids->bssid_info[i].bssid, | 1778 | if (ether_addr_equal(pmkids->bssid_info[i].bssid, |
1805 | pmksa->bssid)) | 1779 | pmksa->bssid)) |
1806 | break; | 1780 | break; |
1807 | 1781 | ||
1808 | /* pmkid not found */ | 1782 | /* pmkid not found */ |
@@ -1843,8 +1817,8 @@ static struct ndis_80211_pmkid *update_pmkid(struct usbnet *usbdev, | |||
1843 | 1817 | ||
1844 | /* update with new pmkid */ | 1818 | /* update with new pmkid */ |
1845 | for (i = 0; i < count; i++) { | 1819 | for (i = 0; i < count; i++) { |
1846 | if (compare_ether_addr(pmkids->bssid_info[i].bssid, | 1820 | if (!ether_addr_equal(pmkids->bssid_info[i].bssid, |
1847 | pmksa->bssid)) | 1821 | pmksa->bssid)) |
1848 | continue; | 1822 | continue; |
1849 | 1823 | ||
1850 | memcpy(pmkids->bssid_info[i].pmkid, pmksa->pmkid, | 1824 | memcpy(pmkids->bssid_info[i].pmkid, pmksa->pmkid, |
@@ -2113,7 +2087,8 @@ resize_buf: | |||
2113 | * resizing until it won't get any bigger. | 2087 | * resizing until it won't get any bigger. |
2114 | */ | 2088 | */ |
2115 | new_len = len; | 2089 | new_len = len; |
2116 | ret = rndis_query_oid(usbdev, OID_802_11_BSSID_LIST, buf, &new_len); | 2090 | ret = rndis_query_oid(usbdev, RNDIS_OID_802_11_BSSID_LIST, |
2091 | buf, &new_len); | ||
2117 | if (ret != 0 || new_len < sizeof(struct ndis_80211_bssid_list_ex)) | 2092 | if (ret != 0 || new_len < sizeof(struct ndis_80211_bssid_list_ex)) |
2118 | goto out; | 2093 | goto out; |
2119 | 2094 | ||
@@ -2139,7 +2114,7 @@ resize_buf: | |||
2139 | while (check_bssid_list_item(bssid, bssid_len, buf, len)) { | 2114 | while (check_bssid_list_item(bssid, bssid_len, buf, len)) { |
2140 | if (rndis_bss_info_update(usbdev, bssid) && match_bssid && | 2115 | if (rndis_bss_info_update(usbdev, bssid) && match_bssid && |
2141 | matched) { | 2116 | matched) { |
2142 | if (compare_ether_addr(bssid->mac, match_bssid)) | 2117 | if (!ether_addr_equal(bssid->mac, match_bssid)) |
2143 | *matched = true; | 2118 | *matched = true; |
2144 | } | 2119 | } |
2145 | 2120 | ||
@@ -2511,14 +2486,15 @@ static void rndis_fill_station_info(struct usbnet *usbdev, | |||
2511 | memset(sinfo, 0, sizeof(*sinfo)); | 2486 | memset(sinfo, 0, sizeof(*sinfo)); |
2512 | 2487 | ||
2513 | len = sizeof(linkspeed); | 2488 | len = sizeof(linkspeed); |
2514 | ret = rndis_query_oid(usbdev, OID_GEN_LINK_SPEED, &linkspeed, &len); | 2489 | ret = rndis_query_oid(usbdev, RNDIS_OID_GEN_LINK_SPEED, &linkspeed, &len); |
2515 | if (ret == 0) { | 2490 | if (ret == 0) { |
2516 | sinfo->txrate.legacy = le32_to_cpu(linkspeed) / 1000; | 2491 | sinfo->txrate.legacy = le32_to_cpu(linkspeed) / 1000; |
2517 | sinfo->filled |= STATION_INFO_TX_BITRATE; | 2492 | sinfo->filled |= STATION_INFO_TX_BITRATE; |
2518 | } | 2493 | } |
2519 | 2494 | ||
2520 | len = sizeof(rssi); | 2495 | len = sizeof(rssi); |
2521 | ret = rndis_query_oid(usbdev, OID_802_11_RSSI, &rssi, &len); | 2496 | ret = rndis_query_oid(usbdev, RNDIS_OID_802_11_RSSI, |
2497 | &rssi, &len); | ||
2522 | if (ret == 0) { | 2498 | if (ret == 0) { |
2523 | sinfo->signal = level_to_qual(le32_to_cpu(rssi)); | 2499 | sinfo->signal = level_to_qual(le32_to_cpu(rssi)); |
2524 | sinfo->filled |= STATION_INFO_SIGNAL; | 2500 | sinfo->filled |= STATION_INFO_SIGNAL; |
@@ -2531,7 +2507,7 @@ static int rndis_get_station(struct wiphy *wiphy, struct net_device *dev, | |||
2531 | struct rndis_wlan_private *priv = wiphy_priv(wiphy); | 2507 | struct rndis_wlan_private *priv = wiphy_priv(wiphy); |
2532 | struct usbnet *usbdev = priv->usbdev; | 2508 | struct usbnet *usbdev = priv->usbdev; |
2533 | 2509 | ||
2534 | if (compare_ether_addr(priv->bssid, mac)) | 2510 | if (!ether_addr_equal(priv->bssid, mac)) |
2535 | return -ENOENT; | 2511 | return -ENOENT; |
2536 | 2512 | ||
2537 | rndis_fill_station_info(usbdev, sinfo); | 2513 | rndis_fill_station_info(usbdev, sinfo); |
@@ -2624,7 +2600,8 @@ static int rndis_flush_pmksa(struct wiphy *wiphy, struct net_device *netdev) | |||
2624 | pmkid.length = cpu_to_le32(sizeof(pmkid)); | 2600 | pmkid.length = cpu_to_le32(sizeof(pmkid)); |
2625 | pmkid.bssid_info_count = cpu_to_le32(0); | 2601 | pmkid.bssid_info_count = cpu_to_le32(0); |
2626 | 2602 | ||
2627 | return rndis_set_oid(usbdev, OID_802_11_PMKID, &pmkid, sizeof(pmkid)); | 2603 | return rndis_set_oid(usbdev, RNDIS_OID_802_11_PMKID, |
2604 | &pmkid, sizeof(pmkid)); | ||
2628 | } | 2605 | } |
2629 | 2606 | ||
2630 | static int rndis_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, | 2607 | static int rndis_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, |
@@ -2654,9 +2631,10 @@ static int rndis_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, | |||
2654 | priv->power_mode = power_mode; | 2631 | priv->power_mode = power_mode; |
2655 | 2632 | ||
2656 | mode = cpu_to_le32(power_mode); | 2633 | mode = cpu_to_le32(power_mode); |
2657 | ret = rndis_set_oid(usbdev, OID_802_11_POWER_MODE, &mode, sizeof(mode)); | 2634 | ret = rndis_set_oid(usbdev, RNDIS_OID_802_11_POWER_MODE, |
2635 | &mode, sizeof(mode)); | ||
2658 | 2636 | ||
2659 | netdev_dbg(usbdev->net, "%s(): OID_802_11_POWER_MODE -> %d\n", | 2637 | netdev_dbg(usbdev->net, "%s(): RNDIS_OID_802_11_POWER_MODE -> %d\n", |
2660 | __func__, ret); | 2638 | __func__, ret); |
2661 | 2639 | ||
2662 | return ret; | 2640 | return ret; |
@@ -2693,10 +2671,11 @@ static void rndis_wlan_craft_connected_bss(struct usbnet *usbdev, u8 *bssid, | |||
2693 | /* Get signal quality, in case of error use rssi=0 and ignore error. */ | 2671 | /* Get signal quality, in case of error use rssi=0 and ignore error. */ |
2694 | len = sizeof(rssi); | 2672 | len = sizeof(rssi); |
2695 | rssi = 0; | 2673 | rssi = 0; |
2696 | ret = rndis_query_oid(usbdev, OID_802_11_RSSI, &rssi, &len); | 2674 | ret = rndis_query_oid(usbdev, RNDIS_OID_802_11_RSSI, |
2675 | &rssi, &len); | ||
2697 | signal = level_to_qual(le32_to_cpu(rssi)); | 2676 | signal = level_to_qual(le32_to_cpu(rssi)); |
2698 | 2677 | ||
2699 | netdev_dbg(usbdev->net, "%s(): OID_802_11_RSSI -> %d, " | 2678 | netdev_dbg(usbdev->net, "%s(): RNDIS_OID_802_11_RSSI -> %d, " |
2700 | "rssi:%d, qual: %d\n", __func__, ret, le32_to_cpu(rssi), | 2679 | "rssi:%d, qual: %d\n", __func__, ret, le32_to_cpu(rssi), |
2701 | level_to_qual(le32_to_cpu(rssi))); | 2680 | level_to_qual(le32_to_cpu(rssi))); |
2702 | 2681 | ||
@@ -2720,8 +2699,9 @@ static void rndis_wlan_craft_connected_bss(struct usbnet *usbdev, u8 *bssid, | |||
2720 | /* Get SSID, in case of error, use zero length SSID and ignore error. */ | 2699 | /* Get SSID, in case of error, use zero length SSID and ignore error. */ |
2721 | len = sizeof(ssid); | 2700 | len = sizeof(ssid); |
2722 | memset(&ssid, 0, sizeof(ssid)); | 2701 | memset(&ssid, 0, sizeof(ssid)); |
2723 | ret = rndis_query_oid(usbdev, OID_802_11_SSID, &ssid, &len); | 2702 | ret = rndis_query_oid(usbdev, RNDIS_OID_802_11_SSID, |
2724 | netdev_dbg(usbdev->net, "%s(): OID_802_11_SSID -> %d, len: %d, ssid: " | 2703 | &ssid, &len); |
2704 | netdev_dbg(usbdev->net, "%s(): RNDIS_OID_802_11_SSID -> %d, len: %d, ssid: " | ||
2725 | "'%.32s'\n", __func__, ret, | 2705 | "'%.32s'\n", __func__, ret, |
2726 | le32_to_cpu(ssid.length), ssid.essid); | 2706 | le32_to_cpu(ssid.length), ssid.essid); |
2727 | 2707 | ||
@@ -2843,7 +2823,7 @@ static void rndis_wlan_do_link_up_work(struct usbnet *usbdev) | |||
2843 | * NDIS spec says: "If the device is associated, but the associated | 2823 | * NDIS spec says: "If the device is associated, but the associated |
2844 | * BSSID is not in its BSSID scan list, then the driver must add an | 2824 | * BSSID is not in its BSSID scan list, then the driver must add an |
2845 | * entry for the BSSID at the end of the data that it returns in | 2825 | * entry for the BSSID at the end of the data that it returns in |
2846 | * response to query of OID_802_11_BSSID_LIST." | 2826 | * response to query of RNDIS_OID_802_11_BSSID_LIST." |
2847 | * | 2827 | * |
2848 | * NOTE: Seems to be true for BCM4320b variant, but not BCM4320a. | 2828 | * NOTE: Seems to be true for BCM4320b variant, but not BCM4320a. |
2849 | */ | 2829 | */ |
@@ -3095,15 +3075,15 @@ static void rndis_wlan_indication(struct usbnet *usbdev, void *ind, int buflen) | |||
3095 | struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); | 3075 | struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); |
3096 | struct rndis_indicate *msg = ind; | 3076 | struct rndis_indicate *msg = ind; |
3097 | 3077 | ||
3098 | switch (msg->status) { | 3078 | switch (le32_to_cpu(msg->status)) { |
3099 | case RNDIS_STATUS_MEDIA_CONNECT: | 3079 | case RNDIS_STATUS_MEDIA_CONNECT: |
3100 | if (priv->current_command_oid == OID_802_11_ADD_KEY) { | 3080 | if (priv->current_command_oid == RNDIS_OID_802_11_ADD_KEY) { |
3101 | /* OID_802_11_ADD_KEY causes sometimes extra | 3081 | /* RNDIS_OID_802_11_ADD_KEY causes sometimes extra |
3102 | * "media connect" indications which confuses driver | 3082 | * "media connect" indications which confuses driver |
3103 | * and userspace to think that device is | 3083 | * and userspace to think that device is |
3104 | * roaming/reassociating when it isn't. | 3084 | * roaming/reassociating when it isn't. |
3105 | */ | 3085 | */ |
3106 | netdev_dbg(usbdev->net, "ignored OID_802_11_ADD_KEY triggered 'media connect'\n"); | 3086 | netdev_dbg(usbdev->net, "ignored RNDIS_OID_802_11_ADD_KEY triggered 'media connect'\n"); |
3107 | return; | 3087 | return; |
3108 | } | 3088 | } |
3109 | 3089 | ||
@@ -3148,8 +3128,9 @@ static int rndis_wlan_get_caps(struct usbnet *usbdev, struct wiphy *wiphy) | |||
3148 | 3128 | ||
3149 | /* determine supported modes */ | 3129 | /* determine supported modes */ |
3150 | len = sizeof(networks_supported); | 3130 | len = sizeof(networks_supported); |
3151 | retval = rndis_query_oid(usbdev, OID_802_11_NETWORK_TYPES_SUPPORTED, | 3131 | retval = rndis_query_oid(usbdev, |
3152 | &networks_supported, &len); | 3132 | RNDIS_OID_802_11_NETWORK_TYPES_SUPPORTED, |
3133 | &networks_supported, &len); | ||
3153 | if (retval >= 0) { | 3134 | if (retval >= 0) { |
3154 | n = le32_to_cpu(networks_supported.num_items); | 3135 | n = le32_to_cpu(networks_supported.num_items); |
3155 | if (n > 8) | 3136 | if (n > 8) |
@@ -3173,9 +3154,11 @@ static int rndis_wlan_get_caps(struct usbnet *usbdev, struct wiphy *wiphy) | |||
3173 | /* get device 802.11 capabilities, number of PMKIDs */ | 3154 | /* get device 802.11 capabilities, number of PMKIDs */ |
3174 | caps = (struct ndis_80211_capability *)caps_buf; | 3155 | caps = (struct ndis_80211_capability *)caps_buf; |
3175 | len = sizeof(caps_buf); | 3156 | len = sizeof(caps_buf); |
3176 | retval = rndis_query_oid(usbdev, OID_802_11_CAPABILITY, caps, &len); | 3157 | retval = rndis_query_oid(usbdev, |
3158 | RNDIS_OID_802_11_CAPABILITY, | ||
3159 | caps, &len); | ||
3177 | if (retval >= 0) { | 3160 | if (retval >= 0) { |
3178 | netdev_dbg(usbdev->net, "OID_802_11_CAPABILITY -> len %d, " | 3161 | netdev_dbg(usbdev->net, "RNDIS_OID_802_11_CAPABILITY -> len %d, " |
3179 | "ver %d, pmkids %d, auth-encr-pairs %d\n", | 3162 | "ver %d, pmkids %d, auth-encr-pairs %d\n", |
3180 | le32_to_cpu(caps->length), | 3163 | le32_to_cpu(caps->length), |
3181 | le32_to_cpu(caps->version), | 3164 | le32_to_cpu(caps->version), |
@@ -3247,13 +3230,14 @@ static void rndis_device_poller(struct work_struct *work) | |||
3247 | } | 3230 | } |
3248 | 3231 | ||
3249 | len = sizeof(rssi); | 3232 | len = sizeof(rssi); |
3250 | ret = rndis_query_oid(usbdev, OID_802_11_RSSI, &rssi, &len); | 3233 | ret = rndis_query_oid(usbdev, RNDIS_OID_802_11_RSSI, |
3234 | &rssi, &len); | ||
3251 | if (ret == 0) { | 3235 | if (ret == 0) { |
3252 | priv->last_qual = level_to_qual(le32_to_cpu(rssi)); | 3236 | priv->last_qual = level_to_qual(le32_to_cpu(rssi)); |
3253 | rndis_do_cqm(usbdev, le32_to_cpu(rssi)); | 3237 | rndis_do_cqm(usbdev, le32_to_cpu(rssi)); |
3254 | } | 3238 | } |
3255 | 3239 | ||
3256 | netdev_dbg(usbdev->net, "dev-poller: OID_802_11_RSSI -> %d, rssi:%d, qual: %d\n", | 3240 | netdev_dbg(usbdev->net, "dev-poller: RNDIS_OID_802_11_RSSI -> %d, rssi:%d, qual: %d\n", |
3257 | ret, le32_to_cpu(rssi), level_to_qual(le32_to_cpu(rssi))); | 3241 | ret, le32_to_cpu(rssi), level_to_qual(le32_to_cpu(rssi))); |
3258 | 3242 | ||
3259 | /* Workaround transfer stalls on poor quality links. | 3243 | /* Workaround transfer stalls on poor quality links. |
@@ -3275,15 +3259,18 @@ static void rndis_device_poller(struct work_struct *work) | |||
3275 | * working. | 3259 | * working. |
3276 | */ | 3260 | */ |
3277 | tmp = cpu_to_le32(1); | 3261 | tmp = cpu_to_le32(1); |
3278 | rndis_set_oid(usbdev, OID_802_11_BSSID_LIST_SCAN, &tmp, | 3262 | rndis_set_oid(usbdev, |
3279 | sizeof(tmp)); | 3263 | RNDIS_OID_802_11_BSSID_LIST_SCAN, |
3264 | &tmp, sizeof(tmp)); | ||
3280 | 3265 | ||
3281 | len = CONTROL_BUFFER_SIZE; | 3266 | len = CONTROL_BUFFER_SIZE; |
3282 | buf = kmalloc(len, GFP_KERNEL); | 3267 | buf = kmalloc(len, GFP_KERNEL); |
3283 | if (!buf) | 3268 | if (!buf) |
3284 | goto end; | 3269 | goto end; |
3285 | 3270 | ||
3286 | rndis_query_oid(usbdev, OID_802_11_BSSID_LIST, buf, &len); | 3271 | rndis_query_oid(usbdev, |
3272 | RNDIS_OID_802_11_BSSID_LIST, | ||
3273 | buf, &len); | ||
3287 | kfree(buf); | 3274 | kfree(buf); |
3288 | } | 3275 | } |
3289 | 3276 | ||
@@ -3465,13 +3452,15 @@ static int rndis_wlan_bind(struct usbnet *usbdev, struct usb_interface *intf) | |||
3465 | */ | 3452 | */ |
3466 | usbdev->net->netdev_ops = &rndis_wlan_netdev_ops; | 3453 | usbdev->net->netdev_ops = &rndis_wlan_netdev_ops; |
3467 | 3454 | ||
3468 | tmp = RNDIS_PACKET_TYPE_DIRECTED | RNDIS_PACKET_TYPE_BROADCAST; | 3455 | tmp = cpu_to_le32(RNDIS_PACKET_TYPE_DIRECTED | RNDIS_PACKET_TYPE_BROADCAST); |
3469 | retval = rndis_set_oid(usbdev, OID_GEN_CURRENT_PACKET_FILTER, &tmp, | 3456 | retval = rndis_set_oid(usbdev, |
3470 | sizeof(tmp)); | 3457 | RNDIS_OID_GEN_CURRENT_PACKET_FILTER, |
3458 | &tmp, sizeof(tmp)); | ||
3471 | 3459 | ||
3472 | len = sizeof(tmp); | 3460 | len = sizeof(tmp); |
3473 | retval = rndis_query_oid(usbdev, OID_802_3_MAXIMUM_LIST_SIZE, &tmp, | 3461 | retval = rndis_query_oid(usbdev, |
3474 | &len); | 3462 | RNDIS_OID_802_3_MAXIMUM_LIST_SIZE, |
3463 | &tmp, &len); | ||
3475 | priv->multicast_size = le32_to_cpu(tmp); | 3464 | priv->multicast_size = le32_to_cpu(tmp); |
3476 | if (retval < 0 || priv->multicast_size < 0) | 3465 | if (retval < 0 || priv->multicast_size < 0) |
3477 | priv->multicast_size = 0; | 3466 | priv->multicast_size = 0; |
@@ -3601,7 +3590,7 @@ static int rndis_wlan_stop(struct usbnet *usbdev) | |||
3601 | /* Set current packet filter zero to block receiving data packets from | 3590 | /* Set current packet filter zero to block receiving data packets from |
3602 | device. */ | 3591 | device. */ |
3603 | filter = 0; | 3592 | filter = 0; |
3604 | rndis_set_oid(usbdev, OID_GEN_CURRENT_PACKET_FILTER, &filter, | 3593 | rndis_set_oid(usbdev, RNDIS_OID_GEN_CURRENT_PACKET_FILTER, &filter, |
3605 | sizeof(filter)); | 3594 | sizeof(filter)); |
3606 | 3595 | ||
3607 | return retval; | 3596 | return retval; |