wifi: cfg80211: Extend cfg80211_new_sta() for MLD AP
authorVeerendranath Jakkam <quic_vjakkam@quicinc.com>
Thu, 26 Jan 2023 14:32:55 +0000 (20:02 +0530)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 14 Feb 2023 10:53:34 +0000 (11:53 +0100)
Add support for drivers to indicate STA connection(MLO/non-MLO) when
user space SME (e.g., hostapd) is not used for MLD AP.

Add new parameters in struct station_info to provide below information
in cfg80211_new_sta() call:
- MLO link ID of the AP, with which station completed (re)association.
  This is applicable for both MLO and non-MLO station connections when
  the AP affiliated with an MLD.
- Station's MLD address if the connection is MLO capable.
- (Re)Association Response IEs sent to the station. User space needs
  this to determine rejected and accepted affiliated links information
  of the connected station if the connection is MLO capable.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
Link: https://lore.kernel.org/r/20230126143256.960563-2-quic_vjakkam@quicinc.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/cfg80211.h
net/wireless/nl80211.c

index bcde215..2852919 100644 (file)
@@ -1876,6 +1876,24 @@ struct cfg80211_tid_stats {
  *     received packet with an FCS error matches the peer MAC address.
  * @airtime_link_metric: mesh airtime link metric.
  * @connected_to_as: true if mesh STA has a path to authentication server
+ * @mlo_params_valid: Indicates @assoc_link_id and @mld_addr fields are filled
+ *     by driver. Drivers use this only in cfg80211_new_sta() calls when AP
+ *     MLD's MLME/SME is offload to driver. Drivers won't fill this
+ *     information in cfg80211_del_sta_sinfo(), get_station() and
+ *     dump_station() callbacks.
+ * @assoc_link_id: Indicates MLO link ID of the AP, with which the station
+ *     completed (re)association. This information filled for both MLO
+ *     and non-MLO STA connections when the AP affiliated with an MLD.
+ * @mld_addr: For MLO STA connection, filled with MLD address of the station.
+ *     For non-MLO STA connection, filled with all zeros.
+ * @assoc_resp_ies: IEs from (Re)Association Response.
+ *     This is used only when in AP mode with drivers that do not use user
+ *     space MLME/SME implementation. The information is provided only for the
+ *     cfg80211_new_sta() calls to notify user space of the IEs. Drivers won't
+ *     fill this information in cfg80211_del_sta_sinfo(), get_station() and
+ *     dump_station() callbacks. User space needs this information to determine
+ *     the accepted and rejected affiliated links of the connected station.
+ * @assoc_resp_ies_len: Length of @assoc_resp_ies buffer in octets.
  */
 struct station_info {
        u64 filled;
@@ -1935,6 +1953,12 @@ struct station_info {
        u32 airtime_link_metric;
 
        u8 connected_to_as;
+
+       bool mlo_params_valid;
+       u8 assoc_link_id;
+       u8 mld_addr[ETH_ALEN] __aligned(2);
+       const u8 *assoc_resp_ies;
+       size_t assoc_resp_ies_len;
 };
 
 /**
index a0858d7..caf716c 100644 (file)
@@ -6527,6 +6527,22 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid,
                    sinfo->assoc_req_ies))
                goto nla_put_failure;
 
+       if (sinfo->assoc_resp_ies_len &&
+           nla_put(msg, NL80211_ATTR_RESP_IE, sinfo->assoc_resp_ies_len,
+                   sinfo->assoc_resp_ies))
+               goto nla_put_failure;
+
+       if (sinfo->mlo_params_valid) {
+               if (nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID,
+                              sinfo->assoc_link_id))
+                       goto nla_put_failure;
+
+               if (!is_zero_ether_addr(sinfo->mld_addr) &&
+                   nla_put(msg, NL80211_ATTR_MLD_ADDR, ETH_ALEN,
+                           sinfo->mld_addr))
+                       goto nla_put_failure;
+       }
+
        cfg80211_sinfo_release_content(sinfo);
        genlmsg_end(msg, hdr);
        return 0;