Commit fc41f4a2 authored by Ilan Peer's avatar Ilan Peer Committed by Johannes Berg
Browse files

wifi: mac80211: Support Tx of action frame for NAN



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: default avatarIlan Peer <ilan.peer@intel.com>
Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250908140015.23b160089228.I65a58af753bcbcfb5c4ad8ef372d546f889725ba@changeid


Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 1884e259
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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];
}

+5 −0
Original line number Diff line number Diff line
@@ -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 = {
+4 −1
Original line number Diff line number Diff line
@@ -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;
+10 −1
Original line number Diff line number Diff line
@@ -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))
+10 −2
Original line number Diff line number Diff line
@@ -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));

	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);