linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Golle <dgolle@allnet.de>
To: <linux-wireless@vger.kernel.org>
Cc: Daniel Golle <dgolle@allnet.de>,
	"Luis R. Rodriguez" <lrodriguez@atheros.com>,
	Johannes Berg <johannes.berg@intel.com>,
	Felix Fietkau <nbd@openwrt.org>
Subject: [PATCH v1 2/3] support for antenna configuration profiles
Date: Mon, 28 Nov 2011 17:13:25 +0100	[thread overview]
Message-ID: <20111128161325.GA25474@localhost> (raw)

[-- Attachment #1: Type: text/plain, Size: 4547 bytes --]

This adds {get,set}_extant operations to mac80211

Signed-off-by: Daniel Golle <dgolle@allnet.de>
---
 include/net/mac80211.h      |    3 ++
 net/mac80211/cfg.c          |   19 +++++++++++++++++
 net/mac80211/driver-ops.h   |   20 ++++++++++++++++++
 net/mac80211/driver-trace.h |   46 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 88 insertions(+), 0 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 5b5c8a7..fe905ab 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2212,6 +2212,9 @@ struct ieee80211_ops {
 	int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant);
 	int (*get_antenna)(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant);
 
+	int (*set_extant)(struct ieee80211_hw *hw, u32 extant);
+	int (*get_extant)(struct ieee80211_hw *hw, u32 *extant);
+
 	int (*remain_on_channel)(struct ieee80211_hw *hw,
 				 struct ieee80211_channel *chan,
 				 enum nl80211_channel_type channel_type,
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 2577c45..58fc272 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2208,6 +2208,23 @@ static int ieee80211_get_antenna(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant)
 	return drv_get_antenna(local, tx_ant, rx_ant);
 }
 
+static int ieee80211_set_extant(struct wiphy *wiphy, u32 extant)
+{
+	struct ieee80211_local *local = wiphy_priv(wiphy);
+
+	if (local->started)
+		return -EOPNOTSUPP;
+
+	return drv_set_extant(local, extant);
+}
+
+static int ieee80211_get_extant(struct wiphy *wiphy, u32 *extant)
+{
+	struct ieee80211_local *local = wiphy_priv(wiphy);
+
+	return drv_get_extant(local, extant);
+}
+
 static int ieee80211_set_ringparam(struct wiphy *wiphy, u32 tx, u32 rx)
 {
 	struct ieee80211_local *local = wiphy_priv(wiphy);
@@ -2691,6 +2708,8 @@ struct cfg80211_ops mac80211_config_ops = {
 	.mgmt_frame_register = ieee80211_mgmt_frame_register,
 	.set_antenna = ieee80211_set_antenna,
 	.get_antenna = ieee80211_get_antenna,
+	.set_extant = ieee80211_set_extant,
+	.get_extant = ieee80211_get_extant,
 	.set_ringparam = ieee80211_set_ringparam,
 	.get_ringparam = ieee80211_get_ringparam,
 	.set_rekey_data = ieee80211_set_rekey_data,
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 49cc5e0..bd09553 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -626,6 +626,26 @@ static inline int drv_get_antenna(struct ieee80211_local *local,
 	return ret;
 }
 
+static inline int drv_set_extant(struct ieee80211_local *local, u32 extant)
+{
+	int ret = -EOPNOTSUPP;
+	might_sleep();
+	if (local->ops->set_extant)
+		ret = local->ops->set_extant(&local->hw, extant);
+	trace_drv_set_extant(local, extant, ret);
+	return ret;
+}
+
+static inline int drv_get_extant(struct ieee80211_local *local, u32 *extant)
+{
+	int ret = -EOPNOTSUPP;
+	might_sleep();
+	if (local->ops->get_extant)
+		ret = local->ops->get_extant(&local->hw, extant);
+	trace_drv_get_extant(local, *extant, ret);
+	return ret;
+}
+
 static inline int drv_remain_on_channel(struct ieee80211_local *local,
 					struct ieee80211_channel *chan,
 					enum nl80211_channel_type chantype,
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h
index 2af4fca..8593dba 100644
--- a/net/mac80211/driver-trace.h
+++ b/net/mac80211/driver-trace.h
@@ -931,6 +931,52 @@ TRACE_EVENT(drv_get_antenna,
 	)
 );
 
+TRACE_EVENT(drv_set_extant,
+	TP_PROTO(struct ieee80211_local *local, u32 extant, int ret),
+
+	TP_ARGS(local, extant, ret),
+
+	TP_STRUCT__entry(
+		LOCAL_ENTRY
+		__field(u32, extant)
+		__field(int, ret)
+	),
+
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		__entry->extant = extant;
+		__entry->ret = ret;
+	),
+
+	TP_printk(
+		LOCAL_PR_FMT " extant:%d ret:%d",
+		LOCAL_PR_ARG, __entry->extant, __entry->ret
+	)
+);
+
+TRACE_EVENT(drv_get_extant,
+	TP_PROTO(struct ieee80211_local *local, u32 extant, int ret),
+
+	TP_ARGS(local, ext, ret),
+
+	TP_STRUCT__entry(
+		LOCAL_ENTRY
+		__field(u32, extant)
+		__field(int, ret)
+	),
+
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		__entry->extant = extant;
+		__entry->ret = ret;
+	),
+
+	TP_printk(
+		LOCAL_PR_FMT " extant:%d ret:%d",
+		LOCAL_PR_ARG, __entry->extant, __entry->ret
+	)
+);
+
 TRACE_EVENT(drv_remain_on_channel,
 	TP_PROTO(struct ieee80211_local *local, struct ieee80211_channel *chan,
 		 enum nl80211_channel_type chantype, unsigned int duration),
-- 
1.7.4.1


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

                 reply	other threads:[~2011-11-28 16:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20111128161325.GA25474@localhost \
    --to=dgolle@allnet.de \
    --cc=johannes.berg@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lrodriguez@atheros.com \
    --cc=nbd@openwrt.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).