Skip to content
Permalink
Browse files
brcmfmac: Configure keep-alive packet on suspend
When system enter suspend, there is no more wireless traffic, and
if there is no incoming data, most of the AP kick-out the client
station after few minutes because of inactivity.

The usual way to prevent this is to submit a Null function frame
periodically as a keep-alive. This is supported by brcm controllers
and can be configured via the mkeep_alive IOVAR.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
  • Loading branch information
Loic Poulain authored and intel-lab-lkp committed Nov 22, 2021
1 parent 728e26c commit 13a67e895024e7cdbf0faa409fe3349cb0d741fc
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
@@ -3901,6 +3901,24 @@ static void brcmf_configure_wowl(struct brcmf_cfg80211_info *cfg,
cfg->wowl.active = true;
}

int brcmf_keepalive_start(struct brcmf_if *ifp, unsigned int interval)
{
struct brcmf_mkeep_alive_pkt_le kalive = {0};
int ret = 0;

/* Configure Null function/data keepalive */
kalive.version = cpu_to_le16(1);
kalive.period_msec = cpu_to_le16(interval * MSEC_PER_SEC);
kalive.len_bytes = cpu_to_le16(0);
kalive.keep_alive_id = cpu_to_le16(0);

ret = brcmf_fil_iovar_data_set(ifp, "mkeep_alive", &kalive, sizeof(kalive));
if (ret)
brcmf_err("keep-alive packet config failed, ret=%d\n", ret);

return ret;
}

static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,
struct cfg80211_wowlan *wowl)
{
@@ -3947,6 +3965,9 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,
} else {
/* Configure WOWL paramaters */
brcmf_configure_wowl(cfg, ifp, wowl);

/* Prevent disassociation due to inactivity with keep-alive */
brcmf_keepalive_start(ifp, 30);
}

exit:
@@ -1052,4 +1052,23 @@ struct brcmf_gscan_config {
struct brcmf_gscan_bucket_config bucket[1];
};

/**
* struct brcmf_mkeep_alive_pkt_le - configuration data for keep-alive frame.
*
* @version: version for mkeep_alive
* @length: length of fixed parameters in the structure.
* @period_msec: keep-alive period in milliseconds.
* @len_bytes: size of the data.
* @keep_alive_id: ID (0 - 3).
* @data: keep-alive frame data.
*/
struct brcmf_mkeep_alive_pkt_le {
__le16 version;
__le16 length;
__le32 period_msec;
__le16 len_bytes;
u8 keep_alive_id;
u8 data[0];
} __packed;

#endif /* FWIL_TYPES_H_ */

0 comments on commit 13a67e8

Please sign in to comment.