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
此提交包含在:
Shashikala Prabhu
2020-07-15 11:30:52 +05:30
提交者 snandini
父節點 8054d1a47d
當前提交 6d11d6f27a
共有 8 個檔案被更改,包括 318 行新增58 行删除

查看文件

@@ -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;
};