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

Configure Feed

Select the types of activity you want to include in your feed.

wifi: cfg80211: Add cluster joined notification APIs

The drivers should notify upper layers and user space when a NAN device
joins a cluster. This is needed, for example, to set the correct addr3
in SDF frames. Add API to report cluster join event.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250908140015.ad27b7b6e4d9.I70b213a2a49f18d1ba2ad325e67e8eff51cc7a1f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Andrei Otcheretianski and committed by
Johannes Berg
1ccfd8db ba9b2cea

+82
+14
include/net/cfg80211.h
··· 10074 10074 void cfg80211_next_nan_dw_notif(struct wireless_dev *wdev, 10075 10075 struct ieee80211_channel *chan, gfp_t gfp); 10076 10076 10077 + /** 10078 + * cfg80211_nan_cluster_joined - Notify about NAN cluster join 10079 + * @wdev: Pointer to the wireless device structure 10080 + * @cluster_id: Cluster ID of the NAN cluster that was joined or started 10081 + * @new_cluster: Indicates if this is a new cluster or an existing one 10082 + * @gfp: Memory allocation flags 10083 + * 10084 + * This function is used to notify user space when a NAN cluster has been 10085 + * joined, providing the cluster ID and a flag whether it is a new cluster. 10086 + */ 10087 + void cfg80211_nan_cluster_joined(struct wireless_dev *wdev, 10088 + const u8 *cluster_id, bool new_cluster, 10089 + gfp_t gfp); 10090 + 10077 10091 #ifdef CONFIG_CFG80211_DEBUGFS 10078 10092 /** 10079 10093 * wiphy_locked_debugfs_read - do a locked read in debugfs
+8
include/uapi/linux/nl80211.h
··· 1357 1357 * the device/driver shall take care of the actual transmission timing. 1358 1358 * This notification is only sent to the NAN interface owning socket 1359 1359 * (see %NL80211_ATTR_SOCKET_OWNER flag). 1360 + * @NL80211_CMD_NAN_CLUSTER_JOINED: This command is used to notify 1361 + * user space that the NAN new cluster has been joined. The cluster ID is 1362 + * indicated by %NL80211_ATTR_MAC. 1360 1363 * 1361 1364 * @NL80211_CMD_MAX: highest used command number 1362 1365 * @__NL80211_CMD_AFTER_LAST: internal use ··· 1622 1619 NL80211_CMD_EPCS_CFG, 1623 1620 1624 1621 NL80211_CMD_NAN_NEXT_DW_NOTIFICATION, 1622 + NL80211_CMD_NAN_CLUSTER_JOINED, 1625 1623 1626 1624 /* add new commands above here */ 1627 1625 ··· 2961 2957 * %NL80211_CMD_START_NAN and %NL80211_CMD_CHANGE_NAN_CONFIG. 2962 2958 * See &enum nl80211_nan_conf_attributes for details. 2963 2959 * This attribute is optional. 2960 + * @NL80211_ATTR_NAN_NEW_CLUSTER: Flag attribute indicating that a new 2961 + * NAN cluster has been created. This is used with 2962 + * %NL80211_CMD_NAN_CLUSTER_JOINED 2964 2963 * 2965 2964 * @NUM_NL80211_ATTR: total number of nl80211_attrs available 2966 2965 * @NL80211_ATTR_MAX: highest attribute number currently defined ··· 3528 3521 NL80211_ATTR_S1G_SHORT_BEACON, 3529 3522 NL80211_ATTR_BSS_PARAM, 3530 3523 NL80211_ATTR_NAN_CONFIG, 3524 + NL80211_ATTR_NAN_NEW_CLUSTER, 3531 3525 3532 3526 /* add attributes here, update the policy in nl80211.c */ 3533 3527
+41
net/wireless/nl80211.c
··· 21809 21809 } 21810 21810 EXPORT_SYMBOL(cfg80211_next_nan_dw_notif); 21811 21811 21812 + void cfg80211_nan_cluster_joined(struct wireless_dev *wdev, 21813 + const u8 *cluster_id, bool new_cluster, 21814 + gfp_t gfp) 21815 + { 21816 + struct wiphy *wiphy = wdev->wiphy; 21817 + struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); 21818 + struct sk_buff *msg; 21819 + void *hdr; 21820 + 21821 + trace_cfg80211_nan_cluster_joined(wdev, cluster_id, new_cluster); 21822 + 21823 + msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); 21824 + if (!msg) 21825 + return; 21826 + 21827 + hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_NAN_CLUSTER_JOINED); 21828 + if (!hdr) 21829 + goto nla_put_failure; 21830 + 21831 + if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || 21832 + nla_put_u64_64bit(msg, NL80211_ATTR_WDEV, wdev_id(wdev), 21833 + NL80211_ATTR_PAD) || 21834 + nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, cluster_id) || 21835 + (new_cluster && nla_put_flag(msg, NL80211_ATTR_NAN_NEW_CLUSTER))) 21836 + goto nla_put_failure; 21837 + 21838 + genlmsg_end(msg, hdr); 21839 + 21840 + if (!wdev->owner_nlportid) 21841 + genlmsg_multicast_netns(&nl80211_fam, wiphy_net(wiphy), 21842 + msg, 0, NL80211_MCGRP_NAN, gfp); 21843 + else 21844 + genlmsg_unicast(wiphy_net(wiphy), msg, 21845 + wdev->owner_nlportid); 21846 + return; 21847 + 21848 + nla_put_failure: 21849 + nlmsg_free(msg); 21850 + } 21851 + EXPORT_SYMBOL(cfg80211_nan_cluster_joined); 21852 + 21812 21853 /* initialisation/exit functions */ 21813 21854 21814 21855 int __init nl80211_init(void)
+19
net/wireless/trace.h
··· 4182 4182 WDEV_PR_ARG, CHAN_PR_ARG) 4183 4183 ); 4184 4184 4185 + TRACE_EVENT(cfg80211_nan_cluster_joined, 4186 + TP_PROTO(struct wireless_dev *wdev, 4187 + const u8 *cluster_id, 4188 + bool new_cluster), 4189 + TP_ARGS(wdev, cluster_id, new_cluster), 4190 + TP_STRUCT__entry( 4191 + WDEV_ENTRY 4192 + MAC_ENTRY(cluster_id) 4193 + __field(bool, new_cluster) 4194 + ), 4195 + TP_fast_assign( 4196 + WDEV_ASSIGN; 4197 + MAC_ASSIGN(cluster_id, cluster_id); 4198 + __entry->new_cluster = new_cluster; 4199 + ), 4200 + TP_printk(WDEV_PR_FMT " cluster_id %pMF%s", 4201 + WDEV_PR_ARG, __entry->cluster_id, 4202 + __entry->new_cluster ? " [new]" : "") 4203 + ); 4185 4204 #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */ 4186 4205 4187 4206 #undef TRACE_INCLUDE_PATH