blob: 2f8b6cce7b19474b961f9a53fe4fcc4eb0a68cc1 [file] [log] [blame]
/*
* Copyright (c) 2017-2018 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
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include <wlan_objmgr_pdev_obj.h>
#include <dp_txrx.h>
#include <cdp_txrx_cmn.h>
QDF_STATUS dp_txrx_init(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
struct dp_txrx_config *config)
{
struct dp_txrx_handle *dp_ext_hdl;
QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
dp_ext_hdl = qdf_mem_malloc(sizeof(*dp_ext_hdl));
if (!dp_ext_hdl) {
dp_err("failed to alloc dp_txrx_handle");
QDF_ASSERT(0);
return QDF_STATUS_E_NOMEM;
}
dp_debug("dp_txrx_handle allocated");
dp_ext_hdl->soc = soc;
dp_ext_hdl->pdev = pdev;
cdp_soc_set_dp_txrx_handle(soc, dp_ext_hdl);
qdf_mem_copy(&dp_ext_hdl->config, config, sizeof(*config));
dp_ext_hdl->rx_tm_hdl.txrx_handle_cmn =
dp_txrx_get_cmn_hdl_frm_ext_hdl(dp_ext_hdl);
if (dp_ext_hdl->config.enable_rx_threads) {
qdf_status = dp_rx_tm_init(&dp_ext_hdl->rx_tm_hdl,
dp_ext_hdl->config.num_rx_threads);
}
return qdf_status;
}
QDF_STATUS dp_txrx_deinit(ol_txrx_soc_handle soc)
{
struct dp_txrx_handle *dp_ext_hdl;
if (!soc)
return QDF_STATUS_E_INVAL;
dp_ext_hdl = cdp_soc_get_dp_txrx_handle(soc);
if (!dp_ext_hdl)
return QDF_STATUS_E_FAULT;
dp_rx_tm_deinit(&dp_ext_hdl->rx_tm_hdl);
qdf_mem_free(dp_ext_hdl);
dp_info("dp_txrx_handle_t de-allocated");
cdp_soc_set_dp_txrx_handle(soc, NULL);
return QDF_STATUS_SUCCESS;
}