From aa8703f4732dca32b34d117d1ddce0e345723f9a Mon Sep 17 00:00:00 2001 From: Rhythm Patwa Date: Thu, 2 Mar 2023 01:43:19 -0800 Subject: [PATCH] qcacmn: Add support to find ML peer from MLD MAC Add API to retrieve ML peer context using peer MLD address from the list of MLDs. Change-Id: I7136e6b9cbcc96e897457c01c187965978e85d77 CRs-Fixed: 3422684 --- umac/mlo_mgr/inc/wlan_mlo_mgr_main.h | 24 ++++++++++++++++ umac/mlo_mgr/inc/wlan_mlo_mgr_peer.h | 13 +++++++++ umac/mlo_mgr/inc/wlan_mlo_t2lm.h | 5 ++++ umac/mlo_mgr/src/wlan_mlo_mgr_main.c | 17 ++++++------ umac/mlo_mgr/src/wlan_mlo_mgr_peer_list.c | 34 ++++++++++++++++++++++- 5 files changed, 83 insertions(+), 10 deletions(-) diff --git a/umac/mlo_mgr/inc/wlan_mlo_mgr_main.h b/umac/mlo_mgr/inc/wlan_mlo_mgr_main.h index 8203a6b2b5..9b6d4cf889 100644 --- a/umac/mlo_mgr/inc/wlan_mlo_mgr_main.h +++ b/umac/mlo_mgr/inc/wlan_mlo_mgr_main.h @@ -886,6 +886,30 @@ uint8_t wlan_mlo_get_sta_mld_ctx_count(void); struct wlan_mlo_dev_context *wlan_mlo_get_mld_ctx_by_mldaddr(struct qdf_mac_addr *mldaddr); +/** + * wlan_mlo_list_peek_head() - Returns the head of linked list + * + * @ml_list: Pointer to the list of MLDs + * + * API to retrieve the head from the list of active MLDs + * + * Return: Pointer to mlo device context + */ +struct wlan_mlo_dev_context *wlan_mlo_list_peek_head(qdf_list_t *ml_list); + +/** + * wlan_mlo_get_next_mld_ctx() - Return next mlo dev node from the list + * + * @ml_list: Pointer to the list of MLDs + * @mld_cur: Pointer to the current mlo dev node + * + * API to retrieve the next node from the list of active MLDs + * + * Return: Pointer to mlo device context + */ +struct wlan_mlo_dev_context *wlan_mlo_get_next_mld_ctx(qdf_list_t *ml_list, + struct wlan_mlo_dev_context *mld_cur); + /** * wlan_mlo_check_valid_config() - Check vap config is valid for mld * diff --git a/umac/mlo_mgr/inc/wlan_mlo_mgr_peer.h b/umac/mlo_mgr/inc/wlan_mlo_mgr_peer.h index 5930f36cd1..ac59b22059 100644 --- a/umac/mlo_mgr/inc/wlan_mlo_mgr_peer.h +++ b/umac/mlo_mgr/inc/wlan_mlo_mgr_peer.h @@ -434,6 +434,19 @@ 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_peer_mladdr() - Get ML peer from the list of MLD's + * using MLD MAC address + * + * @mldaddr: MAC address of the ML peer + * @mldev: Update corresponding ML dev context in which peer is found + * + * Return: Pointer to mlo peer context + */ +struct wlan_mlo_peer_context +*wlan_mlo_get_mlpeer_by_peer_mladdr(struct qdf_mac_addr *mldaddr, + struct wlan_mlo_dev_context **mldev); + /** * wlan_mlo_get_mlpeer_by_aid() - find ML peer by AID * @ml_dev: MLO DEV object diff --git a/umac/mlo_mgr/inc/wlan_mlo_t2lm.h b/umac/mlo_mgr/inc/wlan_mlo_t2lm.h index 6e257b684a..821809b740 100644 --- a/umac/mlo_mgr/inc/wlan_mlo_t2lm.h +++ b/umac/mlo_mgr/inc/wlan_mlo_t2lm.h @@ -103,11 +103,16 @@ enum wlan_link_band_caps { * is present. * @pref_order: Preferred links in order.it is in form of hardware link id. * @timeout: timeout values for all the access categories. + * @tlt_characterization_params: Bitmask to select Tx-Link Tuple from ordered + * list. + * Bit 0-15: Each bit maps to the corresponding Link ID + * Bit 16-31: Reserved */ struct wlan_link_preference { uint8_t num_pref_links; uint8_t pref_order[MAX_PREFERRED_LINKS]; uint32_t timeout[WIFI_AC_MAX]; + uint32_t tlt_characterization_params; }; /** diff --git a/umac/mlo_mgr/src/wlan_mlo_mgr_main.c b/umac/mlo_mgr/src/wlan_mlo_mgr_main.c index ca0e7a8f06..1744dee053 100644 --- a/umac/mlo_mgr/src/wlan_mlo_mgr_main.c +++ b/umac/mlo_mgr/src/wlan_mlo_mgr_main.c @@ -179,7 +179,7 @@ QDF_STATUS wlan_mlo_mgr_deinit(void) return status; } -static inline struct wlan_mlo_dev_context *mlo_list_peek_head( +struct wlan_mlo_dev_context *wlan_mlo_list_peek_head( qdf_list_t *ml_list) { struct wlan_mlo_dev_context *mld_ctx; @@ -195,8 +195,7 @@ static inline struct wlan_mlo_dev_context *mlo_list_peek_head( return mld_ctx; } -static inline -struct wlan_mlo_dev_context *mlo_get_next_mld_ctx(qdf_list_t *ml_list, +struct wlan_mlo_dev_context *wlan_mlo_get_next_mld_ctx(qdf_list_t *ml_list, struct wlan_mlo_dev_context *mld_cur) { struct wlan_mlo_dev_context *mld_next; @@ -230,13 +229,13 @@ uint8_t wlan_mlo_get_sta_mld_ctx_count(void) ml_link_lock_acquire(mlo_mgr_ctx); ml_list = &mlo_mgr_ctx->ml_dev_list; /* Get first mld context */ - mld_cur = mlo_list_peek_head(ml_list); + mld_cur = wlan_mlo_list_peek_head(ml_list); while (mld_cur) { /* get next mld node */ if (mld_cur->sta_ctx) count++; - mld_next = mlo_get_next_mld_ctx(ml_list, mld_cur); + mld_next = wlan_mlo_get_next_mld_ctx(ml_list, mld_cur); mld_cur = mld_next; } ml_link_lock_release(mlo_mgr_ctx); @@ -258,7 +257,7 @@ struct wlan_mlo_dev_context ml_link_lock_acquire(mlo_mgr_ctx); ml_list = &mlo_mgr_ctx->ml_dev_list; /* Get first mld context */ - mld_cur = mlo_list_peek_head(ml_list); + mld_cur = wlan_mlo_list_peek_head(ml_list); /** * Iterate through ml list, till ml mldaddr matches with * entry of list @@ -270,7 +269,7 @@ struct wlan_mlo_dev_context return mld_cur; } /* get next mld node */ - mld_next = mlo_get_next_mld_ctx(ml_list, mld_cur); + mld_next = wlan_mlo_get_next_mld_ctx(ml_list, mld_cur); mld_cur = mld_next; } ml_link_lock_release(mlo_mgr_ctx); @@ -310,7 +309,7 @@ bool mlo_mgr_ml_peer_exist_on_diff_ml_ctx(uint8_t *peer_addr, if (!qdf_list_size(ml_list)) goto g_ml_ref; - mld_cur = mlo_list_peek_head(ml_list); + mld_cur = wlan_mlo_list_peek_head(ml_list); while (mld_cur) { mlo_dev_lock_acquire(mld_cur); if (qdf_is_macaddr_equal(&mld_cur->mld_addr, @@ -369,7 +368,7 @@ bool mlo_mgr_ml_peer_exist_on_diff_ml_ctx(uint8_t *peer_addr, } ml_peerlist_lock_release(mlo_peer_list); - mld_next = mlo_get_next_mld_ctx(ml_list, mld_cur); + mld_next = wlan_mlo_get_next_mld_ctx(ml_list, mld_cur); mlo_dev_lock_release(mld_cur); mld_cur = mld_next; } 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 f53307b29f..2e47c1f900 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-2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2023 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 @@ -294,6 +294,38 @@ struct wlan_mlo_peer_context *wlan_mlo_get_mlpeer_by_mld_mac( return NULL; } +struct wlan_mlo_peer_context +*wlan_mlo_get_mlpeer_by_peer_mladdr(struct qdf_mac_addr *mldaddr, + struct wlan_mlo_dev_context **mldev) +{ + struct wlan_mlo_dev_context *mld_cur; + struct wlan_mlo_dev_context *mld_next; + struct wlan_mlo_peer_context *ml_peer; + qdf_list_t *ml_list; + struct mlo_mgr_context *mlo_mgr_ctx = wlan_objmgr_get_mlo_ctx(); + + if (!mlo_mgr_ctx) + return NULL; + + ml_link_lock_acquire(mlo_mgr_ctx); + ml_list = &mlo_mgr_ctx->ml_dev_list; + mld_cur = wlan_mlo_list_peek_head(ml_list); + + while (mld_cur) { + ml_peer = mlo_get_mlpeer(mld_cur, mldaddr); + if (ml_peer != NULL) { + *mldev = mld_cur; + ml_link_lock_release(mlo_mgr_ctx); + return ml_peer; + } + mld_next = wlan_mlo_get_next_mld_ctx(ml_list, mld_cur); + mld_cur = mld_next; + } + ml_link_lock_release(mlo_mgr_ctx); + + 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)