Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH REGRESSION] wifi: mac80211: also accept RX frames reported on channel center frequency
@ 2026-12-03 16:53 Catalin Iacob
  2026-12-03 17:04 ` Berg, Benjamin
  0 siblings, 1 reply; 7+ messages in thread
From: Catalin Iacob @ 2026-12-03 16:53 UTC (permalink / raw)
  To: Johannes Berg, Benjamin Berg
  Cc: Ping-Ke Shih, linux-wireless, regressions, Catalin Iacob

Commit 6d531b9af16e ("wifi: mac80211: rework RX packet handling")
intentionally made mac80211 more strict by checking the RX frame's
frequency when determining the link. However, it did not account for
drivers reporting the center frequency of the configured channel rather
than the primary channel frequency. Relax the check to also accept
configured channel center frequencies, including both centers for
80+80MHz channels.

Fixes: 6d531b9af16e ("wifi: mac80211: rework RX packet handling")
Signed-off-by: Catalin Iacob <iacobcatalin@gmail.com>
---
Since 7.4-rc1 my wireless card doesn't work at all on a 5GHz access
point, not even ping to the default gateway. This is perfectly
reproducible at every boot since rc1, I just did not get the chance to
debug and report it so far. lspci identifies the card as:

 c0:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8922AE 802.11be PCIe Wireless Network Ad

From code analysis I expect more drivers could be broken the same way
though it's dependent on channel frequencies which I guess explains why
this one is rare enough that it wasn't reported yet based on what I see
in the wireless tree and on lore.

I bisected the issue to 6d531b9af16e ("wifi: mac80211: rework RX packet
handling")

I don't know the code at all but, with some LLM help, I poked around,
added some debug prints and this one added to ieee80211_rx_valid_freq
when it would return falso best shows what's happening:

 pr_warn_ratelimited("wifihangdebug: mac80211: rejecting RX frame on %s: fc=%04x reported frequency %d MHz, expected primary %d MHz (channel %d), width %d MHz, center_freq1 %d MHz, center_freq2 %d MHz\n",
                     link->sdata->name, le16_to_cpu(hdr->frame_control),
                     freq, conf->def.chan->center_freq,
                     conf->def.chan->hw_value,
                     nl80211_chan_width_to_mhz(conf->def.width),
                     conf->def.center_freq1, conf->def.center_freq2);
prints:

 wifihangdebug: mac80211: rejecting RX frame on wlp192s0: fc=4208 reported frequency 5210 MHz, expected primary 5180 MHz (channel 36), width 80 MHz, center_freq1 5210 MHz, center_freq2 0 MHz

See the patch for what appears to me as a correct fix: drivers can
report both frequencies so both need to be accepted. In my tests this
works and fixes wifi for my card. But take the code and expecially the
commit message with grains of salt, I don't know the area to trust that
it's a proper fix explained with correct terminology.

#regzbot introduced: 6d531b9af16e
---
 net/mac80211/rx.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index f8cfd04c0c6c..2d8c160d84b0 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -5346,6 +5346,14 @@ static void __ieee80211_rx_handle_8023(struct ieee80211_hw *hw,
 	dev_kfree_skb(skb);
 }
 
+static bool ieee80211_rx_freq_matches_chan(int freq,
+					   struct ieee80211_chanctx_conf *conf)
+{
+	return freq == conf->def.chan->center_freq ||
+	       freq == conf->def.center_freq1 ||
+	       (conf->def.center_freq2 && freq == conf->def.center_freq2);
+}
+
 static bool ieee80211_rx_valid_freq(int freq, struct ieee80211_link_data *link)
 {
 	struct ieee80211_chanctx_conf *conf;
@@ -5358,7 +5366,7 @@ static bool ieee80211_rx_valid_freq(int freq, struct ieee80211_link_data *link)
 	if (!conf || !conf->def.chan)
 		return false;
 
-	return freq == conf->def.chan->center_freq;
+	return ieee80211_rx_freq_matches_chan(freq, conf);
 }
 
 static struct ieee80211_link_data *
@@ -5374,7 +5382,7 @@ ieee80211_link_from_freq(struct ieee80211_sub_if_data *sdata, int freq)
 			if (!conf || !conf->def.chan)
 				continue;
 
-			if (freq == conf->def.chan->center_freq)
+			if (ieee80211_rx_freq_matches_chan(freq, conf))
 				return link;
 		}
 

---
base-commit: 2dcd468aff400f859d8e520e41814e7fd35e35aa
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless.git main
change-id: 20261203-wifi-breakage-7-4-rc1-d46f38f9ed7f

Best regards,
--  
Catalin Iacob <iacobcatalin@gmail.com>


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH REGRESSION] wifi: mac80211: also accept RX frames reported on channel center frequency
  2026-12-03 16:53 [PATCH REGRESSION] wifi: mac80211: also accept RX frames reported on channel center frequency Catalin Iacob
@ 2026-12-03 17:04 ` Berg, Benjamin
  2026-12-03 21:02   ` Catalin Iacob
  0 siblings, 1 reply; 7+ messages in thread
From: Berg, Benjamin @ 2026-12-03 17:04 UTC (permalink / raw)
  To: johannes@sipsolutions.net, iacobcatalin@gmail.com
  Cc: linux-wireless@vger.kernel.org, pkshih@realtek.com,
	regressions@lists.linux.dev

Hi,

On Thu, 2026-12-03 at 18:53 +0200, Catalin Iacob wrote:
> Commit 6d531b9af16e ("wifi: mac80211: rework RX packet handling")
> intentionally made mac80211 more strict by checking the RX frame's
> frequency when determining the link. However, it did not account for
> drivers reporting the center frequency of the configured channel
> rather
> than the primary channel frequency. Relax the check to also accept
> configured channel center frequencies, including both centers for
> 80+80MHz channels.

So, the field is documented as

 * @freq: frequency the radio was tuned to when receiving this frame, in MHz
 *	This field must be set for management frames, but isn't strictly needed
 *	for data (other) frames - for those it only affects radiotap reporting.

and I always thought that this was supposed to be the control frequency
rather than the channel center frequency.

Would it be possible to change the reporting on the driver side to so
that everyone agrees on the same definition?

Benjamin

> 
> Fixes: 6d531b9af16e ("wifi: mac80211: rework RX packet handling")
> Signed-off-by: Catalin Iacob <iacobcatalin@gmail.com>
> ---
> Since 7.4-rc1 my wireless card doesn't work at all on a 5GHz access
> point, not even ping to the default gateway. This is perfectly
> reproducible at every boot since rc1, I just did not get the chance
> to
> debug and report it so far. lspci identifies the card as:
> 
>  c0:00.0 Network controller: Realtek Semiconductor Co., Ltd.
> RTL8922AE 802.11be PCIe Wireless Network Ad
> 
> From code analysis I expect more drivers could be broken the same way
> though it's dependent on channel frequencies which I guess explains
> why
> this one is rare enough that it wasn't reported yet based on what I
> see
> in the wireless tree and on lore.
> 
> I bisected the issue to 6d531b9af16e ("wifi: mac80211: rework RX
> packet
> handling")
> 
> I don't know the code at all but, with some LLM help, I poked around,
> added some debug prints and this one added to ieee80211_rx_valid_freq
> when it would return falso best shows what's happening:
> 
>  pr_warn_ratelimited("wifihangdebug: mac80211: rejecting RX frame on
> %s: fc=%04x reported frequency %d MHz, expected primary %d MHz
> (channel %d), width %d MHz, center_freq1 %d MHz, center_freq2 %d
> MHz\n",
>                      link->sdata->name, le16_to_cpu(hdr-
> >frame_control),
>                      freq, conf->def.chan->center_freq,
>                      conf->def.chan->hw_value,
>                      nl80211_chan_width_to_mhz(conf->def.width),
>                      conf->def.center_freq1, conf->def.center_freq2);
> prints:
> 
>  wifihangdebug: mac80211: rejecting RX frame on wlp192s0: fc=4208
> reported frequency 5210 MHz, expected primary 5180 MHz (channel 36),
> width 80 MHz, center_freq1 5210 MHz, center_freq2 0 MHz
> 
> See the patch for what appears to me as a correct fix: drivers can
> report both frequencies so both need to be accepted. In my tests this
> works and fixes wifi for my card. But take the code and expecially
> the
> commit message with grains of salt, I don't know the area to trust
> that
> it's a proper fix explained with correct terminology.
> 
> #regzbot introduced: 6d531b9af16e
> ---
>  net/mac80211/rx.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
> index f8cfd04c0c6c..2d8c160d84b0 100644
> --- a/net/mac80211/rx.c
> +++ b/net/mac80211/rx.c
> @@ -5346,6 +5346,14 @@ static void __ieee80211_rx_handle_8023(struct
> ieee80211_hw *hw,
>  	dev_kfree_skb(skb);
>  }
>  
> +static bool ieee80211_rx_freq_matches_chan(int freq,
> +					   struct
> ieee80211_chanctx_conf *conf)
> +{
> +	return freq == conf->def.chan->center_freq ||
> +	       freq == conf->def.center_freq1 ||
> +	       (conf->def.center_freq2 && freq == conf-
> >def.center_freq2);
> +}
> +
>  static bool ieee80211_rx_valid_freq(int freq, struct
> ieee80211_link_data *link)
>  {
>  	struct ieee80211_chanctx_conf *conf;
> @@ -5358,7 +5366,7 @@ static bool ieee80211_rx_valid_freq(int freq,
> struct ieee80211_link_data *link)
>  	if (!conf || !conf->def.chan)
>  		return false;
>  
> -	return freq == conf->def.chan->center_freq;
> +	return ieee80211_rx_freq_matches_chan(freq, conf);
>  }
>  
>  static struct ieee80211_link_data *
> @@ -5374,7 +5382,7 @@ ieee80211_link_from_freq(struct
> ieee80211_sub_if_data *sdata, int freq)
>  			if (!conf || !conf->def.chan)
>  				continue;
>  
> -			if (freq == conf->def.chan->center_freq)
> +			if (ieee80211_rx_freq_matches_chan(freq,
> conf))
>  				return link;
>  		}
>  
> 
> ---
> base-commit: 2dcd468aff400f859d8e520e41814e7fd35e35aa
> base-tree:
> git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless.git
> main
> change-id: 20261203-wifi-breakage-7-4-rc1-d46f38f9ed7f
> 
> Best regards,
> --  
> Catalin Iacob <iacobcatalin@gmail.com>
________________________________________
Intel Deutschland GmbH 

Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany 

Tel: +49 (89) 99143-0 

www.intel.de 

Managing Directors: Candice Moore, Jeffrey Schneiderman, Ramachandran Sitaraman

Chairperson of the Supervisory Board: Sonja Pierer

Registered Seat: Munich Commercial Register B: Amtsgericht Munich HRB 186928

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH REGRESSION] wifi: mac80211: also accept RX frames reported on channel center frequency
  2026-12-03 17:04 ` Berg, Benjamin
@ 2026-12-03 21:02   ` Catalin Iacob
  2026-12-04  2:49     ` Ping-Ke Shih
  0 siblings, 1 reply; 7+ messages in thread
From: Catalin Iacob @ 2026-12-03 21:02 UTC (permalink / raw)
  To: Berg, Benjamin
  Cc: johannes@sipsolutions.net, linux-wireless@vger.kernel.org,
	pkshih@realtek.com, regressions@lists.linux.dev

On Thu, Dec 03, 2026 at 05:04:58PM +0000, Berg, Benjamin wrote:
> So, the field is documented as
> 
>  * @freq: frequency the radio was tuned to when receiving this frame, in MHz
>  *	This field must be set for management frames, but isn't strictly needed
>  *	for data (other) frames - for those it only affects radiotap reporting.
> 
> and I always thought that this was supposed to be the control frequency
> rather than the channel center frequency.
> 
> Would it be possible to change the reporting on the driver side to so
> that everyone agrees on the same definition?

I looked through the rtw code, it doesn't seem trivial to me because
part of it comes from hardware, e.g. phy_ppdu->chan_index in
rtw8922a_fill_freq_with_ppdu and similar code for other Realtek models
and I don't know how "normalized" what the hardware reports is. I expect
Ping-Ke Shih will answer around feasibility of doing this for Realtek.

