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

Commit bf354433 authored by Avinash Patil's avatar Avinash Patil Committed by John W. Linville
Browse files

mwifiex: channel statistics support for mwifiex



This patch adds support to record channel statistics during
scan. With extended scan, scan results are returned as events from
FW while channel statistics are part of scan command response.
We store these channel statistics in adapter.

Signed-off-by: default avatarAvinash Patil <patila@marvell.com>
Signed-off-by: default avatarXinmin Hu <huxm@marvell.com>
Signed-off-by: default avatarCathy Luo <cluo@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 15a892e7
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -2840,6 +2840,25 @@ static const struct wiphy_coalesce_support mwifiex_coalesce_support = {
	.max_pkt_offset = MWIFIEX_MAX_OFFSET_LEN,
};

int mwifiex_init_channel_scan_gap(struct mwifiex_adapter *adapter)
{
	u32 n_channels_bg, n_channels_a = 0;

	n_channels_bg = mwifiex_band_2ghz.n_channels;

	if (adapter->config_bands & BAND_A)
		n_channels_a = mwifiex_band_5ghz.n_channels;

	adapter->num_in_chan_stats = max_t(u32, n_channels_bg, n_channels_a);
	adapter->chan_stats = vmalloc(sizeof(*adapter->chan_stats) *
				      adapter->num_in_chan_stats);

	if (!adapter->chan_stats)
		return -ENOMEM;

	return 0;
}

/*
 * This function registers the device with CFG802.11 subsystem.
 *
+10 −0
Original line number Diff line number Diff line
@@ -185,4 +185,14 @@ struct mwifiex_arp_eth_header {
	u8 ar_tha[ETH_ALEN];
	u8 ar_tip[4];
} __packed;

struct mwifiex_chan_stats {
	u8 chan_num;
	u8 bandcfg;
	u8 flags;
	s8 noise;
	u16 total_bss;
	u16 cca_scan_dur;
	u16 cca_busy_dur;
} __packed;
#endif /* !_MWIFIEX_DECL_H_ */
+16 −0
Original line number Diff line number Diff line
@@ -172,6 +172,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {
#define TLV_TYPE_TDLS_IDLE_TIMEOUT  (PROPRIETARY_TLV_BASE_ID + 194)
#define TLV_TYPE_SCAN_CHANNEL_GAP   (PROPRIETARY_TLV_BASE_ID + 197)
#define TLV_TYPE_API_REV            (PROPRIETARY_TLV_BASE_ID + 199)
#define TLV_TYPE_CHANNEL_STATS      (PROPRIETARY_TLV_BASE_ID + 198)

#define MWIFIEX_TX_DATA_BUF_SIZE_2K        2048

@@ -611,6 +612,16 @@ struct uap_rxpd {
	u8 reserved1;
};

struct mwifiex_fw_chan_stats {
	u8 chan_num;
	u8 bandcfg;
	u8 flags;
	s8 noise;
	__le16 total_bss;
	__le16 cca_scan_dur;
	__le16 cca_busy_dur;
} __packed;

enum mwifiex_chan_scan_mode_bitmasks {
	MWIFIEX_PASSIVE_SCAN = BIT(0),
	MWIFIEX_DISABLE_CHAN_FILT = BIT(1),
@@ -660,6 +671,11 @@ struct mwifiex_ie_types_scan_chan_gap {
	__le16 chan_gap;
} __packed;

struct mwifiex_ietypes_chanstats {
	struct mwifiex_ie_types_header header;
	struct mwifiex_fw_chan_stats chanstats[0];
} __packed;

struct mwifiex_ie_types_wildcard_ssid_params {
	struct mwifiex_ie_types_header header;
	u8 max_ssid_length;
+6 −0
Original line number Diff line number Diff line
@@ -122,6 +122,7 @@ static int mwifiex_unregister(struct mwifiex_adapter *adapter)
		}
	}

	vfree(adapter->chan_stats);
	kfree(adapter);
	return 0;
}
@@ -447,6 +448,11 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context)
		goto err_init_fw;
	}

	if (mwifiex_init_channel_scan_gap(adapter)) {
		dev_err(adapter->dev, "could not init channel stats table\n");
		goto err_init_fw;
	}

	rtnl_lock();
	/* Create station interface by default */
	wdev = mwifiex_add_virtual_intf(adapter->wiphy, "mlan%d",
+5 −1
Original line number Diff line number Diff line
@@ -844,6 +844,9 @@ struct mwifiex_adapter {
	u8 curr_mem_idx;
	bool scan_chan_gap_enabled;
	struct sk_buff_head rx_data_q;
	struct mwifiex_chan_stats *chan_stats;
	u32 num_in_chan_stats;
	int survey_idx;
};

int mwifiex_init_lock_list(struct mwifiex_adapter *adapter);
@@ -1030,7 +1033,8 @@ void mwifiex_set_11ac_ba_params(struct mwifiex_private *priv);
int mwifiex_cmd_802_11_scan_ext(struct mwifiex_private *priv,
				struct host_cmd_ds_command *cmd,
				void *data_buf);
int mwifiex_ret_802_11_scan_ext(struct mwifiex_private *priv);
int mwifiex_ret_802_11_scan_ext(struct mwifiex_private *priv,
				struct host_cmd_ds_command *resp);
int mwifiex_handle_event_ext_scan_report(struct mwifiex_private *priv,
					 void *buf);

Loading