All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mt76: connac: fix GTK rekey offload failure on WPA mixed mode
@ 2021-07-27 22:59 ` sean.wang
  0 siblings, 0 replies; 8+ messages in thread
From: sean.wang @ 2021-07-27 22:59 UTC (permalink / raw)
  To: nbd, lorenzo.bianconi
  Cc: sean.wang, Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang,
	Deren.Wu, km.lin, robin.chiu, ch.yeh, posh.sun, Eric.Liang,
	Stella.Chang, jemele, yenlinlai, linux-wireless, linux-mediatek

From: Leon Yen <Leon.Yen@mediatek.com>

Update the proper firmware programming sequence to fix GTK rekey
offload failure on WPA mixed mode.

In the mt76_connac_mcu_key_iter,
gtk_tlv->proto should be only set up on pairwise key
and gtk_tlk->group_cipher should be only set up on the group key.

Otherwise, those parameters required by firmware would be set
incorrectly to cause GTK rekey offload failure on WPA mixed mode
and then disconnection follows.

Fixes: b47e21e75c80 ("mt76: mt7615: add gtk rekey offload support")
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Leon Yen <Leon.Yen@mediatek.com>
---
 .../net/wireless/mediatek/mt76/mt76_connac_mcu.c  | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
index a2555dc0f003..d71393b1c5e6 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
@@ -1957,19 +1957,22 @@ mt76_connac_mcu_key_iter(struct ieee80211_hw *hw,
 	    key->cipher != WLAN_CIPHER_SUITE_TKIP)
 		return;
 
-	if (key->cipher == WLAN_CIPHER_SUITE_TKIP) {
-		gtk_tlv->proto = cpu_to_le32(NL80211_WPA_VERSION_1);
+	if (key->cipher == WLAN_CIPHER_SUITE_TKIP)
 		cipher = BIT(3);
-	} else {
-		gtk_tlv->proto = cpu_to_le32(NL80211_WPA_VERSION_2);
+	else
 		cipher = BIT(4);
-	}
 
 	/* we are assuming here to have a single pairwise key */
 	if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) {
+		if (key->cipher == WLAN_CIPHER_SUITE_TKIP)
+			gtk_tlv->proto = cpu_to_le32(NL80211_WPA_VERSION_1);
+		else
+			gtk_tlv->proto = cpu_to_le32(NL80211_WPA_VERSION_2);
+
 		gtk_tlv->pairwise_cipher = cpu_to_le32(cipher);
-		gtk_tlv->group_cipher = cpu_to_le32(cipher);
 		gtk_tlv->keyid = key->keyidx;
+	} else {
+		gtk_tlv->group_cipher = cpu_to_le32(cipher);
 	}
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 1/2] mt76: connac: fix GTK rekey offload failure on WPA mixed mode
@ 2021-07-27 22:59 ` sean.wang
  0 siblings, 0 replies; 8+ messages in thread
From: sean.wang @ 2021-07-27 22:59 UTC (permalink / raw)
  To: nbd, lorenzo.bianconi
  Cc: sean.wang, Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang,
	Deren.Wu, km.lin, robin.chiu, ch.yeh, posh.sun, Eric.Liang,
	Stella.Chang, jemele, yenlinlai, linux-wireless, linux-mediatek

From: Leon Yen <Leon.Yen@mediatek.com>

Update the proper firmware programming sequence to fix GTK rekey
offload failure on WPA mixed mode.

In the mt76_connac_mcu_key_iter,
gtk_tlv->proto should be only set up on pairwise key
and gtk_tlk->group_cipher should be only set up on the group key.

Otherwise, those parameters required by firmware would be set
incorrectly to cause GTK rekey offload failure on WPA mixed mode
and then disconnection follows.

Fixes: b47e21e75c80 ("mt76: mt7615: add gtk rekey offload support")
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Leon Yen <Leon.Yen@mediatek.com>
---
 .../net/wireless/mediatek/mt76/mt76_connac_mcu.c  | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
