]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: iwlwifi: mld: add handler for NAN ULW attribute notification
authorAvraham Stern <avraham.stern@intel.com>
Wed, 13 May 2026 05:43:52 +0000 (08:43 +0300)
committerMiri Korenblit <miriam.rachel.korenblit@intel.com>
Tue, 26 May 2026 12:17:11 +0000 (15:17 +0300)
When a notification about a new ULW attribute arrives, send it to
user space so the ULW attribute can be added to the relevant frames
(e.g. SDF).

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Link: https://patch.msgid.link/20260513084215.76d980e195a7.Ide4aaf4553a3980e6990485cd37204a922c36913@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h
drivers/net/wireless/intel/iwlwifi/mld/mld.c
drivers/net/wireless/intel/iwlwifi/mld/nan.c
drivers/net/wireless/intel/iwlwifi/mld/nan.h
drivers/net/wireless/intel/iwlwifi/mld/notif.c

index 1df81df5830e3a461ccb9805fd98402963abd77a..dde6cfd9d286f9134ea3210260a633266470fee1 100644 (file)
@@ -80,6 +80,10 @@ enum iwl_mac_conf_subcmd_ids {
         * @NAN_PEER_CMD: &struct iwl_nan_peer_cmd
         */
        NAN_PEER_CMD = 0x14,
+       /**
+        * @NAN_ULW_ATTR_NOTIF: &struct iwl_nan_ulw_attr_notif
+        */
+       NAN_ULW_ATTR_NOTIF = 0xf2,
        /**
         * @NAN_DW_END_NOTIF: &struct iwl_nan_dw_end_notif
         */
@@ -1393,4 +1397,20 @@ struct iwl_nan_dw_end_notif {
        u8 reserved[3];
 } __packed; /* NAN_DW_END_NTF_API_S_VER_1 */
 
+#define IWL_NAN_MAX_ENDLESS_ULW_ATTR_LEN       48
+
+/**
+ * struct iwl_nan_ulw_attr_notif - sent to notify the host of a change in the
+ *     ULW attribute
+ *
+ * @attr_len: length of the ULW attribute in bytes
+ * @reserved: reserved
+ * @attr: the ULW attribute including the attribute header
+ */
+struct iwl_nan_ulw_attr_notif {
+       u8 attr_len;
+       u8 reserved[3];
+       u8 attr[IWL_NAN_MAX_ENDLESS_ULW_ATTR_LEN];
+} __packed; /* NAN_ULW_ATTR_NOTIF_API_S_VER_1 */
+
 #endif /* __iwl_fw_api_mac_cfg_h__ */
index 3caa76b9b2cb1e48bb92515c10fdcfa7bae79314..054bb11344257e0c6eac6a25d415b67bed61be81 100644 (file)
@@ -237,6 +237,7 @@ static const struct iwl_hcmd_names iwl_mld_mac_conf_names[] = {
        HCMD_NAME(NAN_CFG_CMD),
        HCMD_NAME(NAN_SCHEDULE_CMD),
        HCMD_NAME(NAN_PEER_CMD),
+       HCMD_NAME(NAN_ULW_ATTR_NOTIF),
        HCMD_NAME(NAN_DW_END_NOTIF),
        HCMD_NAME(NAN_JOINED_CLUSTER_NOTIF),
        HCMD_NAME(MISSED_BEACONS_NOTIF),
index 351c726be51f8d6457405481c785869145905132..8f35687c58b1832b5c5119816cb1c99967606038 100644 (file)
@@ -353,6 +353,39 @@ bool iwl_mld_cancel_nan_dw_end_notif(struct iwl_mld *mld,
        return true;
 }
 
+bool iwl_mld_cancel_nan_ulw_attr_notif(struct iwl_mld *mld,
+                                      struct iwl_rx_packet *pkt,
+                                      u32 obj_id)
+{
+       return true;
+}
+
+void iwl_mld_handle_nan_ulw_attr_notif(struct iwl_mld *mld,
+                                      struct iwl_rx_packet *pkt)
+{
+       struct iwl_nan_ulw_attr_notif *notif = (void *)pkt->data;
+       struct wireless_dev *wdev;
+
+       IWL_DEBUG_INFO(mld, "NAN: ULW attr update: len=%u\n", notif->attr_len);
+
+       if (IWL_FW_CHECK(mld, !mld->nan_device_vif,
+                        "NAN: ULW attr update without NAN vif\n"))
+               return;
+
+       if (IWL_FW_CHECK(mld, !ieee80211_vif_nan_started(mld->nan_device_vif),
+                        "NAN: ULW attr update without NAN started\n"))
+               return;
+
+       if (IWL_FW_CHECK(mld,
+                        notif->attr_len > IWL_NAN_MAX_ENDLESS_ULW_ATTR_LEN,
+                        "NAN: ULW attr update invalid len %u\n",
+                        notif->attr_len))
+               return;
+
+       wdev = ieee80211_vif_to_wdev(mld->nan_device_vif);
+       cfg80211_nan_ulw_update(wdev, notif->attr, notif->attr_len, GFP_KERNEL);
+}
+
 void iwl_mld_handle_nan_dw_end_notif(struct iwl_mld *mld,
                                     struct iwl_rx_packet *pkt)
 {
index caa98dbb4a75752d9ae573e8e1b412c725482da8..40152dc7d906aac75e55825430ecea7a176a53af 100644 (file)
@@ -38,11 +38,16 @@ int iwl_mld_stop_nan(struct ieee80211_hw *hw,
                     struct ieee80211_vif *vif);
 void iwl_mld_handle_nan_cluster_notif(struct iwl_mld *mld,
                                      struct iwl_rx_packet *pkt);
+void iwl_mld_handle_nan_ulw_attr_notif(struct iwl_mld *mld,
+                                      struct iwl_rx_packet *pkt);
 void iwl_mld_handle_nan_dw_end_notif(struct iwl_mld *mld,
                                     struct iwl_rx_packet *pkt);
 bool iwl_mld_cancel_nan_cluster_notif(struct iwl_mld *mld,
                                      struct iwl_rx_packet *pkt,
                                      u32 obj_id);
+bool iwl_mld_cancel_nan_ulw_attr_notif(struct iwl_mld *mld,
+                                      struct iwl_rx_packet *pkt,
+                                      u32 obj_id);
 bool iwl_mld_cancel_nan_dw_end_notif(struct iwl_mld *mld,
                                     struct iwl_rx_packet *pkt,
                                     u32 obj_id);
index 6170953982b71d349a297f5657a3787200570de8..a5074bbc7e24da78e92cef1779a18d00ce0a6714 100644 (file)
@@ -346,6 +346,7 @@ CMD_VERSIONS(time_sync_confirm_notif,
 CMD_VERSIONS(ftm_resp_notif, CMD_VER_ENTRY(10, iwl_tof_range_rsp_ntfy))
 CMD_VERSIONS(beacon_filter_notif, CMD_VER_ENTRY(2, iwl_beacon_filter_notif))
 CMD_VERSIONS(nan_cluster_notif, CMD_VER_ENTRY(1, iwl_nan_cluster_notif))
+CMD_VERSIONS(nan_ulw_attr_notif, CMD_VER_ENTRY(1, iwl_nan_ulw_attr_notif))
 CMD_VERSIONS(nan_dw_end_notif, CMD_VER_ENTRY(1, iwl_nan_dw_end_notif))
 
 DEFINE_SIMPLE_CANCELLATION(session_prot, iwl_session_prot_notif, mac_link_id)
@@ -463,6 +464,8 @@ const struct iwl_rx_handler iwl_mld_rx_handlers[] = {
                              ftm_resp_notif)
        RX_HANDLER_OF_NAN(MAC_CONF_GROUP, NAN_JOINED_CLUSTER_NOTIF,
                          nan_cluster_notif)
+       RX_HANDLER_OF_NAN(MAC_CONF_GROUP, NAN_ULW_ATTR_NOTIF,
+                         nan_ulw_attr_notif)
        RX_HANDLER_OF_NAN(MAC_CONF_GROUP, NAN_DW_END_NOTIF,
                          nan_dw_end_notif)
 };