diff mbox series

mac80211: Fix sw connection monitor and sw scan when STA is connected HE

Message ID 20210611030422.9608-1-pkshih@realtek.com
State New
Headers show
Series mac80211: Fix sw connection monitor and sw scan when STA is connected HE | expand

Commit Message

Ping-Ke Shih June 11, 2021, 3:04 a.m. UTC
Add HE_NULLFUNC_STACK hw_flag to allow sending nullfunc when STA is
connected HE. Then, sw connection monitor can detects AP has left, and sw
scan can issue nullfunc properly when switching to off channel.

The related commits are commit 41cbb0f5a295 ("mac80211: add support for HE")
that stops sending nullfunc when STA is connected HE, and commit f39b07fdfb68
("mac80211: HE STA disassoc due to QOS NULL not sent") that makes STA
doesn't disconnect locally even if AP has left.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 include/net/mac80211.h  | 4 ++++
 net/mac80211/debugfs.c  | 1 +
 net/mac80211/mlme.c     | 9 ++++++---
 net/mac80211/sta_info.c | 3 ++-
 4 files changed, 13 insertions(+), 4 deletions(-)

Comments

Johannes Berg June 23, 2021, 10:32 a.m. UTC | #1
> Hi mac80211 team,

> 

> We are working on Realtek 11ax driver, rtw89, not being merged yet.

> This driver uses software connection monitor and software scan, like

> our 11ac driver rtw88,

> but we found these two functions don't work properly due to mac80211

> doesn't send

> null data frame when STA is connected HE.

> 

> We search for the reason why it can't send null frame, but we don't

> get the answer.

> Possibly, it is because existing HE hardware supports hardware

> connection monitor

> and scan, or supports TWT to avoid sending null data frame to tell AP

> its PS mode.

> Could anyone enlighten me the reason?


It was just a workaround for an iwlwifi specific issue that got left in.
I just merged a patch from Felix to resolve that.

johannes
Ping-Ke Shih June 23, 2021, 12:49 p.m. UTC | #2
> -----Original Message-----

> From: Johannes Berg [mailto:johannes@sipsolutions.net]

> Sent: Wednesday, June 23, 2021 6:33 PM

> To: Pkshih

> Cc: linux-wireless@vger.kernel.org

> Subject: Re: [PATCH] mac80211: Fix sw connection monitor and sw scan when STA is connected HE

> 

> > Hi mac80211 team,

> >

> > We are working on Realtek 11ax driver, rtw89, not being merged yet.

> > This driver uses software connection monitor and software scan, like

> > our 11ac driver rtw88,

> > but we found these two functions don't work properly due to mac80211

> > doesn't send

> > null data frame when STA is connected HE.

> >

> > We search for the reason why it can't send null frame, but we don't

> > get the answer.

> > Possibly, it is because existing HE hardware supports hardware

> > connection monitor

> > and scan, or supports TWT to avoid sending null data frame to tell AP

> > its PS mode.

> > Could anyone enlighten me the reason?

> 

> It was just a workaround for an iwlwifi specific issue that got left in.

> I just merged a patch from Felix to resolve that.

> 


I check Felix's patch:
https://patchwork.kernel.org/project/linux-wireless/patch/20210619101517.90806-1-nbd@nbd.name/


I think we should revert the commit f39b07fdfb68 ("mac80211: HE STA disassoc due to QOS NULL not sent"),
which fixes connection monitor due to QOS NULL not send.