index a2555dc0f003..d71393b1c5e6 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
@@ -1957,19 +1957,22 @@ mt76_connac_mcu_key_iter(struct ieee80211_hw *hw,
 	    key->cipher != WLAN_CIPHER_SUITE_TKIP)
 		return;
 
-	if (key->cipher == WLAN_CIPHER_SUITE_TKIP) {
-		gtk_tlv->proto = cpu_to_le32(NL80211_WPA_VERSION_1);
+	if (key->cipher == WLAN_CIPHER_SUITE_TKIP)
 		cipher = BIT(3);
-	} else {
-		gtk_tlv->proto = cpu_to_le32(NL80211_WPA_VERSION_2);
+	else
 		cipher = BIT(4);
-	}
 
 	/* we are assuming here to have a single pairwise key */
 	if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) {
+		if (key->cipher == WLAN_CIPHER_SUITE_TKIP)
+			gtk_tlv->proto = cpu_to_le32(NL80211_WPA_VERSION_1);
+		else
+			gtk_tlv->proto = cpu_to_le32(NL80211_WPA_VERSION_2);
+
 		gtk_tlv->pairwise_cipher = cpu_to_le32(cipher);
-		gtk_tlv->group_cipher = cpu_to_le32(cipher);
 		gtk_tlv->keyid = key->keyidx;
+	} else {
+		gtk_tlv->group_cipher = cpu_to_le32(cipher);
 	}
 }
 
-- 
2.25.1
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] mt76: connac: add support maximum regulatory Tx power
  2021-07-27 22:59 ` sean.wang
@ 2021-07-27 22:59   ` sean.wang
  -1 siblings, 0 replies; 8+ messages in thread
From: sean.wang @ 2021-07-27 22:59 UTC (permalink / raw)
  To: nbd, lorenzo.bianconi
  Cc: sean.wang, Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang,
	Deren.Wu, km.lin, robin.chiu, ch.yeh, posh.sun, Eric.Liang,
	Stella.Chang, jemele, yenlinlai, linux-wireless, linux-mediatek

From: YN Chen <YN.Chen@mediatek.com>

Consider .max_reg_power in struct ieee80211_channel to limit the
maximum power the wireless device allowed to transmit on the
corresponding channel according to the regulatory domain.

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: YN Chen <YN.Chen@mediatek.com>
---
 .../wireless/mediatek/mt76/mt76_connac_mcu.c  | 43 ++++++++++++++++++-
 1 file changed, 41 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
index d71393b1c5e6..84f42ce12626 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
@@ -1773,6 +1773,43 @@ static s8 mt76_connac_get_sar_power(struct mt76_phy *phy,
 	return target_power;
 }
 
+static s8 mt76_connac_get_ch_power(struct mt76_phy *phy,
+				   struct ieee80211_channel *chan,
+				   s8 target_power)
+{
+	struct mt76_dev *dev = phy->dev;
+	struct ieee80211_supported_band *sband;
+	int i;
+
+	switch (chan->band) {
+	case NL80211_BAND_2GHZ:
+		sband = &phy->sband_2g.sband;
+		break;
+	case NL80211_BAND_5GHZ:
+		sband = &phy->sband_5g.sband;
+		break;
+	default:
+		return target_power;
+	}
+
+	for (i = 0; i < sband->n_channels; i++) {
+		struct ieee80211_channel *ch = &sband->channels[i];
+
+		if (ch->hw_value == chan->hw_value) {
+			if (!(ch->flags & IEEE80211_CHAN_DISABLED)) {
+				int power = 2 * ch->max_reg_power;
+
+				if (power > 127 || power < -127)
+					power = 127;
+				target_power = min_t(s8, power, target_power);
+			}
+			break;
+		}
+	}
+
+	return target_power;
+}
+
 static int
 mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
 				  enum nl80211_band band)
@@ -1840,10 +1877,12 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
 				.hw_value = ch_list[idx],
 				.band = band,
 			};
-			s8 sar_power;
+			s8 reg_power, sar_power;
 
+			reg_power = mt76_connac_get_ch_power(phy, &chan,
+							     tx_power);
 			sar_power = mt76_connac_get_sar_power(phy, &chan,
-							      tx_power);
+							      reg_power);
 
 			mt76_get_rate_power_limits(phy, &chan, &limits,
 						   sar_power);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] mt76: connac: add support maximum regulatory Tx power
