qcacmn: Add support to get pdev_id and psoc from dev_name
LOWI application provides the interface name as part of lowi message to host driver. Add support in the driver code to get the corresponding pdev_id and pdev from interface name using dev_get_by_name(). Change-Id: I267b95c843a9bb1dd0c58ff45767f31999500b1c CRs-Fixed: 2711423
Esse commit está contido em:
@@ -571,13 +571,13 @@ static void os_if_send_nl_resp(uint32_t pid, uint8_t *buf,
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
static void os_if_wifi_pos_send_rsp(uint32_t pid, enum wifi_pos_cmd_ids cmd,
|
||||
uint32_t buf_len, uint8_t *buf)
|
||||
static void os_if_wifi_pos_send_rsp(struct wlan_objmgr_psoc *psoc, uint32_t pid,
|
||||
enum wifi_pos_cmd_ids cmd, uint32_t buf_len,
|
||||
uint8_t *buf)
|
||||
{
|
||||
tAniMsgHdr *aniHdr;
|
||||
struct sk_buff *skb = NULL;
|
||||
struct nlmsghdr *nlh;
|
||||
struct wlan_objmgr_psoc *psoc = wifi_pos_get_psoc();
|
||||
|
||||
/* OEM msg is always to a specific process and cannot be a broadcast */
|
||||
if (pid == 0) {
|
||||
@@ -766,13 +766,21 @@ static int wifi_pos_parse_req(const void *data, int len, int pid,
|
||||
return status;
|
||||
}
|
||||
#else
|
||||
static int wifi_pos_parse_req(struct sk_buff *skb, struct wifi_pos_req_msg *req)
|
||||
static int wifi_pos_parse_req(struct sk_buff *skb, struct wifi_pos_req_msg *req,
|
||||
struct wlan_objmgr_psoc **psoc)
|
||||
{
|
||||
/* SKB->data contains NL msg */
|
||||
/* NLMSG_DATA(nlh) contains ANI msg */
|
||||
struct nlmsghdr *nlh;
|
||||
tAniMsgHdr *msg_hdr;
|
||||
size_t field_info_len;
|
||||
int interface_len;
|
||||
char *interface = NULL;
|
||||
uint8_t pdev_id = 0;
|
||||
uint32_t tgt_pdev_id = 0;
|
||||
uint8_t i;
|
||||
uint32_t offset;
|
||||
QDF_STATUS status;
|
||||
|
||||
nlh = (struct nlmsghdr *)skb->data;
|
||||
if (!nlh) {
|
||||
@@ -805,13 +813,58 @@ static int wifi_pos_parse_req(struct sk_buff *skb, struct wifi_pos_req_msg *req)
|
||||
req->buf = (uint8_t *)&msg_hdr[1];
|
||||
req->pid = nlh->nlmsg_pid;
|
||||
req->field_info_buf = NULL;
|
||||
req->field_info_buf_len = 0;
|
||||
|
||||
field_info_len = nlh->nlmsg_len -
|
||||
(NLMSG_LENGTH(sizeof(*msg_hdr) + msg_hdr->length));
|
||||
(NLMSG_LENGTH(sizeof(*msg_hdr) + msg_hdr->length +
|
||||
sizeof(struct wifi_pos_interface)));
|
||||
if (field_info_len) {
|
||||
req->field_info_buf = (struct wifi_pos_field_info *)
|
||||
(req->buf + req->buf_len);
|
||||
req->field_info_buf_len = field_info_len;
|
||||
req->field_info_buf =
|
||||
(struct wifi_pos_field_info *)(req->buf + req->buf_len);
|
||||
req->field_info_buf_len = sizeof(struct wifi_pos_field_info);
|
||||
}
|
||||
|
||||
interface_len = nlh->nlmsg_len -
|
||||
(NLMSG_LENGTH(sizeof(*msg_hdr) + msg_hdr->length +
|
||||
req->field_info_buf_len));
|
||||
|
||||
if (interface_len) {
|
||||
interface = (char *)(req->buf + req->buf_len +
|
||||
req->field_info_buf_len);
|
||||
req->interface.length = *interface;
|
||||
|
||||
if (req->interface.length > sizeof(req->interface.dev_name)) {
|
||||
osif_err("interface length exceeds array length");
|
||||
return OEM_ERR_INVALID_MESSAGE_LENGTH;
|
||||
}
|
||||
|
||||
qdf_mem_copy(req->interface.dev_name,
|
||||
(interface + sizeof(uint8_t)),
|
||||
req->interface.length);
|
||||
|
||||
status = ucfg_wifi_psoc_get_pdev_id_by_dev_name(
|
||||
req->interface.dev_name, &pdev_id, psoc);
|
||||
if (QDF_IS_STATUS_ERROR(status)) {
|
||||
osif_err("failed to get pdev_id and psoc");
|
||||
return OEM_ERR_NULL_CONTEXT;
|
||||
}
|
||||
|
||||
status = wifi_pos_convert_host_pdev_id_to_target(
|
||||
*psoc, pdev_id, &tgt_pdev_id);
|
||||
if (QDF_IS_STATUS_ERROR(status)) {
|
||||
osif_err("failed to get target pdev_id");
|
||||
return OEM_ERR_NULL_CONTEXT;
|
||||
}
|
||||
|
||||
for (i = 0;
|
||||
(req->field_info_buf && (i < req->field_info_buf->count));
|
||||
i++) {
|
||||
if (req->field_info_buf->fields[i].id ==
|
||||
META_DATA_PDEV) {
|
||||
offset = req->field_info_buf->fields[i].offset;
|
||||
*((uint32_t *)&req->buf[offset]) = tgt_pdev_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -843,7 +896,7 @@ static void __os_if_wifi_pos_callback(const void *data, int data_len,
|
||||
wlan_objmgr_psoc_get_ref(psoc, WLAN_WIFI_POS_OSIF_ID);
|
||||
err = wifi_pos_parse_req(data, data_len, pid, &req);
|
||||
if (err) {
|
||||
os_if_wifi_pos_send_rsp(wifi_pos_get_app_pid(psoc),
|
||||
os_if_wifi_pos_send_rsp(psoc, wifi_pos_get_app_pid(psoc),
|
||||
WIFI_POS_CMD_ERROR, sizeof(err), &err);
|
||||
status = QDF_STATUS_E_INVAL;
|
||||
goto release_psoc_ref;
|
||||
@@ -875,18 +928,20 @@ static int __os_if_wifi_pos_callback(struct sk_buff *skb)
|
||||
uint8_t err;
|
||||
QDF_STATUS status;
|
||||
struct wifi_pos_req_msg req = {0};
|
||||
struct wlan_objmgr_psoc *psoc = wifi_pos_get_psoc();
|
||||
struct wlan_objmgr_psoc *psoc = NULL;
|
||||
|
||||
osif_debug("enter");
|
||||
if (!psoc) {
|
||||
osif_err("global psoc object not registered yet.");
|
||||
|
||||
err = wifi_pos_parse_req(skb, &req, &psoc);
|
||||
if (err) {
|
||||
osif_err("wifi_pos_parse_req failed");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
wlan_objmgr_psoc_get_ref(psoc, WLAN_WIFI_POS_OSIF_ID);
|
||||
err = wifi_pos_parse_req(skb, &req);
|
||||
|
||||
if (err) {
|
||||
os_if_wifi_pos_send_rsp(wifi_pos_get_app_pid(psoc),
|
||||
os_if_wifi_pos_send_rsp(psoc, wifi_pos_get_app_pid(psoc),
|
||||
WIFI_POS_CMD_ERROR, sizeof(err), &err);
|
||||
status = QDF_STATUS_E_INVAL;
|
||||
goto release_psoc_ref;
|
||||
@@ -1000,7 +1055,7 @@ void os_if_wifi_pos_send_peer_status(struct qdf_mac_addr *peer_mac,
|
||||
peer_info->peer_chan_info.reg_info_2 = chan_info->reg_info_2;
|
||||
}
|
||||
|
||||
os_if_wifi_pos_send_rsp(wifi_pos_get_app_pid(psoc),
|
||||
os_if_wifi_pos_send_rsp(psoc, wifi_pos_get_app_pid(psoc),
|
||||
WIFI_POS_PEER_STATUS_IND,
|
||||
sizeof(*peer_info), (uint8_t *)peer_info);
|
||||
qdf_mem_free(peer_info);
|
||||
|
@@ -698,12 +698,22 @@ struct wlan_lmac_if_iot_sim_tx_ops {
|
||||
* @data_req_tx: function pointer to send wifi_pos req to firmware
|
||||
* @wifi_pos_register_events: function pointer to register wifi_pos events
|
||||
* @wifi_pos_deregister_events: function pointer to deregister wifi_pos events
|
||||
* @wifi_pos_convert_pdev_id_host_to_target: function pointer to get target
|
||||
* pdev_id from host pdev_id.
|
||||
* @wifi_pos_convert_pdev_id_target_to_host: function pointer to get host
|
||||
* pdev_id from target pdev_id.
|
||||
*/
|
||||
struct wlan_lmac_if_wifi_pos_tx_ops {
|
||||
QDF_STATUS (*data_req_tx)(struct wlan_objmgr_pdev *pdev,
|
||||
struct oem_data_req *req);
|
||||
QDF_STATUS (*wifi_pos_register_events)(struct wlan_objmgr_psoc *psoc);
|
||||
QDF_STATUS (*wifi_pos_deregister_events)(struct wlan_objmgr_psoc *psoc);
|
||||
QDF_STATUS (*wifi_pos_convert_pdev_id_host_to_target)(
|
||||
struct wlan_objmgr_psoc *psoc, uint32_t host_pdev_id,
|
||||
uint32_t *target_pdev_id);
|
||||
QDF_STATUS (*wifi_pos_convert_pdev_id_target_to_host)(
|
||||
struct wlan_objmgr_psoc *psoc, uint32_t target_pdev_id,
|
||||
uint32_t *host_pdev_id);
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@@ -31,6 +31,18 @@
|
||||
struct wlan_objmgr_psoc;
|
||||
struct wifi_pos_driver_caps;
|
||||
|
||||
/**
|
||||
* enum RTT_FIELD_ID - identifies which field is being specified
|
||||
* @META_DATA_SUB_TYPE: oem data req sub type
|
||||
* @META_DATA_CHANNEL_MHZ: channel mhz info
|
||||
* @META_DATA_PDEV: pdev info
|
||||
*/
|
||||
enum RTT_FIELD_ID {
|
||||
META_DATA_SUB_TYPE,
|
||||
META_DATA_CHANNEL_MHZ,
|
||||
META_DATA_PDEV,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct wifi_pos_field - wifi positioning field element
|
||||
* @id: RTT field id
|
||||
@@ -53,6 +65,18 @@ struct wifi_pos_field_info {
|
||||
struct wifi_pos_field fields[1];
|
||||
};
|
||||
|
||||
/* Length of interface name */
|
||||
#define INTERFACE_LEN 16
|
||||
/**
|
||||
* struct wifi_pos_interface - wifi positioning interface structure
|
||||
* @length: interface length
|
||||
* @dev_name: device name
|
||||
*/
|
||||
struct wifi_pos_interface {
|
||||
uint8_t length;
|
||||
char dev_name[INTERFACE_LEN];
|
||||
};
|
||||
|
||||
#ifdef WIFI_POS_CONVERGED
|
||||
/**
|
||||
* enum oem_err_msg - err msg returned to user space
|
||||
@@ -138,7 +162,7 @@ struct qdf_packed wifi_pos_peer_status_info {
|
||||
* @field_info_buf: buffer containing field info
|
||||
* @field_info_buf_len: length of field info buffer
|
||||
* @rsp_version: nl type or ani type
|
||||
*
|
||||
* @interface: contains interface name and length
|
||||
*/
|
||||
struct wifi_pos_req_msg {
|
||||
enum wifi_pos_cmd_ids msg_type;
|
||||
@@ -148,6 +172,7 @@ struct wifi_pos_req_msg {
|
||||
struct wifi_pos_field_info *field_info_buf;
|
||||
uint32_t field_info_buf_len;
|
||||
uint32_t rsp_version;
|
||||
struct wifi_pos_interface interface;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -460,6 +485,33 @@ QDF_STATUS wifi_pos_register_send_action(
|
||||
uint8_t *buf,
|
||||
uint32_t buf_len));
|
||||
|
||||
#ifndef CNSS_GENL
|
||||
/**
|
||||
* ucfg_wifi_psoc_get_pdev_id_by_dev_name: ucfg API to get pdev_id and psoc from
|
||||
* devname.
|
||||
* @dev_name: dev name received from LOWI application
|
||||
* @pdev_id: get pdev_id from dev_name
|
||||
* @psoc: get psoc corresponding psoc from dev_name
|
||||
*/
|
||||
QDF_STATUS ucfg_wifi_psoc_get_pdev_id_by_dev_name(
|
||||
char *dev_name, uint8_t *pdev_id,
|
||||
struct wlan_objmgr_psoc **psoc);
|
||||
|
||||
/**
|
||||
* wifi_pos_register_get_pdev_id_by_dev_name: API to register callback to get
|
||||
* pdev_id from dev name
|
||||
* @psoc: pointer to global psoc object
|
||||
* @handler: callback to be registered
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS in case of success, error codes in
|
||||
* case of failure
|
||||
*/
|
||||
QDF_STATUS wifi_pos_register_get_pdev_id_by_dev_name(
|
||||
struct wlan_objmgr_psoc *psoc,
|
||||
QDF_STATUS (*handler)(char *dev_name, uint8_t *pdev_id,
|
||||
struct wlan_objmgr_psoc **psoc));
|
||||
#endif
|
||||
|
||||
/**
|
||||
* wifi_pos_send_report_resp: Send report to osif
|
||||
* @psoc: pointer to psoc object
|
||||
@@ -473,4 +525,18 @@ QDF_STATUS wifi_pos_register_send_action(
|
||||
QDF_STATUS wifi_pos_send_report_resp(struct wlan_objmgr_psoc *psoc,
|
||||
int req_id, uint8_t *dest_mac,
|
||||
int err_code);
|
||||
|
||||
/**
|
||||
* wifi_pos_convert_host_pdev_id_to_target: convert host pdev_id to target
|
||||
* pdev_id
|
||||
* @psoc: pointer to psoc object
|
||||
* @host_pdev_id: host pdev id
|
||||
* @target_pdev_id: target pdev id
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS in case of success, error codes in
|
||||
* case of failure
|
||||
*/
|
||||
QDF_STATUS wifi_pos_convert_host_pdev_id_to_target(
|
||||
struct wlan_objmgr_psoc *psoc, uint32_t host_pdev_id,
|
||||
uint32_t *target_pdev_id);
|
||||
#endif
|
||||
|
@@ -377,6 +377,36 @@ QDF_STATUS wifi_pos_register_get_fw_phy_mode_for_freq_cb(
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#ifndef CNSS_GENL
|
||||
QDF_STATUS wifi_pos_register_get_pdev_id_by_dev_name(
|
||||
struct wlan_objmgr_psoc *psoc,
|
||||
QDF_STATUS (*handler)(char *dev_name, uint8_t *pdev_id,
|
||||
struct wlan_objmgr_psoc **psoc))
|
||||
{
|
||||
struct wifi_pos_psoc_priv_obj *wifi_pos_psoc;
|
||||
|
||||
if (!psoc) {
|
||||
wifi_pos_err("psoc is null");
|
||||
return QDF_STATUS_E_NULL_VALUE;
|
||||
}
|
||||
|
||||
if (!handler) {
|
||||
wifi_pos_err("Null callback");
|
||||
return QDF_STATUS_E_NULL_VALUE;
|
||||
}
|
||||
|
||||
wifi_pos_psoc = wifi_pos_get_psoc_priv_obj(psoc);
|
||||
if (!wifi_pos_psoc) {
|
||||
wifi_pos_err("wifi_pos priv obj is null");
|
||||
return QDF_STATUS_E_NULL_VALUE;
|
||||
}
|
||||
|
||||
wifi_pos_psoc->wifi_pos_get_pdev_id_by_dev_name = handler;
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
QDF_STATUS wifi_pos_register_send_action(
|
||||
struct wlan_objmgr_psoc *psoc,
|
||||
void (*handler)(struct wlan_objmgr_psoc *psoc,
|
||||
|
@@ -126,6 +126,31 @@ wifi_pos_prepare_reg_resp(uint32_t *rsp_len,
|
||||
|
||||
return resp_buf;
|
||||
}
|
||||
|
||||
/**
|
||||
* wifi_pos_get_host_pdev_id: Get host pdev_id
|
||||
* @psoc: Pointer to psoc object
|
||||
* @tgt_pdev_id: target_pdev_id
|
||||
* @host_pdev_id: host pdev_id
|
||||
*
|
||||
* Return: QDF_STATUS_SUCCESS in case of success, error codes in case of failure
|
||||
*/
|
||||
static QDF_STATUS wifi_pos_get_host_pdev_id(
|
||||
struct wlan_objmgr_psoc *psoc, uint32_t tgt_pdev_id,
|
||||
uint32_t *host_pdev_id)
|
||||
{
|
||||
/* pdev_id in FW starts from 1. So convert it to
|
||||
* host id by decrementing it.
|
||||
* zero has special meaning due to backward
|
||||
* compatibility. Dont change it.
|
||||
*/
|
||||
if (tgt_pdev_id)
|
||||
*host_pdev_id = tgt_pdev_id - 1;
|
||||
else
|
||||
*host_pdev_id = tgt_pdev_id;
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
#else
|
||||
static uint8_t *
|
||||
wifi_pos_prepare_reg_resp(uint32_t *rsp_len,
|
||||
@@ -147,6 +172,27 @@ wifi_pos_prepare_reg_resp(uint32_t *rsp_len,
|
||||
|
||||
return resp_buf;
|
||||
}
|
||||
|
||||
static QDF_STATUS wifi_pos_get_host_pdev_id(
|
||||
struct wlan_objmgr_psoc *psoc, uint32_t tgt_pdev_id,
|
||||
uint32_t *host_pdev_id)
|
||||
{
|
||||
struct wlan_lmac_if_wifi_pos_tx_ops *tx_ops;
|
||||
|
||||
tx_ops = wifi_pos_get_tx_ops(psoc);
|
||||
if (!tx_ops) {
|
||||
qdf_print("tx ops null");
|
||||
return QDF_STATUS_E_NULL_VALUE;
|
||||
}
|
||||
|
||||
if (!tx_ops->wifi_pos_convert_pdev_id_target_to_host) {
|
||||
wifi_pos_err("wifi_pos_convert_pdev_id_target_to_host is null");
|
||||
return QDF_STATUS_E_NULL_VALUE;
|
||||
}
|
||||
|
||||
return tx_ops->wifi_pos_convert_pdev_id_target_to_host(
|
||||
psoc, tgt_pdev_id, host_pdev_id);
|
||||
}
|
||||
#endif
|
||||
|
||||
static QDF_STATUS wifi_pos_process_data_req(struct wlan_objmgr_psoc *psoc,
|
||||
@@ -155,13 +201,15 @@ static QDF_STATUS wifi_pos_process_data_req(struct wlan_objmgr_psoc *psoc,
|
||||
uint8_t idx;
|
||||
uint32_t sub_type = 0;
|
||||
uint32_t channel_mhz = 0;
|
||||
uint32_t pdev_id = 0;
|
||||
uint32_t host_pdev_id = 0, tgt_pdev_id = 0;
|
||||
uint32_t offset;
|
||||
struct oem_data_req data_req;
|
||||
struct wlan_lmac_if_wifi_pos_tx_ops *tx_ops;
|
||||
struct wlan_objmgr_pdev *pdev;
|
||||
struct wifi_pos_psoc_priv_obj *wifi_pos_obj =
|
||||
wifi_pos_get_psoc_priv_obj(psoc);
|
||||
wifi_pos_get_psoc_priv_obj(wifi_pos_get_psoc());
|
||||
QDF_STATUS status;
|
||||
|
||||
|
||||
if (!wifi_pos_obj) {
|
||||
wifi_pos_err("wifi_pos priv obj is null");
|
||||
@@ -180,27 +228,28 @@ static QDF_STATUS wifi_pos_process_data_req(struct wlan_objmgr_psoc *psoc,
|
||||
* length
|
||||
*/
|
||||
if (req->field_info_buf->fields[idx].id ==
|
||||
WMIRTT_FIELD_ID_oem_data_sub_type) {
|
||||
META_DATA_SUB_TYPE) {
|
||||
sub_type = *((uint32_t *)&req->buf[offset]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (req->field_info_buf->fields[idx].id ==
|
||||
WMIRTT_FIELD_ID_channel_mhz) {
|
||||
META_DATA_CHANNEL_MHZ) {
|
||||
channel_mhz = *((uint32_t *)&req->buf[offset]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (req->field_info_buf->fields[idx].id ==
|
||||
WMIRTT_FIELD_ID_pdev) {
|
||||
pdev_id = *((uint32_t *)&req->buf[offset]);
|
||||
/* pdev_id in FW starts from 1. So convert it to
|
||||
* host id by decrementing it.
|
||||
* zero has special meaning due to backward
|
||||
* compatibility. Dont change it.
|
||||
*/
|
||||
if (pdev_id)
|
||||
pdev_id -= 1;
|
||||
META_DATA_PDEV) {
|
||||
tgt_pdev_id = *((uint32_t *)&req->buf[offset]);
|
||||
status = wifi_pos_get_host_pdev_id(
|
||||
psoc, tgt_pdev_id,
|
||||
&host_pdev_id);
|
||||
if (QDF_IS_STATUS_ERROR(status)) {
|
||||
wifi_pos_err("failed to get host pdev_id, tgt_pdev_id = %d",
|
||||
tgt_pdev_id);
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -241,7 +290,7 @@ static QDF_STATUS wifi_pos_process_data_req(struct wlan_objmgr_psoc *psoc,
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
pdev = wlan_objmgr_get_pdev_by_id(psoc, pdev_id,
|
||||
pdev = wlan_objmgr_get_pdev_by_id(psoc, host_pdev_id,
|
||||
WLAN_WIFI_POS_CORE_ID);
|
||||
if (!pdev) {
|
||||
wifi_pos_err("pdev null");
|
||||
@@ -278,7 +327,7 @@ static QDF_STATUS wifi_pos_process_set_cap_req(struct wlan_objmgr_psoc *psoc,
|
||||
wifi_pos_obj->ftm_rr = caps->ftm_rr;
|
||||
wifi_pos_obj->lci_capability = caps->lci_capability;
|
||||
error_code = qdf_status_to_os_return(QDF_STATUS_SUCCESS);
|
||||
wifi_pos_obj->wifi_pos_send_rsp(wifi_pos_obj->app_pid,
|
||||
wifi_pos_obj->wifi_pos_send_rsp(psoc, wifi_pos_obj->app_pid,
|
||||
WIFI_POS_CMD_SET_CAPS,
|
||||
sizeof(error_code),
|
||||
(uint8_t *)&error_code);
|
||||
@@ -305,7 +354,7 @@ static QDF_STATUS wifi_pos_process_get_cap_req(struct wlan_objmgr_psoc *psoc,
|
||||
cap_rsp.user_defined_cap.ftm_rr = wifi_pos_obj->ftm_rr;
|
||||
cap_rsp.user_defined_cap.lci_capability = wifi_pos_obj->lci_capability;
|
||||
|
||||
wifi_pos_obj->wifi_pos_send_rsp(wifi_pos_obj->app_pid,
|
||||
wifi_pos_obj->wifi_pos_send_rsp(psoc, wifi_pos_obj->app_pid,
|
||||
WIFI_POS_CMD_GET_CAPS,
|
||||
sizeof(cap_rsp),
|
||||
(uint8_t *)&cap_rsp);
|
||||
@@ -339,7 +388,7 @@ QDF_STATUS wifi_pos_send_report_resp(struct wlan_objmgr_psoc *psoc,
|
||||
(sizeof(struct wifi_pos_err_rpt)) & 0x0000FFFF;
|
||||
memcpy(&err_report.err_rpt.dest_mac, dest_mac, QDF_MAC_ADDR_SIZE);
|
||||
|
||||
wifi_pos_obj->wifi_pos_send_rsp(wifi_pos_obj->app_pid,
|
||||
wifi_pos_obj->wifi_pos_send_rsp(psoc, wifi_pos_obj->app_pid,
|
||||
WIFI_POS_CMD_OEM_DATA,
|
||||
sizeof(err_report),
|
||||
(uint8_t *)&err_report);
|
||||
@@ -548,7 +597,7 @@ static QDF_STATUS wifi_pos_process_ch_info_req(struct wlan_objmgr_psoc *psoc,
|
||||
ch_info[idx].reg_info_2 = reg_info_2;
|
||||
}
|
||||
|
||||
wifi_pos_obj->wifi_pos_send_rsp(wifi_pos_obj->app_pid,
|
||||
wifi_pos_obj->wifi_pos_send_rsp(psoc, wifi_pos_obj->app_pid,
|
||||
WIFI_POS_CMD_GET_CH_INFO,
|
||||
len, buf);
|
||||
|
||||
@@ -622,7 +671,8 @@ static QDF_STATUS wifi_pos_process_app_reg_req(struct wlan_objmgr_psoc *psoc,
|
||||
wifi_pos_debug("no active vdev");
|
||||
|
||||
vdev_idx = 0;
|
||||
wifi_pos_obj->wifi_pos_send_rsp(req->pid, WIFI_POS_CMD_REGISTRATION,
|
||||
wifi_pos_obj->wifi_pos_send_rsp(psoc, req->pid,
|
||||
WIFI_POS_CMD_REGISTRATION,
|
||||
rsp_len, (uint8_t *)app_reg_rsp);
|
||||
|
||||
qdf_mem_free(app_reg_rsp);
|
||||
@@ -630,7 +680,7 @@ static QDF_STATUS wifi_pos_process_app_reg_req(struct wlan_objmgr_psoc *psoc,
|
||||
|
||||
app_reg_failed:
|
||||
|
||||
wifi_pos_obj->wifi_pos_send_rsp(req->pid, WIFI_POS_CMD_ERROR,
|
||||
wifi_pos_obj->wifi_pos_send_rsp(psoc, req->pid, WIFI_POS_CMD_ERROR,
|
||||
sizeof(err), &err);
|
||||
return ret;
|
||||
}
|
||||
@@ -676,6 +726,27 @@ static QDF_STATUS wifi_pos_non_tlv_callback(struct wlan_objmgr_psoc *psoc,
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
QDF_STATUS wifi_pos_convert_host_pdev_id_to_target(
|
||||
struct wlan_objmgr_psoc *psoc, uint32_t host_pdev_id,
|
||||
uint32_t *target_pdev_id)
|
||||
{
|
||||
struct wlan_lmac_if_wifi_pos_tx_ops *tx_ops;
|
||||
|
||||
tx_ops = wifi_pos_get_tx_ops(psoc);
|
||||
if (!tx_ops) {
|
||||
wifi_pos_err("tx_ops is null");
|
||||
return QDF_STATUS_E_NULL_VALUE;
|
||||
}
|
||||
|
||||
if (!tx_ops->wifi_pos_convert_pdev_id_host_to_target) {
|
||||
wifi_pos_err("wifi_pos_convert_pdev_id_host_to_target is null");
|
||||
return QDF_STATUS_E_NULL_VALUE;
|
||||
}
|
||||
|
||||
return tx_ops->wifi_pos_convert_pdev_id_host_to_target(
|
||||
psoc, host_pdev_id, target_pdev_id);
|
||||
}
|
||||
|
||||
QDF_STATUS wifi_pos_psoc_obj_created_notification(
|
||||
struct wlan_objmgr_psoc *psoc, void *arg_list)
|
||||
{
|
||||
@@ -774,10 +845,10 @@ int wifi_pos_oem_rsp_handler(struct wlan_objmgr_psoc *psoc,
|
||||
uint32_t len;
|
||||
uint8_t *data;
|
||||
uint32_t app_pid;
|
||||
struct wifi_pos_psoc_priv_obj *priv =
|
||||
wifi_pos_get_psoc_priv_obj(psoc);
|
||||
struct wifi_pos_psoc_priv_obj *priv;
|
||||
wifi_pos_send_rsp_handler wifi_pos_send_rsp;
|
||||
|
||||
priv = wifi_pos_get_psoc_priv_obj(wifi_pos_get_psoc());
|
||||
if (!priv) {
|
||||
wifi_pos_err("private object is NULL");
|
||||
return -EINVAL;
|
||||
@@ -814,10 +885,11 @@ int wifi_pos_oem_rsp_handler(struct wlan_objmgr_psoc *psoc,
|
||||
qdf_mem_copy(&data[oem_rsp->rsp_len_1 + oem_rsp->dma_len],
|
||||
oem_rsp->data_2, oem_rsp->rsp_len_2);
|
||||
|
||||
wifi_pos_send_rsp(app_pid, WIFI_POS_CMD_OEM_DATA, len, data);
|
||||
wifi_pos_send_rsp(psoc, app_pid, WIFI_POS_CMD_OEM_DATA, len,
|
||||
data);
|
||||
qdf_mem_free(data);
|
||||
} else {
|
||||
wifi_pos_send_rsp(app_pid, WIFI_POS_CMD_OEM_DATA,
|
||||
wifi_pos_send_rsp(psoc, app_pid, WIFI_POS_CMD_OEM_DATA,
|
||||
oem_rsp->rsp_len_1, oem_rsp->data_1);
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2019 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017, 2019-2020 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
|
||||
@@ -43,16 +43,4 @@
|
||||
#define WIFI_POS_FLAG_DFS 10
|
||||
#define WIFI_POS_SET_DFS(info) (info |= (1 << WIFI_POS_FLAG_DFS))
|
||||
|
||||
/**
|
||||
* enum WMIRTT_FIELD_ID - identifies which field is being specified
|
||||
* @WMIRTT_FIELD_ID_oem_data_sub_type: oem data req sub type
|
||||
* @WMIRTT_FIELD_ID_channel_mhz: channel mhz info
|
||||
* @WMIRTT_FIELD_ID_pdev: pdev info
|
||||
*/
|
||||
enum WMIRTT_FIELD_ID {
|
||||
WMIRTT_FIELD_ID_oem_data_sub_type,
|
||||
WMIRTT_FIELD_ID_channel_mhz,
|
||||
WMIRTT_FIELD_ID_pdev,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -24,6 +24,38 @@
|
||||
#include "wifi_pos_api.h"
|
||||
#include "wifi_pos_ucfg_i.h"
|
||||
#include "wlan_ptt_sock_svc.h"
|
||||
#ifndef CNSS_GENL
|
||||
#include <wlan_objmgr_psoc_obj.h>
|
||||
#endif
|
||||
|
||||
#ifndef CNSS_GENL
|
||||
QDF_STATUS ucfg_wifi_psoc_get_pdev_id_by_dev_name(
|
||||
char *dev_name, uint8_t *pdev_id,
|
||||
struct wlan_objmgr_psoc **psoc)
|
||||
{
|
||||
struct wlan_objmgr_psoc *tmp_psoc = wifi_pos_get_psoc();
|
||||
struct wifi_pos_psoc_priv_obj *wifi_pos_psoc_obj;
|
||||
|
||||
if (!tmp_psoc) {
|
||||
wifi_pos_err("psoc is null");
|
||||
return QDF_STATUS_E_NULL_VALUE;
|
||||
}
|
||||
|
||||
wifi_pos_psoc_obj = wifi_pos_get_psoc_priv_obj(tmp_psoc);
|
||||
if (!wifi_pos_psoc_obj) {
|
||||
wifi_pos_err("wifi_pos_psoc_obj is null");
|
||||
return QDF_STATUS_E_NULL_VALUE;
|
||||
}
|
||||
|
||||
if (!wifi_pos_psoc_obj->wifi_pos_get_pdev_id_by_dev_name) {
|
||||
wifi_pos_err("wifi_pos_get_pdev_id_by_dev_name is null");
|
||||
return QDF_STATUS_E_NULL_VALUE;
|
||||
}
|
||||
|
||||
return wifi_pos_psoc_obj->wifi_pos_get_pdev_id_by_dev_name(
|
||||
dev_name, pdev_id, psoc);
|
||||
}
|
||||
#endif
|
||||
|
||||
QDF_STATUS ucfg_wifi_pos_process_req(struct wlan_objmgr_psoc *psoc,
|
||||
struct wifi_pos_req_msg *req,
|
||||
@@ -32,11 +64,11 @@ QDF_STATUS ucfg_wifi_pos_process_req(struct wlan_objmgr_psoc *psoc,
|
||||
uint8_t err;
|
||||
uint32_t app_pid;
|
||||
bool is_app_registered;
|
||||
struct wifi_pos_psoc_priv_obj *wifi_pos_psoc_obj =
|
||||
wifi_pos_get_psoc_priv_obj(psoc);
|
||||
struct wifi_pos_psoc_priv_obj *wifi_pos_psoc_obj;
|
||||
|
||||
wifi_pos_debug("enter");
|
||||
|
||||
wifi_pos_psoc_obj = wifi_pos_get_psoc_priv_obj(wifi_pos_get_psoc());
|
||||
if (!wifi_pos_psoc_obj) {
|
||||
wifi_pos_err("wifi_pos_psoc_obj is null");
|
||||
return QDF_STATUS_E_NULL_VALUE;
|
||||
@@ -52,7 +84,8 @@ QDF_STATUS ucfg_wifi_pos_process_req(struct wlan_objmgr_psoc *psoc,
|
||||
if (!wifi_pos_psoc_obj->wifi_pos_req_handler) {
|
||||
wifi_pos_err("wifi_pos_psoc_obj->wifi_pos_req_handler is null");
|
||||
err = OEM_ERR_NULL_CONTEXT;
|
||||
send_rsp_cb(app_pid, WIFI_POS_CMD_ERROR, sizeof(err), &err);
|
||||
send_rsp_cb(psoc, app_pid, WIFI_POS_CMD_ERROR, sizeof(err),
|
||||
&err);
|
||||
return QDF_STATUS_E_NULL_VALUE;
|
||||
}
|
||||
|
||||
@@ -61,7 +94,8 @@ QDF_STATUS ucfg_wifi_pos_process_req(struct wlan_objmgr_psoc *psoc,
|
||||
wifi_pos_err("requesting app is not registered, app_registered: %d, requesting pid: %d, stored pid: %d",
|
||||
is_app_registered, req->pid, app_pid);
|
||||
err = OEM_ERR_APP_NOT_REGISTERED;
|
||||
send_rsp_cb(app_pid, WIFI_POS_CMD_ERROR, sizeof(err), &err);
|
||||
send_rsp_cb(psoc, app_pid, WIFI_POS_CMD_ERROR, sizeof(err),
|
||||
&err);
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
|
@@ -207,7 +207,8 @@ struct wifi_pos_dma_rings_cfg {
|
||||
void *srng;
|
||||
};
|
||||
|
||||
typedef void (*wifi_pos_send_rsp_handler)(uint32_t, enum wifi_pos_cmd_ids,
|
||||
typedef void (*wifi_pos_send_rsp_handler)(struct wlan_objmgr_psoc *, uint32_t,
|
||||
enum wifi_pos_cmd_ids,
|
||||
uint32_t, uint8_t *);
|
||||
|
||||
/**
|
||||
@@ -242,6 +243,7 @@ typedef void (*wifi_pos_send_rsp_handler)(uint32_t, enum wifi_pos_cmd_ids,
|
||||
* for given freq and channel width
|
||||
* @wifi_pos_send_action: function pointer to send registered action frames
|
||||
* to userspace APP
|
||||
* @wifi_pos_get_pdev_id_by_dev_name: get pdev_id from device name
|
||||
* @rsp_version: rsp version
|
||||
*
|
||||
* wifi pos request messages
|
||||
@@ -288,6 +290,9 @@ struct wifi_pos_psoc_priv_obj {
|
||||
void (*wifi_pos_send_action)(struct wlan_objmgr_psoc *psoc,
|
||||
uint32_t oem_subtype, uint8_t *buf,
|
||||
uint32_t len);
|
||||
QDF_STATUS (*wifi_pos_get_pdev_id_by_dev_name)(
|
||||
char *dev_name, uint8_t *pdev_id,
|
||||
struct wlan_objmgr_psoc **psoc);
|
||||
uint32_t rsp_version;
|
||||
};
|
||||
|
||||
|
Referência em uma nova issue
Block a user