diff mbox

[RFC,7/7] mac80211: implement nan_change_conf

Message ID 1442500351-8780-8-git-send-email-andrei.otcheretianski@intel.com (mailing list archive)
State RFC
Delegated to: Johannes Berg
Headers show

Commit Message

Andrei Otcheretianski Sept. 17, 2015, 2:32 p.m. UTC
From: Andrei Otcheretianski <andrei.otcheretianski@intel.com>

Add a trivial implementation for nan_change_conf by simply passing
everything directly to the driver.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
---
 net/mac80211/cfg.c        | 18 ++++++++++++++++++
 net/mac80211/driver-ops.h | 21 +++++++++++++++++++++
 net/mac80211/trace.h      | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 71 insertions(+)
diff mbox

Patch

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 8a504ae..d2726f1 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -191,6 +191,23 @@  static void ieee80211_rm_nan_func(struct wiphy *wiphy,
 	drv_rm_nan_func(sdata->local, sdata, instance_id);
 }
 
+static int ieee80211_nan_change_conf(struct wiphy *wiphy,
+				     struct wireless_dev *wdev,
+				     struct cfg80211_nan_conf *conf,
+				     u32 changes)
+{
+	struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
+
+	if (sdata->vif.type != NL80211_IFTYPE_NAN)
+		return -EOPNOTSUPP;
+
+	if (!ieee80211_sdata_running(sdata))
+		return -ENETDOWN;
+
+	return drv_nan_change_conf(sdata->local, sdata, conf, changes);
+}
+
+
 static int ieee80211_set_noack_map(struct wiphy *wiphy,
 				  struct net_device *dev,
 				  u16 noack_map)
@@ -3972,4 +3989,5 @@  const struct cfg80211_ops mac80211_config_ops = {
 	.stop_nan = ieee80211_stop_nan,
 	.add_nan_func = ieee80211_add_nan_func,
 	.rm_nan_func = ieee80211_rm_nan_func,
+	.nan_change_conf = ieee80211_nan_change_conf,
 };
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 0d6c622..8d5349c 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1430,4 +1430,25 @@  static inline void drv_rm_nan_func(struct ieee80211_local *local,
 		local->ops->rm_nan_func(&local->hw, &sdata->vif, instance_id);
 	trace_drv_return_void(local);
 }
+
+static inline int drv_nan_change_conf(struct ieee80211_local *local,
+				       struct ieee80211_sub_if_data *sdata,
+				       struct cfg80211_nan_conf *conf,
+				       u32 changes)
+{
+	int ret;
+
+	might_sleep();
+	check_sdata_in_driver(sdata);
+
+	if (!local->ops->add_nan_func)
+		return -EOPNOTSUPP;
+
+	trace_drv_nan_change_conf(local, sdata, conf, changes);
+	ret = local->ops->nan_change_conf(&local->hw, &sdata->vif, conf, changes);
+	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 ca79e83..7871d99 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -1791,6 +1791,38 @@  TRACE_EVENT(drv_rm_nan_func,
 	)
 );
 
+TRACE_EVENT(drv_nan_change_conf,
+	TP_PROTO(struct ieee80211_local *local,
+		 struct ieee80211_sub_if_data *sdata,
+		 struct cfg80211_nan_conf *conf,
+		 u32 changes),
+
+	TP_ARGS(local, sdata, conf, changes),
+	TP_STRUCT__entry(
+		LOCAL_ENTRY
+		VIF_ENTRY
+		__field(u8, master_pref)
+		__field(u16, cluster_id)
+		__field(u8, dual)
+		__field(u32, changes)
+	),
+
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		VIF_ASSIGN;
+		__entry->master_pref = conf->master_pref;
+		__entry->cluster_id = conf->cluster_id;
+		__entry->dual = conf->dual;
+		__entry->changes = changes;
+	),
+
+	TP_printk(
+		LOCAL_PR_FMT  VIF_PR_FMT
+		", master preference: %u, cluster_id: %04x, dual: %d, changes: 0x%x",
+		LOCAL_PR_ARG, VIF_PR_ARG, __entry->master_pref,
+		 __entry->cluster_id, __entry->dual, __entry->changes
+	)
+);
 
 /*
  * Tracing for API calls that drivers call.