diff --git a/umac/mlo_mgr/inc/wlan_mlo_mgr_ap.h b/umac/mlo_mgr/inc/wlan_mlo_mgr_ap.h index 9284f03c7e..c408c721cf 100644 --- a/umac/mlo_mgr/inc/wlan_mlo_mgr_ap.h +++ b/umac/mlo_mgr/inc/wlan_mlo_mgr_ap.h @@ -516,6 +516,26 @@ void mlo_ap_vdev_quiet_clear(struct wlan_objmgr_vdev *vdev); */ bool mlo_ap_vdev_quiet_is_any_idx_set(struct wlan_objmgr_vdev *vdev); +#if defined(MESH_MODE_SUPPORT) && defined(WLAN_FEATURE_11BE_MLO) +/** + * mlo_peer_populate_mesh_params() - Populate mesh parameters in ml_peer + * @ml_peer: ml_peer to which mesh config parameters need to be populated + * @ml_info: ml_info with mesh config associated with this link + * + * Return: void + */ +void mlo_peer_populate_mesh_params( + struct wlan_mlo_peer_context *ml_peer, + struct mlo_partner_info *ml_info); +#else +static inline +void mlo_peer_populate_mesh_params( + struct wlan_mlo_peer_context *ml_peer, + struct mlo_partner_info *ml_info) +{ +} +#endif + #ifdef UMAC_SUPPORT_MLNAWDS /** * mlo_peer_populate_nawds_params() - Populate nawds parameters in ml_peer diff --git a/umac/mlo_mgr/inc/wlan_mlo_mgr_peer.h b/umac/mlo_mgr/inc/wlan_mlo_mgr_peer.h index 78c54db854..b19192bc79 100644 --- a/umac/mlo_mgr/inc/wlan_mlo_mgr_peer.h +++ b/umac/mlo_mgr/inc/wlan_mlo_mgr_peer.h @@ -411,6 +411,20 @@ struct wlan_mlo_peer_context *wlan_mlo_get_mlpeer_by_linkmac( struct wlan_mlo_dev_context *ml_dev, struct qdf_mac_addr *link_mac); +/** + * wlan_mlo_get_mlpeer_by_mld_mac() - find ML peer by MLD MAC address + * @ml_dev: MLO DEV object + * @mld_mac: Peer MLD MAC address + * + * API to get ML peer using link MAC address + * + * Return: ML peer object, if it is found + * otherwise, returns NULL + */ +struct wlan_mlo_peer_context *wlan_mlo_get_mlpeer_by_mld_mac( + struct wlan_mlo_dev_context *ml_dev, + struct qdf_mac_addr *mld_mac); + /** * wlan_mlo_get_mlpeer_by_aid() - find ML peer by AID * @ml_dev: MLO DEV object @@ -539,6 +553,22 @@ static inline void wlan_peer_clear_mlo(struct wlan_objmgr_peer *peer) return wlan_peer_mlme_flag_ext_clear(peer, WLAN_PEER_FEXT_MLO); } +#if defined(MESH_MODE_SUPPORT) && defined(WLAN_FEATURE_11BE_MLO) +/** + * wlan_mlo_peer_is_mesh() - Check if ml_peer is configured to operate as MESH + * @ml_peer: MLO peer + * + * Return: TRUE if ml peer is configured as MESH + */ +bool wlan_mlo_peer_is_mesh(struct wlan_mlo_peer_context *ml_peer); +#else +static inline +bool wlan_mlo_peer_is_mesh(struct wlan_mlo_peer_context *ml_peer) +{ + return false; +} +#endif + #ifdef UMAC_SUPPORT_MLNAWDS /** * wlan_mlo_peer_is_nawds() - Check if ml_peer is configured to operate as NAWDS diff --git a/umac/mlo_mgr/inc/wlan_mlo_mgr_public_structs.h b/umac/mlo_mgr/inc/wlan_mlo_mgr_public_structs.h index 878f173a1d..09d8db576e 100644 --- a/umac/mlo_mgr/inc/wlan_mlo_mgr_public_structs.h +++ b/umac/mlo_mgr/inc/wlan_mlo_mgr_public_structs.h @@ -460,7 +460,7 @@ enum mlo_peer_state { ML_PEER_DISCONN_INITIATED, }; -#ifdef UMAC_SUPPORT_MLNAWDS +#if defined(UMAC_SUPPORT_MLNAWDS) || defined(MESH_MODE_SUPPORT) /* * struct mlnawds_config - MLO NAWDS configuration * @caps: Bandwidth & NSS capabilities to be configured on NAWDS peer @@ -697,6 +697,8 @@ struct wlan_mlo_mld_cap { * @msd_cap_present: Medium Sync Capability present bit * @mlpeer_emlcap: EML capability information for ML peer * @mlpeer_msdcap: Medium Sync Delay capability information for ML peer + * @is_mesh_ml_peer: flag to indicate if ml_peer is MESH configured + * @mesh_config: eack link peer's MESH configuration */ struct wlan_mlo_peer_context { qdf_list_node_t peer_node; @@ -730,6 +732,10 @@ struct wlan_mlo_peer_context { bool msd_cap_present; struct wlan_mlo_eml_cap mlpeer_emlcap; struct wlan_mlo_msd_cap mlpeer_msdcap; +#ifdef MESH_MODE_SUPPORT + bool is_mesh_ml_peer; + struct mlnawds_config mesh_config[MAX_MLO_LINK_PEERS]; +#endif }; /* @@ -739,6 +745,7 @@ struct wlan_mlo_peer_context { * @chan_freq: Operating channel frequency * @nawds_config: peer's NAWDS configurarion * @vdev_id: VDEV ID + * @mesh_config: peer's MESH configurarion */ struct mlo_link_info { struct qdf_mac_addr link_addr; @@ -748,6 +755,9 @@ struct mlo_link_info { struct mlnawds_config nawds_config; #endif uint8_t vdev_id; +#ifdef MESH_MODE_SUPPORT + struct mlnawds_config mesh_config; +#endif }; /* diff --git a/umac/mlo_mgr/src/wlan_mlo_mgr_ap.c b/umac/mlo_mgr/src/wlan_mlo_mgr_ap.c index c29bdc9cdf..cb692e79f3 100644 --- a/umac/mlo_mgr/src/wlan_mlo_mgr_ap.c +++ b/umac/mlo_mgr/src/wlan_mlo_mgr_ap.c @@ -26,6 +26,7 @@ #ifdef WLAN_MLO_MULTI_CHIP #include "cdp_txrx_mlo.h" #endif +#include "wlan_mlo_mgr_peer.h" #ifdef WLAN_MLO_MULTI_CHIP bool mlo_ap_vdev_attach(struct wlan_objmgr_vdev *vdev, @@ -480,18 +481,21 @@ bool mlo_ap_vdev_quiet_is_any_idx_set(struct wlan_objmgr_vdev *vdev) sizeof(mld_ctx->ap_ctx->mlo_vdev_quiet_bmap)); } -#ifdef UMAC_SUPPORT_MLNAWDS QDF_STATUS mlo_peer_create_get_frm_buf( struct wlan_mlo_peer_context *ml_peer, struct peer_create_notif_s *peer_create, qdf_nbuf_t frm_buf) { - if (ml_peer->is_nawds_ml_peer) { + if (wlan_mlo_peer_is_nawds(ml_peer) || + wlan_mlo_peer_is_mesh(ml_peer)) { peer_create->frm_buf = NULL; return QDF_STATUS_SUCCESS; } + if (!frm_buf) + return QDF_STATUS_E_FAILURE; + peer_create->frm_buf = qdf_nbuf_clone(frm_buf); if (!peer_create->frm_buf) return QDF_STATUS_E_NOMEM; @@ -499,6 +503,7 @@ mlo_peer_create_get_frm_buf( return QDF_STATUS_SUCCESS; } +#ifdef UMAC_SUPPORT_MLNAWDS void mlo_peer_populate_nawds_params( struct wlan_mlo_peer_context *ml_peer, struct mlo_partner_info *ml_info) @@ -512,7 +517,7 @@ void mlo_peer_populate_nawds_params( ml_peer->is_nawds_ml_peer = false; for (i = 0; i < ml_info->num_partner_links; i++) { nawds_config = ml_info->partner_link_info[i].nawds_config; - /** + /* * if ml_info->partner_link_info[i].nawds_config has valid * config(check for non-null mac or non-0 caps), then mark * ml_peer's is_nawds_ml_peer true & copy the config @@ -527,17 +532,34 @@ void mlo_peer_populate_nawds_params( } mlo_peer_lock_release(ml_peer); } -#else -QDF_STATUS -mlo_peer_create_get_frm_buf( - struct wlan_mlo_peer_context *ml_peer, - struct peer_create_notif_s *peer_create, - qdf_nbuf_t frm_buf) -{ - peer_create->frm_buf = qdf_nbuf_clone(frm_buf); - if (!peer_create->frm_buf) - return QDF_STATUS_E_NOMEM; +#endif - return QDF_STATUS_SUCCESS; +#ifdef MESH_MODE_SUPPORT +void mlo_peer_populate_mesh_params( + struct wlan_mlo_peer_context *ml_peer, + struct mlo_partner_info *ml_info) +{ + uint8_t i; + uint8_t null_mac[QDF_MAC_ADDR_SIZE] = {0}; + struct mlnawds_config mesh_config; + + mlo_peer_lock_acquire(ml_peer); + ml_peer->is_mesh_ml_peer = false; + for (i = 0; i < ml_info->num_partner_links; i++) { + mesh_config = ml_info->partner_link_info[i].mesh_config; + /* + * if ml_info->partner_link_info[i].mesh_config has valid + * config(check for non-null mac or non-0 caps), then mark + * ml_peer's is_mesh_ml_peer true & copy the config + */ + if ((mesh_config.caps) || + (qdf_mem_cmp(null_mac, + mesh_config.mac, + sizeof(null_mac)))) { + ml_peer->is_mesh_ml_peer = true; + ml_peer->mesh_config[i] = mesh_config; + } + } + mlo_peer_lock_release(ml_peer); } #endif diff --git a/umac/mlo_mgr/src/wlan_mlo_mgr_peer.c b/umac/mlo_mgr/src/wlan_mlo_mgr_peer.c index 141e15aa4e..cc583f7ba6 100644 --- a/umac/mlo_mgr/src/wlan_mlo_mgr_peer.c +++ b/umac/mlo_mgr/src/wlan_mlo_mgr_peer.c @@ -958,6 +958,7 @@ QDF_STATUS wlan_mlo_peer_create(struct wlan_objmgr_vdev *vdev, mlo_peer_populate_link_peer(ml_peer, link_peer); mlo_peer_populate_nawds_params(ml_peer, ml_info); + mlo_peer_populate_mesh_params(ml_peer, ml_info); if ((wlan_vdev_mlme_get_opmode(vdev) == QDF_SAP_MODE) || ((wlan_vdev_mlme_get_opmode(vdev) == QDF_STA_MODE) && @@ -1267,6 +1268,25 @@ bool wlan_mlo_peer_is_nawds(struct wlan_mlo_peer_context *ml_peer) qdf_export_symbol(wlan_mlo_peer_is_nawds); #endif +#ifdef MESH_MODE_SUPPORT +bool wlan_mlo_peer_is_mesh(struct wlan_mlo_peer_context *ml_peer) +{ + bool status = false; + + if (!ml_peer) + return status; + + mlo_peer_lock_acquire(ml_peer); + if (ml_peer->is_mesh_ml_peer) + status = true; + mlo_peer_lock_release(ml_peer); + + return status; +} + +qdf_export_symbol(wlan_mlo_peer_is_mesh); +#endif + #ifdef UMAC_MLO_AUTH_DEFER void mlo_peer_free_auth_param(struct mlpeer_auth_params *auth_params) { diff --git a/umac/mlo_mgr/src/wlan_mlo_mgr_peer_list.c b/umac/mlo_mgr/src/wlan_mlo_mgr_peer_list.c index 85121482fd..5e795bc87d 100644 --- a/umac/mlo_mgr/src/wlan_mlo_mgr_peer_list.c +++ b/umac/mlo_mgr/src/wlan_mlo_mgr_peer_list.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2021, The Linux Foundation. All rights reserved. - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-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 @@ -32,7 +32,7 @@ struct mlpeerid_search { uint16_t ml_peerid; }; -struct link_mac_search { +struct mac_addr_search { struct wlan_mlo_peer_context *ml_peer; struct qdf_mac_addr mac_addr; }; @@ -151,7 +151,7 @@ wlan_find_mlpeer_link_mac_addr(struct wlan_mlo_dev_context *ml_dev, void *iter_ml_peer, void *arg) { - struct link_mac_search *link_mac_arg = (struct link_mac_search *)arg; + struct mac_addr_search *link_mac_arg = (struct mac_addr_search *)arg; struct wlan_mlo_link_peer_entry *link_peer; struct wlan_mlo_peer_context *ml_peer; uint8_t i; @@ -176,6 +176,28 @@ wlan_find_mlpeer_link_mac_addr(struct wlan_mlo_dev_context *ml_dev, return QDF_STATUS_E_NOENT; } +static QDF_STATUS +wlan_find_mlpeer_mld_mac_addr(struct wlan_mlo_dev_context *ml_dev, + void *iter_ml_peer, + void *arg) +{ + struct mac_addr_search *mld_mac_arg = (struct mac_addr_search *)arg; + struct wlan_mlo_peer_context *ml_peer; + + ml_peer = (struct wlan_mlo_peer_context *)iter_ml_peer; + mlo_debug("MLD ID %d ML Peer mac " QDF_MAC_ADDR_FMT, + ml_dev->mld_id, + QDF_MAC_ADDR_REF(ml_peer->peer_mld_addr.bytes)); + + if (qdf_is_macaddr_equal(&mld_mac_arg->mac_addr, + &ml_peer->peer_mld_addr)) { + mld_mac_arg->ml_peer = ml_peer; + return QDF_STATUS_SUCCESS; + } + + return QDF_STATUS_E_NOENT; +} + static QDF_STATUS wlan_find_mlpeer_aid(struct wlan_mlo_dev_context *ml_dev, void *iter_ml_peer, void *arg) @@ -215,7 +237,7 @@ struct wlan_mlo_peer_context *wlan_mlo_get_mlpeer_by_linkmac( struct wlan_mlo_dev_context *ml_dev, struct qdf_mac_addr *link_mac) { - struct link_mac_search link_mac_arg; + struct mac_addr_search link_mac_arg; QDF_STATUS status; mlo_debug("MLD ID %d ML Peer search with link mac " QDF_MAC_ADDR_FMT, @@ -251,6 +273,27 @@ struct wlan_mlo_peer_context *wlan_mlo_get_mlpeer_by_aid( return NULL; } +struct wlan_mlo_peer_context *wlan_mlo_get_mlpeer_by_mld_mac( + struct wlan_mlo_dev_context *ml_dev, + struct qdf_mac_addr *mld_mac) +{ + struct mac_addr_search mld_mac_arg; + QDF_STATUS status; + + mlo_debug("MLD ID %d ML Peer search with mld mac " QDF_MAC_ADDR_FMT, + ml_dev->mld_id, QDF_MAC_ADDR_REF(mld_mac->bytes)); + qdf_copy_macaddr(&mld_mac_arg.mac_addr, mld_mac); + status = wlan_mlo_iterate_ml_peerlist(ml_dev, + wlan_find_mlpeer_mld_mac_addr, + &mld_mac_arg); + if (QDF_IS_STATUS_SUCCESS(status)) + return mld_mac_arg.ml_peer; + + /* TODO: Take ref */ + + return NULL; +} + struct wlan_mlo_peer_context *wlan_mlo_get_mlpeer_by_ml_peerid( struct wlan_mlo_dev_context *ml_dev, uint16_t ml_peerid)