@ 2021-07-27 22:59   ` sean.wang
  0 siblings, 0 replies; 8+ messages in thread
From: sean.wang @ 2021-07-27 22:59 UTC (permalink / raw)
  To: nbd, lorenzo.bianconi
  Cc: sean.wang, Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang,
	Deren.Wu, km.lin, robin.chiu, ch.yeh, posh.sun, Eric.Liang,
	Stella.Chang, jemele, yenlinlai, linux-wireless, linux-mediatek

From: YN Chen <YN.Chen@mediatek.com>

Consider .max_reg_power in struct ieee80211_channel to limit the
maximum power the wireless device allowed to transmit on the
corresponding channel according to the regulatory domain.

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: YN Chen <YN.Chen@mediatek.com>
---
 .../wireless/mediatek/mt76/mt76_connac_mcu.c  | 43 ++++++++++++++++++-
 1 file changed, 41 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
index d71393b1c5e6..84f42ce12626 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
@@ -1773,6 +1773,43 @@ static s8 mt76_connac_get_sar_power(struct mt76_phy *phy,
 	return target_power;
 }
 
+static s8 mt76_connac_get_ch_power(struct mt76_phy *phy,
+				   struct ieee80211_channel *chan,
+				   s8 target_power)
+{
+	struct mt76_dev *dev = phy->dev;
+	struct ieee80211_supported_band *sband;
+	int i;
+
+	switch (chan->band) {
+	case NL80211_BAND_2GHZ:
+		sband = &phy->sband_2g.sband;
+		break;
+	case NL80211_BAND_5GHZ:
+		sband = &phy->sband_5g.sband;
+		break;
+	default:
+		return target_power;
+	}
+
+	for (i = 0; i < sband->n_channels; i++) {
+		struct ieee80211_channel *ch = &sband->channels[i];
+
+		if (ch->hw_value == chan->hw_value) {
+			if (!(ch->flags & IEEE80211_CHAN_DISABLED)) {
+				int power = 2 * ch->max_reg_power;
+
+				if (power > 127 || power < -127)
+					power = 127;
+				target_power = min_t(s8, power, target_power);
+			}
+			break;
+		}
+	}
+
+	return target_power;
+}
+
 static int
 mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
 				  enum nl80211_band band)
@@ -1840,10 +1877,12 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
 				.hw_value = ch_list[idx],
 				.band = band,
 			};
-			s8 sar_power;
+			s8 reg_power, sar_power;
 
+			reg_power = mt76_connac_get_ch_power(phy, &chan,
+							     tx_power);
 			sar_power = mt76_connac_get_sar_power(phy, &chan,
-							      tx_power);
+							      reg_power);
 
 			mt76_get_rate_power_limits(phy, &chan, &limits,
 						   sar_power);
-- 
2.25.1
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] mt76: connac: add support maximum regulatory Tx power
  2021-07-27 22:59   ` sean.wang
@ 2021-07-28  7:35     ` Lorenzo Bianconi
  -1 siblings, 0 replies; 8+ messages in thread
From: Lorenzo Bianconi @ 2021-07-28  7:35 UTC (permalink / raw)
  To: sean.wang
  Cc: nbd, lorenzo.bianconi, Soul.Huang, YN.Chen, Leon.Yen,
	Eric-SY.Chang, Deren.Wu, km.lin, robin.chiu, ch.yeh, posh.sun,
	Eric.Liang, Stella.Chang, jemele, yenlinlai, linux-wireless,
	linux-mediatek

[-- Attachment #1: Type: text/plain, Size: 2629 bytes --]

> From: YN Chen <YN.Chen@mediatek.com>
> 
> Consider .max_reg_power in struct ieee80211_channel to limit the
> maximum power the wireless device allowed to transmit on the
> corresponding channel according to the regulatory domain.
> 
> Co-developed-by: Sean Wang <sean.wang@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> Signed-off-by: YN Chen <YN.Chen@mediatek.com>
> ---
>  .../wireless/mediatek/mt76/mt76_connac_mcu.c  | 43 ++++++++++++++++++-
>  1 file changed, 41 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> index d71393b1c5e6..84f42ce12626 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> @@ -1773,6 +1773,43 @@ static s8 mt76_connac_get_sar_power(struct mt76_phy *phy,
>  	return target_power;
>  }
>  
> +static s8 mt76_connac_get_ch_power(struct mt76_phy *phy,
> +				   struct ieee80211_channel *chan,
> +				   s8 target_power)
> +{
> +	struct mt76_dev *dev = phy->dev;

is it used?

> +	struct ieee80211_supported_band *sband;
> +	int i;
> +
> +	switch (chan->band) {
> +	case NL80211_BAND_2GHZ:
> +		sband = &phy->sband_2g.sband;
> +		break;
> +	case NL80211_BAND_5GHZ:
> +		sband = &phy->sband_5g.sband;
> +		break;
> +	default:
> +		return target_power;
> +	}
> +
> +	for (i = 0; i < sband->n_channels; i++) {
> +		struct ieee80211_channel *ch = &sband->channels[i];
> +
> +		if (ch->hw_value == chan->hw_value) {
> +			if (!(ch->flags & IEEE80211_CHAN_DISABLED)) {
> +				int power = 2 * ch->max_reg_power;
> +
> +				if (power > 127 || power < -127)
> +					power = 127;

please correct me if I am wrong, but I guess the limit for mt7663 should be 63,
isn't it?

Regards,
Lorenzo

> +				target_power = min_t(s8, power, target_power);
> +			}
> +			break;
> +		}
> +	}
> +
> +	return target_power;
> +}
> +
>  static int
>  mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
>  				  enum nl80211_band band)
> @@ -1840,10 +1877,12 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
>  				.hw_value = ch_list[idx],
>  				.band = band,
>  			};
> -			s8 sar_power;
> +			s8 reg_power, sar_power;
>  
> +			reg_power = mt76_connac_get_ch_power(phy, &chan,
> +							     tx_power);
>  			sar_power = mt76_connac_get_sar_power(phy, &chan,
> -							      tx_power);
> +							      reg_power);
>  
>  			mt76_get_rate_power_limits(phy, &chan, &limits,
>  						   sar_power);
> -- 
> 2.25.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] mt76: connac: add support maximum regulatory Tx power
@ 2021-07-28  7:35     ` Lorenzo Bianconi
  0 siblings, 0 replies; 8+ messages in thread
From: Lorenzo Bianconi @ 2021-07-28  7:35 UTC (permalink / raw)
  To: sean.wang
  Cc: nbd, lorenzo.bianconi, Soul.Huang, YN.Chen, Leon.Yen,
	Eric-SY.Chang, Deren.Wu, km.lin, robin.chiu, ch.yeh, posh.sun,
	Eric.Liang, Stella.Chang, jemele, yenlinlai, linux-wireless,
	linux-mediatek