I did not check other drivers, there could be more having similar
issues.

These reasons are why I judged my patch to be better than auditing and
changing the drivers but given my lack of expertise it's more a guess
than something I stand by. Happy with any solution you pick, just please
fix this before 7.4 final, it's a big regression for the drivers
affected.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH REGRESSION] wifi: mac80211: also accept RX frames reported on channel center frequency
  2026-12-03 21:02   ` Catalin Iacob
@ 2026-12-04  2:49     ` Ping-Ke Shih
  2026-12-04  4:08       ` Lachlan Hodges
  2026-12-04  9:58       ` Berg, Benjamin
  0 siblings, 2 replies; 7+ messages in thread
From: Ping-Ke Shih @ 2026-12-04  2:49 UTC (permalink / raw)
  To: Catalin Iacob, Berg, Benjamin
  Cc: johannes@sipsolutions.net, linux-wireless@vger.kernel.org,
	regressions@lists.linux.dev

Catalin Iacob <iacobcatalin@gmail.com> wrote:
> On Thu, Dec 03, 2026 at 05:04:58PM +0000, Berg, Benjamin wrote:
> > So, the field is documented as
> >
> >  * @freq: frequency the radio was tuned to when receiving this frame, in MHz
> >  *    This field must be set for management frames, but isn't strictly needed
> >  *    for data (other) frames - for those it only affects radiotap reporting.
> >
> > and I always thought that this was supposed to be the control frequency
> > rather than the channel center frequency.
> >
> > Would it be possible to change the reporting on the driver side to so
> > that everyone agrees on the same definition?
> 
> I looked through the rtw code, it doesn't seem trivial to me because
> part of it comes from hardware, e.g. phy_ppdu->chan_index in
> rtw8922a_fill_freq_with_ppdu and similar code for other Realtek models
> and I don't know how "normalized" what the hardware reports is. I expect
> Ping-Ke Shih will answer around feasibility of doing this for Realtek.

