]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mac80211: Support Tx of action frame for NAN
authorIlan Peer <ilan.peer@intel.com>
Mon, 8 Sep 2025 11:13:02 +0000 (14:13 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 19 Sep 2025 09:26:22 +0000 (11:26 +0200)
Add support for sending management frame over a NAN Device
interface:

- Declare support for the supported management frames types.
- Since action frame transmissions over a NAN Device interface
  do not necessarily require a channel configuration, e.g., they
  can be transmitted during DW, modify the Tx path to avoid
  accessing channel information for NAN Device interface.
- In addition modify the points in the Tx path logic to account
  for cases that a band is not specified in the Tx information.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250908140015.23b160089228.I65a58af753bcbcfb5c4ad8ef372d546f889725ba@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/mac80211.h
net/mac80211/main.c
net/mac80211/offchannel.c
net/mac80211/rate.c
net/mac80211/tx.c

index a45e4bee65d4f651a1fbdf1cffc00ea27069298f..a5140ecf334b49e50f61c0dabb8dd042c0469185 100644 (file)
@@ -3192,6 +3192,10 @@ ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
 {
        if (WARN_ON_ONCE(c->control.rates[0].idx < 0))
                return NULL;
+
+       if (c->band >= NUM_NL80211_BANDS)
+               return NULL;
+
        return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx];
 }
 
index 437f1363c982b9e58374c8f0bb71a894953dc74f..27b3ec5deabe0c5259fde6744bcc7aff2c119003 100644 (file)
@@ -746,6 +746,11 @@ ieee80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = {
                        BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
                        BIT(IEEE80211_STYPE_AUTH >> 4),
        },
+       [NL80211_IFTYPE_NAN] = {
+               .tx = 0xffff,
+               .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
+                       BIT(IEEE80211_STYPE_AUTH >> 4),
+       },
 };
 
 static const struct ieee80211_ht_cap mac80211_ht_capa_mod_mask = {
index 13df6321634debd3fb777b08f55a8bafef805022..ae82533e3c0259dfdf5d1cd67885119084f0bae9 100644 (file)
@@ -8,7 +8,7 @@
  * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
  * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
  * Copyright 2009      Johannes Berg <johannes@sipsolutions.net>
- * Copyright (C) 2019, 2022-2024 Intel Corporation
+ * Copyright (C) 2019, 2022-2025 Intel Corporation
  */
 #include <linux/export.h>
 #include <net/mac80211.h>
@@ -897,6 +897,7 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
                need_offchan = true;
                break;
        case NL80211_IFTYPE_NAN:
+               break;
        default:
                return -EOPNOTSUPP;
        }
@@ -910,6 +911,8 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
        /* Check if the operating channel is the requested channel */
        if (!params->chan && mlo_sta) {
                need_offchan = false;
+       } else if (sdata->vif.type == NL80211_IFTYPE_NAN) {
+               /* Frames can be sent during NAN schedule */
        } else if (!need_offchan) {
                struct ieee80211_chanctx_conf *chanctx_conf = NULL;
                int i;
index 3cb2ad6d0b280257bd1646bcfb0c4e691207876a..e441f85416037dac771a160b2e9989d37e13ab28 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright 2005-2006, Devicescape Software, Inc.
  * Copyright (c) 2006 Jiri Benc <jbenc@suse.cz>
  * Copyright 2017      Intel Deutschland GmbH
- * Copyright (C) 2019, 2022-2024 Intel Corporation
+ * Copyright (C) 2019, 2022-2025 Intel Corporation
  */
 
 #include <linux/kernel.h>
@@ -98,6 +98,9 @@ void rate_control_tx_status(struct ieee80211_local *local,
        if (!ref || !test_sta_flag(sta, WLAN_STA_RATE_CONTROL))
                return;
 
+       if (st->info->band >= NUM_NL80211_BANDS)
+               return;
+
        sband = local->hw.wiphy->bands[st->info->band];
 
        spin_lock_bh(&sta->rate_ctrl_lock);
@@ -419,6 +422,9 @@ static bool rate_control_send_low(struct ieee80211_sta *pubsta,
        int mcast_rate;
        bool use_basicrate = false;
 
+       if (!sband)
+               return false;
+
        if (!pubsta || rc_no_data_or_no_ack_use_min(txrc)) {
                __rate_control_send_low(txrc->hw, sband, pubsta, info,
                                        txrc->rate_idx_mask);
@@ -898,6 +904,9 @@ void ieee80211_get_tx_rates(struct ieee80211_vif *vif,
                return;
 
        sdata = vif_to_sdata(vif);
+       if (info->band >= NUM_NL80211_BANDS)
+               return;
+
        sband = sdata->local->hw.wiphy->bands[info->band];
 
        if (ieee80211_is_tx_data(skb))
index a27e2af5d569f5b4064832f81e1ed0549dd92a3c..ba51198be94a8f5aec9a8b341afd104c5c69297d 100644 (file)
@@ -59,6 +59,9 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
        if (WARN_ON_ONCE(tx->rate.idx < 0))
                return 0;
 
+       if (info->band >= NUM_NL80211_BANDS)
+               return 0;
+
        sband = local->hw.wiphy->bands[info->band];
        txrate = &sband->bitrates[tx->rate.idx];
 
@@ -683,7 +686,10 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
 
        memset(&txrc, 0, sizeof(txrc));
 
-       sband = tx->local->hw.wiphy->bands[info->band];
+       if (info->band < NUM_NL80211_BANDS)
+               sband = tx->local->hw.wiphy->bands[info->band];
+       else
+               return TX_CONTINUE;
 
        len = min_t(u32, tx->skb->len + FCS_LEN,
                         tx->local->hw.wiphy->frag_threshold);
@@ -6288,7 +6294,9 @@ void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata,
        enum nl80211_band band;
 
        rcu_read_lock();
-       if (!ieee80211_vif_is_mld(&sdata->vif)) {
+       if (sdata->vif.type == NL80211_IFTYPE_NAN) {
+               band = NUM_NL80211_BANDS;
+       } else if (!ieee80211_vif_is_mld(&sdata->vif)) {
                WARN_ON(link_id >= 0);
                chanctx_conf =
                        rcu_dereference(sdata->vif.bss_conf.chanctx_conf);