]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: iwlwifi: mld: include raw PHY notification in radiotap
authorJohannes Berg <johannes.berg@intel.com>
Sun, 19 Oct 2025 08:45:03 +0000 (11:45 +0300)
committerMiri Korenblit <miriam.rachel.korenblit@intel.com>
Tue, 28 Oct 2025 14:17:26 +0000 (16:17 +0200)
This is useful for debugging and can also be used to see
anything that isn't encoded in radiotap (yet.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20251019114304.5fe26e9061f2.Iefb45e3a6a2a62ff3247db4de3777059d390af95@changeid
drivers/net/wireless/intel/iwlwifi/mld/rx.c

index 052a19bb85b45fabc6e66874e410e9724f0f59ad..19e78d2fbf9b5d6167e477f4c79bf467dc021615 100644 (file)
@@ -1217,8 +1217,9 @@ static void iwl_mld_add_rtap_sniffer_config(struct iwl_mld *mld,
        radiotap->oui[0] = 0xf6;
        radiotap->oui[1] = 0x54;
        radiotap->oui[2] = 0x25;
-       /* radiotap sniffer config sub-namespace */
+       /* Intel OUI default radiotap subtype */
        radiotap->oui_subtype = 1;
+       /* Sniffer config element type */
        radiotap->vendor_type = 0;
 
        /* fill the data now */
@@ -1229,6 +1230,34 @@ static void iwl_mld_add_rtap_sniffer_config(struct iwl_mld *mld,
 }
 #endif
 
+static void iwl_mld_add_rtap_sniffer_phy_data(struct iwl_mld *mld,
+                                             struct sk_buff *skb,
+                                             struct iwl_rx_phy_air_sniffer_ntfy *ntfy)
+{
+       struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);
+       struct ieee80211_radiotap_vendor_content *radiotap;
+       const u16 vendor_data_len = sizeof(*ntfy);
+
+       radiotap =
+               iwl_mld_radiotap_put_tlv(skb,
+                                        IEEE80211_RADIOTAP_VENDOR_NAMESPACE,
+                                        sizeof(*radiotap) + vendor_data_len);
+
+       /* Intel OUI */
+       radiotap->oui[0] = 0xf6;
+       radiotap->oui[1] = 0x54;
+       radiotap->oui[2] = 0x25;
+       /* Intel OUI default radiotap subtype */
+       radiotap->oui_subtype = 1;
+       /* PHY data element type */
+       radiotap->vendor_type = cpu_to_le16(1);
+
+       /* fill the data now */
+       memcpy(radiotap->data, ntfy, vendor_data_len);
+
+       rx_status->flag |= RX_FLAG_RADIOTAP_TLV_AT_END;
+}
+
 static void
 iwl_mld_set_rx_nonlegacy_rate_info(u32 rate_n_flags,
                                   struct ieee80211_rx_status *rx_status)
@@ -1371,6 +1400,9 @@ static void iwl_mld_rx_fill_status(struct iwl_mld *mld, int link_id,
                }
        }
 #endif
+
+       if (phy_data->ntfy)
+               iwl_mld_add_rtap_sniffer_phy_data(mld, skb, phy_data->ntfy);
 }
 
 /* iwl_mld_create_skb adds the rxb to a new skb */
@@ -1866,6 +1898,7 @@ void iwl_mld_rx_mpdu(struct iwl_mld *mld, struct napi_struct *napi,
        u32 mpdu_len;
        enum iwl_mld_reorder_result reorder_res;
        struct ieee80211_rx_status *rx_status;
+       unsigned int alloc_size = 128;
 
        if (unlikely(mld->fw_status.in_hw_restart))
                return;
@@ -1884,8 +1917,13 @@ void iwl_mld_rx_mpdu(struct iwl_mld *mld, struct napi_struct *napi,
 
        /* Don't use dev_alloc_skb(), we'll have enough headroom once
         * ieee80211_hdr pulled.
+        *
+        * For monitor mode we need more space to include the full PHY
+        * notification data.
         */
-       skb = alloc_skb(128, GFP_ATOMIC);
+       if (unlikely(mld->monitor.on) && phy_data.ntfy)
+               alloc_size += sizeof(struct iwl_rx_phy_air_sniffer_ntfy);
+       skb = alloc_skb(alloc_size, GFP_ATOMIC);
        if (!skb) {
                IWL_ERR(mld, "alloc_skb failed\n");
                return;
@@ -2102,7 +2140,8 @@ static void iwl_mld_no_data_rx(struct iwl_mld *mld,
        u32 format = phy_data.rate_n_flags & RATE_MCS_MOD_TYPE_MSK;
        struct sk_buff *skb;
 
-       skb = alloc_skb(128, GFP_ATOMIC);
+       skb = alloc_skb(128 + sizeof(struct iwl_rx_phy_air_sniffer_ntfy),
+                       GFP_ATOMIC);
        if (!skb)
                return;