Linux wireless drivers development
 help / color / mirror / Atom feed
From: Eliad Peller <eliad@wizery.com>
To: Luciano Coelho <coelho@ti.com>
Cc: <linux-wireless@vger.kernel.org>
Subject: [PATCH v2 16/40] wl12xx: add system_hlid
Date: Sun, 14 Aug 2011 13:17:15 +0300	[thread overview]
Message-ID: <1313317059-16567-17-git-send-email-eliad@wizery.com> (raw)
In-Reply-To: <1313317059-16567-1-git-send-email-eliad@wizery.com>

system_hlid is a const hlid (always 0), used by the fw and driver
for packets which are not bound to specific role (e.g. dynamic
memory packets).
indicate it as always allocated.

Signed-off-by: Eliad Peller <eliad@wizery.com>
---
v2: remove memset, refactor wl1271_tx_get_hlid

 drivers/net/wireless/wl12xx/main.c   |    9 ++++++-
 drivers/net/wireless/wl12xx/tx.c     |   40 +++++++++++++++++++++------------
 drivers/net/wireless/wl12xx/tx.h     |    2 +-
 drivers/net/wireless/wl12xx/wl12xx.h |    2 +
 4 files changed, 36 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 3db191d..e4081e2 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -1488,13 +1488,13 @@ static void wl1271_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
 	u8 hlid = 0;
 
 	mapping = skb_get_queue_mapping(skb);
 	q = wl1271_tx_get_queue(mapping);
 
 	if (wl->bss_type == BSS_TYPE_AP_BSS)
-		hlid = wl1271_tx_get_hlid(skb);
+		hlid = wl12xx_tx_get_hlid_ap(wl, skb);
 
 	spin_lock_irqsave(&wl->wl_lock, flags);
 
 	wl->tx_queue_count[q]++;
 
 	/*
@@ -2066,12 +2066,15 @@ deinit:
 	wl->sched_scanning = false;
 	wl->role_id = WL12XX_INVALID_ROLE_ID;
 	wl->dev_role_id = WL12XX_INVALID_ROLE_ID;
 	memset(wl->roles_map, 0, sizeof(wl->roles_map));
 	memset(wl->links_map, 0, sizeof(wl->links_map));
 
+	/* The system link is always allocated */
+	__set_bit(WL12XX_SYSTEM_HLID, wl->links_map);
+
 	/*
 	 * this is performed after the cancel_work calls and the associated
 	 * mutex_lock, so that wl1271_op_add_interface does not accidentally
 	 * get executed before all these vars have been reset.
 	 */
 	wl->flags = 0;
@@ -4404,20 +4407,24 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
 	wl->quirks = 0;
 	wl->platform_quirks = 0;
 	wl->sched_scanning = false;
 	wl->tx_security_seq = 0;
 	wl->tx_security_last_seq_lsb = 0;
 	wl->role_id = WL12XX_INVALID_ROLE_ID;
+	wl->system_hlid = WL12XX_SYSTEM_HLID;
 	wl->sta_hlid = WL12XX_INVALID_LINK_ID;
 	wl->dev_role_id = WL12XX_INVALID_ROLE_ID;
 	wl->dev_hlid = WL12XX_INVALID_LINK_ID;
 	setup_timer(&wl->rx_streaming_timer, wl1271_rx_streaming_timer,
 		    (unsigned long) wl);
 	wl->fwlog_size = 0;
 	init_waitqueue_head(&wl->fwlog_waitq);
 
+	/* The system link is always allocated */
+	__set_bit(WL12XX_SYSTEM_HLID, wl->links_map);
+
 	memset(wl->tx_frames_map, 0, sizeof(wl->tx_frames_map));
 	for (i = 0; i < ACX_TX_DESCRIPTORS; i++)
 		wl->tx_frames[i] = NULL;
 
 	spin_lock_init(&wl->wl_lock);
 
diff --git a/drivers/net/wireless/wl12xx/tx.c b/drivers/net/wireless/wl12xx/tx.c
index 23ce7aa..ffdaf97 100644
--- a/drivers/net/wireless/wl12xx/tx.c
+++ b/drivers/net/wireless/wl12xx/tx.c
@@ -129,33 +129,55 @@ static void wl1271_tx_regulate_link(struct wl1271 *wl, u8 hlid)
 	 */
 	if (fw_ps && tx_blks >= WL1271_PS_STA_MAX_BLOCKS)
 		wl1271_ps_link_start(wl, hlid, true);
 }
 #endif
 
-u8 wl1271_tx_get_hlid(struct sk_buff *skb)
+static bool wl12xx_is_dummy_packet(struct wl1271 *wl, struct sk_buff *skb)
+{
+	return wl->dummy_packet == skb;
+}
+
+u8 wl12xx_tx_get_hlid_ap(struct wl1271 *wl, struct sk_buff *skb)
 {
 	struct ieee80211_tx_info *control = IEEE80211_SKB_CB(skb);
 
 	if (control->control.sta) {
 		struct wl1271_station *wl_sta;
 
 		wl_sta = (struct wl1271_station *)
 				control->control.sta->drv_priv;
 		return wl_sta->hlid;
 	} else {
 		struct ieee80211_hdr *hdr;
 
+		if (!test_bit(WL1271_FLAG_AP_STARTED, &wl->flags))
+			return wl->system_hlid;
+
 		hdr = (struct ieee80211_hdr *)skb->data;
 		if (ieee80211_is_mgmt(hdr->frame_control))
 			return WL1271_AP_GLOBAL_HLID;
 		else
 			return WL1271_AP_BROADCAST_HLID;
 	}
 }
 
+static u8 wl1271_tx_get_hlid(struct wl1271 *wl, struct sk_buff *skb)
+{
+	if (wl12xx_is_dummy_packet(wl, skb))
+		return wl->system_hlid;
+
+	if (wl->bss_type == BSS_TYPE_AP_BSS)
+		return wl12xx_tx_get_hlid_ap(wl, skb);
+
+	if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags))
+		return wl->sta_hlid;
+	else
+		return wl->dev_hlid;
+}
+
 static unsigned int wl12xx_calc_packet_alignment(struct wl1271 *wl,
 						unsigned int packet_length)
 {
 	if (wl->quirks & WL12XX_QUIRK_BLOCKSIZE_ALIGNMENT)
 		return ALIGN(packet_length, WL12XX_BUS_BLOCK_SIZE);
 	else
@@ -218,17 +240,12 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra,
 		wl1271_free_tx_id(wl, id);
 	}
 
 	return ret;
 }
 
-static bool wl12xx_is_dummy_packet(struct wl1271 *wl, struct sk_buff *skb)
-{
-	return wl->dummy_packet == skb;
-}
-
 static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb,
 			      u32 extra, struct ieee80211_tx_info *control,
 			      u8 hlid)
 {
 	struct timespec ts;
 	struct wl1271_tx_hw_descr *desc;
@@ -368,20 +385,13 @@ static int wl1271_prepare_tx_frame(struct wl1271 *wl, struct sk_buff *skb,
 			if (ret < 0)
 				return ret;
 			wl->default_key = idx;
 		}
 	}
 
-	if (wl->bss_type == BSS_TYPE_AP_BSS)
-		hlid = wl1271_tx_get_hlid(skb);
-	else
-		if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags))
-			hlid = wl->sta_hlid;
-		else
-			hlid = wl->dev_hlid;
-
+	hlid = wl1271_tx_get_hlid(wl, skb);
 	if (hlid == WL12XX_INVALID_LINK_ID) {
 		wl1271_error("invalid hlid. dropping skb 0x%p", skb);
 		return -EINVAL;
 	}
 
 	ret = wl1271_tx_allocate(wl, skb, extra, buf_offset, hlid);
