* Re: [PATCH, v2] libertas: move association related commands into assoc.c
From: Holger Schurig @ 2009-10-19 12:33 UTC (permalink / raw)
To: linux-wireless; +Cc: John Linville, Dan Williams
In-Reply-To: <200910191315.33005.hs4233@mail.mn-solutions.de>
That's because the new cfg80211 implementation will provide cleaner
implementations.
No functional changes.
Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>
---
v2: move declaration of lbs_cmd_802_11_set_wep(), lbs_cmd_802_11_enable_rsn
and lbs_cmd_802_11_key_material into assoc.c as well
--- linux-wl.orig/drivers/net/wireless/libertas/assoc.c
+++ linux-wl/drivers/net/wireless/libertas/assoc.c
@@ -154,6 +154,396 @@
}
+int lbs_cmd_802_11_set_wep(struct lbs_private *priv, uint16_t cmd_action,
+ struct assoc_request *assoc)
+{
+ struct cmd_ds_802_11_set_wep cmd;
+ int ret = 0;
+
+ lbs_deb_enter(LBS_DEB_CMD);
+
+ memset(&cmd, 0, sizeof(cmd));
+ cmd.hdr.command = cpu_to_le16(CMD_802_11_SET_WEP);
+ cmd.hdr.size = cpu_to_le16(sizeof(cmd));
+
+ cmd.action = cpu_to_le16(cmd_action);
+
+ if (cmd_action == CMD_ACT_ADD) {
+ int i;
+
+ /* default tx key index */
+ cmd.keyindex = cpu_to_le16(assoc->wep_tx_keyidx &
+ CMD_WEP_KEY_INDEX_MASK);
+
+ /* Copy key types and material to host command structure */
+ for (i = 0; i < 4; i++) {
+ struct enc_key *pkey = &assoc->wep_keys[i];
+
+ switch (pkey->len) {
+ case KEY_LEN_WEP_40:
+ cmd.keytype[i] = CMD_TYPE_WEP_40_BIT;
+ memmove(cmd.keymaterial[i], pkey->key, pkey->len);
+ lbs_deb_cmd("SET_WEP: add key %d (40 bit)\n", i);
+ break;
+ case KEY_LEN_WEP_104:
+ cmd.keytype[i] = CMD_TYPE_WEP_104_BIT;
+ memmove(cmd.keymaterial[i], pkey->key, pkey->len);
+ lbs_deb_cmd("SET_WEP: add key %d (104 bit)\n", i);
+ break;
+ case 0:
+ break;
+ default:
+ lbs_deb_cmd("SET_WEP: invalid key %d, length %d\n",
+ i, pkey->len);
+ ret = -1;
+ goto done;
+ break;
+ }
+ }
+ } else if (cmd_action == CMD_ACT_REMOVE) {
+ /* ACT_REMOVE clears _all_ WEP keys */
+
+ /* default tx key index */
+ cmd.keyindex = cpu_to_le16(priv->wep_tx_keyidx &
+ CMD_WEP_KEY_INDEX_MASK);
+ lbs_deb_cmd("SET_WEP: remove key %d\n", priv->wep_tx_keyidx);
+ }
+
+ ret = lbs_cmd_with_response(priv, CMD_802_11_SET_WEP, &cmd);
+done:
+ lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
+ return ret;
+}
+
+int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv, uint16_t cmd_action,
+ uint16_t *enable)
+{
+ struct cmd_ds_802_11_enable_rsn cmd;
+ int ret;
+
+ lbs_deb_enter(LBS_DEB_CMD);
+
+ cmd.hdr.size = cpu_to_le16(sizeof(cmd));
+ cmd.action = cpu_to_le16(cmd_action);
+
+ if (cmd_action == CMD_ACT_GET)
+ cmd.enable = 0;
+ else {
+ if (*enable)
+ cmd.enable = cpu_to_le16(CMD_ENABLE_RSN);
+ else
+ cmd.enable = cpu_to_le16(CMD_DISABLE_RSN);
+ lbs_deb_cmd("ENABLE_RSN: %d\n", *enable);
+ }
+
+ ret = lbs_cmd_with_response(priv, CMD_802_11_ENABLE_RSN, &cmd);
+ if (!ret && cmd_action == CMD_ACT_GET)
+ *enable = le16_to_cpu(cmd.enable);
+
+ lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
+ return ret;
+}
+
+static void set_one_wpa_key(struct MrvlIEtype_keyParamSet *keyparam,
+ struct enc_key *key)
+{
+ lbs_deb_enter(LBS_DEB_CMD);
+
+ if (key->flags & KEY_INFO_WPA_ENABLED)
+ keyparam->keyinfo |= cpu_to_le16(KEY_INFO_WPA_ENABLED);
+ if (key->flags & KEY_INFO_WPA_UNICAST)
+ keyparam->keyinfo |= cpu_to_le16(KEY_INFO_WPA_UNICAST);
+ if (key->flags & KEY_INFO_WPA_MCAST)
+ keyparam->keyinfo |= cpu_to_le16(KEY_INFO_WPA_MCAST);
+
+ keyparam->type = cpu_to_le16(TLV_TYPE_KEY_MATERIAL);
+ keyparam->keytypeid = cpu_to_le16(key->type);
+ keyparam->keylen = cpu_to_le16(key->len);
+ memcpy(keyparam->key, key->key, key->len);
+
+ /* Length field doesn't include the {type,length} header */
+ keyparam->length = cpu_to_le16(sizeof(*keyparam) - 4);
+ lbs_deb_leave(LBS_DEB_CMD);
+}
+
+int lbs_cmd_802_11_key_material(struct lbs_private *priv, uint16_t cmd_action,
+ struct assoc_request *assoc)
+{
+ struct cmd_ds_802_11_key_material cmd;
+ int ret = 0;
+ int index = 0;
+
+ lbs_deb_enter(LBS_DEB_CMD);
+
+ cmd.action = cpu_to_le16(cmd_action);
+ cmd.hdr.size = cpu_to_le16(sizeof(cmd));
+
+ if (cmd_action == CMD_ACT_GET) {
+ cmd.hdr.size = cpu_to_le16(S_DS_GEN + 2);
+ } else {
+ memset(cmd.keyParamSet, 0, sizeof(cmd.keyParamSet));
+
+ if (test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc->flags)) {
+ set_one_wpa_key(&cmd.keyParamSet[index],
+ &assoc->wpa_unicast_key);
+ index++;
+ }
+
+ if (test_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc->flags)) {
+ set_one_wpa_key(&cmd.keyParamSet[index],
+ &assoc->wpa_mcast_key);
+ index++;
+ }
+
+ /* The common header and as many keys as we included */
+ cmd.hdr.size = cpu_to_le16(offsetof(typeof(cmd),
+ keyParamSet[index]));
+ }
+ ret = lbs_cmd_with_response(priv, CMD_802_11_KEY_MATERIAL, &cmd);
+ /* Copy the returned key to driver private data */
+ if (!ret && cmd_action == CMD_ACT_GET) {
+ void *buf_ptr = cmd.keyParamSet;
+ void *resp_end = &(&cmd)[1];
+
+ while (buf_ptr < resp_end) {
+ struct MrvlIEtype_keyParamSet *keyparam = buf_ptr;
+ struct enc_key *key;
+ uint16_t param_set_len = le16_to_cpu(keyparam->length);
+ uint16_t key_len = le16_to_cpu(keyparam->keylen);
+ uint16_t key_flags = le16_to_cpu(keyparam->keyinfo);
+ uint16_t key_type = le16_to_cpu(keyparam->keytypeid);
+ void *end;
+
+ end = (void *)keyparam + sizeof(keyparam->type)
+ + sizeof(keyparam->length) + param_set_len;
+
+ /* Make sure we don't access past the end of the IEs */
+ if (end > resp_end)
+ break;
+
+ if (key_flags & KEY_INFO_WPA_UNICAST)
+ key = &priv->wpa_unicast_key;
+ else if (key_flags & KEY_INFO_WPA_MCAST)
+ key = &priv->wpa_mcast_key;
+ else
+ break;
+
+ /* Copy returned key into driver */
+ memset(key, 0, sizeof(struct enc_key));
+ if (key_len > sizeof(key->key))
+ break;
+ key->type = key_type;
+ key->flags = key_flags;
+ key->len = key_len;
+ memcpy(key->key, keyparam->key, key->len);
+
+ buf_ptr = end + 1;
+ }
+ }
+
+ lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
+ return ret;
+}
+
+static __le16 lbs_rate_to_fw_bitmap(int rate, int lower_rates_ok)
+{
+/* Bit Rate
+* 15:13 Reserved
+* 12 54 Mbps
+* 11 48 Mbps
+* 10 36 Mbps
+* 9 24 Mbps
+* 8 18 Mbps
+* 7 12 Mbps
+* 6 9 Mbps
+* 5 6 Mbps
+* 4 Reserved
+* 3 11 Mbps
+* 2 5.5 Mbps
+* 1 2 Mbps
+* 0 1 Mbps
+**/
+
+ uint16_t ratemask;
+ int i = lbs_data_rate_to_fw_index(rate);
+ if (lower_rates_ok)
+ ratemask = (0x1fef >> (12 - i));
+ else
+ ratemask = (1 << i);
+ return cpu_to_le16(ratemask);
+}
+
+int lbs_cmd_802_11_rate_adapt_rateset(struct lbs_private *priv,
+ uint16_t cmd_action)
+{
+ struct cmd_ds_802_11_rate_adapt_rateset cmd;
+ int ret;
+
+ lbs_deb_enter(LBS_DEB_CMD);
+
+ if (!priv->cur_rate && !priv->enablehwauto)
+ return -EINVAL;
+
+ cmd.hdr.size = cpu_to_le16(sizeof(cmd));
+
+ cmd.action = cpu_to_le16(cmd_action);
+ cmd.enablehwauto = cpu_to_le16(priv->enablehwauto);
+ cmd.bitmap = lbs_rate_to_fw_bitmap(priv->cur_rate, priv->enablehwauto);
+ ret = lbs_cmd_with_response(priv, CMD_802_11_RATE_ADAPT_RATESET, &cmd);
+ if (!ret && cmd_action == CMD_ACT_GET) {
+ priv->ratebitmap = le16_to_cpu(cmd.bitmap);
+ priv->enablehwauto = le16_to_cpu(cmd.enablehwauto);
+ }
+
+ lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
+ return ret;
+}
+
+/**
+ * @brief Set the data rate
+ *
+ * @param priv A pointer to struct lbs_private structure
+ * @param rate The desired data rate, or 0 to clear a locked rate
+ *
+ * @return 0 on success, error on failure
+ */
+int lbs_set_data_rate(struct lbs_private *priv, u8 rate)
+{
+ struct cmd_ds_802_11_data_rate cmd;
+ int ret = 0;
+
+ lbs_deb_enter(LBS_DEB_CMD);
+
+ memset(&cmd, 0, sizeof(cmd));
+ cmd.hdr.size = cpu_to_le16(sizeof(cmd));
+
+ if (rate > 0) {
+ cmd.action = cpu_to_le16(CMD_ACT_SET_TX_FIX_RATE);
+ cmd.rates[0] = lbs_data_rate_to_fw_index(rate);
+ if (cmd.rates[0] == 0) {
+ lbs_deb_cmd("DATA_RATE: invalid requested rate of"
+ " 0x%02X\n", rate);
+ ret = 0;
+ goto out;
+ }
+ lbs_deb_cmd("DATA_RATE: set fixed 0x%02X\n", cmd.rates[0]);
+ } else {
+ cmd.action = cpu_to_le16(CMD_ACT_SET_TX_AUTO);
+ lbs_deb_cmd("DATA_RATE: setting auto\n");
+ }
+
+ ret = lbs_cmd_with_response(priv, CMD_802_11_DATA_RATE, &cmd);
+ if (ret)
+ goto out;
+
+ lbs_deb_hex(LBS_DEB_CMD, "DATA_RATE_RESP", (u8 *) &cmd, sizeof(cmd));
+
+ /* FIXME: get actual rates FW can do if this command actually returns
+ * all data rates supported.
+ */
+ priv->cur_rate = lbs_fw_index_to_data_rate(cmd.rates[0]);
+ lbs_deb_cmd("DATA_RATE: current rate is 0x%02x\n", priv->cur_rate);
+
+out:
+ lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
+ return ret;
+}
+
+
+int lbs_cmd_802_11_rssi(struct lbs_private *priv,
+ struct cmd_ds_command *cmd)
+{
+
+ lbs_deb_enter(LBS_DEB_CMD);
+ cmd->command = cpu_to_le16(CMD_802_11_RSSI);
+ cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rssi) + S_DS_GEN);
+ cmd->params.rssi.N = cpu_to_le16(DEFAULT_BCN_AVG_FACTOR);
+
+ /* reset Beacon SNR/NF/RSSI values */
+ priv->SNR[TYPE_BEACON][TYPE_NOAVG] = 0;
+ priv->SNR[TYPE_BEACON][TYPE_AVG] = 0;
+ priv->NF[TYPE_BEACON][TYPE_NOAVG] = 0;
+ priv->NF[TYPE_BEACON][TYPE_AVG] = 0;
+ priv->RSSI[TYPE_BEACON][TYPE_NOAVG] = 0;
+ priv->RSSI[TYPE_BEACON][TYPE_AVG] = 0;
+
+ lbs_deb_leave(LBS_DEB_CMD);
+ return 0;
+}
+
+int lbs_ret_802_11_rssi(struct lbs_private *priv,
+ struct cmd_ds_command *resp)
+{
+ struct cmd_ds_802_11_rssi_rsp *rssirsp = &resp->params.rssirsp;
+
+ lbs_deb_enter(LBS_DEB_CMD);
+
+ /* store the non average value */
+ priv->SNR[TYPE_BEACON][TYPE_NOAVG] = get_unaligned_le16(&rssirsp->SNR);
+ priv->NF[TYPE_BEACON][TYPE_NOAVG] =
+ get_unaligned_le16(&rssirsp->noisefloor);
+
+ priv->SNR[TYPE_BEACON][TYPE_AVG] = get_unaligned_le16(&rssirsp->avgSNR);
+ priv->NF[TYPE_BEACON][TYPE_AVG] =
+ get_unaligned_le16(&rssirsp->avgnoisefloor);
+
+ priv->RSSI[TYPE_BEACON][TYPE_NOAVG] =
+ CAL_RSSI(priv->SNR[TYPE_BEACON][TYPE_NOAVG],
+ priv->NF[TYPE_BEACON][TYPE_NOAVG]);
+
+ priv->RSSI[TYPE_BEACON][TYPE_AVG] =
+ CAL_RSSI(priv->SNR[TYPE_BEACON][TYPE_AVG] / AVG_SCALE,
+ priv->NF[TYPE_BEACON][TYPE_AVG] / AVG_SCALE);
+
+ lbs_deb_cmd("RSSI: beacon %d, avg %d\n",
+ priv->RSSI[TYPE_BEACON][TYPE_NOAVG],
+ priv->RSSI[TYPE_BEACON][TYPE_AVG]);
+
+ lbs_deb_leave(LBS_DEB_CMD);
+ return 0;
+}
+
+
+int lbs_cmd_bcn_ctrl(struct lbs_private *priv,
+ struct cmd_ds_command *cmd,
+ u16 cmd_action)
+{
+ struct cmd_ds_802_11_beacon_control
+ *bcn_ctrl = &cmd->params.bcn_ctrl;
+
+ lbs_deb_enter(LBS_DEB_CMD);
+ cmd->size =
+ cpu_to_le16(sizeof(struct cmd_ds_802_11_beacon_control)
+ + S_DS_GEN);
+ cmd->command = cpu_to_le16(CMD_802_11_BEACON_CTRL);
+
+ bcn_ctrl->action = cpu_to_le16(cmd_action);
+ bcn_ctrl->beacon_enable = cpu_to_le16(priv->beacon_enable);
+ bcn_ctrl->beacon_period = cpu_to_le16(priv->beacon_period);
+
+ lbs_deb_leave(LBS_DEB_CMD);
+ return 0;
+}
+
+int lbs_ret_802_11_bcn_ctrl(struct lbs_private *priv,
+ struct cmd_ds_command *resp)
+{
+ struct cmd_ds_802_11_beacon_control *bcn_ctrl =
+ &resp->params.bcn_ctrl;
+
+ lbs_deb_enter(LBS_DEB_CMD);
+
+ if (bcn_ctrl->action == CMD_ACT_GET) {
+ priv->beacon_enable = (u8) le16_to_cpu(bcn_ctrl->beacon_enable);
+ priv->beacon_period = le16_to_cpu(bcn_ctrl->beacon_period);
+ }
+
+ lbs_deb_enter(LBS_DEB_CMD);
+ return 0;
+}
+
+
+
static int lbs_assoc_post(struct lbs_private *priv,
struct cmd_ds_802_11_associate_response *resp)
{
--- linux-wl.orig/drivers/net/wireless/libertas/assoc.h
+++ linux-wl/drivers/net/wireless/libertas/assoc.h
@@ -132,4 +132,24 @@
int lbs_cmd_80211_deauthenticate(struct lbs_private *priv,
u8 bssid[ETH_ALEN], u16 reason);
+int lbs_cmd_802_11_rssi(struct lbs_private *priv,
+ struct cmd_ds_command *cmd);
+int lbs_ret_802_11_rssi(struct lbs_private *priv,
+ struct cmd_ds_command *resp);
+
+int lbs_cmd_bcn_ctrl(struct lbs_private *priv,
+ struct cmd_ds_command *cmd,
+ u16 cmd_action);
+int lbs_ret_802_11_bcn_ctrl(struct lbs_private *priv,
+ struct cmd_ds_command *resp);
+
+int lbs_cmd_802_11_set_wep(struct lbs_private *priv, uint16_t cmd_action,
+ struct assoc_request *assoc);
+
+int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv, uint16_t cmd_action,
+ uint16_t *enable);
+
+int lbs_cmd_802_11_key_material(struct lbs_private *priv, uint16_t cmd_action,
+ struct assoc_request *assoc);
+
#endif /* _LBS_ASSOC_H */
--- linux-wl.orig/drivers/net/wireless/libertas/cmd.c
+++ linux-wl/drivers/net/wireless/libertas/cmd.c
@@ -365,197 +365,6 @@
return ret;
}
-int lbs_cmd_802_11_set_wep(struct lbs_private *priv, uint16_t cmd_action,
- struct assoc_request *assoc)
-{
- struct cmd_ds_802_11_set_wep cmd;
- int ret = 0;
-
- lbs_deb_enter(LBS_DEB_CMD);
-
- memset(&cmd, 0, sizeof(cmd));
- cmd.hdr.command = cpu_to_le16(CMD_802_11_SET_WEP);
- cmd.hdr.size = cpu_to_le16(sizeof(cmd));
-
- cmd.action = cpu_to_le16(cmd_action);
-
- if (cmd_action == CMD_ACT_ADD) {
- int i;
-
- /* default tx key index */
- cmd.keyindex = cpu_to_le16(assoc->wep_tx_keyidx &
- CMD_WEP_KEY_INDEX_MASK);
-
- /* Copy key types and material to host command structure */
- for (i = 0; i < 4; i++) {
- struct enc_key *pkey = &assoc->wep_keys[i];
-
- switch (pkey->len) {
- case KEY_LEN_WEP_40:
- cmd.keytype[i] = CMD_TYPE_WEP_40_BIT;
- memmove(cmd.keymaterial[i], pkey->key, pkey->len);
- lbs_deb_cmd("SET_WEP: add key %d (40 bit)\n", i);
- break;
- case KEY_LEN_WEP_104:
- cmd.keytype[i] = CMD_TYPE_WEP_104_BIT;
- memmove(cmd.keymaterial[i], pkey->key, pkey->len);
- lbs_deb_cmd("SET_WEP: add key %d (104 bit)\n", i);
- break;
- case 0:
- break;
- default:
- lbs_deb_cmd("SET_WEP: invalid key %d, length %d\n",
- i, pkey->len);
- ret = -1;
- goto done;
- break;
- }
- }
- } else if (cmd_action == CMD_ACT_REMOVE) {
- /* ACT_REMOVE clears _all_ WEP keys */
-
- /* default tx key index */
- cmd.keyindex = cpu_to_le16(priv->wep_tx_keyidx &
- CMD_WEP_KEY_INDEX_MASK);
- lbs_deb_cmd("SET_WEP: remove key %d\n", priv->wep_tx_keyidx);
- }
-
- ret = lbs_cmd_with_response(priv, CMD_802_11_SET_WEP, &cmd);
-done:
- lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
- return ret;
-}
-
-int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv, uint16_t cmd_action,
- uint16_t *enable)
-{
- struct cmd_ds_802_11_enable_rsn cmd;
- int ret;
-
- lbs_deb_enter(LBS_DEB_CMD);
-
- cmd.hdr.size = cpu_to_le16(sizeof(cmd));
- cmd.action = cpu_to_le16(cmd_action);
-
- if (cmd_action == CMD_ACT_GET)
- cmd.enable = 0;
- else {
- if (*enable)
- cmd.enable = cpu_to_le16(CMD_ENABLE_RSN);
- else
- cmd.enable = cpu_to_le16(CMD_DISABLE_RSN);
- lbs_deb_cmd("ENABLE_RSN: %d\n", *enable);
- }
-
- ret = lbs_cmd_with_response(priv, CMD_802_11_ENABLE_RSN, &cmd);
- if (!ret && cmd_action == CMD_ACT_GET)
- *enable = le16_to_cpu(cmd.enable);
-
- lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
- return ret;
-}
-
-static void set_one_wpa_key(struct MrvlIEtype_keyParamSet *keyparam,
- struct enc_key *key)
-{
- lbs_deb_enter(LBS_DEB_CMD);
-
- if (key->flags & KEY_INFO_WPA_ENABLED)
- keyparam->keyinfo |= cpu_to_le16(KEY_INFO_WPA_ENABLED);
- if (key->flags & KEY_INFO_WPA_UNICAST)
- keyparam->keyinfo |= cpu_to_le16(KEY_INFO_WPA_UNICAST);
- if (key->flags & KEY_INFO_WPA_MCAST)
- keyparam->keyinfo |= cpu_to_le16(KEY_INFO_WPA_MCAST);
-
- keyparam->type = cpu_to_le16(TLV_TYPE_KEY_MATERIAL);
- keyparam->keytypeid = cpu_to_le16(key->type);
- keyparam->keylen = cpu_to_le16(key->len);
- memcpy(keyparam->key, key->key, key->len);
-
- /* Length field doesn't include the {type,length} header */
- keyparam->length = cpu_to_le16(sizeof(*keyparam) - 4);
- lbs_deb_leave(LBS_DEB_CMD);
-}
-
-int lbs_cmd_802_11_key_material(struct lbs_private *priv, uint16_t cmd_action,
- struct assoc_request *assoc)
-{
- struct cmd_ds_802_11_key_material cmd;
- int ret = 0;
- int index = 0;
-
- lbs_deb_enter(LBS_DEB_CMD);
-
- cmd.action = cpu_to_le16(cmd_action);
- cmd.hdr.size = cpu_to_le16(sizeof(cmd));
-
- if (cmd_action == CMD_ACT_GET) {
- cmd.hdr.size = cpu_to_le16(S_DS_GEN + 2);
- } else {
- memset(cmd.keyParamSet, 0, sizeof(cmd.keyParamSet));
-
- if (test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc->flags)) {
- set_one_wpa_key(&cmd.keyParamSet[index],
- &assoc->wpa_unicast_key);
- index++;
- }
-
- if (test_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc->flags)) {
- set_one_wpa_key(&cmd.keyParamSet[index],
- &assoc->wpa_mcast_key);
- index++;
- }
-
- /* The common header and as many keys as we included */
- cmd.hdr.size = cpu_to_le16(offsetof(typeof(cmd),
- keyParamSet[index]));
- }
- ret = lbs_cmd_with_response(priv, CMD_802_11_KEY_MATERIAL, &cmd);
- /* Copy the returned key to driver private data */
- if (!ret && cmd_action == CMD_ACT_GET) {
- void *buf_ptr = cmd.keyParamSet;
- void *resp_end = &(&cmd)[1];
-
- while (buf_ptr < resp_end) {
- struct MrvlIEtype_keyParamSet *keyparam = buf_ptr;
- struct enc_key *key;
- uint16_t param_set_len = le16_to_cpu(keyparam->length);
- uint16_t key_len = le16_to_cpu(keyparam->keylen);
- uint16_t key_flags = le16_to_cpu(keyparam->keyinfo);
- uint16_t key_type = le16_to_cpu(keyparam->keytypeid);
- void *end;
-
- end = (void *)keyparam + sizeof(keyparam->type)
- + sizeof(keyparam->length) + param_set_len;
-
- /* Make sure we don't access past the end of the IEs */
- if (end > resp_end)
- break;
-
- if (key_flags & KEY_INFO_WPA_UNICAST)
- key = &priv->wpa_unicast_key;
- else if (key_flags & KEY_INFO_WPA_MCAST)
- key = &priv->wpa_mcast_key;
- else
- break;
-
- /* Copy returned key into driver */
- memset(key, 0, sizeof(struct enc_key));
- if (key_len > sizeof(key->key))
- break;
- key->type = key_type;
- key->flags = key_flags;
- key->len = key_len;
- memcpy(key->key, keyparam->key, key->len);
-
- buf_ptr = end + 1;
- }
- }
-
- lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
- return ret;
-}
-
/**
* @brief Set an SNMP MIB value
*
@@ -737,111 +546,6 @@
return 0;
}
-static __le16 lbs_rate_to_fw_bitmap(int rate, int lower_rates_ok)
-{
-/* Bit Rate
-* 15:13 Reserved
-* 12 54 Mbps
-* 11 48 Mbps
-* 10 36 Mbps
-* 9 24 Mbps
-* 8 18 Mbps
-* 7 12 Mbps
-* 6 9 Mbps
-* 5 6 Mbps
-* 4 Reserved
-* 3 11 Mbps
-* 2 5.5 Mbps
-* 1 2 Mbps
-* 0 1 Mbps
-**/
-
- uint16_t ratemask;
- int i = lbs_data_rate_to_fw_index(rate);
- if (lower_rates_ok)
- ratemask = (0x1fef >> (12 - i));
- else
- ratemask = (1 << i);
- return cpu_to_le16(ratemask);
-}
-
-int lbs_cmd_802_11_rate_adapt_rateset(struct lbs_private *priv,
- uint16_t cmd_action)
-{
- struct cmd_ds_802_11_rate_adapt_rateset cmd;
- int ret;
-
- lbs_deb_enter(LBS_DEB_CMD);
-
- if (!priv->cur_rate && !priv->enablehwauto)
- return -EINVAL;
-
- cmd.hdr.size = cpu_to_le16(sizeof(cmd));
-
- cmd.action = cpu_to_le16(cmd_action);
- cmd.enablehwauto = cpu_to_le16(priv->enablehwauto);
- cmd.bitmap = lbs_rate_to_fw_bitmap(priv->cur_rate, priv->enablehwauto);
- ret = lbs_cmd_with_response(priv, CMD_802_11_RATE_ADAPT_RATESET, &cmd);
- if (!ret && cmd_action == CMD_ACT_GET) {
- priv->ratebitmap = le16_to_cpu(cmd.bitmap);
- priv->enablehwauto = le16_to_cpu(cmd.enablehwauto);
- }
-
- lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
- return ret;
-}
-EXPORT_SYMBOL_GPL(lbs_cmd_802_11_rate_adapt_rateset);
-
-/**
- * @brief Set the data rate
- *
- * @param priv A pointer to struct lbs_private structure
- * @param rate The desired data rate, or 0 to clear a locked rate
- *
- * @return 0 on success, error on failure
- */
-int lbs_set_data_rate(struct lbs_private *priv, u8 rate)
-{
- struct cmd_ds_802_11_data_rate cmd;
- int ret = 0;
-
- lbs_deb_enter(LBS_DEB_CMD);
-
- memset(&cmd, 0, sizeof(cmd));
- cmd.hdr.size = cpu_to_le16(sizeof(cmd));
-
- if (rate > 0) {
- cmd.action = cpu_to_le16(CMD_ACT_SET_TX_FIX_RATE);
- cmd.rates[0] = lbs_data_rate_to_fw_index(rate);
- if (cmd.rates[0] == 0) {
- lbs_deb_cmd("DATA_RATE: invalid requested rate of"
- " 0x%02X\n", rate);
- ret = 0;
- goto out;
- }
- lbs_deb_cmd("DATA_RATE: set fixed 0x%02X\n", cmd.rates[0]);
- } else {
- cmd.action = cpu_to_le16(CMD_ACT_SET_TX_AUTO);
- lbs_deb_cmd("DATA_RATE: setting auto\n");
- }
-
- ret = lbs_cmd_with_response(priv, CMD_802_11_DATA_RATE, &cmd);
- if (ret)
- goto out;
-
- lbs_deb_hex(LBS_DEB_CMD, "DATA_RATE_RESP", (u8 *) &cmd, sizeof (cmd));
-
- /* FIXME: get actual rates FW can do if this command actually returns
- * all data rates supported.
- */
- priv->cur_rate = lbs_fw_index_to_data_rate(cmd.rates[0]);
- lbs_deb_cmd("DATA_RATE: current rate is 0x%02x\n", priv->cur_rate);
-
-out:
- lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
- return ret;
-}
-
/**
* @brief Get the radio channel
*
@@ -924,27 +628,6 @@
return ret;
}
-static int lbs_cmd_802_11_rssi(struct lbs_private *priv,
- struct cmd_ds_command *cmd)
-{
-
- lbs_deb_enter(LBS_DEB_CMD);
- cmd->command = cpu_to_le16(CMD_802_11_RSSI);
- cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rssi) + S_DS_GEN);
- cmd->params.rssi.N = cpu_to_le16(DEFAULT_BCN_AVG_FACTOR);
-
- /* reset Beacon SNR/NF/RSSI values */
- priv->SNR[TYPE_BEACON][TYPE_NOAVG] = 0;
- priv->SNR[TYPE_BEACON][TYPE_AVG] = 0;
- priv->NF[TYPE_BEACON][TYPE_NOAVG] = 0;
- priv->NF[TYPE_BEACON][TYPE_AVG] = 0;
- priv->RSSI[TYPE_BEACON][TYPE_NOAVG] = 0;
- priv->RSSI[TYPE_BEACON][TYPE_AVG] = 0;
-
- lbs_deb_leave(LBS_DEB_CMD);
- return 0;
-}
-
static int lbs_cmd_reg_access(struct cmd_ds_command *cmdptr,
u8 cmd_action, void *pdata_buf)
{
@@ -1184,27 +867,6 @@
return __lbs_mesh_config_send(priv, &cmd, action, priv->mesh_tlv);
}
-static int lbs_cmd_bcn_ctrl(struct lbs_private * priv,
- struct cmd_ds_command *cmd,
- u16 cmd_action)
-{
- struct cmd_ds_802_11_beacon_control
- *bcn_ctrl = &cmd->params.bcn_ctrl;
-
- lbs_deb_enter(LBS_DEB_CMD);
- cmd->size =
- cpu_to_le16(sizeof(struct cmd_ds_802_11_beacon_control)
- + S_DS_GEN);
- cmd->command = cpu_to_le16(CMD_802_11_BEACON_CTRL);
-
- bcn_ctrl->action = cpu_to_le16(cmd_action);
- bcn_ctrl->beacon_enable = cpu_to_le16(priv->beacon_enable);
- bcn_ctrl->beacon_period = cpu_to_le16(priv->beacon_period);
-
- lbs_deb_leave(LBS_DEB_CMD);
- return 0;
-}
-
static void lbs_queue_cmd(struct lbs_private *priv,
struct cmd_ctrl_node *cmdnode)
{
@@ -2180,5 +1842,3 @@
return ret;
}
EXPORT_SYMBOL_GPL(__lbs_cmd);
-
-
--- linux-wl.orig/drivers/net/wireless/libertas/cmdresp.c
+++ linux-wl/drivers/net/wireless/libertas/cmdresp.c
@@ -148,53 +148,6 @@
return ret;
}
-static int lbs_ret_802_11_rssi(struct lbs_private *priv,
- struct cmd_ds_command *resp)
-{
- struct cmd_ds_802_11_rssi_rsp *rssirsp = &resp->params.rssirsp;
-
- lbs_deb_enter(LBS_DEB_CMD);
-
- /* store the non average value */
- priv->SNR[TYPE_BEACON][TYPE_NOAVG] = get_unaligned_le16(&rssirsp->SNR);
- priv->NF[TYPE_BEACON][TYPE_NOAVG] = get_unaligned_le16(&rssirsp->noisefloor);
-
- priv->SNR[TYPE_BEACON][TYPE_AVG] = get_unaligned_le16(&rssirsp->avgSNR);
- priv->NF[TYPE_BEACON][TYPE_AVG] = get_unaligned_le16(&rssirsp->avgnoisefloor);
-
- priv->RSSI[TYPE_BEACON][TYPE_NOAVG] =
- CAL_RSSI(priv->SNR[TYPE_BEACON][TYPE_NOAVG],
- priv->NF[TYPE_BEACON][TYPE_NOAVG]);
-
- priv->RSSI[TYPE_BEACON][TYPE_AVG] =
- CAL_RSSI(priv->SNR[TYPE_BEACON][TYPE_AVG] / AVG_SCALE,
- priv->NF[TYPE_BEACON][TYPE_AVG] / AVG_SCALE);
-
- lbs_deb_cmd("RSSI: beacon %d, avg %d\n",
- priv->RSSI[TYPE_BEACON][TYPE_NOAVG],
- priv->RSSI[TYPE_BEACON][TYPE_AVG]);
-
- lbs_deb_leave(LBS_DEB_CMD);
- return 0;
-}
-
-static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv,
- struct cmd_ds_command *resp)
-{
- struct cmd_ds_802_11_beacon_control *bcn_ctrl =
- &resp->params.bcn_ctrl;
-
- lbs_deb_enter(LBS_DEB_CMD);
-
- if (bcn_ctrl->action == CMD_ACT_GET) {
- priv->beacon_enable = (u8) le16_to_cpu(bcn_ctrl->beacon_enable);
- priv->beacon_period = le16_to_cpu(bcn_ctrl->beacon_period);
- }
-
- lbs_deb_enter(LBS_DEB_CMD);
- return 0;
-}
-
static inline int handle_cmd_response(struct lbs_private *priv,
struct cmd_header *cmd_response)
{
--- linux-wl.orig/drivers/net/wireless/libertas/cmd.h
+++ linux-wl/drivers/net/wireless/libertas/cmd.h
@@ -135,15 +135,6 @@
int lbs_cmd_802_11_rate_adapt_rateset(struct lbs_private *priv,
uint16_t cmd_action);
-int lbs_cmd_802_11_set_wep(struct lbs_private *priv, uint16_t cmd_action,
- struct assoc_request *assoc);
-
-int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv, uint16_t cmd_action,
- uint16_t *enable);
-
-int lbs_cmd_802_11_key_material(struct lbs_private *priv, uint16_t cmd_action,
- struct assoc_request *assoc);
-
int lbs_set_tx_power(struct lbs_private *priv, s16 dbm);
int lbs_set_deep_sleep(struct lbs_private *priv, int deep_sleep);
^ permalink raw reply
* [PATCH] libertas: move SIOCGIWAP calls to wext.c
From: Holger Schurig @ 2009-10-19 13:04 UTC (permalink / raw)
To: linux-wireless, John Linville, Dan Williams
This removes to calls to SIOCGIWAP with an all-bytes-zero AP into wext.c.
Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>
---
Less and less files now depend on WEXT :-)
--- linux-wl.orig/drivers/net/wireless/libertas/cmdresp.c
+++ linux-wl/drivers/net/wireless/libertas/cmdresp.c
@@ -27,23 +27,18 @@
*/
void lbs_mac_event_disconnected(struct lbs_private *priv)
{
- union iwreq_data wrqu;
-
if (priv->connect_status != LBS_CONNECTED)
return;
lbs_deb_enter(LBS_DEB_ASSOC);
- memset(wrqu.ap_addr.sa_data, 0x00, ETH_ALEN);
- wrqu.ap_addr.sa_family = ARPHRD_ETHER;
/*
* Cisco AP sends EAP failure and de-auth in less than 0.5 ms.
* It causes problem in the Supplicant
*/
-
msleep_interruptible(1000);
- wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
+ lbs_send_disconnect_notification(priv);
/* report disconnect to upper layer */
netif_stop_queue(priv->dev);
--- linux-wl.orig/drivers/net/wireless/libertas/main.c
+++ linux-wl/drivers/net/wireless/libertas/main.c
@@ -1227,7 +1227,6 @@
void lbs_remove_card(struct lbs_private *priv)
{
struct net_device *dev = priv->dev;
- union iwreq_data wrqu;
lbs_deb_enter(LBS_DEB_MAIN);
@@ -1252,9 +1251,7 @@
lbs_ps_wakeup(priv, CMD_OPTION_WAITFORRSP);
}
- memset(wrqu.ap_addr.sa_data, 0xaa, ETH_ALEN);
- wrqu.ap_addr.sa_family = ARPHRD_ETHER;
- wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
+ lbs_send_disconnect_notification(priv);
if (priv->is_deep_sleep) {
priv->is_deep_sleep = 0;
--- linux-wl.orig/drivers/net/wireless/libertas/wext.c
+++ linux-wl/drivers/net/wireless/libertas/wext.c
@@ -45,6 +45,15 @@
priv->pending_assoc_req = NULL;
}
+void lbs_send_disconnect_notification(struct lbs_private *priv)
+{
+ union iwreq_data wrqu;
+
+ memset(wrqu.ap_addr.sa_data, 0x00, ETH_ALEN);
+ wrqu.ap_addr.sa_family = ARPHRD_ETHER;
+ wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
+}
+
void lbs_send_iwevcustom_event(struct lbs_private *priv, s8 *str)
{
union iwreq_data iwrq;
--
http://www.holgerschurig.de
^ permalink raw reply
* Re: [PATCH 3/9] pcmcia: use pcmcia_loop_config in misc pcmcia drivers
From: Jiri Kosina @ 2009-10-19 13:45 UTC (permalink / raw)
To: Dominik Brodowski
Cc: linux-pcmcia, David S. Miller, John W. Linville, David Sterba,
netdev, linux-wireless
In-Reply-To: <1255907255-28297-3-git-send-email-linux@dominikbrodowski.net>
On Mon, 19 Oct 2009, Dominik Brodowski wrote:
> Use pcmcia_loop_config() in a few drivers missed during the first
> round. On fmvj18x_cs.c it -- strangely -- only requries us to set
> conf.ConfigIndex, which is done by the core, so include an empty
> loop function which returns 0 unconditionally.
>
> CC: David S. Miller <davem@davemloft.net>
> CC: John W. Linville <linville@tuxdriver.com>
> CC: Jiri Kosina <jkosina@suse.cz>
> CC: David Sterba <dsterba@suse.cz>
> CC: netdev@vger.kernel.org
> CC: linux-wireless@vger.kernel.org
> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
> ---
> drivers/char/pcmcia/ipwireless/main.c | 103 +++++++--------------------------
For the ipwireless part
Acked-by: Jiri Kosina <jkosina@suse.cz>
Thanks,
--
Jiri Kosina
SUSE Labs, Novell Inc.
^ permalink raw reply
* [RFC] libertas: monster-patch to make CFG/WEXT configurable
From: Holger Schurig @ 2009-10-19 12:49 UTC (permalink / raw)
To: linux-wireless, Dan Williams
This is a monster patch that makes CFG80211/WEXT operation
configurable. My cfg80211-RFC/WIP-Patch would come on top of it,
but would then be quite small, e.g. almost only changed to
cfg.c/cfg.h.
As there's no mesh/adhoc/monitor mode implemented in cfg80211-
mode, I added many, many #ifdef/#endif pairs. Maybe too many.
Is this too ugly? Or would this patch be applyable as-is ?
If the patch is perceived to be too ugly, I could create an
monitor.h/monitor.c file and singleout everything related to
monitoring in it, where monitor.h would resolv to dummy static
functions in the cfg80211-case ... at least as long as we don't
have monitor suppport in libertas+cfg80211. The same for mesh
support, e.g. here I could create a mesh.h/mesh.c and do the
same.
Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>
--- linux-wl.orig/drivers/net/wireless/libertas/Kconfig
+++ linux-wl/drivers/net/wireless/libertas/Kconfig
@@ -37,3 +37,29 @@
depends on LIBERTAS
---help---
Debugging support.
+
+choice
+ prompt "interface to user-space"
+ depends on LIBERTAS
+ default LIBERTAS_WEXT
+
+config LIBERTAS_WEXT
+ bool "WEXT"
+ help
+ This is the old Libertas code as it always used to be:
+ configuration done via "iwconfig" or "wpa_supplicant -Dwext",
+ associating via libertas-internal code. This is currently the only
+ way to support:
+
+ * AD-HOC
+ * Libertas' MESH
+ * Monitor interface ("rtap")
+
+config LIBERTAS_CFG80211
+ bool "CFG80211"
+ depends on EXPERIMENTAL
+ help
+ This is new new way of wireless: use cfg80211 for all, e.g.
+ "iw" or "wpa_supplicant -Dnl80211".
+
+endchoice
--- linux-wl.orig/drivers/net/wireless/libertas/Makefile
+++ linux-wl/drivers/net/wireless/libertas/Makefile
@@ -1,15 +1,15 @@
-libertas-y += assoc.o
libertas-y += cfg.o
libertas-y += cmd.o
libertas-y += cmdresp.o
libertas-y += debugfs.o
-libertas-y += ethtool.o
libertas-y += main.o
-libertas-y += persistcfg.o
libertas-y += rx.o
-libertas-y += scan.o
libertas-y += tx.o
-libertas-y += wext.o
+libertas-$(CONFIG_LIBERTAS_WEXT) += assoc.o
+libertas-$(CONFIG_LIBERTAS_WEXT) += ethtool.o
+libertas-$(CONFIG_LIBERTAS_WEXT) += persistcfg.o
+libertas-$(CONFIG_LIBERTAS_WEXT) += scan.o
+libertas-$(CONFIG_LIBERTAS_WEXT) += wext.o
usb8xxx-objs += if_usb.o
libertas_cs-objs += if_cs.o
--- linux-wl.orig/drivers/net/wireless/libertas/cmd.c
+++ linux-wl/drivers/net/wireless/libertas/cmd.c
@@ -3,7 +3,6 @@
* It prepares command and sends it to firmware when it is ready.
*/
-#include <net/iw_handler.h>
#include <net/lib80211.h>
#include <linux/kfifo.h>
#include <linux/sched.h>
@@ -184,6 +183,8 @@
memmove(priv->current_addr, cmd.permanentaddr, ETH_ALEN);
memcpy(priv->dev->dev_addr, priv->current_addr, ETH_ALEN);
+
+#ifdef CONFIG_LIBERTAS_WEXT
if (priv->mesh_dev)
memcpy(priv->mesh_dev->dev_addr, priv->current_addr, ETH_ALEN);
@@ -191,6 +192,7 @@
ret = -1;
goto out;
}
+#endif
out:
lbs_deb_leave(LBS_DEB_CMD);
@@ -387,10 +389,12 @@
cmd.oid = cpu_to_le16((u16) oid);
switch (oid) {
+#ifdef CONFIG_LIBERTAS_WEXT
case SNMP_MIB_OID_BSS_TYPE:
cmd.bufsize = cpu_to_le16(sizeof(u8));
cmd.value[0] = (val == IW_MODE_ADHOC) ? 2 : 1;
break;
+#endif
case SNMP_MIB_OID_11D_ENABLE:
case SNMP_MIB_OID_FRAG_THRESHOLD:
case SNMP_MIB_OID_RTS_THRESHOLD:
@@ -442,12 +446,14 @@
switch (le16_to_cpu(cmd.bufsize)) {
case sizeof(u8):
+#ifdef CONFIG_LIBERTAS_WEXT
if (oid == SNMP_MIB_OID_BSS_TYPE) {
if (cmd.value[0] == 2)
*out_val = IW_MODE_ADHOC;
else
*out_val = IW_MODE_INFRA;
} else
+#endif
*out_val = cmd.value[0];
break;
case sizeof(u16):
@@ -702,6 +708,7 @@
return 0;
}
+#ifdef CONFIG_LIBERTAS_WEXT
static int lbs_cmd_bt_access(struct cmd_ds_command *cmd,
u16 cmd_action, void *pdata_buf)
{
@@ -868,6 +875,7 @@
return __lbs_mesh_config_send(priv, &cmd, action, priv->mesh_tlv);
}
+#endif
static void lbs_queue_cmd(struct lbs_private *priv,
struct cmd_ctrl_node *cmdnode)
@@ -1155,10 +1163,6 @@
cmd_action, pdata_buf);
break;
- case CMD_802_11_RSSI:
- ret = lbs_cmd_802_11_rssi(priv, cmdptr);
- break;
-
case CMD_802_11_SET_AFC:
case CMD_802_11_GET_AFC:
@@ -1184,6 +1188,11 @@
ret = 0;
break;
+#ifdef CONFIG_LIBERTAS_WEXT
+ case CMD_802_11_RSSI:
+ ret = lbs_cmd_802_11_rssi(priv, cmdptr);
+ break;
+
case CMD_BT_ACCESS:
ret = lbs_cmd_bt_access(cmdptr, cmd_action, pdata_buf);
break;
@@ -1195,6 +1204,8 @@
case CMD_802_11_BEACON_CTRL:
ret = lbs_cmd_bcn_ctrl(priv, cmdptr, cmd_action);
break;
+#endif
+
case CMD_802_11_DEEP_SLEEP:
cmdptr->command = cpu_to_le16(CMD_802_11_DEEP_SLEEP);
cmdptr->size = cpu_to_le16(sizeof(struct cmd_header));
@@ -1487,6 +1498,7 @@
* check if in power save mode, if yes, put the device back
* to PS mode
*/
+#ifdef CONFIG_LIBERTAS_WEXT
if ((priv->psmode != LBS802_11POWERMODECAM) &&
(priv->psstate == PS_STATE_FULL_POWER) &&
((priv->connect_status == LBS_CONNECTED) ||
@@ -1508,6 +1520,9 @@
lbs_ps_sleep(priv, 0);
}
}
+#else
+ /* TODO: we need to figure out what to do here in cfg80211-mode */
+#endif
}
ret = 0;
--- linux-wl.orig/drivers/net/wireless/libertas/dev.h
+++ linux-wl/drivers/net/wireless/libertas/dev.h
@@ -6,8 +6,10 @@
#ifndef _LBS_DEV_H_
#define _LBS_DEV_H_
+#include "defs.h"
#include "scan.h"
#include "assoc.h"
+#include "host.h"
@@ -21,6 +23,9 @@
uint16_t sp_reserved;
};
+
+#ifdef CONFIG_LIBERTAS_WEXT
+
/* Mesh statistics */
struct lbs_mesh_stats {
u32 fwd_bcast_cnt; /* Fwd: Broadcast counter */
@@ -32,6 +37,8 @@
u32 drop_blind; /* Rx: Dropped by blinding table */
u32 tx_failed_cnt; /* Tx: Failed transmissions */
};
+#endif
+
/** Private structure for the MV device */
struct lbs_private {
@@ -48,11 +55,11 @@
struct wireless_dev *wdev;
/* Mesh */
+#ifdef CONFIG_LIBERTAS_WEXT
struct net_device *mesh_dev; /* Virtual device */
u32 mesh_connect_status;
struct lbs_mesh_stats mstats;
int mesh_open;
- int mesh_fw_ver;
int mesh_autostart_enabled;
uint16_t mesh_tlv;
u8 mesh_ssid[IEEE80211_MAX_SSID_LEN + 1];
@@ -62,6 +69,7 @@
/* Monitor mode */
struct net_device *rtap_net_dev;
u32 monitormode;
+#endif
/* Debugfs */
struct dentry *debugfs_dir;
@@ -103,6 +111,7 @@
int (*reset_deep_sleep_wakeup) (struct lbs_private *priv);
/* Adapter info (from EEPROM) */
+ int mesh_fw_ver;
u32 fwrelease;
u32 fwcapinfo;
u16 regioncode;
@@ -138,11 +147,13 @@
struct workqueue_struct *work_thread;
/** Encryption stuff */
+#ifdef CONFIG_LIBERTAS_WEXT
struct lbs_802_11_security secinfo;
struct enc_key wpa_mcast_key;
struct enc_key wpa_unicast_key;
u8 wpa_ie[MAX_WPA_IE_LEN];
u8 wpa_ie_len;
+#endif
u16 wep_tx_keyidx;
struct enc_key wep_keys[4];
@@ -163,6 +174,7 @@
spinlock_t driver_lock;
/* NIC/link operation characteristics */
+ u16 capability;
u16 mac_control;
u8 radio_on;
u8 channel;
@@ -174,6 +186,7 @@
struct delayed_work scan_work;
int scan_channel;
/* remember which channel was scanned last, != 0 if currently scanning */
+#ifdef CONFIG_LIBERTAS_WEXT
u8 scan_ssid[IEEE80211_MAX_SSID_LEN + 1];
u8 scan_ssid_len;
@@ -186,7 +199,6 @@
struct bss_descriptor *networks;
struct assoc_request * pending_assoc_req;
struct assoc_request * in_progress_assoc_req;
- u16 capability;
uint16_t enablehwauto;
uint16_t ratebitmap;
@@ -211,6 +223,7 @@
u8 rawNF[DEFAULT_DATA_AVG_FACTOR];
u16 nextSNRNF;
u16 numSNRNF;
+#endif
};
extern struct cmd_confirm_sleep confirm_sleep;
--- linux-wl.orig/drivers/net/wireless/libertas/main.c
+++ linux-wl/drivers/net/wireless/libertas/main.c
@@ -13,7 +13,6 @@
#include <linux/kfifo.h>
#include <linux/stddef.h>
#include <linux/ieee80211.h>
-#include <net/iw_handler.h>
#include <net/cfg80211.h>
#include "host.h"
@@ -98,6 +97,7 @@
* Attributes exported through sysfs
*/
+#ifdef CONFIG_LIBERTAS_WEXT
/**
* @brief Get function for sysfs attribute anycast_mask
*/
@@ -325,6 +325,8 @@
static struct attribute_group lbs_mesh_attr_group = {
.attrs = lbs_mesh_sysfs_entries,
};
+#endif
+
/**
* @brief This function opens the ethX or mshX interface
@@ -341,6 +343,7 @@
spin_lock_irq(&priv->driver_lock);
+#ifdef CONFIG_LIBERTAS_WEXT
if (priv->monitormode) {
ret = -EBUSY;
goto out;
@@ -351,6 +354,9 @@
priv->mesh_connect_status = LBS_CONNECTED;
netif_carrier_on(dev);
} else {
+#else
+ if (1) {
+#endif
priv->infra_open = 1;
if (priv->connect_status == LBS_CONNECTED)
@@ -361,13 +367,16 @@
if (!priv->tx_pending_len)
netif_wake_queue(dev);
- out:
+#ifdef CONFIG_LIBERTAS_WEXT
+ out:
+#endif
spin_unlock_irq(&priv->driver_lock);
lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
return ret;
}
+#ifdef CONFIG_LIBERTAS_WEXT
/**
* @brief This function closes the mshX interface
*
@@ -383,7 +392,6 @@
priv->mesh_open = 0;
priv->mesh_connect_status = LBS_DISCONNECTED;
-
netif_stop_queue(dev);
netif_carrier_off(dev);
@@ -394,6 +402,7 @@
lbs_deb_leave(LBS_DEB_MESH);
return 0;
}
+#endif
/**
* @brief This function closes the ethX interface
@@ -428,8 +437,10 @@
dev->trans_start = jiffies;
+#ifdef CONFIG_LIBERTAS_WEXT
if (priv->currenttxskb)
lbs_send_tx_feedback(priv, 0);
+#endif
/* XX: Shouldn't we also call into the hw-specific driver
to kick it somehow? */
@@ -490,8 +501,10 @@
memcpy(priv->current_addr, phwaddr->sa_data, ETH_ALEN);
memcpy(dev->dev_addr, phwaddr->sa_data, ETH_ALEN);
+#ifdef CONFIG_LIBERTAS_WEXT
if (priv->mesh_dev)
memcpy(priv->mesh_dev->dev_addr, phwaddr->sa_data, ETH_ALEN);
+#endif
done:
lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
@@ -554,8 +567,10 @@
lbs_deb_enter(LBS_DEB_NET);
dev_flags = priv->dev->flags;
+#ifdef CONFIG_LIBERTAS_WEXT
if (priv->mesh_dev)
dev_flags |= priv->mesh_dev->flags;
+#endif
if (dev_flags & IFF_PROMISC) {
priv->mac_control |= CMD_ACT_MAC_PROMISCUOUS_ENABLE;
@@ -572,8 +587,10 @@
/* Once for priv->dev, again for priv->mesh_dev if it exists */
nr_addrs = lbs_add_mcast_addrs(&mcast_cmd, priv->dev, 0);
+#ifdef CONFIG_LIBERTAS_WEXT
if (nr_addrs >= 0 && priv->mesh_dev)
nr_addrs = lbs_add_mcast_addrs(&mcast_cmd, priv->mesh_dev, nr_addrs);
+#endif
if (nr_addrs < 0)
goto do_allmulti;
@@ -816,9 +833,11 @@
waiting for TX feedback */
if (priv->connect_status == LBS_CONNECTED)
netif_wake_queue(priv->dev);
+#ifdef CONFIG_LIBERTAS_WEXT
if (priv->mesh_dev &&
priv->mesh_connect_status == LBS_CONNECTED)
netif_wake_queue(priv->mesh_dev);
+#endif
}
}
spin_unlock_irq(&priv->driver_lock);
@@ -838,8 +857,10 @@
lbs_deb_enter(LBS_DEB_FW);
netif_device_detach(priv->dev);
+#ifdef CONFIG_LIBERTAS_WEXT
if (priv->mesh_dev)
netif_device_detach(priv->mesh_dev);
+#endif
priv->fw_ready = 0;
lbs_deb_leave(LBS_DEB_FW);
@@ -882,8 +903,10 @@
0, 0, NULL);
netif_device_attach(priv->dev);
+#ifdef CONFIG_LIBERTAS_WEXT
if (priv->mesh_dev)
netif_device_attach(priv->mesh_dev);
+#endif
lbs_deb_leave(LBS_DEB_FW);
}
@@ -1004,6 +1027,7 @@
return 0;
}
+#ifdef CONFIG_LIBERTAS_WEXT
static void lbs_sync_channel_worker(struct work_struct *work)
{
struct lbs_private *priv = container_of(work, struct lbs_private,
@@ -1014,15 +1038,19 @@
lbs_pr_info("Channel synchronization failed.");
lbs_deb_leave(LBS_DEB_MAIN);
}
-
+#endif
static int lbs_init_adapter(struct lbs_private *priv)
{
+ int ret = 0;
+#ifdef CONFIG_LIBERTAS_WEXT
size_t bufsize;
- int i, ret = 0;
+ int i;
+#endif
lbs_deb_enter(LBS_DEB_MAIN);
+#ifdef CONFIG_LIBERTAS_WEXT
/* Allocate buffer to store the BSSID list */
bufsize = MAX_NETWORK_COUNT * sizeof(struct bss_descriptor);
priv->networks = kzalloc(bufsize, GFP_KERNEL);
@@ -1039,17 +1067,18 @@
list_add_tail(&priv->networks[i].list,
&priv->network_free_list);
}
+ priv->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
+ priv->mode = IW_MODE_INFRA;
+ priv->enablehwauto = 1;
+ priv->mesh_connect_status = LBS_DISCONNECTED;
+#endif
memset(priv->current_addr, 0xff, ETH_ALEN);
priv->connect_status = LBS_DISCONNECTED;
- priv->mesh_connect_status = LBS_DISCONNECTED;
- priv->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
- priv->mode = IW_MODE_INFRA;
priv->channel = DEFAULT_AD_HOC_CHANNEL;
priv->mac_control = CMD_ACT_MAC_RX_ON | CMD_ACT_MAC_TX_ON;
priv->radio_on = 1;
- priv->enablehwauto = 1;
priv->capability = WLAN_CAPABILITY_SHORT_PREAMBLE;
priv->psmode = LBS802_11POWERMODECAM;
priv->psstate = PS_STATE_FULL_POWER;
@@ -1103,8 +1132,10 @@
kfifo_free(priv->event_fifo);
del_timer(&priv->command_timer);
del_timer(&priv->auto_deepsleep_timer);
+#ifdef CONFIG_LIBERTAS_WEXT
kfree(priv->networks);
priv->networks = NULL;
+#endif
lbs_deb_leave(LBS_DEB_MAIN);
}
@@ -1166,8 +1197,8 @@
dev->netdev_ops = &lbs_netdev_ops;
dev->watchdog_timeo = 5 * HZ;
+#ifdef CONFIG_LIBERTAS_WEXT
dev->ethtool_ops = &lbs_ethtool_ops;
-#ifdef WIRELESS_EXT
dev->wireless_handlers = &lbs_handler_def;
#endif
dev->flags |= IFF_BROADCAST | IFF_MULTICAST;
@@ -1177,11 +1208,8 @@
priv->card = card;
- priv->mesh_open = 0;
priv->infra_open = 0;
-
- priv->rtap_net_dev = NULL;
strcpy(dev->name, "wlan%d");
lbs_deb_thread("Starting main thread...\n");
@@ -1193,13 +1221,18 @@
}
priv->work_thread = create_singlethread_workqueue("lbs_worker");
- INIT_DELAYED_WORK(&priv->assoc_work, lbs_association_worker);
- INIT_DELAYED_WORK(&priv->scan_work, lbs_scan_worker);
- INIT_WORK(&priv->mcast_work, lbs_set_mcast_worker);
- INIT_WORK(&priv->sync_channel, lbs_sync_channel_worker);
+#ifdef CONFIG_LIBERTAS_WEXT
+ priv->rtap_net_dev = NULL;
sprintf(priv->mesh_ssid, "mesh");
priv->mesh_ssid_len = 4;
+ priv->mesh_open = 0;
+
+ INIT_DELAYED_WORK(&priv->assoc_work, lbs_association_worker);
+ INIT_DELAYED_WORK(&priv->scan_work, lbs_scan_worker);
+ INIT_WORK(&priv->sync_channel, lbs_sync_channel_worker);
+#endif
+ INIT_WORK(&priv->mcast_work, lbs_set_mcast_worker);
priv->wol_criteria = 0xffffffff;
priv->wol_gpio = 0xff;
@@ -1231,13 +1264,15 @@
lbs_deb_enter(LBS_DEB_MAIN);
+ dev = priv->dev;
+
+#ifdef CONFIG_LIBERTAS_WEXT
lbs_remove_mesh(priv);
lbs_remove_rtap(priv);
- dev = priv->dev;
-
cancel_delayed_work_sync(&priv->scan_work);
cancel_delayed_work_sync(&priv->assoc_work);
+#endif
cancel_work_sync(&priv->mcast_work);
/* worker thread destruction blocks on the in-flight command which
@@ -1295,6 +1330,7 @@
lbs_update_channel(priv);
+#ifdef CONFIG_LIBERTAS_WEXT
/* Check mesh FW version and appropriately send the mesh start
* command
*/
@@ -1342,6 +1378,7 @@
if (device_create_file(&dev->dev, &dev_attr_lbs_rtap))
lbs_pr_err("cannot register lbs_rtap attribute\n");
}
+#endif
lbs_debugfs_init_one(priv, dev);
@@ -1372,10 +1409,12 @@
netif_carrier_off(dev);
lbs_debugfs_remove_one(priv);
+#ifdef CONFIG_LIBERTAS_WEXT
if (priv->mesh_tlv) {
device_remove_file(&dev->dev, &dev_attr_lbs_mesh);
device_remove_file(&dev->dev, &dev_attr_lbs_rtap);
}
+#endif
/* Delete the timeout of the currently processing command */
del_timer_sync(&priv->command_timer);
@@ -1408,6 +1447,7 @@
EXPORT_SYMBOL_GPL(lbs_stop_card);
+#ifdef CONFIG_LIBERTAS_WEXT
static const struct net_device_ops mesh_netdev_ops = {
.ndo_open = lbs_dev_open,
.ndo_stop = lbs_mesh_stop,
@@ -1445,7 +1485,7 @@
SET_NETDEV_DEV(priv->mesh_dev, priv->dev->dev.parent);
-#ifdef WIRELESS_EXT
+#ifdef CONFIG_LIBERTAS_WEXT
mesh_dev->wireless_handlers = (struct iw_handler_def *)&mesh_handler_def;
#endif
mesh_dev->flags |= IFF_BROADCAST | IFF_MULTICAST;
@@ -1496,6 +1536,7 @@
free_netdev(mesh_dev);
lbs_deb_leave(LBS_DEB_MESH);
}
+#endif
void lbs_queue_event(struct lbs_private *priv, u32 event)
{
@@ -1556,6 +1597,7 @@
* rtap interface support fuctions
*/
+#ifdef CONFIG_LIBERTAS_WEXT
static int lbs_rtap_open(struct net_device *dev)
{
/* Yes, _stop_ the queue. Because we don't support injection */
@@ -1632,6 +1674,7 @@
lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
return ret;
}
+#endif
module_init(lbs_init_module);
module_exit(lbs_exit_module);
--- linux-wl.orig/drivers/net/wireless/libertas/cmdresp.c
+++ linux-wl/drivers/net/wireless/libertas/cmdresp.c
@@ -7,7 +7,6 @@
#include <linux/if_arp.h>
#include <linux/netdevice.h>
#include <asm/unaligned.h>
-#include <net/iw_handler.h>
#include "host.h"
#include "decl.h"
@@ -27,13 +26,16 @@
*/
void lbs_mac_event_disconnected(struct lbs_private *priv)
{
+#ifdef CONFIG_LIBERTAS_WEXT
union iwreq_data wrqu;
+#endif
if (priv->connect_status != LBS_CONNECTED)
return;
lbs_deb_enter(LBS_DEB_ASSOC);
+#ifdef CONFIG_LIBERTAS_WEXT
memset(wrqu.ap_addr.sa_data, 0x00, ETH_ALEN);
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
@@ -44,6 +46,9 @@
msleep_interruptible(1000);
wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
+#else
+ /* TODO: find out what to do in the cfg80211 case */
+#endif
/* report disconnect to upper layer */
netif_stop_queue(priv->dev);
@@ -55,6 +60,7 @@
priv->tx_pending_len = 0;
/* reset SNR/NF/RSSI values */
+#ifdef CONFIG_LIBERTAS_WEXT
memset(priv->SNR, 0x00, sizeof(priv->SNR));
memset(priv->NF, 0x00, sizeof(priv->NF));
memset(priv->RSSI, 0x00, sizeof(priv->RSSI));
@@ -62,7 +68,6 @@
memset(priv->rawNF, 0x00, sizeof(priv->rawNF));
priv->nextSNRNF = 0;
priv->numSNRNF = 0;
- priv->connect_status = LBS_DISCONNECTED;
/* Clear out associated SSID and BSSID since connection is
* no longer valid.
@@ -70,6 +75,9 @@
memset(&priv->curbssparams.bssid, 0, ETH_ALEN);
memset(&priv->curbssparams.ssid, 0, IEEE80211_MAX_SSID_LEN);
priv->curbssparams.ssid_len = 0;
+#endif
+ priv->connect_status = LBS_DISCONNECTED;
+
if (priv->psstate != PS_STATE_FULL_POWER) {
/* make firmware to exit PS mode */
@@ -88,9 +96,12 @@
*/
static void handle_mic_failureevent(struct lbs_private *priv, u32 event)
{
+#ifdef CONFIG_LIBERTAS_WEXT
char buf[50];
+#endif
lbs_deb_enter(LBS_DEB_CMD);
+#ifdef CONFIG_LIBERTAS_WEXT
memset(buf, 0, sizeof(buf));
sprintf(buf, "%s", "MLME-MICHAELMICFAILURE.indication ");
@@ -102,6 +113,7 @@
}
lbs_send_iwevcustom_event(priv, buf);
+#endif
lbs_deb_leave(LBS_DEB_CMD);
}
@@ -177,10 +189,6 @@
case CMD_RET(CMD_802_11_BEACON_STOP):
break;
- case CMD_RET(CMD_802_11_RSSI):
- ret = lbs_ret_802_11_rssi(priv, resp);
- break;
-
case CMD_RET(CMD_802_11_TPC_CFG):
spin_lock_irqsave(&priv->driver_lock, flags);
memmove((void *)priv->cur_cmd->callback_arg, &resp->params.tpccfg,
@@ -202,9 +210,16 @@
sizeof(resp->params.fwt));
spin_unlock_irqrestore(&priv->driver_lock, flags);
break;
+
+#ifdef CONFIG_LIBERTAS_WEXT
+ case CMD_RET(CMD_802_11_RSSI):
+ ret = lbs_ret_802_11_rssi(priv, resp);
+ break;
+
case CMD_RET(CMD_802_11_BEACON_CTRL):
ret = lbs_ret_802_11_bcn_ctrl(priv, resp);
break;
+#endif
default:
lbs_pr_err("CMD_RESP: unknown cmd response 0x%04x\n",
@@ -297,9 +312,13 @@
* ad-hoc mode. It takes place in
* lbs_execute_next_command().
*/
+#ifdef CONFIG_LIBERTAS_WEXT
if (priv->mode == IW_MODE_ADHOC &&
action == CMD_SUBCMD_ENTER_PS)
priv->psmode = LBS802_11POWERMODECAM;
+#else
+ /* TODO: we need to figure out what to do here in cfg80211-mode */
+#endif
} else if (action == CMD_SUBCMD_ENTER_PS) {
priv->needtowakeup = 0;
priv->psstate = PS_STATE_AWAKE;
@@ -516,6 +535,7 @@
lbs_pr_alert("EVENT: snr high\n");
break;
+#ifdef CONFIG_LIBERTAS_WEXT
case MACREG_INT_CODE_MESH_AUTO_STARTED:
/* Ignore spurious autostart events if autostart is disabled */
if (!priv->mesh_autostart_enabled) {
@@ -532,6 +552,7 @@
priv->mode = IW_MODE_ADHOC;
schedule_work(&priv->sync_channel);
break;
+#endif
default:
lbs_pr_alert("EVENT: unknown event id %d\n", event);
--- linux-wl.orig/drivers/net/wireless/libertas/debugfs.c
+++ linux-wl/drivers/net/wireless/libertas/debugfs.c
@@ -4,7 +4,6 @@
#include <linux/delay.h>
#include <linux/mm.h>
#include <linux/string.h>
-#include <net/iw_handler.h>
#include <net/lib80211.h>
#include "dev.h"
@@ -60,6 +59,7 @@
}
+#ifdef CONFIG_LIBERTAS_WEXT
static ssize_t lbs_getscantable(struct file *file, char __user *userbuf,
size_t count, loff_t *ppos)
{
@@ -103,6 +103,7 @@
free_page(addr);
return res;
}
+#endif
static ssize_t lbs_sleepparams_write(struct file *file,
const char __user *user_buf, size_t count,
@@ -722,8 +723,10 @@
static const struct lbs_debugfs_files debugfs_files[] = {
{ "info", 0444, FOPS(lbs_dev_info, write_file_dummy), },
+#ifdef CONFIG_LIBERTAS_WEXT
{ "getscantable", 0444, FOPS(lbs_getscantable,
write_file_dummy), },
+#endif
{ "sleepparams", 0644, FOPS(lbs_sleepparams_read,
lbs_sleepparams_write), },
};
--- linux-wl.orig/drivers/net/wireless/libertas/rx.c
+++ linux-wl/drivers/net/wireless/libertas/rx.c
@@ -34,6 +34,7 @@
void *eth80211_hdr;
} __attribute__ ((packed));
+#ifdef CONFIG_LIBERTAS_WEXT
static int process_rxed_802_11_packet(struct lbs_private *priv,
struct sk_buff *skb);
@@ -129,6 +130,7 @@
lbs_deb_leave(LBS_DEB_RX);
}
+#endif
/**
* @brief This function processes received packet and forwards it
@@ -154,12 +156,15 @@
skb->ip_summed = CHECKSUM_NONE;
+#ifdef CONFIG_LIBERTAS_WEXT
if (priv->monitormode)
return process_rxed_802_11_packet(priv, skb);
+#endif
p_rx_pd = (struct rxpd *) skb->data;
p_rx_pkt = (struct rxpackethdr *) ((u8 *)p_rx_pd +
le32_to_cpu(p_rx_pd->pkt_ptr));
+#ifdef CONFIG_LIBERTAS_WEXT
if (priv->mesh_dev) {
if (priv->mesh_fw_ver == MESH_FW_OLD) {
if (p_rx_pd->rx_control & RxPD_MESH_FRAME)
@@ -169,6 +174,7 @@
dev = priv->mesh_dev;
}
}
+#endif
lbs_deb_hex(LBS_DEB_RX, "RX Data: Before chop rxpd", skb->data,
min_t(unsigned int, skb->len, 100));
@@ -232,6 +238,7 @@
*/
skb_pull(skb, hdrchop);
+#ifdef CONFIG_LIBERTAS_WEXT
/* Take the data rate from the rxpd structure
* only if the rate is auto
*/
@@ -239,6 +246,7 @@
priv->cur_rate = lbs_fw_index_to_data_rate(p_rx_pd->rx_rate);
lbs_compute_rssi(priv, p_rx_pd);
+#endif
lbs_deb_rx("rx data: size of actual packet %d\n", skb->len);
dev->stats.rx_bytes += skb->len;
@@ -257,6 +265,7 @@
}
EXPORT_SYMBOL_GPL(lbs_process_rxed_packet);
+#ifdef CONFIG_LIBERTAS_WEXT
/**
* @brief This function converts Tx/Rx rates from the Marvell WLAN format
* (see Table 2 in Section 3.1) to IEEE80211_RADIOTAP_RATE units (500 Kb/s)
@@ -381,3 +390,4 @@
lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret);
return ret;
}
+#endif
--- linux-wl.orig/drivers/net/wireless/libertas/tx.c
+++ linux-wl/drivers/net/wireless/libertas/tx.c
@@ -12,6 +12,7 @@
#include "dev.h"
#include "wext.h"
+#ifdef CONFIG_LIBERTAS_WEXT
/**
* @brief This function converts Tx/Rx rates from IEEE80211_RADIOTAP_RATE
* units (500 Kb/s) into Marvell WLAN format (see Table 8 in Section 3.2.1)
@@ -49,6 +50,7 @@
}
return 0;
}
+#endif
/**
* @brief This function checks the conditions and sends packet to IF
@@ -88,8 +90,10 @@
netif_stop_queue(priv->dev);
+#ifdef CONFIG_LIBERTAS_WEXT
if (priv->mesh_dev)
netif_stop_queue(priv->mesh_dev);
+#endif
if (priv->tx_pending_len) {
/* This can happen if packets come in on the mesh and eth
@@ -111,6 +115,7 @@
p802x_hdr = skb->data;
pkt_len = skb->len;
+#ifdef CONFIG_LIBERTAS_WEXT
if (dev == priv->rtap_net_dev) {
struct tx_radiotap_hdr *rtap_hdr = (void *)skb->data;
@@ -123,6 +128,9 @@
/* copy destination address from 802.11 header */
memcpy(txpd->tx_dest_addr_high, p802x_hdr + 4, ETH_ALEN);
+#else
+ if (0) {
+#endif
} else {
/* copy destination address from 802.3 header */
memcpy(txpd->tx_dest_addr_high, p802x_hdr, ETH_ALEN);
@@ -131,12 +139,14 @@
txpd->tx_packet_length = cpu_to_le16(pkt_len);
txpd->tx_packet_location = cpu_to_le32(sizeof(struct txpd));
+#ifdef CONFIG_LIBERTAS_WEXT
if (dev == priv->mesh_dev) {
if (priv->mesh_fw_ver == MESH_FW_OLD)
txpd->tx_control |= cpu_to_le32(TxPD_MESH_FRAME);
else if (priv->mesh_fw_ver == MESH_FW_NEW)
txpd->u.bss.bss_num = MESH_IFACE_ID;
}
+#endif
lbs_deb_hex(LBS_DEB_TX, "txpd", (u8 *) &txpd, sizeof(struct txpd));
@@ -154,6 +164,7 @@
dev->trans_start = jiffies;
+#ifdef CONFIG_LIBERTAS_WEXT
if (priv->monitormode) {
/* Keep the skb to echo it back once Tx feedback is
received from FW */
@@ -161,6 +172,9 @@
/* Keep the skb around for when we get feedback */
priv->currenttxskb = skb;
+#else
+ if (0) {
+#endif
} else {
free:
dev_kfree_skb_any(skb);
@@ -173,6 +187,7 @@
return ret;
}
+#ifdef CONFIG_LIBERTAS_WEXT
/**
* @brief This function sends to the host the last transmitted packet,
* filling the radiotap headers with transmission information.
@@ -207,3 +222,4 @@
netif_wake_queue(priv->mesh_dev);
}
EXPORT_SYMBOL_GPL(lbs_send_tx_feedback);
+#endif
--- linux-wl.orig/drivers/net/wireless/libertas/if_usb.c
+++ linux-wl/drivers/net/wireless/libertas/if_usb.c
@@ -757,6 +757,7 @@
lbs_deb_usbd(&cardp->udev->dev, "**EVENT** 0x%X\n", event);
kfree_skb(skb);
+#ifdef CONFIG_LIBERTAS_WEXT
/* Icky undocumented magic special case */
if (event & 0xffff0000) {
u32 trycount = (event & 0xffff0000) >> 16;
@@ -764,6 +765,7 @@
lbs_send_tx_feedback(priv, trycount);
} else
lbs_queue_event(priv, event & 0xFF);
+#endif
break;
default:
--- linux-wl.orig/drivers/net/wireless/libertas/assoc.h
+++ linux-wl/drivers/net/wireless/libertas/assoc.h
@@ -3,6 +3,7 @@
#ifndef _LBS_ASSOC_H_
#define _LBS_ASSOC_H_
+#ifdef CONFIG_LIBERTAS_WEXT
#include "defs.h"
#include "host.h"
@@ -152,4 +153,6 @@
int lbs_cmd_802_11_key_material(struct lbs_private *priv, uint16_t cmd_action,
struct assoc_request *assoc);
+#endif
+
#endif /* _LBS_ASSOC_H */
--- linux-wl.orig/drivers/net/wireless/libertas/scan.h
+++ linux-wl/drivers/net/wireless/libertas/scan.h
@@ -7,6 +7,8 @@
#ifndef _LBS_SCAN_H
#define _LBS_SCAN_H
+#ifdef CONFIG_LIBERTAS_WEXT
+
#include <net/iw_handler.h>
struct lbs_private;
@@ -61,3 +63,5 @@
void lbs_scan_worker(struct work_struct *work);
#endif
+
+#endif
--- linux-wl.orig/drivers/net/wireless/libertas/wext.h
+++ linux-wl/drivers/net/wireless/libertas/wext.h
@@ -4,9 +4,13 @@
#ifndef _LBS_WEXT_H_
#define _LBS_WEXT_H_
+#ifdef CONFIG_LIBERTAS_WEXT
+
void lbs_send_iwevcustom_event(struct lbs_private *priv, s8 *str);
extern struct iw_handler_def lbs_handler_def;
extern struct iw_handler_def mesh_handler_def;
#endif
+
+#endif
^ permalink raw reply
* [PATCH] libertas: sort and categorize entries in decl.h
From: Holger Schurig @ 2009-10-19 13:27 UTC (permalink / raw)
To: linux-wireless, John Linville, Dan Williams
Also make lbs_find_cfp_by_band_and_channel() as static, as it's only used
inside wext.c.
This now makes decl.h only contain declarations for functions that don't
have their own *.h file.
No function change.
Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>
--- linux-wl.orig/drivers/net/wireless/libertas/decl.h
+++ linux-wl/drivers/net/wireless/libertas/decl.h
@@ -8,46 +8,30 @@
#include <linux/netdevice.h>
-#include "defs.h"
-
-extern const struct ethtool_ops lbs_ethtool_ops;
-
-/** Function Prototype Declaration */
struct lbs_private;
struct sk_buff;
struct net_device;
-struct cmd_ctrl_node;
-struct cmd_ds_command;
-int lbs_suspend(struct lbs_private *priv);
-void lbs_resume(struct lbs_private *priv);
-
-void lbs_send_tx_feedback(struct lbs_private *priv, u32 try_count);
-void lbs_queue_event(struct lbs_private *priv, u32 event);
-void lbs_notify_command_response(struct lbs_private *priv, u8 resp_idx);
-int lbs_enter_auto_deep_sleep(struct lbs_private *priv);
-int lbs_exit_auto_deep_sleep(struct lbs_private *priv);
+/* ethtool.c */
+extern const struct ethtool_ops lbs_ethtool_ops;
-u32 lbs_fw_index_to_data_rate(u8 index);
-u8 lbs_data_rate_to_fw_index(u32 rate);
-/** The proc fs interface */
+/* tx.c */
+void lbs_send_tx_feedback(struct lbs_private *priv, u32 try_count);
netdev_tx_t lbs_hard_start_xmit(struct sk_buff *skb,
struct net_device *dev);
+/* rx.c */
int lbs_process_rxed_packet(struct lbs_private *priv, struct sk_buff *);
-struct chan_freq_power *lbs_find_cfp_by_band_and_channel(
- struct lbs_private *priv,
- u8 band,
- u16 channel);
/* persistcfg.c */
void lbs_persist_config_init(struct net_device *net);
void lbs_persist_config_remove(struct net_device *net);
+
/* main.c */
struct lbs_private *lbs_add_card(void *card, struct device *dmdev);
void lbs_remove_card(struct lbs_private *priv);
@@ -55,5 +39,17 @@
void lbs_stop_card(struct lbs_private *priv);
void lbs_host_to_card_done(struct lbs_private *priv);
+int lbs_suspend(struct lbs_private *priv);
+void lbs_resume(struct lbs_private *priv);
+
+void lbs_queue_event(struct lbs_private *priv, u32 event);
+void lbs_notify_command_response(struct lbs_private *priv, u8 resp_idx);
+
+int lbs_enter_auto_deep_sleep(struct lbs_private *priv);
+int lbs_exit_auto_deep_sleep(struct lbs_private *priv);
+
+u32 lbs_fw_index_to_data_rate(u8 index);
+u8 lbs_data_rate_to_fw_index(u32 rate);
+
#endif
--- linux-wl.orig/drivers/net/wireless/libertas/scan.c
+++ linux-wl/drivers/net/wireless/libertas/scan.c
@@ -12,10 +12,10 @@
#include <net/lib80211.h>
#include "host.h"
-#include "decl.h"
#include "dev.h"
#include "scan.h"
#include "assoc.h"
+#include "wext.h"
#include "cmd.h"
//! Approximate amount of data needed to pass a scan result back to iwlist
--- linux-wl.orig/drivers/net/wireless/libertas/wext.c
+++ linux-wl/drivers/net/wireless/libertas/wext.c
@@ -86,7 +86,7 @@
* @param channel the channel for looking
* @return A pointer to struct chan_freq_power structure or NULL if not find.
*/
-struct chan_freq_power *lbs_find_cfp_by_band_and_channel(
+static struct chan_freq_power *lbs_find_cfp_by_band_and_channel(
struct lbs_private *priv,
u8 band,
u16 channel)
--
http://www.holgerschurig.de
^ permalink raw reply
* IBSS mode and scanning
From: Holger Schurig @ 2009-10-19 14:05 UTC (permalink / raw)
To: linux-wireless
Hi list !
I now try for the first time ever to do some IBSS/ADHOC
networking (so that I can implement this for libertas+cfg80211).
I noticed several things:
Documentation
-------------
http://linuxwireless.org/en/users/Documentation/iw doesn't have
any example. Via google, I found
http://linuxwireless.org/en/users/Documentation/iw/replace-iwconfig,
but this example is wrong, e.g. the frequency isn't specified.
As I'm not yet an authoritative instance for IBSS questions, I
won't fix those wiki pages --- yet.
Scanning while in IBSS mode?
----------------------------
I finally settled to use these commands:
dmesg -c >/dev/null
iw dev wlan0 set type ibss
ifconfig wlan0 192.168.1.2 up
iw --debug dev wlan0 ibss join ADHOC 2412
This seemed to work, but then I tried to look at the beacon. This
was just not possible using "iw":
iw dev wlan0 scan freq
iw dev wlan0 scan freq 2412
didn't work. But, oh wonder, it worked via "iwlist eth1 scan".
For me it looks like a but that I have to use a WEXT tool to
check for ADHOC beacons while in IBSS mode.
DMESG spamming
--------------
At first, my dmesg looked quite reasonable:
[22313.286690] phy0: device now idle
[22313.292241] phy0: device no longer idle - in use
[22313.292647] wlan0: Trigger new scan to find an IBSS to join
[22316.000249] wlan0: Trigger new scan to find an IBSS to join
[22320.000336] wlan0: Trigger new scan to find an IBSS to join
[22322.000444] wlan0: Creating new IBSS network, BSSID 4e:9d:b6:88:b7:9b
but then something started to spam it (Note that I did *NOT* yet operate another IBSS mode):
[22352.000210] wlan0: No active IBSS STAs - trying to scan for other IBSS networks with same SSID (merge)
[22352.032050] wlan0: No active IBSS STAs - trying to scan for other IBSS networks with same SSID (merge)
[22352.068034] wlan0: No active IBSS STAs - trying to scan for other IBSS networks with same SSID (merge)
[22352.108035] wlan0: No active IBSS STAs - trying to scan for other IBSS networks with same SSID (merge)
[22352.140057] wlan0: No active IBSS STAs - trying to scan for other IBSS networks with same SSID (merge)
[22352.176038] wlan0: No active IBSS STAs - trying to scan for other IBSS networks with same SSID (merg
...
ad-infinitum
--
http://www.holgerschurig.de
^ permalink raw reply
* How do you set the rate algorithm from the command line
From: Charles Gordon @ 2009-10-19 15:50 UTC (permalink / raw)
To: linux-wireless
Hi,
I'm using mac80211 in an embedded system. I can build the driver so
that more than one wifi rate algorithm is included, and one is set as
the default. It is not clear to me how to set the rate algorithm at
run time. Is there a command line utility that does this?
Suppose I build the driver so that both the PID and Mistrel algorithms
are included, and the Minstrel algorithm is the default. How can I
switch to the PID algorithm at run time?
Thanks for your help.
^ permalink raw reply
* Re: [PATCH 2/2] rt2x00: Implement support for rt2800pci
From: Bartlomiej Zolnierkiewicz @ 2009-10-19 15:56 UTC (permalink / raw)
To: Ivo van Doorn
Cc: John Linville, linux-wireless, users, Alban Browaeys,
Benoit PAPILLAULT, Felix Fietkau, Luis Correia, Mattias Nissler,
Mark Asselstine, Xose Vazquez Perez, linux-kernel
In-Reply-To: <200910181859.22413.IvDoorn@gmail.com>
On Sunday 18 October 2009 18:59:21 Ivo van Doorn wrote:
> > I also used the opportunity to take a closer look at this driver and
> > it seems that it needlessly adds around 2 KLOC to kernel by duplicating
> > the common content of rt2800usb.h to rt2800pci.h instead of moving it
> > to the shared header (like it is done in the staging crap drivers):
> >
> > $ wc -l drivers/net/wireless/rt2x00/rt2800usb.h drivers/net/wireless/rt2x00/rt2800pci.h
> > 1951 drivers/net/wireless/rt2x00/rt2800usb.h
> > 1960 drivers/net/wireless/rt2x00/rt2800pci.h
> > 3911 total
> >
> > $ diff -u drivers/net/wireless/rt2x00/rt2800usb.h drivers/net/wireless/rt2x00/rt2800pci.h|diffstat
> > rt2800pci.h | 213 +++++++++++++++++++++++++++++++-----------------------------
> > 1 file changed, 111 insertions(+), 102 deletions(-)
>
> Creating rt2800.h with common register defines has been on the todo list for some time already,
> it will likely happen in the future, but until I get around to update my debugfs scripts the seperate
> rt2800pci.h and rt2800usb.h files make debugging and register analysis a bit easier.
Knowing that this driver has been in more-or-less unchanged state in your
tree for at least past half year I would say that there was a plenty of time
to fix this trivial issue..
Also are the said scripts available anywhere?
> > Similarly it looks like most of the code between rt2800usb.c and rt2800pci.c
> > could also be shared (up to another 2 KLOC saved) by adding abstraction layer
> > for accessing chipset registers over different buses (again like it is done
> > in staging crap drivers):
> >
> > $ wc -l drivers/net/wireless/rt2x00/rt2800usb.c drivers/net/wireless/rt2x00/rt2800pci.c
> > 3077 drivers/net/wireless/rt2x00/rt2800usb.c
> > 3323 drivers/net/wireless/rt2x00/rt2800pci.c
> > 6400 total
> >
> > $ diff -u drivers/net/wireless/rt2x00/rt2800usb.c drivers/net/wireless/rt2x00/rt2800pci.c|diffstat
> > rt2800pci.c | 2190 +++++++++++++++++++++++++++++++++---------------------------
> > 1 file changed, 1218 insertions(+), 972 deletions(-)
>
> I don't agree on this, for starters the whole "abstraction layer as done in the staging driver, really
> obfuscated the code in multiple areas, so whatever abstraction layer will be needed for rt2x00 it
> should be done much cleaner without the ugly defines and crap like that. So unless there is a _clean_
> and very _readable_ solution for such abstraction layer I might consider it.
Nobody was talking about duplicating any obfuscations present in the staging
driver -- adding struct rt2800_ops would be the preferred way to go.
> Secondly, you can't merge them until both drivers would correctly for all users/chipsets, because only
> then you can see what registers are initialized equaly, and where potential pitfalls are between the
> 2 busses.
Merge should be done sooner than later, or the drivers will diverge even
more, i.e. eFUSE support is needed for rt2800usb and is currently present
only in rt2800pci driver.
You can always split them later, OTOH joining diverged code bases is much
more difficult task (i.e. unifying rt2860, rt2870, rt3070 and rt3090 was)
Moreover rt2800pci doesn't work at all currently (why it is not labeled as
EXPERIMENTAL BTW, ditto for rt2800usb?) so there is no rush in merging it
and you have a plenty of time to improve your code for the usual kernel
standards (alternatively you may want consider submitting it for staging).
Could you please start looking into addressing valid review comments?
[ If you do not have a time for it, my offer to take over maintenance of
rt2800 drivers is still actual.. ]
^ permalink raw reply
* Re: [PATCH 10/10] iwlwifi: rework for static power save
From: Guy, Wey-Yi @ 2009-10-19 16:32 UTC (permalink / raw)
To: Tomas Winkler
Cc: Chatre, Reinette, linville@tuxdriver.com,
linux-wireless@vger.kernel.org,
ipw3945-devel@lists.sourceforge.net
In-Reply-To: <1ba2fa240910161615h75a74e13u8a31c3e49eae234a@mail.gmail.com>
Tom,
Thanks for the feedback, I will submit a cleanup patch to address this
mistake.
On Fri, 2009-10-16 at 16:15 -0700, Tomas Winkler wrote:
> > #include "iwl-commands.h"
> >
> > +#define IWL_CONN_LISTEN_INTERVAL 10
>
> There is already IWL_CONN_MAX_LISTEN_INTERVAL; defined
>
> Thanks
> Tomas
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH] mac80211: fix SME warning by removing stale BSS upon assoc failure
From: ASIC Felix @ 2009-10-19 16:37 UTC (permalink / raw)
To: John W. Linville
Cc: Johannes Berg, Luis R. Rodriguez, Luis Rodriguez,
linux-wireless@vger.kernel.org
In-Reply-To: <20091016182039.GC6438@tuxdriver.com>
On Fri, 2009-10-16 at 14:20 -0400, John W. Linville wrote:
> On Fri, Oct 16, 2009 at 06:31:32PM +0900, Johannes Berg wrote:
> > On Wed, 2009-10-14 at 16:35 -0700, Luis R. Rodriguez wrote:
> >
> > > Well sure, but why do we want to keep the authentication present if
> > > association failed? And as a matter of fact it lingers there forever.
> > > Is that desired behaviour?
> >
> > Yes, well, the SME is supposed to clean it up or try the association
> > again (possibly with different parameters in the IEs, e.g. different WPA
> > settings). The cfg80211 SME certainly does so (it deauthenticates).
> >
> > > > > +++ b/net/mac80211/mlme.c
> > > > > @@ -1463,11 +1463,11 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
> > > > > if (status_code != WLAN_STATUS_SUCCESS) {
> > > > > printk(KERN_DEBUG "%s: AP denied association (code=%d)\n",
> > > > > sdata->dev->name, status_code);
> > > > > list_del(&wk->list);
> > > > > kfree(wk);
> > > > > - return RX_MGMT_CFG80211_ASSOC;
> > > > > + return RX_MGMT_CFG80211_DEAUTH;
> > > >
> > > > I'm sure this is correct. Maybe cfg80211 doesn't react properly to
> > > > getting an assoc frame with non-zero status?
> > >
> > > I see, will have to take a look when I get a chance then, not now though.
> >
> > > Actually can you elaborate a little on the logic here as to why
> > > we want to issue an association command with non-zero status to
> > > cfg80211 instead of just knocking off the current authentication
> > > and killing the BSS?
> >
> > Is the above sufficient? Btw, please don't talk about "killing the BSS",
> > you're not talking about a BSS struct but rather one of the mlme work
> > structs.
>
> So, should this patch be dropped? It is currently in w-t...
I'm still running the first w-t kernel with this fix
(master-2009-10-14), and haven't seen the sme warning I had been
complaining about for the past months, also: no connection drops.
Note I have _not_ run performance tests.
So this patch affects the sme issue. You guys will know where the
correct place is for fixing it.
By the way, (master-2009-10-14) is the best kernel for me since about
March/April this year. It looks like we're out of the rough again on
ath9k&mac80211.
Felix
^ permalink raw reply
* Re: Support for Broadcom's BCM4328 chip
From: Gábor Stefanik @ 2009-10-19 17:29 UTC (permalink / raw)
To: Russell Knighton; +Cc: Chriss Kalogeropoulos, linux-wireless
In-Reply-To: <279b980f0910191011p50064547r6d77a5ac32e22f93@mail.gmail.com>
2009/10/19 Russell Knighton <russell@knighton.me.uk>
>
> Great news that this is now truly under-way - but, at the risk of sounding cheeky, is there an estimated merge date on this (or any progress information you can share)? I have a broadcom BCM4322 and would like to get involved in any possible testing, or at the very least be able to check the progress on this.
>
> Thanks for all your hard work - your skill and efforts are highly appreciated by us end users!
>
> Russell
>
Only reverse-engineering is happening at this point - actual
development can only start once reverse-engineering is done. (And even
then, we will need to find someone to actually write the code for
N-PHY, as I'm not sure that I will have enough free time to do it
myself, and Michael seems to have practically abandoned the project.)
> 2009/10/18 Gábor Stefanik <netrolller.3d@gmail.com>
>>
>> On Sun, Oct 18, 2009 at 12:32 PM, Chriss Kalogeropoulos
>> <iz.iznogood@gmail.com> wrote:
>> > Hello,
>> >
>> > i have an i-mac using Broadcom's BCM4328 chip.
>> >
>> > lspci gives:
>> >
>> > 03:00.0 Network controller [0280]: Broadcom Corporation BCM4328
>> > 802.11a/b/g/n [14e4:4328] (rev 01)
>> >
>> > This must have been answered before but i thought to ask in case
>> > something has changed. Any hope on getting support on that chip with an
>> > open source driver ?
>> >
>> > Please cc me since i am not a subscriber on the list.
>> >
>> > Thanks in advance
>> >
>> > --
>> > To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
>> > the body of a message to majordomo@vger.kernel.org
>> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>> >
>>
>> This is an N-PHY card. Reverse-engineering of N-PHY cards is still in
>> progress (though it is finally really "in progress", and not stalled
>> anymore), and it needs to be finished (at least the G part) before we
>> can work on implementing it.
>>
>> --
>> Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)
^ permalink raw reply
* Re: [PATCH] rt2800pci.c : more ids
From: Ivo van Doorn @ 2009-10-19 17:31 UTC (permalink / raw)
To: Xose Vazquez Perez; +Cc: linux-wireless, users
In-Reply-To: <4ADC3664.8050900@gmail.com>
Hi,
I have merged your previous rt2800pci patch before sending it
upstream. Please recheck and if required rebase your patch
to the new version.
Thanks,
Ivo
On Monday 19 October 2009, Xose Vazquez Perez wrote:
> On 10/13/2009 10:05 AM, Xose Vazquez Perez wrote:
>
> > stolen from windows inf file(09/05/2009, 1.04.07.0000)
> >
> > 0x1814, 0x3060
>
> apply this one instead,
> got 0x1462,0x89a from linux driver(2009_0903_RT3090_Linux_STA_v2.2.0.1)
>
> -thanks-
>
> Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
>
^ permalink raw reply
* Re: [PATCH 2/2] rt2x00: Implement support for rt2800pci
From: Ivo van Doorn @ 2009-10-19 17:42 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz
Cc: John Linville, linux-wireless, users, Alban Browaeys,
Benoit PAPILLAULT, Felix Fietkau, Luis Correia, Mattias Nissler,
Mark Asselstine, Xose Vazquez Perez, linux-kernel
In-Reply-To: <200910191756.16579.bzolnier@gmail.com>
> > > I also used the opportunity to take a closer look at this driver and
> > > it seems that it needlessly adds around 2 KLOC to kernel by duplicating
> > > the common content of rt2800usb.h to rt2800pci.h instead of moving it
> > > to the shared header (like it is done in the staging crap drivers):
> > >
> > > $ wc -l drivers/net/wireless/rt2x00/rt2800usb.h drivers/net/wireless/rt2x00/rt2800pci.h
> > > 1951 drivers/net/wireless/rt2x00/rt2800usb.h
> > > 1960 drivers/net/wireless/rt2x00/rt2800pci.h
> > > 3911 total
> > >
> > > $ diff -u drivers/net/wireless/rt2x00/rt2800usb.h drivers/net/wireless/rt2x00/rt2800pci.h|diffstat
> > > rt2800pci.h | 213 +++++++++++++++++++++++++++++++-----------------------------
> > > 1 file changed, 111 insertions(+), 102 deletions(-)
> >
> > Creating rt2800.h with common register defines has been on the todo list for some time already,
> > it will likely happen in the future, but until I get around to update my debugfs scripts the seperate
> > rt2800pci.h and rt2800usb.h files make debugging and register analysis a bit easier.
>
> Knowing that this driver has been in more-or-less unchanged state in your
> tree for at least past half year I would say that there was a plenty of time
> to fix this trivial issue..
Well good to see you actually read the mails I send in this, and the previous, discussion regarding
the rt2800 development. Because that would have answered your question regarding the "plenty of time" part.
> Also are the said scripts available anywhere?
http://kernel.org/pub/linux/kernel/people/ivd/tools/
There is no howto for the scripts...
I have an updated script somewhere, but that is mostly performance fixes.
> > Secondly, you can't merge them until both drivers would correctly for all users/chipsets, because only
> > then you can see what registers are initialized equaly, and where potential pitfalls are between the
> > 2 busses.
>
> Merge should be done sooner than later, or the drivers will diverge even
> more, i.e. eFUSE support is needed for rt2800usb and is currently present
> only in rt2800pci driver.
Well nobody mentioned which USB chipsets require the eFuse EEPROM,
and I am not adding it until that is figured out.
> You can always split them later, OTOH joining diverged code bases is much
> more difficult task (i.e. unifying rt2860, rt2870, rt3070 and rt3090 was)
There have been way to many problems with the rt2800pci/usb drivers where
the ordering of the register initialization really matters. And those parts seem
to be different between rt2800pci/usb or at least they depend on different registers
to make it work.
So until that has been figured out we can try to unify the drivers then,
> Moreover rt2800pci doesn't work at all currently (why it is not labeled as
> EXPERIMENTAL BTW, ditto for rt2800usb?)
+config RT2800PCI
+ tristate "Ralink rt2800 (PCI/PCMCIA) support"
+ depends on (RT2800PCI_PCI || RT2800PCI_SOC) && EXPERIMENTAL
^^^^^^^^^
The same exists for RT2800USB....
> so there is no rush in merging it
> and you have a plenty of time to improve your code for the usual kernel
> standards (alternatively you may want consider submitting it for staging).
>
> Could you please start looking into addressing valid review comments?
Haven't I been answering all your points already?
> [ If you do not have a time for it, my offer to take over maintenance of
> rt2800 drivers is still actual.. ]
If I am going to hand over the maintainership to somebody else
(and don't worry I will in the near future), I will hand it over to somebody
who has experience with the rt2x00 driver (i.e. actually wrote code for
the drivers).
The second requirement is that the new maintainer needs to be interested
in _all_ rt2x00 drivers, and is willing to give the priority of the development
to those drivers rather then then staging drivers.
Ivo
^ permalink raw reply
* [PATCH] mac80211: fix ibss joining
From: Reinette Chatre @ 2009-10-19 21:55 UTC (permalink / raw)
To: johannes, linville; +Cc: linux-wireless, Reinette Chatre
From: Reinette Chatre <reinette.chatre@intel.com>
Recent commit "mac80211: fix logic error ibss merge bssid check" fixed
joining of ibss cell when static bssid is provided. In this case
ifibss->bssid is set before the cell is joined and comparing that address
to a bss should thus always succeed. Unfortunately this change broke the
other case of joining a ibss cell without providing a static bssid where
the value of ifibss->bssid is not set before the cell is joined.
Since ifibss->bssid may be set before or after joining the cell we do not
learn anything by comparing it to a known bss. Remove this check.
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
---
I tested this change with static bssid and without.
The symptom without this patch is that it is not possible to join an ad-hoc
cell unless you provide a bssid. When you want to join an existing cell a
new cell will be created.
net/mac80211/ibss.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 6eaf698..ca8ecce 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -538,13 +538,12 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
WLAN_CAPABILITY_PRIVACY,
capability);
+ if (bss) {
#ifdef CONFIG_MAC80211_IBSS_DEBUG
- if (bss)
printk(KERN_DEBUG " sta_find_ibss: selected %pM current "
"%pM\n", bss->cbss.bssid, ifibss->bssid);
#endif /* CONFIG_MAC80211_IBSS_DEBUG */
- if (bss && !memcmp(ifibss->bssid, bss->cbss.bssid, ETH_ALEN)) {
printk(KERN_DEBUG "%s: Selected IBSS BSSID %pM"
" based on configured SSID\n",
sdata->dev->name, bss->cbss.bssid);
@@ -552,8 +551,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
ieee80211_sta_join_ibss(sdata, bss);
ieee80211_rx_bss_put(local, bss);
return;
- } else if (bss)
- ieee80211_rx_bss_put(local, bss);
+ }
#ifdef CONFIG_MAC80211_IBSS_DEBUG
printk(KERN_DEBUG " did not try to join ibss\n");
--
1.5.6.3
^ permalink raw reply related
* Re: [PATCH] libertas: remove unused 11d code
From: Luis R. Rodriguez @ 2009-10-19 23:49 UTC (permalink / raw)
To: Holger Schurig; +Cc: linux-wireless, John Linville, Dan Williams
In-Reply-To: <200910191118.39975.hs4233@mail.mn-solutions.de>
On Mon, Oct 19, 2009 at 6:18 PM, Holger Schurig
<hs4233@mail.mn-solutions.de> wrote:
>> Is the countryinfo->countrycode not usable for
>> regulatory_hint_11d() ?
>
> I guess so, but the libertas+cfg80211 patch hasn't yet landed.
>
> And if it lands, it will have a WAY simpler 11d coding than
> before:
>
> 1. get the region code out of the EEPROM, convert it, call call
> regulatory_hint_11d().
>
> 2. no need to parse the scan result IE for a WLAN_EID_COUNTRY,
> because cfg80211 does this for us
>
> 3. no need to parse the association response either, because
> cfg80211 does this for us
>
> 4. no need to store special channel settings, because cfg80211
> does this for us
>
>
> At least this is how I understand it based on my current
> region-handling knowledge of cfg80211, which isn't too deep.
Sounds right.
Luis
^ permalink raw reply
* Re: How do you set the rate algorithm from the command line
From: Johannes Berg @ 2009-10-20 0:31 UTC (permalink / raw)
To: Charles Gordon; +Cc: linux-wireless
In-Reply-To: <86201b3f0910190850g3f014abbi9e2fa3f89463e7c6@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 574 bytes --]
On Mon, 2009-10-19 at 11:50 -0400, Charles Gordon wrote:
> Hi,
>
> I'm using mac80211 in an embedded system. I can build the driver so
> that more than one wifi rate algorithm is included, and one is set as
> the default. It is not clear to me how to set the rate algorithm at
> run time. Is there a command line utility that does this?
>
> Suppose I build the driver so that both the PID and Mistrel algorithms
> are included, and the Minstrel algorithm is the default. How can I
> switch to the PID algorithm at run time?
You cannot (yet).
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* Re: [RFC] libertas: monster-patch to make CFG/WEXT configurable
From: Johannes Berg @ 2009-10-20 0:33 UTC (permalink / raw)
To: Holger Schurig; +Cc: linux-wireless, Dan Williams
In-Reply-To: <200910191449.18915.hs4233@mail.mn-solutions.de>
[-- Attachment #1: Type: text/plain, Size: 1061 bytes --]
On Mon, 2009-10-19 at 14:49 +0200, Holger Schurig wrote:
> This is a monster patch that makes CFG80211/WEXT operation
> configurable. My cfg80211-RFC/WIP-Patch would come on top of it,
> but would then be quite small, e.g. almost only changed to
> cfg.c/cfg.h.
>
> As there's no mesh/adhoc/monitor mode implemented in cfg80211-
> mode, I added many, many #ifdef/#endif pairs. Maybe too many.
> Is this too ugly? Or would this patch be applyable as-is ?
>
> If the patch is perceived to be too ugly, I could create an
> monitor.h/monitor.c file and singleout everything related to
> monitoring in it, where monitor.h would resolv to dummy static
> functions in the cfg80211-case ... at least as long as we don't
> have monitor suppport in libertas+cfg80211. The same for mesh
> support, e.g. here I could create a mesh.h/mesh.c and do the
> same.
I really don't understand the point. Can't you just use the cfg80211
hooks and keep both functional at the same time? Just like orinoco does
-- it uses cfg80211 only partially.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* Re: wlan oops
From: Johannes Berg @ 2009-10-20 1:08 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linux-wireless, nbd
In-Reply-To: <1255916929.2139.1.camel@pasglop>
[-- Attachment #1: Type: text/plain, Size: 1666 bytes --]
On Mon, 2009-10-19 at 10:48 +0900, Benjamin Herrenschmidt wrote:
> [ 3698.908913] wlan0: Selected IBSS BSSID 22:48:99:ac:65:40 based on configured SSID
> [ 3698.932660] ------------[ cut here ]------------
> [ 3698.932701] WARNING: at net/wireless/scan.c:483 cfg80211_inform_bss_frame+0x151/0x190 [cfg80211]()
> [ 3698.932707] Hardware name: 7659AB8
> [ 3698.932711] Modules linked in: tun snd_hda_codec_analog snd_hda_intel snd_hda_codec binfmt_misc snd_pcm_oss snd_mixer_oss snd_pcm snd_seq_dummy snd_seq_oss snd_seq_midi snd_rawmidi arc4 snd_seq_midi_event ecb snd_seq snd_timer snd_seq_device pcmcia bridge iwlagn stp iptable_filter sdhci_pci ppdev snd iwlcore bnep ip_tables yenta_socket psmouse thinkpad_acpi sdhci soundcore mac80211 x_tables lp ricoh_mmc btusb rsrc_nonstatic pcmcia_core serio_raw led_class nvram snd_page_alloc cfg80211 parport fbcon tileblit font bitblit softcursor ohci1394 ieee1394 i915 e1000e drm i2c_algo_bit cfbcopyarea video output cfbimgblt cfbfillrect intel_agp
> [ 3698.932822] Pid: 1345, comm: iwlagn Not tainted 2.6.31.4-14-benh #1
> [ 3698.932827] Call Trace:
> [ 3698.932875] [<ffffffffa012a4b1>] cfg80211_inform_bss_frame+0x151/0x190 [cfg80211]
> [ 3698.932916] [<ffffffffa01a3cc4>] __ieee80211_sta_join_ibss+0x384/0x460 [mac80211]
> [ 3698.932944] [<ffffffffa01a427e>] ieee80211_sta_find_ibss+0x4de/0x4f0 [mac80211]
> [ 3698.932971] [<ffffffffa01a4303>] ieee80211_ibss_notify_scan_completed+0x73/0xa0 [mac80211]
> [ 3698.932997] [<ffffffffa01a0bc9>] ieee80211_scan_completed+0xc9/0x470 [mac80211]
This actually seems to be a bug in mac80211, not just random weird
frames being received.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* Re: [PATCH net-next V2 1/3] iwmc3200top: Add Intel Wireless MultiCom 3200 top driver.
From: David Miller @ 2009-10-20 4:54 UTC (permalink / raw)
To: tomas.winkler
Cc: linville, netdev, linux-wireless, linux-mmc, yi.zhu,
inaky.perez-gonzalez, cindy.h.kao, guy.cohen, ron.rindjunsky
In-Reply-To: <1255806576-26869-1-git-send-email-tomas.winkler@intel.com>
From: Tomas Winkler <tomas.winkler@intel.com>
Date: Sat, 17 Oct 2009 21:09:34 +0200
> This patch adds Intel Wireless MultiCom 3200 top driver.
> IWMC3200 is 4Wireless Com CHIP (GPS/BT/WiFi/WiMAX).
> Top driver is responsible for device initialization and firmware download.
> Firmware handled by top is responsible for top itself and
> as well as bluetooth and GPS coms. (Wifi and WiMax provide their own firmware)
> In addition top driver is used to retrieve firmware logs
> and supports other debugging features
>
> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Applied to net-next-2.6
^ permalink raw reply
* Re: [PATCH net-next V2 2/3] iwmc3200wifi: select IWMC3200TOP in Kconfig
From: David Miller @ 2009-10-20 4:55 UTC (permalink / raw)
To: tomas.winkler
Cc: linville, netdev, linux-wireless, linux-mmc, yi.zhu,
inaky.perez-gonzalez, cindy.h.kao, guy.cohen, ron.rindjunsky
In-Reply-To: <1255806576-26869-2-git-send-email-tomas.winkler@intel.com>
From: Tomas Winkler <tomas.winkler@intel.com>
Date: Sat, 17 Oct 2009 21:09:35 +0200
> iwmc3200wifi requires iwmc3200top for its operation
>
> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
> Acked-by: Zhu Yi <yi.zhu@intel.com>
Applied to net-next-2.6
^ permalink raw reply
* Re: [PATCH net-next V2 3/3] i2400m-sdio: select IWMC3200TOP in Kconfig
From: David Miller @ 2009-10-20 4:55 UTC (permalink / raw)
To: tomas.winkler
Cc: linville, netdev, linux-wireless, linux-mmc, yi.zhu,
inaky.perez-gonzalez, cindy.h.kao, guy.cohen, ron.rindjunsky
In-Reply-To: <1255806576-26869-3-git-send-email-tomas.winkler@intel.com>
From: Tomas Winkler <tomas.winkler@intel.com>
Date: Sat, 17 Oct 2009 21:09:36 +0200
> i2400m-sdio requires iwmc3200top for its operation
>
> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
> Acked-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Applied to net-next-2.6, thanks!
^ permalink raw reply
* [PATCH] mac80211: keep auth state when assoc fails
From: Johannes Berg @ 2009-10-20 6:08 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless, Luis R. Rodriguez
When association fails, we should stay authenticated,
which in mac80211 is represented by the existence of
the mlme work struct, so we cannot free that, instead
we need to just set it to idle.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
net/mac80211/mlme.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- wireless-testing.orig/net/mac80211/mlme.c 2009-10-20 15:01:40.000000000 +0900
+++ wireless-testing/net/mac80211/mlme.c 2009-10-20 15:01:46.000000000 +0900
@@ -1457,8 +1457,7 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee
if (status_code != WLAN_STATUS_SUCCESS) {
printk(KERN_DEBUG "%s: AP denied association (code=%d)\n",
sdata->dev->name, status_code);
- list_del(&wk->list);
- kfree(wk);
+ wk->state = IEEE80211_MGD_STATE_IDLE;
return RX_MGMT_CFG80211_ASSOC;
}
^ permalink raw reply
* [PATCH] cfg80211: sme: deauthenticate on assoc failure
From: Johannes Berg @ 2009-10-20 6:08 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless, Luis R. Rodriguez
When the in-kernel SME gets an association failure from
the AP we don't deauthenticate, and thus get into a very
confused state which will lead to warnings later on. Fix
this by actually deauthenticating when the AP indicates
an association failure.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
net/wireless/core.h | 1 +
net/wireless/mlme.c | 9 +++++++++
net/wireless/sme.c | 21 +++++++++++++++++++--
3 files changed, 29 insertions(+), 2 deletions(-)
--- wireless-testing.orig/net/wireless/core.h 2009-10-20 15:02:15.000000000 +0900
+++ wireless-testing/net/wireless/core.h 2009-10-20 15:03:20.000000000 +0900
@@ -358,6 +358,7 @@ int cfg80211_mgd_wext_connect(struct cfg
struct wireless_dev *wdev);
void cfg80211_conn_work(struct work_struct *work);
+void cfg80211_sme_failed_assoc(struct wireless_dev *wdev);
bool cfg80211_sme_failed_reassoc(struct wireless_dev *wdev);
/* internal helpers */
--- wireless-testing.orig/net/wireless/mlme.c 2009-10-20 15:02:15.000000000 +0900
+++ wireless-testing/net/wireless/mlme.c 2009-10-20 15:03:20.000000000 +0900
@@ -62,6 +62,7 @@ void cfg80211_send_rx_assoc(struct net_d
u8 *ie = mgmt->u.assoc_resp.variable;
int i, ieoffs = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable);
struct cfg80211_internal_bss *bss = NULL;
+ bool need_connect_result = true;
wdev_lock(wdev);
@@ -94,6 +95,14 @@ void cfg80211_send_rx_assoc(struct net_d
}
WARN_ON(!bss);
+ } else if (wdev->conn) {
+ cfg80211_sme_failed_assoc(wdev);
+ need_connect_result = false;
+ /*
+ * do not call connect_result() now because the
+ * sme will schedule work that does it later.
+ */
+ goto out;
}
if (!wdev->conn && wdev->sme_state == CFG80211_SME_IDLE) {
--- wireless-testing.orig/net/wireless/sme.c 2009-10-20 15:02:15.000000000 +0900
+++ wireless-testing/net/wireless/sme.c 2009-10-20 15:03:20.000000000 +0900
@@ -26,6 +26,7 @@ struct cfg80211_conn {
CFG80211_CONN_AUTHENTICATING,
CFG80211_CONN_ASSOCIATE_NEXT,
CFG80211_CONN_ASSOCIATING,
+ CFG80211_CONN_DEAUTH_ASSOC_FAIL,
} state;
u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
u8 *ie;
@@ -148,6 +149,12 @@ static int cfg80211_conn_do_work(struct
NULL, 0,
WLAN_REASON_DEAUTH_LEAVING);
return err;
+ case CFG80211_CONN_DEAUTH_ASSOC_FAIL:
+ __cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid,
+ NULL, 0,
+ WLAN_REASON_DEAUTH_LEAVING);
+ /* return an error so that we call __cfg80211_connect_result() */
+ return -EINVAL;
default:
return 0;
}
@@ -158,6 +165,7 @@ void cfg80211_conn_work(struct work_stru
struct cfg80211_registered_device *rdev =
container_of(work, struct cfg80211_registered_device, conn_work);
struct wireless_dev *wdev;
+ u8 bssid[ETH_ALEN];
rtnl_lock();
cfg80211_lock_rdev(rdev);
@@ -173,10 +181,10 @@ void cfg80211_conn_work(struct work_stru
wdev_unlock(wdev);
continue;
}
+ memcpy(bssid, wdev->conn->params.bssid, ETH_ALEN);
if (cfg80211_conn_do_work(wdev))
__cfg80211_connect_result(
- wdev->netdev,
- wdev->conn->params.bssid,
+ wdev->netdev, bssid,
NULL, 0, NULL, 0,
WLAN_STATUS_UNSPECIFIED_FAILURE,
false, NULL);
@@ -337,6 +345,15 @@ bool cfg80211_sme_failed_reassoc(struct
return true;
}
+void cfg80211_sme_failed_assoc(struct wireless_dev *wdev)
+{
+ struct wiphy *wiphy = wdev->wiphy;
+ struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
+
+ wdev->conn->state = CFG80211_CONN_DEAUTH_ASSOC_FAIL;
+ schedule_work(&rdev->conn_work);
+}
+
void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
const u8 *req_ie, size_t req_ie_len,
const u8 *resp_ie, size_t resp_ie_len,
^ permalink raw reply
* Re: [PATCH] cfg80211: sme: deauthenticate on assoc failure
From: Luis R. Rodriguez @ 2009-10-20 6:24 UTC (permalink / raw)
To: Johannes Berg; +Cc: John Linville, linux-wireless
In-Reply-To: <1256018933.4475.6.camel@johannes.local>
On Tue, Oct 20, 2009 at 3:08 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> When the in-kernel SME gets an association failure from
> the AP we don't deauthenticate, and thus get into a very
> confused state which will lead to warnings later on. Fix
> this by actually deauthenticating when the AP indicates
> an association failure.
>
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Thanks Johannes.
Tested-by: Luis R. Rodriguez <lrodriguez@atheros.com>
John -- this patch and the previous patch titled "mac80211: keep auth
state when assoc fails" fix the SME warning as well. These are also
2.6.32-rc fixes.
Luis
^ permalink raw reply
* Re: [PATCH] cfg80211: sme: deauthenticate on assoc failure
From: Johannes Berg @ 2009-10-20 6:26 UTC (permalink / raw)
To: Luis R. Rodriguez; +Cc: John Linville, linux-wireless
In-Reply-To: <43e72e890910192324t3deab484nad855a5ecd109dd@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 807 bytes --]
On Tue, 2009-10-20 at 15:24 +0900, Luis R. Rodriguez wrote:
> On Tue, Oct 20, 2009 at 3:08 PM, Johannes Berg
> <johannes@sipsolutions.net> wrote:
> > When the in-kernel SME gets an association failure from
> > the AP we don't deauthenticate, and thus get into a very
> > confused state which will lead to warnings later on. Fix
> > this by actually deauthenticating when the AP indicates
> > an association failure.
> >
> > Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
>
> Thanks Johannes.
>
> Tested-by: Luis R. Rodriguez <lrodriguez@atheros.com>
>
> John -- this patch and the previous patch titled "mac80211: keep auth
> state when assoc fails" fix the SME warning as well. These are also
> 2.6.32-rc fixes.
And also done during the hacking session at KS.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox