linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Cc: johannes@sipsolutions.net
Subject: [PATCH v4 13/14] mac80211: notify the driver when a sta uses 4-address mode
Date: Tue,  8 Sep 2020 14:37:01 +0200	[thread overview]
Message-ID: <20200908123702.88454-14-nbd@nbd.name> (raw)
In-Reply-To: <20200908123702.88454-1-nbd@nbd.name>

This is needed for encapsulation offload of 4-address mode packets

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 include/net/mac80211.h    |  4 ++++
 net/mac80211/cfg.c        |  1 +
 net/mac80211/driver-ops.h | 14 ++++++++++++++
 net/mac80211/mlme.c       |  3 +++
 net/mac80211/trace.h      | 27 +++++++++++++++++++++++++++
 5 files changed, 49 insertions(+)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 1d1290aca870..05c8049ddd5e 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3843,6 +3843,8 @@ enum ieee80211_reconfig_type {
  *	This callback may sleep.
  * @update_vif_config: Update virtual interface offload flags
  *	This callback may sleep.
+ * @sta_set_4addr: Called to notify the driver when a station starts/stops using
+ *	4-address mode
  */
 struct ieee80211_ops {
 	void (*tx)(struct ieee80211_hw *hw,
@@ -4156,6 +4158,8 @@ struct ieee80211_ops {
 				struct ieee80211_sta *sta, u8 tids);
 	void (*update_vif_offload)(struct ieee80211_hw *hw,
 				   struct ieee80211_vif *vif);
+	void (*sta_set_4addr)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+			      struct ieee80211_sta *sta, bool enabled);
 };
 
 /**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index b4e39e31a985..022caf1c492b 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1696,6 +1696,7 @@ static int ieee80211_change_station(struct wiphy *wiphy,
 
 			rcu_assign_pointer(vlansdata->u.vlan.sta, sta);
 			__ieee80211_check_fast_rx_iface(vlansdata);
+			drv_sta_set_4addr(local, sta->sdata, &sta->sta, true);
 		}
 
 		if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN &&
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index e3dfb9307fae..bcdfd19a596b 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1399,4 +1399,18 @@ static inline void drv_update_vif_offload(struct ieee80211_local *local,
 	trace_drv_return_void(local);
 }
 
+static inline void drv_sta_set_4addr(struct ieee80211_local *local,
+				     struct ieee80211_sub_if_data *sdata,
+				     struct ieee80211_sta *sta, bool enabled)
+{
+	sdata = get_bss_sdata(sdata);
+	if (!check_sdata_in_driver(sdata))
+		return;
+
+	trace_drv_sta_set_4addr(local, sdata, sta, enabled);
+	if (local->ops->sta_set_4addr)
+		local->ops->sta_set_4addr(&local->hw, &sdata->vif, sta, enabled);
+	trace_drv_return_void(local);
+}
+
 #endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index f241decf843d..50a9b9025725 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -3523,6 +3523,9 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
 		goto out;
 	}
 
+	if (sdata->wdev.use_4addr)
+		drv_sta_set_4addr(local, sdata, &sta->sta, true);
+
 	mutex_unlock(&sdata->local->sta_mtx);
 
 	/*
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index 50a0a83e96fc..89723907a094 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -2740,6 +2740,33 @@ DEFINE_EVENT(local_sdata_addr_evt, drv_update_vif_offload,
 	TP_ARGS(local, sdata)
 );
 
+TRACE_EVENT(drv_sta_set_4addr,
+	TP_PROTO(struct ieee80211_local *local,
+		 struct ieee80211_sub_if_data *sdata,
+		 struct ieee80211_sta *sta, bool enabled),
+
+	TP_ARGS(local, sdata, sta, enabled),
+
+	TP_STRUCT__entry(
+		LOCAL_ENTRY
+		VIF_ENTRY
+		STA_ENTRY
+		__field(bool, enabled)
+	),
+
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		VIF_ASSIGN;
+		STA_ASSIGN;
+		__entry->enabled = enabled;
+	),
+
+	TP_printk(
+		LOCAL_PR_FMT  VIF_PR_FMT  STA_PR_FMT " enabled:%d",
+		LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->enabled
+	)
+);
+
 #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
 
 #undef TRACE_INCLUDE_PATH
-- 
2.28.0


  parent reply	other threads:[~2020-09-08 16:41 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-08 12:36 [PATCH v4 00/14] mac80211 encapsulation offload / performance patches Felix Fietkau
2020-09-08 12:36 ` [PATCH v4 01/14] mac80211: add missing queue/hash initialization to 802.3 xmit Felix Fietkau
2020-09-08 12:36 ` [PATCH v4 02/14] mac80211: check and refresh aggregation session in encap offload tx Felix Fietkau
2020-09-18  9:58   ` Johannes Berg
2020-09-08 12:36 ` [PATCH v4 03/14] mac80211: skip encap offload for tx multicast/control packets Felix Fietkau
2020-09-18  9:59   ` Johannes Berg
2020-09-08 12:36 ` [PATCH v4 04/14] mac80211: set info->control.hw_key for encap offload packets Felix Fietkau
2020-09-08 12:36 ` [PATCH v4 05/14] mac80211: rework tx encapsulation offload API Felix Fietkau
2020-09-18 10:10   ` Johannes Berg
2020-09-08 12:36 ` [PATCH v4 06/14] mac80211: reduce duplication in tx status functions Felix Fietkau
2020-09-08 12:36 ` [PATCH v4 07/14] mac80211: remove tx status call to ieee80211_sta_register_airtime Felix Fietkau
2020-09-18 10:11   ` Johannes Berg
2020-09-08 12:36 ` [PATCH v4 08/14] mac80211: optimize station connection monitor Felix Fietkau
2020-09-08 12:36 ` [PATCH v4 09/14] mac80211: swap NEED_TXPROCESSING and HW_80211_ENCAP tx flags Felix Fietkau
2020-09-08 12:36 ` [PATCH v4 10/14] mac80211: unify 802.3 (offload) and 802.11 tx status codepath Felix Fietkau
2020-09-08 12:36 ` [PATCH v4 11/14] mac80211: support using ieee80211_tx_status_ext to free skbs without status info Felix Fietkau
2020-09-18 10:31   ` Johannes Berg
2020-09-08 12:37 ` [PATCH v4 12/14] mac80211: extend ieee80211_tx_status_ext to support bulk free Felix Fietkau
2020-09-08 12:37 ` Felix Fietkau [this message]
2020-09-08 12:37 ` [PATCH v4 14/14] mac80211: reorganize code to remove a forward declaration Felix Fietkau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200908123702.88454-14-nbd@nbd.name \
    --to=nbd@nbd.name \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).