[-- Attachment #1.1: Type: text/plain, Size: 2629 bytes --]

> From: YN Chen <YN.Chen@mediatek.com>
> 
> Consider .max_reg_power in struct ieee80211_channel to limit the
> maximum power the wireless device allowed to transmit on the
> corresponding channel according to the regulatory domain.
> 
> Co-developed-by: Sean Wang <sean.wang@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> Signed-off-by: YN Chen <YN.Chen@mediatek.com>
> ---
>  .../wireless/mediatek/mt76/mt76_connac_mcu.c  | 43 ++++++++++++++++++-
>  1 file changed, 41 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> index d71393b1c5e6..84f42ce12626 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> @@ -1773,6 +1773,43 @@ static s8 mt76_connac_get_sar_power(struct mt76_phy *phy,
>  	return target_power;
>  }
>  
> +static s8 mt76_connac_get_ch_power(struct mt76_phy *phy,
> +				   struct ieee80211_channel *chan,
> +				   s8 target_power)
> +{
> +	struct mt76_dev *dev = phy->dev;

is it used?

> +	struct ieee80211_supported_band *sband;
> +	int i;
> +
> +	switch (chan->band) {
> +	case NL80211_BAND_2GHZ:
> +		sband = &phy->sband_2g.sband;
> +		break;
> +	case NL80211_BAND_5GHZ:
> +		sband = &phy->sband_5g.sband;
> +		break;
> +	default:
> +		return target_power;
> +	}
> +
> +	for (i = 0; i < sband->n_channels; i++) {
> +		struct ieee80211_channel *ch = &sband->channels[i];
> +
> +		if (ch->hw_value == chan->hw_value) {
> +			if (!(ch->flags & IEEE80211_CHAN_DISABLED)) {
> +				int power = 2 * ch->max_reg_power;
> +
> +				if (power > 127 || power < -127)
> +					power = 127;

please correct me if I am wrong, but I guess the limit for mt7663 should be 63,
isn't it?

Regards,
Lorenzo

> +				target_power = min_t(s8, power, target_power);
> +			}
> +			break;
> +		}
> +	}
> +
> +	return target_power;
> +}
> +
>  static int
>  mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
>  				  enum nl80211_band band)
> @@ -1840,10 +1877,12 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
>  				.hw_value = ch_list[idx],
>  				.band = band,
>  			};
> -			s8 sar_power;
> +			s8 reg_power, sar_power;
>  
> +			reg_power = mt76_connac_get_ch_power(phy, &chan,
> +							     tx_power);
>  			sar_power = mt76_connac_get_sar_power(phy, &chan,
> -							      tx_power);
> +							      reg_power);
>  
>  			mt76_get_rate_power_limits(phy, &chan, &limits,
>  						   sar_power);
> -- 
> 2.25.1
> 

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] mt76: connac: fix GTK rekey offload failure on WPA mixed mode
  2021-07-27 22:59 ` sean.wang
@ 2021-08-13 10:22   ` Felix Fietkau
  -1 siblings, 0 replies; 8+ messages in thread
From: Felix Fietkau @ 2021-08-13 10:22 UTC (permalink / raw)
  To: sean.wang, lorenzo.bianconi
  Cc: Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang, Deren.Wu, km.lin,
	robin.chiu, ch.yeh, posh.sun, Eric.Liang, Stella.Chang, jemele,
	yenlinlai, linux-wireless, linux-mediatek

