Commit fb3fac5f authored by Gregory Greenman's avatar Gregory Greenman Committed by Luca Coelho
Browse files

iwlwifi: mvm: introduce iwl_stored_beacon_notif_v3



The new version sends station id in the notification. It's still not
used, but need to adjust the code since the offset of the data was
changed.

Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210826224715.87bc9e45c40b.I770493dc4a293ed8bdf059518e94dccf5dd1b3a7@changeid


Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent b05c1d14
Loading
Loading
Loading
Loading
+28 −3
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
 * Copyright (C) 2012-2014 Intel Corporation
 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
 * Copyright (C) 2016-2017 Intel Deutschland GmbH
 * Copyright (C) 2021 Intel Corporation
 */
#ifndef __iwl_fw_api_offload_h__
#define __iwl_fw_api_offload_h__
@@ -20,7 +21,7 @@ enum iwl_prot_offload_subcmd_ids {
#define MAX_STORED_BEACON_SIZE 600

/**
 * struct iwl_stored_beacon_notif - Stored beacon notification
 * struct iwl_stored_beacon_notif_common - Stored beacon notif common fields
 *
 * @system_time: system time on air rise
 * @tsf: TSF on air rise
@@ -29,9 +30,8 @@ enum iwl_prot_offload_subcmd_ids {
 * @channel: channel this beacon was received on
 * @rates: rate in ucode internal format
 * @byte_count: frame's byte count
 * @data: beacon data, length in @byte_count
 */
struct iwl_stored_beacon_notif {
struct iwl_stored_beacon_notif_common {
	__le32 system_time;
	__le64 tsf;
	__le32 beacon_timestamp;
@@ -39,7 +39,32 @@ struct iwl_stored_beacon_notif {
	__le16 channel;
	__le32 rates;
	__le32 byte_count;
} __packed;

/**
 * struct iwl_stored_beacon_notif - Stored beacon notification
 *
 * @common: fields common for all versions
 * @data: beacon data, length in @byte_count
 */
struct iwl_stored_beacon_notif_v2 {
	struct iwl_stored_beacon_notif_common common;
	u8 data[MAX_STORED_BEACON_SIZE];
} __packed; /* WOWLAN_STROED_BEACON_INFO_S_VER_2 */

/**
 * struct iwl_stored_beacon_notif_v3 - Stored beacon notification
 *
 * @common: fields common for all versions
 * @sta_id: station for which the beacon was received
 * @reserved: reserved for alignment
 * @data: beacon data, length in @byte_count
 */
struct iwl_stored_beacon_notif_v3 {
	struct iwl_stored_beacon_notif_common common;
	u8 sta_id;
	u8 reserved[3];
	u8 data[MAX_STORED_BEACON_SIZE];
} __packed; /* WOWLAN_STROED_BEACON_INFO_S_VER_3 */

#endif /* __iwl_fw_api_offload_h__ */
+23 −3
Original line number Diff line number Diff line
@@ -1432,14 +1432,34 @@ void iwl_mvm_rx_stored_beacon_notif(struct iwl_mvm *mvm,
{
	struct iwl_rx_packet *pkt = rxb_addr(rxb);
	unsigned int pkt_len = iwl_rx_packet_payload_len(pkt);
	struct iwl_stored_beacon_notif *sb = (void *)pkt->data;
	struct iwl_stored_beacon_notif_common *sb = (void *)pkt->data;
	struct ieee80211_rx_status rx_status;
	struct sk_buff *skb;
	u8 *data;
	u32 size = le32_to_cpu(sb->byte_count);
	int ver = iwl_fw_lookup_cmd_ver(mvm->fw, PROT_OFFLOAD_GROUP,
					STORED_BEACON_NTF, 0);

	if (size == 0 || pkt_len < struct_size(sb, data, size))
	if (size == 0)
		return;

	/* handle per-version differences */
	if (ver <= 2) {
		struct iwl_stored_beacon_notif_v2 *sb_v2 = (void *)pkt->data;

		if (pkt_len < struct_size(sb_v2, data, size))
			return;

		data = sb_v2->data;
	} else {
		struct iwl_stored_beacon_notif_v3 *sb_v3 = (void *)pkt->data;

		if (pkt_len < struct_size(sb_v3, data, size))
			return;

		data = sb_v3->data;
	}

	skb = alloc_skb(size, GFP_ATOMIC);
	if (!skb) {
		IWL_ERR(mvm, "alloc_skb failed\n");
@@ -1460,7 +1480,7 @@ void iwl_mvm_rx_stored_beacon_notif(struct iwl_mvm *mvm,
					       rx_status.band);

	/* copy the data */
	skb_put_data(skb, sb->data, size);
	skb_put_data(skb, data, size);
	memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status));

	/* pass it as regular rx to mac80211 */
+1 −1
Original line number Diff line number Diff line
@@ -373,7 +373,7 @@ static const struct iwl_rx_handlers iwl_mvm_rx_handlers[] = {
		       struct iwl_mfu_assert_dump_notif),
	RX_HANDLER_GRP(PROT_OFFLOAD_GROUP, STORED_BEACON_NTF,
		       iwl_mvm_rx_stored_beacon_notif, RX_HANDLER_SYNC,
		       struct iwl_stored_beacon_notif),
		       struct iwl_stored_beacon_notif_v2),
	RX_HANDLER_GRP(DATA_PATH_GROUP, MU_GROUP_MGMT_NOTIF,
		       iwl_mvm_mu_mimo_grp_notif, RX_HANDLER_SYNC,
		       struct iwl_mu_group_mgmt_notif),