Another place is ieee80211_send_null_response(); I'm not sure if we can remove
the checking as well.

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index f2fb69da9b6e..13250cadb420 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -1398,11 +1398,6 @@ static void ieee80211_send_null_response(struct sta_info *sta, int tid,
        struct ieee80211_tx_info *info;
        struct ieee80211_chanctx_conf *chanctx_conf;
 
-       /* Don't send NDPs when STA is connected HE */
-       if (sdata->vif.type == NL80211_IFTYPE_STATION &&
-           !(sdata->u.mgd.flags & IEEE80211_STA_DISABLE_HE))
-               return;
-
        if (qos) {
                fc = cpu_to_le16(IEEE80211_FTYPE_DATA |
                                 IEEE80211_STYPE_QOS_NULLFUNC |

--
Ping-Ke
Johannes Berg June 23, 2021, 1 p.m. UTC | #3
On Wed, 2021-06-23 at 12:49 +0000, Pkshih wrote:
> > -----Original Message-----

> > From: Johannes Berg [mailto:johannes@sipsolutions.net]

> > Sent: Wednesday, June 23, 2021 6:33 PM

> > To: Pkshih

> > Cc: linux-wireless@vger.kernel.org

> > Subject: Re: [PATCH] mac80211: Fix sw connection monitor and sw scan

> > when STA is connected HE

> > 

> > > Hi mac80211 team,

> > > 

> > > We are working on Realtek 11ax driver, rtw89, not being merged

> > > yet.

> > > This driver uses software connection monitor and software scan,

> > > like

> > > our 11ac driver rtw88,

> > > but we found these two functions don't work properly due to

> > > mac80211

> > > doesn't send

> > > null data frame when STA is connected HE.

> > > 

> > > We search for the reason why it can't send null frame, but we

> > > don't

> > > get the answer.

> > > Possibly, it is because existing HE hardware supports hardware

> > > connection monitor

> > > and scan, or supports TWT to avoid sending null data frame to tell

> > > AP

> > > its PS mode.

> > > Could anyone enlighten me the reason?

> > 

> > It was just a workaround for an iwlwifi specific issue that got left

> > in.

> > I just merged a patch from Felix to resolve that.

> > 

> 

> I check Felix's patch:

> https://patchwork.kernel.org/project/linux-wireless/patch/20210619101517.90806-1-nbd@nbd.name/

> 

> 

> I think we should revert the commit f39b07fdfb68 ("mac80211: HE STA

> disassoc due to QOS NULL not sent"),

> which fixes connection monitor due to QOS NULL not send.

> 


I agree, that makes sense.

> 

> Another place is ieee80211_send_null_response(); I'm not sure if we

> can remove

> the checking as well.


Yes, I think so.

Want to send patch(es) for that?

johannes
Ping-Ke Shih June 23, 2021, 1:50 p.m. UTC | #4
> -----Original Message-----

> From: Johannes Berg [mailto:johannes@sipsolutions.net]

> Sent: Wednesday, June 23, 2021 9:00 PM

> To: Pkshih

> Cc: linux-wireless@vger.kernel.org

> Subject: Re: [PATCH] mac80211: Fix sw connection monitor and sw scan when STA is connected HE

> 

> On Wed, 2021-06-23 at 12:49 +0000, Pkshih wrote:

> > > -----Original Message-----

> > > From: Johannes Berg [mailto:johannes@sipsolutions.net]

> > > Sent: Wednesday, June 23, 2021 6:33 PM

> > > To: Pkshih

> > > Cc: linux-wireless@vger.kernel.org

> > > Subject: Re: [PATCH] mac80211: Fix sw connection monitor and sw scan

> > > when STA is connected HE

> > >

> > > > Hi mac80211 team,

> > > >

> > > > We are working on Realtek 11ax driver, rtw89, not being merged

> > > > yet.

> > > > This driver uses software connection monitor and software scan,

> > > > like

> > > > our 11ac driver rtw88,

> > > > but we found these two functions don't work properly due to

> > > > mac80211

> > > > doesn't send

> > > > null data frame when STA is connected HE.

> > > >

> > > > We search for the reason why it can't send null frame, but we

> > > > don't

> > > > get the answer.

> > > > Possibly, it is because existing HE hardware supports hardware

> > > > connection monitor

> > > > and scan, or supports TWT to avoid sending null data frame to tell

> > > > AP

> > > > its PS mode.

> > > > Could anyone enlighten me the reason?

> > >

> > > It was just a workaround for an iwlwifi specific issue that got left

> > > in.

> > > I just merged a patch from Felix to resolve that.

> > >

> >

> > I check Felix's patch:

> > https://patchwork.kernel.org/project/linux-wireless/patch/20210619101517.90806-1-nbd@nbd.name/

> >

> >

> > I think we should revert the commit f39b07fdfb68 ("mac80211: HE STA

> > disassoc due to QOS NULL not sent"),

> > which fixes connection monitor due to QOS NULL not send.

> >

> 

> I agree, that makes sense.

> 

> >

> > Another place is ieee80211_send_null_response(); I'm not sure if we

> > can remove

> > the checking as well.

> 

> Yes, I think so.

> 

> Want to send patch(es) for that?

> 


Sure.

Two patches are sent:
https://lore.kernel.org/linux-wireless/20210623134826.10318-1-pkshih@realtek.com/T/#t
https://lore.kernel.org/linux-wireless/20210623134826.10318-2-pkshih@realtek.com/T/#u

--
Ping-Ke
diff mbox series

Patch

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 445b66c6eb7e..6e78d59db528 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2402,6 +2402,9 @@  struct ieee80211_txq {
  *	usage and 802.11 frames with %RX_FLAG_ONLY_MONITOR set for monitor to
  *	the stack.
  *
+ * @IEEE80211_HW_HE_NULLFUNC_STACK: HE hardware needs stack to send nullfunc
+ *	frames.
+ *
  * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  */
 enum ieee80211_hw_flags {
@@ -2457,6 +2460,7 @@  enum ieee80211_hw_flags {
 	IEEE80211_HW_SUPPORTS_TX_ENCAP_OFFLOAD,
 	IEEE80211_HW_SUPPORTS_RX_DECAP_OFFLOAD,
 	IEEE80211_HW_SUPPORTS_CONC_MON_RX_DECAP,
+	IEEE80211_HW_HE_NULLFUNC_STACK,
 
 	/* keep last, obviously */
 	NUM_IEEE80211_HW_FLAGS
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index 9245c0421bda..59997cef5a63 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -457,6 +457,7 @@  static const char *hw_flag_names[] = {
 	FLAG(SUPPORTS_TX_ENCAP_OFFLOAD),
 	FLAG(SUPPORTS_RX_DECAP_OFFLOAD),
 	FLAG(SUPPORTS_CONC_MON_RX_DECAP),
+	FLAG(HE_NULLFUNC_STACK),
 #undef FLAG
 };
 
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 2480bd0577bb..fc0d6ad651b4 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1095,7 +1095,8 @@  void ieee80211_send_nullfunc(struct ieee80211_local *local,
 	struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
 
 	/* Don't send NDPs when STA is connected HE */
-	if (sdata->vif.type == NL80211_IFTYPE_STATION &&
+	if (!ieee80211_hw_check(&local->hw, HE_NULLFUNC_STACK) &&
+	    sdata->vif.type == NL80211_IFTYPE_STATION &&
 	    !(ifmgd->flags & IEEE80211_STA_DISABLE_HE))
 		return;
 
@@ -1131,7 +1132,8 @@  static void ieee80211_send_4addr_nullfunc(struct ieee80211_local *local,
 		return;
 
 	/* Don't send NDPs when connected HE */
-	if (!(sdata->u.mgd.flags & IEEE80211_STA_DISABLE_HE))
+	if (!ieee80211_hw_check(&local->hw, HE_NULLFUNC_STACK) &&
+	    !(sdata->u.mgd.flags & IEEE80211_STA_DISABLE_HE))
 		return;
 
 	skb = dev_alloc_skb(local->hw.extra_tx_headroom + 30);
@@ -2617,7 +2619,8 @@  static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata)
 
 	if (ieee80211_hw_check(&sdata->local->hw, REPORTS_TX_ACK_STATUS)) {
 		ifmgd->nullfunc_failed = false;
-		if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HE))
+		if (!ieee80211_hw_check(&sdata->local->hw, HE_NULLFUNC_STACK) &&
+		    !(ifmgd->flags & IEEE80211_STA_DISABLE_HE))
 			ifmgd->probe_send_count--;
 		else
 			ieee80211_send_nullfunc(sdata->local, sdata, false);
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index f2fb69da9b6e..beda2b1bd9d1 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -1399,7 +1399,8 @@  static void ieee80211_send_null_response(struct sta_info *sta, int tid,
 	struct ieee80211_chanctx_conf *chanctx_conf;
 
 	/* Don't send NDPs when STA is connected HE */
-	if (sdata->vif.type == NL80211_IFTYPE_STATION &&
+	if (!ieee80211_hw_check(&local->hw, HE_NULLFUNC_STACK) &&
+	    sdata->vif.type == NL80211_IFTYPE_STATION &&
 	    !(sdata->u.mgd.flags & IEEE80211_STA_DISABLE_HE))
 		return;