On 2021-07-28 00:59, sean.wang@mediatek.com wrote:
> From: Leon Yen <Leon.Yen@mediatek.com>
> 
> Update the proper firmware programming sequence to fix GTK rekey
> offload failure on WPA mixed mode.
> 
> In the mt76_connac_mcu_key_iter,
> gtk_tlv->proto should be only set up on pairwise key
> and gtk_tlk->group_cipher should be only set up on the group key.
> 
> Otherwise, those parameters required by firmware would be set
> incorrectly to cause GTK rekey offload failure on WPA mixed mode
> and then disconnection follows.
> 
> Fixes: b47e21e75c80 ("mt76: mt7615: add gtk rekey offload support")
> Co-developed-by: Sean Wang <sean.wang@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> Signed-off-by: Leon Yen <Leon.Yen@mediatek.com>
> ---
>  .../net/wireless/mediatek/mt76/mt76_connac_mcu.c  | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> index a2555dc0f003..d71393b1c5e6 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> @@ -1957,19 +1957,22 @@ mt76_connac_mcu_key_iter(struct ieee80211_hw *hw,
>  	    key->cipher != WLAN_CIPHER_SUITE_TKIP)
>  		return;
>  
> -	if (key->cipher == WLAN_CIPHER_SUITE_TKIP) {
> -		gtk_tlv->proto = cpu_to_le32(NL80211_WPA_VERSION_1);
> +	if (key->cipher == WLAN_CIPHER_SUITE_TKIP)
>  		cipher = BIT(3);
> -	} else {
> -		gtk_tlv->proto = cpu_to_le32(NL80211_WPA_VERSION_2);
> +	else
>  		cipher = BIT(4);
> -	}
>  
>  	/* we are assuming here to have a single pairwise key */
>  	if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) {
> +		if (key->cipher == WLAN_CIPHER_SUITE_TKIP)
> +			gtk_tlv->proto = cpu_to_le32(NL80211_WPA_VERSION_1);
> +		else
> +			gtk_tlv->proto = cpu_to_le32(NL80211_WPA_VERSION_2);
Why is gtk_tlv->proto set to WPA version values based on the cipher
suite? That doesn't make much sense to me, since TKIP is supported by
WPA2 as well. I will apply this patch anyway, since this check is there
already, but this does look suspicious to me and should probably be
revisited.

- Felix

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] mt76: connac: fix GTK rekey offload failure on WPA mixed mode
@ 2021-08-13 10:22   ` Felix Fietkau
  0 siblings, 0 replies; 8+ messages in thread
From: Felix Fietkau @ 2021-08-13 10:22 UTC (permalink / raw)
  To: sean.wang, lorenzo.bianconi
  Cc: Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang, Deren.Wu, km.lin,
	robin.chiu, ch.yeh, posh.sun, Eric.Liang, Stella.Chang, jemele,
	yenlinlai, linux-wireless, linux-mediatek

On 2021-07-28 00:59, sean.wang@mediatek.com wrote:
> From: Leon Yen <Leon.Yen@mediatek.com>
> 
> Update the proper firmware programming sequence to fix GTK rekey
> offload failure on WPA mixed mode.
> 
> In the mt76_connac_mcu_key_iter,
> gtk_tlv->proto should be only set up on pairwise key
> and gtk_tlk->group_cipher should be only set up on the group key.
> 
> Otherwise, those parameters required by firmware would be set
> incorrectly to cause GTK rekey offload failure on WPA mixed mode
> and then disconnection follows.
> 
> Fixes: b47e21e75c80 ("mt76: mt7615: add gtk rekey offload support")
> Co-developed-by: Sean Wang <sean.wang@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> Signed-off-by: Leon Yen <Leon.Yen@mediatek.com>
> ---
>  .../net/wireless/mediatek/mt76/mt76_connac_mcu.c  | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> index a2555dc0f003..d71393b1c5e6 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
> @@ -1957,19 +1957,22 @@ mt76_connac_mcu_key_iter(struct ieee80211_hw *hw,
>  	    key->cipher != WLAN_CIPHER_SUITE_TKIP)
>  		return;
>  
> -	if (key->cipher == WLAN_CIPHER_SUITE_TKIP) {
> -		gtk_tlv->proto = cpu_to_le32(NL80211_WPA_VERSION_1);
> +	if (key->cipher == WLAN_CIPHER_SUITE_TKIP)
>  		cipher = BIT(3);
> -	} else {
> -		gtk_tlv->proto = cpu_to_le32(NL80211_WPA_VERSION_2);
> +	else
>  		cipher = BIT(4);
> -	}
>  
>  	/* we are assuming here to have a single pairwise key */
>  	if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) {
> +		if (key->cipher == WLAN_CIPHER_SUITE_TKIP)
> +			gtk_tlv->proto = cpu_to_le32(NL80211_WPA_VERSION_1);
> +		else
> +			gtk_tlv->proto = cpu_to_le32(NL80211_WPA_VERSION_2);
Why is gtk_tlv->proto set to WPA version values based on the cipher
suite? That doesn't make much sense to me, since TKIP is supported by
WPA2 as well. I will apply this patch anyway, since this check is there
already, but this does look suspicious to me and should probably be
revisited.

- Felix

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-08-13 10:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-27 22:59 [PATCH 1/2] mt76: connac: fix GTK rekey offload failure on WPA mixed mode sean.wang
2021-07-27 22:59 ` sean.wang
2021-07-27 22:59 ` [PATCH 2/2] mt76: connac: add support maximum regulatory Tx power sean.wang
2021-07-27 22:59   ` sean.wang
2021-07-28  7:35   ` Lorenzo Bianconi
2021-07-28  7:35     ` Lorenzo Bianconi
2021-08-13 10:22 ` [PATCH 1/2] mt76: connac: fix GTK rekey offload failure on WPA mixed mode Felix Fietkau
2021-08-13 10:22   ` Felix Fietkau

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.