mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-24 21:54:34 -04:00
qcacmn: Use IDR API in p2p component
Use qdf idr API to create id for roc and mgmt tx cookie, and not provide kernel address to userspace. Change-Id: I0b80dbe265d0e5f9981ae89df709720e7d9901f9 CRs-Fixed: 2232947
This commit is contained in:
parent
839cf6df59
commit
b2e9551c57
8 changed files with 55 additions and 8 deletions
|
|
@ -821,6 +821,7 @@ QDF_STATUS p2p_psoc_object_open(struct wlan_objmgr_psoc *soc)
|
|||
|
||||
qdf_runtime_lock_init(&p2p_soc_obj->roc_runtime_lock);
|
||||
p2p_soc_obj->cur_roc_vdev_id = P2P_INVALID_VDEV_ID;
|
||||
qdf_idr_create(&p2p_soc_obj->p2p_idr);
|
||||
p2p_register_pmo_handler();
|
||||
|
||||
p2p_debug("p2p psoc object open successful");
|
||||
|
|
@ -852,6 +853,7 @@ QDF_STATUS p2p_psoc_object_close(struct wlan_objmgr_psoc *soc)
|
|||
}
|
||||
|
||||
p2p_unregister_pmo_handler();
|
||||
qdf_idr_destroy(&p2p_soc_obj->p2p_idr);
|
||||
qdf_runtime_lock_deinit(&p2p_soc_obj->roc_runtime_lock);
|
||||
qdf_event_destroy(&p2p_soc_obj->cancel_roc_done);
|
||||
qdf_list_destroy(&p2p_soc_obj->tx_q_ack);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include <qdf_event.h>
|
||||
#include <qdf_list.h>
|
||||
#include <qdf_lock.h>
|
||||
#include <qdf_idr.h>
|
||||
|
||||
#define MAX_QUEUE_LENGTH 20
|
||||
#define P2P_NOA_ATTR_IND 0x1090
|
||||
|
|
@ -169,6 +170,7 @@ enum p2p_connection_status {
|
|||
* @roc_runtime_lock: Runtime lock for roc request
|
||||
* @p2p_cb: Callbacks to protocol stack
|
||||
* @cur_roc_vdev_id: Vdev id of current roc
|
||||
* @p2p_idr: p2p idr
|
||||
* @connection_status:Global P2P connection status
|
||||
*/
|
||||
struct p2p_soc_priv_obj {
|
||||
|
|
@ -182,6 +184,7 @@ struct p2p_soc_priv_obj {
|
|||
qdf_runtime_lock_t roc_runtime_lock;
|
||||
struct p2p_protocol_callbacks p2p_cb;
|
||||
uint32_t cur_roc_vdev_id;
|
||||
qdf_idr p2p_idr;
|
||||
#ifdef WLAN_FEATURE_P2P_DEBUG
|
||||
enum p2p_connection_status connection_status;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -841,7 +841,7 @@ static QDF_STATUS p2p_send_tx_conf(struct tx_action_context *tx_ctx,
|
|||
if (tx_ctx->no_ack)
|
||||
tx_cnf.action_cookie = 0;
|
||||
else
|
||||
tx_cnf.action_cookie = (uintptr_t)tx_ctx;
|
||||
tx_cnf.action_cookie = (uint64_t)tx_ctx->id;
|
||||
|
||||
tx_cnf.vdev_id = tx_ctx->vdev_id;
|
||||
tx_cnf.buf = tx_ctx->buf;
|
||||
|
|
@ -1242,6 +1242,7 @@ static QDF_STATUS p2p_remove_tx_context(
|
|||
}
|
||||
|
||||
end:
|
||||
qdf_idr_remove(&p2p_soc_obj->p2p_idr, tx_ctx->id);
|
||||
qdf_mem_free(tx_ctx->buf);
|
||||
qdf_mem_free(tx_ctx);
|
||||
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@ struct p2p_frame_info {
|
|||
* @vdev_id: Vdev id on which this request has come
|
||||
* @scan_id: Scan id given by scan component for this roc req
|
||||
* @roc_cookie: Cookie for remain on channel request
|
||||
* @id: Identifier of this tx context
|
||||
* @chan: Chan for which this tx has been requested
|
||||
* @buf: tx buffer
|
||||
* @buf_len: Length of tx buffer
|
||||
|
|
@ -165,6 +166,7 @@ struct tx_action_context {
|
|||
int vdev_id;
|
||||
int scan_id;
|
||||
uint64_t roc_cookie;
|
||||
int32_t id;
|
||||
uint8_t chan;
|
||||
uint8_t *buf;
|
||||
int buf_len;
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ static QDF_STATUS p2p_send_roc_event(
|
|||
|
||||
p2p_evt.vdev_id = roc_ctx->vdev_id;
|
||||
p2p_evt.roc_event = evt;
|
||||
p2p_evt.cookie = (uintptr_t)roc_ctx;
|
||||
p2p_evt.cookie = (uint64_t)roc_ctx->id;
|
||||
p2p_evt.chan = roc_ctx->chan;
|
||||
p2p_evt.duration = roc_ctx->duration;
|
||||
|
||||
|
|
@ -244,6 +244,7 @@ static QDF_STATUS p2p_destroy_roc_ctx(struct p2p_roc_context *roc_ctx,
|
|||
p2p_err("Failed to remove roc req, status %d", status);
|
||||
}
|
||||
|
||||
qdf_idr_remove(&p2p_soc_obj->p2p_idr, roc_ctx->id);
|
||||
qdf_mem_free(roc_ctx);
|
||||
|
||||
return status;
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ enum roc_state {
|
|||
* @roc_type: RoC type User requested or internal
|
||||
* @roc_timer: RoC timer
|
||||
* @roc_state: Roc state
|
||||
* @id: identifier of roc
|
||||
*/
|
||||
struct p2p_roc_context {
|
||||
qdf_list_node_t node;
|
||||
|
|
@ -97,6 +98,7 @@ struct p2p_roc_context {
|
|||
enum roc_type roc_type;
|
||||
qdf_mc_timer_t roc_timer;
|
||||
enum roc_state roc_state;
|
||||
int32_t id;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ QDF_STATUS tgt_p2p_mgmt_ota_comp_cb(void *context, qdf_nbuf_t buf,
|
|||
|
||||
qdf_nbuf_free(buf);
|
||||
tx_cnf->vdev_id = tx_ctx->vdev_id;
|
||||
tx_cnf->action_cookie = (uintptr_t)tx_ctx;
|
||||
tx_cnf->action_cookie = (uint64_t)tx_ctx->id;
|
||||
tx_cnf->buf = tx_ctx->buf;
|
||||
tx_cnf->buf_len = tx_ctx->buf_len;
|
||||
tx_cnf->status = status;
|
||||
|
|
|
|||
|
|
@ -114,6 +114,8 @@ QDF_STATUS ucfg_p2p_roc_req(struct wlan_objmgr_psoc *soc,
|
|||
struct scheduler_msg msg = {0};
|
||||
struct p2p_soc_priv_obj *p2p_soc_obj;
|
||||
struct p2p_roc_context *roc_ctx;
|
||||
QDF_STATUS status;
|
||||
int32_t id;
|
||||
|
||||
p2p_debug("soc:%pK, vdev_id:%d, chan:%d, phy_mode:%d, duration:%d",
|
||||
soc, roc_req->vdev_id, roc_req->chan,
|
||||
|
|
@ -137,7 +139,14 @@ QDF_STATUS ucfg_p2p_roc_req(struct wlan_objmgr_psoc *soc,
|
|||
return QDF_STATUS_E_NOMEM;
|
||||
}
|
||||
|
||||
*cookie = (uintptr_t)roc_ctx;
|
||||
status = qdf_idr_alloc(&p2p_soc_obj->p2p_idr, roc_ctx, &id);
|
||||
if (status != QDF_STATUS_SUCCESS) {
|
||||
qdf_mem_free(roc_ctx);
|
||||
p2p_err("failed to alloc idr, status %d", status);
|
||||
return status;
|
||||
}
|
||||
|
||||
*cookie = (uint64_t)id;
|
||||
roc_ctx->p2p_soc_obj = p2p_soc_obj;
|
||||
roc_ctx->vdev_id = roc_req->vdev_id;
|
||||
roc_ctx->chan = roc_req->chan;
|
||||
|
|
@ -145,10 +154,12 @@ QDF_STATUS ucfg_p2p_roc_req(struct wlan_objmgr_psoc *soc,
|
|||
roc_ctx->duration = roc_req->duration;
|
||||
roc_ctx->roc_state = ROC_STATE_IDLE;
|
||||
roc_ctx->roc_type = USER_REQUESTED;
|
||||
roc_ctx->id = id;
|
||||
msg.type = P2P_ROC_REQ;
|
||||
msg.bodyptr = roc_ctx;
|
||||
msg.callback = p2p_process_cmd;
|
||||
scheduler_post_msg(QDF_MODULE_ID_OS_IF, &msg);
|
||||
p2p_debug("cookie = 0x%llx", *cookie);
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
|
@ -159,6 +170,7 @@ QDF_STATUS ucfg_p2p_roc_cancel_req(struct wlan_objmgr_psoc *soc,
|
|||
struct scheduler_msg msg = {0};
|
||||
struct p2p_soc_priv_obj *p2p_soc_obj;
|
||||
struct cancel_roc_context *cancel_roc;
|
||||
void *roc_ctx = NULL;
|
||||
|
||||
p2p_debug("soc:%pK, cookie:0x%llx", soc, cookie);
|
||||
|
||||
|
|
@ -174,6 +186,12 @@ QDF_STATUS ucfg_p2p_roc_cancel_req(struct wlan_objmgr_psoc *soc,
|
|||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
if (QDF_STATUS_SUCCESS != qdf_idr_find(&p2p_soc_obj->p2p_idr,
|
||||
cookie, &roc_ctx)) {
|
||||
p2p_err("invalid id");
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
cancel_roc = qdf_mem_malloc(sizeof(*cancel_roc));
|
||||
if (!cancel_roc) {
|
||||
p2p_err("failed to allocate cancel p2p roc");
|
||||
|
|
@ -181,7 +199,7 @@ QDF_STATUS ucfg_p2p_roc_cancel_req(struct wlan_objmgr_psoc *soc,
|
|||
}
|
||||
|
||||
cancel_roc->p2p_soc_obj = p2p_soc_obj;
|
||||
cancel_roc->cookie = cookie;
|
||||
cancel_roc->cookie = (uintptr_t)roc_ctx;
|
||||
msg.type = P2P_CANCEL_ROC_REQ;
|
||||
msg.bodyptr = cancel_roc;
|
||||
msg.callback = p2p_process_cmd;
|
||||
|
|
@ -226,6 +244,8 @@ QDF_STATUS ucfg_p2p_mgmt_tx(struct wlan_objmgr_psoc *soc,
|
|||
struct scheduler_msg msg = {0};
|
||||
struct p2p_soc_priv_obj *p2p_soc_obj;
|
||||
struct tx_action_context *tx_action;
|
||||
QDF_STATUS status;
|
||||
int32_t id;
|
||||
|
||||
p2p_debug("soc:%pK, vdev_id:%d, chan:%d, wait:%d, buf_len:%d, cck:%d, no ack:%d, off chan:%d",
|
||||
soc, mgmt_frm->vdev_id, mgmt_frm->chan,
|
||||
|
|
@ -253,9 +273,17 @@ QDF_STATUS ucfg_p2p_mgmt_tx(struct wlan_objmgr_psoc *soc,
|
|||
/* return cookie just for ota ack frames */
|
||||
if (mgmt_frm->dont_wait_for_ack)
|
||||
*cookie = 0;
|
||||
else
|
||||
*cookie = (uintptr_t)tx_action;
|
||||
else {
|
||||
status = qdf_idr_alloc(&p2p_soc_obj->p2p_idr,
|
||||
tx_action, &id);
|
||||
if (status != QDF_STATUS_SUCCESS) {
|
||||
qdf_mem_free(tx_action);
|
||||
p2p_err("failed to alloc idr, status :%d", status);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
*cookie = (uint64_t)id;
|
||||
tx_action->p2p_soc_obj = p2p_soc_obj;
|
||||
tx_action->vdev_id = mgmt_frm->vdev_id;
|
||||
tx_action->chan = mgmt_frm->chan;
|
||||
|
|
@ -273,6 +301,7 @@ QDF_STATUS ucfg_p2p_mgmt_tx(struct wlan_objmgr_psoc *soc,
|
|||
}
|
||||
qdf_mem_copy(tx_action->buf, mgmt_frm->buf, tx_action->buf_len);
|
||||
tx_action->nbuf = NULL;
|
||||
tx_action->id = id;
|
||||
msg.type = P2P_MGMT_TX;
|
||||
msg.bodyptr = tx_action;
|
||||
msg.callback = p2p_process_cmd;
|
||||
|
|
@ -287,6 +316,7 @@ QDF_STATUS ucfg_p2p_mgmt_tx_cancel(struct wlan_objmgr_psoc *soc,
|
|||
struct scheduler_msg msg = {0};
|
||||
struct p2p_soc_priv_obj *p2p_soc_obj;
|
||||
struct cancel_roc_context *cancel_tx;
|
||||
void *tx_ctx;
|
||||
|
||||
p2p_debug("soc:%pK, cookie:0x%llx", soc, cookie);
|
||||
|
||||
|
|
@ -302,6 +332,12 @@ QDF_STATUS ucfg_p2p_mgmt_tx_cancel(struct wlan_objmgr_psoc *soc,
|
|||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
if (QDF_STATUS_SUCCESS != qdf_idr_find(&p2p_soc_obj->p2p_idr,
|
||||
cookie, &tx_ctx)) {
|
||||
p2p_err("invalid id");
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
cancel_tx = qdf_mem_malloc(sizeof(*cancel_tx));
|
||||
if (!cancel_tx) {
|
||||
p2p_err("Failed to allocate cancel p2p roc");
|
||||
|
|
@ -309,7 +345,7 @@ QDF_STATUS ucfg_p2p_mgmt_tx_cancel(struct wlan_objmgr_psoc *soc,
|
|||
}
|
||||
|
||||
cancel_tx->p2p_soc_obj = p2p_soc_obj;
|
||||
cancel_tx->cookie = cookie;
|
||||
cancel_tx->cookie = (uintptr_t)tx_ctx;
|
||||
msg.type = P2P_MGMT_TX_CANCEL;
|
||||
msg.bodyptr = cancel_tx;
|
||||
msg.callback = p2p_process_cmd;
|
||||
|
|
|
|||
Loading…
Reference in a new issue