hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/net/mac80211/chan.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * mac80211 - channel management
34 */
....@@ -312,9 +313,14 @@
312313
313314 lockdep_assert_held(&local->chanctx_mtx);
314315
315
- /* don't optimize 5MHz, 10MHz, and radar_enabled confs */
316
+ /* don't optimize non-20MHz based and radar_enabled confs */
316317 if (ctx->conf.def.width == NL80211_CHAN_WIDTH_5 ||
317318 ctx->conf.def.width == NL80211_CHAN_WIDTH_10 ||
319
+ ctx->conf.def.width == NL80211_CHAN_WIDTH_1 ||
320
+ ctx->conf.def.width == NL80211_CHAN_WIDTH_2 ||
321
+ ctx->conf.def.width == NL80211_CHAN_WIDTH_4 ||
322
+ ctx->conf.def.width == NL80211_CHAN_WIDTH_8 ||
323
+ ctx->conf.def.width == NL80211_CHAN_WIDTH_16 ||
318324 ctx->conf.radar_enabled) {
319325 ctx->conf.min_def = ctx->conf.def;
320326 return;
....@@ -530,8 +536,16 @@
530536
531537 if (!local->use_chanctx) {
532538 struct cfg80211_chan_def *chandef = &local->_oper_chandef;
533
- chandef->width = NL80211_CHAN_WIDTH_20_NOHT;
539
+ /* S1G doesn't have 20MHz, so get the correct width for the
540
+ * current channel.
541
+ */
542
+ if (chandef->chan->band == NL80211_BAND_S1GHZ)
543
+ chandef->width =
544
+ ieee80211_s1g_channel_width(chandef->chan);
545
+ else
546
+ chandef->width = NL80211_CHAN_WIDTH_20_NOHT;
534547 chandef->center_freq1 = chandef->chan->center_freq;
548
+ chandef->freq1_offset = chandef->chan->freq_offset;
535549 chandef->center_freq2 = 0;
536550
537551 /* NOTE: Disabling radar is only valid here for
....@@ -741,7 +755,7 @@
741755 default:
742756 WARN_ONCE(1, "Invalid SMPS mode %d\n",
743757 sdata->smps_mode);
744
- /* fall through */
758
+ fallthrough;
745759 case IEEE80211_SMPS_OFF:
746760 needed_static = sdata->needed_rx_chains;
747761 needed_dynamic = sdata->needed_rx_chains;
....@@ -1638,12 +1652,9 @@
16381652
16391653 if (new_ctx->replace_state == IEEE80211_CHANCTX_REPLACE_NONE) {
16401654 if (old_ctx)
1641
- err = ieee80211_vif_use_reserved_reassign(sdata);
1642
- else
1643
- err = ieee80211_vif_use_reserved_assign(sdata);
1655
+ return ieee80211_vif_use_reserved_reassign(sdata);
16441656
1645
- if (err)
1646
- return err;
1657
+ return ieee80211_vif_use_reserved_assign(sdata);
16471658 }
16481659
16491660 /*