Skip to content

Commit

Permalink
wl12xx: don't regulate links when a single STA is connected
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ariknem committed Jul 7, 2011
1 parent 10bc822 commit f8b899e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
15 changes: 12 additions & 3 deletions drivers/net/wireless/wl12xx/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -768,13 +768,14 @@ static int wl1271_plt_init(struct wl1271 *wl)

static void wl1271_irq_ps_regulate_link(struct wl1271 *wl, u8 hlid, u8 tx_pkts)
{
bool fw_ps;
bool fw_ps, single_sta;

/* only regulate station links */
if (hlid < WL1271_AP_STA_HLID_START)
return;

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
Expand All @@ -783,8 +784,12 @@ static void wl1271_irq_ps_regulate_link(struct wl1271 *wl, u8 hlid, u8 tx_pkts)
if (!fw_ps || tx_pkts < WL1271_PS_STA_MAX_PACKETS)
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);
}

Expand Down Expand Up @@ -2094,6 +2099,7 @@ static void __wl1271_op_remove_interface(struct wl1271 *wl,
wl->dev_role_id = WL1271_INVALID_ROLE_ID;
memset(wl->roles_map, 0, sizeof(wl->roles_map));
memset(wl->links_map, 0, sizeof(wl->links_map));
wl->active_sta_count = 0;

/* The system link is always allocated */
__set_bit(WL1271_SYSTEM_HLID, wl->links_map);
Expand Down Expand Up @@ -3829,6 +3835,7 @@ static int wl1271_allocate_sta(struct wl1271 *wl,
wl_sta->hlid = WL1271_AP_STA_HLID_START + id;
*hlid = wl_sta->hlid;
memcpy(wl->links[wl_sta->hlid].addr, sta->addr, ETH_ALEN);
wl->active_sta_count++;
return 0;
}

Expand All @@ -3844,6 +3851,7 @@ static void wl1271_free_sta(struct wl1271 *wl, u8 hlid)
wl1271_tx_reset_link_queues(wl, hlid);
__clear_bit(hlid, &wl->ap_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,
Expand Down Expand Up @@ -4718,6 +4726,7 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
wl->ap_global_hlid = WL1271_INVALID_LINK_ID;
wl->tx_security_seq = 0;
wl->tx_security_last_seq_lsb = 0;
wl->active_sta_count = 0;

setup_timer(&wl->rx_streaming_timer, wl1271_rx_streaming_timer,
(unsigned long) wl);
Expand Down
7 changes: 5 additions & 2 deletions drivers/net/wireless/wl12xx/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ static void wl1271_tx_ap_update_inconnection_sta(struct wl1271 *wl,

static void wl1271_tx_regulate_link(struct wl1271 *wl, u8 hlid)
{
bool fw_ps;
bool fw_ps, single_sta;
u8 tx_pkts;

/* only regulate station links */
Expand All @@ -148,12 +148,15 @@ static void wl1271_tx_regulate_link(struct wl1271 *wl, u8 hlid)

fw_ps = test_bit(hlid, (unsigned long *)&wl->ap_fw_ps_map);
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
* 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);
}

Expand Down
3 changes: 3 additions & 0 deletions drivers/net/wireless/wl12xx/wl12xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,9 @@ struct wl1271 {

/* number of currently active RX BA sessions */
int ba_rx_session_count;

/* AP-mode - number of currently connected stations */
int active_sta_count;
};

struct wl1271_station {
Expand Down

0 comments on commit f8b899e

Please sign in to comment.