aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx
diff options
context:
space:
mode:
authorEliad Peller <eliad@wizery.com>2011-08-14 06:17:15 -0400
committerLuciano Coelho <coelho@ti.com>2011-08-22 05:35:26 -0400
commitf4df1bd525e027aa1975e00f87a420aec7bef4e0 (patch)
tree8fbdb065ebe9bfc347b4119122046ca2eaf56470 /drivers/net/wireless/wl12xx
parentfa6ad9f0f34b0754ce7551866b33587f077a2a51 (diff)
wl12xx: add system_hlid
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> Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx')
-rw-r--r--drivers/net/wireless/wl12xx/main.c9
-rw-r--r--drivers/net/wireless/wl12xx/tx.c40
-rw-r--r--drivers/net/wireless/wl12xx/tx.h2
-rw-r--r--drivers/net/wireless/wl12xx/wl12xx.h2
4 files changed, 36 insertions, 17 deletions
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 3db191de3f51..e4081e222184 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -1491,7 +1491,7 @@ static void wl1271_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
1491 q = wl1271_tx_get_queue(mapping); 1491 q = wl1271_tx_get_queue(mapping);
1492 1492
1493 if (wl->bss_type == BSS_TYPE_AP_BSS) 1493 if (wl->bss_type == BSS_TYPE_AP_BSS)
1494 hlid = wl1271_tx_get_hlid(skb); 1494 hlid = wl12xx_tx_get_hlid_ap(wl, skb);
1495 1495
1496 spin_lock_irqsave(&wl->wl_lock, flags); 1496 spin_lock_irqsave(&wl->wl_lock, flags);
1497 1497
@@ -2069,6 +2069,9 @@ deinit:
2069 memset(wl->roles_map, 0, sizeof(wl->roles_map)); 2069 memset(wl->roles_map, 0, sizeof(wl->roles_map));
2070 memset(wl->links_map, 0, sizeof(wl->links_map)); 2070 memset(wl->links_map, 0, sizeof(wl->links_map));
2071 2071
2072 /* The system link is always allocated */
2073 __set_bit(WL12XX_SYSTEM_HLID, wl->links_map);
2074
2072 /* 2075 /*
2073 * this is performed after the cancel_work calls and the associated 2076 * this is performed after the cancel_work calls and the associated
2074 * mutex_lock, so that wl1271_op_add_interface does not accidentally 2077 * mutex_lock, so that wl1271_op_add_interface does not accidentally
@@ -4407,6 +4410,7 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
4407 wl->tx_security_seq = 0; 4410 wl->tx_security_seq = 0;
4408 wl->tx_security_last_seq_lsb = 0; 4411 wl->tx_security_last_seq_lsb = 0;
4409 wl->role_id = WL12XX_INVALID_ROLE_ID; 4412 wl->role_id = WL12XX_INVALID_ROLE_ID;
4413 wl->system_hlid = WL12XX_SYSTEM_HLID;
4410 wl->sta_hlid = WL12XX_INVALID_LINK_ID; 4414 wl->sta_hlid = WL12XX_INVALID_LINK_ID;
4411 wl->dev_role_id = WL12XX_INVALID_ROLE_ID; 4415 wl->dev_role_id = WL12XX_INVALID_ROLE_ID;
4412 wl->dev_hlid = WL12XX_INVALID_LINK_ID; 4416 wl->dev_hlid = WL12XX_INVALID_LINK_ID;
@@ -4415,6 +4419,9 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
4415 wl->fwlog_size = 0; 4419 wl->fwlog_size = 0;
4416 init_waitqueue_head(&wl->fwlog_waitq); 4420 init_waitqueue_head(&wl->fwlog_waitq);
4417 4421
4422 /* The system link is always allocated */
4423 __set_bit(WL12XX_SYSTEM_HLID, wl->links_map);
4424
4418 memset(wl->tx_frames_map, 0, sizeof(wl->tx_frames_map)); 4425 memset(wl->tx_frames_map, 0, sizeof(wl->tx_frames_map));
4419 for (i = 0; i < ACX_TX_DESCRIPTORS; i++) 4426 for (i = 0; i < ACX_TX_DESCRIPTORS; i++)
4420 wl->tx_frames[i] = NULL; 4427 wl->tx_frames[i] = NULL;
diff --git a/drivers/net/wireless/wl12xx/tx.c b/drivers/net/wireless/wl12xx/tx.c
index 23ce7aaeb4c4..ffdaf97854cb 100644
--- a/drivers/net/wireless/wl12xx/tx.c
+++ b/drivers/net/wireless/wl12xx/tx.c
@@ -132,7 +132,12 @@ static void wl1271_tx_regulate_link(struct wl1271 *wl, u8 hlid)
132} 132}
133#endif 133#endif
134 134
135u8 wl1271_tx_get_hlid(struct sk_buff *skb) 135static bool wl12xx_is_dummy_packet(struct wl1271 *wl, struct sk_buff *skb)
136{
137 return wl->dummy_packet == skb;
138}
139
140u8 wl12xx_tx_get_hlid_ap(struct wl1271 *wl, struct sk_buff *skb)
136{ 141{
137 struct ieee80211_tx_info *control = IEEE80211_SKB_CB(skb); 142 struct ieee80211_tx_info *control = IEEE80211_SKB_CB(skb);
138 143
@@ -145,6 +150,9 @@ u8 wl1271_tx_get_hlid(struct sk_buff *skb)
145 } else { 150 } else {
146 struct ieee80211_hdr *hdr; 151 struct ieee80211_hdr *hdr;
147 152
153 if (!test_bit(WL1271_FLAG_AP_STARTED, &wl->flags))
154 return wl->system_hlid;
155
148 hdr = (struct ieee80211_hdr *)skb->data; 156 hdr = (struct ieee80211_hdr *)skb->data;
149 if (ieee80211_is_mgmt(hdr->frame_control)) 157 if (ieee80211_is_mgmt(hdr->frame_control))
150 return WL1271_AP_GLOBAL_HLID; 158 return WL1271_AP_GLOBAL_HLID;
@@ -153,6 +161,20 @@ u8 wl1271_tx_get_hlid(struct sk_buff *skb)
153 } 161 }
154} 162}
155 163
164static u8 wl1271_tx_get_hlid(struct wl1271 *wl, struct sk_buff *skb)
165{
166 if (wl12xx_is_dummy_packet(wl, skb))
167 return wl->system_hlid;
168
169 if (wl->bss_type == BSS_TYPE_AP_BSS)
170 return wl12xx_tx_get_hlid_ap(wl, skb);
171
172 if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags))
173 return wl->sta_hlid;
174 else
175 return wl->dev_hlid;
176}
177
156static unsigned int wl12xx_calc_packet_alignment(struct wl1271 *wl, 178static unsigned int wl12xx_calc_packet_alignment(struct wl1271 *wl,
157 unsigned int packet_length) 179 unsigned int packet_length)
158{ 180{
@@ -221,11 +243,6 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra,
221 return ret; 243 return ret;
222} 244}
223 245
224static bool wl12xx_is_dummy_packet(struct wl1271 *wl, struct sk_buff *skb)
225{
226 return wl->dummy_packet == skb;
227}
228
229static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb, 246static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb,
230 u32 extra, struct ieee80211_tx_info *control, 247 u32 extra, struct ieee80211_tx_info *control,
231 u8 hlid) 248 u8 hlid)
@@ -371,14 +388,7 @@ static int wl1271_prepare_tx_frame(struct wl1271 *wl, struct sk_buff *skb,
371 } 388 }
372 } 389 }
373 390
374 if (wl->bss_type == BSS_TYPE_AP_BSS) 391 hlid = wl1271_tx_get_hlid(wl, skb);
375 hlid = wl1271_tx_get_hlid(skb);
376 else
377 if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags))
378 hlid = wl->sta_hlid;
379 else
380 hlid = wl->dev_hlid;
381
382 if (hlid == WL12XX_INVALID_LINK_ID) { 392 if (hlid == WL12XX_INVALID_LINK_ID) {
383 wl1271_error("invalid hlid. dropping skb 0x%p", skb); 393 wl1271_error("invalid hlid. dropping skb 0x%p", skb);
384 return -EINVAL; 394 return -EINVAL;
@@ -564,7 +574,7 @@ static void wl1271_skb_queue_head(struct wl1271 *wl, struct sk_buff *skb)
564 if (wl12xx_is_dummy_packet(wl, skb)) { 574 if (wl12xx_is_dummy_packet(wl, skb)) {
565 set_bit(WL1271_FLAG_DUMMY_PACKET_PENDING, &wl->flags); 575 set_bit(WL1271_FLAG_DUMMY_PACKET_PENDING, &wl->flags);
566 } else if (wl->bss_type == BSS_TYPE_AP_BSS) { 576 } else if (wl->bss_type == BSS_TYPE_AP_BSS) {
567 u8 hlid = wl1271_tx_get_hlid(skb); 577 u8 hlid = wl1271_tx_get_hlid(wl, skb);
568 skb_queue_head(&wl->links[hlid].tx_queue[q], skb); 578 skb_queue_head(&wl->links[hlid].tx_queue[q], skb);
569 579
570 /* make sure we dequeue the same packet next time */ 580 /* make sure we dequeue the same packet next time */
diff --git a/drivers/net/wireless/wl12xx/tx.h b/drivers/net/wireless/wl12xx/tx.h
index b712d7b058a8..7da35c0e411b 100644
--- a/drivers/net/wireless/wl12xx/tx.h
+++ b/drivers/net/wireless/wl12xx/tx.h
@@ -210,7 +210,7 @@ void wl1271_tx_flush(struct wl1271 *wl);
210u8 wl1271_rate_to_idx(int rate, enum ieee80211_band band); 210u8 wl1271_rate_to_idx(int rate, enum ieee80211_band band);
211u32 wl1271_tx_enabled_rates_get(struct wl1271 *wl, u32 rate_set); 211u32 wl1271_tx_enabled_rates_get(struct wl1271 *wl, u32 rate_set);
212u32 wl1271_tx_min_rate_get(struct wl1271 *wl); 212u32 wl1271_tx_min_rate_get(struct wl1271 *wl);
213u8 wl1271_tx_get_hlid(struct sk_buff *skb); 213u8 wl12xx_tx_get_hlid_ap(struct wl1271 *wl, struct sk_buff *skb);
214void wl1271_tx_reset_link_queues(struct wl1271 *wl, u8 hlid); 214void wl1271_tx_reset_link_queues(struct wl1271 *wl, u8 hlid);
215void wl1271_handle_tx_low_watermark(struct wl1271 *wl); 215void wl1271_handle_tx_low_watermark(struct wl1271 *wl);
216 216
diff --git a/drivers/net/wireless/wl12xx/wl12xx.h b/drivers/net/wireless/wl12xx/wl12xx.h
index 93e689d1f46a..089304d874d5 100644
--- a/drivers/net/wireless/wl12xx/wl12xx.h
+++ b/drivers/net/wireless/wl12xx/wl12xx.h
@@ -141,6 +141,7 @@ extern u32 wl12xx_debug_level;
141#define WL12XX_MAX_LINKS 8 141#define WL12XX_MAX_LINKS 8
142#define WL12XX_INVALID_ROLE_ID 0xff 142#define WL12XX_INVALID_ROLE_ID 0xff
143#define WL12XX_INVALID_LINK_ID 0xff 143#define WL12XX_INVALID_LINK_ID 0xff
144#define WL12XX_SYSTEM_HLID 0
144#define WL1271_AP_GLOBAL_HLID 0 145#define WL1271_AP_GLOBAL_HLID 0
145#define WL1271_AP_BROADCAST_HLID 1 146#define WL1271_AP_BROADCAST_HLID 1
146#define WL1271_AP_STA_HLID_START 2 147#define WL1271_AP_STA_HLID_START 2
@@ -395,6 +396,7 @@ struct wl1271 {
395 int channel; 396 int channel;
396 u8 role_id; 397 u8 role_id;
397 u8 dev_role_id; 398 u8 dev_role_id;
399 u8 system_hlid;
398 u8 sta_hlid; 400 u8 sta_hlid;
399 u8 dev_hlid; 401 u8 dev_hlid;
400 402