qcacmn: DP peer changes for multi-chip MLO
DP peer changes required for multi-chip MLO. This change includes 1) Adding MLO peer to global peer hash at ML context 2) Add ML peer to all partner chips id to objtable Change-Id: I230a6c1b14484c587b190a9a318fe9ffb1caea11
This commit is contained in:

committed by
Madan Koyyalamudi

vanhempi
fb6af4edcd
commit
bbe062b4b7
@@ -19,6 +19,8 @@
|
||||
#include <hal_be_api.h>
|
||||
#include "dp_mlo.h"
|
||||
#include <dp_be.h>
|
||||
#include <dp_htt.h>
|
||||
#include <dp_internal.h>
|
||||
|
||||
/*
|
||||
* dp_mlo_ctxt_attach_wifi3 () – Attach DP MLO context
|
||||
@@ -38,6 +40,14 @@ dp_mlo_ctxt_attach_wifi3(struct cdp_ctrl_mlo_mgr *ctrl_ctxt)
|
||||
|
||||
mlo_ctxt->ctrl_ctxt = ctrl_ctxt;
|
||||
|
||||
if (dp_mlo_peer_find_hash_attach_be
|
||||
(mlo_ctxt, DP_MAX_MLO_PEER) != QDF_STATUS_SUCCESS) {
|
||||
dp_err("Failed to allocate peer hash");
|
||||
qdf_mem_free(mlo_ctxt);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
qdf_spinlock_create(&mlo_ctxt->ml_soc_list_lock);
|
||||
return dp_mlo_ctx_to_cdp(mlo_ctxt);
|
||||
}
|
||||
|
||||
@@ -50,9 +60,16 @@ qdf_export_symbol(dp_mlo_ctxt_attach_wifi3);
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
void dp_mlo_ctxt_detach_wifi3(struct cdp_mlo_ctxt *ml_ctxt)
|
||||
void dp_mlo_ctxt_detach_wifi3(struct cdp_mlo_ctxt *cdp_ml_ctxt)
|
||||
{
|
||||
qdf_mem_free(ml_ctxt);
|
||||
struct dp_mlo_ctxt *mlo_ctxt = cdp_mlo_ctx_to_dp(cdp_ml_ctxt);
|
||||
|
||||
if (!cdp_ml_ctxt)
|
||||
return;
|
||||
|
||||
qdf_spinlock_destroy(&mlo_ctxt->ml_soc_list_lock);
|
||||
dp_mlo_peer_find_hash_detach_be(mlo_ctxt);
|
||||
qdf_mem_free(mlo_ctxt);
|
||||
}
|
||||
|
||||
qdf_export_symbol(dp_mlo_ctxt_detach_wifi3);
|
||||
@@ -92,13 +109,50 @@ dp_mlo_get_soc_ref_by_chip_id(struct dp_mlo_ctxt *ml_ctxt,
|
||||
struct dp_soc *soc = NULL;
|
||||
|
||||
qdf_spin_lock_bh(&ml_ctxt->ml_soc_list_lock);
|
||||
qdf_atomic_inc(&soc->ref_count);
|
||||
soc = ml_ctxt->ml_soc_list[chip_id];
|
||||
|
||||
if (!soc) {
|
||||
qdf_spin_unlock_bh(&ml_ctxt->ml_soc_list_lock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
qdf_atomic_inc(&soc->ref_count);
|
||||
qdf_spin_unlock_bh(&ml_ctxt->ml_soc_list_lock);
|
||||
|
||||
return soc;
|
||||
}
|
||||
|
||||
static void dp_mlo_soc_setup(struct cdp_soc_t *soc_hdl,
|
||||
struct cdp_mlo_ctxt *cdp_ml_ctxt)
|
||||
{
|
||||
struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
|
||||
struct dp_mlo_ctxt *mlo_ctxt = cdp_mlo_ctx_to_dp(cdp_ml_ctxt);
|
||||
struct dp_soc_be *be_soc = dp_get_be_soc_from_dp_soc(soc);
|
||||
|
||||
if (!cdp_ml_ctxt)
|
||||
return;
|
||||
|
||||
dp_mlo_set_soc_by_chip_id(mlo_ctxt, soc, be_soc->mlo_chip_id);
|
||||
}
|
||||
|
||||
static void dp_mlo_soc_teardown(struct cdp_soc_t *soc_hdl,
|
||||
struct cdp_mlo_ctxt *cdp_ml_ctxt)
|
||||
{
|
||||
struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
|
||||
struct dp_mlo_ctxt *mlo_ctxt = cdp_mlo_ctx_to_dp(cdp_ml_ctxt);
|
||||
struct dp_soc_be *be_soc = dp_get_be_soc_from_dp_soc(soc);
|
||||
|
||||
if (!cdp_ml_ctxt)
|
||||
return;
|
||||
|
||||
dp_mlo_set_soc_by_chip_id(mlo_ctxt, NULL, be_soc->mlo_chip_id);
|
||||
}
|
||||
|
||||
static struct cdp_mlo_ops dp_mlo_ops = {
|
||||
.mlo_soc_setup = dp_mlo_soc_setup,
|
||||
.mlo_soc_teardown = dp_mlo_soc_teardown,
|
||||
};
|
||||
|
||||
void dp_soc_mlo_fill_params(struct dp_soc *soc,
|
||||
struct cdp_soc_attach_params *params)
|
||||
{
|
||||
@@ -112,6 +166,7 @@ void dp_soc_mlo_fill_params(struct dp_soc *soc,
|
||||
be_soc->mlo_chip_id = params->mlo_chip_id;
|
||||
be_soc->ml_ctxt = cdp_mlo_ctx_to_dp(params->ml_context);
|
||||
be_soc->mlo_enabled = 1;
|
||||
soc->cdp_soc.ops->mlo_ops = &dp_mlo_ops;
|
||||
}
|
||||
|
||||
void dp_pdev_mlo_fill_params(struct dp_pdev *pdev,
|
||||
@@ -127,3 +182,110 @@ void dp_pdev_mlo_fill_params(struct dp_pdev *pdev,
|
||||
|
||||
be_pdev->mlo_link_id = params->mlo_link_id;
|
||||
}
|
||||
|
||||
void dp_mlo_partner_chips_map(struct dp_soc *soc,
|
||||
struct dp_peer *peer,
|
||||
uint16_t peer_id)
|
||||
{
|
||||
struct dp_soc_be *be_soc = dp_get_be_soc_from_dp_soc(soc);
|
||||
struct dp_mlo_ctxt *mlo_ctxt = be_soc->ml_ctxt;
|
||||
bool is_ml_peer_id = peer_id & HTT_RX_PEER_META_DATA_V1_ML_PEER_VALID_S;
|
||||
uint8_t chip_id;
|
||||
struct dp_soc *temp_soc;
|
||||
|
||||
if (!mlo_ctxt)
|
||||
return;
|
||||
|
||||
/* for non ML peer dont map on partner chips*/
|
||||
if (!is_ml_peer_id)
|
||||
return;
|
||||
|
||||
qdf_spin_lock_bh(&mlo_ctxt->ml_soc_list_lock);
|
||||
for (chip_id = 0; chip_id < DP_MAX_MLO_CHIPS; chip_id++) {
|
||||
temp_soc = mlo_ctxt->ml_soc_list[chip_id];
|
||||
|
||||
if (!temp_soc)
|
||||
continue;
|
||||
|
||||
/* skip if this is current soc */
|
||||
if (temp_soc == soc)
|
||||
continue;
|
||||
|
||||
dp_peer_find_id_to_obj_add(temp_soc, peer, peer_id);
|
||||
}
|
||||
qdf_spin_unlock_bh(&mlo_ctxt->ml_soc_list_lock);
|
||||
}
|
||||
|
||||
qdf_export_symbol(dp_mlo_partner_chips_map);
|
||||
|
||||
void dp_mlo_partner_chips_unmap(struct dp_soc *soc,
|
||||
uint16_t peer_id)
|
||||
{
|
||||
struct dp_soc_be *be_soc = dp_get_be_soc_from_dp_soc(soc);
|
||||
struct dp_mlo_ctxt *mlo_ctxt = be_soc->ml_ctxt;
|
||||
bool is_ml_peer_id = peer_id & HTT_RX_PEER_META_DATA_V1_ML_PEER_VALID_S;
|
||||
uint8_t chip_id;
|
||||
struct dp_soc *temp_soc;
|
||||
|
||||
if (!is_ml_peer_id)
|
||||
return;
|
||||
|
||||
if (!mlo_ctxt)
|
||||
return;
|
||||
|
||||
qdf_spin_lock_bh(&mlo_ctxt->ml_soc_list_lock);
|
||||
for (chip_id = 0; chip_id < DP_MAX_MLO_CHIPS; chip_id++) {
|
||||
temp_soc = mlo_ctxt->ml_soc_list[chip_id];
|
||||
|
||||
if (!temp_soc)
|
||||
continue;
|
||||
|
||||
/* skip if this is current soc */
|
||||
if (temp_soc == soc)
|
||||
continue;
|
||||
|
||||
dp_peer_find_id_to_obj_remove(temp_soc, peer_id);
|
||||
}
|
||||
qdf_spin_unlock_bh(&mlo_ctxt->ml_soc_list_lock);
|
||||
}
|
||||
|
||||
qdf_export_symbol(dp_mlo_partner_chips_unmap);
|
||||
|
||||
uint8_t dp_mlo_get_chip_id(struct dp_soc *soc)
|
||||
{
|
||||
struct dp_soc_be *be_soc = dp_get_be_soc_from_dp_soc(soc);
|
||||
|
||||
return be_soc->mlo_chip_id;
|
||||
}
|
||||
|
||||
qdf_export_symbol(dp_mlo_get_chip_id);
|
||||
|
||||
struct dp_peer *
|
||||
dp_link_peer_hash_find_by_chip_id(struct dp_soc *soc,
|
||||
uint8_t *peer_mac_addr,
|
||||
int mac_addr_is_aligned,
|
||||
uint8_t vdev_id,
|
||||
uint8_t chip_id,
|
||||
enum dp_mod_id mod_id)
|
||||
{
|
||||
struct dp_soc_be *be_soc = dp_get_be_soc_from_dp_soc(soc);
|
||||
struct dp_mlo_ctxt *mlo_ctxt = be_soc->ml_ctxt;
|
||||
struct dp_soc *link_peer_soc = NULL;
|
||||
struct dp_peer *peer = NULL;
|
||||
|
||||
if (!mlo_ctxt)
|
||||
return NULL;
|
||||
|
||||
link_peer_soc = dp_mlo_get_soc_ref_by_chip_id(mlo_ctxt, chip_id);
|
||||
|
||||
if (!link_peer_soc)
|
||||
return NULL;
|
||||
|
||||
peer = dp_peer_find_hash_find(link_peer_soc, peer_mac_addr,
|
||||
mac_addr_is_aligned, vdev_id,
|
||||
mod_id);
|
||||
qdf_atomic_dec(&link_peer_soc->ref_count);
|
||||
return peer;
|
||||
}
|
||||
|
||||
qdf_export_symbol(dp_link_peer_hash_find_by_chip_id);
|
||||
|
@@ -17,10 +17,13 @@
|
||||
#define __DP_MLO_H
|
||||
|
||||
#include <dp_types.h>
|
||||
#include <dp_peer.h>
|
||||
|
||||
/* Max number of chips that can participate in MLO */
|
||||
#define DP_MAX_MLO_CHIPS 3
|
||||
|
||||
/* Max number of peers supported */
|
||||
#define DP_MAX_MLO_PEER 512
|
||||
/*
|
||||
* dp_mlo_ctxt
|
||||
*
|
||||
@@ -28,9 +31,9 @@
|
||||
* @ml_soc_list: list of socs which are mlo enabled. This also maintains
|
||||
* mlo_chip_id to dp_soc mapping
|
||||
* @ml_soc_list_lock: lock to protect ml_soc_list
|
||||
* @ml_peer_hash: peer hash table for ML peers
|
||||
* @mld_peer_hash: peer hash table for ML peers
|
||||
* Associated peer with this MAC address)
|
||||
* @ml_peer_hash_lock: lock to protect ml_peer_hash
|
||||
* @mld_peer_hash_lock: lock to protect mld_peer_hash
|
||||
*/
|
||||
struct dp_mlo_ctxt {
|
||||
struct cdp_ctrl_mlo_mgr *ctrl_ctxt;
|
||||
@@ -41,9 +44,9 @@ struct dp_mlo_ctxt {
|
||||
uint32_t idx_bits;
|
||||
|
||||
TAILQ_HEAD(, dp_peer) * bins;
|
||||
} ml_peer_hash;
|
||||
} mld_peer_hash;
|
||||
|
||||
qdf_spinlock_t ml_peer_hash_lock;
|
||||
qdf_spinlock_t mld_peer_hash_lock;
|
||||
};
|
||||
|
||||
/**
|
||||
|
Viittaa uudesa ongelmassa
Block a user