Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH v3 04/18] wl1271: AP-mode high level commands
From: Arik Nemtsov @ 2010-12-28 17:36 UTC (permalink / raw)
  To: linux-wireless; +Cc: Luciano Coelho, Arik Nemtsov
In-Reply-To: <1293557808-27068-1-git-send-email-arik@wizery.com>

Add commands to start/stop BSS, add/remove STA and configure encryption
keys. Split the encryption commands "set key" and "set default key" into
AP and STA specific versions.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
---
 drivers/net/wireless/wl12xx/cmd.c    |  276 +++++++++++++++++++++++++++++++++-
 drivers/net/wireless/wl12xx/cmd.h    |  139 ++++++++++++++++-
 drivers/net/wireless/wl12xx/init.c   |    2 +-
 drivers/net/wireless/wl12xx/main.c   |    6 +-
 drivers/net/wireless/wl12xx/tx.c     |    2 +-
 drivers/net/wireless/wl12xx/wl12xx.h |    8 +
 6 files changed, 419 insertions(+), 14 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/cmd.c b/drivers/net/wireless/wl12xx/cmd.c
index 15f4077..eb723f0 100644
--- a/drivers/net/wireless/wl12xx/cmd.c
+++ b/drivers/net/wireless/wl12xx/cmd.c
@@ -36,6 +36,7 @@
 #include "wl12xx_80211.h"
 #include "cmd.h"
 #include "event.h"
+#include "tx.h"
 
 #define WL1271_CMD_FAST_POLL_COUNT       50
 
@@ -702,9 +703,9 @@ int wl1271_build_qos_null_data(struct wl1271 *wl)
 				       wl->basic_rate);
 }
 
-int wl1271_cmd_set_default_wep_key(struct wl1271 *wl, u8 id)
+int wl1271_cmd_set_sta_default_wep_key(struct wl1271 *wl, u8 id)
 {
-	struct wl1271_cmd_set_keys *cmd;
+	struct wl1271_cmd_set_sta_keys *cmd;
 	int ret = 0;
 
 	wl1271_debug(DEBUG_CMD, "cmd set_default_wep_key %d", id);
@@ -731,11 +732,42 @@ out:
 	return ret;
 }
 
-int wl1271_cmd_set_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
+int wl1271_cmd_set_ap_default_wep_key(struct wl1271 *wl, u8 id)
+{
+	struct wl1271_cmd_set_ap_keys *cmd;
+	int ret = 0;
+
+	wl1271_debug(DEBUG_CMD, "cmd set_ap_default_wep_key %d", id);
+
+	cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
+	if (!cmd) {
+		ret = -ENOMEM;
+		goto out;
+	}
+
+	cmd->hlid = WL1271_AP_BROADCAST_HLID;
+	cmd->key_id = id;
+	cmd->lid_key_type = WEP_DEFAULT_LID_TYPE;
+	cmd->key_action = cpu_to_le16(KEY_SET_ID);
+	cmd->key_type = KEY_WEP;
+
+	ret = wl1271_cmd_send(wl, CMD_SET_KEYS, cmd, sizeof(*cmd), 0);
+	if (ret < 0) {
+		wl1271_warning("cmd set_ap_default_wep_key failed: %d", ret);
+		goto out;
+	}
+
+out:
+	kfree(cmd);
+
+	return ret;
+}
+
+int wl1271_cmd_set_sta_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
 		       u8 key_size, const u8 *key, const u8 *addr,
 		       u32 tx_seq_32, u16 tx_seq_16)
 {
-	struct wl1271_cmd_set_keys *cmd;
+	struct wl1271_cmd_set_sta_keys *cmd;
 	int ret = 0;
 
 	cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
@@ -788,6 +820,67 @@ out:
 	return ret;
 }
 
+int wl1271_cmd_set_ap_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
+			u8 key_size, const u8 *key, u8 hlid, u32 tx_seq_32,
+			u16 tx_seq_16)
+{
+	struct wl1271_cmd_set_ap_keys *cmd;
+	int ret = 0;
+	u8 lid_type;
+
+	cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
+	if (!cmd)
+		return -ENOMEM;
+
+	if (hlid == WL1271_AP_BROADCAST_HLID) {
+		if (key_type == KEY_WEP)
+			lid_type = WEP_DEFAULT_LID_TYPE;
+		else
+			lid_type = BROADCAST_LID_TYPE;
+	} else {
+		lid_type = UNICAST_LID_TYPE;
+	}
+
+	wl1271_debug(DEBUG_CRYPT, "ap key action: %d id: %d lid: %d type: %d"
+		     " hlid: %d", (int)action, (int)id, (int)lid_type,
+		     (int)key_type, (int)hlid);
+
+	cmd->lid_key_type = lid_type;
+	cmd->hlid = hlid;
+	cmd->key_action = cpu_to_le16(action);
+	cmd->key_size = key_size;
+	cmd->key_type = key_type;
+	cmd->key_id = id;
+	cmd->ac_seq_num16[0] = cpu_to_le16(tx_seq_16);
+	cmd->ac_seq_num32[0] = cpu_to_le32(tx_seq_32);
+
+	if (key_type == KEY_TKIP) {
+		/*
+		 * We get the key in the following form:
+		 * TKIP (16 bytes) - TX MIC (8 bytes) - RX MIC (8 bytes)
+		 * but the target is expecting:
+		 * TKIP - RX MIC - TX MIC
+		 */
+		memcpy(cmd->key, key, 16);
+		memcpy(cmd->key + 16, key + 24, 8);
+		memcpy(cmd->key + 24, key + 16, 8);
+	} else {
+		memcpy(cmd->key, key, key_size);
+	}
+
+	wl1271_dump(DEBUG_CRYPT, "TARGET AP KEY: ", cmd, sizeof(*cmd));
+
+	ret = wl1271_cmd_send(wl, CMD_SET_KEYS, cmd, sizeof(*cmd), 0);
+	if (ret < 0) {
+		wl1271_warning("could not set ap keys");
+		goto out;
+	}
+
+out:
+	kfree(cmd);
+	return ret;
+}
+
 int wl1271_cmd_disconnect(struct wl1271 *wl)
 {
 	struct wl1271_cmd_disconnect *cmd;
@@ -850,3 +943,178 @@ out_free:
 out:
 	return ret;
 }
+
+int wl1271_cmd_start_bss(struct wl1271 *wl)
+{
+	struct wl1271_cmd_bss_start *cmd;
+	struct ieee80211_bss_conf *bss_conf = &wl->vif->bss_conf;
+	int ret;
+
+	wl1271_debug(DEBUG_CMD, "cmd start bss");
+
+	/*
+	 * FIXME: We currently do not support hidden SSID. The real SSID
+	 * should be fetched from mac80211 first.
+	 */
+	if (wl->ssid_len == 0) {
+		wl1271_warning("Hidden SSID currently not supported for AP");
+		ret = -EINVAL;
+		goto out;
+	}
+
+	cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
+	if (!cmd) {
+		ret = -ENOMEM;
+		goto out;
+	}
+
+	memcpy(cmd->bssid, bss_conf->bssid, ETH_ALEN);
+
+	cmd->aging_period = WL1271_AP_DEF_INACTIV_SEC;
+	cmd->bss_index = WL1271_AP_BSS_INDEX;
+	cmd->global_hlid = WL1271_AP_GLOBAL_HLID;
+	cmd->broadcast_hlid = WL1271_AP_BROADCAST_HLID;
+	cmd->basic_rate_set = cpu_to_le32(wl->basic_rate_set);
+	cmd->beacon_interval = cpu_to_le16(wl->beacon_int);
+	cmd->dtim_interval = bss_conf->dtim_period;
+	cmd->beacon_expiry = WL1271_AP_DEF_BEACON_EXP;
+	cmd->channel = wl->channel;
+	cmd->ssid_len = wl->ssid_len;
+	cmd->ssid_type = SSID_TYPE_PUBLIC;
+	memcpy(cmd->ssid, wl->ssid, wl->ssid_len);
+
+	switch (wl->band) {
+	case IEEE80211_BAND_2GHZ:
+		cmd->band = RADIO_BAND_2_4GHZ;
+		break;
+	case IEEE80211_BAND_5GHZ:
+		cmd->band = RADIO_BAND_5GHZ;
+		break;
+	default:
+		wl1271_warning("bss start - unknown band: %d", (int)wl->band);
+		cmd->band = RADIO_BAND_2_4GHZ;
+		break;
+	}
+
+	ret = wl1271_cmd_send(wl, CMD_BSS_START, cmd, sizeof(*cmd), 0);
+	if (ret < 0) {
+		wl1271_error("failed to initiate cmd start bss");
+		goto out_free;
+	}
+
+out_free:
+	kfree(cmd);
+
+out:
+	return ret;
+}
+
+int wl1271_cmd_stop_bss(struct wl1271 *wl)
+{
+	struct wl1271_cmd_bss_start *cmd;
+	int ret;
+
+	wl1271_debug(DEBUG_CMD, "cmd stop bss");
+
+	cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
+	if (!cmd) {
+		ret = -ENOMEM;
+		goto out;
+	}
+
+	cmd->bss_index = WL1271_AP_BSS_INDEX;
+
+	ret = wl1271_cmd_send(wl, CMD_BSS_STOP, cmd, sizeof(*cmd), 0);
+	if (ret < 0) {
+		wl1271_error("failed to initiate cmd stop bss");
+		goto out_free;
+	}
+
+out_free:
+	kfree(cmd);
+
+out:
+	return ret;
+}
+
+int wl1271_cmd_add_sta(struct wl1271 *wl, struct ieee80211_sta *sta, u8 hlid)
+{
+	struct wl1271_cmd_add_sta *cmd;
+	int ret;
+
+	wl1271_debug(DEBUG_CMD, "cmd add sta %d", (int)hlid);
+
+	cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
+	if (!cmd) {
+		ret = -ENOMEM;
+		goto out;
+	}
+
+	/* currently we don't support UAPSD */
+	cmd->sp_len = 0;
+
+	memcpy(cmd->addr, sta->addr, ETH_ALEN);
+	cmd->bss_index = WL1271_AP_BSS_INDEX;
+	cmd->aid = sta->aid;
+	cmd->hlid = hlid;
+
+	/*
+	 * FIXME: Does STA support QOS? We need to propagate this info from
+	 * hostapd. Currently not that important since this is only used for
+	 * sending the correct flavor of null-data packet in response to a
+	 * trigger.
+	 */
+	cmd->wmm = 0;
+
+	cmd->supported_rates = cpu_to_le32(wl1271_tx_enabled_rates_get(wl,
+						sta->supp_rates[wl->band]));
+
+	wl1271_debug(DEBUG_CMD, "new sta rates: 0x%x", cmd->supported_rates);
+
+	ret = wl1271_cmd_send(wl, CMD_ADD_STA, cmd, sizeof(*cmd), 0);
+	if (ret < 0) {
+		wl1271_error("failed to initiate cmd add sta");
+		goto out_free;
+	}
+
+out_free:
+	kfree(cmd);
+
+out:
+	return ret;
+}
+
+int wl1271_cmd_remove_sta(struct wl1271 *wl, u8 hlid)
+{
+	struct wl1271_cmd_remove_sta *cmd;
+	int ret;
+
+	wl1271_debug(DEBUG_CMD, "cmd remove sta %d", (int)hlid);
+
+	cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
+	if (!cmd) {
+		ret = -ENOMEM;
+		goto out;
+	}
+
+	cmd->hlid = hlid;
+	/* We never send a deauth, mac80211 is in charge of this */
+	cmd->reason_opcode = 0;
+	cmd->send_deauth_flag = 0;
+
+	ret = wl1271_cmd_send(wl, CMD_REMOVE_STA, cmd, sizeof(*cmd), 0);
+	if (ret < 0) {
+		wl1271_error("failed to initiate cmd remove sta");
+		goto out_free;
+	}
+
+	ret = wl1271_cmd_wait_for_event(wl, STA_REMOVE_COMPLETE_EVENT_ID);
+	if (ret < 0)
+		wl1271_error("cmd remove sta event completion error");
+
+out_free:
+	kfree(cmd);
+
+out:
+	return ret;
+}
diff --git a/drivers/net/wireless/wl12xx/cmd.h b/drivers/net/wireless/wl12xx/cmd.h
index 2a1d9db..072bf3c 100644
--- a/drivers/net/wireless/wl12xx/cmd.h
+++ b/drivers/net/wireless/wl12xx/cmd.h
@@ -54,12 +54,20 @@ struct sk_buff *wl1271_cmd_build_ap_probe_req(struct wl1271 *wl,
 int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, __be32 ip_addr);
 int wl1271_build_qos_null_data(struct wl1271 *wl);
 int wl1271_cmd_build_klv_null_data(struct wl1271 *wl);
