]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: nl80211: add NL80211_CMD_NAN_ULW_UPDATE notification
authorMiri Korenblit <miriam.rachel.korenblit@intel.com>
Wed, 18 Mar 2026 12:39:23 +0000 (14:39 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 25 Mar 2026 19:56:55 +0000 (20:56 +0100)
Add a new notification command that allows drivers to notify user space
when the device's ULW (Unaligned Schedule) blob has been updated. This
enables user space to attach the updated ULW blob to frames sent to NAN
peers.

Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260219114327.32b715af4ebb.Ibdb6e33941afd94abf77245245f87e4338d729d3@changeid
Link: https://patch.msgid.link/20260318123926.206536-10-miriam.rachel.korenblit@intel.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/cfg80211.h
include/uapi/linux/nl80211.h
net/wireless/nl80211.c
net/wireless/trace.h

index 0d19f34ea7ac0ffe23fc3f8128f91b585f7ccc49..ee173f69c417aa9eb1216647a0afd9095ebe880e 100644 (file)
@@ -10574,6 +10574,20 @@ void cfg80211_nan_cluster_joined(struct wireless_dev *wdev,
                                 const u8 *cluster_id, bool new_cluster,
                                 gfp_t gfp);
 
+/**
+ * cfg80211_nan_ulw_update - Notify user space about ULW update
+ * @wdev: Pointer to the wireless device structure
+ * @ulw: Pointer to the ULW blob data
+ * @ulw_len: Length of the ULW blob in bytes
+ * @gfp: Memory allocation flags
+ *
+ * This function is used by drivers to notify user space when the device's
+ * ULW (Unaligned Schedule) blob has been updated. User space can use this
+ * blob to attach to frames sent to peers.
+ */
+void cfg80211_nan_ulw_update(struct wireless_dev *wdev,
+                            const u8 *ulw, size_t ulw_len, gfp_t gfp);
+
 #ifdef CONFIG_CFG80211_DEBUGFS
 /**
  * wiphy_locked_debugfs_read - do a locked read in debugfs
index cf6f1f6b9e36ce5625e61c9e015803052b3bbac2..947ec7079484d9788ad72c85a4d5fa6c0d18e25c 100644 (file)
  *     completely replace the previous one.
  *     The peer schedule is automatically removed when the NMI station is
  *     removed.
+ * @NL80211_CMD_NAN_ULW_UPDATE: Notification from the driver to user space
+ *     with the updated ULW blob of the device. User space can use this blob
+ *     to attach to frames sent to peers. This notification contains
+ *     %NL80211_ATTR_NAN_ULW with the ULW blob.
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
  */
@@ -1673,6 +1677,7 @@ enum nl80211_commands {
 
        NL80211_CMD_NAN_SET_PEER_SCHED,
 
+       NL80211_CMD_NAN_ULW_UPDATE,
        /* add new commands above here */
 
        /* used to define NL80211_CMD_MAX below */
index 7f47feaf44229fa6d04d67d1bf6ad23823ad8160..b5185655e6878dccf1d6396174d109c8b7af011c 100644 (file)
@@ -22893,6 +22893,49 @@ void cfg80211_nan_cluster_joined(struct wireless_dev *wdev,
 }
 EXPORT_SYMBOL(cfg80211_nan_cluster_joined);
 
+void cfg80211_nan_ulw_update(struct wireless_dev *wdev,
+                            const u8 *ulw, size_t ulw_len, gfp_t gfp)
+{
+       struct wiphy *wiphy = wdev->wiphy;
+       struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
+       struct sk_buff *msg;
+       void *hdr;
+
+       trace_cfg80211_nan_ulw_update(wiphy, wdev, ulw, ulw_len);
+
+       if (!wdev->owner_nlportid)
+               return;
+
+       /* 32 for the wiphy idx, 64 for the wdev id, 100 for padding */
+       msg = nlmsg_new(nla_total_size(sizeof(u32)) +
+                       nla_total_size(ulw_len) +
+                       nla_total_size(sizeof(u64)) + 100,
+                       gfp);
+       if (!msg)
+               return;
+
+       hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_NAN_ULW_UPDATE);
+       if (!hdr)
+               goto nla_put_failure;
+
+       if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
+           nla_put_u64_64bit(msg, NL80211_ATTR_WDEV, wdev_id(wdev),
+                             NL80211_ATTR_PAD) ||
+           (ulw && ulw_len &&
+            nla_put(msg, NL80211_ATTR_NAN_ULW, ulw_len, ulw)))
+               goto nla_put_failure;
+
+       genlmsg_end(msg, hdr);
+
+       genlmsg_unicast(wiphy_net(wiphy), msg, wdev->owner_nlportid);
+
+       return;
+
+ nla_put_failure:
+       nlmsg_free(msg);
+}
+EXPORT_SYMBOL(cfg80211_nan_ulw_update);
+
 /* initialisation/exit functions */
 
 int __init nl80211_init(void)
index df639d97cc0c6a192862c2ee8c922e6433894273..061bb84f1a488afe9960e1e30a5751226ee6c9d8 100644 (file)
@@ -4342,6 +4342,27 @@ TRACE_EVENT(cfg80211_nan_sched_update_done,
        TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT " success=%d",
                  WIPHY_PR_ARG, WDEV_PR_ARG, __entry->success)
 );
+
+TRACE_EVENT(cfg80211_nan_ulw_update,
+       TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev,
+                const u8 *ulw, size_t ulw_len),
+       TP_ARGS(wiphy, wdev, ulw, ulw_len),
+       TP_STRUCT__entry(
+               WIPHY_ENTRY
+               WDEV_ENTRY
+               __dynamic_array(u8, ulw, ulw_len)
+       ),
+       TP_fast_assign(
+               WIPHY_ASSIGN;
+               WDEV_ASSIGN;
+               if (ulw && ulw_len)
+                       memcpy(__get_dynamic_array(ulw), ulw, ulw_len);
+       ),
+       TP_printk(WIPHY_PR_FMT ", " WDEV_PR_FMT " ulw: %s",
+                 WIPHY_PR_ARG, WDEV_PR_ARG,
+                 __print_array(__get_dynamic_array(ulw),
+                               __get_dynamic_array_len(ulw), 1))
+);
 #endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */
 
 #undef TRACE_INCLUDE_PATH