aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ti
diff options
context:
space:
mode:
authorArik Nemtsov <arik@wizery.com>2011-12-07 16:38:47 -0500
committerLuciano Coelho <coelho@ti.com>2012-04-12 01:43:58 -0400
commit3edab305dfd48415074a36f1cdd605dcae8463de (patch)
tree090df6dff3214f856b54ceaf7b287737e0aacf60 /drivers/net/wireless/ti
parent72b0624fa5b766133fd0be9099724324b1f0d70e (diff)
wlcore/wl12xx: change GEM Tx-spare blocks per-vif
The number of spare Tx blocks must be changed when the GEM cipher is engaged. Track set_key() operations to see if this is the case and change the Tx HW spare block count accordingly. Set the number of spare blocks for each operating mode from the low level driver. Signed-off-by: Arik Nemtsov <arik@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers/net/wireless/ti')
-rw-r--r--drivers/net/wireless/ti/wl12xx/main.c6
-rw-r--r--drivers/net/wireless/ti/wlcore/debugfs.c1
-rw-r--r--drivers/net/wireless/ti/wlcore/main.c24
-rw-r--r--drivers/net/wireless/ti/wlcore/tx.c9
-rw-r--r--drivers/net/wireless/ti/wlcore/tx.h1
-rw-r--r--drivers/net/wireless/ti/wlcore/wl12xx.h3
-rw-r--r--drivers/net/wireless/ti/wlcore/wlcore.h7
7 files changed, 29 insertions, 22 deletions
diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c
index 57c70a4321e8..3447cefb6483 100644
--- a/drivers/net/wireless/ti/wl12xx/main.c
+++ b/drivers/net/wireless/ti/wl12xx/main.c
@@ -34,6 +34,10 @@
34 34
35#include "reg.h" 35#include "reg.h"
36 36
37#define WL12XX_TX_HW_BLOCK_SPARE_DEFAULT 1
38#define WL12XX_TX_HW_BLOCK_GEM_SPARE 2
39
40
37static struct wlcore_partition_set wl12xx_ptable[PART_TABLE_LEN] = { 41static struct wlcore_partition_set wl12xx_ptable[PART_TABLE_LEN] = {
38 [PART_DOWN] = { 42 [PART_DOWN] = {
39 .mem = { 43 .mem = {
@@ -675,6 +679,8 @@ static int __devinit wl12xx_probe(struct platform_device *pdev)
675 wl->ptable = wl12xx_ptable; 679 wl->ptable = wl12xx_ptable;
676 wl->rtable = wl12xx_rtable; 680 wl->rtable = wl12xx_rtable;
677 wl->num_tx_desc = 16; 681 wl->num_tx_desc = 16;
682 wl->normal_tx_spare = WL12XX_TX_HW_BLOCK_SPARE_DEFAULT;
683 wl->gem_tx_spare = WL12XX_TX_HW_BLOCK_GEM_SPARE;
678 684
679 return wlcore_probe(wl, pdev); 685 return wlcore_probe(wl, pdev);
680} 686}
diff --git a/drivers/net/wireless/ti/wlcore/debugfs.c b/drivers/net/wireless/ti/wlcore/debugfs.c
index 02e4255ed7ac..0b775e35b5df 100644
--- a/drivers/net/wireless/ti/wlcore/debugfs.c
+++ b/drivers/net/wireless/ti/wlcore/debugfs.c
@@ -653,6 +653,7 @@ static ssize_t vifs_state_read(struct file *file, char __user *user_buf,
653 VIF_STATE_PRINT_INT(last_rssi_event); 653 VIF_STATE_PRINT_INT(last_rssi_event);
654 VIF_STATE_PRINT_INT(ba_support); 654 VIF_STATE_PRINT_INT(ba_support);
655 VIF_STATE_PRINT_INT(ba_allowed); 655 VIF_STATE_PRINT_INT(ba_allowed);
656 VIF_STATE_PRINT_INT(is_gem);
656 VIF_STATE_PRINT_LLHEX(tx_security_seq); 657 VIF_STATE_PRINT_LLHEX(tx_security_seq);
657 VIF_STATE_PRINT_INT(tx_security_last_seq_lsb); 658 VIF_STATE_PRINT_INT(tx_security_last_seq_lsb);
658 } 659 }
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index 7b39a861d6b7..b56bbc360fcc 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -1858,7 +1858,6 @@ static void wl1271_op_stop(struct ieee80211_hw *hw)
1858 wl->tx_results_count = 0; 1858 wl->tx_results_count = 0;
1859 wl->tx_packets_count = 0; 1859 wl->tx_packets_count = 0;
1860 wl->time_offset = 0; 1860 wl->time_offset = 0;
1861 wl->tx_spare_blocks = TX_HW_BLOCK_SPARE_DEFAULT;
1862 wl->ap_fw_ps_map = 0; 1861 wl->ap_fw_ps_map = 0;
1863 wl->ap_ps_map = 0; 1862 wl->ap_ps_map = 0;
1864 wl->sched_scanning = false; 1863 wl->sched_scanning = false;
@@ -2912,6 +2911,17 @@ static int wl1271_set_key(struct wl1271 *wl, struct wl12xx_vif *wlvif,
2912 int ret; 2911 int ret;
2913 bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); 2912 bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS);
2914 2913
2914 /*
2915 * A role set to GEM cipher requires different Tx settings (namely
2916 * spare blocks). Note when we are in this mode so the HW can adjust.
2917 */
2918 if (key_type == KEY_GEM) {
2919 if (action == KEY_ADD_OR_REPLACE)
2920 wlvif->is_gem = true;
2921 else if (action == KEY_REMOVE)
2922 wlvif->is_gem = false;
2923 }
2924
2915 if (is_ap) { 2925 if (is_ap) {
2916 struct wl1271_station *wl_sta; 2926 struct wl1271_station *wl_sta;
2917 u8 hlid; 2927 u8 hlid;
@@ -2950,17 +2960,6 @@ static int wl1271_set_key(struct wl1271 *wl, struct wl12xx_vif *wlvif,
2950 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 2960 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
2951 }; 2961 };
2952 2962
2953 /*
2954 * A STA set to GEM cipher requires 2 tx spare blocks.
2955 * Return to default value when GEM cipher key is removed
2956 */
2957 if (key_type == KEY_GEM) {
2958 if (action == KEY_ADD_OR_REPLACE)
2959 wl->tx_spare_blocks = 2;
2960 else if (action == KEY_REMOVE)
2961 wl->tx_spare_blocks = TX_HW_BLOCK_SPARE_DEFAULT;
2962 }
2963
2964 addr = sta ? sta->addr : bcast_addr; 2963 addr = sta ? sta->addr : bcast_addr;
2965 2964
2966 if (is_zero_ether_addr(addr)) { 2965 if (is_zero_ether_addr(addr)) {
@@ -5259,7 +5258,6 @@ struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size)
5259 wl->quirks = 0; 5258 wl->quirks = 0;
5260 wl->platform_quirks = 0; 5259 wl->platform_quirks = 0;
5261 wl->sched_scanning = false; 5260 wl->sched_scanning = false;
5262 wl->tx_spare_blocks = TX_HW_BLOCK_SPARE_DEFAULT;
5263 wl->system_hlid = WL12XX_SYSTEM_HLID; 5261 wl->system_hlid = WL12XX_SYSTEM_HLID;
5264 wl->active_sta_count = 0; 5262 wl->active_sta_count = 0;
5265 wl->fwlog_size = 0; 5263 wl->fwlog_size = 0;
diff --git a/drivers/net/wireless/ti/wlcore/tx.c b/drivers/net/wireless/ti/wlcore/tx.c
index 815d0acb84db..3306990c1364 100644
--- a/drivers/net/wireless/ti/wlcore/tx.c
+++ b/drivers/net/wireless/ti/wlcore/tx.c
@@ -190,7 +190,7 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct wl12xx_vif *wlvif,
190 u32 len; 190 u32 len;
191 u32 total_blocks; 191 u32 total_blocks;
192 int id, ret = -EBUSY, ac; 192 int id, ret = -EBUSY, ac;
193 u32 spare_blocks = wl->tx_spare_blocks; 193 u32 spare_blocks = wl->normal_tx_spare;
194 bool is_dummy = false; 194 bool is_dummy = false;
195 195
196 if (buf_offset + total_len > WL1271_AGGR_BUFFER_SIZE) 196 if (buf_offset + total_len > WL1271_AGGR_BUFFER_SIZE)
@@ -205,11 +205,10 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct wl12xx_vif *wlvif,
205 in the firmware */ 205 in the firmware */
206 len = wl12xx_calc_packet_alignment(wl, total_len); 206 len = wl12xx_calc_packet_alignment(wl, total_len);
207 207
208 /* in case of a dummy packet, use default amount of spare mem blocks */ 208 if (unlikely(wl12xx_is_dummy_packet(wl, skb)))
209 if (unlikely(wl12xx_is_dummy_packet(wl, skb))) {
210 is_dummy = true; 209 is_dummy = true;
211 spare_blocks = TX_HW_BLOCK_SPARE_DEFAULT; 210 else if (wlvif->is_gem)
212 } 211 spare_blocks = wl->gem_tx_spare;
213 212
214 total_blocks = (len + TX_HW_BLOCK_SIZE - 1) / TX_HW_BLOCK_SIZE + 213 total_blocks = (len + TX_HW_BLOCK_SIZE - 1) / TX_HW_BLOCK_SIZE +
215 spare_blocks; 214 spare_blocks;
diff --git a/drivers/net/wireless/ti/wlcore/tx.h b/drivers/net/wireless/ti/wlcore/tx.h
index 5cf8c32d40d1..2ad770565217 100644
--- a/drivers/net/wireless/ti/wlcore/tx.h
+++ b/drivers/net/wireless/ti/wlcore/tx.h
@@ -25,7 +25,6 @@
25#ifndef __TX_H__ 25#ifndef __TX_H__
26#define __TX_H__ 26#define __TX_H__
27 27
28#define TX_HW_BLOCK_SPARE_DEFAULT 1
29#define TX_HW_BLOCK_SIZE 252 28#define TX_HW_BLOCK_SIZE 252
30 29
31#define TX_HW_MGMT_PKT_LIFETIME_TU 2000 30#define TX_HW_MGMT_PKT_LIFETIME_TU 2000
diff --git a/drivers/net/wireless/ti/wlcore/wl12xx.h b/drivers/net/wireless/ti/wlcore/wl12xx.h
index 15166222cfc8..b09c9ed4bbd1 100644
--- a/drivers/net/wireless/ti/wlcore/wl12xx.h
+++ b/drivers/net/wireless/ti/wlcore/wl12xx.h
@@ -375,6 +375,9 @@ struct wl12xx_vif {
375 struct work_struct rx_streaming_disable_work; 375 struct work_struct rx_streaming_disable_work;
376 struct timer_list rx_streaming_timer; 376 struct timer_list rx_streaming_timer;
377 377
378 /* does the current role use GEM for encryption (AP or STA) */
379 bool is_gem;
380
378 /* 381 /*
379 * This struct must be last! 382 * This struct must be last!
380 * data that has to be saved acrossed reconfigs (e.g. recovery) 383 * data that has to be saved acrossed reconfigs (e.g. recovery)
diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h
index a4f576dbcd2b..2fb713a8b268 100644
--- a/drivers/net/wireless/ti/wlcore/wlcore.h
+++ b/drivers/net/wireless/ti/wlcore/wlcore.h
@@ -150,9 +150,6 @@ struct wl1271 {
150 u32 tx_allocated_blocks; 150 u32 tx_allocated_blocks;
151 u32 tx_results_count; 151 u32 tx_results_count;
152 152
153 /* amount of spare TX blocks to use */
154 u32 tx_spare_blocks;
155
156 /* Accounting for allocated / available Tx packets in HW */ 153 /* Accounting for allocated / available Tx packets in HW */
157 u32 tx_pkts_freed[NUM_TX_QUEUES]; 154 u32 tx_pkts_freed[NUM_TX_QUEUES];
158 u32 tx_allocated_pkts[NUM_TX_QUEUES]; 155 u32 tx_allocated_pkts[NUM_TX_QUEUES];
@@ -309,6 +306,10 @@ struct wl1271 {
309 306
310 /* number of TX descriptors the HW supports. */ 307 /* number of TX descriptors the HW supports. */
311 u32 num_tx_desc; 308 u32 num_tx_desc;
309
310 /* spare Tx blocks for normal/GEM operating modes */
311 u32 normal_tx_spare;
312 u32 gem_tx_spare;
312}; 313};
313 314
314int __devinit wlcore_probe(struct wl1271 *wl, struct platform_device *pdev); 315int __devinit wlcore_probe(struct wl1271 *wl, struct platform_device *pdev);