aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2009-05-22 20:05:25 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-06-03 14:05:09 -0400
commitbe0d76e48f6cc1f8b01eeb5efbeea41f2efdab49 (patch)
tree763838ac9d81a823e83e929dcbaf93ac4a69c6ee /drivers/net/wireless/libertas
parent75b6a61a47353fd404277ae3f2dda03af96a8c1a (diff)
libertas: convert CMD_802_11_AUTHENTICATE to a direct command
And fix up setting authentication suite for v9+ firmware too. Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas')
-rw-r--r--drivers/net/wireless/libertas/assoc.c134
-rw-r--r--drivers/net/wireless/libertas/cmd.c7
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c1
-rw-r--r--drivers/net/wireless/libertas/hostcmd.h5
-rw-r--r--drivers/net/wireless/libertas/types.h7
5 files changed, 86 insertions, 68 deletions
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index 75c67c9d1178..d004170ec417 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -19,8 +19,9 @@ static const u8 bssid_any[ETH_ALEN] __attribute__ ((aligned (2))) =
19static const u8 bssid_off[ETH_ALEN] __attribute__ ((aligned (2))) = 19static const u8 bssid_off[ETH_ALEN] __attribute__ ((aligned (2))) =
20 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 20 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
21 21
22/* The firmware needs certain bits masked out of the beacon-derviced capability 22/* The firmware needs the following bits masked out of the beacon-derived
23 * field when associating/joining to BSSs. 23 * capability field when associating/joining to a BSS:
24 * 9 (QoS), 11 (APSD), 12 (unused), 14 (unused), 15 (unused)
24 */ 25 */
25#define CAPINFO_MASK (~(0xda00)) 26#define CAPINFO_MASK (~(0xda00))
26 27
@@ -102,6 +103,52 @@ static void lbs_set_basic_rate_flags(u8 *rates, size_t len)
102} 103}
103 104
104 105
106static u8 iw_auth_to_ieee_auth(u8 auth)
107{
108 if (auth == IW_AUTH_ALG_OPEN_SYSTEM)
109 return 0x00;
110 else if (auth == IW_AUTH_ALG_SHARED_KEY)
111 return 0x01;
112 else if (auth == IW_AUTH_ALG_LEAP)
113 return 0x80;
114
115 lbs_deb_join("%s: invalid auth alg 0x%X\n", __func__, auth);
116 return 0;
117}
118
119/**
120 * @brief This function prepares the authenticate command. AUTHENTICATE only
121 * sets the authentication suite for future associations, as the firmware
122 * handles authentication internally during the ASSOCIATE command.
123 *
124 * @param priv A pointer to struct lbs_private structure
125 * @param bssid The peer BSSID with which to authenticate
126 * @param auth The authentication mode to use (from wireless.h)
127 *
128 * @return 0 or -1
129 */
130static int lbs_set_authentication(struct lbs_private *priv, u8 bssid[6], u8 auth)
131{
132 struct cmd_ds_802_11_authenticate cmd;
133 int ret = -1;
134 DECLARE_MAC_BUF(mac);
135
136 lbs_deb_enter(LBS_DEB_JOIN);
137
138 cmd.hdr.size = cpu_to_le16(sizeof(cmd));
139 memcpy(cmd.bssid, bssid, ETH_ALEN);
140
141 cmd.authtype = iw_auth_to_ieee_auth(auth);
142
143 lbs_deb_join("AUTH_CMD: BSSID %s, auth 0x%x\n",
144 print_mac(mac, bssid), cmd.authtype);
145
146 ret = lbs_cmd_with_response(priv, CMD_802_11_AUTHENTICATE, &cmd);
147
148 lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
149 return ret;
150}
151
105/** 152/**
106 * @brief Associate to a specific BSS discovered in a scan 153 * @brief Associate to a specific BSS discovered in a scan
107 * 154 *
@@ -118,11 +165,15 @@ static int lbs_associate(struct lbs_private *priv,
118 165
119 lbs_deb_enter(LBS_DEB_ASSOC); 166 lbs_deb_enter(LBS_DEB_ASSOC);
120 167
121 ret = lbs_prepare_and_send_command(priv, CMD_802_11_AUTHENTICATE, 168 /* FW v9 and higher indicate authentication suites as a TLV in the
122 0, CMD_OPTION_WAITFORRSP, 169 * association command, not as a separate authentication command.
123 0, assoc_req->bss.bssid); 170 */
124 if (ret) 171 if (priv->fwrelease < 0x09000000) {
125 goto out; 172 ret = lbs_set_authentication(priv, assoc_req->bss.bssid,
173 priv->secinfo.auth_mode);
174 if (ret)
175 goto out;
176 }
126 177
127 /* Use short preamble only when both the BSS and firmware support it */ 178 /* Use short preamble only when both the BSS and firmware support it */
128 if ((priv->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) && 179 if ((priv->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) &&
@@ -1466,57 +1517,6 @@ struct assoc_request *lbs_get_association_request(struct lbs_private *priv)
1466 1517
1467 1518
1468/** 1519/**
1469 * @brief This function prepares command of authenticate.
1470 *
1471 * @param priv A pointer to struct lbs_private structure
1472 * @param cmd A pointer to cmd_ds_command structure
1473 * @param pdata_buf Void cast of pointer to a BSSID to authenticate with
1474 *
1475 * @return 0 or -1
1476 */
1477int lbs_cmd_80211_authenticate(struct lbs_private *priv,
1478 struct cmd_ds_command *cmd,
1479 void *pdata_buf)
1480{
1481 struct cmd_ds_802_11_authenticate *pauthenticate = &cmd->params.auth;
1482 int ret = -1;
1483 u8 *bssid = pdata_buf;
1484
1485 lbs_deb_enter(LBS_DEB_JOIN);
1486
1487 cmd->command = cpu_to_le16(CMD_802_11_AUTHENTICATE);
1488 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_authenticate)
1489 + S_DS_GEN);
1490
1491 /* translate auth mode to 802.11 defined wire value */
1492 switch (priv->secinfo.auth_mode) {
1493 case IW_AUTH_ALG_OPEN_SYSTEM:
1494 pauthenticate->authtype = 0x00;
1495 break;
1496 case IW_AUTH_ALG_SHARED_KEY:
1497 pauthenticate->authtype = 0x01;
1498 break;
1499 case IW_AUTH_ALG_LEAP:
1500 pauthenticate->authtype = 0x80;
1501 break;
1502 default:
1503 lbs_deb_join("AUTH_CMD: invalid auth alg 0x%X\n",
1504 priv->secinfo.auth_mode);
1505 goto out;
1506 }
1507
1508 memcpy(pauthenticate->macaddr, bssid, ETH_ALEN);
1509
1510 lbs_deb_join("AUTH_CMD: BSSID %pM, auth 0x%x\n",
1511 bssid, pauthenticate->authtype);
1512 ret = 0;
1513
1514out:
1515 lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
1516 return ret;
1517}
1518
1519/**
1520 * @brief Deauthenticate from a specific BSS 1520 * @brief Deauthenticate from a specific BSS
1521 * 1521 *
1522 * @param priv A pointer to struct lbs_private structure 1522 * @param priv A pointer to struct lbs_private structure
@@ -1557,12 +1557,13 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
1557 struct assoc_request *assoc_req = pdata_buf; 1557 struct assoc_request *assoc_req = pdata_buf;
1558 struct bss_descriptor *bss = &assoc_req->bss; 1558 struct bss_descriptor *bss = &assoc_req->bss;
1559 u8 *pos; 1559 u8 *pos;
1560 u16 tmpcap, tmplen; 1560 u16 tmpcap, tmplen, tmpauth;
1561 struct mrvl_ie_ssid_param_set *ssid; 1561 struct mrvl_ie_ssid_param_set *ssid;
1562 struct mrvl_ie_ds_param_set *ds; 1562 struct mrvl_ie_ds_param_set *ds;
1563 struct mrvl_ie_cf_param_set *cf; 1563 struct mrvl_ie_cf_param_set *cf;
1564 struct mrvl_ie_rates_param_set *rates; 1564 struct mrvl_ie_rates_param_set *rates;
1565 struct mrvl_ie_rsn_param_set *rsn; 1565 struct mrvl_ie_rsn_param_set *rsn;
1566 struct mrvl_ie_auth_type *auth;
1566 1567
1567 lbs_deb_enter(LBS_DEB_ASSOC); 1568 lbs_deb_enter(LBS_DEB_ASSOC);
1568 1569
@@ -1627,6 +1628,21 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
1627 */ 1628 */
1628 lbs_set_basic_rate_flags(rates->rates, tmplen); 1629 lbs_set_basic_rate_flags(rates->rates, tmplen);
1629 1630
1631 /* Firmware v9+ indicate authentication suites as a TLV */
1632 if (priv->fwrelease >= 0x09000000) {
1633 DECLARE_MAC_BUF(mac);
1634
1635 auth = (struct mrvl_ie_auth_type *) pos;
1636 auth->header.type = cpu_to_le16(TLV_TYPE_AUTH_TYPE);
1637 auth->header.len = cpu_to_le16(2);
1638 tmpauth = iw_auth_to_ieee_auth(priv->secinfo.auth_mode);
1639 auth->auth = cpu_to_le16(tmpauth);
1640 pos += sizeof(auth->header) + 2;
1641
1642 lbs_deb_join("AUTH_CMD: BSSID %s, auth 0x%x\n",
1643 print_mac(mac, bss->bssid), priv->secinfo.auth_mode);
1644 }
1645
1630 if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { 1646 if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) {
1631 rsn = (struct mrvl_ie_rsn_param_set *) pos; 1647 rsn = (struct mrvl_ie_rsn_param_set *) pos;
1632 /* WPA_IE or WPA2_IE */ 1648 /* WPA_IE or WPA2_IE */
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index ed079c1a34e6..bd740fc00f94 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1220,8 +1220,7 @@ static void lbs_submit_command(struct lbs_private *priv,
1220 command = le16_to_cpu(cmd->command); 1220 command = le16_to_cpu(cmd->command);
1221 1221
1222 /* These commands take longer */ 1222 /* These commands take longer */
1223 if (command == CMD_802_11_SCAN || command == CMD_802_11_ASSOCIATE || 1223 if (command == CMD_802_11_SCAN || command == CMD_802_11_ASSOCIATE)
1224 command == CMD_802_11_AUTHENTICATE)
1225 timeo = 5 * HZ; 1224 timeo = 5 * HZ;
1226 1225
1227 lbs_deb_cmd("DNLD_CMD: command 0x%04x, seq %d, size %d\n", 1226 lbs_deb_cmd("DNLD_CMD: command 0x%04x, seq %d, size %d\n",
@@ -1420,10 +1419,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
1420 ret = lbs_cmd_80211_associate(priv, cmdptr, pdata_buf); 1419 ret = lbs_cmd_80211_associate(priv, cmdptr, pdata_buf);
1421 break; 1420 break;
1422 1421
1423 case CMD_802_11_AUTHENTICATE:
1424 ret = lbs_cmd_80211_authenticate(priv, cmdptr, pdata_buf);
1425 break;
1426
1427 case CMD_MAC_REG_ACCESS: 1422 case CMD_MAC_REG_ACCESS:
1428 case CMD_BBP_REG_ACCESS: 1423 case CMD_BBP_REG_ACCESS:
1429 case CMD_RF_REG_ACCESS: 1424 case CMD_RF_REG_ACCESS:
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index bcf2a9756fb6..a830ecaf98de 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -225,7 +225,6 @@ static inline int handle_cmd_response(struct lbs_private *priv,
225 225
226 break; 226 break;
227 227
228 case CMD_RET(CMD_802_11_AUTHENTICATE):
229 case CMD_RET(CMD_802_11_BEACON_STOP): 228 case CMD_RET(CMD_802_11_BEACON_STOP):
230 break; 229 break;
231 230
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h
index 463ff977995c..4c930bd1b292 100644
--- a/drivers/net/wireless/libertas/hostcmd.h
+++ b/drivers/net/wireless/libertas/hostcmd.h
@@ -250,7 +250,9 @@ struct cmd_ds_gspi_bus_config {
250} __attribute__ ((packed)); 250} __attribute__ ((packed));
251 251
252struct cmd_ds_802_11_authenticate { 252struct cmd_ds_802_11_authenticate {
253 u8 macaddr[ETH_ALEN]; 253 struct cmd_header hdr;
254
255 u8 bssid[ETH_ALEN];
254 u8 authtype; 256 u8 authtype;
255 u8 reserved[10]; 257 u8 reserved[10];
256} __attribute__ ((packed)); 258} __attribute__ ((packed));
@@ -770,7 +772,6 @@ struct cmd_ds_command {
770 union { 772 union {
771 struct cmd_ds_802_11_ps_mode psmode; 773 struct cmd_ds_802_11_ps_mode psmode;
772 struct cmd_ds_802_11_associate associate; 774 struct cmd_ds_802_11_associate associate;
773 struct cmd_ds_802_11_authenticate auth;
774 struct cmd_ds_802_11_get_stat gstat; 775 struct cmd_ds_802_11_get_stat gstat;
775 struct cmd_ds_802_3_get_stat gstat_8023; 776 struct cmd_ds_802_3_get_stat gstat_8023;
776 struct cmd_ds_802_11_rf_antenna rant; 777 struct cmd_ds_802_11_rf_antenna rant;
diff --git a/drivers/net/wireless/libertas/types.h b/drivers/net/wireless/libertas/types.h
index 1055ecfa1cc8..4ad3bb6bc2c1 100644
--- a/drivers/net/wireless/libertas/types.h
+++ b/drivers/net/wireless/libertas/types.h
@@ -99,6 +99,7 @@ struct ieee_assoc_response {
99#define TLV_TYPE_TSFTIMESTAMP (PROPRIETARY_TLV_BASE_ID + 19) 99#define TLV_TYPE_TSFTIMESTAMP (PROPRIETARY_TLV_BASE_ID + 19)
100#define TLV_TYPE_RSSI_HIGH (PROPRIETARY_TLV_BASE_ID + 22) 100#define TLV_TYPE_RSSI_HIGH (PROPRIETARY_TLV_BASE_ID + 22)
101#define TLV_TYPE_SNR_HIGH (PROPRIETARY_TLV_BASE_ID + 23) 101#define TLV_TYPE_SNR_HIGH (PROPRIETARY_TLV_BASE_ID + 23)
102#define TLV_TYPE_AUTH_TYPE (PROPRIETARY_TLV_BASE_ID + 31)
102#define TLV_TYPE_MESH_ID (PROPRIETARY_TLV_BASE_ID + 37) 103#define TLV_TYPE_MESH_ID (PROPRIETARY_TLV_BASE_ID + 37)
103#define TLV_TYPE_OLD_MESH_ID (PROPRIETARY_TLV_BASE_ID + 291) 104#define TLV_TYPE_OLD_MESH_ID (PROPRIETARY_TLV_BASE_ID + 291)
104 105
@@ -177,6 +178,12 @@ struct mrvl_ie_tsf_timestamp {
177 __le64 tsftable[1]; 178 __le64 tsftable[1];
178} __attribute__ ((packed)); 179} __attribute__ ((packed));
179 180
181/* v9 and later firmware only */
182struct mrvl_ie_auth_type {
183 struct mrvl_ie_header header;
184 __le16 auth;
185} __attribute__ ((packed));
186
180/** Local Power capability */ 187/** Local Power capability */
181struct mrvl_ie_power_capability { 188struct mrvl_ie_power_capability {
182 struct mrvl_ie_header header; 189 struct mrvl_ie_header header;