diff mbox series

[5/6] wifi: mt76: mt7915: Improve monitor-mode flags settings.

Message ID 20230428205000.2647945-5-greearb@candelatech.com
State Superseded
Headers show
Series [1/6] wifi: mt76: mt7915: Support vht mu-mimo sniffer feature. | expand

Commit Message

Ben Greear April 28, 2023, 8:49 p.m. UTC
From: Ben Greear <greearb@candelatech.com>

This enables capturing more frames, and now when the rx5 group
option is also enabled for rx-status, wireshark shows HE-TRIG
as well as HE-MU frames.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 .../net/wireless/mediatek/mt76/mt7915/main.c  | 26 +++++++++++++++++--
 .../net/wireless/mediatek/mt76/mt7915/regs.h  | 16 ++++++++++++
 2 files changed, 40 insertions(+), 2 deletions(-)

Comments

Ryder Lee April 28, 2023, 9:48 p.m. UTC | #1
On Fri, 2023-04-28 at 13:49 -0700, greearb@candelatech.com wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> 
> 
> From: Ben Greear <greearb@candelatech.com>
> 
> This enables capturing more frames, and now when the rx5 group
> option is also enabled for rx-status, wireshark shows HE-TRIG
> as well as HE-MU frames.
> 
> Signed-off-by: Ben Greear <greearb@candelatech.com>
> ---
>  .../net/wireless/mediatek/mt76/mt7915/main.c  | 26
> +++++++++++++++++--
>  .../net/wireless/mediatek/mt76/mt7915/regs.h  | 16 ++++++++++++
>  2 files changed, 40 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c
> b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
> index 64c14fc303a2..55aed3c6d3be 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
> @@ -562,6 +562,12 @@ static void __mt7915_configure_filter(struct
> ieee80211_hw *hw,
>                         MT_WF_RFCR1_DROP_BF_POLL |
>                         MT_WF_RFCR1_DROP_BA |
>                         MT_WF_RFCR1_DROP_CFEND |
> +                       MT_WF_RFCR1_DROP_PS_BFRPOL |
> +                       MT_WF_RFCR1_DROP_PS_NDPA |
> +                       MT_WF_RFCR1_DROP_NO2ME_TF |
> +                       MT_WF_RFCR1_DROP_NON_MUBAR_TF |
> +                       MT_WF_RFCR1_DROP_RXS_BRP |
> +                       MT_WF_RFCR1_DROP_TF_BFRP |
>                         MT_WF_RFCR1_DROP_CFACK;
>         u32 flags = 0;
>         bool is_promisc = *total_flags & FIF_CONTROL || phy-
> >monitor_vif ||
> @@ -587,7 +593,9 @@ static void __mt7915_configure_filter(struct
> ieee80211_hw *hw,
>                            MT_WF_RFCR_DROP_BCAST |
>                            MT_WF_RFCR_DROP_DUPLICATE |
>                            MT_WF_RFCR_DROP_A2_BSSID |
> -                          MT_WF_RFCR_DROP_UNWANTED_CTL |
> +                          MT_WF_RFCR_DROP_UNWANTED_CTL | /* 0 means
> drop */
> +                          MT_WF_RFCR_IND_FILTER_EN_OF_31_23_BIT |
> +                          MT_WF_RFCR_DROP_DIFFBSSIDMGT_CTRL |
>                            MT_WF_RFCR_DROP_STBC_MULTI);
> 
>         phy->rxfilter |= MT_WF_RFCR_DROP_OTHER_UC;
> @@ -602,8 +610,22 @@ static void __mt7915_configure_filter(struct
> ieee80211_hw *hw,
>                              MT_WF_RFCR_DROP_RTS |
>                              MT_WF_RFCR_DROP_CTL_RSV |
>                              MT_WF_RFCR_DROP_NDPA);
> -       if (is_promisc)
> +       if (is_promisc) {
>                 phy->rxfilter &= ~MT_WF_RFCR_DROP_OTHER_UC;
> +               phy->rxfilter |=
> MT_WF_RFCR_IND_FILTER_EN_OF_31_23_BIT;
> +               if (flags & FIF_CONTROL) {
> +                       phy->rxfilter |=
> MT_WF_RFCR_DROP_UNWANTED_CTL; /* 1 means receive */
> +                       phy->rxfilter |= MT_WF_RFCR_SECOND_BCN_EN;
> +                       phy->rxfilter |=
> MT_WF_RFCR_RX_MGMT_FRAME_CTRL;
> +                       phy->rxfilter |=
> MT_WF_RFCR_RX_SAMEBSSIDPRORESP_CTRL;
> +                       phy->rxfilter |=
> MT_WF_RFCR_RX_DIFFBSSIDPRORESP_CTRL;
> +                       phy->rxfilter |=
> MT_WF_RFCR_RX_SAMEBSSIDBCN_CTRL;
> +                       phy->rxfilter |=
> MT_WF_RFCR_RX_SAMEBSSIDNULL_CTRL;
> +                       phy->rxfilter |=
> MT_WF_RFCR_RX_DIFFBSSIDNULL_CTRL;
> +                       phy->rxfilter &=
> ~(MT_WF_RFCR_DROP_DIFFBSSIDMGT_CTRL);

FIF_CONTROL: pass control frame. However, many of these are not control
frames. I think we should move monitor dedicated misc parts to
IEEE80211_CONF_CHANGE_MONITOR mt7915_set_monitor and leave this
function as-is ... as my reply in [2/6].
> +               }
> +               phy->rxfilter |= MT_WF_RFCR_RX_DATA_FRAME_CTRL;
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
index 64c14fc303a2..55aed3c6d3be 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
@@ -562,6 +562,12 @@  static void __mt7915_configure_filter(struct ieee80211_hw *hw,
 			MT_WF_RFCR1_DROP_BF_POLL |
 			MT_WF_RFCR1_DROP_BA |
 			MT_WF_RFCR1_DROP_CFEND |
+			MT_WF_RFCR1_DROP_PS_BFRPOL |
+			MT_WF_RFCR1_DROP_PS_NDPA |
+			MT_WF_RFCR1_DROP_NO2ME_TF |
+			MT_WF_RFCR1_DROP_NON_MUBAR_TF |
+			MT_WF_RFCR1_DROP_RXS_BRP |
+			MT_WF_RFCR1_DROP_TF_BFRP |
 			MT_WF_RFCR1_DROP_CFACK;
 	u32 flags = 0;
 	bool is_promisc = *total_flags & FIF_CONTROL || phy->monitor_vif ||
@@ -587,7 +593,9 @@  static void __mt7915_configure_filter(struct ieee80211_hw *hw,
 			   MT_WF_RFCR_DROP_BCAST |
 			   MT_WF_RFCR_DROP_DUPLICATE |
 			   MT_WF_RFCR_DROP_A2_BSSID |
-			   MT_WF_RFCR_DROP_UNWANTED_CTL |
+			   MT_WF_RFCR_DROP_UNWANTED_CTL | /* 0 means drop */
+			   MT_WF_RFCR_IND_FILTER_EN_OF_31_23_BIT |
+			   MT_WF_RFCR_DROP_DIFFBSSIDMGT_CTRL |
 			   MT_WF_RFCR_DROP_STBC_MULTI);
 
 	phy->rxfilter |= MT_WF_RFCR_DROP_OTHER_UC;
@@ -602,8 +610,22 @@  static void __mt7915_configure_filter(struct ieee80211_hw *hw,
 			     MT_WF_RFCR_DROP_RTS |
 			     MT_WF_RFCR_DROP_CTL_RSV |
 			     MT_WF_RFCR_DROP_NDPA);
-	if (is_promisc)
+	if (is_promisc) {
 		phy->rxfilter &= ~MT_WF_RFCR_DROP_OTHER_UC;
+		phy->rxfilter |= MT_WF_RFCR_IND_FILTER_EN_OF_31_23_BIT;
+		if (flags & FIF_CONTROL) {
+			phy->rxfilter |= MT_WF_RFCR_DROP_UNWANTED_CTL; /* 1 means receive */
+			phy->rxfilter |= MT_WF_RFCR_SECOND_BCN_EN;
+			phy->rxfilter |= MT_WF_RFCR_RX_MGMT_FRAME_CTRL;
+			phy->rxfilter |= MT_WF_RFCR_RX_SAMEBSSIDPRORESP_CTRL;
+			phy->rxfilter |= MT_WF_RFCR_RX_DIFFBSSIDPRORESP_CTRL;
+			phy->rxfilter |= MT_WF_RFCR_RX_SAMEBSSIDBCN_CTRL;
+			phy->rxfilter |= MT_WF_RFCR_RX_SAMEBSSIDNULL_CTRL;
+			phy->rxfilter |= MT_WF_RFCR_RX_DIFFBSSIDNULL_CTRL;
+			phy->rxfilter &= ~(MT_WF_RFCR_DROP_DIFFBSSIDMGT_CTRL);
+		}
+		phy->rxfilter |= MT_WF_RFCR_RX_DATA_FRAME_CTRL;
+	}
 
 	*total_flags = flags;
 	mt76_wr(dev, MT_WF_RFCR(band), phy->rxfilter);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/regs.h b/drivers/net/wireless/mediatek/mt76/mt7915/regs.h
index db81c9902832..db52334204ed 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/regs.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/regs.h
@@ -547,6 +547,16 @@  enum offs_rev {
 #define MT_WF_RFCR_DROP_OTHER_TIM	BIT(19)
 #define MT_WF_RFCR_DROP_NDPA		BIT(20)
 #define MT_WF_RFCR_DROP_UNWANTED_CTL	BIT(21)
+#define MT_WF_RFCR_IND_FILTER_EN_OF_31_23_BIT      BIT(22)
+#define MT_WF_RFCR_SECOND_BCN_EN                   BIT(23)
+#define MT_WF_RFCR_RX_MGMT_FRAME_CTRL              BIT(24)
+#define MT_WF_RFCR_RX_DATA_FRAME_CTRL              BIT(25)
+#define MT_WF_RFCR_RX_SAMEBSSIDPRORESP_CTRL        BIT(26)
+#define MT_WF_RFCR_RX_DIFFBSSIDPRORESP_CTRL        BIT(27)
+#define MT_WF_RFCR_RX_SAMEBSSIDBCN_CTRL            BIT(28)
+#define MT_WF_RFCR_RX_SAMEBSSIDNULL_CTRL           BIT(29)
+#define MT_WF_RFCR_RX_DIFFBSSIDNULL_CTRL           BIT(30)
+#define MT_WF_RFCR_DROP_DIFFBSSIDMGT_CTRL          BIT(31)
 
 #define MT_WF_RFCR1(_band)		MT_WF_RMAC(_band, 0x004)
 #define MT_WF_RFCR1_DROP_ACK		BIT(4)
@@ -554,6 +564,12 @@  enum offs_rev {
 #define MT_WF_RFCR1_DROP_BA		BIT(6)
 #define MT_WF_RFCR1_DROP_CFEND		BIT(7)
 #define MT_WF_RFCR1_DROP_CFACK		BIT(8)
+#define MT_WF_RFCR1_DROP_PS_BFRPOL	BIT(11)
+#define MT_WF_RFCR1_DROP_PS_NDPA	BIT(12)
+#define MT_WF_RFCR1_DROP_NO2ME_TF	BIT(22)
+#define MT_WF_RFCR1_DROP_NON_MUBAR_TF	BIT(23)
+#define MT_WF_RFCR1_DROP_RXS_BRP	BIT(25)
+#define MT_WF_RFCR1_DROP_TF_BFRP	BIT(30)
 
 #define MT_WF_RMAC_RSVD0(_band)	MT_WF_RMAC(_band, 0x02e0)
 #define MT_WF_RMAC_RSVD0_EIFS_CLR	BIT(21)