Commit da03209e authored by Arik Nemtsov's avatar Arik Nemtsov Committed by Luciano Coelho

wl12xx: don't regulate links when a single STA is connected

When operating as AP track the number of connected stations. When a
single STA is connected don't regulate the PS status of the link.
Since this is the only STA connected, there's no point holding space in
FW for other links. This will speed up communications with a single
connected STA in PSM.
Signed-off-by: default avatarArik Nemtsov <arik@wizery.com>
Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
parent c47e8229
...@@ -770,13 +770,14 @@ static int wl1271_plt_init(struct wl1271 *wl) ...@@ -770,13 +770,14 @@ static int wl1271_plt_init(struct wl1271 *wl)
static void wl12xx_irq_ps_regulate_link(struct wl1271 *wl, u8 hlid, u8 tx_pkts) static void wl12xx_irq_ps_regulate_link(struct wl1271 *wl, u8 hlid, u8 tx_pkts)
{ {
bool fw_ps; bool fw_ps, single_sta;
/* only regulate station links */ /* only regulate station links */
if (hlid < WL1271_AP_STA_HLID_START) if (hlid < WL1271_AP_STA_HLID_START)
return; return;
fw_ps = test_bit(hlid, (unsigned long *)&wl->ap_fw_ps_map); fw_ps = test_bit(hlid, (unsigned long *)&wl->ap_fw_ps_map);
single_sta = (wl->active_sta_count == 1);
/* /*
* Wake up from high level PS if the STA is asleep with too little * Wake up from high level PS if the STA is asleep with too little
...@@ -785,8 +786,12 @@ static void wl12xx_irq_ps_regulate_link(struct wl1271 *wl, u8 hlid, u8 tx_pkts) ...@@ -785,8 +786,12 @@ static void wl12xx_irq_ps_regulate_link(struct wl1271 *wl, u8 hlid, u8 tx_pkts)
if (!fw_ps || tx_pkts < WL1271_PS_STA_MAX_PACKETS) if (!fw_ps || tx_pkts < WL1271_PS_STA_MAX_PACKETS)
wl1271_ps_link_end(wl, hlid); wl1271_ps_link_end(wl, hlid);
/* Start high-level PS if the STA is asleep with enough blocks in FW */ /*
else if (fw_ps && tx_pkts >= WL1271_PS_STA_MAX_PACKETS) * Start high-level PS if the STA is asleep with enough blocks in FW.
* Make an exception if this is the only connected station. In this
* case FW-memory congestion is not a problem.
*/
else if (!single_sta && fw_ps && tx_pkts >= WL1271_PS_STA_MAX_PACKETS)
wl1271_ps_link_start(wl, hlid, true); wl1271_ps_link_start(wl, hlid, true);
} }
...@@ -2093,6 +2098,7 @@ static void __wl1271_op_remove_interface(struct wl1271 *wl, ...@@ -2093,6 +2098,7 @@ static void __wl1271_op_remove_interface(struct wl1271 *wl,
memset(wl->roles_map, 0, sizeof(wl->roles_map)); memset(wl->roles_map, 0, sizeof(wl->roles_map));
memset(wl->links_map, 0, sizeof(wl->links_map)); memset(wl->links_map, 0, sizeof(wl->links_map));
memset(wl->roc_map, 0, sizeof(wl->roc_map)); memset(wl->roc_map, 0, sizeof(wl->roc_map));
wl->active_sta_count = 0;
/* The system link is always allocated */ /* The system link is always allocated */
__set_bit(WL12XX_SYSTEM_HLID, wl->links_map); __set_bit(WL12XX_SYSTEM_HLID, wl->links_map);
...@@ -3747,6 +3753,7 @@ static int wl1271_allocate_sta(struct wl1271 *wl, ...@@ -3747,6 +3753,7 @@ static int wl1271_allocate_sta(struct wl1271 *wl,
wl_sta->hlid = WL1271_AP_STA_HLID_START + id; wl_sta->hlid = WL1271_AP_STA_HLID_START + id;
*hlid = wl_sta->hlid; *hlid = wl_sta->hlid;
memcpy(wl->links[wl_sta->hlid].addr, sta->addr, ETH_ALEN); memcpy(wl->links[wl_sta->hlid].addr, sta->addr, ETH_ALEN);
wl->active_sta_count++;
return 0; return 0;
} }
...@@ -3763,6 +3770,7 @@ static void wl1271_free_sta(struct wl1271 *wl, u8 hlid) ...@@ -3763,6 +3770,7 @@ static void wl1271_free_sta(struct wl1271 *wl, u8 hlid)
wl1271_tx_reset_link_queues(wl, hlid); wl1271_tx_reset_link_queues(wl, hlid);
__clear_bit(hlid, &wl->ap_ps_map); __clear_bit(hlid, &wl->ap_ps_map);
__clear_bit(hlid, (unsigned long *)&wl->ap_fw_ps_map); __clear_bit(hlid, (unsigned long *)&wl->ap_fw_ps_map);
wl->active_sta_count--;
} }
static int wl1271_op_sta_add(struct ieee80211_hw *hw, static int wl1271_op_sta_add(struct ieee80211_hw *hw,
...@@ -4640,6 +4648,7 @@ struct ieee80211_hw *wl1271_alloc_hw(void) ...@@ -4640,6 +4648,7 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
wl->session_counter = 0; wl->session_counter = 0;
wl->ap_bcast_hlid = WL12XX_INVALID_LINK_ID; wl->ap_bcast_hlid = WL12XX_INVALID_LINK_ID;
wl->ap_global_hlid = WL12XX_INVALID_LINK_ID; wl->ap_global_hlid = WL12XX_INVALID_LINK_ID;
wl->active_sta_count = 0;
setup_timer(&wl->rx_streaming_timer, wl1271_rx_streaming_timer, setup_timer(&wl->rx_streaming_timer, wl1271_rx_streaming_timer,
(unsigned long) wl); (unsigned long) wl);
wl->fwlog_size = 0; wl->fwlog_size = 0;
......
...@@ -126,7 +126,7 @@ static void wl1271_tx_ap_update_inconnection_sta(struct wl1271 *wl, ...@@ -126,7 +126,7 @@ static void wl1271_tx_ap_update_inconnection_sta(struct wl1271 *wl,
static void wl1271_tx_regulate_link(struct wl1271 *wl, u8 hlid) static void wl1271_tx_regulate_link(struct wl1271 *wl, u8 hlid)
{ {
bool fw_ps; bool fw_ps, single_sta;
u8 tx_pkts; u8 tx_pkts;
/* only regulate station links */ /* only regulate station links */
...@@ -138,12 +138,15 @@ static void wl1271_tx_regulate_link(struct wl1271 *wl, u8 hlid) ...@@ -138,12 +138,15 @@ static void wl1271_tx_regulate_link(struct wl1271 *wl, u8 hlid)
fw_ps = test_bit(hlid, (unsigned long *)&wl->ap_fw_ps_map); fw_ps = test_bit(hlid, (unsigned long *)&wl->ap_fw_ps_map);
tx_pkts = wl->links[hlid].allocated_pkts; tx_pkts = wl->links[hlid].allocated_pkts;
single_sta = (wl->active_sta_count == 1);
/* /*
* if in FW PS and there is enough data in FW we can put the link * if in FW PS and there is enough data in FW we can put the link
* into high-level PS and clean out its TX queues. * into high-level PS and clean out its TX queues.
* Make an exception if this is the only connected station. In this
* case FW-memory congestion is not a problem.
*/ */
if (fw_ps && tx_pkts >= WL1271_PS_STA_MAX_PACKETS) if (!single_sta && fw_ps && tx_pkts >= WL1271_PS_STA_MAX_PACKETS)
wl1271_ps_link_start(wl, hlid, true); wl1271_ps_link_start(wl, hlid, true);
} }
......
...@@ -626,6 +626,9 @@ struct wl1271 { ...@@ -626,6 +626,9 @@ struct wl1271 {
/* number of currently active RX BA sessions */ /* number of currently active RX BA sessions */
int ba_rx_session_count; int ba_rx_session_count;
/* AP-mode - number of currently connected stations */
int active_sta_count;
}; };
struct wl1271_station { struct wl1271_station {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment