linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tamizh chelvam <tamizhr@codeaurora.org>
To: ath10k@lists.infradead.org, johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org, Tamizh chelvam <tamizhr@codeaurora.org>
Subject: [PATCH 3/4] mac80211: Add api to support configuring TID specific configuration
Date: Mon, 22 Oct 2018 23:25:17 +0530	[thread overview]
Message-ID: <1540230918-27712-4-git-send-email-tamizhr@codeaurora.org> (raw)
In-Reply-To: <1540230918-27712-1-git-send-email-tamizhr@codeaurora.org>

Implement drv_set_tid_conf api to allow TID specific
retry count for data frames and aggregation enable/disable
configuration. If the retry_short and/or
retry_long value is default (-1), use the nedev wide retry
configuration for the station. This per-TID configuration
will be applied for all the connected stations when MAC is NULL.
enum ieee80211_tid_conf_change introduced to notify the the driver
about which configuration parameter got changed in
ieee80211_tid_conf structure.

Signed-off-by: Tamizh chelvam <tamizhr@codeaurora.org>
---
 include/net/mac80211.h    |   40 +++++++++++++++++++++++++
 net/mac80211/cfg.c        |   71 +++++++++++++++++++++++++++++++++++++++++++++
 net/mac80211/driver-ops.h |   16 ++++++++++
 net/mac80211/trace.h      |   34 ++++++++++++++++++++++
 4 files changed, 161 insertions(+)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index b6cc3e33..7fa7e25 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1478,6 +1478,35 @@ struct ieee80211_channel_switch {
 	u8 count;
 };
 
+/*
+ * enum ieee80211_tid_conf_change - TID change configuration notification flags
+ *
+ * These flags are used with the set_tid_conf() callback
+ * to indicate which TID configuration parameter changed.
+ *
+ * @TID_RETRY_CONF_CHANGED: retry configuration changed.
+ * @TID_AGGR_CONF_CHANGED: Aggregation config changed for the TID.
+ */
+enum ieee80211_tid_conf_change {
+	TID_RETRY_CONF_CHANGED		= BIT(0),
+	TID_AGGR_CONF_CHANGED		= BIT(1),
+};
+
+/*
+ * struct ieee80211_tid_conf - holds the tid configiuration data
+ * The information provided in the structure is required for the driver
+ * to configure TID specific configuration.
+ * @tid: TID number
+ * @retry_short: retry count value
+ * @retry_long: retry count value
+ * @aggr: enable/disable aggregation
+ */
+struct ieee80211_tid_conf {
+	u8 tid;
+	int retry_short;
+	int retry_long;
+	bool aggr;
+};
 /**
  * enum ieee80211_vif_flags - virtual interface flags
  *
@@ -1565,6 +1594,8 @@ struct ieee80211_vif {
 
 	bool txqs_stopped[IEEE80211_NUM_ACS];
 
+	struct ieee80211_tid_conf tid_conf;
+
 	/* must be last */
 	u8 drv_priv[0] __aligned(sizeof(void *));
 };
