From patchwork Thu Sep 17 14:32:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 7208031 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A1B569F380 for ; Thu, 17 Sep 2015 14:34:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B05CE207B1 for ; Thu, 17 Sep 2015 14:34:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 13E51207A4 for ; Thu, 17 Sep 2015 14:33:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751753AbbIQOds (ORCPT ); Thu, 17 Sep 2015 10:33:48 -0400 Received: from mga01.intel.com ([192.55.52.88]:6821 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751471AbbIQOdm (ORCPT ); Thu, 17 Sep 2015 10:33:42 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 17 Sep 2015 07:33:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,547,1437462000"; d="scan'208";a="791759286" Received: from aotchere-mobl1.ger.corp.intel.com ([10.12.85.62]) by fmsmga001.fm.intel.com with ESMTP; 17 Sep 2015 07:33:41 -0700 From: andrei.otcheretianski@intel.com To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, emmanuel.grumbach@intel.com, Andrei Otcheretianski Subject: [RFC 7/7] mac80211: implement nan_change_conf Date: Thu, 17 Sep 2015 17:32:31 +0300 Message-Id: <1442500351-8780-8-git-send-email-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.5.2.windows.2 In-Reply-To: <1442500351-8780-1-git-send-email-andrei.otcheretianski@intel.com> References: <1442500351-8780-1-git-send-email-andrei.otcheretianski@intel.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Andrei Otcheretianski Add a trivial implementation for nan_change_conf by simply passing everything directly to the driver. Signed-off-by: Andrei Otcheretianski --- net/mac80211/cfg.c | 18 ++++++++++++++++++ net/mac80211/driver-ops.h | 21 +++++++++++++++++++++ net/mac80211/trace.h | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+) 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.