Unfortunately the hardware report is controlled by firmware. I'd ask
firmware to change from center channel to primary channel. However,
it takes some time to develop and deliver to users. Can we apply
this patch in advance?

Ping-Ke



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH REGRESSION] wifi: mac80211: also accept RX frames reported on channel center frequency
  2026-12-04  2:49     ` Ping-Ke Shih
@ 2026-12-04  4:08       ` Lachlan Hodges
  2026-12-04 11:57         ` Catalin Iacob
  2026-12-04  9:58       ` Berg, Benjamin
  1 sibling, 1 reply; 7+ messages in thread
From: Lachlan Hodges @ 2026-12-04  4:08 UTC (permalink / raw)
  To: Ping-Ke Shih
  Cc: Catalin Iacob, Berg, Benjamin, johannes@sipsolutions.net,
	linux-wireless@vger.kernel.org, regressions@lists.linux.dev

On Fri, Dec 04, 2026 at 02:49:21AM +0000, Ping-Ke Shih wrote:
> Catalin Iacob <iacobcatalin@gmail.com> wrote:
> > On Thu, Dec 03, 2026 at 05:04:58PM +0000, Berg, Benjamin wrote:
> > > So, the field is documented as
> > >
> > >  * @freq: frequency the radio was tuned to when receiving this frame, in MHz
> > >  *    This field must be set for management frames, but isn't strictly needed
> > >  *    for data (other) frames - for those it only affects radiotap reporting.
> > >
> > > and I always thought that this was supposed to be the control frequency
> > > rather than the channel center frequency.
> > >
> > > Would it be possible to change the reporting on the driver side to so
> > > that everyone agrees on the same definition?
> > 
> > I looked through the rtw code, it doesn't seem trivial to me because
> > part of it comes from hardware, e.g. phy_ppdu->chan_index in
> > rtw8922a_fill_freq_with_ppdu and similar code for other Realtek models
> > and I don't know how "normalized" what the hardware reports is. I expect
> > Ping-Ke Shih will answer around feasibility of doing this for Realtek.
> 
> Unfortunately the hardware report is controlled by firmware. I'd ask
> firmware to change from center channel to primary channel. However,
> it takes some time to develop and deliver to users. Can we apply
> this patch in advance?

FWIW if you are going to make this change, please use the KHz helpers
to ensure freq_offset is accounted for (ieee80211_channel_to_khz
and ieee80211_rx_status_to_khz) such as in [1] (that patch is only
in -next so it will probably conflict)

lachlan

[1] https://lore.kernel.org/linux-wireless/20261028044118.1422069-2-lachlan.hodges@morsemicro.com/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH REGRESSION] wifi: mac80211: also accept RX frames reported on channel center frequency
  2026-12-04  2:49     ` Ping-Ke Shih
  2026-12-04  4:08       ` Lachlan Hodges