@@ -561,13 +571,13 @@ static void wl1271_skb_queue_head(struct wl1271 *wl, struct sk_buff *skb)
 	unsigned long flags;
 	int q = wl1271_tx_get_queue(skb_get_queue_mapping(skb));
 
 	if (wl12xx_is_dummy_packet(wl, skb)) {
 		set_bit(WL1271_FLAG_DUMMY_PACKET_PENDING, &wl->flags);
 	} else if (wl->bss_type == BSS_TYPE_AP_BSS) {
-		u8 hlid = wl1271_tx_get_hlid(skb);
+		u8 hlid = wl1271_tx_get_hlid(wl, skb);
 		skb_queue_head(&wl->links[hlid].tx_queue[q], skb);
 
 		/* make sure we dequeue the same packet next time */
 		wl->last_tx_hlid = (hlid + AP_MAX_LINKS - 1) % AP_MAX_LINKS;
 	} else {
 		skb_queue_head(&wl->tx_queue[q], skb);
diff --git a/drivers/net/wireless/wl12xx/tx.h b/drivers/net/wireless/wl12xx/tx.h
index b712d7b..7da35c0 100644
--- a/drivers/net/wireless/wl12xx/tx.h
+++ b/drivers/net/wireless/wl12xx/tx.h
@@ -207,11 +207,11 @@ void wl1271_tx_work_locked(struct wl1271 *wl);
 void wl1271_tx_complete(struct wl1271 *wl);
 void wl1271_tx_reset(struct wl1271 *wl, bool reset_tx_queues);
 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);
 u32 wl1271_tx_min_rate_get(struct wl1271 *wl);
-u8 wl1271_tx_get_hlid(struct sk_buff *skb);
+u8 wl12xx_tx_get_hlid_ap(struct wl1271 *wl, struct sk_buff *skb);
 void wl1271_tx_reset_link_queues(struct wl1271 *wl, u8 hlid);
 void wl1271_handle_tx_low_watermark(struct wl1271 *wl);
 
 #endif
diff --git a/drivers/net/wireless/wl12xx/wl12xx.h b/drivers/net/wireless/wl12xx/wl12xx.h
index 93e689d..089304d 100644
--- a/drivers/net/wireless/wl12xx/wl12xx.h
+++ b/drivers/net/wireless/wl12xx/wl12xx.h
@@ -138,12 +138,13 @@ extern u32 wl12xx_debug_level;
 #define WL1271_DEFAULT_DTIM_PERIOD 1
 
 #define WL12XX_MAX_ROLES           4
 #define WL12XX_MAX_LINKS           8
 #define WL12XX_INVALID_ROLE_ID     0xff
 #define WL12XX_INVALID_LINK_ID     0xff
+#define WL12XX_SYSTEM_HLID         0
 #define WL1271_AP_GLOBAL_HLID      0
 #define WL1271_AP_BROADCAST_HLID   1
 #define WL1271_AP_STA_HLID_START   2
 
 /*
  * When in AP-mode, we allow (at least) this number of mem-blocks
@@ -392,12 +393,13 @@ struct wl1271 {
 	u8 set_bss_type;
 	u8 ssid[IEEE80211_MAX_SSID_LEN + 1];
 	u8 ssid_len;
 	int channel;
 	u8 role_id;
 	u8 dev_role_id;
+	u8 system_hlid;
 	u8 sta_hlid;
 	u8 dev_hlid;
 
 	unsigned long links_map[BITS_TO_LONGS(WL12XX_MAX_LINKS)];
 	unsigned long roles_map[BITS_TO_LONGS(WL12XX_MAX_ROLES)];
 
-- 
1.7.6.401.g6a319


  parent reply	other threads:[~2011-08-14 10:17 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-14 10:16 [PATCH v2 00/40] wl12xx: move to wl12xx-fw-3 Eliad Peller
2011-08-14 10:17 ` [PATCH v2 01/40] wl12xx: Revert "wl12xx: schedule TX packets according to FW occupancy" Eliad Peller
2011-08-14 10:17 ` [PATCH v2 02/40] wl12xx: Use a single fw for both STA and AP roles Eliad Peller
2011-08-14 10:17 ` [PATCH v2 03/40] wl12xx: use 1 spare block in all cases Eliad Peller
2011-08-14 10:17 ` [PATCH v2 04/40] wl12xx: temporarily disable advanced ap functions Eliad Peller
2011-08-14 10:17 ` [PATCH v2 05/40] wl12xx: remove rx filtering stuff Eliad Peller
2011-08-14 10:17 ` [PATCH v2 06/40] wl12xx: update fw status struct Eliad Peller
2011-08-14 10:17 ` [PATCH v2 07/40] wl12xx: update acx commands Eliad Peller
2011-08-14 10:17 ` [PATCH v2 08/40] wl12xx: update commands & events Eliad Peller
2011-08-14 10:17 ` [PATCH v2 09/40] wl12xx: enable/disable role on interface add/remove Eliad Peller
2011-08-14 10:17 ` [PATCH v2 10/40] wl12xx: add device role commands Eliad Peller
2011-08-14 10:17 ` [PATCH v2 11/40] wl12xx: update scan cmd api Eliad Peller
2011-08-14 10:17 ` [PATCH v2 12/40] wl12xx: update rx/tx Eliad Peller
2011-08-14 10:17 ` [PATCH v2 13/40] wl12xx: change max/default template size Eliad Peller
2011-08-14 10:17 ` [PATCH v2 14/40] wl12xx: use wl1271_acx_beacon_filter_opt for both sta and ap Eliad Peller
2011-08-14 10:17 ` [PATCH v2 15/40] wl12xx: add set_rate_mgmt_params acx Eliad Peller
2011-08-14 10:17 ` Eliad Peller [this message]
2011-08-14 10:17 ` [PATCH v2 17/40] wl12xx: add ROC/CROC commands Eliad Peller
2011-08-14 10:17 ` [PATCH v2 18/40] wl12xx: replace dummy_join with " Eliad Peller
2011-08-14 10:17 ` [PATCH v2 19/40] wl12xx: handle dummy packet event also in ap mode Eliad Peller
2011-08-14 10:17 ` [PATCH v2 20/40] wl12xx: update BT coex configuration params Eliad Peller
2011-08-14 10:17 ` [PATCH v2 21/40] wl12xx: fix session counter Eliad Peller
2011-08-14 10:17 ` [PATCH v2 22/40] wl12xx: use dynamic hlids for AP-mode Eliad Peller
2011-08-14 10:17 ` [PATCH v2 23/40] wl12xx: re-enable block ack session support Eliad Peller
2011-08-14 10:17 ` [PATCH v2 24/40] wl12xx: call wl12xx_cmd_set_peer_state() in AP mode Eliad Peller
2011-08-14 10:17 ` [PATCH v2 25/40] wl12xx: don't remove key if hlid was already deleted Eliad Peller
2011-08-14 10:17 ` [PATCH v2 26/40] wl12xx: add wl12xx_cmd_role_start_ibss() Eliad Peller
2011-08-14 10:17 ` [PATCH v2 27/40] wl12xx: support IBSS vif type Eliad Peller
2011-08-14 10:17 ` [PATCH v2 28/40] wl12xx: AP-mode - set STA HT capabilities when adding a STA Eliad Peller
2011-08-14 10:17 ` [PATCH v2 29/40] wl12xx: AP-mode - configure STA HT rates on join Eliad Peller
2011-08-14 10:17 ` [PATCH v2 30/40] wl12xx: AP-mode - configure HT rate support to the FW Eliad Peller
2011-08-14 10:17 ` [PATCH v2 31/40] wl12xx: use ap_bcast_hlid for recorded keys Eliad Peller
2011-08-14 10:17 ` [PATCH v2 32/40] wl12xx: don't remove key if hlid was already deleted Eliad Peller
2011-08-14 10:17 ` [PATCH v2 33/40] wl12xx: track freed packets in FW by AC Eliad Peller
2011-08-14 10:17 ` [PATCH v2 34/40] wl12xx: schedule TX packets according to FW packet occupancy Eliad Peller
2011-08-14 10:17 ` [PATCH v2 35/40] wl12xx: handle wrap-around overflow in released Tx blocks FW counter Eliad Peller
2011-08-14 10:17 ` [PATCH v2 36/40] wl12xx: enable AP advanced functionality Eliad Peller
2011-08-14 10:17 ` [PATCH v2 37/40] wl12xx: don't wait for disconnection event Eliad Peller
2011-08-14 10:17 ` [PATCH v2 38/40] wl12xx: set the AP-started flag only after setting keys Eliad Peller
2011-08-14 10:17 ` [PATCH v2 39/40] wl12xx: AP-mode - prevent Tx to stale/invalid stations Eliad Peller
2011-08-14 10:17 ` [PATCH v2 40/40] wl12xx: fix tx_queue_count spurious increment Eliad Peller
2011-08-22 11:11 ` [PATCH v2 00/40] wl12xx: move to wl12xx-fw-3 Luciano Coelho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1313317059-16567-17-git-send-email-eliad@wizery.com \
    --to=eliad@wizery.com \
    --cc=coelho@ti.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox