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

Commit 8de00f1b authored by chunfan chen's avatar chunfan chen Committed by Kalle Valo
Browse files

mwifiex: report wakeup reason to cfg80211



This patch adds code to report wakeup reason to cfg80211
when system is resumed.

Signed-off-by: default avatarchunfan chen <jeffc@marvell.com>
Signed-off-by: default avatarAmitkumar Karwar <akarwar@marvell.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 7d7f07d8
Loading
Loading
Loading
Loading
+58 −0
Original line number Diff line number Diff line
@@ -3316,6 +3316,64 @@ static int mwifiex_cfg80211_suspend(struct wiphy *wiphy,

static int mwifiex_cfg80211_resume(struct wiphy *wiphy)
{
	struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy);
	struct mwifiex_private *priv =
		mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA);
	struct mwifiex_ds_wakeup_reason wakeup_reason;
	struct cfg80211_wowlan_wakeup wakeup_report;
	int i;

	mwifiex_get_wakeup_reason(priv, HostCmd_ACT_GEN_GET, MWIFIEX_SYNC_CMD,
				  &wakeup_reason);
	memset(&wakeup_report, 0, sizeof(struct cfg80211_wowlan_wakeup));

	wakeup_report.pattern_idx = -1;

	switch (wakeup_reason.hs_wakeup_reason) {
	case NO_HSWAKEUP_REASON:
		break;
	case BCAST_DATA_MATCHED:
		break;
	case MCAST_DATA_MATCHED:
		break;
	case UCAST_DATA_MATCHED:
		break;
	case MASKTABLE_EVENT_MATCHED:
		break;
	case NON_MASKABLE_EVENT_MATCHED:
		if (wiphy->wowlan_config->disconnect)
			wakeup_report.disconnect = true;
		if (wiphy->wowlan_config->nd_config)
			wakeup_report.net_detect = adapter->nd_info;
		break;
	case NON_MASKABLE_CONDITION_MATCHED:
		break;
	case MAGIC_PATTERN_MATCHED:
		if (wiphy->wowlan_config->magic_pkt)
			wakeup_report.magic_pkt = true;
		if (wiphy->wowlan_config->n_patterns)
			wakeup_report.pattern_idx = 1;
		break;
	case CONTROL_FRAME_MATCHED:
		break;
	case	MANAGEMENT_FRAME_MATCHED:
		break;
	default:
		break;
	}

	if ((wakeup_reason.hs_wakeup_reason > 0) &&
	    (wakeup_reason.hs_wakeup_reason <= 7))
		cfg80211_report_wowlan_wakeup(&priv->wdev, &wakeup_report,
					      GFP_KERNEL);

	if (adapter->nd_info) {
		for (i = 0 ; i < adapter->nd_info->n_matches ; i++)
			kfree(adapter->nd_info->matches[i]);
		kfree(adapter->nd_info);
		adapter->nd_info = NULL;
	}

	return 0;
}

+13 −0
Original line number Diff line number Diff line
@@ -1657,3 +1657,16 @@ int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv,

	return 0;
}

/* This function handles the command response of hs wakeup reason
 * command.
 */
int mwifiex_ret_wakeup_reason(struct mwifiex_private *priv,
			      struct host_cmd_ds_command *resp,
			      struct host_cmd_ds_wakeup_reason *wakeup_reason)
{
	wakeup_reason->wakeup_reason =
		resp->params.hs_wakeup_reason.wakeup_reason;

	return 0;
}
+20 −0
Original line number Diff line number Diff line
@@ -373,6 +373,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {
#define HostCmd_CMD_MGMT_FRAME_REG                    0x010c
#define HostCmd_CMD_REMAIN_ON_CHAN                    0x010d
#define HostCmd_CMD_11AC_CFG			      0x0112
#define HostCmd_CMD_HS_WAKEUP_REASON                  0x0116
#define HostCmd_CMD_TDLS_CONFIG                       0x0100
#define HostCmd_CMD_MC_POLICY                         0x0121
#define HostCmd_CMD_TDLS_OPER                         0x0122
@@ -607,6 +608,20 @@ struct mwifiex_ie_types_data {
#define MWIFIEX_RXPD_FLAGS_TDLS_PACKET      0x01
#define MWIFIEX_TXPD_FLAGS_REQ_TX_STATUS    0x20

enum HS_WAKEUP_REASON {
	NO_HSWAKEUP_REASON = 0,
	BCAST_DATA_MATCHED,
	MCAST_DATA_MATCHED,
	UCAST_DATA_MATCHED,
	MASKTABLE_EVENT_MATCHED,
	NON_MASKABLE_EVENT_MATCHED,
	NON_MASKABLE_CONDITION_MATCHED,
	MAGIC_PATTERN_MATCHED,
	CONTROL_FRAME_MATCHED,
	MANAGEMENT_FRAME_MATCHED,
	RESERVED
};

struct txpd {
	u8 bss_type;
	u8 bss_num;
@@ -2159,6 +2174,10 @@ struct host_cmd_ds_robust_coex {
	__le16 reserved;
} __packed;

struct host_cmd_ds_wakeup_reason {
	u16  wakeup_reason;
} __packed;

struct host_cmd_ds_command {
	__le16 command;
	__le16 size;
@@ -2231,6 +2250,7 @@ struct host_cmd_ds_command {
		struct host_cmd_sdio_sp_rx_aggr_cfg sdio_rx_aggr_cfg;
		struct host_cmd_ds_multi_chan_policy mc_policy;
		struct host_cmd_ds_robust_coex coex;
		struct host_cmd_ds_wakeup_reason hs_wakeup_reason;
	} params;
} __packed;

+4 −0
Original line number Diff line number Diff line
@@ -271,6 +271,10 @@ struct mwifiex_ds_hs_cfg {
	u32 gap;
};

struct mwifiex_ds_wakeup_reason {
	u16  hs_wakeup_reason;
};

#define DEEP_SLEEP_ON  1
#define DEEP_SLEEP_OFF 0
#define DEEP_SLEEP_IDLE_TIME	100
+6 −0
Original line number Diff line number Diff line
@@ -1599,6 +1599,12 @@ void mwifiex_drv_info_dump(struct mwifiex_adapter *adapter);
void mwifiex_upload_device_dump(struct mwifiex_adapter *adapter);
void *mwifiex_alloc_dma_align_buf(int rx_len, gfp_t flags);
void mwifiex_queue_main_work(struct mwifiex_adapter *adapter);
int mwifiex_get_wakeup_reason(struct mwifiex_private *priv, u16 action,
			      int cmd_type,
			      struct mwifiex_ds_wakeup_reason *wakeup_reason);
int mwifiex_ret_wakeup_reason(struct mwifiex_private *priv,
			      struct host_cmd_ds_command *resp,
			      struct host_cmd_ds_wakeup_reason *wakeup_reason);
void mwifiex_coex_ampdu_rxwinsize(struct mwifiex_adapter *adapter);
void mwifiex_11n_delba(struct mwifiex_private *priv, int tid);
int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy);
Loading