@ 2026-12-04  9:58       ` Berg, Benjamin
  1 sibling, 0 replies; 7+ messages in thread
From: Berg, Benjamin @ 2026-12-04  9:58 UTC (permalink / raw)
  To: pkshih@realtek.com, iacobcatalin@gmail.com
  Cc: linux-wireless@vger.kernel.org, johannes@sipsolutions.net,
	regressions@lists.linux.dev

Hi,

On Fri, 2026-12-04 at 02:49 +0000, Ping-Ke Shih wrote:
> Catalin Iacob <iacobcatalin@gmail.com> wrote:
> > On Thu, Dec 03, 2026 at 05:04:58PM +0000, Berg, Benjamin wrote:
> > > So, the field is documented as
> > > 
> > >  * @freq: frequency the radio was tuned to when receiving this frame, in MHz
> > >  *    This field must be set for management frames, but isn't strictly needed
> > >  *    for data (other) frames - for those it only affects radiotap reporting.
> > > 
> > > and I always thought that this was supposed to be the control frequency
> > > rather than the channel center frequency.
> > > 
> > > Would it be possible to change the reporting on the driver side to so
> > > that everyone agrees on the same definition?
> > 
> > I looked through the rtw code, it doesn't seem trivial to me because
> > part of it comes from hardware, e.g. phy_ppdu->chan_index in
> > rtw8922a_fill_freq_with_ppdu and similar code for other Realtek models
> > and I don't know how "normalized" what the hardware reports is. I expect
> > Ping-Ke Shih will answer around feasibility of doing this for Realtek.
> 
> Unfortunately the hardware report is controlled by firmware. I'd ask
> firmware to change from center channel to primary channel. However,
> it takes some time to develop and deliver to users. Can we apply
> this patch in advance?

So, I could also imagine two approaches in the driver right now.

One would be to just not report the information for data frames. The
link_sta will be set and mac80211 just double checks that the
information is consistent.

The other could be to simply rewrite it in the driver. That should be
pretty easy to do, at least if we know that the frame was not received
during some off-channel operation.

That said, one could relax the check.

Benjamin
________________________________________
Intel Deutschland GmbH 

Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany 

Tel: +49 (89) 99143-0 

www.intel.de 

Managing Directors: Candice Moore, Jeffrey Schneiderman, Ramachandran Sitaraman

Chairperson of the Supervisory Board: Sonja Pierer

Registered Seat: Munich Commercial Register B: Amtsgericht Munich HRB 186928

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH REGRESSION] wifi: mac80211: also accept RX frames reported on channel center frequency
  2026-12-04  4:08       ` Lachlan Hodges
@ 2026-12-04 11:57         ` Catalin Iacob
  0 siblings, 0 replies; 7+ messages in thread
From: Catalin Iacob @ 2026-12-04 11:57 UTC (permalink / raw)
  To: Lachlan Hodges
  Cc: Ping-Ke Shih, Berg, Benjamin, johannes@sipsolutions.net,
	linux-wireless@vger.kernel.org, regressions@lists.linux.dev

On Fri, Dec 04, 2026 at 03:08:31PM +1100, Lachlan Hodges wrote:
> FWIW if you are going to make this change, please use the KHz helpers
> to ensure freq_offset is accounted for (ieee80211_channel_to_khz
> and ieee80211_rx_status_to_khz) such as in [1] (that patch is only
> in -next so it will probably conflict)
> 
> lachlan
> 
> [1] https://lore.kernel.org/linux-wireless/20261028044118.1422069-2-lachlan.hodges@morsemicro.com/

I see thanks. I have a new version locally incorporating those helpers,
just tested it and it still works. I'm not posting it yet to not spam
with patches while there's an ongoing discussion of whether to change
the driver or relax the check.

A question Lachlan: your patch in wireless-next does not change
ieee80211_link_from_freq() which still has:
if (freq == conf->def.chan->center_freq)
without the helpers. Is that intentional or an oversight?

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-12-04 11:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 16:53 [PATCH REGRESSION] wifi: mac80211: also accept RX frames reported on channel center frequency Catalin Iacob
2026-12-03 17:04 ` Berg, Benjamin
2026-12-03 21:02   ` Catalin Iacob
2026-12-04  2:49     ` Ping-Ke Shih
2026-12-04  4:08       ` Lachlan Hodges
2026-12-04 11:57         ` Catalin Iacob
2026-12-04  9:58       ` Berg, Benjamin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox