diff options
Diffstat (limited to 'drivers/net/wireless/rndis_wlan.c')
-rw-r--r-- | drivers/net/wireless/rndis_wlan.c | 442 |
1 files changed, 248 insertions, 194 deletions
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index 54175b6fa86c..1de5b22d3efe 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/if_arp.h> | 41 | #include <linux/if_arp.h> |
42 | #include <linux/ctype.h> | 42 | #include <linux/ctype.h> |
43 | #include <linux/spinlock.h> | 43 | #include <linux/spinlock.h> |
44 | #include <linux/slab.h> | ||
44 | #include <net/iw_handler.h> | 45 | #include <net/iw_handler.h> |
45 | #include <net/cfg80211.h> | 46 | #include <net/cfg80211.h> |
46 | #include <linux/usb/usbnet.h> | 47 | #include <linux/usb/usbnet.h> |
@@ -83,11 +84,11 @@ MODULE_PARM_DESC(roamdelta, | |||
83 | "set roaming tendency: 0=aggressive, 1=moderate, " | 84 | "set roaming tendency: 0=aggressive, 1=moderate, " |
84 | "2=conservative (default: moderate)"); | 85 | "2=conservative (default: moderate)"); |
85 | 86 | ||
86 | static int modparam_workaround_interval = 500; | 87 | static int modparam_workaround_interval; |
87 | module_param_named(workaround_interval, modparam_workaround_interval, | 88 | module_param_named(workaround_interval, modparam_workaround_interval, |
88 | int, 0444); | 89 | int, 0444); |
89 | MODULE_PARM_DESC(workaround_interval, | 90 | MODULE_PARM_DESC(workaround_interval, |
90 | "set stall workaround interval in msecs (default: 500)"); | 91 | "set stall workaround interval in msecs (0=disabled) (default: 0)"); |
91 | 92 | ||
92 | 93 | ||
93 | /* various RNDIS OID defs */ | 94 | /* various RNDIS OID defs */ |
@@ -728,21 +729,22 @@ static int rndis_query_oid(struct usbnet *dev, __le32 oid, void *data, int *len) | |||
728 | ret = rndis_command(dev, u.header, buflen); | 729 | ret = rndis_command(dev, u.header, buflen); |
729 | priv->current_command_oid = 0; | 730 | priv->current_command_oid = 0; |
730 | if (ret < 0) | 731 | if (ret < 0) |
731 | devdbg(dev, "rndis_query_oid(%s): rndis_command() failed, %d " | 732 | netdev_dbg(dev->net, "%s(%s): rndis_command() failed, %d (%08x)\n", |
732 | "(%08x)", oid_to_string(oid), ret, | 733 | __func__, oid_to_string(oid), ret, |
733 | le32_to_cpu(u.get_c->status)); | 734 | le32_to_cpu(u.get_c->status)); |
734 | 735 | ||
735 | if (ret == 0) { | 736 | if (ret == 0) { |
737 | memcpy(data, u.buf + le32_to_cpu(u.get_c->offset) + 8, *len); | ||
738 | |||
736 | ret = le32_to_cpu(u.get_c->len); | 739 | ret = le32_to_cpu(u.get_c->len); |
737 | if (ret > *len) | 740 | if (ret > *len) |
738 | *len = ret; | 741 | *len = ret; |
739 | memcpy(data, u.buf + le32_to_cpu(u.get_c->offset) + 8, *len); | ||
740 | ret = rndis_error_status(u.get_c->status); | ||
741 | 742 | ||
743 | ret = rndis_error_status(u.get_c->status); | ||
742 | if (ret < 0) | 744 | if (ret < 0) |
743 | devdbg(dev, "rndis_query_oid(%s): device returned " | 745 | netdev_dbg(dev->net, "%s(%s): device returned error, 0x%08x (%d)\n", |
744 | "error, 0x%08x (%d)", oid_to_string(oid), | 746 | __func__, oid_to_string(oid), |
745 | le32_to_cpu(u.get_c->status), ret); | 747 | le32_to_cpu(u.get_c->status), ret); |
746 | } | 748 | } |
747 | 749 | ||
748 | mutex_unlock(&priv->command_lock); | 750 | mutex_unlock(&priv->command_lock); |
@@ -790,17 +792,17 @@ static int rndis_set_oid(struct usbnet *dev, __le32 oid, void *data, int len) | |||
790 | ret = rndis_command(dev, u.header, buflen); | 792 | ret = rndis_command(dev, u.header, buflen); |
791 | priv->current_command_oid = 0; | 793 | priv->current_command_oid = 0; |
792 | if (ret < 0) | 794 | if (ret < 0) |
793 | devdbg(dev, "rndis_set_oid(%s): rndis_command() failed, %d " | 795 | netdev_dbg(dev->net, "%s(%s): rndis_command() failed, %d (%08x)\n", |
794 | "(%08x)", oid_to_string(oid), ret, | 796 | __func__, oid_to_string(oid), ret, |
795 | le32_to_cpu(u.set_c->status)); | 797 | le32_to_cpu(u.set_c->status)); |
796 | 798 | ||
797 | if (ret == 0) { | 799 | if (ret == 0) { |
798 | ret = rndis_error_status(u.set_c->status); | 800 | ret = rndis_error_status(u.set_c->status); |
799 | 801 | ||
800 | if (ret < 0) | 802 | if (ret < 0) |
801 | devdbg(dev, "rndis_set_oid(%s): device returned error, " | 803 | netdev_dbg(dev->net, "%s(%s): device returned error, 0x%08x (%d)\n", |
802 | "0x%08x (%d)", oid_to_string(oid), | 804 | __func__, oid_to_string(oid), |
803 | le32_to_cpu(u.set_c->status), ret); | 805 | le32_to_cpu(u.set_c->status), ret); |
804 | } | 806 | } |
805 | 807 | ||
806 | mutex_unlock(&priv->command_lock); | 808 | mutex_unlock(&priv->command_lock); |
@@ -869,11 +871,11 @@ static int rndis_set_config_parameter(struct usbnet *dev, char *param, | |||
869 | #endif | 871 | #endif |
870 | 872 | ||
871 | if (value_type == 2) | 873 | if (value_type == 2) |
872 | devdbg(dev, "setting config parameter: %s, value: %s", | 874 | netdev_dbg(dev->net, "setting config parameter: %s, value: %s\n", |
873 | param, (u8 *)value); | 875 | param, (u8 *)value); |
874 | else | 876 | else |
875 | devdbg(dev, "setting config parameter: %s, value: %d", | 877 | netdev_dbg(dev->net, "setting config parameter: %s, value: %d\n", |
876 | param, *(u32 *)value); | 878 | param, *(u32 *)value); |
877 | 879 | ||
878 | infobuf->name_offs = cpu_to_le32(sizeof(*infobuf)); | 880 | infobuf->name_offs = cpu_to_le32(sizeof(*infobuf)); |
879 | infobuf->name_length = cpu_to_le32(param_len); | 881 | infobuf->name_length = cpu_to_le32(param_len); |
@@ -896,20 +898,21 @@ static int rndis_set_config_parameter(struct usbnet *dev, char *param, | |||
896 | } | 898 | } |
897 | 899 | ||
898 | #ifdef DEBUG | 900 | #ifdef DEBUG |
899 | devdbg(dev, "info buffer (len: %d):", info_len); | 901 | netdev_dbg(dev->net, "info buffer (len: %d)\n", info_len); |
900 | for (i = 0; i < info_len; i += 12) { | 902 | for (i = 0; i < info_len; i += 12) { |
901 | u32 *tmp = (u32 *)((u8 *)infobuf + i); | 903 | u32 *tmp = (u32 *)((u8 *)infobuf + i); |
902 | devdbg(dev, "%08X:%08X:%08X", | 904 | netdev_dbg(dev->net, "%08X:%08X:%08X\n", |
903 | cpu_to_be32(tmp[0]), | 905 | cpu_to_be32(tmp[0]), |
904 | cpu_to_be32(tmp[1]), | 906 | cpu_to_be32(tmp[1]), |
905 | cpu_to_be32(tmp[2])); | 907 | cpu_to_be32(tmp[2])); |
906 | } | 908 | } |
907 | #endif | 909 | #endif |
908 | 910 | ||
909 | ret = rndis_set_oid(dev, OID_GEN_RNDIS_CONFIG_PARAMETER, | 911 | ret = rndis_set_oid(dev, OID_GEN_RNDIS_CONFIG_PARAMETER, |
910 | infobuf, info_len); | 912 | infobuf, info_len); |
911 | if (ret != 0) | 913 | if (ret != 0) |
912 | devdbg(dev, "setting rndis config parameter failed, %d.", ret); | 914 | netdev_dbg(dev->net, "setting rndis config parameter failed, %d\n", |
915 | ret); | ||
913 | 916 | ||
914 | kfree(infobuf); | 917 | kfree(infobuf); |
915 | return ret; | 918 | return ret; |
@@ -944,13 +947,13 @@ static int set_essid(struct usbnet *usbdev, struct ndis_80211_ssid *ssid) | |||
944 | 947 | ||
945 | ret = rndis_set_oid(usbdev, OID_802_11_SSID, ssid, sizeof(*ssid)); | 948 | ret = rndis_set_oid(usbdev, OID_802_11_SSID, ssid, sizeof(*ssid)); |
946 | if (ret < 0) { | 949 | if (ret < 0) { |
947 | devwarn(usbdev, "setting SSID failed (%08X)", ret); | 950 | netdev_warn(usbdev->net, "setting SSID failed (%08X)\n", ret); |
948 | return ret; | 951 | return ret; |
949 | } | 952 | } |
950 | if (ret == 0) { | 953 | if (ret == 0) { |
951 | memcpy(&priv->essid, ssid, sizeof(priv->essid)); | 954 | memcpy(&priv->essid, ssid, sizeof(priv->essid)); |
952 | priv->radio_on = true; | 955 | priv->radio_on = true; |
953 | devdbg(usbdev, "set_essid: radio_on = true"); | 956 | netdev_dbg(usbdev->net, "%s(): radio_on = true\n", __func__); |
954 | } | 957 | } |
955 | 958 | ||
956 | return ret; | 959 | return ret; |
@@ -962,7 +965,8 @@ static int set_bssid(struct usbnet *usbdev, u8 bssid[ETH_ALEN]) | |||
962 | 965 | ||
963 | ret = rndis_set_oid(usbdev, OID_802_11_BSSID, bssid, ETH_ALEN); | 966 | ret = rndis_set_oid(usbdev, OID_802_11_BSSID, bssid, ETH_ALEN); |
964 | if (ret < 0) { | 967 | if (ret < 0) { |
965 | devwarn(usbdev, "setting BSSID[%pM] failed (%08X)", bssid, ret); | 968 | netdev_warn(usbdev->net, "setting BSSID[%pM] failed (%08X)\n", |
969 | bssid, ret); | ||
966 | return ret; | 970 | return ret; |
967 | } | 971 | } |
968 | 972 | ||
@@ -1020,7 +1024,8 @@ static int disassociate(struct usbnet *usbdev, bool reset_ssid) | |||
1020 | ret = rndis_set_oid(usbdev, OID_802_11_DISASSOCIATE, NULL, 0); | 1024 | ret = rndis_set_oid(usbdev, OID_802_11_DISASSOCIATE, NULL, 0); |
1021 | if (ret == 0) { | 1025 | if (ret == 0) { |
1022 | priv->radio_on = false; | 1026 | priv->radio_on = false; |
1023 | devdbg(usbdev, "disassociate: radio_on = false"); | 1027 | netdev_dbg(usbdev->net, "%s(): radio_on = false\n", |
1028 | __func__); | ||
1024 | 1029 | ||
1025 | if (reset_ssid) | 1030 | if (reset_ssid) |
1026 | msleep(100); | 1031 | msleep(100); |
@@ -1053,8 +1058,8 @@ static int set_auth_mode(struct usbnet *usbdev, u32 wpa_version, | |||
1053 | __le32 tmp; | 1058 | __le32 tmp; |
1054 | int auth_mode, ret; | 1059 | int auth_mode, ret; |
1055 | 1060 | ||
1056 | devdbg(usbdev, "set_auth_mode: wpa_version=0x%x authalg=0x%x " | 1061 | netdev_dbg(usbdev->net, "%s(): wpa_version=0x%x authalg=0x%x keymgmt=0x%x\n", |
1057 | "keymgmt=0x%x", wpa_version, auth_type, keymgmt); | 1062 | __func__, wpa_version, auth_type, keymgmt); |
1058 | 1063 | ||
1059 | if (wpa_version & NL80211_WPA_VERSION_2) { | 1064 | if (wpa_version & NL80211_WPA_VERSION_2) { |
1060 | if (keymgmt & RNDIS_WLAN_KEY_MGMT_802_1X) | 1065 | if (keymgmt & RNDIS_WLAN_KEY_MGMT_802_1X) |
@@ -1072,6 +1077,8 @@ static int set_auth_mode(struct usbnet *usbdev, u32 wpa_version, | |||
1072 | auth_mode = NDIS_80211_AUTH_SHARED; | 1077 | auth_mode = NDIS_80211_AUTH_SHARED; |
1073 | else if (auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) | 1078 | else if (auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) |
1074 | auth_mode = NDIS_80211_AUTH_OPEN; | 1079 | auth_mode = NDIS_80211_AUTH_OPEN; |
1080 | else if (auth_type == NL80211_AUTHTYPE_AUTOMATIC) | ||
1081 | auth_mode = NDIS_80211_AUTH_AUTO_SWITCH; | ||
1075 | else | 1082 | else |
1076 | return -ENOTSUPP; | 1083 | return -ENOTSUPP; |
1077 | 1084 | ||
@@ -1079,7 +1086,8 @@ static int set_auth_mode(struct usbnet *usbdev, u32 wpa_version, | |||
1079 | ret = rndis_set_oid(usbdev, OID_802_11_AUTHENTICATION_MODE, &tmp, | 1086 | ret = rndis_set_oid(usbdev, OID_802_11_AUTHENTICATION_MODE, &tmp, |
1080 | sizeof(tmp)); | 1087 | sizeof(tmp)); |
1081 | if (ret != 0) { | 1088 | if (ret != 0) { |
1082 | devwarn(usbdev, "setting auth mode failed (%08X)", ret); | 1089 | netdev_warn(usbdev->net, "setting auth mode failed (%08X)\n", |
1090 | ret); | ||
1083 | return ret; | 1091 | return ret; |
1084 | } | 1092 | } |
1085 | 1093 | ||
@@ -1095,7 +1103,8 @@ static int set_priv_filter(struct usbnet *usbdev) | |||
1095 | struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); | 1103 | struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); |
1096 | __le32 tmp; | 1104 | __le32 tmp; |
1097 | 1105 | ||
1098 | devdbg(usbdev, "set_priv_filter: wpa_version=0x%x", priv->wpa_version); | 1106 | netdev_dbg(usbdev->net, "%s(): wpa_version=0x%x\n", |
1107 | __func__, priv->wpa_version); | ||
1099 | 1108 | ||
1100 | if (priv->wpa_version & NL80211_WPA_VERSION_2 || | 1109 | if (priv->wpa_version & NL80211_WPA_VERSION_2 || |
1101 | priv->wpa_version & NL80211_WPA_VERSION_1) | 1110 | priv->wpa_version & NL80211_WPA_VERSION_1) |
@@ -1113,8 +1122,8 @@ static int set_encr_mode(struct usbnet *usbdev, int pairwise, int groupwise) | |||
1113 | __le32 tmp; | 1122 | __le32 tmp; |
1114 | int encr_mode, ret; | 1123 | int encr_mode, ret; |
1115 | 1124 | ||
1116 | devdbg(usbdev, "set_encr_mode: cipher_pair=0x%x cipher_group=0x%x", | 1125 | netdev_dbg(usbdev->net, "%s(): cipher_pair=0x%x cipher_group=0x%x\n", |
1117 | pairwise, groupwise); | 1126 | __func__, pairwise, groupwise); |
1118 | 1127 | ||
1119 | if (pairwise & RNDIS_WLAN_ALG_CCMP) | 1128 | if (pairwise & RNDIS_WLAN_ALG_CCMP) |
1120 | encr_mode = NDIS_80211_ENCR_CCMP_ENABLED; | 1129 | encr_mode = NDIS_80211_ENCR_CCMP_ENABLED; |
@@ -1133,7 +1142,8 @@ static int set_encr_mode(struct usbnet *usbdev, int pairwise, int groupwise) | |||
1133 | ret = rndis_set_oid(usbdev, OID_802_11_ENCRYPTION_STATUS, &tmp, | 1142 | ret = rndis_set_oid(usbdev, OID_802_11_ENCRYPTION_STATUS, &tmp, |
1134 | sizeof(tmp)); | 1143 | sizeof(tmp)); |
1135 | if (ret != 0) { | 1144 | if (ret != 0) { |
1136 | devwarn(usbdev, "setting encr mode failed (%08X)", ret); | 1145 | netdev_warn(usbdev->net, "setting encr mode failed (%08X)\n", |
1146 | ret); | ||
1137 | return ret; | 1147 | return ret; |
1138 | } | 1148 | } |
1139 | 1149 | ||
@@ -1148,13 +1158,15 @@ static int set_infra_mode(struct usbnet *usbdev, int mode) | |||
1148 | __le32 tmp; | 1158 | __le32 tmp; |
1149 | int ret; | 1159 | int ret; |
1150 | 1160 | ||
1151 | devdbg(usbdev, "set_infra_mode: infra_mode=0x%x", priv->infra_mode); | 1161 | netdev_dbg(usbdev->net, "%s(): infra_mode=0x%x\n", |
1162 | __func__, priv->infra_mode); | ||
1152 | 1163 | ||
1153 | tmp = cpu_to_le32(mode); | 1164 | tmp = cpu_to_le32(mode); |
1154 | ret = rndis_set_oid(usbdev, OID_802_11_INFRASTRUCTURE_MODE, &tmp, | 1165 | ret = rndis_set_oid(usbdev, OID_802_11_INFRASTRUCTURE_MODE, &tmp, |
1155 | sizeof(tmp)); | 1166 | sizeof(tmp)); |
1156 | if (ret != 0) { | 1167 | if (ret != 0) { |
1157 | devwarn(usbdev, "setting infra mode failed (%08X)", ret); | 1168 | netdev_warn(usbdev->net, "setting infra mode failed (%08X)\n", |
1169 | ret); | ||
1158 | return ret; | 1170 | return ret; |
1159 | } | 1171 | } |
1160 | 1172 | ||
@@ -1171,7 +1183,7 @@ static int set_rts_threshold(struct usbnet *usbdev, u32 rts_threshold) | |||
1171 | { | 1183 | { |
1172 | __le32 tmp; | 1184 | __le32 tmp; |
1173 | 1185 | ||
1174 | devdbg(usbdev, "set_rts_threshold %i", rts_threshold); | 1186 | netdev_dbg(usbdev->net, "%s(): %i\n", __func__, rts_threshold); |
1175 | 1187 | ||
1176 | if (rts_threshold < 0 || rts_threshold > 2347) | 1188 | if (rts_threshold < 0 || rts_threshold > 2347) |
1177 | rts_threshold = 2347; | 1189 | rts_threshold = 2347; |
@@ -1185,7 +1197,7 @@ static int set_frag_threshold(struct usbnet *usbdev, u32 frag_threshold) | |||
1185 | { | 1197 | { |
1186 | __le32 tmp; | 1198 | __le32 tmp; |
1187 | 1199 | ||
1188 | devdbg(usbdev, "set_frag_threshold %i", frag_threshold); | 1200 | netdev_dbg(usbdev->net, "%s(): %i\n", __func__, frag_threshold); |
1189 | 1201 | ||
1190 | if (frag_threshold < 256 || frag_threshold > 2346) | 1202 | if (frag_threshold < 256 || frag_threshold > 2346) |
1191 | frag_threshold = 2346; | 1203 | frag_threshold = 2346; |
@@ -1219,7 +1231,7 @@ static int set_channel(struct usbnet *usbdev, int channel) | |||
1219 | unsigned int dsconfig; | 1231 | unsigned int dsconfig; |
1220 | int len, ret; | 1232 | int len, ret; |
1221 | 1233 | ||
1222 | devdbg(usbdev, "set_channel(%d)", channel); | 1234 | netdev_dbg(usbdev->net, "%s(%d)\n", __func__, channel); |
1223 | 1235 | ||
1224 | /* this OID is valid only when not associated */ | 1236 | /* this OID is valid only when not associated */ |
1225 | if (is_associated(usbdev)) | 1237 | if (is_associated(usbdev)) |
@@ -1230,7 +1242,8 @@ static int set_channel(struct usbnet *usbdev, int channel) | |||
1230 | len = sizeof(config); | 1242 | len = sizeof(config); |
1231 | ret = rndis_query_oid(usbdev, OID_802_11_CONFIGURATION, &config, &len); | 1243 | ret = rndis_query_oid(usbdev, OID_802_11_CONFIGURATION, &config, &len); |
1232 | if (ret < 0) { | 1244 | if (ret < 0) { |
1233 | devdbg(usbdev, "set_channel: querying configuration failed"); | 1245 | netdev_dbg(usbdev->net, "%s(): querying configuration failed\n", |
1246 | __func__); | ||
1234 | return ret; | 1247 | return ret; |
1235 | } | 1248 | } |
1236 | 1249 | ||
@@ -1238,7 +1251,7 @@ static int set_channel(struct usbnet *usbdev, int channel) | |||
1238 | ret = rndis_set_oid(usbdev, OID_802_11_CONFIGURATION, &config, | 1251 | ret = rndis_set_oid(usbdev, OID_802_11_CONFIGURATION, &config, |
1239 | sizeof(config)); | 1252 | sizeof(config)); |
1240 | 1253 | ||
1241 | devdbg(usbdev, "set_channel: %d -> %d", channel, ret); | 1254 | netdev_dbg(usbdev->net, "%s(): %d -> %d\n", __func__, channel, ret); |
1242 | 1255 | ||
1243 | return ret; | 1256 | return ret; |
1244 | } | 1257 | } |
@@ -1252,7 +1265,8 @@ static int add_wep_key(struct usbnet *usbdev, const u8 *key, int key_len, | |||
1252 | u32 cipher; | 1265 | u32 cipher; |
1253 | int ret; | 1266 | int ret; |
1254 | 1267 | ||
1255 | devdbg(usbdev, "add_wep_key(idx: %d, len: %d)", index, key_len); | 1268 | netdev_dbg(usbdev->net, "%s(idx: %d, len: %d)\n", |
1269 | __func__, index, key_len); | ||
1256 | 1270 | ||
1257 | if ((key_len != 5 && key_len != 13) || index < 0 || index > 3) | 1271 | if ((key_len != 5 && key_len != 13) || index < 0 || index > 3) |
1258 | return -EINVAL; | 1272 | return -EINVAL; |
@@ -1274,15 +1288,15 @@ static int add_wep_key(struct usbnet *usbdev, const u8 *key, int key_len, | |||
1274 | ret = set_encr_mode(usbdev, RNDIS_WLAN_ALG_WEP, | 1288 | ret = set_encr_mode(usbdev, RNDIS_WLAN_ALG_WEP, |
1275 | RNDIS_WLAN_ALG_NONE); | 1289 | RNDIS_WLAN_ALG_NONE); |
1276 | if (ret) | 1290 | if (ret) |
1277 | devwarn(usbdev, "encryption couldn't be enabled (%08X)", | 1291 | netdev_warn(usbdev->net, "encryption couldn't be enabled (%08X)\n", |
1278 | ret); | 1292 | ret); |
1279 | } | 1293 | } |
1280 | 1294 | ||
1281 | ret = rndis_set_oid(usbdev, OID_802_11_ADD_WEP, &ndis_key, | 1295 | ret = rndis_set_oid(usbdev, OID_802_11_ADD_WEP, &ndis_key, |
1282 | sizeof(ndis_key)); | 1296 | sizeof(ndis_key)); |
1283 | if (ret != 0) { | 1297 | if (ret != 0) { |
1284 | devwarn(usbdev, "adding encryption key %d failed (%08X)", | 1298 | netdev_warn(usbdev->net, "adding encryption key %d failed (%08X)\n", |
1285 | index+1, ret); | 1299 | index + 1, ret); |
1286 | return ret; | 1300 | return ret; |
1287 | } | 1301 | } |
1288 | 1302 | ||
@@ -1304,22 +1318,23 @@ static int add_wpa_key(struct usbnet *usbdev, const u8 *key, int key_len, | |||
1304 | int ret; | 1318 | int ret; |
1305 | 1319 | ||
1306 | if (index < 0 || index >= 4) { | 1320 | if (index < 0 || index >= 4) { |
1307 | devdbg(usbdev, "add_wpa_key: index out of range (%i)", index); | 1321 | netdev_dbg(usbdev->net, "%s(): index out of range (%i)\n", |
1322 | __func__, index); | ||
1308 | return -EINVAL; | 1323 | return -EINVAL; |
1309 | } | 1324 | } |
1310 | if (key_len > sizeof(ndis_key.material) || key_len < 0) { | 1325 | if (key_len > sizeof(ndis_key.material) || key_len < 0) { |
1311 | devdbg(usbdev, "add_wpa_key: key length out of range (%i)", | 1326 | netdev_dbg(usbdev->net, "%s(): key length out of range (%i)\n", |
1312 | key_len); | 1327 | __func__, key_len); |
1313 | return -EINVAL; | 1328 | return -EINVAL; |
1314 | } | 1329 | } |
1315 | if (flags & NDIS_80211_ADDKEY_SET_INIT_RECV_SEQ) { | 1330 | if (flags & NDIS_80211_ADDKEY_SET_INIT_RECV_SEQ) { |
1316 | if (!rx_seq || seq_len <= 0) { | 1331 | if (!rx_seq || seq_len <= 0) { |
1317 | devdbg(usbdev, "add_wpa_key: recv seq flag without" | 1332 | netdev_dbg(usbdev->net, "%s(): recv seq flag without buffer\n", |
1318 | "buffer"); | 1333 | __func__); |
1319 | return -EINVAL; | 1334 | return -EINVAL; |
1320 | } | 1335 | } |
1321 | if (rx_seq && seq_len > sizeof(ndis_key.rsc)) { | 1336 | if (rx_seq && seq_len > sizeof(ndis_key.rsc)) { |
1322 | devdbg(usbdev, "add_wpa_key: too big recv seq buffer"); | 1337 | netdev_dbg(usbdev->net, "%s(): too big recv seq buffer\n", __func__); |
1323 | return -EINVAL; | 1338 | return -EINVAL; |
1324 | } | 1339 | } |
1325 | } | 1340 | } |
@@ -1327,15 +1342,16 @@ static int add_wpa_key(struct usbnet *usbdev, const u8 *key, int key_len, | |||
1327 | is_addr_ok = addr && !is_zero_ether_addr(addr) && | 1342 | is_addr_ok = addr && !is_zero_ether_addr(addr) && |
1328 | !is_broadcast_ether_addr(addr); | 1343 | !is_broadcast_ether_addr(addr); |
1329 | if ((flags & NDIS_80211_ADDKEY_PAIRWISE_KEY) && !is_addr_ok) { | 1344 | if ((flags & NDIS_80211_ADDKEY_PAIRWISE_KEY) && !is_addr_ok) { |
1330 | devdbg(usbdev, "add_wpa_key: pairwise but bssid invalid (%pM)", | 1345 | netdev_dbg(usbdev->net, "%s(): pairwise but bssid invalid (%pM)\n", |
1331 | addr); | 1346 | __func__, addr); |
1332 | return -EINVAL; | 1347 | return -EINVAL; |
1333 | } | 1348 | } |
1334 | 1349 | ||
1335 | devdbg(usbdev, "add_wpa_key(%i): flags:%i%i%i", index, | 1350 | netdev_dbg(usbdev->net, "%s(%i): flags:%i%i%i\n", |
1336 | !!(flags & NDIS_80211_ADDKEY_TRANSMIT_KEY), | 1351 | __func__, index, |
1337 | !!(flags & NDIS_80211_ADDKEY_PAIRWISE_KEY), | 1352 | !!(flags & NDIS_80211_ADDKEY_TRANSMIT_KEY), |
1338 | !!(flags & NDIS_80211_ADDKEY_SET_INIT_RECV_SEQ)); | 1353 | !!(flags & NDIS_80211_ADDKEY_PAIRWISE_KEY), |
1354 | !!(flags & NDIS_80211_ADDKEY_SET_INIT_RECV_SEQ)); | ||
1339 | 1355 | ||
1340 | memset(&ndis_key, 0, sizeof(ndis_key)); | 1356 | memset(&ndis_key, 0, sizeof(ndis_key)); |
1341 | 1357 | ||
@@ -1369,7 +1385,8 @@ static int add_wpa_key(struct usbnet *usbdev, const u8 *key, int key_len, | |||
1369 | 1385 | ||
1370 | ret = rndis_set_oid(usbdev, OID_802_11_ADD_KEY, &ndis_key, | 1386 | ret = rndis_set_oid(usbdev, OID_802_11_ADD_KEY, &ndis_key, |
1371 | le32_to_cpu(ndis_key.size)); | 1387 | le32_to_cpu(ndis_key.size)); |
1372 | devdbg(usbdev, "add_wpa_key: OID_802_11_ADD_KEY -> %08X", ret); | 1388 | netdev_dbg(usbdev->net, "%s(): OID_802_11_ADD_KEY -> %08X\n", |
1389 | __func__, ret); | ||
1373 | if (ret != 0) | 1390 | if (ret != 0) |
1374 | return ret; | 1391 | return ret; |
1375 | 1392 | ||
@@ -1398,7 +1415,7 @@ static int restore_key(struct usbnet *usbdev, int key_idx) | |||
1398 | 1415 | ||
1399 | key = priv->encr_keys[key_idx]; | 1416 | key = priv->encr_keys[key_idx]; |
1400 | 1417 | ||
1401 | devdbg(usbdev, "restore_key: %i:%i", key_idx, key.len); | 1418 | netdev_dbg(usbdev->net, "%s(): %i:%i\n", __func__, key_idx, key.len); |
1402 | 1419 | ||
1403 | if (key.len == 0) | 1420 | if (key.len == 0) |
1404 | return 0; | 1421 | return 0; |
@@ -1433,8 +1450,9 @@ static int remove_key(struct usbnet *usbdev, int index, const u8 *bssid) | |||
1433 | 1450 | ||
1434 | is_wpa = is_wpa_key(priv, index); | 1451 | is_wpa = is_wpa_key(priv, index); |
1435 | 1452 | ||
1436 | devdbg(usbdev, "remove_key: %i:%s:%i", index, is_wpa ? "wpa" : "wep", | 1453 | netdev_dbg(usbdev->net, "%s(): %i:%s:%i\n", |
1437 | priv->encr_keys[index].len); | 1454 | __func__, index, is_wpa ? "wpa" : "wep", |
1455 | priv->encr_keys[index].len); | ||
1438 | 1456 | ||
1439 | clear_key(priv, index); | 1457 | clear_key(priv, index); |
1440 | 1458 | ||
@@ -1461,9 +1479,9 @@ static int remove_key(struct usbnet *usbdev, int index, const u8 *bssid) | |||
1461 | ret = rndis_set_oid(usbdev, OID_802_11_REMOVE_WEP, &keyindex, | 1479 | ret = rndis_set_oid(usbdev, OID_802_11_REMOVE_WEP, &keyindex, |
1462 | sizeof(keyindex)); | 1480 | sizeof(keyindex)); |
1463 | if (ret != 0) { | 1481 | if (ret != 0) { |
1464 | devwarn(usbdev, | 1482 | netdev_warn(usbdev->net, |
1465 | "removing encryption key %d failed (%08X)", | 1483 | "removing encryption key %d failed (%08X)\n", |
1466 | index, ret); | 1484 | index, ret); |
1467 | return ret; | 1485 | return ret; |
1468 | } | 1486 | } |
1469 | } | 1487 | } |
@@ -1479,59 +1497,76 @@ static void set_multicast_list(struct usbnet *usbdev) | |||
1479 | { | 1497 | { |
1480 | struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); | 1498 | struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); |
1481 | struct dev_mc_list *mclist; | 1499 | struct dev_mc_list *mclist; |
1482 | __le32 filter; | 1500 | __le32 filter, basefilter; |
1483 | int ret, i, size; | 1501 | int ret; |
1484 | char *buf; | 1502 | char *mc_addrs = NULL; |
1503 | int mc_count; | ||
1485 | 1504 | ||
1486 | filter = RNDIS_PACKET_TYPE_DIRECTED | RNDIS_PACKET_TYPE_BROADCAST; | 1505 | basefilter = filter = RNDIS_PACKET_TYPE_DIRECTED | |
1506 | RNDIS_PACKET_TYPE_BROADCAST; | ||
1487 | 1507 | ||
1488 | if (usbdev->net->flags & IFF_PROMISC) { | 1508 | if (usbdev->net->flags & IFF_PROMISC) { |
1489 | filter |= RNDIS_PACKET_TYPE_PROMISCUOUS | | 1509 | filter |= RNDIS_PACKET_TYPE_PROMISCUOUS | |
1490 | RNDIS_PACKET_TYPE_ALL_LOCAL; | 1510 | RNDIS_PACKET_TYPE_ALL_LOCAL; |
1491 | } else if (usbdev->net->flags & IFF_ALLMULTI || | 1511 | } else if (usbdev->net->flags & IFF_ALLMULTI) { |
1492 | usbdev->net->mc_count > priv->multicast_size) { | ||
1493 | filter |= RNDIS_PACKET_TYPE_ALL_MULTICAST; | 1512 | filter |= RNDIS_PACKET_TYPE_ALL_MULTICAST; |
1494 | } else if (usbdev->net->mc_count > 0) { | 1513 | } |
1495 | size = min(priv->multicast_size, usbdev->net->mc_count); | 1514 | |
1496 | buf = kmalloc(size * ETH_ALEN, GFP_KERNEL); | 1515 | if (filter != basefilter) |
1497 | if (!buf) { | 1516 | goto set_filter; |
1498 | devwarn(usbdev, | 1517 | |
1499 | "couldn't alloc %d bytes of memory", | 1518 | /* |
1500 | size * ETH_ALEN); | 1519 | * mc_list should be accessed holding the lock, so copy addresses to |
1520 | * local buffer first. | ||
1521 | */ | ||
1522 | netif_addr_lock_bh(usbdev->net); | ||
1523 | mc_count = netdev_mc_count(usbdev->net); | ||
1524 | if (mc_count > priv->multicast_size) { | ||
1525 | filter |= RNDIS_PACKET_TYPE_ALL_MULTICAST; | ||
1526 | } else if (mc_count) { | ||
1527 | int i = 0; | ||
1528 | |||
1529 | mc_addrs = kmalloc(mc_count * ETH_ALEN, GFP_ATOMIC); | ||
1530 | if (!mc_addrs) { | ||
1531 | netdev_warn(usbdev->net, | ||
1532 | "couldn't alloc %d bytes of memory\n", | ||
1533 | mc_count * ETH_ALEN); | ||
1534 | netif_addr_unlock_bh(usbdev->net); | ||
1501 | return; | 1535 | return; |
1502 | } | 1536 | } |
1503 | 1537 | ||
1504 | mclist = usbdev->net->mc_list; | 1538 | netdev_for_each_mc_addr(mclist, usbdev->net) |
1505 | for (i = 0; i < size && mclist; mclist = mclist->next) { | 1539 | memcpy(mc_addrs + i++ * ETH_ALEN, |
1506 | if (mclist->dmi_addrlen != ETH_ALEN) | 1540 | mclist->dmi_addr, ETH_ALEN); |
1507 | continue; | 1541 | } |
1542 | netif_addr_unlock_bh(usbdev->net); | ||
1508 | 1543 | ||
1509 | memcpy(buf + i * ETH_ALEN, mclist->dmi_addr, ETH_ALEN); | 1544 | if (filter != basefilter) |
1510 | i++; | 1545 | goto set_filter; |
1511 | } | ||
1512 | 1546 | ||
1513 | ret = rndis_set_oid(usbdev, OID_802_3_MULTICAST_LIST, buf, | 1547 | if (mc_count) { |
1514 | i * ETH_ALEN); | 1548 | ret = rndis_set_oid(usbdev, OID_802_3_MULTICAST_LIST, mc_addrs, |
1515 | if (ret == 0 && i > 0) | 1549 | mc_count * ETH_ALEN); |
1550 | kfree(mc_addrs); | ||
1551 | if (ret == 0) | ||
1516 | filter |= RNDIS_PACKET_TYPE_MULTICAST; | 1552 | filter |= RNDIS_PACKET_TYPE_MULTICAST; |
1517 | else | 1553 | else |
1518 | filter |= RNDIS_PACKET_TYPE_ALL_MULTICAST; | 1554 | filter |= RNDIS_PACKET_TYPE_ALL_MULTICAST; |
1519 | 1555 | ||
1520 | devdbg(usbdev, "OID_802_3_MULTICAST_LIST(%d, max: %d) -> %d", | 1556 | netdev_dbg(usbdev->net, "OID_802_3_MULTICAST_LIST(%d, max: %d) -> %d\n", |
1521 | i, priv->multicast_size, ret); | 1557 | mc_count, priv->multicast_size, ret); |
1522 | |||
1523 | kfree(buf); | ||
1524 | } | 1558 | } |
1525 | 1559 | ||
1560 | set_filter: | ||
1526 | ret = rndis_set_oid(usbdev, OID_GEN_CURRENT_PACKET_FILTER, &filter, | 1561 | ret = rndis_set_oid(usbdev, OID_GEN_CURRENT_PACKET_FILTER, &filter, |
1527 | sizeof(filter)); | 1562 | sizeof(filter)); |
1528 | if (ret < 0) { | 1563 | if (ret < 0) { |
1529 | devwarn(usbdev, "couldn't set packet filter: %08x", | 1564 | netdev_warn(usbdev->net, "couldn't set packet filter: %08x\n", |
1530 | le32_to_cpu(filter)); | 1565 | le32_to_cpu(filter)); |
1531 | } | 1566 | } |
1532 | 1567 | ||
1533 | devdbg(usbdev, "OID_GEN_CURRENT_PACKET_FILTER(%08x) -> %d", | 1568 | netdev_dbg(usbdev->net, "OID_GEN_CURRENT_PACKET_FILTER(%08x) -> %d\n", |
1534 | le32_to_cpu(filter), ret); | 1569 | le32_to_cpu(filter), ret); |
1535 | } | 1570 | } |
1536 | 1571 | ||
1537 | /* | 1572 | /* |
@@ -1589,7 +1624,8 @@ static int rndis_set_tx_power(struct wiphy *wiphy, enum tx_power_setting type, | |||
1589 | struct rndis_wlan_private *priv = wiphy_priv(wiphy); | 1624 | struct rndis_wlan_private *priv = wiphy_priv(wiphy); |
1590 | struct usbnet *usbdev = priv->usbdev; | 1625 | struct usbnet *usbdev = priv->usbdev; |
1591 | 1626 | ||
1592 | devdbg(usbdev, "rndis_set_tx_power type:0x%x dbm:%i", type, dbm); | 1627 | netdev_dbg(usbdev->net, "%s(): type:0x%x dbm:%i\n", |
1628 | __func__, type, dbm); | ||
1593 | 1629 | ||
1594 | /* Device doesn't support changing txpower after initialization, only | 1630 | /* Device doesn't support changing txpower after initialization, only |
1595 | * turn off/on radio. Support 'auto' mode and setting same dBm that is | 1631 | * turn off/on radio. Support 'auto' mode and setting same dBm that is |
@@ -1612,7 +1648,7 @@ static int rndis_get_tx_power(struct wiphy *wiphy, int *dbm) | |||
1612 | 1648 | ||
1613 | *dbm = get_bcm4320_power_dbm(priv); | 1649 | *dbm = get_bcm4320_power_dbm(priv); |
1614 | 1650 | ||
1615 | devdbg(usbdev, "rndis_get_tx_power dbm:%i", *dbm); | 1651 | netdev_dbg(usbdev->net, "%s(): dbm:%i\n", __func__, *dbm); |
1616 | 1652 | ||
1617 | return 0; | 1653 | return 0; |
1618 | } | 1654 | } |
@@ -1626,7 +1662,7 @@ static int rndis_scan(struct wiphy *wiphy, struct net_device *dev, | |||
1626 | int ret; | 1662 | int ret; |
1627 | __le32 tmp; | 1663 | __le32 tmp; |
1628 | 1664 | ||
1629 | devdbg(usbdev, "cfg80211.scan"); | 1665 | netdev_dbg(usbdev->net, "cfg80211.scan\n"); |
1630 | 1666 | ||
1631 | /* Get current bssid list from device before new scan, as new scan | 1667 | /* Get current bssid list from device before new scan, as new scan |
1632 | * clears internal bssid list. | 1668 | * clears internal bssid list. |
@@ -1666,8 +1702,8 @@ static struct cfg80211_bss *rndis_bss_info_update(struct usbnet *usbdev, | |||
1666 | int ie_len, bssid_len; | 1702 | int ie_len, bssid_len; |
1667 | u8 *ie; | 1703 | u8 *ie; |
1668 | 1704 | ||
1669 | devdbg(usbdev, " found bssid: '%.32s' [%pM]", bssid->ssid.essid, | 1705 | netdev_dbg(usbdev->net, " found bssid: '%.32s' [%pM]\n", |
1670 | bssid->mac); | 1706 | bssid->ssid.essid, bssid->mac); |
1671 | 1707 | ||
1672 | /* parse bssid structure */ | 1708 | /* parse bssid structure */ |
1673 | bssid_len = le32_to_cpu(bssid->length); | 1709 | bssid_len = le32_to_cpu(bssid->length); |
@@ -1709,7 +1745,7 @@ static int rndis_check_bssid_list(struct usbnet *usbdev) | |||
1709 | int ret = -EINVAL, len, count, bssid_len; | 1745 | int ret = -EINVAL, len, count, bssid_len; |
1710 | bool resized = false; | 1746 | bool resized = false; |
1711 | 1747 | ||
1712 | devdbg(usbdev, "check_bssid_list"); | 1748 | netdev_dbg(usbdev->net, "check_bssid_list\n"); |
1713 | 1749 | ||
1714 | len = CONTROL_BUFFER_SIZE; | 1750 | len = CONTROL_BUFFER_SIZE; |
1715 | resize_buf: | 1751 | resize_buf: |
@@ -1733,8 +1769,8 @@ resize_buf: | |||
1733 | bssid = bssid_list->bssid; | 1769 | bssid = bssid_list->bssid; |
1734 | bssid_len = le32_to_cpu(bssid->length); | 1770 | bssid_len = le32_to_cpu(bssid->length); |
1735 | count = le32_to_cpu(bssid_list->num_items); | 1771 | count = le32_to_cpu(bssid_list->num_items); |
1736 | devdbg(usbdev, "check_bssid_list: %d BSSIDs found (buflen: %d)", count, | 1772 | netdev_dbg(usbdev->net, "check_bssid_list: %d BSSIDs found (buflen: %d)\n", |
1737 | len); | 1773 | count, len); |
1738 | 1774 | ||
1739 | while (count && ((void *)bssid + bssid_len) <= (buf + len)) { | 1775 | while (count && ((void *)bssid + bssid_len) <= (buf + len)) { |
1740 | rndis_bss_info_update(usbdev, bssid); | 1776 | rndis_bss_info_update(usbdev, bssid); |
@@ -1756,7 +1792,7 @@ static void rndis_get_scan_results(struct work_struct *work) | |||
1756 | struct usbnet *usbdev = priv->usbdev; | 1792 | struct usbnet *usbdev = priv->usbdev; |
1757 | int ret; | 1793 | int ret; |
1758 | 1794 | ||
1759 | devdbg(usbdev, "get_scan_results"); | 1795 | netdev_dbg(usbdev->net, "get_scan_results\n"); |
1760 | 1796 | ||
1761 | if (!priv->scan_request) | 1797 | if (!priv->scan_request) |
1762 | return; | 1798 | return; |
@@ -1790,7 +1826,7 @@ static int rndis_connect(struct wiphy *wiphy, struct net_device *dev, | |||
1790 | 1826 | ||
1791 | if (sme->crypto.n_ciphers_pairwise > 0 && | 1827 | if (sme->crypto.n_ciphers_pairwise > 0 && |
1792 | pairwise == RNDIS_WLAN_ALG_NONE) { | 1828 | pairwise == RNDIS_WLAN_ALG_NONE) { |
1793 | deverr(usbdev, "Unsupported pairwise cipher"); | 1829 | netdev_err(usbdev->net, "Unsupported pairwise cipher\n"); |
1794 | return -ENOTSUPP; | 1830 | return -ENOTSUPP; |
1795 | } | 1831 | } |
1796 | 1832 | ||
@@ -1800,28 +1836,30 @@ static int rndis_connect(struct wiphy *wiphy, struct net_device *dev, | |||
1800 | 1836 | ||
1801 | if (sme->crypto.n_akm_suites > 0 && | 1837 | if (sme->crypto.n_akm_suites > 0 && |
1802 | keymgmt == RNDIS_WLAN_KEY_MGMT_NONE) { | 1838 | keymgmt == RNDIS_WLAN_KEY_MGMT_NONE) { |
1803 | deverr(usbdev, "Invalid keymgmt"); | 1839 | netdev_err(usbdev->net, "Invalid keymgmt\n"); |
1804 | return -ENOTSUPP; | 1840 | return -ENOTSUPP; |
1805 | } | 1841 | } |
1806 | 1842 | ||
1807 | devdbg(usbdev, "cfg80211.connect('%.32s':[%pM]:%d:[%d,0x%x:0x%x]:[0x%x:" | 1843 | netdev_dbg(usbdev->net, "cfg80211.connect('%.32s':[%pM]:%d:[%d,0x%x:0x%x]:[0x%x:0x%x]:0x%x)\n", |
1808 | "0x%x]:0x%x)", sme->ssid, sme->bssid, chan, | 1844 | sme->ssid, sme->bssid, chan, |
1809 | sme->privacy, sme->crypto.wpa_versions, sme->auth_type, | 1845 | sme->privacy, sme->crypto.wpa_versions, sme->auth_type, |
1810 | groupwise, pairwise, keymgmt); | 1846 | groupwise, pairwise, keymgmt); |
1811 | 1847 | ||
1812 | if (is_associated(usbdev)) | 1848 | if (is_associated(usbdev)) |
1813 | disassociate(usbdev, false); | 1849 | disassociate(usbdev, false); |
1814 | 1850 | ||
1815 | ret = set_infra_mode(usbdev, NDIS_80211_INFRA_INFRA); | 1851 | ret = set_infra_mode(usbdev, NDIS_80211_INFRA_INFRA); |
1816 | if (ret < 0) { | 1852 | if (ret < 0) { |
1817 | devdbg(usbdev, "connect: set_infra_mode failed, %d", ret); | 1853 | netdev_dbg(usbdev->net, "connect: set_infra_mode failed, %d\n", |
1854 | ret); | ||
1818 | goto err_turn_radio_on; | 1855 | goto err_turn_radio_on; |
1819 | } | 1856 | } |
1820 | 1857 | ||
1821 | ret = set_auth_mode(usbdev, sme->crypto.wpa_versions, sme->auth_type, | 1858 | ret = set_auth_mode(usbdev, sme->crypto.wpa_versions, sme->auth_type, |
1822 | keymgmt); | 1859 | keymgmt); |
1823 | if (ret < 0) { | 1860 | if (ret < 0) { |
1824 | devdbg(usbdev, "connect: set_auth_mode failed, %d", ret); | 1861 | netdev_dbg(usbdev->net, "connect: set_auth_mode failed, %d\n", |
1862 | ret); | ||
1825 | goto err_turn_radio_on; | 1863 | goto err_turn_radio_on; |
1826 | } | 1864 | } |
1827 | 1865 | ||
@@ -1829,14 +1867,16 @@ static int rndis_connect(struct wiphy *wiphy, struct net_device *dev, | |||
1829 | 1867 | ||
1830 | ret = set_encr_mode(usbdev, pairwise, groupwise); | 1868 | ret = set_encr_mode(usbdev, pairwise, groupwise); |
1831 | if (ret < 0) { | 1869 | if (ret < 0) { |
1832 | devdbg(usbdev, "connect: set_encr_mode failed, %d", ret); | 1870 | netdev_dbg(usbdev->net, "connect: set_encr_mode failed, %d\n", |
1871 | ret); | ||
1833 | goto err_turn_radio_on; | 1872 | goto err_turn_radio_on; |
1834 | } | 1873 | } |
1835 | 1874 | ||
1836 | if (channel) { | 1875 | if (channel) { |
1837 | ret = set_channel(usbdev, chan); | 1876 | ret = set_channel(usbdev, chan); |
1838 | if (ret < 0) { | 1877 | if (ret < 0) { |
1839 | devdbg(usbdev, "connect: set_channel failed, %d", ret); | 1878 | netdev_dbg(usbdev->net, "connect: set_channel failed, %d\n", |
1879 | ret); | ||
1840 | goto err_turn_radio_on; | 1880 | goto err_turn_radio_on; |
1841 | } | 1881 | } |
1842 | } | 1882 | } |
@@ -1845,8 +1885,8 @@ static int rndis_connect(struct wiphy *wiphy, struct net_device *dev, | |||
1845 | priv->encr_tx_key_index = sme->key_idx; | 1885 | priv->encr_tx_key_index = sme->key_idx; |
1846 | ret = add_wep_key(usbdev, sme->key, sme->key_len, sme->key_idx); | 1886 | ret = add_wep_key(usbdev, sme->key, sme->key_len, sme->key_idx); |
1847 | if (ret < 0) { | 1887 | if (ret < 0) { |
1848 | devdbg(usbdev, "connect: add_wep_key failed, %d " | 1888 | netdev_dbg(usbdev->net, "connect: add_wep_key failed, %d (%d, %d)\n", |
1849 | "(%d, %d)", ret, sme->key_len, sme->key_idx); | 1889 | ret, sme->key_len, sme->key_idx); |
1850 | goto err_turn_radio_on; | 1890 | goto err_turn_radio_on; |
1851 | } | 1891 | } |
1852 | } | 1892 | } |
@@ -1855,7 +1895,8 @@ static int rndis_connect(struct wiphy *wiphy, struct net_device *dev, | |||
1855 | !is_broadcast_ether_addr(sme->bssid)) { | 1895 | !is_broadcast_ether_addr(sme->bssid)) { |
1856 | ret = set_bssid(usbdev, sme->bssid); | 1896 | ret = set_bssid(usbdev, sme->bssid); |
1857 | if (ret < 0) { | 1897 | if (ret < 0) { |
1858 | devdbg(usbdev, "connect: set_bssid failed, %d", ret); | 1898 | netdev_dbg(usbdev->net, "connect: set_bssid failed, %d\n", |
1899 | ret); | ||
1859 | goto err_turn_radio_on; | 1900 | goto err_turn_radio_on; |
1860 | } | 1901 | } |
1861 | } else | 1902 | } else |
@@ -1877,7 +1918,7 @@ static int rndis_connect(struct wiphy *wiphy, struct net_device *dev, | |||
1877 | 1918 | ||
1878 | ret = set_essid(usbdev, &ssid); | 1919 | ret = set_essid(usbdev, &ssid); |
1879 | if (ret < 0) | 1920 | if (ret < 0) |
1880 | devdbg(usbdev, "connect: set_essid failed, %d", ret); | 1921 | netdev_dbg(usbdev->net, "connect: set_essid failed, %d\n", ret); |
1881 | return ret; | 1922 | return ret; |
1882 | 1923 | ||
1883 | err_turn_radio_on: | 1924 | err_turn_radio_on: |
@@ -1892,7 +1933,7 @@ static int rndis_disconnect(struct wiphy *wiphy, struct net_device *dev, | |||
1892 | struct rndis_wlan_private *priv = wiphy_priv(wiphy); | 1933 | struct rndis_wlan_private *priv = wiphy_priv(wiphy); |
1893 | struct usbnet *usbdev = priv->usbdev; | 1934 | struct usbnet *usbdev = priv->usbdev; |
1894 | 1935 | ||
1895 | devdbg(usbdev, "cfg80211.disconnect(%d)", reason_code); | 1936 | netdev_dbg(usbdev->net, "cfg80211.disconnect(%d)\n", reason_code); |
1896 | 1937 | ||
1897 | priv->connected = false; | 1938 | priv->connected = false; |
1898 | memset(priv->bssid, 0, ETH_ALEN); | 1939 | memset(priv->bssid, 0, ETH_ALEN); |
@@ -1926,21 +1967,23 @@ static int rndis_join_ibss(struct wiphy *wiphy, struct net_device *dev, | |||
1926 | alg = RNDIS_WLAN_ALG_NONE; | 1967 | alg = RNDIS_WLAN_ALG_NONE; |
1927 | } | 1968 | } |
1928 | 1969 | ||
1929 | devdbg(usbdev, "cfg80211.join_ibss('%.32s':[%pM]:%d:%d)", params->ssid, | 1970 | netdev_dbg(usbdev->net, "cfg80211.join_ibss('%.32s':[%pM]:%d:%d)\n", |
1930 | params->bssid, chan, params->privacy); | 1971 | params->ssid, params->bssid, chan, params->privacy); |
1931 | 1972 | ||
1932 | if (is_associated(usbdev)) | 1973 | if (is_associated(usbdev)) |
1933 | disassociate(usbdev, false); | 1974 | disassociate(usbdev, false); |
1934 | 1975 | ||
1935 | ret = set_infra_mode(usbdev, NDIS_80211_INFRA_ADHOC); | 1976 | ret = set_infra_mode(usbdev, NDIS_80211_INFRA_ADHOC); |
1936 | if (ret < 0) { | 1977 | if (ret < 0) { |
1937 | devdbg(usbdev, "join_ibss: set_infra_mode failed, %d", ret); | 1978 | netdev_dbg(usbdev->net, "join_ibss: set_infra_mode failed, %d\n", |
1979 | ret); | ||
1938 | goto err_turn_radio_on; | 1980 | goto err_turn_radio_on; |
1939 | } | 1981 | } |
1940 | 1982 | ||
1941 | ret = set_auth_mode(usbdev, 0, auth_type, RNDIS_WLAN_KEY_MGMT_NONE); | 1983 | ret = set_auth_mode(usbdev, 0, auth_type, RNDIS_WLAN_KEY_MGMT_NONE); |
1942 | if (ret < 0) { | 1984 | if (ret < 0) { |
1943 | devdbg(usbdev, "join_ibss: set_auth_mode failed, %d", ret); | 1985 | netdev_dbg(usbdev->net, "join_ibss: set_auth_mode failed, %d\n", |
1986 | ret); | ||
1944 | goto err_turn_radio_on; | 1987 | goto err_turn_radio_on; |
1945 | } | 1988 | } |
1946 | 1989 | ||
@@ -1948,15 +1991,16 @@ static int rndis_join_ibss(struct wiphy *wiphy, struct net_device *dev, | |||
1948 | 1991 | ||
1949 | ret = set_encr_mode(usbdev, alg, RNDIS_WLAN_ALG_NONE); | 1992 | ret = set_encr_mode(usbdev, alg, RNDIS_WLAN_ALG_NONE); |
1950 | if (ret < 0) { | 1993 | if (ret < 0) { |
1951 | devdbg(usbdev, "join_ibss: set_encr_mode failed, %d", ret); | 1994 | netdev_dbg(usbdev->net, "join_ibss: set_encr_mode failed, %d\n", |
1995 | ret); | ||
1952 | goto err_turn_radio_on; | 1996 | goto err_turn_radio_on; |
1953 | } | 1997 | } |
1954 | 1998 | ||
1955 | if (channel) { | 1999 | if (channel) { |
1956 | ret = set_channel(usbdev, chan); | 2000 | ret = set_channel(usbdev, chan); |
1957 | if (ret < 0) { | 2001 | if (ret < 0) { |
1958 | devdbg(usbdev, "join_ibss: set_channel failed, %d", | 2002 | netdev_dbg(usbdev->net, "join_ibss: set_channel failed, %d\n", |
1959 | ret); | 2003 | ret); |
1960 | goto err_turn_radio_on; | 2004 | goto err_turn_radio_on; |
1961 | } | 2005 | } |
1962 | } | 2006 | } |
@@ -1965,7 +2009,8 @@ static int rndis_join_ibss(struct wiphy *wiphy, struct net_device *dev, | |||
1965 | !is_broadcast_ether_addr(params->bssid)) { | 2009 | !is_broadcast_ether_addr(params->bssid)) { |
1966 | ret = set_bssid(usbdev, params->bssid); | 2010 | ret = set_bssid(usbdev, params->bssid); |
1967 | if (ret < 0) { | 2011 | if (ret < 0) { |
1968 | devdbg(usbdev, "join_ibss: set_bssid failed, %d", ret); | 2012 | netdev_dbg(usbdev->net, "join_ibss: set_bssid failed, %d\n", |
2013 | ret); | ||
1969 | goto err_turn_radio_on; | 2014 | goto err_turn_radio_on; |
1970 | } | 2015 | } |
1971 | } else | 2016 | } else |
@@ -1985,7 +2030,8 @@ static int rndis_join_ibss(struct wiphy *wiphy, struct net_device *dev, | |||
1985 | 2030 | ||
1986 | ret = set_essid(usbdev, &ssid); | 2031 | ret = set_essid(usbdev, &ssid); |
1987 | if (ret < 0) | 2032 | if (ret < 0) |
1988 | devdbg(usbdev, "join_ibss: set_essid failed, %d", ret); | 2033 | netdev_dbg(usbdev->net, "join_ibss: set_essid failed, %d\n", |
2034 | ret); | ||
1989 | return ret; | 2035 | return ret; |
1990 | 2036 | ||
1991 | err_turn_radio_on: | 2037 | err_turn_radio_on: |
@@ -1999,7 +2045,7 @@ static int rndis_leave_ibss(struct wiphy *wiphy, struct net_device *dev) | |||
1999 | struct rndis_wlan_private *priv = wiphy_priv(wiphy); | 2045 | struct rndis_wlan_private *priv = wiphy_priv(wiphy); |
2000 | struct usbnet *usbdev = priv->usbdev; | 2046 | struct usbnet *usbdev = priv->usbdev; |
2001 | 2047 | ||
2002 | devdbg(usbdev, "cfg80211.leave_ibss()"); | 2048 | netdev_dbg(usbdev->net, "cfg80211.leave_ibss()\n"); |
2003 | 2049 | ||
2004 | priv->connected = false; | 2050 | priv->connected = false; |
2005 | memset(priv->bssid, 0, ETH_ALEN); | 2051 | memset(priv->bssid, 0, ETH_ALEN); |
@@ -2025,8 +2071,8 @@ static int rndis_add_key(struct wiphy *wiphy, struct net_device *netdev, | |||
2025 | struct usbnet *usbdev = priv->usbdev; | 2071 | struct usbnet *usbdev = priv->usbdev; |
2026 | __le32 flags; | 2072 | __le32 flags; |
2027 | 2073 | ||
2028 | devdbg(usbdev, "rndis_add_key(%i, %pM, %08x)", key_index, mac_addr, | 2074 | netdev_dbg(usbdev->net, "%s(%i, %pM, %08x)\n", |
2029 | params->cipher); | 2075 | __func__, key_index, mac_addr, params->cipher); |
2030 | 2076 | ||
2031 | switch (params->cipher) { | 2077 | switch (params->cipher) { |
2032 | case WLAN_CIPHER_SUITE_WEP40: | 2078 | case WLAN_CIPHER_SUITE_WEP40: |
@@ -2047,8 +2093,8 @@ static int rndis_add_key(struct wiphy *wiphy, struct net_device *netdev, | |||
2047 | key_index, mac_addr, params->seq, | 2093 | key_index, mac_addr, params->seq, |
2048 | params->seq_len, params->cipher, flags); | 2094 | params->seq_len, params->cipher, flags); |
2049 | default: | 2095 | default: |
2050 | devdbg(usbdev, "rndis_add_key: unsupported cipher %08x", | 2096 | netdev_dbg(usbdev->net, "%s(): unsupported cipher %08x\n", |
2051 | params->cipher); | 2097 | __func__, params->cipher); |
2052 | return -ENOTSUPP; | 2098 | return -ENOTSUPP; |
2053 | } | 2099 | } |
2054 | } | 2100 | } |
@@ -2059,7 +2105,7 @@ static int rndis_del_key(struct wiphy *wiphy, struct net_device *netdev, | |||
2059 | struct rndis_wlan_private *priv = wiphy_priv(wiphy); | 2105 | struct rndis_wlan_private *priv = wiphy_priv(wiphy); |
2060 | struct usbnet *usbdev = priv->usbdev; | 2106 | struct usbnet *usbdev = priv->usbdev; |
2061 | 2107 | ||
2062 | devdbg(usbdev, "rndis_del_key(%i, %pM)", key_index, mac_addr); | 2108 | netdev_dbg(usbdev->net, "%s(%i, %pM)\n", __func__, key_index, mac_addr); |
2063 | 2109 | ||
2064 | return remove_key(usbdev, key_index, mac_addr); | 2110 | return remove_key(usbdev, key_index, mac_addr); |
2065 | } | 2111 | } |
@@ -2071,7 +2117,7 @@ static int rndis_set_default_key(struct wiphy *wiphy, struct net_device *netdev, | |||
2071 | struct usbnet *usbdev = priv->usbdev; | 2117 | struct usbnet *usbdev = priv->usbdev; |
2072 | struct rndis_wlan_encr_key key; | 2118 | struct rndis_wlan_encr_key key; |
2073 | 2119 | ||
2074 | devdbg(usbdev, "rndis_set_default_key(%i)", key_index); | 2120 | netdev_dbg(usbdev->net, "%s(%i)\n", __func__, key_index); |
2075 | 2121 | ||
2076 | priv->encr_tx_key_index = key_index; | 2122 | priv->encr_tx_key_index = key_index; |
2077 | 2123 | ||
@@ -2185,7 +2231,8 @@ static void rndis_wlan_do_link_up_work(struct usbnet *usbdev) | |||
2185 | if (ret < 0) | 2231 | if (ret < 0) |
2186 | memset(bssid, 0, sizeof(bssid)); | 2232 | memset(bssid, 0, sizeof(bssid)); |
2187 | 2233 | ||
2188 | devdbg(usbdev, "link up work: [%pM] %s", bssid, roamed ? "roamed" : ""); | 2234 | netdev_dbg(usbdev->net, "link up work: [%pM]%s\n", |
2235 | bssid, roamed ? " roamed" : ""); | ||
2189 | 2236 | ||
2190 | /* Internal bss list in device always contains at least the currently | 2237 | /* Internal bss list in device always contains at least the currently |
2191 | * connected bss and we can get it to cfg80211 with | 2238 | * connected bss and we can get it to cfg80211 with |
@@ -2267,8 +2314,8 @@ static void rndis_wlan_auth_indication(struct usbnet *usbdev, | |||
2267 | /* must have at least one array entry */ | 2314 | /* must have at least one array entry */ |
2268 | if (len < offsetof(struct ndis_80211_status_indication, u) + | 2315 | if (len < offsetof(struct ndis_80211_status_indication, u) + |
2269 | sizeof(struct ndis_80211_auth_request)) { | 2316 | sizeof(struct ndis_80211_auth_request)) { |
2270 | devinfo(usbdev, "authentication indication: " | 2317 | netdev_info(usbdev->net, "authentication indication: too short message (%i)\n", |
2271 | "too short message (%i)", len); | 2318 | len); |
2272 | return; | 2319 | return; |
2273 | } | 2320 | } |
2274 | 2321 | ||
@@ -2295,8 +2342,8 @@ static void rndis_wlan_auth_indication(struct usbnet *usbdev, | |||
2295 | type = "group_error"; | 2342 | type = "group_error"; |
2296 | } | 2343 | } |
2297 | 2344 | ||
2298 | devinfo(usbdev, "authentication indication: %s (0x%08x)", type, | 2345 | netdev_info(usbdev->net, "authentication indication: %s (0x%08x)\n", |
2299 | le32_to_cpu(auth_req->flags)); | 2346 | type, le32_to_cpu(auth_req->flags)); |
2300 | 2347 | ||
2301 | if (pairwise_error) { | 2348 | if (pairwise_error) { |
2302 | key_type = NL80211_KEYTYPE_PAIRWISE; | 2349 | key_type = NL80211_KEYTYPE_PAIRWISE; |
@@ -2332,8 +2379,8 @@ static void rndis_wlan_pmkid_cand_list_indication(struct usbnet *usbdev, | |||
2332 | 2379 | ||
2333 | if (len < offsetof(struct ndis_80211_status_indication, u) + | 2380 | if (len < offsetof(struct ndis_80211_status_indication, u) + |
2334 | sizeof(struct ndis_80211_pmkid_cand_list)) { | 2381 | sizeof(struct ndis_80211_pmkid_cand_list)) { |
2335 | devinfo(usbdev, "pmkid candidate list indication: " | 2382 | netdev_info(usbdev->net, "pmkid candidate list indication: too short message (%i)\n", |
2336 | "too short message (%i)", len); | 2383 | len); |
2337 | return; | 2384 | return; |
2338 | } | 2385 | } |
2339 | 2386 | ||
@@ -2343,18 +2390,16 @@ static void rndis_wlan_pmkid_cand_list_indication(struct usbnet *usbdev, | |||
2343 | offsetof(struct ndis_80211_status_indication, u); | 2390 | offsetof(struct ndis_80211_status_indication, u); |
2344 | 2391 | ||
2345 | if (len < expected_len) { | 2392 | if (len < expected_len) { |
2346 | devinfo(usbdev, "pmkid candidate list indication: " | 2393 | netdev_info(usbdev->net, "pmkid candidate list indication: list larger than buffer (%i < %i)\n", |
2347 | "list larger than buffer (%i < %i)", | 2394 | len, expected_len); |
2348 | len, expected_len); | ||
2349 | return; | 2395 | return; |
2350 | } | 2396 | } |
2351 | 2397 | ||
2352 | cand_list = &indication->u.cand_list; | 2398 | cand_list = &indication->u.cand_list; |
2353 | 2399 | ||
2354 | devinfo(usbdev, "pmkid candidate list indication: " | 2400 | netdev_info(usbdev->net, "pmkid candidate list indication: version %i, candidates %i\n", |
2355 | "version %i, candidates %i", | 2401 | le32_to_cpu(cand_list->version), |
2356 | le32_to_cpu(cand_list->version), | 2402 | le32_to_cpu(cand_list->num_candidates)); |
2357 | le32_to_cpu(cand_list->num_candidates)); | ||
2358 | 2403 | ||
2359 | if (le32_to_cpu(cand_list->version) != 1) | 2404 | if (le32_to_cpu(cand_list->version) != 1) |
2360 | return; | 2405 | return; |
@@ -2363,8 +2408,8 @@ static void rndis_wlan_pmkid_cand_list_indication(struct usbnet *usbdev, | |||
2363 | struct ndis_80211_pmkid_candidate *cand = | 2408 | struct ndis_80211_pmkid_candidate *cand = |
2364 | &cand_list->candidate_list[i]; | 2409 | &cand_list->candidate_list[i]; |
2365 | 2410 | ||
2366 | devdbg(usbdev, "cand[%i]: flags: 0x%08x, bssid: %pM", | 2411 | netdev_dbg(usbdev->net, "cand[%i]: flags: 0x%08x, bssid: %pM\n", |
2367 | i, le32_to_cpu(cand->flags), cand->bssid); | 2412 | i, le32_to_cpu(cand->flags), cand->bssid); |
2368 | 2413 | ||
2369 | #if 0 | 2414 | #if 0 |
2370 | struct iw_pmkid_cand pcand; | 2415 | struct iw_pmkid_cand pcand; |
@@ -2395,15 +2440,14 @@ static void rndis_wlan_media_specific_indication(struct usbnet *usbdev, | |||
2395 | len = le32_to_cpu(msg->length); | 2440 | len = le32_to_cpu(msg->length); |
2396 | 2441 | ||
2397 | if (len < 8) { | 2442 | if (len < 8) { |
2398 | devinfo(usbdev, "media specific indication, " | 2443 | netdev_info(usbdev->net, "media specific indication, ignore too short message (%i < 8)\n", |
2399 | "ignore too short message (%i < 8)", len); | 2444 | len); |
2400 | return; | 2445 | return; |
2401 | } | 2446 | } |
2402 | 2447 | ||
2403 | if (offset + len > buflen) { | 2448 | if (offset + len > buflen) { |
2404 | devinfo(usbdev, "media specific indication, " | 2449 | netdev_info(usbdev->net, "media specific indication, too large to fit to buffer (%i > %i)\n", |
2405 | "too large to fit to buffer (%i > %i)", | 2450 | offset + len, buflen); |
2406 | offset + len, buflen); | ||
2407 | return; | 2451 | return; |
2408 | } | 2452 | } |
2409 | 2453 | ||
@@ -2411,13 +2455,13 @@ static void rndis_wlan_media_specific_indication(struct usbnet *usbdev, | |||
2411 | 2455 | ||
2412 | switch (le32_to_cpu(indication->status_type)) { | 2456 | switch (le32_to_cpu(indication->status_type)) { |
2413 | case NDIS_80211_STATUSTYPE_RADIOSTATE: | 2457 | case NDIS_80211_STATUSTYPE_RADIOSTATE: |
2414 | devinfo(usbdev, "radio state indication: %i", | 2458 | netdev_info(usbdev->net, "radio state indication: %i\n", |
2415 | le32_to_cpu(indication->u.radio_status)); | 2459 | le32_to_cpu(indication->u.radio_status)); |
2416 | return; | 2460 | return; |
2417 | 2461 | ||
2418 | case NDIS_80211_STATUSTYPE_MEDIASTREAMMODE: | 2462 | case NDIS_80211_STATUSTYPE_MEDIASTREAMMODE: |
2419 | devinfo(usbdev, "media stream mode indication: %i", | 2463 | netdev_info(usbdev->net, "media stream mode indication: %i\n", |
2420 | le32_to_cpu(indication->u.media_stream_mode)); | 2464 | le32_to_cpu(indication->u.media_stream_mode)); |
2421 | return; | 2465 | return; |
2422 | 2466 | ||
2423 | case NDIS_80211_STATUSTYPE_AUTHENTICATION: | 2467 | case NDIS_80211_STATUSTYPE_AUTHENTICATION: |
@@ -2429,9 +2473,8 @@ static void rndis_wlan_media_specific_indication(struct usbnet *usbdev, | |||
2429 | return; | 2473 | return; |
2430 | 2474 | ||
2431 | default: | 2475 | default: |
2432 | devinfo(usbdev, "media specific indication: " | 2476 | netdev_info(usbdev->net, "media specific indication: unknown status type 0x%08x\n", |
2433 | "unknown status type 0x%08x", | 2477 | le32_to_cpu(indication->status_type)); |
2434 | le32_to_cpu(indication->status_type)); | ||
2435 | } | 2478 | } |
2436 | } | 2479 | } |
2437 | 2480 | ||
@@ -2448,14 +2491,13 @@ static void rndis_wlan_indication(struct usbnet *usbdev, void *ind, int buflen) | |||
2448 | * and userspace to think that device is | 2491 | * and userspace to think that device is |
2449 | * roaming/reassociating when it isn't. | 2492 | * roaming/reassociating when it isn't. |
2450 | */ | 2493 | */ |
2451 | devdbg(usbdev, "ignored OID_802_11_ADD_KEY triggered " | 2494 | netdev_dbg(usbdev->net, "ignored OID_802_11_ADD_KEY triggered 'media connect'\n"); |
2452 | "'media connect'"); | ||
2453 | return; | 2495 | return; |
2454 | } | 2496 | } |
2455 | 2497 | ||
2456 | usbnet_pause_rx(usbdev); | 2498 | usbnet_pause_rx(usbdev); |
2457 | 2499 | ||
2458 | devinfo(usbdev, "media connect"); | 2500 | netdev_info(usbdev->net, "media connect\n"); |
2459 | 2501 | ||
2460 | /* queue work to avoid recursive calls into rndis_command */ | 2502 | /* queue work to avoid recursive calls into rndis_command */ |
2461 | set_bit(WORK_LINK_UP, &priv->work_pending); | 2503 | set_bit(WORK_LINK_UP, &priv->work_pending); |
@@ -2463,7 +2505,7 @@ static void rndis_wlan_indication(struct usbnet *usbdev, void *ind, int buflen) | |||
2463 | break; | 2505 | break; |
2464 | 2506 | ||
2465 | case RNDIS_STATUS_MEDIA_DISCONNECT: | 2507 | case RNDIS_STATUS_MEDIA_DISCONNECT: |
2466 | devinfo(usbdev, "media disconnect"); | 2508 | netdev_info(usbdev->net, "media disconnect\n"); |
2467 | 2509 | ||
2468 | /* queue work to avoid recursive calls into rndis_command */ | 2510 | /* queue work to avoid recursive calls into rndis_command */ |
2469 | set_bit(WORK_LINK_DOWN, &priv->work_pending); | 2511 | set_bit(WORK_LINK_DOWN, &priv->work_pending); |
@@ -2475,8 +2517,8 @@ static void rndis_wlan_indication(struct usbnet *usbdev, void *ind, int buflen) | |||
2475 | break; | 2517 | break; |
2476 | 2518 | ||
2477 | default: | 2519 | default: |
2478 | devinfo(usbdev, "indication: 0x%08x", | 2520 | netdev_info(usbdev->net, "indication: 0x%08x\n", |
2479 | le32_to_cpu(msg->status)); | 2521 | le32_to_cpu(msg->status)); |
2480 | break; | 2522 | break; |
2481 | } | 2523 | } |
2482 | } | 2524 | } |
@@ -2541,13 +2583,13 @@ static void rndis_device_poller(struct work_struct *work) | |||
2541 | if (ret == 0) | 2583 | if (ret == 0) |
2542 | priv->last_qual = level_to_qual(le32_to_cpu(rssi)); | 2584 | priv->last_qual = level_to_qual(le32_to_cpu(rssi)); |
2543 | 2585 | ||
2544 | devdbg(usbdev, "dev-poller: OID_802_11_RSSI -> %d, rssi:%d, qual: %d", | 2586 | netdev_dbg(usbdev->net, "dev-poller: OID_802_11_RSSI -> %d, rssi:%d, qual: %d\n", |
2545 | ret, le32_to_cpu(rssi), level_to_qual(le32_to_cpu(rssi))); | 2587 | ret, le32_to_cpu(rssi), level_to_qual(le32_to_cpu(rssi))); |
2546 | 2588 | ||
2547 | /* Workaround transfer stalls on poor quality links. | 2589 | /* Workaround transfer stalls on poor quality links. |
2548 | * TODO: find right way to fix these stalls (as stalls do not happen | 2590 | * TODO: find right way to fix these stalls (as stalls do not happen |
2549 | * with ndiswrapper/windows driver). */ | 2591 | * with ndiswrapper/windows driver). */ |
2550 | if (priv->last_qual <= 25) { | 2592 | if (priv->param_workaround_interval > 0 && priv->last_qual <= 25) { |
2551 | /* Decrease stats worker interval to catch stalls. | 2593 | /* Decrease stats worker interval to catch stalls. |
2552 | * faster. Faster than 400-500ms causes packet loss, | 2594 | * faster. Faster than 400-500ms causes packet loss, |
2553 | * Slower doesn't catch stalls fast enough. | 2595 | * Slower doesn't catch stalls fast enough. |
@@ -2591,23 +2633,9 @@ end: | |||
2591 | /* | 2633 | /* |
2592 | * driver/device initialization | 2634 | * driver/device initialization |
2593 | */ | 2635 | */ |
2594 | static int bcm4320a_early_init(struct usbnet *usbdev) | 2636 | static void rndis_copy_module_params(struct usbnet *usbdev) |
2595 | { | ||
2596 | /* bcm4320a doesn't handle configuration parameters well. Try | ||
2597 | * set any and you get partially zeroed mac and broken device. | ||
2598 | */ | ||
2599 | |||
2600 | return 0; | ||
2601 | } | ||
2602 | |||
2603 | static int bcm4320b_early_init(struct usbnet *usbdev) | ||
2604 | { | 2637 | { |
2605 | struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); | 2638 | struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); |
2606 | char buf[8]; | ||
2607 | |||
2608 | /* Early initialization settings, setting these won't have effect | ||
2609 | * if called after generic_rndis_bind(). | ||
2610 | */ | ||
2611 | 2639 | ||
2612 | priv->param_country[0] = modparam_country[0]; | 2640 | priv->param_country[0] = modparam_country[0]; |
2613 | priv->param_country[1] = modparam_country[1]; | 2641 | priv->param_country[1] = modparam_country[1]; |
@@ -2649,6 +2677,32 @@ static int bcm4320b_early_init(struct usbnet *usbdev) | |||
2649 | priv->param_workaround_interval = 500; | 2677 | priv->param_workaround_interval = 500; |
2650 | else | 2678 | else |
2651 | priv->param_workaround_interval = modparam_workaround_interval; | 2679 | priv->param_workaround_interval = modparam_workaround_interval; |
2680 | } | ||
2681 | |||
2682 | static int bcm4320a_early_init(struct usbnet *usbdev) | ||
2683 | { | ||
2684 | /* copy module parameters for bcm4320a so that iwconfig reports txpower | ||
2685 | * and workaround parameter is copied to private structure correctly. | ||
2686 | */ | ||
2687 | rndis_copy_module_params(usbdev); | ||
2688 | |||
2689 | /* bcm4320a doesn't handle configuration parameters well. Try | ||
2690 | * set any and you get partially zeroed mac and broken device. | ||
2691 | */ | ||
2692 | |||
2693 | return 0; | ||
2694 | } | ||
2695 | |||
2696 | static int bcm4320b_early_init(struct usbnet *usbdev) | ||
2697 | { | ||
2698 | struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); | ||
2699 | char buf[8]; | ||
2700 | |||
2701 | rndis_copy_module_params(usbdev); | ||
2702 | |||
2703 | /* Early initialization settings, setting these won't have effect | ||
2704 | * if called after generic_rndis_bind(). | ||
2705 | */ | ||
2652 | 2706 | ||
2653 | rndis_set_config_parameter_str(usbdev, "Country", priv->param_country); | 2707 | rndis_set_config_parameter_str(usbdev, "Country", priv->param_country); |
2654 | rndis_set_config_parameter_str(usbdev, "FrameBursting", | 2708 | rndis_set_config_parameter_str(usbdev, "FrameBursting", |
@@ -2823,11 +2877,11 @@ static int rndis_wlan_reset(struct usbnet *usbdev) | |||
2823 | struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); | 2877 | struct rndis_wlan_private *priv = get_rndis_wlan_priv(usbdev); |
2824 | int retval; | 2878 | int retval; |
2825 | 2879 | ||
2826 | devdbg(usbdev, "rndis_wlan_reset"); | 2880 | netdev_dbg(usbdev->net, "%s()\n", __func__); |
2827 | 2881 | ||
2828 | retval = rndis_reset(usbdev); | 2882 | retval = rndis_reset(usbdev); |
2829 | if (retval) | 2883 | if (retval) |
2830 | devwarn(usbdev, "rndis_reset() failed: %d", retval); | 2884 | netdev_warn(usbdev->net, "rndis_reset failed: %d\n", retval); |
2831 | 2885 | ||
2832 | /* rndis_reset cleared multicast list, so restore here. | 2886 | /* rndis_reset cleared multicast list, so restore here. |
2833 | (set_multicast_list() also turns on current packet filter) */ | 2887 | (set_multicast_list() also turns on current packet filter) */ |
@@ -2845,7 +2899,7 @@ static int rndis_wlan_stop(struct usbnet *usbdev) | |||
2845 | int retval; | 2899 | int retval; |
2846 | __le32 filter; | 2900 | __le32 filter; |
2847 | 2901 | ||
2848 | devdbg(usbdev, "rndis_wlan_stop"); | 2902 | netdev_dbg(usbdev->net, "%s()\n", __func__); |
2849 | 2903 | ||
2850 | retval = disassociate(usbdev, false); | 2904 | retval = disassociate(usbdev, false); |
2851 | 2905 | ||