diff mbox series

[v7,02/12] wifi: mwifiex: fixed group rekey issue for WPA3.

Message ID 20231128083115.613235-3-yu-hao.lin@nxp.com
State New
Headers show
Series wifi: mwifiex: added code to support host mlme. | expand

Commit Message

David Lin Nov. 28, 2023, 8:31 a.m. UTC
If host mlme is enabled, gropu rekey offload should be disabled.

Signed-off-by: David Lin <yu-hao.lin@nxp.com>
---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 3 +++
 drivers/net/wireless/marvell/mwifiex/main.c     | 4 ++++
 drivers/net/wireless/marvell/mwifiex/util.c     | 7 +++++++
 3 files changed, 14 insertions(+)

Comments

Francesco Dolcini Dec. 1, 2023, 10:15 a.m. UTC | #1
On Tue, Nov 28, 2023 at 04:31:05PM +0800, David Lin wrote:
> If host mlme is enabled, gropu rekey offload should be disabled.
> 
> Signed-off-by: David Lin <yu-hao.lin@nxp.com>
> ---
>  drivers/net/wireless/marvell/mwifiex/cfg80211.c | 3 +++
>  drivers/net/wireless/marvell/mwifiex/main.c     | 4 ++++
>  drivers/net/wireless/marvell/mwifiex/util.c     | 7 +++++++
>  3 files changed, 14 insertions(+)
> 
> diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> index 40c39e4765f7..3d59e6a441b9 100644
> --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> @@ -3657,6 +3657,9 @@ static int mwifiex_set_rekey_data(struct wiphy *wiphy, struct net_device *dev,
>  	if (!ISSUPP_FIRMWARE_SUPPLICANT(priv->adapter->fw_cap_info))
>  		return -EOPNOTSUPP;
>  
> +	if (priv->adapter->host_mlme)
> +		return 0;

this is a fixup of the previous patch, you should not introduce an issue
and fix it in the following patch. Please make it correct in the first
place fixing up that patch.


> +
>  	return mwifiex_send_cmd(priv, HostCmd_CMD_GTK_REKEY_OFFLOAD_CFG,
>  				HostCmd_ACT_GEN_SET, 0, data, true);
>  }
> diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c
> index d99127dc466e..3bebb6c37604 100644
> --- a/drivers/net/wireless/marvell/mwifiex/main.c
> +++ b/drivers/net/wireless/marvell/mwifiex/main.c
> @@ -802,6 +802,10 @@ mwifiex_bypass_tx_queue(struct mwifiex_private *priv,
>  			    "bypass txqueue; eth type %#x, mgmt %d\n",
>  			     ntohs(eth_hdr->h_proto),
>  			     mwifiex_is_skb_mgmt_frame(skb));
> +		if (ntohs(eth_hdr->h_proto) == ETH_P_PAE)
> +			mwifiex_dbg(priv->adapter, MSG,
> +				    "key: send EAPOL to %pM\n",
> +				    eth_hdr->h_dest);

