Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mac80211: Add API to report NAN function match

Provide an API to report NAN function match. Mac80211 will lookup the
corresponding cookie and report the match to cfg80211.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Ayala Beker and committed by
Johannes Berg
92bc43bc 167e33f4

+41
+16
include/net/mac80211.h
··· 5777 5777 u8 inst_id, 5778 5778 enum nl80211_nan_func_term_reason reason, 5779 5779 gfp_t gfp); 5780 + 5781 + /** 5782 + * ieee80211_nan_func_match - notify about NAN function match event. 5783 + * 5784 + * This function is used to notify mac80211 about NAN function match. The 5785 + * cookie inside the match struct will be assigned by mac80211. 5786 + * Note that this function can't be called from hard irq. 5787 + * 5788 + * @vif: &struct ieee80211_vif pointer from the add_interface callback. 5789 + * @match: match event information 5790 + * @gfp: allocation flags 5791 + */ 5792 + void ieee80211_nan_func_match(struct ieee80211_vif *vif, 5793 + struct cfg80211_nan_match_params *match, 5794 + gfp_t gfp); 5795 + 5780 5796 #endif /* MAC80211_H */
+25
net/mac80211/cfg.c
··· 3555 3555 } 3556 3556 EXPORT_SYMBOL(ieee80211_nan_func_terminated); 3557 3557 3558 + void ieee80211_nan_func_match(struct ieee80211_vif *vif, 3559 + struct cfg80211_nan_match_params *match, 3560 + gfp_t gfp) 3561 + { 3562 + struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); 3563 + struct cfg80211_nan_func *func; 3564 + 3565 + if (WARN_ON(vif->type != NL80211_IFTYPE_NAN)) 3566 + return; 3567 + 3568 + spin_lock_bh(&sdata->u.nan.func_lock); 3569 + 3570 + func = idr_find(&sdata->u.nan.function_inst_ids, match->inst_id); 3571 + if (WARN_ON(!func)) { 3572 + spin_unlock_bh(&sdata->u.nan.func_lock); 3573 + return; 3574 + } 3575 + match->cookie = func->cookie; 3576 + 3577 + spin_unlock_bh(&sdata->u.nan.func_lock); 3578 + 3579 + cfg80211_nan_match(ieee80211_vif_to_wdev(vif), match, gfp); 3580 + } 3581 + EXPORT_SYMBOL(ieee80211_nan_func_match); 3582 + 3558 3583 const struct cfg80211_ops mac80211_config_ops = { 3559 3584 .add_virtual_intf = ieee80211_add_iface, 3560 3585 .del_virtual_intf = ieee80211_del_iface,