]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
wifi: mac80211: add support for TX over NAN_DATA interfaces
authorMiri Korenblit <miriam.rachel.korenblit@intel.com>
Thu, 26 Mar 2026 10:14:41 +0000 (12:14 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 7 Apr 2026 13:36:03 +0000 (15:36 +0200)
Add support for TXing frames over NAN_DATA interfaces:
- find the NDI station
- populoate the addresses fields
- use NUM_NL80211_BANDS for the band, similar to NAN interfaces.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260326121156.b1d248947158.I04b27d9727f7a553fa80520cf6e532683ac03690@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/tx.c

index f0f23e94db0433fd4a86b62394f5d991d3b6119c..b487d2330f25f119f730b714900815c19c77bf1d 100644 (file)
@@ -2543,6 +2543,13 @@ int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata,
                if (!sta)
                        return -ENOLINK;
                break;
+       case NL80211_IFTYPE_NAN_DATA:
+               if (is_multicast_ether_addr(skb->data)) {
+                       *sta_out = ERR_PTR(-ENOENT);
+                       return 0;
+               }
+               sta = sta_info_get(sdata, skb->data);
+               break;
        default:
                return -EINVAL;
        }
@@ -2836,18 +2843,37 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
                memcpy(hdr.addr3, sdata->u.ibss.bssid, ETH_ALEN);
                hdrlen = 24;
                break;
+       case NL80211_IFTYPE_NAN_DATA: {
+               struct ieee80211_sub_if_data *nmi;
+
+               /* DA SA Cluster ID */
+               memcpy(hdr.addr1, skb->data, ETH_ALEN);
+               memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN);
+               nmi = rcu_dereference(sdata->u.nan_data.nmi);
+               if (!nmi) {
+                       ret = -ENOTCONN;
+                       goto free;
+               }
+               memcpy(hdr.addr3, nmi->wdev.u.nan.cluster_id, ETH_ALEN);
+               hdrlen = 24;
+               break;
+       }
        default:
                ret = -EINVAL;
                goto free;
        }
 
        if (!chanctx_conf) {
-               if (!ieee80211_vif_is_mld(&sdata->vif)) {
+               if (sdata->vif.type == NL80211_IFTYPE_NAN_DATA) {
+                        /* NAN operates on multiple bands */
+                       band = NUM_NL80211_BANDS;
+               } else if (!ieee80211_vif_is_mld(&sdata->vif)) {
                        ret = -ENOTCONN;
                        goto free;
+               } else {
+                       /* MLD transmissions must not rely on the band */
+                       band = 0;
                }
-               /* MLD transmissions must not rely on the band */
-               band = 0;
        } else {
                band = chanctx_conf->def.chan->band;
        }