this is just debug code, at a first glance not sure i
> diff --git a/drivers/net/wireless/marvell/mwifiex/util.c b/drivers/net/wireless/marvell/mwifiex/util.c
> index 23675c1cecae..ff1b2f162c30 100644
> --- a/drivers/net/wireless/marvell/mwifiex/util.c
> +++ b/drivers/net/wireless/marvell/mwifiex/util.c
> @@ -482,8 +482,15 @@ mwifiex_process_mgmt_packet(struct mwifiex_private *priv,
>  				return 0;
>  
>  			if (ieee80211_is_deauth(ieee_hdr->frame_control)) {
> +				mwifiex_dbg(priv->adapter, MSG,
> +					    "auth: receive deauth from %pM\n",
> +					    ieee_hdr->addr3);
ditto

>  				priv->auth_flag = 0;
>  				priv->auth_alg = 0xFFFF;
> +			} else {
> +				mwifiex_dbg(priv->adapter, MSG,
> +					    "assoc: receive disasso from %pM\n",
> +					    ieee_hdr->addr3);
ditto
Jeff Johnson Dec. 1, 2023, 3:05 p.m. UTC | #2
On 12/1/2023 2:15 AM, Francesco Dolcini wrote:
> On Tue, Nov 28, 2023 at 04:31:05PM +0800, David Lin wrote:

>> diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c
>> index d99127dc466e..3bebb6c37604 100644
>> --- a/drivers/net/wireless/marvell/mwifiex/main.c
>> +++ b/drivers/net/wireless/marvell/mwifiex/main.c
>> @@ -802,6 +802,10 @@ mwifiex_bypass_tx_queue(struct mwifiex_private *priv,
>>  			    "bypass txqueue; eth type %#x, mgmt %d\n",
>>  			     ntohs(eth_hdr->h_proto),
>>  			     mwifiex_is_skb_mgmt_frame(skb));
>> +		if (ntohs(eth_hdr->h_proto) == ETH_P_PAE)
>> +			mwifiex_dbg(priv->adapter, MSG,
>> +				    "key: send EAPOL to %pM\n",
>> +				    eth_hdr->h_dest);
> 
> this is just debug code, at a first glance not sure i

not only that, the usual pattern is:
if (eth_hdr->h_proto == htons(ETH_P_PAE))

you want to do endian conversion on a constant when possible since that
is a compile-time conversion and not a runtime conversion
David Lin Dec. 1, 2023, 10:41 p.m. UTC | #3
> From: Francesco Dolcini <francesco@dolcini.it>
> Sent: Friday, December 1, 2023 6:16 PM
> To: David Lin <yu-hao.lin@nxp.com>
> Cc: linux-wireless@vger.kernel.org; linux-kernel@vger.kernel.org;
> briannorris@chromium.org; kvalo@kernel.org; francesco@dolcini.it; Pete
> Hsieh <tsung-hsien.hsieh@nxp.com>
> Subject: [EXT] Re: [PATCH v7 02/12] wifi: mwifiex: fixed group rekey issue for
> WPA3.
> 
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report
> this email' button
> 
> 
> On Tue, Nov 28, 2023 at 04:31:05PM +0800, David Lin wrote:
> > If host mlme is enabled, gropu rekey offload should be disabled.
> >
> > Signed-off-by: David Lin <yu-hao.lin@nxp.com>
> > ---
> >  drivers/net/wireless/marvell/mwifiex/cfg80211.c | 3 +++
> >  drivers/net/wireless/marvell/mwifiex/main.c     | 4 ++++
> >  drivers/net/wireless/marvell/mwifiex/util.c     | 7 +++++++
> >  3 files changed, 14 insertions(+)
> >
> > diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> > b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> > index 40c39e4765f7..3d59e6a441b9 100644
> > --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> > +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> > @@ -3657,6 +3657,9 @@ static int mwifiex_set_rekey_data(struct wiphy
> *wiphy, struct net_device *dev,
> >       if (!ISSUPP_FIRMWARE_SUPPLICANT(priv->adapter->fw_cap_info))
> >               return -EOPNOTSUPP;
> >
> > +     if (priv->adapter->host_mlme)
> > +             return 0;
> 
> this is a fixup of the previous patch, you should not introduce an issue and
> fix it in the following patch. Please make it correct in the first place fixing up
> that patch.
>

This is the main fix for this issue. If host mlme is enabled, there is no need for firmware to do group rekey off load.
 
> 
> > +
> >       return mwifiex_send_cmd(priv,
> HostCmd_CMD_GTK_REKEY_OFFLOAD_CFG,
> >                               HostCmd_ACT_GEN_SET, 0, data,
> true);  }
> > diff --git a/drivers/net/wireless/marvell/mwifiex/main.c
> > b/drivers/net/wireless/marvell/mwifiex/main.c
> > index d99127dc466e..3bebb6c37604 100644
> > --- a/drivers/net/wireless/marvell/mwifiex/main.c
> > +++ b/drivers/net/wireless/marvell/mwifiex/main.c
> > @@ -802,6 +802,10 @@ mwifiex_bypass_tx_queue(struct mwifiex_private
> *priv,
> >                           "bypass txqueue; eth type %#x, mgmt
> %d\n",
> >                            ntohs(eth_hdr->h_proto),
> >                            mwifiex_is_skb_mgmt_frame(skb));
> > +             if (ntohs(eth_hdr->h_proto) == ETH_P_PAE)
> > +                     mwifiex_dbg(priv->adapter, MSG,
> > +                                 "key: send EAPOL to %pM\n",
> > +                                 eth_hdr->h_dest);
> 
> this is just debug code, at a first glance not sure i

It will be helpful for driver to print out authentication, association and EAPoL key handshaking.
This kind of information will only be printed out when station is associated to AP. It won't affect
TP of driver.

> > diff --git a/drivers/net/wireless/marvell/mwifiex/util.c
> > b/drivers/net/wireless/marvell/mwifiex/util.c
> > index 23675c1cecae..ff1b2f162c30 100644
> > --- a/drivers/net/wireless/marvell/mwifiex/util.c
> > +++ b/drivers/net/wireless/marvell/mwifiex/util.c
> > @@ -482,8 +482,15 @@ mwifiex_process_mgmt_packet(struct
> mwifiex_private *priv,
> >                               return 0;
> >
> >                       if
> > (ieee80211_is_deauth(ieee_hdr->frame_control)) {
> > +                             mwifiex_dbg(priv->adapter, MSG,
> > +                                         "auth: receive deauth
> from %pM\n",
> > +                                         ieee_hdr->addr3);
> ditto
> 
> >                               priv->auth_flag = 0;
> >                               priv->auth_alg = 0xFFFF;
> > +                     } else {
> > +                             mwifiex_dbg(priv->adapter, MSG,
> > +                                         "assoc: receive disasso
> from %pM\n",
> > +                                         ieee_hdr->addr3);
> ditto
David Lin Dec. 1, 2023, 11:18 p.m. UTC | #4
> From: Jeff Johnson <quic_jjohnson@quicinc.com>
> Sent: Friday, December 1, 2023 11:05 PM
> To: Francesco Dolcini <francesco@dolcini.it>; David Lin
> <yu-hao.lin@nxp.com>
> Cc: linux-wireless@vger.kernel.org; linux-kernel@vger.kernel.org;
> briannorris@chromium.org; kvalo@kernel.org; Pete Hsieh
> <tsung-hsien.hsieh@nxp.com>
> Subject: [EXT] Re: [PATCH v7 02/12] wifi: mwifiex: fixed group rekey issue for
> WPA3.
> 
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report
> this email' button
> 
> 
> On 12/1/2023 2:15 AM, Francesco Dolcini wrote:
> > On Tue, Nov 28, 2023 at 04:31:05PM +0800, David Lin wrote:
> 
> >> diff --git a/drivers/net/wireless/marvell/mwifiex/main.c
> >> b/drivers/net/wireless/marvell/mwifiex/main.c
> >> index d99127dc466e..3bebb6c37604 100644
> >> --- a/drivers/net/wireless/marvell/mwifiex/main.c
> >> +++ b/drivers/net/wireless/marvell/mwifiex/main.c
> >> @@ -802,6 +802,10 @@ mwifiex_bypass_tx_queue(struct
> mwifiex_private *priv,
> >>                          "bypass txqueue; eth type %#x, mgmt
> %d\n",
> >>                           ntohs(eth_hdr->h_proto),
> >>                           mwifiex_is_skb_mgmt_frame(skb));
> >> +            if (ntohs(eth_hdr->h_proto) == ETH_P_PAE)
> >> +                    mwifiex_dbg(priv->adapter, MSG,
> >> +                                "key: send EAPOL to %pM\n",
> >> +                                eth_hdr->h_dest);
> >
> > this is just debug code, at a first glance not sure i
> 
> not only that, the usual pattern is:
> if (eth_hdr->h_proto == htons(ETH_P_PAE))
> 
> you want to do endian conversion on a constant when possible since that is
> a compile-time conversion and not a runtime conversion

Thanks. I will fix it for next patch.
diff mbox series

Patch

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 40c39e4765f7..3d59e6a441b9 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -3657,6 +3657,9 @@  static int mwifiex_set_rekey_data(struct wiphy *wiphy, struct net_device *dev,
 	if (!ISSUPP_FIRMWARE_SUPPLICANT(priv->adapter->fw_cap_info))
 		return -EOPNOTSUPP;
 
+	if (priv->adapter->host_mlme)
+		return 0;
+
 	return mwifiex_send_cmd(priv, HostCmd_CMD_GTK_REKEY_OFFLOAD_CFG,
 				HostCmd_ACT_GEN_SET, 0, data, true);
 }
diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c
index d99127dc466e..3bebb6c37604 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.c
+++ b/drivers/net/wireless/marvell/mwifiex/main.c
@@ -802,6 +802,10 @@  mwifiex_bypass_tx_queue(struct mwifiex_private *priv,
 			    "bypass txqueue; eth type %#x, mgmt %d\n",
 			     ntohs(eth_hdr->h_proto),
 			     mwifiex_is_skb_mgmt_frame(skb));
+		if (ntohs(eth_hdr->h_proto) == ETH_P_PAE)
+			mwifiex_dbg(priv->adapter, MSG,
+				    "key: send EAPOL to %pM\n",
+				    eth_hdr->h_dest);
 		return true;
 	}
 
diff --git a/drivers/net/wireless/marvell/mwifiex/util.c b/drivers/net/wireless/marvell/mwifiex/util.c
index 23675c1cecae..ff1b2f162c30 100644
--- a/drivers/net/wireless/marvell/mwifiex/util.c
+++ b/drivers/net/wireless/marvell/mwifiex/util.c
@@ -482,8 +482,15 @@  mwifiex_process_mgmt_packet(struct mwifiex_private *priv,
 				return 0;
 
 			if (ieee80211_is_deauth(ieee_hdr->frame_control)) {
+				mwifiex_dbg(priv->adapter, MSG,
+					    "auth: receive deauth from %pM\n",
+					    ieee_hdr->addr3);
 				priv->auth_flag = 0;
 				priv->auth_alg = 0xFFFF;
+			} else {
+				mwifiex_dbg(priv->adapter, MSG,
+					    "assoc: receive disasso from %pM\n",
+					    ieee_hdr->addr3);
 			}
 		}