qcacmn: Use qdf_bitmap for vdev bitmap in psoc

The current bitmap used for vdevs in psoc is a two element
array of 32bit, thus supporting upto 64 bits bitmap.

In certain feature of AP use cases, there could be more
than 64 vdevs of multiple radios of a psoc, so the current
bitmap would not suffice.

Use the qdf_bitmap to define bitmap based on the max vdevs
supported by a psoc, which could be defined to higher value than
64 if a given AP feature is enabled.

CRs-Fixed: 2678131
Change-Id: Icd72f8dbe4654180dab993e3ce35d886c9e6ca43
This commit is contained in:
Vivek 2020-05-05 00:02:58 +05:30 • committed by nshrivas
commit d73181f045
4 changed files with 29 additions and 35 deletions

View file

@ -67,6 +67,10 @@
#define objmgr_nofl_debug(params...) \
QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_OBJ_MGR, params)
#define obj_mgr_debug_hex(ptr, size) \
qdf_trace_hex_dump(QDF_MODULE_ID_OBJ_MGR, \
QDF_TRACE_LEVEL_DEBUG, ptr, size)
/**
* enum WLAN_OBJ_STATE - State of Object
* @WLAN_OBJ_STATE_ALLOCATED: Common object is allocated, but not

View file

@ -830,6 +830,9 @@ static inline void wlan_pdev_reset_ospriv(struct wlan_objmgr_pdev *pdev)
static inline void wlan_pdev_set_max_vdev_count(struct wlan_objmgr_pdev *pdev,
uint8_t max_vdev_count)
{
if (max_vdev_count > WLAN_UMAC_PDEV_MAX_VDEVS)
QDF_BUG(0);
pdev->pdev_objmgr.max_vdev_count = max_vdev_count;
}

View file

@ -305,7 +305,7 @@ struct wlan_objmgr_psoc_objmgr {
uint16_t temp_peer_count;
struct wlan_objmgr_pdev *wlan_pdev_list[WLAN_UMAC_MAX_PDEVS];
struct wlan_objmgr_vdev *wlan_vdev_list[WLAN_UMAC_PSOC_MAX_VDEVS];
uint32_t wlan_vdev_id_map[2];
qdf_bitmap(wlan_vdev_id_map, WLAN_UMAC_PSOC_MAX_VDEVS);
struct wlan_peer_list peer_list;
qdf_atomic_t ref_cnt;
qdf_atomic_t ref_id_dbg[WLAN_REF_ID_MAX];
@ -1555,6 +1555,9 @@ static inline void wlan_psoc_set_qdf_dev(
static inline void wlan_psoc_set_max_vdev_count(struct wlan_objmgr_psoc *psoc,
uint8_t max_vdev_count)
{
if (max_vdev_count > WLAN_UMAC_PSOC_MAX_VDEVS)
QDF_BUG(0);
psoc->soc_objmgr.max_vdev_count = max_vdev_count;
}
@ -1584,6 +1587,9 @@ static inline uint8_t wlan_psoc_get_max_vdev_count(
static inline void wlan_psoc_set_max_peer_count(struct wlan_objmgr_psoc *psoc,
uint16_t max_peer_count)
{
if (max_peer_count > WLAN_UMAC_PSOC_MAX_PEERS)
QDF_BUG(0);
psoc->soc_objmgr.max_peer_count = max_peer_count;
}

View file

@ -872,32 +872,23 @@ QDF_STATUS wlan_objmgr_psoc_vdev_attach(struct wlan_objmgr_psoc *psoc,
{
struct wlan_objmgr_psoc_objmgr *objmgr;
uint8_t id = 0;
uint8_t map_index = 0;
uint8_t map_entry_size = 32;
uint8_t adjust_ix = 0;
QDF_STATUS status;
wlan_psoc_obj_lock(psoc);
objmgr = &psoc->soc_objmgr;
/* Find first free vdev id */
while ((id < objmgr->max_vdev_count) &&
(objmgr->wlan_vdev_id_map[map_index] & (1<<(id - adjust_ix)))) {
id++;
/*
* The map is two DWORDS(32 bits), so, map_index
* adjust_ix derived based on the id value
*/
if (id == ((map_index + 1) * map_entry_size)) {
map_index++;
adjust_ix = map_index * map_entry_size;
while ((id < objmgr->max_vdev_count)) {
if (qdf_test_bit(id, objmgr->wlan_vdev_id_map)) {
id++;
continue;
}
break;
}
/* If no free slot, return failure */
if (id == objmgr->max_vdev_count) {
status = QDF_STATUS_E_FAILURE;
} else {
if (id < objmgr->max_vdev_count) {
/* set free vdev id index */
objmgr->wlan_vdev_id_map[map_index] |= (1<<(id-adjust_ix));
qdf_set_bit(id, objmgr->wlan_vdev_id_map);
/* store vdev pointer in vdev list */
objmgr->wlan_vdev_list[id] = vdev;
/* increment vdev counter */
@ -905,6 +896,8 @@ QDF_STATUS wlan_objmgr_psoc_vdev_attach(struct wlan_objmgr_psoc *psoc,
/* save vdev id */
vdev->vdev_objmgr.vdev_id = id;
status = QDF_STATUS_SUCCESS;
} else {
status = QDF_STATUS_E_FAILURE;
}
wlan_psoc_obj_unlock(psoc);
@ -916,26 +909,16 @@ QDF_STATUS wlan_objmgr_psoc_vdev_detach(struct wlan_objmgr_psoc *psoc,
{
struct wlan_objmgr_psoc_objmgr *objmgr;
uint8_t id = 0;
uint8_t map_index = 0;
uint8_t map_entry_size = 32;
uint8_t adjust_ix = 0;
id = vdev->vdev_objmgr.vdev_id;
/* Invalid vdev id */
if (id >= wlan_psoc_get_max_vdev_count(psoc))
return QDF_STATUS_E_FAILURE;
/*
* Derive map_index and adjust_ix to find actual DWORD
* the id map is present
*/
while ((id - adjust_ix) >= map_entry_size) {
map_index++;
adjust_ix = map_index * map_entry_size;
}
wlan_psoc_obj_lock(psoc);
objmgr = &psoc->soc_objmgr;
/* unset bit, to free the slot */
objmgr->wlan_vdev_id_map[map_index] &= ~(1<<(id-adjust_ix));
qdf_clear_bit(id, objmgr->wlan_vdev_id_map);
/* reset VDEV pointer to NULL in VDEV list array */
objmgr->wlan_vdev_list[id] = NULL;
/* decrement vdev count */
@ -2999,11 +2982,9 @@ void wlan_print_psoc_info(struct wlan_objmgr_psoc *psoc)
obj_mgr_debug("ref_cnt: %d", qdf_atomic_read(&psoc_objmgr->ref_cnt));
obj_mgr_debug("qdf_dev: %pK", psoc_objmgr->qdf_dev);
obj_mgr_debug("wlan_vdev_id_map[%d]: 0x%x",
index, psoc_objmgr->wlan_vdev_id_map[index]);
index++;
obj_mgr_debug("wlan_vdev_id_map[%d]: 0x%x",
index, psoc_objmgr->wlan_vdev_id_map[index]);
obj_mgr_debug("wlan_vdev_id_map:");
obj_mgr_debug_hex(psoc_objmgr->wlan_vdev_id_map,
sizeof(psoc_objmgr->wlan_vdev_id_map));
wlan_objmgr_for_each_psoc_pdev(psoc, index, pdev) {
obj_mgr_debug("wlan_pdev_list[%d]: %pK", index, pdev);