All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@kernel.org>
To: Carl Huang <cjhuang@codeaurora.org>
Cc: ath11k@lists.infradead.org, linux-wireless@vger.kernel.org
Subject: Re: [PATCH 6/6] ath11k: support GTK rekey offload
Date: Thu, 09 Dec 2021 18:05:14 +0200	[thread overview]
Message-ID: <87lf0tydad.fsf@codeaurora.org> (raw)
In-Reply-To: <20211011193750.4891-7-cjhuang@codeaurora.org> (Carl Huang's message of "Mon, 11 Oct 2021 15:37:50 -0400")

Carl Huang <cjhuang@codeaurora.org> writes:

> Host sets GTK related info to firmware before WoW is enabled, and
> gets rekey replay_count and then disables GTK rekey when WoW quits.
>
> Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1
>
> Signed-off-by: Carl Huang <cjhuang@codeaurora.org>

[...]

> --- a/drivers/net/wireless/ath/ath11k/wmi.h
> +++ b/drivers/net/wireless/ath/ath11k/wmi.h
> @@ -5850,6 +5850,41 @@ struct wmi_set_arp_ns_offload_cmd {
>  	 */
>  } __packed;
>  
> +#define GTK_OFFLOAD_OPCODE_MASK             0xFF000000
> +#define GTK_OFFLOAD_ENABLE_OPCODE           0x01000000
> +#define GTK_OFFLOAD_DISABLE_OPCODE          0x02000000
> +#define GTK_OFFLOAD_REQUEST_STATUS_OPCODE   0x04000000
> +
> +#define GTK_OFFLOAD_KEK_BYTES       16
> +#define GTK_OFFLOAD_KCK_BYTES       16
> +#define GTK_REPLAY_COUNTER_BYTES    8
> +#define WMI_MAX_KEY_LEN             32
> +#define IGTK_PN_SIZE                6
> +
> +struct wmi_gtk_offload_status_event {
> +	u32 vdev_id;
> +	u32 flags;
> +	u32 refresh_cnt;
> +	u8 replay_counter[GTK_REPLAY_COUNTER_BYTES];
> +	u8 igtk_key_index;
> +	u8 igtk_key_length;
> +	u8 igtk_key_rsc[IGTK_PN_SIZE];
> +	u8 igtk_key[WMI_MAX_KEY_LEN];
> +	u8 gtk_key_index;
> +	u8 gtk_key_length;
> +	u8 gtk_key_rsc[GTK_REPLAY_COUNTER_BYTES];
> +	u8 gtk_key[WMI_MAX_KEY_LEN];
> +} __packed;

[...]

> +	arvif->rekey_data.replay_ctr = le64_to_cpup((__le64 *)ev->replay_counter);
> +	/* supplicant expects big-endian replay counter */
> +	replay_ctr = cpu_to_be64(le64_to_cpup((__le64 *)ev->replay_counter));
> +
> +	ieee80211_gtk_rekey_notify(arvif->vif, arvif->bssid,
> +				   (void *)&replay_ctr, GFP_KERNEL);

Please avoid casting as much possible, and also otherwise this just
looks weird. Isn't ath11k WMI commands and events supposed to be in CPU
endian and the firmware automatically translates them if CPU is little
or big endian? So why do you cast ev->replay_counter to __le64 then?
Wouldn't that break on big endian?

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

WARNING: multiple messages have this Message-ID (diff)
From: Kalle Valo <kvalo@kernel.org>
To: Carl Huang <cjhuang@codeaurora.org>
Cc: ath11k@lists.infradead.org,  linux-wireless@vger.kernel.org
Subject: Re: [PATCH 6/6] ath11k: support GTK rekey offload
Date: Thu, 09 Dec 2021 18:05:14 +0200	[thread overview]
Message-ID: <87lf0tydad.fsf@codeaurora.org> (raw)
In-Reply-To: <20211011193750.4891-7-cjhuang@codeaurora.org> (Carl Huang's message of "Mon, 11 Oct 2021 15:37:50 -0400")

Carl Huang <cjhuang@codeaurora.org> writes:

> Host sets GTK related info to firmware before WoW is enabled, and
> gets rekey replay_count and then disables GTK rekey when WoW quits.
>
> Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1
>
> Signed-off-by: Carl Huang <cjhuang@codeaurora.org>

[...]

> --- a/drivers/net/wireless/ath/ath11k/wmi.h
> +++ b/drivers/net/wireless/ath/ath11k/wmi.h
> @@ -5850,6 +5850,41 @@ struct wmi_set_arp_ns_offload_cmd {
>  	 */
>  } __packed;
>  
> +#define GTK_OFFLOAD_OPCODE_MASK             0xFF000000
> +#define GTK_OFFLOAD_ENABLE_OPCODE           0x01000000
> +#define GTK_OFFLOAD_DISABLE_OPCODE          0x02000000
> +#define GTK_OFFLOAD_REQUEST_STATUS_OPCODE   0x04000000
> +
> +#define GTK_OFFLOAD_KEK_BYTES       16
> +#define GTK_OFFLOAD_KCK_BYTES       16
> +#define GTK_REPLAY_COUNTER_BYTES    8
> +#define WMI_MAX_KEY_LEN             32
> +#define IGTK_PN_SIZE                6
> +
> +struct wmi_gtk_offload_status_event {
> +	u32 vdev_id;
> +	u32 flags;
> +	u32 refresh_cnt;
> +	u8 replay_counter[GTK_REPLAY_COUNTER_BYTES];
> +	u8 igtk_key_index;
> +	u8 igtk_key_length;
> +	u8 igtk_key_rsc[IGTK_PN_SIZE];
> +	u8 igtk_key[WMI_MAX_KEY_LEN];
> +	u8 gtk_key_index;
> +	u8 gtk_key_length;
> +	u8 gtk_key_rsc[GTK_REPLAY_COUNTER_BYTES];
> +	u8 gtk_key[WMI_MAX_KEY_LEN];
> +} __packed;

[...]

> +	arvif->rekey_data.replay_ctr = le64_to_cpup((__le64 *)ev->replay_counter);
> +	/* supplicant expects big-endian replay counter */
> +	replay_ctr = cpu_to_be64(le64_to_cpup((__le64 *)ev->replay_counter));
> +
> +	ieee80211_gtk_rekey_notify(arvif->vif, arvif->bssid,
> +				   (void *)&replay_ctr, GFP_KERNEL);

Please avoid casting as much possible, and also otherwise this just
looks weird. Isn't ath11k WMI commands and events supposed to be in CPU
endian and the firmware automatically translates them if CPU is little
or big endian? So why do you cast ev->replay_counter to __le64 then?
Wouldn't that break on big endian?

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

  reply	other threads:[~2021-12-09 16:05 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-11 19:37 [PATCH 0/6] ath11k: support WoW functionalities Carl Huang
2021-10-11 19:37 ` Carl Huang
2021-10-11 19:37 ` [PATCH 1/6] ath11k: Add basic " Carl Huang
2021-10-11 19:37   ` Carl Huang
2021-12-09 14:48   ` Kalle Valo
2021-12-09 14:48     ` Kalle Valo
2021-10-11 19:37 ` [PATCH 2/6] ath11k: Add WoW net-detect functionality Carl Huang
2021-10-11 19:37   ` Carl Huang
2021-12-09 14:57   ` Kalle Valo
2021-12-09 14:57     ` Kalle Valo
2021-12-09 15:03   ` Kalle Valo
2021-12-09 15:03     ` Kalle Valo
2021-10-11 19:37 ` [PATCH 3/6] ath11k: implement hw data filter Carl Huang
2021-10-11 19:37   ` Carl Huang
2021-12-09 15:07   ` Kalle Valo
2021-12-09 15:07     ` Kalle Valo
2021-12-09 15:47   ` Kalle Valo
2021-12-09 15:47     ` Kalle Valo
2021-10-11 19:37 ` [PATCH 4/6] ath11k: purge rx pktlog when entering WoW Carl Huang
2021-10-11 19:37   ` Carl Huang
2021-12-09 15:12   ` Kalle Valo
2021-12-09 15:12     ` Kalle Valo
2021-10-11 19:37 ` [PATCH 5/6] ath11k: support ARP and NS offload Carl Huang
2021-10-11 19:37   ` Carl Huang
2021-12-09 15:16   ` Kalle Valo
2021-12-09 15:16     ` Kalle Valo
2021-12-09 16:07   ` Kalle Valo
2021-12-09 16:07     ` Kalle Valo
2021-10-11 19:37 ` [PATCH 6/6] ath11k: support GTK rekey offload Carl Huang
2021-10-11 19:37   ` Carl Huang
2021-12-09 16:05   ` Kalle Valo [this message]
2021-12-09 16:05     ` Kalle Valo
2021-12-17 11:04     ` Carl Huang
2021-12-17 11:04       ` Carl Huang
2021-12-18  8:37       ` Sven Eckelmann
2021-12-18  8:37         ` Sven Eckelmann
2021-12-18  8:43         ` Sven Eckelmann
2021-12-18  8:43           ` Sven Eckelmann
2021-12-18  9:16         ` Sven Eckelmann
2021-12-18  9:16           ` Sven Eckelmann
2021-12-20 10:03         ` Kalle Valo
2021-12-20 10:03           ` Kalle Valo
2021-12-20 11:50           ` Sven Eckelmann
2021-12-20 11:50             ` Sven Eckelmann
2021-12-21 14:48             ` Kalle Valo
2021-12-21 14:48               ` Kalle Valo
2021-12-21 20:39               ` Sven Eckelmann
2021-12-21 20:39                 ` Sven Eckelmann
2021-12-09 17:45 ` [PATCH 0/6] ath11k: support WoW functionalities Kalle Valo
2021-12-09 17:45   ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lf0tydad.fsf@codeaurora.org \
    --to=kvalo@kernel.org \
    --cc=ath11k@lists.infradead.org \
    --cc=cjhuang@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.