aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorArik Nemtsov <arik@wizery.com>2012-11-28 04:42:42 -0500
committerLuciano Coelho <coelho@ti.com>2012-12-11 05:25:37 -0500
commit9a1009684df5295883ba2eb85066a23ed3c3f6a6 (patch)
treeaf2f60d5022702b47b0577d985c8692ecacaa503 /drivers/net
parent98323895c021ff010685ba77773af876eff503a5 (diff)
wlcore: use link count for single-STA-PSM optimization
Only allow a PSM STA to congest FW memory when it is the single active link. Being a single STA doesn't imply a single link - there might be other links on other roles. [Changed WARN_ON to WARN_ON_ONCE -- Luca] Signed-off-by: Arik Nemtsov <arik@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/ti/wlcore/cmd.c4
-rw-r--r--drivers/net/wireless/ti/wlcore/main.c12
-rw-r--r--drivers/net/wireless/ti/wlcore/tx.c10
-rw-r--r--drivers/net/wireless/ti/wlcore/wlcore.h3
4 files changed, 19 insertions, 10 deletions
diff --git a/drivers/net/wireless/ti/wlcore/cmd.c b/drivers/net/wireless/ti/wlcore/cmd.c
index 1fbee0d51872..14734b7fc6e8 100644
--- a/drivers/net/wireless/ti/wlcore/cmd.c
+++ b/drivers/net/wireless/ti/wlcore/cmd.c
@@ -328,6 +328,8 @@ int wl12xx_allocate_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid)
328 wl->fw_status_2->counters.tx_lnk_free_pkts[link]; 328 wl->fw_status_2->counters.tx_lnk_free_pkts[link];
329 wl->links[link].wlvif = wlvif; 329 wl->links[link].wlvif = wlvif;
330 *hlid = link; 330 *hlid = link;
331
332 wl->active_link_count++;
331 return 0; 333 return 0;
332} 334}
333 335
@@ -357,6 +359,8 @@ void wl12xx_free_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid)
357 wl->links[*hlid].wlvif = NULL; 359 wl->links[*hlid].wlvif = NULL;
358 360
359 *hlid = WL12XX_INVALID_LINK_ID; 361 *hlid = WL12XX_INVALID_LINK_ID;
362 wl->active_link_count--;
363 WARN_ON_ONCE(wl->active_link_count < 0);
360} 364}
361 365
362static u8 wlcore_get_native_channel_type(u8 nl_channel_type) 366static u8 wlcore_get_native_channel_type(u8 nl_channel_type)
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index ba9f0019f20e..b78c47dc0164 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -334,10 +334,10 @@ static void wl12xx_irq_ps_regulate_link(struct wl1271 *wl,
334 struct wl12xx_vif *wlvif, 334 struct wl12xx_vif *wlvif,
335 u8 hlid, u8 tx_pkts) 335 u8 hlid, u8 tx_pkts)
336{ 336{
337 bool fw_ps, single_sta; 337 bool fw_ps, single_link;
338 338
339 fw_ps = test_bit(hlid, (unsigned long *)&wl->ap_fw_ps_map); 339 fw_ps = test_bit(hlid, (unsigned long *)&wl->ap_fw_ps_map);
340 single_sta = (wl->active_sta_count == 1); 340 single_link = (wl->active_link_count == 1);
341 341
342 /* 342 /*
343 * Wake up from high level PS if the STA is asleep with too little 343 * Wake up from high level PS if the STA is asleep with too little
@@ -348,10 +348,10 @@ static void wl12xx_irq_ps_regulate_link(struct wl1271 *wl,
348 348
349 /* 349 /*
350 * Start high-level PS if the STA is asleep with enough blocks in FW. 350 * Start high-level PS if the STA is asleep with enough blocks in FW.
351 * Make an exception if this is the only connected station. In this 351 * Make an exception if this is the only connected link. In this
352 * case FW-memory congestion is not a problem. 352 * case FW-memory congestion is less of a problem.
353 */ 353 */
354 else if (!single_sta && fw_ps && tx_pkts >= WL1271_PS_STA_MAX_PACKETS) 354 else if (!single_link && fw_ps && tx_pkts >= WL1271_PS_STA_MAX_PACKETS)
355 wl12xx_ps_link_start(wl, wlvif, hlid, true); 355 wl12xx_ps_link_start(wl, wlvif, hlid, true);
356} 356}
357 357
@@ -1890,6 +1890,7 @@ static void wlcore_op_stop_locked(struct wl1271 *wl)
1890 memset(wl->roc_map, 0, sizeof(wl->roc_map)); 1890 memset(wl->roc_map, 0, sizeof(wl->roc_map));
1891 memset(wl->session_ids, 0, sizeof(wl->session_ids)); 1891 memset(wl->session_ids, 0, sizeof(wl->session_ids));
1892 wl->active_sta_count = 0; 1892 wl->active_sta_count = 0;
1893 wl->active_link_count = 0;
1893 1894
1894 /* The system link is always allocated */ 1895 /* The system link is always allocated */
1895 wl->links[WL12XX_SYSTEM_HLID].allocated_pkts = 0; 1896 wl->links[WL12XX_SYSTEM_HLID].allocated_pkts = 0;
@@ -5728,6 +5729,7 @@ struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size, u32 aggr_buf_size,
5728 wl->platform_quirks = 0; 5729 wl->platform_quirks = 0;
5729 wl->system_hlid = WL12XX_SYSTEM_HLID; 5730 wl->system_hlid = WL12XX_SYSTEM_HLID;
5730 wl->active_sta_count = 0; 5731 wl->active_sta_count = 0;
5732 wl->active_link_count = 0;
5731 wl->fwlog_size = 0; 5733 wl->fwlog_size = 0;
5732 init_waitqueue_head(&wl->fwlog_waitq); 5734 init_waitqueue_head(&wl->fwlog_waitq);
5733 5735
diff --git a/drivers/net/wireless/ti/wlcore/tx.c b/drivers/net/wireless/ti/wlcore/tx.c
index 25cfd35ab1a2..76dbb6f66d17 100644
--- a/drivers/net/wireless/ti/wlcore/tx.c
+++ b/drivers/net/wireless/ti/wlcore/tx.c
@@ -104,7 +104,7 @@ static void wl1271_tx_regulate_link(struct wl1271 *wl,
104 struct wl12xx_vif *wlvif, 104 struct wl12xx_vif *wlvif,
105 u8 hlid) 105 u8 hlid)
106{ 106{
107 bool fw_ps, single_sta; 107 bool fw_ps, single_link;
108 u8 tx_pkts; 108 u8 tx_pkts;
109 109
110 if (WARN_ON(!test_bit(hlid, wlvif->links_map))) 110 if (WARN_ON(!test_bit(hlid, wlvif->links_map)))
@@ -112,15 +112,15 @@ static void wl1271_tx_regulate_link(struct wl1271 *wl,
112 112
113 fw_ps = test_bit(hlid, (unsigned long *)&wl->ap_fw_ps_map); 113 fw_ps = test_bit(hlid, (unsigned long *)&wl->ap_fw_ps_map);
114 tx_pkts = wl->links[hlid].allocated_pkts; 114 tx_pkts = wl->links[hlid].allocated_pkts;
115 single_sta = (wl->active_sta_count == 1); 115 single_link = (wl->active_link_count == 1);
116 116
117 /* 117 /*
118 * if in FW PS and there is enough data in FW we can put the link 118 * if in FW PS and there is enough data in FW we can put the link
119 * into high-level PS and clean out its TX queues. 119 * into high-level PS and clean out its TX queues.
120 * Make an exception if this is the only connected station. In this 120 * Make an exception if this is the only connected link. In this
121 * case FW-memory congestion is not a problem. 121 * case FW-memory congestion is less of a problem.
122 */ 122 */
123 if (!single_sta && fw_ps && tx_pkts >= WL1271_PS_STA_MAX_PACKETS) 123 if (!single_link && fw_ps && tx_pkts >= WL1271_PS_STA_MAX_PACKETS)
124 wl12xx_ps_link_start(wl, wlvif, hlid, true); 124 wl12xx_ps_link_start(wl, wlvif, hlid, true);
125} 125}
126 126
diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h
index 58e52505ec17..22347e864f51 100644
--- a/drivers/net/wireless/ti/wlcore/wlcore.h
+++ b/drivers/net/wireless/ti/wlcore/wlcore.h
@@ -369,6 +369,9 @@ struct wl1271 {
369 */ 369 */
370 struct wl1271_link links[WL12XX_MAX_LINKS]; 370 struct wl1271_link links[WL12XX_MAX_LINKS];
371 371
372 /* number of currently active links */
373 int active_link_count;
374
372 /* Fast/slow links bitmap according to FW */ 375 /* Fast/slow links bitmap according to FW */
373 u32 fw_fast_lnk_map; 376 u32 fw_fast_lnk_map;
374 377