diff --git a/os_if/linux/mlme/src/osif_cm_connect_rsp.c b/os_if/linux/mlme/src/osif_cm_connect_rsp.c index 6a647f7f91..d0fce22d0f 100644 --- a/os_if/linux/mlme/src/osif_cm_connect_rsp.c +++ b/os_if/linux/mlme/src/osif_cm_connect_rsp.c @@ -494,6 +494,26 @@ osif_free_ml_link_params(struct cfg80211_connect_resp_params *conn_rsp_params) } #endif +#ifdef CFG80211_SINGLE_NETDEV_MULTI_LINK_SUPPORT +static +void osif_copy_connected_info(struct cfg80211_connect_resp_params *conn_rsp, + struct wlan_cm_connect_resp *rsp, + struct cfg80211_bss *bss) +{ + conn_rsp->links[0].bssid = rsp->bssid.bytes; + conn_rsp->links[0].bss = bss; +} +#else +static +void osif_copy_connected_info(struct cfg80211_connect_resp_params *conn_rsp, + struct wlan_cm_connect_resp *rsp, + struct cfg80211_bss *bss) +{ + conn_rsp->bssid = rsp->bssid.bytes; + conn_rsp->bss = bss; +} +#endif + /** * osif_connect_done() - Wrapper API to call cfg80211_connect_done * @dev: network device @@ -520,7 +540,7 @@ static int osif_connect_done(struct net_device *dev, struct cfg80211_bss *bss, qdf_mem_zero(&conn_rsp_params, sizeof(conn_rsp_params)); conn_rsp_params.status = status; - conn_rsp_params.bssid = rsp->bssid.bytes; + osif_copy_connected_info(&conn_rsp_params, rsp, bss); conn_rsp_params.timeout_reason = osif_convert_timeout_reason(rsp->reason); osif_cm_get_assoc_req_ie_data(&rsp->connect_ies.assoc_req, @@ -529,7 +549,6 @@ static int osif_connect_done(struct net_device *dev, struct cfg80211_bss *bss, osif_cm_get_assoc_rsp_ie_data(&rsp->connect_ies.assoc_rsp, &conn_rsp_params.resp_ie_len, &conn_rsp_params.resp_ie); - conn_rsp_params.bss = bss; osif_populate_fils_params(&conn_rsp_params, &rsp->connect_ies); osif_cm_save_gtk(vdev, rsp); diff --git a/os_if/linux/mlme/src/osif_cm_roam_rsp.c b/os_if/linux/mlme/src/osif_cm_roam_rsp.c index 6ea9d22dc8..575c137965 100644 --- a/os_if/linux/mlme/src/osif_cm_roam_rsp.c +++ b/os_if/linux/mlme/src/osif_cm_roam_rsp.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2012-2015,2020-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -63,6 +64,21 @@ static inline void osif_update_fils_hlp_data(struct net_device *dev, */ #if defined CFG80211_ROAMED_API_UNIFIED || \ (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) +#ifdef CFG80211_SINGLE_NETDEV_MULTI_LINK_SUPPORT +static +void osif_copy_roamed_info(struct cfg80211_roam_info *info, + struct cfg80211_bss *bss) +{ + info->links[0].bss = bss; +} +#else +static +void osif_copy_roamed_info(struct cfg80211_roam_info *info, + struct cfg80211_bss *bss) +{ + info->bss = bss; +} +#endif static void osif_roamed_ind(struct net_device *dev, struct cfg80211_bss *bss, const uint8_t *req_ie, size_t req_ie_len, const uint8_t *resp_ie, @@ -70,7 +86,7 @@ static void osif_roamed_ind(struct net_device *dev, struct cfg80211_bss *bss, { struct cfg80211_roam_info info = {0}; - info.bss = bss; + osif_copy_roamed_info(&info, bss); info.req_ie = req_ie; info.req_ie_len = req_ie_len; info.resp_ie = resp_ie; diff --git a/os_if/linux/wlan_cfg80211.h b/os_if/linux/wlan_cfg80211.h index 96d791de84..d34bf25c86 100644 --- a/os_if/linux/wlan_cfg80211.h +++ b/os_if/linux/wlan_cfg80211.h @@ -502,4 +502,22 @@ static inline void wlan_cfg80211_unregister_netdevice(struct net_device *dev) } #endif +#ifdef CFG80211_SINGLE_NETDEV_MULTI_LINK_SUPPORT +static inline +void wlan_cfg80211_ch_switch_notify(struct net_device *dev, + struct cfg80211_chan_def *chandef, + unsigned int link_id) +{ + cfg80211_ch_switch_notify(dev, chandef, link_id); +} +#else +static inline +void wlan_cfg80211_ch_switch_notify(struct net_device *dev, + struct cfg80211_chan_def *chandef, + unsigned int link_id) +{ + cfg80211_ch_switch_notify(dev, chandef); +} +#endif + #endif diff --git a/os_if/linux/wlan_osif_features.h b/os_if/linux/wlan_osif_features.h index 86482ab880..5070928269 100644 --- a/os_if/linux/wlan_osif_features.h +++ b/os_if/linux/wlan_osif_features.h @@ -83,5 +83,36 @@ #define CFG80211_SA_QUERY_OFFLOAD_SUPPORT 1 #endif - +/* + * CFG80211_SINGLE_NETDEV_MULTI_LINK_SUPPORT + * Used to indicate the Linux Kernel contains support for single netdevice multi + * link support. + * + * This feature was merged into wireless-next via below commits: + * 7b0a0e3c3 wifi: cfg80211: do some rework towards MLO link APIs + * 0f7594489 wifi: cfg80211: mlme: get BSS entry outside cfg80211_mlme_assoc() + * 9ecff10e8 wifi: nl80211: refactor BSS lookup in nl80211_associate() + * 0f48b8b88 wifi: ieee80211: add definitions for multi-link element + * 325839da9 wifi: cfg80211: simplify cfg80211_mlme_auth() prototype + * d648c2302 wifi: nl80211: support MLO in auth/assoc + * + * This feature was backported to Android Common Kernel 5.15 via: + * https://android-review.googlesource.com/c/kernel/common/+/2123895 + * https://android-review.googlesource.com/c/kernel/common/+/2115618 + * https://android-review.googlesource.com/c/kernel/common/+/2115620 + * https://android-review.googlesource.com/c/kernel/common/+/2121347 + * https://android-review.googlesource.com/c/kernel/common/+/2121348 + * https://android-review.googlesource.com/c/kernel/common/+/2121349 + * https://android-review.googlesource.com/c/kernel/common/+/2121350 + * https://android-review.googlesource.com/c/kernel/common/+/2121351 + * https://android-review.googlesource.com/c/kernel/common/+/2123452 + * https://android-review.googlesource.com/c/kernel/common/+/2123454 + * https://android-review.googlesource.com/c/kernel/common/+/2115621 + * + */ +#if (defined(__ANDROID_COMMON_KERNEL__) && \ + (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)) && \ + (defined IEEE80211_MLD_MAX_NUM_LINKS)) +#define CFG80211_SINGLE_NETDEV_MULTI_LINK_SUPPORT 1 +#endif #endif