Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a100968 authored by Arik Nemtsov's avatar Arik Nemtsov Committed by Luciano Coelho
Browse files

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: default avatarArik Nemtsov <arik@wizery.com>
Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
parent 98323895
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -328,6 +328,8 @@ int wl12xx_allocate_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid)
			wl->fw_status_2->counters.tx_lnk_free_pkts[link];
			wl->fw_status_2->counters.tx_lnk_free_pkts[link];
	wl->links[link].wlvif = wlvif;
	wl->links[link].wlvif = wlvif;
	*hlid = link;
	*hlid = link;

	wl->active_link_count++;
	return 0;
	return 0;
}
}


@@ -357,6 +359,8 @@ void wl12xx_free_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid)
	wl->links[*hlid].wlvif = NULL;
	wl->links[*hlid].wlvif = NULL;


	*hlid = WL12XX_INVALID_LINK_ID;
	*hlid = WL12XX_INVALID_LINK_ID;
	wl->active_link_count--;
	WARN_ON_ONCE(wl->active_link_count < 0);
}
}


static u8 wlcore_get_native_channel_type(u8 nl_channel_type)
static u8 wlcore_get_native_channel_type(u8 nl_channel_type)
+7 −5
Original line number Original line Diff line number Diff line
@@ -334,10 +334,10 @@ static void wl12xx_irq_ps_regulate_link(struct wl1271 *wl,
					struct wl12xx_vif *wlvif,
					struct wl12xx_vif *wlvif,
					u8 hlid, u8 tx_pkts)
					u8 hlid, u8 tx_pkts)
{
{
	bool fw_ps, single_sta;
	bool fw_ps, single_link;


	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);
	single_link = (wl->active_link_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
@@ -348,10 +348,10 @@ static void wl12xx_irq_ps_regulate_link(struct wl1271 *wl,


	/*
	/*
	 * Start high-level PS if the STA is asleep with enough blocks in FW.
	 * 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
	 * Make an exception if this is the only connected link. In this
	 * case FW-memory congestion is not a problem.
	 * case FW-memory congestion is less of a problem.
	 */
	 */
	else if (!single_sta && fw_ps && tx_pkts >= WL1271_PS_STA_MAX_PACKETS)
	else if (!single_link && fw_ps && tx_pkts >= WL1271_PS_STA_MAX_PACKETS)
		wl12xx_ps_link_start(wl, wlvif, hlid, true);
		wl12xx_ps_link_start(wl, wlvif, hlid, true);
}
}


@@ -1890,6 +1890,7 @@ static void wlcore_op_stop_locked(struct wl1271 *wl)
	memset(wl->roc_map, 0, sizeof(wl->roc_map));
	memset(wl->roc_map, 0, sizeof(wl->roc_map));
	memset(wl->session_ids, 0, sizeof(wl->session_ids));
	memset(wl->session_ids, 0, sizeof(wl->session_ids));
	wl->active_sta_count = 0;
	wl->active_sta_count = 0;
	wl->active_link_count = 0;


	/* The system link is always allocated */
	/* The system link is always allocated */
	wl->links[WL12XX_SYSTEM_HLID].allocated_pkts = 0;
	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,
	wl->platform_quirks = 0;
	wl->platform_quirks = 0;
	wl->system_hlid = WL12XX_SYSTEM_HLID;
	wl->system_hlid = WL12XX_SYSTEM_HLID;
	wl->active_sta_count = 0;
	wl->active_sta_count = 0;
	wl->active_link_count = 0;
	wl->fwlog_size = 0;
	wl->fwlog_size = 0;
	init_waitqueue_head(&wl->fwlog_waitq);
	init_waitqueue_head(&wl->fwlog_waitq);


+5 −5
Original line number Original line Diff line number Diff line
@@ -104,7 +104,7 @@ static void wl1271_tx_regulate_link(struct wl1271 *wl,
				    struct wl12xx_vif *wlvif,
				    struct wl12xx_vif *wlvif,
				    u8 hlid)
				    u8 hlid)
{
{
	bool fw_ps, single_sta;
	bool fw_ps, single_link;
	u8 tx_pkts;
	u8 tx_pkts;


	if (WARN_ON(!test_bit(hlid, wlvif->links_map)))
	if (WARN_ON(!test_bit(hlid, wlvif->links_map)))
@@ -112,15 +112,15 @@ static void wl1271_tx_regulate_link(struct wl1271 *wl,


	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);
	single_link = (wl->active_link_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
	 * Make an exception if this is the only connected link. In this
	 * case FW-memory congestion is not a problem.
	 * case FW-memory congestion is less of a problem.
	 */
	 */
	if (!single_sta && fw_ps && tx_pkts >= WL1271_PS_STA_MAX_PACKETS)
	if (!single_link && fw_ps && tx_pkts >= WL1271_PS_STA_MAX_PACKETS)
		wl12xx_ps_link_start(wl, wlvif, hlid, true);
		wl12xx_ps_link_start(wl, wlvif, hlid, true);
}
}


+3 −0
Original line number Original line Diff line number Diff line
@@ -369,6 +369,9 @@ struct wl1271 {
	 */
	 */
	struct wl1271_link links[WL12XX_MAX_LINKS];
	struct wl1271_link links[WL12XX_MAX_LINKS];


	/* number of currently active links */
	int active_link_count;

	/* Fast/slow links bitmap according to FW */
	/* Fast/slow links bitmap according to FW */
	u32 fw_fast_lnk_map;
	u32 fw_fast_lnk_map;