qcacld-3.0: cdp: Convergence of cdp_ocb_ops

Currently the cdp apis are given pdev/vdev/peer
handle as its arguments, which is directly
accessed in those APIs. This can cause a
race-condition in access of the respective
handles if it has been deleted in parallel.

Hence as a part of cdp convergence, pass only
the pdev/vdev id or peer mac address, which will be
used to get the respective handles, and hence
avoiding the unwanted access of the handles if
it has been deleted.

Converged ocb_ops
- set_ocb_chan_info
- get_ocb_chan_info

CRs-Fixed: 2539745
Change-Id: I7de53c48ec6b7f0c09be7c9cf642d8cf4f8eae78
This commit is contained in:
Rakesh Pillai 2019-07-07 00:38:25 +05:30 committed by nshrivas
parent 82555082c9
commit 84714471df
6 changed files with 40 additions and 25 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2019 The Linux Foundation. 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
@ -82,7 +82,7 @@ enum ocb_southbound_event {
* @ocb_channel_count: channel count
* @channel_config: current channel configurations
* @dp_soc: psoc data path handle
* @dp_pdev: pdev data path handle
* @dp_pdev_id: pdev data path ID
* @ocb_cbs: legacy callback functions
* @ocb_txops: tx opertions for target interface
* @ocb_rxops: rx opertions for target interface
@ -93,7 +93,7 @@ struct ocb_pdev_obj {
uint32_t ocb_channel_count;
struct ocb_config *channel_config;
void *dp_soc;
void *dp_pdev;
uint8_t dp_pdev_id;
struct ocb_callbacks ocb_cbs;
struct wlan_ocb_tx_ops ocb_txops;
struct wlan_ocb_rx_ops ocb_rxops;

View File

@ -92,7 +92,7 @@ static QDF_STATUS ocb_set_chan_info(void *dp_soc,
ocb_set_chan.ocb_channel_count = config->channel_count;
/* release old settings */
ocb_channel_info = cdp_get_ocb_chan_info(dp_soc, dp_vdev);
ocb_channel_info = cdp_get_ocb_chan_info(dp_soc, vdev_id);
if (ocb_channel_info)
qdf_mem_free(ocb_channel_info);
@ -118,7 +118,7 @@ static QDF_STATUS ocb_set_chan_info(void *dp_soc,
ocb_set_chan.ocb_channel_info = NULL;
}
ocb_debug("Sync channel config to dp");
cdp_set_ocb_chan_info(dp_soc, dp_vdev, ocb_set_chan);
cdp_set_ocb_chan_info(dp_soc, vdev_id, ocb_set_chan);
return QDF_STATUS_SUCCESS;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2019 The Linux Foundation. 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
@ -194,14 +194,14 @@ QDF_STATUS ucfg_ocb_update_dp_handle(struct wlan_objmgr_psoc *soc,
void *dp_soc);
/**
* ucfg_ocb_set_txrx_handle() - register pdev txrx handler
* ucfg_ocb_set_txrx_pdev_id() - register txrx pdev id
* @soc: soc handle
* @txrx_handle: data path pdev txrx handle
* @pdev_id: data path pdev ID
*
* Return: QDF_STATUS_SUCCESS on success
*/
QDF_STATUS ucfg_ocb_set_txrx_handle(struct wlan_objmgr_psoc *psoc,
void *txrx_handle);
QDF_STATUS ucfg_ocb_set_txrx_pdev_id(struct wlan_objmgr_psoc *psoc,
uint8_t pdev_id);
#else
/**
* ucfg_ocb_init() - OCB module initialization
@ -274,15 +274,15 @@ QDF_STATUS ucfg_ocb_update_dp_handle(struct wlan_objmgr_psoc *soc,
}
/**
* ucfg_ocb_set_txrx_handle() - register pdev txrx handler
* ucfg_ocb_set_txrx_pdev_id() - register txrx pdev id
* @soc: soc handle
* @txrx_handle: data path pdev txrx handle
* @pdev_id: data path pdev ID
*
* Return: QDF_STATUS_SUCCESS on success
*/
static inline
QDF_STATUS ucfg_ocb_set_txrx_handle(struct wlan_objmgr_psoc *psoc,
void *txrx_handle)
QDF_STATUS ucfg_ocb_set_txrx_pdev_id(struct wlan_objmgr_psoc *psoc,
uint8_t pdev_id)
{
return QDF_STATUS_SUCCESS;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2019 The Linux Foundation. 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
@ -133,8 +133,8 @@ QDF_STATUS ocb_psoc_disable(struct wlan_objmgr_psoc *psoc)
return QDF_STATUS_SUCCESS;
}
QDF_STATUS ucfg_ocb_set_txrx_handle(struct wlan_objmgr_psoc *psoc,
void *txrx_handle)
QDF_STATUS ucfg_ocb_set_txrx_pdev_id(struct wlan_objmgr_psoc *psoc,
uint8_t pdev_id)
{
struct wlan_objmgr_pdev *pdev;
struct ocb_pdev_obj *ocb_obj;
@ -151,7 +151,7 @@ QDF_STATUS ucfg_ocb_set_txrx_handle(struct wlan_objmgr_psoc *psoc,
ocb_err("OCB object is NULL");
return QDF_STATUS_E_FAILURE;
}
ocb_obj->dp_pdev = txrx_handle;
ocb_obj->dp_pdev_id = pdev_id;
return QDF_STATUS_SUCCESS;
}

View File

@ -817,7 +817,7 @@ QDF_STATUS cds_dp_open(struct wlan_objmgr_psoc *psoc)
goto intr_close;
ucfg_pmo_psoc_set_txrx_handle(psoc, gp_cds_context->pdev_txrx_ctx);
ucfg_ocb_set_txrx_handle(psoc, gp_cds_context->pdev_txrx_ctx);
ucfg_ocb_set_txrx_pdev_id(psoc, WMI_PDEV_ID_SOC);
cds_debug("CDS successfully Opened");

View File

@ -2687,15 +2687,23 @@ ol_txrx_remove_peers_for_vdev_no_lock(struct cdp_vdev *pvdev,
#ifdef WLAN_FEATURE_DSRC
/**
* ol_txrx_set_ocb_chan_info() - set OCB channel info to vdev.
* @vdev: vdev handle
* @soc_hdl: Datapath soc handle
* @vdev_id: id of vdev
* @ocb_set_chan: OCB channel information to be set in vdev.
*
* Return: NONE
*/
static void ol_txrx_set_ocb_chan_info(struct cdp_vdev *pvdev,
static void
ol_txrx_set_ocb_chan_info(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
struct ol_txrx_ocb_set_chan ocb_set_chan)
{
struct ol_txrx_vdev_t *vdev = (struct ol_txrx_vdev_t *)pvdev;
struct ol_txrx_vdev_t *vdev =
(struct ol_txrx_vdev_t *)ol_txrx_get_vdev_from_vdev_id(vdev_id);
if (qdf_unlikely(!vdev)) {
ol_txrx_err("pdev is NULL");
return;
}
vdev->ocb_channel_info = ocb_set_chan.ocb_channel_info;
vdev->ocb_channel_count = ocb_set_chan.ocb_channel_count;
@ -2703,14 +2711,21 @@ static void ol_txrx_set_ocb_chan_info(struct cdp_vdev *pvdev,
/**
* ol_txrx_get_ocb_chan_info() - return handle to vdev ocb_channel_info
* @vdev: vdev handle
* @soc_hdl: Datapath soc handle
* @vdev_id: id of vdev
*
* Return: handle to struct ol_txrx_ocb_chan_info
*/
static struct ol_txrx_ocb_chan_info *
ol_txrx_get_ocb_chan_info(struct cdp_vdev *pvdev)
ol_txrx_get_ocb_chan_info(struct cdp_soc_t *soc_hdl, uint8_t vdev_id)
{
struct ol_txrx_vdev_t *vdev = (struct ol_txrx_vdev_t *)pvdev;
struct ol_txrx_vdev_t *vdev =
(struct ol_txrx_vdev_t *)ol_txrx_get_vdev_from_vdev_id(vdev_id);
if (qdf_unlikely(!vdev)) {
ol_txrx_err("pdev is NULL");
return NULL;
}
return vdev->ocb_channel_info;
}