qcacmn: Move retrieval of wmi_handle to target_if layer
Remove inconsistent API for scan start and stop, where pdev_wmi_handle is derived from psoc_handle at the WMI layer instead of using the wmi_handle passed from the above layer i.e target_if Change-Id: If259260e6f8cf77bf68748a8130db4440b88588a CRs-Fixed: 2203048
This commit is contained in:
@@ -86,25 +86,25 @@ target_if_scan_unregister_event_handler(struct wlan_objmgr_psoc *psoc,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* target_if_scan_start() - lmac handler API to start scan
|
* target_if_scan_start() - lmac handler API to start scan
|
||||||
* @psoc: psoc object
|
* @pdev: pdev object
|
||||||
* @req: scan_req_params object
|
* @req: scan_req_params object
|
||||||
*
|
*
|
||||||
* Return: QDF_STATUS
|
* Return: QDF_STATUS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QDF_STATUS
|
QDF_STATUS
|
||||||
target_if_scan_start(struct wlan_objmgr_psoc *psoc,
|
target_if_scan_start(struct wlan_objmgr_pdev *pdev,
|
||||||
struct scan_start_request *req);
|
struct scan_start_request *req);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* target_if_scan_cancel() - lmac handler API to cancel a previous active scan
|
* target_if_scan_cancel() - lmac handler API to cancel a previous active scan
|
||||||
* @psoc: psoc object
|
* @pdev: pdev object
|
||||||
* @req: scan_cancel_param object
|
* @req: scan_cancel_param object
|
||||||
*
|
*
|
||||||
* Return: QDF_STATUS
|
* Return: QDF_STATUS
|
||||||
*/
|
*/
|
||||||
QDF_STATUS
|
QDF_STATUS
|
||||||
target_if_scan_cancel(struct wlan_objmgr_psoc *psoc,
|
target_if_scan_cancel(struct wlan_objmgr_pdev *pdev,
|
||||||
struct scan_cancel_param *req);
|
struct scan_cancel_param *req);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -327,18 +327,31 @@ target_if_scan_unregister_event_handler(struct wlan_objmgr_psoc *psoc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
QDF_STATUS
|
QDF_STATUS
|
||||||
target_if_scan_start(struct wlan_objmgr_psoc *psoc,
|
target_if_scan_start(struct wlan_objmgr_pdev *pdev,
|
||||||
struct scan_start_request *req)
|
struct scan_start_request *req)
|
||||||
{
|
{
|
||||||
return wmi_unified_scan_start_cmd_send(GET_WMI_HDL_FROM_PSOC(psoc),
|
void *pdev_wmi_handle;
|
||||||
&req->scan_req);
|
|
||||||
|
pdev_wmi_handle = GET_WMI_HDL_FROM_PDEV(pdev);
|
||||||
|
if (!pdev_wmi_handle) {
|
||||||
|
target_if_err("Invalid PDEV WMI handle");
|
||||||
|
return QDF_STATUS_E_FAILURE;
|
||||||
|
}
|
||||||
|
return wmi_unified_scan_start_cmd_send(pdev_wmi_handle, &req->scan_req);
|
||||||
}
|
}
|
||||||
|
|
||||||
QDF_STATUS
|
QDF_STATUS
|
||||||
target_if_scan_cancel(struct wlan_objmgr_psoc *psoc,
|
target_if_scan_cancel(struct wlan_objmgr_pdev *pdev,
|
||||||
struct scan_cancel_param *req)
|
struct scan_cancel_param *req)
|
||||||
{
|
{
|
||||||
return wmi_unified_scan_stop_cmd_send(GET_WMI_HDL_FROM_PSOC(psoc), req);
|
void *pdev_wmi_handle;
|
||||||
|
|
||||||
|
pdev_wmi_handle = GET_WMI_HDL_FROM_PDEV(pdev);
|
||||||
|
if (!pdev_wmi_handle) {
|
||||||
|
target_if_err("Invalid PDEV WMI handle");
|
||||||
|
return QDF_STATUS_E_NULL_VALUE;
|
||||||
|
}
|
||||||
|
return wmi_unified_scan_stop_cmd_send(pdev_wmi_handle, req);
|
||||||
}
|
}
|
||||||
|
|
||||||
QDF_STATUS
|
QDF_STATUS
|
||||||
|
@@ -126,9 +126,9 @@ struct wlan_lmac_if_mgmt_txrx_tx_ops {
|
|||||||
* scan module uses these functions to avail ol/da lmac services
|
* scan module uses these functions to avail ol/da lmac services
|
||||||
*/
|
*/
|
||||||
struct wlan_lmac_if_scan_tx_ops {
|
struct wlan_lmac_if_scan_tx_ops {
|
||||||
QDF_STATUS (*scan_start)(struct wlan_objmgr_psoc *psoc,
|
QDF_STATUS (*scan_start)(struct wlan_objmgr_pdev *pdev,
|
||||||
struct scan_start_request *req);
|
struct scan_start_request *req);
|
||||||
QDF_STATUS (*scan_cancel)(struct wlan_objmgr_psoc *psoc,
|
QDF_STATUS (*scan_cancel)(struct wlan_objmgr_pdev *pdev,
|
||||||
struct scan_cancel_param *req);
|
struct scan_cancel_param *req);
|
||||||
QDF_STATUS (*pno_start)(struct wlan_objmgr_psoc *psoc,
|
QDF_STATUS (*pno_start)(struct wlan_objmgr_psoc *psoc,
|
||||||
struct pno_scan_req_params *req);
|
struct pno_scan_req_params *req);
|
||||||
|
@@ -109,15 +109,17 @@ tgt_scan_start(struct scan_start_request *req)
|
|||||||
{
|
{
|
||||||
struct wlan_lmac_if_scan_tx_ops *scan_ops;
|
struct wlan_lmac_if_scan_tx_ops *scan_ops;
|
||||||
struct wlan_objmgr_psoc *psoc;
|
struct wlan_objmgr_psoc *psoc;
|
||||||
|
struct wlan_objmgr_pdev *pdev;
|
||||||
struct wlan_objmgr_vdev *vdev = req->vdev;
|
struct wlan_objmgr_vdev *vdev = req->vdev;
|
||||||
|
|
||||||
psoc = wlan_vdev_get_psoc(vdev);
|
psoc = wlan_vdev_get_psoc(vdev);
|
||||||
|
pdev = wlan_vdev_get_pdev(vdev);
|
||||||
|
|
||||||
scan_ops = wlan_psoc_get_scan_txops(psoc);
|
scan_ops = wlan_psoc_get_scan_txops(psoc);
|
||||||
/* invoke wmi_unified_scan_start_cmd_send() */
|
/* invoke wmi_unified_scan_start_cmd_send() */
|
||||||
QDF_ASSERT(scan_ops->scan_start);
|
QDF_ASSERT(scan_ops->scan_start);
|
||||||
if (scan_ops->scan_start)
|
if (scan_ops->scan_start)
|
||||||
return scan_ops->scan_start(psoc, req);
|
return scan_ops->scan_start(pdev, req);
|
||||||
else
|
else
|
||||||
return QDF_STATUS_SUCCESS;
|
return QDF_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -128,15 +130,17 @@ tgt_scan_cancel(struct scan_cancel_request *req)
|
|||||||
{
|
{
|
||||||
struct wlan_lmac_if_scan_tx_ops *scan_ops;
|
struct wlan_lmac_if_scan_tx_ops *scan_ops;
|
||||||
struct wlan_objmgr_psoc *psoc;
|
struct wlan_objmgr_psoc *psoc;
|
||||||
|
struct wlan_objmgr_pdev *pdev;
|
||||||
struct wlan_objmgr_vdev *vdev = req->vdev;
|
struct wlan_objmgr_vdev *vdev = req->vdev;
|
||||||
|
|
||||||
psoc = wlan_vdev_get_psoc(vdev);
|
psoc = wlan_vdev_get_psoc(vdev);
|
||||||
|
pdev = wlan_vdev_get_pdev(vdev);
|
||||||
|
|
||||||
scan_ops = wlan_psoc_get_scan_txops(psoc);
|
scan_ops = wlan_psoc_get_scan_txops(psoc);
|
||||||
/* invoke wmi_unified_scan_stop_cmd_send() */
|
/* invoke wmi_unified_scan_stop_cmd_send() */
|
||||||
QDF_ASSERT(scan_ops->scan_cancel);
|
QDF_ASSERT(scan_ops->scan_cancel);
|
||||||
if (scan_ops->scan_cancel)
|
if (scan_ops->scan_cancel)
|
||||||
return scan_ops->scan_cancel(psoc, &(req->cancel_req));
|
return scan_ops->scan_cancel(pdev, &req->cancel_req);
|
||||||
else
|
else
|
||||||
return QDF_STATUS_SUCCESS;
|
return QDF_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@@ -2485,37 +2485,6 @@ static inline void scan_copy_ie_buffer(uint8_t *buf_ptr,
|
|||||||
qdf_mem_copy(buf_ptr, params->extraie.ptr, params->extraie.len);
|
qdf_mem_copy(buf_ptr, params->extraie.ptr, params->extraie.len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* get_pdev_wmi_handle() - Helper func to derive pdev wmi handle from vdev_id
|
|
||||||
* @param wmi_handle : Handle to WMI
|
|
||||||
* @param vdev_id : vdev identifier
|
|
||||||
*
|
|
||||||
* Return : void *
|
|
||||||
*/
|
|
||||||
static inline void *get_pdev_wmi_handle(wmi_unified_t wmi_handle, uint8_t vdev_id)
|
|
||||||
{
|
|
||||||
struct wlan_objmgr_vdev *vdev = NULL;
|
|
||||||
struct wlan_objmgr_pdev *pdev = NULL;
|
|
||||||
uint8_t pdev_id = 0;
|
|
||||||
|
|
||||||
vdev = wlan_objmgr_get_vdev_by_id_from_psoc(
|
|
||||||
(struct wlan_objmgr_psoc *)wmi_handle->soc->wmi_psoc,
|
|
||||||
vdev_id, WLAN_SCAN_ID);
|
|
||||||
if (vdev) {
|
|
||||||
wlan_objmgr_vdev_release_ref(vdev, WLAN_SCAN_ID);
|
|
||||||
pdev = wlan_vdev_get_pdev(vdev);
|
|
||||||
if (pdev)
|
|
||||||
pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
|
|
||||||
else {
|
|
||||||
qdf_print("%s : Invalid PDEV, forcing pdev_id to 0\n", __func__);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
qdf_print("%s : Invalid VDEV, forcing pdev_id to 0\n", __func__);
|
|
||||||
}
|
|
||||||
|
|
||||||
return wmi_unified_get_pdev_handle(wmi_handle->soc, pdev_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wmi_copy_scan_random_mac() - To copy scan randomization attrs to wmi buffer
|
* wmi_copy_scan_random_mac() - To copy scan randomization attrs to wmi buffer
|
||||||
* @mac: random mac addr
|
* @mac: random mac addr
|
||||||
@@ -2607,7 +2576,6 @@ static QDF_STATUS send_scan_start_cmd_tlv(wmi_unified_t wmi_handle,
|
|||||||
uint8_t extraie_len_with_pad = 0;
|
uint8_t extraie_len_with_pad = 0;
|
||||||
uint8_t phymode_roundup = 0;
|
uint8_t phymode_roundup = 0;
|
||||||
struct probe_req_whitelist_attr *ie_whitelist = ¶ms->ie_whitelist;
|
struct probe_req_whitelist_attr *ie_whitelist = ¶ms->ie_whitelist;
|
||||||
wmi_unified_t pdev_wmi_handle;
|
|
||||||
|
|
||||||
/* Length TLV placeholder for array of uint32_t */
|
/* Length TLV placeholder for array of uint32_t */
|
||||||
len += WMI_TLV_HDR_SIZE;
|
len += WMI_TLV_HDR_SIZE;
|
||||||
@@ -2771,13 +2739,7 @@ static QDF_STATUS send_scan_start_cmd_tlv(wmi_unified_t wmi_handle,
|
|||||||
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, 0);
|
WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
pdev_wmi_handle = get_pdev_wmi_handle(wmi_handle, cmd->vdev_id);
|
ret = wmi_unified_cmd_send(wmi_handle, wmi_buf,
|
||||||
if (pdev_wmi_handle == NULL) {
|
|
||||||
WMI_LOGE("%s: Invalid PDEV WMI handle", __func__);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = wmi_unified_cmd_send(pdev_wmi_handle, wmi_buf,
|
|
||||||
len, WMI_START_SCAN_CMDID);
|
len, WMI_START_SCAN_CMDID);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
WMI_LOGE("%s: Failed to start scan: %d", __func__, ret);
|
WMI_LOGE("%s: Failed to start scan: %d", __func__, ret);
|
||||||
@@ -2803,7 +2765,6 @@ static QDF_STATUS send_scan_stop_cmd_tlv(wmi_unified_t wmi_handle,
|
|||||||
int ret;
|
int ret;
|
||||||
int len = sizeof(*cmd);
|
int len = sizeof(*cmd);
|
||||||
wmi_buf_t wmi_buf;
|
wmi_buf_t wmi_buf;
|
||||||
wmi_unified_t pdev_wmi_handle;
|
|
||||||
|
|
||||||
/* Allocate the memory */
|
/* Allocate the memory */
|
||||||
wmi_buf = wmi_buf_alloc(wmi_handle, len);
|
wmi_buf = wmi_buf_alloc(wmi_handle, len);
|
||||||
@@ -2839,14 +2800,7 @@ static QDF_STATUS send_scan_stop_cmd_tlv(wmi_unified_t wmi_handle,
|
|||||||
return QDF_STATUS_E_INVAL;
|
return QDF_STATUS_E_INVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdev_wmi_handle = get_pdev_wmi_handle(wmi_handle, cmd->vdev_id);
|
ret = wmi_unified_cmd_send(wmi_handle, wmi_buf,
|
||||||
if (pdev_wmi_handle == NULL) {
|
|
||||||
WMI_LOGE("%s: Invalid PDEV WMI handle", __func__);
|
|
||||||
wmi_buf_free(wmi_buf);
|
|
||||||
return QDF_STATUS_E_NULL_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = wmi_unified_cmd_send(pdev_wmi_handle, wmi_buf,
|
|
||||||
len, WMI_STOP_SCAN_CMDID);
|
len, WMI_STOP_SCAN_CMDID);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
WMI_LOGE("%s: Failed to send stop scan: %d", __func__, ret);
|
WMI_LOGE("%s: Failed to send stop scan: %d", __func__, ret);
|
||||||
|
Reference in New Issue
Block a user