Linux wireless drivers development
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: Johannes Berg <johannes@sipsolutions.net>,
	Thorsten Leemhuis <regressions@leemhuis.info>,
	Savyasaachi Vanga <savyasaachiv@gmail.com>,
	Christian Heusel <christian@heusel.eu>
Cc: Kalle Valo <kvalo@kernel.org>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"regressions@lists.linux.dev" <regressions@lists.linux.dev>
Subject: RE: [REGRESSION][BISECTED] wifi: RTL8821CE does not work in monitor mode
Date: Wed, 12 Jun 2024 00:56:20 +0000	[thread overview]
Message-ID: <5318640d6eb74301b1fbf6d9385ba69e@realtek.com> (raw)
In-Reply-To: <36c1f49acfcc2cc16c7e54ffeb76f1e93cb96e91.camel@sipsolutions.net>

Johannes Berg <johannes@sipsolutions.net> wrote:
> 
> On Mon, 2024-06-03 at 00:47 +0000, Ping-Ke Shih wrote:
> >
> >
> > We have a draft fix of rtw88 driver for RTL8821CE, but as mentioned some drivers
> > are affected, so I don't plan to send out the patch. Instead we are looking for
> > the fix of cfg80211/mac80211.
> >
> 
> Guess you didn't find it :)

You are right. That is not easy to me. :)

> 
> Just got pinged (sp?) about this, can you share the driver fix so I can
> take a look what the issue is about?
> 

Please reference patch below. I copy this idea from rtw89 [1], which the main
stuff is to add WANT_MONITOR_VIF and case NL80211_IFTYPE_MONITOR in add_interface(). 
Additionally check whether bssid is NULL.

Many other drivers like rtlwifi, rtl8xxxue ... don't declare WANT_MONITOR_VIF, so
I think it would be better to fix this by mac80211 instead of fixing these drivers
one by one. 


diff --git a/drivers/net/wireless/realtek/rtw88/mac80211.c b/drivers/net/wireless/realtek/rtw88/mac80211.c
index 0acebbfa13c4..b90d026519e2 100644
--- a/drivers/net/wireless/realtek/rtw88/mac80211.c
+++ b/drivers/net/wireless/realtek/rtw88/mac80211.c
@@ -191,6 +191,7 @@ static int rtw_ops_add_interface(struct ieee80211_hw *hw,
                bcn_ctrl = BIT_EN_BCN_FUNCTION | BIT_DIS_TSF_UDT;
                break;
        case NL80211_IFTYPE_STATION:
+       case NL80211_IFTYPE_MONITOR:
                rtw_add_rsvd_page_sta(rtwdev, rtwvif);
                net_type = RTW_NET_NO_LINK;
                bcn_ctrl = BIT_EN_BCN_FUNCTION;
diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index 7ab7a988b123..d51c7cad79da 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -2231,6 +2231,7 @@ int rtw_register_hw(struct rtw_dev *rtwdev, struct ieee80211_hw *hw)
        ieee80211_hw_set(hw, HAS_RATE_CONTROL);
        ieee80211_hw_set(hw, TX_AMSDU);
        ieee80211_hw_set(hw, SINGLE_SCAN_ON_ALL_BANDS);
+       ieee80211_hw_set(hw, WANT_MONITOR_VIF);

        if (sta_mode_only)
                hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
diff --git a/drivers/net/wireless/realtek/rtw88/phy.c b/drivers/net/wireless/realtek/rtw88/phy.c
index 37ef80c9091d..b1b7892266f0 100644
--- a/drivers/net/wireless/realtek/rtw88/phy.c
+++ b/drivers/net/wireless/realtek/rtw88/phy.c
@@ -627,6 +627,9 @@ static void rtw_phy_parsing_cfo_iter(void *data, u8 *mac,
        u8 *bssid = iter_data->bssid;
        u8 i;

+       if (!vif->bss_conf.bssid)
+               return;
+
        if (!ether_addr_equal(vif->bss_conf.bssid, bssid))
                return;
diff --git a/drivers/net/wireless/realtek/rtw88/rx.c b/drivers/net/wireless/realtek/rtw88/rx.c
index 84aedabdf285..43aa5dd6f2cc 100644
--- a/drivers/net/wireless/realtek/rtw88/rx.c
+++ b/drivers/net/wireless/realtek/rtw88/rx.c
@@ -104,6 +104,9 @@ static void rtw_rx_addr_match_iter(void *data, u8 *mac,
        struct rtw_rx_pkt_stat *pkt_stat = iter_data->pkt_stat;
        u8 *bssid = iter_data->bssid;

+       if (!vif->bss_conf.bssid)
+               return;
+
        if (!ether_addr_equal(vif->bss_conf.bssid, bssid))
                return;


[1] https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git/commit/drivers/net/wireless/realtek/rtw89?id=cd9b6b3baf5278c73c91e242d41387684fc7f8d8




  reply	other threads:[~2024-06-12  0:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-27 22:01 [REGRESSION][BISECTED] wifi: RTL8821CE does not work in monitor mode Christian Heusel
2024-05-28  5:22 ` Linux regression tracking (Thorsten Leemhuis)
2024-05-28 11:50   ` Christian Heusel
2024-05-28  8:21 ` Linux regression tracking (Thorsten Leemhuis)
2024-05-31  5:58   ` Thorsten Leemhuis
2024-06-03  0:47     ` Ping-Ke Shih
2024-06-11 15:25       ` Johannes Berg
2024-06-12  0:56         ` Ping-Ke Shih [this message]
2024-06-12  7:07           ` Johannes Berg
2024-06-12  7:58             ` Johannes Berg
2024-06-12  8:43               ` Ping-Ke Shih
2024-06-12  8:45                 ` Johannes Berg
2024-06-12  8:49                   ` Ping-Ke Shih
2024-06-12 13:31               ` Christian Heusel
2024-06-12  9:12             ` Vasanthakumar Thiagarajan
2024-06-06 13:36 ` Thorsten Leemhuis
2024-06-12 10:23 ` [PATCH] wifi: mac80211: fix monitor channel with chanctx emulation Johannes Berg
2024-06-16 22:02   ` Christian Heusel

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=5318640d6eb74301b1fbf6d9385ba69e@realtek.com \
    --to=pkshih@realtek.com \
    --cc=christian@heusel.eu \
    --cc=johannes@sipsolutions.net \
    --cc=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=regressions@leemhuis.info \
    --cc=regressions@lists.linux.dev \
    --cc=savyasaachiv@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox