qca-wifi: Fix per peer config cfr stop command
Fix cfr stop wmi command and some other fixes checking for sanity, error handling. Change-Id: I9f0939fee2301f85e6e7b3338fd26e84676d7d6d CRs-Fixed: 2407354
This commit is contained in:
@@ -78,8 +78,10 @@ int tgt_cfr_stop_capture(struct wlan_objmgr_pdev *pdev,
|
||||
* tgt_cfr_enable_cfr_timer() - API to enable cfr timer
|
||||
* @pdev: pointer to pdev_object
|
||||
* @cfr_timer: Amount of time this timer has to run. If 0, it disables timer.
|
||||
*
|
||||
* Return: success/failure of timer enable
|
||||
*/
|
||||
void
|
||||
int
|
||||
tgt_cfr_enable_cfr_timer(struct wlan_objmgr_pdev *pdev, uint32_t cfr_timer);
|
||||
|
||||
/**
|
||||
|
@@ -22,13 +22,15 @@
|
||||
#include <wlan_objmgr_peer_obj.h>
|
||||
#include <wlan_objmgr_pdev_obj.h>
|
||||
|
||||
#define MAX_CFR_PRD (10*60*1000) /* 10 minutes */
|
||||
|
||||
/**
|
||||
* ucfg_cfr_start_capture() - function to start cfr capture
|
||||
* @pdev: pointer to pdev object
|
||||
* @peer: pointer to peer object
|
||||
* @cfr_params: config params to cfr capture
|
||||
*
|
||||
* Return: startus of start capture.
|
||||
* Return: status of start capture.
|
||||
*/
|
||||
int ucfg_cfr_start_capture(struct wlan_objmgr_pdev *pdev,
|
||||
struct wlan_objmgr_peer *peer,
|
||||
@@ -39,7 +41,7 @@ int ucfg_cfr_start_capture(struct wlan_objmgr_pdev *pdev,
|
||||
* @pdev: pointer to pdev object
|
||||
* @peer: pointer to peer object
|
||||
*
|
||||
* Return: startus of stop capture.
|
||||
* Return: status of stop capture.
|
||||
*/
|
||||
int ucfg_cfr_stop_capture(struct wlan_objmgr_pdev *pdev,
|
||||
struct wlan_objmgr_peer *peer);
|
||||
@@ -51,4 +53,21 @@ int ucfg_cfr_stop_capture(struct wlan_objmgr_pdev *pdev,
|
||||
* Return: number of peers with cfr capture enabled
|
||||
*/
|
||||
int ucfg_cfr_list_peers(struct wlan_objmgr_pdev *pdev);
|
||||
|
||||
/**
|
||||
* ucfg_cfr_set_timer() - function to enable cfr timer
|
||||
* @pdev: pointer to pdev object
|
||||
* @value: value to be set
|
||||
*
|
||||
* Return: status of timer enable
|
||||
*/
|
||||
int ucfg_cfr_set_timer(struct wlan_objmgr_pdev *pdev, uint32_t value);
|
||||
|
||||
/**
|
||||
* ucfg_cfr_get_timer() - function to get cfr_timer_enable
|
||||
* @pdev: pointer to pdev object
|
||||
*
|
||||
* Return: value of cfr_timer_enable
|
||||
*/
|
||||
int ucfg_cfr_get_timer(struct wlan_objmgr_pdev *pdev);
|
||||
#endif
|
||||
|
@@ -101,6 +101,8 @@ struct pdev_cfr {
|
||||
*/
|
||||
};
|
||||
|
||||
#define PEER_CFR_CAPTURE_ENABLE 1
|
||||
#define PEER_CFR_CAPTURE_DISABLE 0
|
||||
/**
|
||||
* struct peer_cfr - private peer object for cfr
|
||||
* peer_obj: pointer to peer_obj
|
||||
|
@@ -69,6 +69,8 @@ void tgt_cfr_support_set(struct wlan_objmgr_psoc *psoc, uint32_t value)
|
||||
return;
|
||||
|
||||
cfr_sc->is_cfr_capable = !!value;
|
||||
cfr_debug("CFR:%s FW support advert=%d\n", __func__,
|
||||
cfr_sc->is_cfr_capable);
|
||||
}
|
||||
|
||||
static inline struct wlan_lmac_if_cfr_tx_ops *
|
||||
@@ -161,15 +163,20 @@ int tgt_cfr_stop_capture(struct wlan_objmgr_pdev *pdev,
|
||||
return status;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
tgt_cfr_enable_cfr_timer(struct wlan_objmgr_pdev *pdev, uint32_t cfr_timer)
|
||||
{
|
||||
int status;
|
||||
struct wlan_lmac_if_cfr_tx_ops *cfr_tx_ops = NULL;
|
||||
struct wlan_objmgr_psoc *psoc = wlan_pdev_get_psoc(pdev);
|
||||
|
||||
cfr_tx_ops = wlan_psoc_get_cfr_txops(psoc);
|
||||
|
||||
if (cfr_tx_ops->cfr_enable_cfr_timer)
|
||||
cfr_tx_ops->cfr_enable_cfr_timer(pdev, cfr_timer);
|
||||
status = cfr_tx_ops->cfr_enable_cfr_timer(pdev, cfr_timer);
|
||||
|
||||
if (status != 0)
|
||||
cfr_err("Error occurred with exit code %d\n", status);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@@ -27,53 +27,131 @@ int ucfg_cfr_start_capture(struct wlan_objmgr_pdev *pdev,
|
||||
struct wlan_objmgr_peer *peer,
|
||||
struct cfr_capture_params *params)
|
||||
{
|
||||
int status;
|
||||
struct pdev_cfr *pa;
|
||||
struct peer_cfr *pe;
|
||||
|
||||
if (NULL == pdev) {
|
||||
cfr_err("PDEV is NULL!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
pa = wlan_objmgr_pdev_get_comp_private_obj(pdev, WLAN_UMAC_COMP_CFR);
|
||||
if (NULL == pa) {
|
||||
cfr_err("PDEV cfr object is NULL!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!(pa->is_cfr_capable)) {
|
||||
qdf_info("cfr is not supported on this chip\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Get peer private object */
|
||||
pe = wlan_objmgr_peer_get_comp_private_obj(peer, WLAN_UMAC_COMP_CFR);
|
||||
if (NULL == pe) {
|
||||
cfr_err("PEER cfr object is NULL!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
pe->bandwidth = params->bandwidth;
|
||||
pe->period = params->period;
|
||||
pe->capture_method = params->method;
|
||||
|
||||
if (params->period != 0) {
|
||||
if (!(params->period % 10))
|
||||
tgt_cfr_enable_cfr_timer(pdev, 1);
|
||||
else
|
||||
return -EINVAL;
|
||||
if ((params->period < 0) || (params->period > MAX_CFR_PRD) ||
|
||||
(params->period % 10) ||
|
||||
(!(params->period) && (pa->cfr_timer_enable))) {
|
||||
qdf_info("Invalid period\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return tgt_cfr_start_capture(pdev, peer, params);
|
||||
if (params->period) {
|
||||
if (pa->cfr_current_sta_count == pa->cfr_max_sta_count) {
|
||||
qdf_info("max periodic cfr clients reached\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!(pe->request))
|
||||
pa->cfr_current_sta_count++;
|
||||
}
|
||||
|
||||
status = tgt_cfr_start_capture(pdev, peer, params);
|
||||
|
||||
if (status == 0) {
|
||||
pe->bandwidth = params->bandwidth;
|
||||
pe->period = params->period;
|
||||
pe->capture_method = params->method;
|
||||
pe->request = PEER_CFR_CAPTURE_ENABLE;
|
||||
} else
|
||||
pa->cfr_current_sta_count--;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int ucfg_cfr_set_timer(struct wlan_objmgr_pdev *pdev, uint32_t value)
|
||||
{
|
||||
struct pdev_cfr *pa;
|
||||
|
||||
pa = wlan_objmgr_pdev_get_comp_private_obj(pdev, WLAN_UMAC_COMP_CFR);
|
||||
if (pa == NULL) {
|
||||
cfr_err("PDEV cfr object is NULL!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!(pa->is_cfr_capable)) {
|
||||
qdf_info("cfr is not supported on this chip\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return tgt_cfr_enable_cfr_timer(pdev, value);
|
||||
}
|
||||
qdf_export_symbol(ucfg_cfr_set_timer);
|
||||
|
||||
int ucfg_cfr_get_timer(struct wlan_objmgr_pdev *pdev)
|
||||
{
|
||||
struct pdev_cfr *pa;
|
||||
|
||||
pa = wlan_objmgr_pdev_get_comp_private_obj(pdev, WLAN_UMAC_COMP_CFR);
|
||||
if (pa == NULL) {
|
||||
cfr_err("PDEV cfr object is NULL!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!(pa->is_cfr_capable)) {
|
||||
qdf_info("cfr is not supported on this chip\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return pa->cfr_timer_enable;
|
||||
}
|
||||
qdf_export_symbol(ucfg_cfr_get_timer);
|
||||
|
||||
int ucfg_cfr_stop_capture(struct wlan_objmgr_pdev *pdev,
|
||||
struct wlan_objmgr_peer *peer)
|
||||
{
|
||||
if (NULL == pdev) {
|
||||
cfr_err("pdev is null!\n");
|
||||
int status;
|
||||
struct peer_cfr *pe;
|
||||
struct pdev_cfr *pa;
|
||||
|
||||
pa = wlan_objmgr_pdev_get_comp_private_obj(pdev, WLAN_UMAC_COMP_CFR);
|
||||
if (pa == NULL) {
|
||||
cfr_err("PDEV cfr object is NULL!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (NULL == peer) {
|
||||
cfr_err("peer is null!\n");
|
||||
if (!(pa->is_cfr_capable)) {
|
||||
qdf_info("cfr is not supported on this chip\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return tgt_cfr_stop_capture(pdev, peer);
|
||||
pe = wlan_objmgr_peer_get_comp_private_obj(peer, WLAN_UMAC_COMP_CFR);
|
||||
if (pe == NULL) {
|
||||
cfr_err("PEER cfr object is NULL!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if ((pe->period) && (pe->request))
|
||||
status = tgt_cfr_stop_capture(pdev, peer);
|
||||
else {
|
||||
qdf_info("periodic cfr not started for the client\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (status == 0)
|
||||
pe->request = PEER_CFR_CAPTURE_DISABLE;
|
||||
pa->cfr_current_sta_count--;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int ucfg_cfr_list_peers(struct wlan_objmgr_pdev *pdev)
|
||||
|
@@ -138,6 +138,9 @@ QDF_STATUS cfr_initialize_pdev(struct wlan_objmgr_pdev *pdev)
|
||||
|
||||
status = tgt_cfr_init_pdev(pdev);
|
||||
|
||||
if (status != QDF_STATUS_SUCCESS)
|
||||
cfr_err("cfr_initialize_pdev status=%d\n", status);
|
||||
|
||||
return status;
|
||||
}
|
||||
qdf_export_symbol(cfr_initialize_pdev);
|
||||
@@ -150,6 +153,9 @@ QDF_STATUS cfr_deinitialize_pdev(struct wlan_objmgr_pdev *pdev)
|
||||
|
||||
status = tgt_cfr_deinit_pdev(pdev);
|
||||
|
||||
if (status != QDF_STATUS_SUCCESS)
|
||||
cfr_err("cfr_deinitialize_pdev status=%d\n", status);
|
||||
|
||||
return status;
|
||||
}
|
||||
qdf_export_symbol(cfr_deinitialize_pdev);
|
||||
|
Reference in New Issue
Block a user