RE: [PATCH v2 3/9] cfg80211: add add_nan_func / rm_nan_func
> -Original Message- > From: Arend Van Spriel [mailto:arend.vanspr...@broadcom.com] > Sent: Sunday, September 18, 2016 22:54 > To: Luca Coelho <l...@coelho.fi>; johan...@sipsolutions.net > Cc: linux-wireless@vger.kernel.org; Beker, Ayala <ayala.be...@intel.com>; > Otcheretianski, Andrei <andrei.otcheretian...@intel.com>; Grumbach, > Emmanuel <emmanuel.grumb...@intel.com>; Coelho, Luciano > <luciano.coe...@intel.com> > Subject: Re: [PATCH v2 3/9] cfg80211: add add_nan_func / rm_nan_func > > On 16-9-2016 10:33, Luca Coelho wrote: > > From: Ayala Beker <ayala.be...@intel.com> > > > > A NAN function can be either publish, subscribe or follow up. Make all > > the necessary verifications and just pass the request to the driver. > > Allow the user space application that starts NAN to forbid any other > > socket to add or remove functions. > > > > Signed-off-by: Andrei Otcheretianski <andrei.otcheretian...@intel.com> > > Signed-off-by: Emmanuel Grumbach <emmanuel.grumb...@intel.com> > > Signed-off-by: Ayala Beker <ayala.be...@intel.com> > > Signed-off-by: Luca Coelho <luciano.coe...@intel.com> > > --- > > [...] > > > diff --git a/include/uapi/linux/nl80211.h > > b/include/uapi/linux/nl80211.h index 7ab18c8..ab16c8e 100644 > > --- a/include/uapi/linux/nl80211.h > > +++ b/include/uapi/linux/nl80211.h > > @@ -847,6 +847,24 @@ > > * After this command NAN functions can be added. > > * @NL80211_CMD_STOP_NAN: Stop the NAN operation, identified by > > * its %NL80211_ATTR_WDEV interface. > > + * @NL80211_CMD_ADD_NAN_FUNCTION: Add a NAN function. The > function is defined > > + * with %NL80211_ATTR_NAN_FUNC nested attribute. When called, > this > > + * operation returns the strictly positive and unique instance id > > + * (%NL80211_ATTR_NAN_FUNC_INST_ID) and a cookie > (%NL80211_ATTR_COOKIE) > > + * of the function upon success. > > + * Since instance ID's can be re-used, this cookie is the right > > + * way to identify the function. This will avoid races when a termination > > + * event is handled by the user space after it has already added a new > > + * function that got the same instance id from the kernel as the one > > + * which just terminated. > > + * This cookie may be used in NAN events even before the command > > + * returns, so userspace shouldn't process NAN events until it > processes > > + * the response to this command. > > + * Look at %NL80211_ATTR_SOCKET_OWNER as well. > > + * @NL80211_CMD_RM_NAN_FUNCTION: Remove a NAN function by > cookie. > > + * This command is also used as a notification sent when a NAN function > is > > + * terminated. This will contain a %NL80211_ATTR_NAN_FUNC_INST_ID > > + * and %NL80211_ATTR_COOKIE attributes. > > This patch does not show the notification scenario as it is added in patch 6. > So > those three lines could be added by that patch instead to keep things > logically together. > Good point. Thanks > Regards, > Arend
RE: [PATCH v2 3/9] cfg80211: add add_nan_func / rm_nan_func
> -Original Message- > From: Arend Van Spriel [mailto:arend.vanspr...@broadcom.com] > Sent: Sunday, September 18, 2016 22:29 > To: Luca Coelho <l...@coelho.fi>; johan...@sipsolutions.net > Cc: linux-wireless@vger.kernel.org; Beker, Ayala <ayala.be...@intel.com>; > Otcheretianski, Andrei <andrei.otcheretian...@intel.com>; Grumbach, > Emmanuel <emmanuel.grumb...@intel.com>; Coelho, Luciano > <luciano.coe...@intel.com> > Subject: Re: [PATCH v2 3/9] cfg80211: add add_nan_func / rm_nan_func > > On 16-9-2016 10:33, Luca Coelho wrote: > > From: Ayala Beker <ayala.be...@intel.com> > > > > A NAN function can be either publish, subscribe or follow up. Make all > > the necessary verifications and just pass the request to the driver. > > Allow the user space application that starts NAN to forbid any other > > socket to add or remove functions. > > > > Signed-off-by: Andrei Otcheretianski <andrei.otcheretian...@intel.com> > > Signed-off-by: Emmanuel Grumbach <emmanuel.grumb...@intel.com> > > Signed-off-by: Ayala Beker <ayala.be...@intel.com> > > Signed-off-by: Luca Coelho <luciano.coe...@intel.com> > > --- > > include/net/cfg80211.h | 91 +++ > > include/uapi/linux/nl80211.h | 153 ++ > > net/wireless/core.c | 3 +- > > net/wireless/nl80211.c | 368 > +++ > > net/wireless/rdev-ops.h | 21 +++ > > net/wireless/trace.h | 39 + > > net/wireless/util.c | 22 +++ > > 7 files changed, 696 insertions(+), 1 deletion(-) > > > > diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index > > ca64d69..ced5b8a 100644 > > --- a/include/net/cfg80211.h > > +++ b/include/net/cfg80211.h > > @@ -2306,6 +2306,73 @@ struct cfg80211_nan_conf { }; > > > > /** > > + * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter > > + * > > + * @filter: the content of the filter > > + * @len: the length of the filter > > + */ > > +struct cfg80211_nan_func_filter { > > + const u8 *filter; > > + u8 len; > > +}; > > + > > +/** > > + * struct cfg80211_nan_func - a NAN function > > + * > > + * @type: nl80211_nan_function_type > > + * @service_id: the service ID of the function > > + * @publish_type: _nan_publish_type > > + * @close_range: if true, the range should be limited. Threshold is > > + * implementation specific. > > + * @publish_bcast: if true, the solicited publish should be > > +broadcasted > > + * @subscribe_active: if true, the subscribe is active > > + * @followup_id: the instance ID for follow up > > + * @followup_reqid: the requestor instance ID for follow up > > + * @followup_dest: MAC address of the recipient of the follow up > > + * @ttl: time to live counter in DW. > > + * @serv_spec_info: Service Specific Info > > + * @serv_spec_info_len: Service Specific Info length > > + * @srf_include: if true, SRF is inclusive > > + * @srf_bf: Bloom Filter > > + * @srf_bf_len: Bloom Filter length > > + * @srf_bf_idx: Bloom Filter index > > + * @srf_macs: SRF MAC addresses > > + * @srf_num_macs: number of MAC addresses in SRF > > + * @rx_filters: rx filters that are matched with corresponding peer's > > +tx_filter > > + * @tx_filters: filters that should be transmitted in the SDF. > > + * @num_rx_filters: length of _filters. > > + * @num_tx_filters: length of _filters. > > + * @instance_id: driver allocated id of the function. > > + * @cookie: unique NAN function identifier. > > Might be wrong but it seems a subset of the fields is used depending on the > type of NAN function. Maybe better to separate the function type specific > field in a sub structure defintion. Most of the fields are common for all the function types. Of course some combinations aren't valid. And there are few followup specific fields. The spec defines a single "NAN function" entity (for publish, subscribe and followup) which is represented in an SDA (service descriptor attribute). This is what this struct tries to reflect. > > > + */ > > +struct cfg80211_nan_func { > > + enum nl80211_nan_function_type type; > > + u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN]; > > + u8 publish_type; > > + bool close_range; > > + bool publish_bcast; > > + bool subscribe_active; > > + u8 followup_id; > > + u8 followup_reqid; > > + struct mac_address followup_dest; > > + u32 ttl; > > + const u8 *serv_spec_info; &g
Re: [PATCH v2 3/9] cfg80211: add add_nan_func / rm_nan_func
On 16-9-2016 10:33, Luca Coelho wrote: > From: Ayala Beker> > A NAN function can be either publish, subscribe or follow > up. Make all the necessary verifications and just pass the > request to the driver. > Allow the user space application that starts NAN to > forbid any other socket to add or remove functions. > > Signed-off-by: Andrei Otcheretianski > Signed-off-by: Emmanuel Grumbach > Signed-off-by: Ayala Beker > Signed-off-by: Luca Coelho > --- [...] > diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h > index 7ab18c8..ab16c8e 100644 > --- a/include/uapi/linux/nl80211.h > +++ b/include/uapi/linux/nl80211.h > @@ -847,6 +847,24 @@ > * After this command NAN functions can be added. > * @NL80211_CMD_STOP_NAN: Stop the NAN operation, identified by > * its %NL80211_ATTR_WDEV interface. > + * @NL80211_CMD_ADD_NAN_FUNCTION: Add a NAN function. The function is defined > + * with %NL80211_ATTR_NAN_FUNC nested attribute. When called, this > + * operation returns the strictly positive and unique instance id > + * (%NL80211_ATTR_NAN_FUNC_INST_ID) and a cookie (%NL80211_ATTR_COOKIE) > + * of the function upon success. > + * Since instance ID's can be re-used, this cookie is the right > + * way to identify the function. This will avoid races when a termination > + * event is handled by the user space after it has already added a new > + * function that got the same instance id from the kernel as the one > + * which just terminated. > + * This cookie may be used in NAN events even before the command > + * returns, so userspace shouldn't process NAN events until it processes > + * the response to this command. > + * Look at %NL80211_ATTR_SOCKET_OWNER as well. > + * @NL80211_CMD_RM_NAN_FUNCTION: Remove a NAN function by cookie. > + * This command is also used as a notification sent when a NAN function is > + * terminated. This will contain a %NL80211_ATTR_NAN_FUNC_INST_ID > + * and %NL80211_ATTR_COOKIE attributes. This patch does not show the notification scenario as it is added in patch 6. So those three lines could be added by that patch instead to keep things logically together. Regards, Arend
Re: [PATCH v2 3/9] cfg80211: add add_nan_func / rm_nan_func
On 16-9-2016 10:33, Luca Coelho wrote: > From: Ayala Beker> > A NAN function can be either publish, subscribe or follow > up. Make all the necessary verifications and just pass the > request to the driver. > Allow the user space application that starts NAN to > forbid any other socket to add or remove functions. > > Signed-off-by: Andrei Otcheretianski > Signed-off-by: Emmanuel Grumbach > Signed-off-by: Ayala Beker > Signed-off-by: Luca Coelho > --- > include/net/cfg80211.h | 91 +++ > include/uapi/linux/nl80211.h | 153 ++ > net/wireless/core.c | 3 +- > net/wireless/nl80211.c | 368 > +++ > net/wireless/rdev-ops.h | 21 +++ > net/wireless/trace.h | 39 + > net/wireless/util.c | 22 +++ > 7 files changed, 696 insertions(+), 1 deletion(-) > > diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h > index ca64d69..ced5b8a 100644 > --- a/include/net/cfg80211.h > +++ b/include/net/cfg80211.h > @@ -2306,6 +2306,73 @@ struct cfg80211_nan_conf { > }; > > /** > + * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter > + * > + * @filter: the content of the filter > + * @len: the length of the filter > + */ > +struct cfg80211_nan_func_filter { > + const u8 *filter; > + u8 len; > +}; > + > +/** > + * struct cfg80211_nan_func - a NAN function > + * > + * @type: nl80211_nan_function_type > + * @service_id: the service ID of the function > + * @publish_type: _nan_publish_type > + * @close_range: if true, the range should be limited. Threshold is > + * implementation specific. > + * @publish_bcast: if true, the solicited publish should be broadcasted > + * @subscribe_active: if true, the subscribe is active > + * @followup_id: the instance ID for follow up > + * @followup_reqid: the requestor instance ID for follow up > + * @followup_dest: MAC address of the recipient of the follow up > + * @ttl: time to live counter in DW. > + * @serv_spec_info: Service Specific Info > + * @serv_spec_info_len: Service Specific Info length > + * @srf_include: if true, SRF is inclusive > + * @srf_bf: Bloom Filter > + * @srf_bf_len: Bloom Filter length > + * @srf_bf_idx: Bloom Filter index > + * @srf_macs: SRF MAC addresses > + * @srf_num_macs: number of MAC addresses in SRF > + * @rx_filters: rx filters that are matched with corresponding peer's > tx_filter > + * @tx_filters: filters that should be transmitted in the SDF. > + * @num_rx_filters: length of _filters. > + * @num_tx_filters: length of _filters. > + * @instance_id: driver allocated id of the function. > + * @cookie: unique NAN function identifier. Might be wrong but it seems a subset of the fields is used depending on the type of NAN function. Maybe better to separate the function type specific field in a sub structure defintion. > + */ > +struct cfg80211_nan_func { > + enum nl80211_nan_function_type type; > + u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN]; > + u8 publish_type; > + bool close_range; > + bool publish_bcast; > + bool subscribe_active; > + u8 followup_id; > + u8 followup_reqid; > + struct mac_address followup_dest; > + u32 ttl; > + const u8 *serv_spec_info; > + u8 serv_spec_info_len; > + bool srf_include; > + const u8 *srf_bf; > + u8 srf_bf_len; > + u8 srf_bf_idx; > + struct mac_address *srf_macs; > + int srf_num_macs; > + struct cfg80211_nan_func_filter *rx_filters; > + struct cfg80211_nan_func_filter *tx_filters; > + u8 num_tx_filters; > + u8 num_rx_filters; > + u8 instance_id; > + u64 cookie; > +}; > + > +/** > * struct cfg80211_ops - backend description for wireless configuration > * > * This struct is registered by fullmac card drivers and/or wireless stacks > @@ -2595,6 +2662,14 @@ struct cfg80211_nan_conf { > * peers must be on the base channel when the call completes. > * @start_nan: Start the NAN interface. > * @stop_nan: Stop the NAN interface. > + * @add_nan_func: Add a NAN function. Returns negative value on failure. > + * On success @nan_func ownership is transferred to the driver and > + * it may access it outside of the scope of this function. The driver > + * should free the @nan_func when no longer needed by calling > + * cfg80211_free_nan_func(). > + * On success the driver should assign an instance_id in the > + * provided @nan_func. > + * @rm_nan_func: Remove a NAN function. Would prefer del_nan_func here. At least all other add_* callbacks in this structure have a del_* counter part. > */ > struct cfg80211_ops { > int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); > @@ -2863,6 +2938,10 @@ struct cfg80211_ops { > int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev, >
Re: [PATCH v2 3/9] cfg80211: add add_nan_func / rm_nan_func
Hi Ayala, [auto build test WARNING on mac80211-next/master] [also build test WARNING on next-20160916] [cannot apply to v4.8-rc6] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] [Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on] [Check https://git-scm.com/docs/git-format-patch for more information] url: https://github.com/0day-ci/linux/commits/Luca-Coelho/Add-support-for-Neighbor-Awareness-Networking/20160916-164553 base: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master config: x86_64-randconfig-v0-09161926 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All warnings (new ones prefixed by >>): In file included from include/uapi/linux/stddef.h:1:0, from include/linux/stddef.h:4, from include/uapi/linux/posix_types.h:4, from include/uapi/linux/types.h:13, from include/linux/types.h:5, from include/uapi/linux/if.h:23, from net/wireless/nl80211.c:9: net/wireless/nl80211.c: In function 'nl80211_nan_add_func': net/wireless/nl80211.c:10588:30: error: implicit declaration of function 'genl_info_snd_portid' [-Werror=implicit-function-declaration] wdev->owner_nlportid != genl_info_snd_portid(info)) ^ include/linux/compiler.h:149:30: note: in definition of macro '__trace_if' if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ^~~~ >> net/wireless/nl80211.c:10587:2: note: in expansion of macro 'if' if (wdev->owner_nlportid && ^~ net/wireless/nl80211.c:10785:6: error: implicit declaration of function 'nla_put_u64' [-Werror=implicit-function-declaration] if (nla_put_u64(msg, NL80211_ATTR_COOKIE, func->cookie)) ^ include/linux/compiler.h:149:30: note: in definition of macro '__trace_if' if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ^~~~ net/wireless/nl80211.c:10785:2: note: in expansion of macro 'if' if (nla_put_u64(msg, NL80211_ATTR_COOKIE, func->cookie)) ^~ cc1: some warnings being treated as errors vim +/if +10587 net/wireless/nl80211.c 10571 struct wireless_dev *wdev = info->user_ptr[1]; 10572 struct nlattr *tb[NUM_NL80211_NAN_FUNC_ATTR], *func_attr; 10573 struct cfg80211_nan_func *func; 10574 struct sk_buff *msg = NULL; 10575 void *hdr = NULL; 10576 int err = 0; 10577 10578 if (wdev->iftype != NL80211_IFTYPE_NAN) 10579 return -EOPNOTSUPP; 10580 10581 if (!wdev->nan_started) 10582 return -ENOTCONN; 10583 10584 if (!info->attrs[NL80211_ATTR_NAN_FUNC]) 10585 return -EINVAL; 10586 10587 if (wdev->owner_nlportid && 10588 wdev->owner_nlportid != genl_info_snd_portid(info)) 10589 return -ENOTCONN; 10590 10591 err = nla_parse(tb, NL80211_NAN_FUNC_ATTR_MAX, 10592 nla_data(info->attrs[NL80211_ATTR_NAN_FUNC]), 10593 nla_len(info->attrs[NL80211_ATTR_NAN_FUNC]), 10594 nl80211_nan_func_policy); 10595 if (err) --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
Re: [PATCH v2 3/9] cfg80211: add add_nan_func / rm_nan_func
Hi Ayala, [auto build test ERROR on mac80211-next/master] [also build test ERROR on next-20160916] [cannot apply to v4.8-rc6] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] [Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on] [Check https://git-scm.com/docs/git-format-patch for more information] url: https://github.com/0day-ci/linux/commits/Luca-Coelho/Add-support-for-Neighbor-Awareness-Networking/20160916-164553 base: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master config: x86_64-lkp (attached as .config) compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All errors (new ones prefixed by >>): net/wireless/nl80211.c: In function 'nl80211_nan_add_func': >> net/wireless/nl80211.c:10588:30: error: implicit declaration of function >> 'genl_info_snd_portid' [-Werror=implicit-function-declaration] wdev->owner_nlportid != genl_info_snd_portid(info)) ^~~~ >> net/wireless/nl80211.c:10785:6: error: implicit declaration of function >> 'nla_put_u64' [-Werror=implicit-function-declaration] if (nla_put_u64(msg, NL80211_ATTR_COOKIE, func->cookie)) ^~~ cc1: some warnings being treated as errors vim +/genl_info_snd_portid +10588 net/wireless/nl80211.c 10582 return -ENOTCONN; 10583 10584 if (!info->attrs[NL80211_ATTR_NAN_FUNC]) 10585 return -EINVAL; 10586 10587 if (wdev->owner_nlportid && 10588 wdev->owner_nlportid != genl_info_snd_portid(info)) 10589 return -ENOTCONN; 10590 10591 err = nla_parse(tb, NL80211_NAN_FUNC_ATTR_MAX, 10592 nla_data(info->attrs[NL80211_ATTR_NAN_FUNC]), 10593 nla_len(info->attrs[NL80211_ATTR_NAN_FUNC]), 10594 nl80211_nan_func_policy); 10595 if (err) 10596 return err; 10597 10598 func = kzalloc(sizeof(*func), GFP_KERNEL); 10599 if (!func) 10600 return -ENOMEM; 10601 10602 func->cookie = wdev->wiphy->cookie_counter++; 10603 10604 if (!tb[NL80211_NAN_FUNC_TYPE] || 10605 nla_get_u8(tb[NL80211_NAN_FUNC_TYPE]) > NL80211_NAN_FUNC_MAX_TYPE) { 10606 err = -EINVAL; 10607 goto out; 10608 } 10609 10610 10611 func->type = nla_get_u8(tb[NL80211_NAN_FUNC_TYPE]); 10612 10613 if (!tb[NL80211_NAN_FUNC_SERVICE_ID]) { 10614 err = -EINVAL; 10615 goto out; 10616 } 10617 10618 memcpy(func->service_id, nla_data(tb[NL80211_NAN_FUNC_SERVICE_ID]), 10619 sizeof(func->service_id)); 10620 10621 func->close_range = 10622 nla_get_flag(tb[NL80211_NAN_FUNC_CLOSE_RANGE]); 10623 10624 if (tb[NL80211_NAN_FUNC_SERVICE_INFO]) { 10625 func->serv_spec_info_len = 10626 nla_len(tb[NL80211_NAN_FUNC_SERVICE_INFO]); 10627 func->serv_spec_info = 10628 kmemdup(nla_data(tb[NL80211_NAN_FUNC_SERVICE_INFO]), 10629 func->serv_spec_info_len, 10630 GFP_KERNEL); 10631 if (!func->serv_spec_info) { 10632 err = -ENOMEM; 10633 goto out; 10634 } 10635 } 10636 10637 if (tb[NL80211_NAN_FUNC_TTL]) 10638 func->ttl = nla_get_u32(tb[NL80211_NAN_FUNC_TTL]); 10639 10640 switch (func->type) { 10641 case NL80211_NAN_FUNC_PUBLISH: 10642 if (!tb[NL80211_NAN_FUNC_PUBLISH_TYPE]) { 10643 err = -EINVAL; 10644 goto out; 10645 } 10646 10647 func->publish_type = 10648 nla_get_u8(tb[NL80211_NAN_FUNC_PUBLISH_TYPE]); 10649 func->publish_bcast = 10650 nla_get_flag(tb[NL80211_NAN_FUNC_PUBLISH_BCAST]); 10651 10652 if ((!(func->publish_type & NL80211_NAN_SOLICITED_PUBLISH)) && 10653 func->publish_bcast) { 10654 err = -EINVAL; 10655 goto out; 10656 } 10657 break; 10658 case NL80211_NAN_FUNC_SUBSCRIBE: 10659 func->subscribe_active = 10660 nla_get_flag(tb[NL80211_NAN_FUNC_SUBSCRIBE_ACTIVE]); 10661 break; 10662 case
[PATCH v2 3/9] cfg80211: add add_nan_func / rm_nan_func
From: Ayala BekerA NAN function can be either publish, subscribe or follow up. Make all the necessary verifications and just pass the request to the driver. Allow the user space application that starts NAN to forbid any other socket to add or remove functions. Signed-off-by: Andrei Otcheretianski Signed-off-by: Emmanuel Grumbach Signed-off-by: Ayala Beker Signed-off-by: Luca Coelho --- include/net/cfg80211.h | 91 +++ include/uapi/linux/nl80211.h | 153 ++ net/wireless/core.c | 3 +- net/wireless/nl80211.c | 368 +++ net/wireless/rdev-ops.h | 21 +++ net/wireless/trace.h | 39 + net/wireless/util.c | 22 +++ 7 files changed, 696 insertions(+), 1 deletion(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index ca64d69..ced5b8a 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -2306,6 +2306,73 @@ struct cfg80211_nan_conf { }; /** + * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter + * + * @filter: the content of the filter + * @len: the length of the filter + */ +struct cfg80211_nan_func_filter { + const u8 *filter; + u8 len; +}; + +/** + * struct cfg80211_nan_func - a NAN function + * + * @type: nl80211_nan_function_type + * @service_id: the service ID of the function + * @publish_type: _nan_publish_type + * @close_range: if true, the range should be limited. Threshold is + * implementation specific. + * @publish_bcast: if true, the solicited publish should be broadcasted + * @subscribe_active: if true, the subscribe is active + * @followup_id: the instance ID for follow up + * @followup_reqid: the requestor instance ID for follow up + * @followup_dest: MAC address of the recipient of the follow up + * @ttl: time to live counter in DW. + * @serv_spec_info: Service Specific Info + * @serv_spec_info_len: Service Specific Info length + * @srf_include: if true, SRF is inclusive + * @srf_bf: Bloom Filter + * @srf_bf_len: Bloom Filter length + * @srf_bf_idx: Bloom Filter index + * @srf_macs: SRF MAC addresses + * @srf_num_macs: number of MAC addresses in SRF + * @rx_filters: rx filters that are matched with corresponding peer's tx_filter + * @tx_filters: filters that should be transmitted in the SDF. + * @num_rx_filters: length of _filters. + * @num_tx_filters: length of _filters. + * @instance_id: driver allocated id of the function. + * @cookie: unique NAN function identifier. + */ +struct cfg80211_nan_func { + enum nl80211_nan_function_type type; + u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN]; + u8 publish_type; + bool close_range; + bool publish_bcast; + bool subscribe_active; + u8 followup_id; + u8 followup_reqid; + struct mac_address followup_dest; + u32 ttl; + const u8 *serv_spec_info; + u8 serv_spec_info_len; + bool srf_include; + const u8 *srf_bf; + u8 srf_bf_len; + u8 srf_bf_idx; + struct mac_address *srf_macs; + int srf_num_macs; + struct cfg80211_nan_func_filter *rx_filters; + struct cfg80211_nan_func_filter *tx_filters; + u8 num_tx_filters; + u8 num_rx_filters; + u8 instance_id; + u64 cookie; +}; + +/** * struct cfg80211_ops - backend description for wireless configuration * * This struct is registered by fullmac card drivers and/or wireless stacks @@ -2595,6 +2662,14 @@ struct cfg80211_nan_conf { * peers must be on the base channel when the call completes. * @start_nan: Start the NAN interface. * @stop_nan: Stop the NAN interface. + * @add_nan_func: Add a NAN function. Returns negative value on failure. + * On success @nan_func ownership is transferred to the driver and + * it may access it outside of the scope of this function. The driver + * should free the @nan_func when no longer needed by calling + * cfg80211_free_nan_func(). + * On success the driver should assign an instance_id in the + * provided @nan_func. + * @rm_nan_func: Remove a NAN function. */ struct cfg80211_ops { int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); @@ -2863,6 +2938,10 @@ struct cfg80211_ops { int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev, struct cfg80211_nan_conf *conf); void(*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev); + int (*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev, + struct cfg80211_nan_func *nan_func); + void(*rm_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev, + u64 cookie); }; /* @@ -3311,6 +3390,8 @@ struct wiphy_iftype_ext_capab { * @bss_select_support: bitmask indicating the