@@ -3632,6 +3663,10 @@ enum ieee80211_reconfig_type {
  *	level. Drivers mplementing this callback must take care of setting NoAck
  *	policy in QOS control field based on the configured TID bitmap.
  *	This callback may sleep.
+ * @set_tid_conf: TID specific configuration like number of retries for
+ *	the given TID. Apply this configuration for a particular station when
+ *	@sta is non-NULL. When @sta is NULL, the configuration will be for all
+ *	the connected clients in the vif. This callback may sleep.
  */
 struct ieee80211_ops {
 	void (*tx)(struct ieee80211_hw *hw,
@@ -3924,6 +3959,11 @@ struct ieee80211_ops {
 	int (*set_noack_tid_bitmap)(struct ieee80211_hw *hw,
 				    struct ieee80211_vif *vif,
 				    struct ieee80211_sta *sta, int noack_map);
+	int (*set_tid_conf)(struct ieee80211_hw *hw,
+			    struct ieee80211_vif *vif,
+			    struct ieee80211_sta *sta,
+			    struct ieee80211_tid_conf *tid_conf,
+			    u8 changed);
 };
 
 /**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 02e6d49..786b561 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3889,6 +3889,75 @@ static int ieee80211_get_txq_stats(struct wiphy *wiphy,
 	return drv_get_ftm_responder_stats(local, sdata, ftm_stats);
 }
 
+static int ieee80211_set_data_retry_count(struct wiphy *wiphy,
+					  struct net_device *dev,
+					  const u8 *peer, u8 tid,
+					  int retry_short, int retry_long)
+{
+	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+	struct sta_info *sta;
+	int ret;
+
+	if (!sdata->local->ops->set_tid_conf)
+		return -EOPNOTSUPP;
+
+	sdata->vif.tid_conf.tid = tid;
+	sdata->vif.tid_conf.retry_short = retry_short;
+	sdata->vif.tid_conf.retry_long = retry_long;
+
+	if (!peer)
+		return drv_set_tid_conf(sdata->local, sdata, NULL,
+					TID_RETRY_CONF_CHANGED);
+
+	mutex_lock(&sdata->local->sta_mtx);
+
+	sta = sta_info_get_bss(sdata, peer);
+	if (!sta) {
+		mutex_unlock(&sdata->local->sta_mtx);
+		return -ENOENT;
+	}
+
+	ret = drv_set_tid_conf(sdata->local, sdata, &sta->sta,
+			       TID_RETRY_CONF_CHANGED);
+
+	mutex_unlock(&sdata->local->sta_mtx);
+	return ret;
+}
+
+static int ieee80211_set_tid_aggr_config(struct wiphy *wiphy,
+					 struct net_device *dev,
+					 const u8 *peer, u8 tid,
+					 bool aggr)
+{
+	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+	struct sta_info *sta;
+	int ret;
+
+	if (!sdata->local->ops->set_tid_conf)
+		return -EOPNOTSUPP;
+
+	sdata->vif.tid_conf.tid = tid;
+	sdata->vif.tid_conf.aggr = aggr;
+
+	if (!peer)
+		return drv_set_tid_conf(sdata->local, sdata, NULL,
+					TID_AGGR_CONF_CHANGED);
+
+	mutex_lock(&sdata->local->sta_mtx);
+
+	sta = sta_info_get_bss(sdata, peer);
+	if (!sta) {
+		mutex_unlock(&sdata->local->sta_mtx);
+		return -ENOENT;
+	}
+
+	ret = drv_set_tid_conf(sdata->local, sdata, &sta->sta,
+			       TID_AGGR_CONF_CHANGED);
+
+	mutex_unlock(&sdata->local->sta_mtx);
+	return ret;
+}
+
 const struct cfg80211_ops mac80211_config_ops = {
 	.add_virtual_intf = ieee80211_add_iface,
 	.del_virtual_intf = ieee80211_del_iface,
@@ -3984,4 +4053,6 @@ static int ieee80211_get_txq_stats(struct wiphy *wiphy,
 	.tx_control_port = ieee80211_tx_control_port,
 	.get_txq_stats = ieee80211_get_txq_stats,
 	.get_ftm_responder_stats = ieee80211_get_ftm_responder_stats,
+	.set_data_retry_count = ieee80211_set_data_retry_count,
+	.set_tid_aggr_config = ieee80211_set_tid_aggr_config,
 };
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index ed9bd59..e717cc0 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1300,4 +1300,20 @@ static inline int drv_set_noack_tid_bitmap(struct ieee80211_local *local,
 	return ret;
 }
 
+static inline int drv_set_tid_conf(struct ieee80211_local *local,
+				   struct ieee80211_sub_if_data *sdata,
+				   struct ieee80211_sta *sta,
+				   u8 changed)
+{
+	int ret;
+
+	might_sleep();
+	trace_drv_set_tid_conf(local, sdata, sta, changed);
+	ret = local->ops->set_tid_conf(&local->hw, &sdata->vif, sta,
+				       &sdata->vif.tid_conf, changed);
+	trace_drv_return_int(local, ret);
+
+	return ret;
+}
+
 #endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index e0e6c9a..5aed6ad 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -2648,6 +2648,40 @@ struct trace_switch_entry {
 	)
 );
 
+TRACE_EVENT(drv_set_tid_conf,
+	TP_PROTO(struct ieee80211_local *local,
+		 struct ieee80211_sub_if_data *sdata,
+		 struct ieee80211_sta *sta,
+		 u8 changed),
+
+	TP_ARGS(local, sdata, sta, changed),
+
+	TP_STRUCT__entry(
+		LOCAL_ENTRY
+		VIF_ENTRY
+		STA_ENTRY
+		__field(u8, tid)
+		__field(int, retry_short)
+		__field(int, retry_long)
+		__field(u8, changed)
+	),
+
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		VIF_ASSIGN;
+		STA_ASSIGN;
+		__entry->tid = sdata->vif.tid_conf.tid;
+		__entry->retry_short = sdata->vif.tid_conf.retry_short;
+		__entry->retry_long = sdata->vif.tid_conf.retry_long;
+		__entry->changed = changed;
+	),
+
+	TP_printk(
+		LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " changed: %#x",
+		LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->changed
+	)
+);
+
 #endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
 
 #undef TRACE_INCLUDE_PATH
-- 
1.7.9.5


  parent reply	other threads:[~2018-10-22 17:56 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-22 17:55 [PATCH 0/4] cfg80211/mac80211: Add support for TID specific configuration Tamizh chelvam
2018-10-22 17:55 ` [PATCH 1/4] New netlink command " Tamizh chelvam
2018-11-06 10:16   ` Sergey Matyukevich
2018-11-08 17:29     ` Tamizh chelvam
2018-11-09  9:47       ` Sergey Matyukevich
2018-11-06 11:31   ` Johannes Berg
2018-11-07 14:05   ` Sergey Matyukevich
2018-11-08 17:47     ` Tamizh chelvam
2018-11-09  9:40       ` Sergey Matyukevich
2018-11-09 12:24         ` Johannes Berg
2018-11-13  6:46           ` Tamizh chelvam
2018-11-09 11:37   ` Johannes Berg
2018-10-22 17:55 ` [PATCH 2/4] nl80211: Add netlink attribute for AMPDU aggregation enable/disable Tamizh chelvam
2018-11-06 10:21   ` Sergey Matyukevich
2018-11-08 12:28     ` Tamizh chelvam
2018-10-22 17:55 ` Tamizh chelvam [this message]
2018-11-06 10:33   ` [PATCH 3/4] mac80211: Add api to support configuring TID specific configuration Sergey Matyukevich
2018-11-08 12:42     ` Tamizh chelvam
2018-11-07 23:55   ` Igor Mitsyanko
2018-10-22 17:55 ` [PATCH 4/4] ath10k: Add support to configure " Tamizh chelvam
2018-11-09  9:26   ` Sergey Matyukevich
2018-11-05 20:43 ` [PATCH 0/4] cfg80211/mac80211: Add support for " Johannes Berg
2018-11-06 10:45   ` Sergey Matyukevich
2018-11-06 11:28     ` Johannes Berg
2018-11-06 12:17       ` Sergey Matyukevich
2018-11-08  0:55 ` Igor Mitsyanko
2018-11-08 16:31   ` Ben Greear
2019-02-13 19:01 ` Sergey Matyukevich
     [not found]   ` <a7d97b692da245a8b85769d7766ceba7@aphydexm01f.ap.qualcomm.com>
2019-02-14  7:14     ` Tamizh chelvam

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=1540230918-27712-4-git-send-email-tamizhr@codeaurora.org \
    --to=tamizhr@codeaurora.org \
    --cc=ath10k@lists.infradead.org \
    --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).