-int wl1271_cmd_set_default_wep_key(struct wl1271 *wl, u8 id);
-int wl1271_cmd_set_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
-		       u8 key_size, const u8 *key, const u8 *addr,
-		       u32 tx_seq_32, u16 tx_seq_16);
+int wl1271_cmd_set_sta_default_wep_key(struct wl1271 *wl, u8 id);
+int wl1271_cmd_set_ap_default_wep_key(struct wl1271 *wl, u8 id);
+int wl1271_cmd_set_sta_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
+			   u8 key_size, const u8 *key, const u8 *addr,
+			   u32 tx_seq_32, u16 tx_seq_16);
+int wl1271_cmd_set_ap_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type,
+			  u8 key_size, const u8 *key, u8 hlid, u32 tx_seq_32,
+			  u16 tx_seq_16);
 int wl1271_cmd_disconnect(struct wl1271 *wl);
 int wl1271_cmd_set_sta_state(struct wl1271 *wl);
+int wl1271_cmd_start_bss(struct wl1271 *wl);
+int wl1271_cmd_stop_bss(struct wl1271 *wl);
+int wl1271_cmd_add_sta(struct wl1271 *wl, struct ieee80211_sta *sta, u8 hlid);
+int wl1271_cmd_remove_sta(struct wl1271 *wl, u8 hlid);
 
 enum wl1271_commands {
 	CMD_INTERROGATE     = 1,    /*use this to read information elements*/
@@ -98,6 +106,12 @@ enum wl1271_commands {
 	CMD_STOP_PERIODIC_SCAN       = 51,
 	CMD_SET_STA_STATE            = 52,
 
+	/* AP mode commands */
+	CMD_BSS_START                = 60,
+	CMD_BSS_STOP                 = 61,
+	CMD_ADD_STA                  = 62,
+	CMD_REMOVE_STA               = 63,
+
 	NUM_COMMANDS,
 	MAX_COMMAND_ID = 0xFFFF,
 };
@@ -289,7 +303,7 @@ enum wl1271_cmd_key_type {
 
 /* FIXME: Add description for key-types */
 
-struct wl1271_cmd_set_keys {
+struct wl1271_cmd_set_sta_keys {
 	struct wl1271_cmd_header header;
 
 	/* Ignored for default WEP key */
@@ -318,6 +332,57 @@ struct wl1271_cmd_set_keys {
 	__le32 ac_seq_num32[NUM_ACCESS_CATEGORIES_COPY];
 } __packed;
 
+enum wl1271_cmd_lid_key_type {
+	UNICAST_LID_TYPE     = 0,
+	BROADCAST_LID_TYPE   = 1,
+	WEP_DEFAULT_LID_TYPE = 2
+};
+
+struct wl1271_cmd_set_ap_keys {
+	struct wl1271_cmd_header header;
+
+	/*
+	 * Indicates whether the HLID is a unicast key set
+	 * or broadcast key set. A special value 0xFF is
+	 * used to indicate that the HLID is on WEP-default
+	 * (multi-hlids). of type wl1271_cmd_lid_key_type.
+	 */
+	u8 hlid;
+
+	/*
+	 * In WEP-default network (hlid == 0xFF) used to
+	 * indicate which network STA/IBSS/AP role should be
+	 * changed
+	 */
+	u8 lid_key_type;
+
+	/*
+	 * Key ID - For TKIP and AES key types, this field
+	 * indicates the value that should be inserted into
+	 * the KeyID field of frames transmitted using this
+	 * key entry. For broadcast keys the index use as a
+	 * marker for TX/RX key.
+	 * For WEP default network (HLID=0xFF), this field
+	 * indicates the ID of the key to add or remove.
+	 */
+	u8 key_id;
+	u8 reserved_1;
+
+	/* key_action_e */
+	__le16 key_action;
+
+	/* key size in bytes */
+	u8 key_size;
+
+	/* key_type_e */
+	u8 key_type;
+
+	/* This field holds the security key data to add to the STA table */
+	u8 key[MAX_KEY_SIZE];
+	__le16 ac_seq_num16[NUM_ACCESS_CATEGORIES_COPY];
+	__le32 ac_seq_num32[NUM_ACCESS_CATEGORIES_COPY];
+} __packed;
+
 struct wl1271_cmd_test_header {
 	u8 id;
 	u8 padding[3];
@@ -412,4 +477,68 @@ struct wl1271_cmd_set_sta_state {
 	u8 padding[3];
 } __packed;
 
+enum wl1271_ssid_type {
+	SSID_TYPE_PUBLIC = 0,
+	SSID_TYPE_HIDDEN = 1
+};
+
+struct wl1271_cmd_bss_start {
+	struct wl1271_cmd_header header;
+
+	/* wl1271_ssid_type */
+	u8 ssid_type;
+	u8 ssid_len;
+	u8 ssid[IW_ESSID_MAX_SIZE];
+	u8 padding_1[2];
+
+	/* Basic rate set */
+	__le32 basic_rate_set;
+	/* Aging period in seconds*/
+	__le16 aging_period;
+
+	/*
+	 * This field specifies the time between target beacon
+	 * transmission times (TBTTs), in time units (TUs).
+	 * Valid values are 1 to 1024.
+	 */
+	__le16 beacon_interval;
+	u8 bssid[ETH_ALEN];
+	u8 bss_index;
+	/* Radio band */
+	u8 band;
+	u8 channel;
+	/* The host link id for the AP's global queue */
+	u8 global_hlid;
+	/* The host link id for the AP's broadcast queue */
+	u8 broadcast_hlid;
+	/* DTIM count */
+	u8 dtim_interval;
+	/* Beacon expiry time in ms */
+	u8 beacon_expiry;
+	u8 padding_2[3];
+} __packed;
+
+struct wl1271_cmd_add_sta {
+	struct wl1271_cmd_header header;
+
+	u8 addr[ETH_ALEN];
+	u8 hlid;
+	u8 aid;
+	u8 psd_type[NUM_ACCESS_CATEGORIES_COPY];
+	__le32 supported_rates;
+	u8 bss_index;
+	u8 sp_len;
+	u8 wmm;
+	u8 padding1;
+} __packed;
+
+struct wl1271_cmd_remove_sta {
+	struct wl1271_cmd_header header;
+
+	u8 hlid;
+	u8 reason_opcode;
+	u8 send_deauth_flag;
+	u8 padding1;
+} __packed;
+
 #endif /* __WL1271_CMD_H__ */
diff --git a/drivers/net/wireless/wl12xx/init.c b/drivers/net/wireless/wl12xx/init.c
index f468d71..799c369 100644
--- a/drivers/net/wireless/wl12xx/init.c
+++ b/drivers/net/wireless/wl12xx/init.c
@@ -41,7 +41,7 @@ static int wl1271_init_hwenc_config(struct wl1271 *wl)
 		return ret;
 	}
 
-	ret = wl1271_cmd_set_default_wep_key(wl, wl->default_key);
+	ret = wl1271_cmd_set_sta_default_wep_key(wl, wl->default_key);
 	if (ret < 0) {
 		wl1271_warning("couldn't set default key");
 		return ret;
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index b40568e..9785b4c 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -1712,7 +1712,7 @@ static int wl1271_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 
 	switch (cmd) {
 	case SET_KEY:
-		ret = wl1271_cmd_set_key(wl, KEY_ADD_OR_REPLACE,
+		ret = wl1271_cmd_set_sta_key(wl, KEY_ADD_OR_REPLACE,
 					 key_conf->keyidx, key_type,
 					 key_conf->keylen, key_conf->key,
 					 addr, tx_seq_32, tx_seq_16);
@@ -1723,7 +1723,7 @@ static int wl1271_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 
 		/* the default WEP key needs to be configured at least once */
 		if (key_type == KEY_WEP) {
-			ret = wl1271_cmd_set_default_wep_key(wl,
+			ret = wl1271_cmd_set_sta_default_wep_key(wl,
 							     wl->default_key);
 			if (ret < 0)
 				goto out_sleep;
@@ -1738,7 +1738,7 @@ static int wl1271_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 		if (!is_broadcast_ether_addr(addr))
 			break;
 
-		ret = wl1271_cmd_set_key(wl, KEY_REMOVE,
+		ret = wl1271_cmd_set_sta_key(wl, KEY_REMOVE,
 					 key_conf->keyidx, key_type,
 					 key_conf->keylen, key_conf->key,
 					 addr, 0, 0);
diff --git a/drivers/net/wireless/wl12xx/tx.c b/drivers/net/wireless/wl12xx/tx.c
index 0cf210d..442a7bd 100644
--- a/drivers/net/wireless/wl12xx/tx.c
+++ b/drivers/net/wireless/wl12xx/tx.c
@@ -170,7 +170,7 @@ static int wl1271_prepare_tx_frame(struct wl1271 *wl, struct sk_buff *skb,
 
 		/* FIXME: do we have to do this if we're not using WEP? */
 		if (unlikely(wl->default_key != idx)) {
-			ret = wl1271_cmd_set_default_wep_key(wl, idx);
+			ret = wl1271_cmd_set_sta_default_wep_key(wl, idx);
 			if (ret < 0)
 				return ret;
 			wl->default_key = idx;
diff --git a/drivers/net/wireless/wl12xx/wl12xx.h b/drivers/net/wireless/wl12xx/wl12xx.h
index 01711fe..aba8f47 100644
--- a/drivers/net/wireless/wl12xx/wl12xx.h
+++ b/drivers/net/wireless/wl12xx/wl12xx.h
@@ -129,6 +129,14 @@ extern u32 wl12xx_debug_level;
 #define WL1271_DEFAULT_BEACON_INT  100
 #define WL1271_DEFAULT_DTIM_PERIOD 1
 
+#define WL1271_AP_GLOBAL_HLID      0
+#define WL1271_AP_BROADCAST_HLID   1
+#define WL1271_AP_STA_HLID_START   2
+
+#define WL1271_AP_BSS_INDEX        0
+#define WL1271_AP_DEF_INACTIV_SEC  300
+#define WL1271_AP_DEF_BEACON_EXP   20
+
 #define ACX_TX_DESCRIPTORS         32
 
 #define WL1271_AGGR_BUFFER_SIZE (4 * PAGE_SIZE)
-- 
1.7.1


^ permalink raw reply related

* [PATCH v3 03/18] wl1271: AP mode - add AP specific event
From: Arik Nemtsov @ 2010-12-28 17:36 UTC (permalink / raw)
  To: linux-wireless; +Cc: Luciano Coelho, Arik Nemtsov
In-Reply-To: <1293557808-27068-1-git-send-email-arik@wizery.com>

Add STA-remove completion event. Unmask it during boot if operating in
AP-mode.
Ignore unrelated events in AP-mode.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
---
 drivers/net/wireless/wl12xx/boot.c  |    3 +++
 drivers/net/wireless/wl12xx/event.c |    7 ++++---
 drivers/net/wireless/wl12xx/event.h |    1 +
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/boot.c b/drivers/net/wireless/wl12xx/boot.c
index 4a9f929..bb4f283 100644
--- a/drivers/net/wireless/wl12xx/boot.c
+++ b/drivers/net/wireless/wl12xx/boot.c
@@ -432,6 +432,9 @@ static int wl1271_boot_run_firmware(struct wl1271 *wl)
 		PSPOLL_DELIVERY_FAILURE_EVENT_ID |
 		SOFT_GEMINI_SENSE_EVENT_ID;
 
+	if (wl->bss_type == BSS_TYPE_AP_BSS)
+		wl->event_mask |= STA_REMOVE_COMPLETE_EVENT_ID;
+
 	ret = wl1271_event_unmask(wl);
 	if (ret < 0) {
 		wl1271_error("EVENT mask setting failed");
diff --git a/drivers/net/wireless/wl12xx/event.c b/drivers/net/wireless/wl12xx/event.c
index f9146f5..3376a5d 100644
--- a/drivers/net/wireless/wl12xx/event.c
+++ b/drivers/net/wireless/wl12xx/event.c
@@ -186,6 +186,7 @@ static int wl1271_event_process(struct wl1271 *wl, struct event_mailbox *mbox)
 	int ret;
 	u32 vector;
 	bool beacon_loss = false;
+	bool is_ap = (wl->bss_type == BSS_TYPE_AP_BSS);
 
 	wl1271_event_mbox_dump(mbox);
 
@@ -218,21 +219,21 @@ static int wl1271_event_process(struct wl1271 *wl, struct event_mailbox *mbox)
 	 * BSS_LOSE_EVENT, beacon loss has to be reported to the stack.
 	 *
 	 */
-	if (vector & BSS_LOSE_EVENT_ID) {
+	if ((vector & BSS_LOSE_EVENT_ID) && !is_ap) {
 		wl1271_info("Beacon loss detected.");
 
 		/* indicate to the stack, that beacons have been lost */
 		beacon_loss = true;
 	}
 
-	if (vector & PS_REPORT_EVENT_ID) {
+	if ((vector & PS_REPORT_EVENT_ID) && !is_ap) {
 		wl1271_debug(DEBUG_EVENT, "PS_REPORT_EVENT");
 		ret = wl1271_event_ps_report(wl, mbox, &beacon_loss);
 		if (ret < 0)
 			return ret;
 	}
 
-	if (vector & PSPOLL_DELIVERY_FAILURE_EVENT_ID)
+	if ((vector & PSPOLL_DELIVERY_FAILURE_EVENT_ID) && !is_ap)
 		wl1271_event_pspoll_delivery_fail(wl);
 
 	if (vector & RSSI_SNR_TRIGGER_0_EVENT_ID) {
diff --git a/drivers/net/wireless/wl12xx/event.h b/drivers/net/wireless/wl12xx/event.h
index 6cce014..fd955f3 100644
--- a/drivers/net/wireless/wl12xx/event.h
+++ b/drivers/net/wireless/wl12xx/event.h
@@ -59,6 +59,7 @@ enum {
 	BSS_LOSE_EVENT_ID			 = BIT(18),
 	REGAINED_BSS_EVENT_ID			 = BIT(19),
 	ROAMING_TRIGGER_MAX_TX_RETRY_EVENT_ID	 = BIT(20),
+	STA_REMOVE_COMPLETE_EVENT_ID		 = BIT(21), /* AP */
 	SOFT_GEMINI_SENSE_EVENT_ID		 = BIT(22),
 	SOFT_GEMINI_PREDICTION_EVENT_ID		 = BIT(23),
 	SOFT_GEMINI_AVALANCHE_EVENT_ID		 = BIT(24),
-- 
1.7.1


^ permalink raw reply related

* [PATCH v3 02/18] wl1271: AP mode - AP specific CMD_CONFIGURE sub-commands
From: Arik Nemtsov @ 2010-12-28 17:36 UTC (permalink / raw)
  To: linux-wireless; +Cc: Luciano Coelho, Arik Nemtsov
In-Reply-To: <1293557808-27068-1-git-send-email-arik@wizery.com>

Add AP max retries and rate policy configuration.
Rename STA rate policy configuration function.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
---
 drivers/net/wireless/wl12xx/acx.c  |   60 ++++++++++++++++++++++++++++++++++-
 drivers/net/wireless/wl12xx/acx.h  |   29 ++++++++++++++++-
 drivers/net/wireless/wl12xx/conf.h |    6 +++
 drivers/net/wireless/wl12xx/init.c |    2 +-
 drivers/net/wireless/wl12xx/main.c |   10 +++---
 drivers/net/wireless/wl12xx/tx.c   |    2 +-
 6 files changed, 98 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/acx.c b/drivers/net/wireless/wl12xx/acx.c
index 30ff32a..0f802d5 100644
--- a/drivers/net/wireless/wl12xx/acx.c
+++ b/drivers/net/wireless/wl12xx/acx.c
@@ -751,9 +751,9 @@ int wl1271_acx_statistics(struct wl1271 *wl, struct acx_statistics *stats)
 	return 0;
 }
 
-int wl1271_acx_rate_policies(struct wl1271 *wl)
+int wl1271_acx_sta_rate_policies(struct wl1271 *wl)
 {
-	struct acx_rate_policy *acx;
+	struct acx_sta_rate_policy *acx;
 	struct conf_tx_rate_class *c = &wl->conf.tx.sta_rc_conf;
 	int idx = 0;
 	int ret = 0;
@@ -794,6 +794,38 @@ out:
 	return ret;
 }
 
+int wl1271_acx_ap_rate_policy(struct wl1271 *wl, struct conf_tx_rate_class *c,
+		      u8 idx)
+{
+	struct acx_ap_rate_policy *acx;
+	int ret = 0;
+
+	wl1271_debug(DEBUG_ACX, "acx ap rate policy");
+
+	acx = kzalloc(sizeof(*acx), GFP_KERNEL);
+	if (!acx) {
+		ret = -ENOMEM;
+		goto out;
+	}
+
+	acx->rate_policy.enabled_rates = cpu_to_le32(c->enabled_rates);
+	acx->rate_policy.short_retry_limit = c->short_retry_limit;
+	acx->rate_policy.long_retry_limit = c->long_retry_limit;
+	acx->rate_policy.aflags = c->aflags;
+
+	acx->rate_policy_idx = idx;
+
+	ret = wl1271_cmd_configure(wl, ACX_RATE_POLICY, acx, sizeof(*acx));
+	if (ret < 0) {
+		wl1271_warning("Setting of ap rate policy failed: %d", ret);
+		goto out;
+	}
+
+out:
+	kfree(acx);
+	return ret;
+}
+
 int wl1271_acx_ac_cfg(struct wl1271 *wl, u8 ac, u8 cw_min, u16 cw_max,
 		      u8 aifsn, u16 txop)
 {
@@ -1334,3 +1366,27 @@ out:
 	kfree(tsf_info);
 	return ret;
 }
+
+int wl1271_acx_max_tx_retry(struct wl1271 *wl)
+{
+	struct wl1271_acx_max_tx_retry *acx = NULL;
+	int ret;
+
+	wl1271_debug(DEBUG_ACX, "acx max tx retry");
+
+	acx = kzalloc(sizeof(*acx), GFP_KERNEL);
+	if (!acx)
+		return -ENOMEM;
+
+	acx->max_tx_retry = cpu_to_le16(wl->conf.tx.ap_max_tx_retries);
+
+	ret = wl1271_cmd_configure(wl, ACX_MAX_TX_FAILURE, acx, sizeof(*acx));
+	if (ret < 0) {
+		wl1271_warning("acx max tx retry failed: %d", ret);
+		goto out;
+	}
+
+out:
+	kfree(acx);
+	return ret;
+}
diff --git a/drivers/net/wireless/wl12xx/acx.h b/drivers/net/wireless/wl12xx/acx.h
index 9cbc3f4..89d3748 100644
--- a/drivers/net/wireless/wl12xx/acx.h
+++ b/drivers/net/wireless/wl12xx/acx.h
@@ -747,13 +747,23 @@ struct acx_rate_class {
 #define ACX_TX_BASIC_RATE      0
 #define ACX_TX_AP_FULL_RATE    1
 #define ACX_TX_RATE_POLICY_CNT 2
-struct acx_rate_policy {
+struct acx_sta_rate_policy {
 	struct acx_header header;
 
 	__le32 rate_class_cnt;
 	struct acx_rate_class rate_class[CONF_TX_MAX_RATE_CLASSES];
 } __packed;
 
+
+#define ACX_TX_AP_MODE_MGMT_RATE 4
+#define ACX_TX_AP_MODE_BCST_RATE 5
+struct acx_ap_rate_policy {
+	struct acx_header header;
+
+	__le32 rate_policy_idx;
+	struct acx_rate_class rate_policy;
+} __packed;
+
 struct acx_ac_cfg {
 	struct acx_header header;
 	u8 ac;
@@ -1062,6 +1072,17 @@ struct wl1271_acx_fw_tsf_information {
 	u8 padding[3];
 } __packed;
 
+struct wl1271_acx_max_tx_retry {
+	struct acx_header header;
+
+	/*
+	 * the number of frames transmission failures before
+	 * issuing the aging event.
+	 */
+	__le16 max_tx_retry;
+	u8 padding_1[2];
+} __packed;
+
 enum {
 	ACX_WAKE_UP_CONDITIONS      = 0x0002,
 	ACX_MEM_CFG                 = 0x0003,
@@ -1119,6 +1140,7 @@ enum {
 	ACX_HT_BSS_OPERATION        = 0x0058,
 	ACX_COEX_ACTIVITY           = 0x0059,
 	ACX_SET_DCO_ITRIM_PARAMS    = 0x0061,
+	ACX_MAX_TX_FAILURE          = 0x0072,
 	DOT11_RX_MSDU_LIFE_TIME     = 0x1004,
 	DOT11_CUR_TX_PWR            = 0x100D,
 	DOT11_RX_DOT11_MODE         = 0x1012,
@@ -1160,7 +1182,9 @@ int wl1271_acx_set_preamble(struct wl1271 *wl, enum acx_preamble_type preamble);
 int wl1271_acx_cts_protect(struct wl1271 *wl,
 			   enum acx_ctsprotect_type ctsprotect);
 int wl1271_acx_statistics(struct wl1271 *wl, struct acx_statistics *stats);
-int wl1271_acx_rate_policies(struct wl1271 *wl);
+int wl1271_acx_sta_rate_policies(struct wl1271 *wl);
+int wl1271_acx_ap_rate_policy(struct wl1271 *wl, struct conf_tx_rate_class *c,
+		      u8 idx);
 int wl1271_acx_ac_cfg(struct wl1271 *wl, u8 ac, u8 cw_min, u16 cw_max,
 		      u8 aifsn, u16 txop);
 int wl1271_acx_tid_cfg(struct wl1271 *wl, u8 queue_id, u8 channel_type,
@@ -1186,5 +1210,6 @@ int wl1271_acx_set_ht_capabilities(struct wl1271 *wl,
 int wl1271_acx_set_ht_information(struct wl1271 *wl,
 				   u16 ht_operation_mode);
 int wl1271_acx_tsf_info(struct wl1271 *wl, u64 *mactime);
+int wl1271_acx_max_tx_retry(struct wl1271 *wl);
 
 #endif /* __WL1271_ACX_H__ */
diff --git a/drivers/net/wireless/wl12xx/conf.h b/drivers/net/wireless/wl12xx/conf.h
index 7563ce3..f5c048c 100644
--- a/drivers/net/wireless/wl12xx/conf.h
+++ b/drivers/net/wireless/wl12xx/conf.h
@@ -683,6 +683,12 @@ struct conf_tx_settings {
 	struct conf_tx_rate_class ap_bcst_conf;
 
 	/*
+	 * AP-mode - allow this number of TX retries to a station before an
+	 * event is triggered from FW.
+	 */
+	u16 ap_max_tx_retries;
+
+	/*
 	 * Configuration for TID parameters.
 	 */
 	u8 tid_conf_count;
diff --git a/drivers/net/wireless/wl12xx/init.c b/drivers/net/wireless/wl12xx/init.c
index 785a530..f468d71 100644
--- a/drivers/net/wireless/wl12xx/init.c
+++ b/drivers/net/wireless/wl12xx/init.c
@@ -322,7 +322,7 @@ int wl1271_hw_init(struct wl1271 *wl)
 	}
 
 	/* Configure TX rate classes */
-	ret = wl1271_acx_rate_policies(wl);
+	ret = wl1271_acx_sta_rate_policies(wl);
 	if (ret < 0)
 		goto out_free_memmap;
 
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 788959a..b40568e 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -191,7 +191,7 @@ static struct conf_drv_settings default_conf = {
 			.long_retry_limit    = 10,
 			.aflags              = 0,
 		},
-
+		.ap_max_tx_retries = 100,
 		.tid_conf_count = 4,
 		.tid_conf = {
 			[CONF_TX_AC_BE] = {
@@ -1393,7 +1393,7 @@ static int wl1271_handle_idle(struct wl1271 *wl, bool idle)
 		}
 		wl->rate_set = wl1271_min_rate_get(wl);
 		wl->sta_rate_set = 0;
-		ret = wl1271_acx_rate_policies(wl);
+		ret = wl1271_acx_sta_rate_policies(wl);
 		if (ret < 0)
 			goto out;
 		ret = wl1271_acx_keep_alive_config(
@@ -1468,7 +1468,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
 			wl1271_set_band_rate(wl);
 
 		wl->basic_rate = wl1271_min_rate_get(wl);
-		ret = wl1271_acx_rate_policies(wl);
+		ret = wl1271_acx_sta_rate_policies(wl);
 		if (ret < 0)
 			wl1271_warning("rate policy for update channel "
 				       "failed %d", ret);
@@ -2017,7 +2017,7 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
 			wl->basic_rate_set = wl1271_tx_enabled_rates_get(wl,
 									 rates);
 			wl->basic_rate = wl1271_min_rate_get(wl);
-			ret = wl1271_acx_rate_policies(wl);
+			ret = wl1271_acx_sta_rate_policies(wl);
 			if (ret < 0)
 				goto out_sleep;
 
@@ -2071,7 +2071,7 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw,
 			/* revert back to minimum rates for the current band */
 			wl1271_set_band_rate(wl);
 			wl->basic_rate = wl1271_min_rate_get(wl);
-			ret = wl1271_acx_rate_policies(wl);
+			ret = wl1271_acx_sta_rate_policies(wl);
 			if (ret < 0)
 				goto out_sleep;
 
diff --git a/drivers/net/wireless/wl12xx/tx.c b/drivers/net/wireless/wl12xx/tx.c
index b44c75c..0cf210d 100644
--- a/drivers/net/wireless/wl12xx/tx.c
+++ b/drivers/net/wireless/wl12xx/tx.c
@@ -303,7 +303,7 @@ void wl1271_tx_work_locked(struct wl1271 *wl)
 		woken_up = true;
 
 		wl->rate_set = wl1271_tx_enabled_rates_get(wl, sta_rates);
-		wl1271_acx_rate_policies(wl);
+		wl1271_acx_sta_rate_policies(wl);
 	}
 
 	while ((skb = wl1271_skb_dequeue(wl))) {
-- 
1.7.1


^ permalink raw reply related

* [PATCH v3 01/18] wl1271: Add AP related configuration to conf_drv_settings
From: Arik Nemtsov @ 2010-12-28 17:36 UTC (permalink / raw)
  To: linux-wireless; +Cc: Luciano Coelho, Arik Nemtsov
In-Reply-To: <1293557808-27068-1-git-send-email-arik@wizery.com>

Rate class configuration has been split up for AP and STA modes.
Template related configuration likewise separated.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
---
 drivers/net/wireless/wl12xx/acx.c  |    2 +-
 drivers/net/wireless/wl12xx/cmd.c  |    4 +-
 drivers/net/wireless/wl12xx/conf.h |   46 ++++++++++++++++++++++++++++++++++-
 drivers/net/wireless/wl12xx/main.c |   45 +++++++++++++++++++++++++++++++++-
 4 files changed, 90 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/acx.c b/drivers/net/wireless/wl12xx/acx.c
index cc4068d..30ff32a 100644
--- a/drivers/net/wireless/wl12xx/acx.c
+++ b/drivers/net/wireless/wl12xx/acx.c
@@ -754,7 +754,7 @@ int wl1271_acx_statistics(struct wl1271 *wl, struct acx_statistics *stats)
 int wl1271_acx_rate_policies(struct wl1271 *wl)
 {
 	struct acx_rate_policy *acx;
-	struct conf_tx_rate_class *c = &wl->conf.tx.rc_conf;
+	struct conf_tx_rate_class *c = &wl->conf.tx.sta_rc_conf;
 	int idx = 0;
 	int ret = 0;
 
diff --git a/drivers/net/wireless/wl12xx/cmd.c b/drivers/net/wireless/wl12xx/cmd.c
index 0106628..15f4077 100644
--- a/drivers/net/wireless/wl12xx/cmd.c
+++ b/drivers/net/wireless/wl12xx/cmd.c
@@ -490,8 +490,8 @@ int wl1271_cmd_template_set(struct wl1271 *wl, u16 template_id,
 	cmd->len = cpu_to_le16(buf_len);
 	cmd->template_type = template_id;
 	cmd->enabled_rates = cpu_to_le32(rates);
-	cmd->short_retry_limit = wl->conf.tx.rc_conf.short_retry_limit;
-	cmd->long_retry_limit = wl->conf.tx.rc_conf.long_retry_limit;
+	cmd->short_retry_limit = wl->conf.tx.tmpl_short_retry_limit;
+	cmd->long_retry_limit = wl->conf.tx.tmpl_long_retry_limit;
 	cmd->index = index;
 
 	if (buf)
diff --git a/drivers/net/wireless/wl12xx/conf.h b/drivers/net/wireless/wl12xx/conf.h
index a16b361..7563ce3 100644
--- a/drivers/net/wireless/wl12xx/conf.h
+++ b/drivers/net/wireless/wl12xx/conf.h
@@ -496,6 +496,26 @@ struct conf_rx_settings {
 					CONF_HW_BIT_RATE_2MBPS)
 #define CONF_TX_RATE_RETRY_LIMIT       10
 
+/*
+ * Rates supported for data packets when operating as AP. Note the absense
+ * of the 22Mbps rate. There is a FW limitation on 12 rates so we must drop
+ * one. The rate dropped is not mandatory under any operating mode.
+ */
+#define CONF_TX_AP_ENABLED_RATES       (CONF_HW_BIT_RATE_1MBPS | \
+	CONF_HW_BIT_RATE_2MBPS | CONF_HW_BIT_RATE_5_5MBPS |      \
+	CONF_HW_BIT_RATE_6MBPS | CONF_HW_BIT_RATE_9MBPS |        \
+	CONF_HW_BIT_RATE_11MBPS | CONF_HW_BIT_RATE_12MBPS |      \
+	CONF_HW_BIT_RATE_18MBPS | CONF_HW_BIT_RATE_24MBPS |      \
+	CONF_HW_BIT_RATE_36MBPS | CONF_HW_BIT_RATE_48MBPS |      \
+	CONF_HW_BIT_RATE_54MBPS)
+
+/*
+ * Default rates for management traffic when operating in AP mode. This
+ * should be configured according to the basic rate set of the AP
+ */
+#define CONF_TX_AP_DEFAULT_MGMT_RATES  (CONF_HW_BIT_RATE_1MBPS | \
+	CONF_HW_BIT_RATE_2MBPS | CONF_HW_BIT_RATE_5_5MBPS)
+
 struct conf_tx_rate_class {
 
 	/*
@@ -636,9 +656,9 @@ struct conf_tx_settings {
 
 	/*
 	 * Configuration for rate classes for TX (currently only one
-	 * rate class supported.)
+	 * rate class supported). Used in non-AP mode.
 	 */
-	struct conf_tx_rate_class rc_conf;
+	struct conf_tx_rate_class sta_rc_conf;
 
 	/*
 	 * Configuration for access categories for TX rate control.
@@ -647,6 +667,22 @@ struct conf_tx_settings {
 	struct conf_tx_ac_category ac_conf[CONF_TX_MAX_AC_COUNT];
 
 	/*
+	 * Configuration for rate classes in AP-mode. These rate classes
+	 * are for the AC TX queues
+	 */
+	struct conf_tx_rate_class ap_rc_conf[CONF_TX_MAX_AC_COUNT];
+
+	/*
+	 * Management TX rate class for AP-mode.
+	 */
+	struct conf_tx_rate_class ap_mgmt_conf;
+
+	/*
+	 * Broadcast TX rate class for AP-mode.
+	 */
+	struct conf_tx_rate_class ap_bcst_conf;
+
+	/*
 	 * Configuration for TID parameters.
 	 */
 	u8 tid_conf_count;
@@ -687,6 +723,12 @@ struct conf_tx_settings {
 	 * Range: CONF_HW_BIT_RATE_* bit mask
 	 */
 	u32 basic_rate_5;
+
+	/*
+	 * TX retry limits for templates
+	 */
+	u8 tmpl_short_retry_limit;
+	u8 tmpl_long_retry_limit;
 };
 
 enum {
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 062247e..788959a 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -116,11 +116,11 @@ static struct conf_drv_settings default_conf = {
 	},
 	.tx = {
 		.tx_energy_detection         = 0,
-		.rc_conf                     = {
+		.sta_rc_conf                 = {
 			.enabled_rates       = 0,
 			.short_retry_limit   = 10,
 			.long_retry_limit    = 10,
-			.aflags              = 0
+			.aflags              = 0,
 		},
 		.ac_conf_count               = 4,
 		.ac_conf                     = {
@@ -153,6 +153,45 @@ static struct conf_drv_settings default_conf = {
 				.tx_op_limit = 1504,
 			},
 		},
+		.ap_rc_conf                  = {
+			[0] = {
+				.enabled_rates = CONF_TX_AP_ENABLED_RATES,
+				.short_retry_limit = 10,
+				.long_retry_limit = 10,
+				.aflags      = 0,
+			},
+			[1] = {
+				.enabled_rates = CONF_TX_AP_ENABLED_RATES,
+				.short_retry_limit = 10,
+				.long_retry_limit = 10,
+				.aflags      = 0,
+			},
+			[2] = {
+				.enabled_rates = CONF_TX_AP_ENABLED_RATES,
+				.short_retry_limit = 10,
+				.long_retry_limit = 10,
+				.aflags      = 0,
+			},
+			[3] = {
+				.enabled_rates = CONF_TX_AP_ENABLED_RATES,
+				.short_retry_limit = 10,
+				.long_retry_limit = 10,
+				.aflags      = 0,
+			},
+		},
+		.ap_mgmt_conf = {
+			.enabled_rates       = CONF_TX_AP_DEFAULT_MGMT_RATES,
+			.short_retry_limit   = 10,
+			.long_retry_limit    = 10,
+			.aflags              = 0,
+		},
+		.ap_bcst_conf = {
+			.enabled_rates       = CONF_HW_BIT_RATE_1MBPS,
+			.short_retry_limit   = 10,
+			.long_retry_limit    = 10,
+			.aflags              = 0,
+		},
+
 		.tid_conf_count = 4,
 		.tid_conf = {
 			[CONF_TX_AC_BE] = {
@@ -193,6 +232,8 @@ static struct conf_drv_settings default_conf = {
 		.tx_compl_threshold          = 4,
 		.basic_rate                  = CONF_HW_BIT_RATE_1MBPS,
 		.basic_rate_5                = CONF_HW_BIT_RATE_6MBPS,
+		.tmpl_short_retry_limit      = 10,
+		.tmpl_long_retry_limit       = 10,
 	},
 	.conn = {
 		.wake_up_event               = CONF_WAKE_UP_EVENT_DTIM,
-- 
1.7.1


^ permalink raw reply related

* [PATCH v3 00/18] AP mode support for wl12xx
From: Arik Nemtsov @ 2010-12-28 17:36 UTC (permalink / raw)
  To: linux-wireless; +Cc: Luciano Coelho, Arik Nemtsov

These patches add access point mode support to the wl12xx driver.
This mode uses a separate firmware and has a different initialization
sequence.

In all instances, the flow has been split according to the operating
mode of the driver (AP/STA), so as not to affect STA mode functionality.

v1->2: rebased on latest wl12xx tree
v2->3: refactoring

Arik Nemtsov (18):
  wl1271: Add AP related configuration to conf_drv_settings
  wl1271: AP mode - AP specific CMD_CONFIGURE sub-commands
  wl1271: AP mode - add AP specific event
  wl1271: AP-mode high level commands
  wl1271: AP mode - workaround for FW bug on station remove
  wl1271: AP mode - init sequence
  wl1271: AP specific RX filter configuration
  wl1271: Add AP related definitions to HOST-FW interface
  wl1271: Configure AP on BSS info change
  wl1271: AP mode config in ieee80211_ops.config
  wl1271: AP mode - change filter config
  wl1271: AP mode - add STA add/remove ops
  wl1271: AP mode - changes in TX path
  wl1271: AP mode - record TX configuration settings
  wl1271: AP mode - encryption support
  wl1271: AP mode - fetch appropriate firmware for AP
  wl1271: Read MAC address from NVS file on HW startup
  wl1271: Enable AP-mode

 drivers/net/wireless/wl12xx/acx.c          |   62 ++-
 drivers/net/wireless/wl12xx/acx.h          |   29 +-
 drivers/net/wireless/wl12xx/boot.c         |   11 +-
 drivers/net/wireless/wl12xx/cmd.c          |  300 +++++++++-
 drivers/net/wireless/wl12xx/cmd.h          |  147 ++++-
 drivers/net/wireless/wl12xx/conf.h         |   52 ++-
 drivers/net/wireless/wl12xx/event.c        |    7 +-
 drivers/net/wireless/wl12xx/event.h        |    8 +-
 drivers/net/wireless/wl12xx/init.c         |  352 ++++++++---
 drivers/net/wireless/wl12xx/init.h         |    2 +-
 drivers/net/wireless/wl12xx/main.c         |  955 +++++++++++++++++++++-------
 drivers/net/wireless/wl12xx/rx.c           |   11 +
 drivers/net/wireless/wl12xx/rx.h           |   11 +-
 drivers/net/wireless/wl12xx/tx.c           |  105 +++-
 drivers/net/wireless/wl12xx/tx.h           |   10 +-
 drivers/net/wireless/wl12xx/wl12xx.h       |   68 ++-
 drivers/net/wireless/wl12xx/wl12xx_80211.h |    5 +
 17 files changed, 1770 insertions(+), 365 deletions(-)


^ permalink raw reply

* Re: [PATCH v2 15/18] wl1271: AP mode - encryption support
From: Arik Nemtsov @ 2010-12-28 17:16 UTC (permalink / raw)
  To: Luciano Coelho; +Cc: linux-wireless
In-Reply-To: <1293537823.24274.18.camel@chilepepper>

On Tue, Dec 28, 2010 at 14:03, Luciano Coelho <luciano.coelho@nokia.com> wrote:
> On Wed, 2010-12-22 at 16:27 +0200, ext Arik Nemtsov wrote:
>> Encryption key configuration is different for AP/STA modes.
>>
>> AP encryption keys are recorded when the BSS is not started. On BSS
>> start they are propagated to the AP (in wl1271_ap_init_hwenc).
>>
>> Signed-off-by: Arik Nemtsov <arik@wizery.com>
>> ---
>
> [...]
>
>> diff --git a/drivers/net/wireless/wl12xx/tx.h b/drivers/net/wireless/wl12xx/tx.h
>> index 0662b19..81ba75d 100644
>> --- a/drivers/net/wireless/wl12xx/tx.h
>> +++ b/drivers/net/wireless/wl12xx/tx.h
>> @@ -152,4 +152,8 @@ void wl1271_tx_flush(struct wl1271 *wl);
>>  u8 wl1271_rate_to_idx(int rate, enum ieee80211_band band);
>>  u32 wl1271_tx_enabled_rates_get(struct wl1271 *wl, u32 rate_set);
>>
>> +/* Functions from wl1271_main.c */
>> +
>> +int wl1271_set_default_wep_key(struct wl1271 *wl, u8 id);
>> +
>>  #endif
>
> Again, same thing.  Can we put this somewhere else?
>

Actually the WEP default key is used for TX, so we can put this in tx.c.

Regards,
Arik

^ permalink raw reply

* Re: Compile error for the last week inside rtlwifi/base.c
From: Larry Finger @ 2010-12-28 16:23 UTC (permalink / raw)
  To: Weedy; +Cc: linux-wireless
In-Reply-To: <loom.20101228T075242-208@post.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 992 bytes --]

On 12/28/2010 12:58 AM, Weedy wrote:
> I'm not sure if my kernel is too old or what but since nothing has changed I'm
> going to ask.

Older kernels used create_workqueue(), which is replaced by alloc_workqueue().
If you really need the driver for RTL8192CE/RTL8188CE, then apply the patch
shown below. If you do not need the driver, then disable it in the configuration.

Larry
---

diff --git a/drivers/net/wireless/rtlwifi/base.c
b/drivers/net/wireless/rtlwifi/base.c
index 77fa59a..f6cc073 100644
--- a/drivers/net/wireless/rtlwifi/base.c
+++ b/drivers/net/wireless/rtlwifi/base.c
@@ -225,7 +225,7 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw)

 	/* <2> work queue */
 	rtlpriv->works.hw = hw;
`	rtlpriv->works.rtl_wq = alloc_workqueue(rtlpriv->cfg->name, 0, 0);
+	rtlpriv->works.rtl_wq = create_workqueue(rtlpriv->cfg->name);
 	INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq,
 			  (void *)rtl_watchdog_wq_callback);
 	INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq,


[-- Attachment #2: reverse_alloc --]
[-- Type: text/plain, Size: 1087 bytes --]

commit 3d986b25b5faa50ba6afd94f60f270b6c3061e5e
Author: John W. Linville <linville@tuxdriver.com>
Date:   Thu Dec 16 14:59:49 2010 -0500

    rtlwifi: use alloc_workqueue
    
    create_workqueue is deprecated.  The workqueue usage does not seem to
    demand any special treatment, so do not set any flags either.
    
    Signed-off-by: John W. Linville <linville@tuxdriver.com>
    Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
    Acked-by: Tejun Heo <tj@kernel.org>

diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c
index 77fa59a..f6cc073 100644
--- a/drivers/net/wireless/rtlwifi/base.c
+++ b/drivers/net/wireless/rtlwifi/base.c
@@ -225,7 +225,7 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw)
 
 	/* <2> work queue */
 	rtlpriv->works.hw = hw;
-	rtlpriv->works.rtl_wq = create_workqueue(rtlpriv->cfg->name);
+	rtlpriv->works.rtl_wq = alloc_workqueue(rtlpriv->cfg->name, 0, 0);
 	INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq,
 			  (void *)rtl_watchdog_wq_callback);
 	INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq,

^ permalink raw reply related

* [PATCH] ath9k_hw: fix dma descriptor rx error bit parsing
From: Felix Fietkau @ 2010-12-28 14:46 UTC (permalink / raw)
  To: linux-wireless; +Cc: linville, lrodriguez, Felix Fietkau

An Rx DMA descriptor can have multiple error bits set, and some error
bits (e.g. MIC failure) are filtered by the driver based on other criteria.
Remove the 'else' in various error bit checks so that all error information
is properly passed to the driver.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
---
 drivers/net/wireless/ath/ath9k/ar9003_mac.c |   11 ++++++-----
 drivers/net/wireless/ath/ath9k/mac.c        |    9 +++++----
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mac.c b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
index b6e4ee4..4ceddbb 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
@@ -613,9 +613,9 @@ int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs,
 		 * possibly be reviewing the last subframe. AR_CRCErr
 		 * is the CRC of the actual data.
 		 */
-		if (rxsp->status11 & AR_CRCErr) {
+		if (rxsp->status11 & AR_CRCErr)
 			rxs->rs_status |= ATH9K_RXERR_CRC;
-		} else if (rxsp->status11 & AR_PHYErr) {
+		if (rxsp->status11 & AR_PHYErr) {
 			phyerr = MS(rxsp->status11, AR_PHYErrCode);
 			/*
 			 * If we reach a point here where AR_PostDelimCRCErr is
@@ -638,11 +638,12 @@ int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs,
 				rxs->rs_phyerr = phyerr;
 			}
 
-		} else if (rxsp->status11 & AR_DecryptCRCErr) {
+		}
+		if (rxsp->status11 & AR_DecryptCRCErr)
 			rxs->rs_status |= ATH9K_RXERR_DECRYPT;
-		} else if (rxsp->status11 & AR_MichaelErr) {
+		if (rxsp->status11 & AR_MichaelErr)
 			rxs->rs_status |= ATH9K_RXERR_MIC;
-		} else if (rxsp->status11 & AR_KeyMiss)
+		if (rxsp->status11 & AR_KeyMiss)
 			rxs->rs_status |= ATH9K_RXERR_DECRYPT;
 	}
 
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c
index e3d2ebf..180170d 100644
--- a/drivers/net/wireless/ath/ath9k/mac.c
+++ b/drivers/net/wireless/ath/ath9k/mac.c
@@ -692,15 +692,16 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds,
 	if ((ads.ds_rxstatus8 & AR_RxFrameOK) == 0) {
 		if (ads.ds_rxstatus8 & AR_CRCErr)
 			rs->rs_status |= ATH9K_RXERR_CRC;
-		else if (ads.ds_rxstatus8 & AR_PHYErr) {
+		if (ads.ds_rxstatus8 & AR_PHYErr) {
 			rs->rs_status |= ATH9K_RXERR_PHY;
 			phyerr = MS(ads.ds_rxstatus8, AR_PHYErrCode);
 			rs->rs_phyerr = phyerr;
-		} else if (ads.ds_rxstatus8 & AR_DecryptCRCErr)
+		}
+		if (ads.ds_rxstatus8 & AR_DecryptCRCErr)
 			rs->rs_status |= ATH9K_RXERR_DECRYPT;
-		else if (ads.ds_rxstatus8 & AR_MichaelErr)
+		if (ads.ds_rxstatus8 & AR_MichaelErr)
 			rs->rs_status |= ATH9K_RXERR_MIC;
-		else if (ads.ds_rxstatus8 & AR_KeyMiss)
+		if (ads.ds_rxstatus8 & AR_KeyMiss)
 			rs->rs_status |= ATH9K_RXERR_DECRYPT;
 	}
 
-- 
1.7.3.2


^ permalink raw reply related

* Re: [PATCH v2 17/18] wl1271: Read MAC address from NVS file on HW startup
From: Luciano Coelho @ 2010-12-28 12:57 UTC (permalink / raw)
  To: ext Arik Nemtsov; +Cc: linux-wireless
In-Reply-To: <1293028057-6212-18-git-send-email-arik@wizery.com>

On Wed, 2010-12-22 at 16:27 +0200, ext Arik Nemtsov wrote:
> Try to read the MAC address from the on-disk NVS file.
> A non-zero MAC address is required to add an AP interface.
> 
> Signed-off-by: Arik Nemtsov <arik@wizery.com>
> ---

[...]

> diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
> index eb2c3c5..a9f95c6 100644
> --- a/drivers/net/wireless/wl12xx/main.c
> +++ b/drivers/net/wireless/wl12xx/main.c
> @@ -3025,6 +3025,18 @@ int wl1271_register_hw(struct wl1271 *wl)
>  	if (wl->mac80211_registered)
>  		return 0;
>  
> +	ret = wl1271_fetch_nvs(wl);
> +	if (ret == 0) {
> +		u8 *nvs_ptr = (u8 *)wl->nvs->nvs;
> +
> +		wl->mac_addr[0] = nvs_ptr[11];
> +		wl->mac_addr[1] = nvs_ptr[10];
> +		wl->mac_addr[2] = nvs_ptr[6];
> +		wl->mac_addr[3] = nvs_ptr[5];
> +		wl->mac_addr[4] = nvs_ptr[4];
> +		wl->mac_addr[5] = nvs_ptr[3];
> +	}
> +
>  	SET_IEEE80211_PERM_ADDR(wl->hw, wl->mac_addr);
>  
>  	ret = ieee80211_register_hw(wl->hw);

I think we need to check whether the MAC address is valid in the NVS.
Also this goes a little bit against the way we are doing things in Nokia
devices.  In our devices we don't have different files during
production, the only part that is different from one individual device
to another is in a protected area.  The NVS file in the file system is
always the same.  The one that changes is in the protected area and is
passed to the driver by a special application.

Also, how would this work if the hw is registered before udev is
running?

We need to revise the entire NVS thing.  But at least for now, while we
don't come up with a good and final solution, we should not be inventing
new ways of setting the MAC.


-- 
Cheers,
Luca.


^ permalink raw reply

* Re: [PATCH v2 15/18] wl1271: AP mode - encryption support
From: Luciano Coelho @ 2010-12-28 12:03 UTC (permalink / raw)
  To: ext Arik Nemtsov; +Cc: linux-wireless
In-Reply-To: <1293028057-6212-16-git-send-email-arik@wizery.com>

On Wed, 2010-12-22 at 16:27 +0200, ext Arik Nemtsov wrote:
> Encryption key configuration is different for AP/STA modes.
> 
> AP encryption keys are recorded when the BSS is not started. On BSS
> start they are propagated to the AP (in wl1271_ap_init_hwenc).
> 
> Signed-off-by: Arik Nemtsov <arik@wizery.com>
> ---

[...]

> diff --git a/drivers/net/wireless/wl12xx/tx.h b/drivers/net/wireless/wl12xx/tx.h
> index 0662b19..81ba75d 100644
> --- a/drivers/net/wireless/wl12xx/tx.h
> +++ b/drivers/net/wireless/wl12xx/tx.h
> @@ -152,4 +152,8 @@ void wl1271_tx_flush(struct wl1271 *wl);
>  u8 wl1271_rate_to_idx(int rate, enum ieee80211_band band);
>  u32 wl1271_tx_enabled_rates_get(struct wl1271 *wl, u32 rate_set);
>  
> +/* Functions from wl1271_main.c */
> +
> +int wl1271_set_default_wep_key(struct wl1271 *wl, u8 id);
> +
>  #endif

Again, same thing.  Can we put this somewhere else?


-- 
Cheers,
Luca.


^ permalink raw reply

* Re: [PATCH v2 14/18] wl1271: AP mode - record TX configuration settings
From: Arik Nemtsov @ 2010-12-28 11:37 UTC (permalink / raw)
  To: Luciano Coelho; +Cc: linux-wireless
In-Reply-To: <1293536140.24274.16.camel@chilepepper>

On Tue, Dec 28, 2010 at 13:35, Luciano Coelho <luciano.coelho@nokia.com> wrote:
> On Wed, 2010-12-22 at 16:27 +0200, ext Arik Nemtsov wrote:
>> Record TX configuration settings in the "conf" member of our global
>> structure (struct wl1271) if conf_tx is called when the firmware is
>> not loaded.
>>
>> Later on when the firmware is loaded, we apply the tx conf as part of
>> the init sequence.
>>
>> Important for AP mode since conf_tx is called before add_interface
>> (where the firmware is initialized).
>>
>> Signed-off-by: Arik Nemtsov <arik@wizery.com>
>> ---
>
> [...]
>
>> diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
>> index 3cc4f79..71a67f1 100644
>> --- a/drivers/net/wireless/wl12xx/main.c
>> +++ b/drivers/net/wireless/wl12xx/main.c
>> @@ -1462,6 +1462,8 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
>>               goto out;
>>       }
>>
>> +     is_ap = (wl->bss_type == BSS_TYPE_AP_BSS);
>> +
>>       ret = wl1271_ps_elp_wakeup(wl, false);
>>       if (ret < 0)
>>               goto out;
>
> This is cross-patch and should be in 10/18.

You're right. Actually fixed this already.

Regards,
Arik

^ permalink raw reply

* Re: [PATCH v2 14/18] wl1271: AP mode - record TX configuration settings
From: Luciano Coelho @ 2010-12-28 11:35 UTC (permalink / raw)
  To: ext Arik Nemtsov; +Cc: linux-wireless
In-Reply-To: <1293028057-6212-15-git-send-email-arik@wizery.com>

On Wed, 2010-12-22 at 16:27 +0200, ext Arik Nemtsov wrote:
> Record TX configuration settings in the "conf" member of our global
> structure (struct wl1271) if conf_tx is called when the firmware is
> not loaded.
> 
> Later on when the firmware is loaded, we apply the tx conf as part of
> the init sequence.
> 
> Important for AP mode since conf_tx is called before add_interface
> (where the firmware is initialized).
> 
> Signed-off-by: Arik Nemtsov <arik@wizery.com>
> ---

[...]

> diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
> index 3cc4f79..71a67f1 100644
> --- a/drivers/net/wireless/wl12xx/main.c
> +++ b/drivers/net/wireless/wl12xx/main.c
> @@ -1462,6 +1462,8 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
>  		goto out;
>  	}
>  
> +	is_ap = (wl->bss_type == BSS_TYPE_AP_BSS);
> +
>  	ret = wl1271_ps_elp_wakeup(wl, false);
>  	if (ret < 0)
>  		goto out;

This is cross-patch and should be in 10/18.


-- 
Cheers,
Luca.


^ permalink raw reply

* Re: iwlwifi: Intel 3945ABG speed issues finally identified.
From: Stanislaw Gruszka @ 2010-12-28 10:52 UTC (permalink / raw)
  To: Eric Appleman; +Cc: linux-wireless
In-Reply-To: <loom.20101223T071403-99@post.gmane.org>

On Thu, Dec 23, 2010 at 06:15:18AM +0000, Eric Appleman wrote:
> I spent most of the day bisecting and testing numerous kernels and my work has
> finally paid off.
> 
> I've found 2 candidate commits.
> 
> a6866ac93e6cb68091326e80b4fa4619a5957644
> 1402364162afbaac1b8a74ee21aeb013e817ac7d
> 
> iwl3945 definitely broke between 2.6.35-rc2 and -rc3.

For sure breakage is between -rc2 and -rc3 ?

We have these commits:
$ git log --pretty=oneline v2.6.35-rc2..v2.6.35-rc3 -- net/mac80211/ drivers/net/wireless/iwlwifi/
b054b747a694927879c94dd11af54d04346aed7d mac80211: fix deauth before assoc
6db6340c42d027b6364d49fa99d69019aca24de4 iwlwifi: add missing rcu_read_lock
35dd0509b21e4b5bab36b9eb80c8dab0322f5007 mac80211: fix function pointer check
7d47618a2ade0cb6d8a0b2597029c383c1662fa0 iwlwifi: move sysfs_create_group to post request firmware
1402364162afbaac1b8a74ee21aeb013e817ac7d iwl3945: fix internal scan
a6866ac93e6cb68091326e80b4fa4619a5957644 iwl3945: enable stuck queue detection on 3945
8b9a4e6e442756f670ef507f09bbc6c11dc0fca6 mac80211: process station blockack action frames from work

Also there are some general network commits.

What I can tell, none of them could cause performance problems in
obvious way. If breakage is really between 2.6.35 -rc2 and -rc3, could
you install 2.6.35 kernel from source, and revert these commits 
one by one to see revert of which commit fix the problem?

Stanislaw 

^ permalink raw reply

* Re: stable compat-wireless releases are 404
From: Stanislaw Gruszka @ 2010-12-28 10:28 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linux-wireless, Justin Case
In-Reply-To: <loom.20101227T073819-206@post.gmane.org>

On Mon, Dec 27, 2010 at 06:39:04AM +0000, Justin Case wrote:
> I am trying to download a stable compat-wireless release from this website:
> http://linuxwireless.org/en/users/Download/stable/
> 
> however the main download site:
> http://www.orbit-lab.org/kernel/
> is giving 404 errors.

Luis, could you fix this?

> Is there an alternative download site or mirror?
?

Stanislaw

^ permalink raw reply

* Re: [PATCH RFC] mac80211: Extend channel to frequency mapping for 802.11j
From: Johannes Berg @ 2010-12-28  9:53 UTC (permalink / raw)
  To: Bruno Randolf; +Cc: Dave Kilroy, linville, linux-wireless
In-Reply-To: <1293529861.3526.8.camel@jlt3.sipsolutions.net>

On Tue, 2010-12-28 at 10:51 +0100, Johannes Berg wrote:

> > ieee80211_dsss_chan_to_freq - atmel, airo, wl3501_cs, orinoco, rndis_wlan
> > ieee80211_freq_to_dsss_chan - atmel, airo, orinoco, zd1201
> > 
> > Anyhow i guess it would make sense to have a common channel to frequency 
> > mapping function for mac80211 and other wireless drivers? The problem is now 
> > we have to use enum ieee80211_band which is defined cfg80211.h...

Interestingly, I just noticed that the above ones also have different
semantics -- they try to round to the nearest channel rather than
returning an error if the center frequency isn't exact.

johannes


^ permalink raw reply

* Re: [PATCH RFC] mac80211: Extend channel to frequency mapping for 802.11j
From: Johannes Berg @ 2010-12-28  9:51 UTC (permalink / raw)
  To: Bruno Randolf; +Cc: Dave Kilroy, linville, linux-wireless
In-Reply-To: <201012281843.57453.br1@einfach.org>

On Tue, 2010-12-28 at 18:43 +0900, Bruno Randolf wrote:

> > You don't have to use them, but there are a few channel/frequency
> > conversion routines in include/ieee80211.h which could be reused in
> > these functions.
> 
> Thanks for that info, I didn't know about those functions. I just checked 
> them and it seems most of them are not used, AFAICT:
> 
> ieee80211_fhss_chan_to_freq - not used
> ieee80211_freq_to_fhss_chan - not used
> ieee80211_hr_chan_to_freq - not used
> ieee80211_freq_to_hr_chan - not used
> ieee80211_erp_chan_to_freq - not used
> ieee80211_freq_to_erp_chan - not used
> ieee80211_ofdm_chan_to_freq - not used
> ieee80211_freq_to_ofdm_chan - not used

Cute -- we should probably just remove these.

> The only two which are used are for 2GHz channels:
> 
> ieee80211_dsss_chan_to_freq - atmel, airo, wl3501_cs, orinoco, rndis_wlan
> ieee80211_freq_to_dsss_chan - atmel, airo, orinoco, zd1201
> 
> Anyhow i guess it would make sense to have a common channel to frequency 
> mapping function for mac80211 and other wireless drivers? The problem is now 
> we have to use enum ieee80211_band which is defined cfg80211.h...

Well, you're a bit wrong -- the function you're modifying is part of
cfg80211. Therefore, including cfg80211.h makes perfect sense, it's also
defined in there (therefore, your patch subject should begin with
"cfg80211:" instead of "mac80211:").

However, of those drivers you list only orinoco and rndis_wlan already
use cfg80211, so for the others using it would introduce an almost
"fake" dependency. In any case, it seems like all that should be
separate patches.

johannes


^ permalink raw reply

* Re: [PATCH RFC] mac80211: Extend channel to frequency mapping for 802.11j
From: Bruno Randolf @ 2010-12-28  9:43 UTC (permalink / raw)
  To: Dave Kilroy; +Cc: johannes, linville, linux-wireless
In-Reply-To: <AANLkTi=R58EGLrsT5sTk7JTqWvaeJ5caytHMt3VCSOki@mail.gmail.com>

On Sat December 25 2010 01:46:00 Dave Kilroy wrote:
> On Fri, Dec 24, 2010 at 7:44 AM, Bruno Randolf <br1@einfach.org> wrote:
> > Extend channel to frequency mapping for 802.11j Japan 4.9GHz band,
> > according to IEEE802.11 section 17.3.8.3.2 and Annex J. Because there
> > are now overlapping channel numbers in the 2GHz and 5GHz band we can't
> > map from channel to frequency without knowing the band. This is no
> > problem as in most contexts we know the band. In places where we don't
> > know the band (and WEXT compatibility) we assume the 2GHz band for
> > channels below 14.
> > 
> > Signed-off-by: Bruno Randolf <br1@einfach.org>
> > ---
> > -int ieee80211_channel_to_frequency(int chan)
> > +int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band)
> >  {
> > -       if (chan < 14)
> > -               return 2407 + chan * 5;
> > -
> > -       if (chan == 14)
> > -               return 2484;
> > -
> > -       /* FIXME: 802.11j 17.3.8.3.2 */
> > -       return (chan + 1000) * 5;
> > +       /* see 802.11 17.3.8.3.2 and Annex J
> > +        * there are overlapping channel numbers in 5GHz and 2GHz bands
> > */ +       if (band == IEEE80211_BAND_5GHZ) {
> > +               if (chan >= 182 && chan <= 196)
> > +                       return 4000 + chan * 5;
> > +               else
> > +                       return 5000 + chan * 5;
> > +       } else { /* IEEE80211_BAND_2GHZ */
> > +               if (chan == 14)
> > +                       return 2484;
> > +               else if (chan < 14)
> > +                       return 2407 + chan * 5;
> > +               else
> > +                       return 0; /* not supported */
> > +       }
> >  }
> >  EXPORT_SYMBOL(ieee80211_channel_to_frequency);
> > 
> >  int ieee80211_frequency_to_channel(int freq)
> >  {
> > +       /* see 802.11 17.3.8.3.2 and Annex J */
> >        if (freq == 2484)
> >                return 14;
> > -
> > -       if (freq < 2484)
> > +       else if (freq < 2484)
> >                return (freq - 2407) / 5;
> > -
> > -       /* FIXME: 802.11j 17.3.8.3.2 */
> > -       return freq/5 - 1000;
> > +       else if (freq >= 4910 && freq <= 4980)
> > +               return (freq - 4000) / 5;
> > +       else
> > +               return (freq - 5000) / 5;
> >  }
> >  EXPORT_SYMBOL(ieee80211_frequency_to_channel);
> 
> You don't have to use them, but there are a few channel/frequency
> conversion routines in include/ieee80211.h which could be reused in
> these functions.

Thanks for that info, I didn't know about those functions. I just checked 
them and it seems most of them are not used, AFAICT:

ieee80211_fhss_chan_to_freq - not used
ieee80211_freq_to_fhss_chan - not used
ieee80211_hr_chan_to_freq - not used
ieee80211_freq_to_hr_chan - not used
ieee80211_erp_chan_to_freq - not used
ieee80211_freq_to_erp_chan - not used
ieee80211_ofdm_chan_to_freq - not used
ieee80211_freq_to_ofdm_chan - not used

The only two which are used are for 2GHz channels:

ieee80211_dsss_chan_to_freq - atmel, airo, wl3501_cs, orinoco, rndis_wlan
ieee80211_freq_to_dsss_chan - atmel, airo, orinoco, zd1201

Anyhow i guess it would make sense to have a common channel to frequency 
mapping function for mac80211 and other wireless drivers? The problem is now 
we have to use enum ieee80211_band which is defined cfg80211.h...

Any opinions?

bruno

^ permalink raw reply

* Re: [PATCH RFC] mac80211: Extend channel to frequency mapping for 802.11j
From: Bruno Randolf @ 2010-12-28  9:39 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: Johannes Berg, linville, linux-wireless, mcgrof
In-Reply-To: <20101228092510.GA22967@jm.kir.nu>

On Tue December 28 2010 18:25:10 Jouni Malinen wrote:
> On Tue, Dec 28, 2010 at 10:08:02AM +0100, Johannes Berg wrote:
> > On Tue, 2010-12-28 at 11:01 +0200, Jouni Malinen wrote:
> > > Quite a few.. At least 4.85 GHz and 3.0 GHz for 20 MHz channels and
> > > more for 5 and 10 MHz channels (4.9375 GHz, 4.89 GHz, 3.0025 GHz,
> > > 4.0025 GHz, 5.0025 GHz) in channels defined by IEEE 802.11.
> > 
> > That's what I kinda thought ... doesn't that mean this patch is
> > insufficient?
> 
> Depends on what it is trying to achieve. Based on the Subject: line, it
> aims to add support for channels defined in 802.11j and it does indeed
> seem to do that (most of those odd channel starting frequencies come
> from 802.11y). If the goal were to cover all channels defined in the
> current IEEE 802.11 standard, then sure, it would be insufficient, but
> it is not like we support 3.6 GHz band or sub-20 MHz channels anyway, so
> only the 4.85 GHz starting frequency for some emergency channels from
> 802.11y would not be covered.

Well, yeah, I'm was only concerned about the 802.11j part. And I left out all 
stuff for non 20MHz channels. If it's needed these functions can be extended 
more later... The Japanese need 802.11j now, not a theoretically complete 
channel to frequency mapping... ;)

bruno

^ permalink raw reply

* Re: Patches submitted should apply to which git repository?
From: Johannes Berg @ 2010-12-28  9:33 UTC (permalink / raw)
  To: Naveenan; +Cc: linux-wireless
In-Reply-To: <AANLkTinxwNuZ1QxBKVMLycS=kmCmB1A9fpKrQYDH+TZV@mail.gmail.com>

On Tue, 2010-12-28 at 03:28 -0600, Naveenan wrote:
> [I apologize, I am resending this email with CC to the list]
> 
> >> I would say that the fix is not a critical one would would be useful
> >> if applied to wireless-2.6 too.
> >
> > Yes, if it's an important fix then you would have to send two versions.
> > Without seeing it, I can offer no advice on whether it is important
> > enough though.
> 
> Thanks a lot. I guess I will include the git repository I am diffing
> against after the "---" marker so that it would be applied to the
> right repository. Could you let me know if this style of sending
> patches is ok? I kind of would like to not send a patch and have it
> rejected due to a merge conflict :)

Yes, you can put anything after the first --- marker.

You can also indicate it in the subject: if it's intended for the
current kernel release still -- which is kinda late -- you can say
"[PATCH 2.6.37] mac80211: foobar"

johannes


^ permalink raw reply

* Re: Patches submitted should apply to which git repository?
From: Naveenan @ 2010-12-28  9:28 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless
In-Reply-To: <1293527720.3526.3.camel@jlt3.sipsolutions.net>

[I apologize, I am resending this email with CC to the list]

>> I would say that the fix is not a critical one would would be useful
>> if applied to wireless-2.6 too.
>
> Yes, if it's an important fix then you would have to send two versions.
> Without seeing it, I can offer no advice on whether it is important
> enough though.

Thanks a lot. I guess I will include the git repository I am diffing
against after the "---" marker so that it would be applied to the
right repository. Could you let me know if this style of sending
patches is ok? I kind of would like to not send a patch and have it
rejected due to a merge conflict :)

Thanks

^ permalink raw reply

* Re: [PATCH RFC] mac80211: Extend channel to frequency mapping for 802.11j
From: Jouni Malinen @ 2010-12-28  9:25 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Bruno Randolf, linville, linux-wireless, mcgrof
In-Reply-To: <1293527282.3526.2.camel@jlt3.sipsolutions.net>

On Tue, Dec 28, 2010 at 10:08:02AM +0100, Johannes Berg wrote:
> On Tue, 2010-12-28 at 11:01 +0200, Jouni Malinen wrote:
> > Quite a few.. At least 4.85 GHz and 3.0 GHz for 20 MHz channels and more
> > for 5 and 10 MHz channels (4.9375 GHz, 4.89 GHz, 3.0025 GHz, 4.0025 GHz,
> > 5.0025 GHz) in channels defined by IEEE 802.11.
> 
> That's what I kinda thought ... doesn't that mean this patch is
> insufficient?

Depends on what it is trying to achieve. Based on the Subject: line, it
aims to add support for channels defined in 802.11j and it does indeed
seem to do that (most of those odd channel starting frequencies come
from 802.11y). If the goal were to cover all channels defined in the
current IEEE 802.11 standard, then sure, it would be insufficient, but
it is not like we support 3.6 GHz band or sub-20 MHz channels anyway, so
only the 4.85 GHz starting frequency for some emergency channels from
802.11y would not be covered.

-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply

* Re: Patches submitted should apply to which git repository?
From: Johannes Berg @ 2010-12-28  9:15 UTC (permalink / raw)
  To: Naveenan; +Cc: linux-wireless
In-Reply-To: <AANLkTik9=r8tCouEg0joexH0_S9+WPfyDGDzq5fbMKOe@mail.gmail.com>

On Tue, 2010-12-28 at 03:12 -0600, Naveenan wrote:

> Would it be ok if I can send 2 different patches for both these 2 versions?
> 
> Unfortunately someone changed a line of code (that is a few lines
> before my patch
> but not related to it) in a recent commit to wireless-testing and this
> makes the patch
> not apply-able to both wireless-2.6 and wireless-next.
> 
> I would say that the fix is not a critical one would would be useful
> if applied to wireless-2.6 too.

Yes, if it's an important fix then you would have to send two versions.
Without seeing it, I can offer no advice on whether it is important
enough though.

johannes


^ permalink raw reply

* Re: Patches submitted should apply to which git repository?
From: Naveenan @ 2010-12-28  9:12 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless
In-Reply-To: <1293526293.3526.1.camel@jlt3.sipsolutions.net>

Hi Johannes,

Thanks for your email.

>> I went through:
>> http://wireless.kernel.org/en/developers/Documentation/SubmittingPatches
>> but couldn't find this information there so was hoping someone could
>> point the exact git repository. My current patch applies to
>> wireless-testing but doesn't apply to wireless-2.6 (due to a trivial
>> merge conflict) . The changes I'm making are to mac80211.
>
> If they're fixes and required in wireless-2.6, then you should make them
> apply there, but ask yourself if they really need to be there. If not,
> you can typically just submit them on top of wireless-testing, although
> they will have to be applied to wireless-next-2.6.

Would it be ok if I can send 2 different patches for both these 2 versions?

Unfortunately someone changed a line of code (that is a few lines
before my patch
but not related to it) in a recent commit to wireless-testing and this
makes the patch
not apply-able to both wireless-2.6 and wireless-next.

I would say that the fix is not a critical one would would be useful
if applied to
wireless-2.6 too.

Thanks

^ permalink raw reply

* Re: [PATCH RFC] mac80211: Extend channel to frequency mapping for 802.11j
From: Johannes Berg @ 2010-12-28  9:08 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: Bruno Randolf, linville, linux-wireless, mcgrof
In-Reply-To: <20101228090102.GA22580@jm.kir.nu>

On Tue, 2010-12-28 at 11:01 +0200, Jouni Malinen wrote:
> On Tue, Dec 28, 2010 at 09:38:33AM +0100, Johannes Berg wrote:
> > Not really. I guess it seems fine. Do you know if there are ever any
> > starting values used other than 4900 and 5000?
> 
> Quite a few.. At least 4.85 GHz and 3.0 GHz for 20 MHz channels and more
> for 5 and 10 MHz channels (4.9375 GHz, 4.89 GHz, 3.0025 GHz, 4.0025 GHz,
> 5.0025 GHz) in channels defined by IEEE 802.11.

That's what I kinda thought ... doesn't that mean this patch is
insufficient?

johannes


^ permalink raw reply

* Re: [PATCH RFC] mac80211: Extend channel to frequency mapping for 802.11j
From: Jouni Malinen @ 2010-12-28  9:01 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Bruno Randolf, linville, linux-wireless, mcgrof
In-Reply-To: <1293525513.3526.0.camel@jlt3.sipsolutions.net>

On Tue, Dec 28, 2010 at 09:38:33AM +0100, Johannes Berg wrote:
> Not really. I guess it seems fine. Do you know if there are ever any
> starting values used other than 4900 and 5000?

Quite a few.. At least 4.85 GHz and 3.0 GHz for 20 MHz channels and more
for 5 and 10 MHz channels (4.9375 GHz, 4.89 GHz, 3.0025 GHz, 4.0025 GHz,
5.0025 GHz) in channels defined by IEEE 802.11.

-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox