Search Linux Wireless

RE: [REGRESSION][BISECTED] wifi: RTL8821CE does not work in monitor mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Berg <johannes@xxxxxxxxxxxxxxxx> 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







[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux