msm: ipa: macros to determine the structure mismatch

Macros to determine the structure mismatch between ipa_lnx_agent
and ipa driver. Also includes new framework APIs to get the
IPA client info for the IPA stats module.

Change-Id: I15399b6730c7f4b5c6c7a63684c674f8899dc151
Signed-off-by: Michael Adisumarta <madisuma@codeaurora.org>
This commit is contained in:
Michael Adisumarta 2021-06-21 12:30:19 -07:00 • committed by Gerrit - the friendly Code Review server
commit 770b8d5b45
6 changed files with 154 additions and 5 deletions

View file

@ -251,6 +251,9 @@ struct ipa_fmwk_contex {
int (*ipa_usb_xdci_resume)(u32 ul_clnt_hdl, u32 dl_clnt_hdl,
enum ipa_usb_teth_prot teth_prot);
bool (*ipa_usb_is_teth_prot_connected)(
enum ipa_usb_teth_prot usb_teth_prot);
/* ipa_wdi3 APIs */
int (*ipa_wdi_init)(struct ipa_wdi_init_in_params *in,
struct ipa_wdi_init_out_params *out);
@ -309,6 +312,8 @@ struct ipa_fmwk_contex {
int (*ipa_dereg_uc_rdyCB)(void);
bool (*ipa_wdi_is_tx1_used)(void);
/* ipa_gsb APIs*/
int (*ipa_bridge_init)(struct ipa_bridge_init_params *params, u32 *hdl);
@ -425,8 +430,15 @@ struct ipa_fmwk_contex {
int (*ipa_eth_client_conn_evt)(struct ipa_ecm_msg *msg);
int (*ipa_eth_client_disconn_evt)(struct ipa_ecm_msg *msg);
int (*ipa_get_default_aggr_time_limit)(enum ipa_client_type client,
u32 *default_aggr_time_limit);
enum ipa_client_type (*ipa_eth_get_ipa_client_type_from_eth_type)(
enum ipa_eth_client_type eth_client_type, enum ipa_eth_pipe_direction dir);
bool (*ipa_eth_client_exist)(
enum ipa_eth_client_type eth_client_type, int inst_id);
};
static struct ipa_fmwk_contex *ipa_fmwk_ctx;
@ -1056,7 +1068,8 @@ int ipa_fmwk_register_ipa_usb(const struct ipa_usb_data *in)
ipa_fmwk_ctx->ipa_usb_xdci_disconnect ||
ipa_fmwk_ctx->ipa_usb_deinit_teth_prot ||
ipa_fmwk_ctx->ipa_usb_xdci_suspend ||
ipa_fmwk_ctx->ipa_usb_xdci_resume) {
ipa_fmwk_ctx->ipa_usb_xdci_resume ||
ipa_fmwk_ctx->ipa_usb_is_teth_prot_connected) {
pr_err("ipa_usb APIs were already initialized\n");
return -EPERM;
}
@ -1066,6 +1079,8 @@ int ipa_fmwk_register_ipa_usb(const struct ipa_usb_data *in)
ipa_fmwk_ctx->ipa_usb_deinit_teth_prot = in->ipa_usb_deinit_teth_prot;
ipa_fmwk_ctx->ipa_usb_xdci_suspend = in->ipa_usb_xdci_suspend;
ipa_fmwk_ctx->ipa_usb_xdci_resume = in->ipa_usb_xdci_resume;
ipa_fmwk_ctx->ipa_usb_is_teth_prot_connected =
in->ipa_usb_is_teth_prot_connected;
pr_info("ipa_usb registered successfully\n");
@ -1153,6 +1168,17 @@ int ipa_usb_xdci_resume(u32 ul_clnt_hdl, u32 dl_clnt_hdl,
}
EXPORT_SYMBOL(ipa_usb_xdci_resume);
bool ipa_usb_is_teth_prot_connected(enum ipa_usb_teth_prot usb_teth_prot)
{
int ret;
IPA_FMWK_DISPATCH_RETURN(ipa_usb_is_teth_prot_connected,
usb_teth_prot);
return ret;
}
EXPORT_SYMBOL(ipa_usb_is_teth_prot_connected);
/* registration API for IPA wdi3 module */
int ipa_fmwk_register_ipa_wdi3(const struct ipa_wdi3_data *in)
{
@ -1175,7 +1201,8 @@ int ipa_fmwk_register_ipa_wdi3(const struct ipa_wdi3_data *in)
|| ipa_fmwk_ctx->ipa_wdi_release_smmu_mapping
|| ipa_fmwk_ctx->ipa_wdi_get_stats
|| ipa_fmwk_ctx->ipa_get_wdi_version
|| ipa_fmwk_ctx->ipa_wdi_sw_stats) {
|| ipa_fmwk_ctx->ipa_wdi_sw_stats
|| ipa_fmwk_ctx->ipa_wdi_is_tx1_used) {
pr_err("ipa_wdi3 APIs were already initialized\n");
return -EPERM;
}
@ -1197,6 +1224,7 @@ int ipa_fmwk_register_ipa_wdi3(const struct ipa_wdi3_data *in)
ipa_fmwk_ctx->ipa_wdi_get_stats = in->ipa_wdi_get_stats;
ipa_fmwk_ctx->ipa_wdi_sw_stats = in->ipa_wdi_sw_stats;
ipa_fmwk_ctx->ipa_get_wdi_version = in->ipa_get_wdi_version;
ipa_fmwk_ctx->ipa_wdi_is_tx1_used = in->ipa_wdi_is_tx1_used;
pr_info("ipa_wdi3 registered successfully\n");
@ -1217,6 +1245,16 @@ int ipa_wdi_init(struct ipa_wdi_init_in_params *in,
}
EXPORT_SYMBOL(ipa_wdi_init);
bool ipa_wdi_is_tx1_used(void)
{
int ret;
IPA_FMWK_DISPATCH_RETURN(ipa_wdi_is_tx1_used);
return ret;
}
EXPORT_SYMBOL(ipa_wdi_is_tx1_used);
int ipa_wdi_cleanup(void)
{
int ret;
@ -2125,7 +2163,9 @@ int ipa_fmwk_register_ipa_eth(const struct ipa_eth_data *in)
|| ipa_fmwk_ctx->ipa_eth_client_unreg_intf
|| ipa_fmwk_ctx->ipa_eth_client_set_perf_profile
|| ipa_fmwk_ctx->ipa_eth_client_conn_evt
|| ipa_fmwk_ctx->ipa_eth_client_disconn_evt) {
|| ipa_fmwk_ctx->ipa_eth_client_disconn_evt
|| ipa_fmwk_ctx->ipa_eth_get_ipa_client_type_from_eth_type
|| ipa_fmwk_ctx->ipa_eth_client_exist) {
pr_err("ipa_eth APIs were already initialized\n");
return -EPERM;
}
@ -2143,6 +2183,10 @@ int ipa_fmwk_register_ipa_eth(const struct ipa_eth_data *in)
ipa_fmwk_ctx->ipa_eth_client_conn_evt = in->ipa_eth_client_conn_evt;
ipa_fmwk_ctx->ipa_eth_client_disconn_evt =
in->ipa_eth_client_disconn_evt;
ipa_fmwk_ctx->ipa_eth_get_ipa_client_type_from_eth_type =
in->ipa_eth_get_ipa_client_type_from_eth_type;
ipa_fmwk_ctx->ipa_eth_client_exist =
in->ipa_eth_client_exist;
pr_info("ipa_eth registered successfully\n");
@ -2275,6 +2319,30 @@ int ipa_get_default_aggr_time_limit(enum ipa_client_type client,
}
EXPORT_SYMBOL(ipa_get_default_aggr_time_limit);
enum ipa_client_type ipa_eth_get_ipa_client_type_from_eth_type(
enum ipa_eth_client_type eth_client_type, enum ipa_eth_pipe_direction dir)
{
int ret;
IPA_FMWK_DISPATCH_RETURN_DP(ipa_eth_get_ipa_client_type_from_eth_type,
eth_client_type, dir);
return ret;
}
EXPORT_SYMBOL(ipa_eth_get_ipa_client_type_from_eth_type);
bool ipa_eth_client_exist(
enum ipa_eth_client_type eth_client_type, int inst_id)
{
int ret;
IPA_FMWK_DISPATCH_RETURN_DP(ipa_eth_client_exist,
eth_client_type, inst_id);
return ret;
}
EXPORT_SYMBOL(ipa_eth_client_exist);
/* module functions */
static int __init ipa_fmwk_init(void)
{

View file

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
*/
#ifndef _IPA_ETH_H_
@ -1094,5 +1094,9 @@ int ipa_eth_client_set_perf_profile(struct ipa_eth_client *client,
struct ipa_eth_perf_profile *profile);
int ipa_eth_client_conn_evt(struct ipa_ecm_msg *msg);
int ipa_eth_client_disconn_evt(struct ipa_ecm_msg *msg);
enum ipa_client_type ipa_eth_get_ipa_client_type_from_eth_type(
enum ipa_eth_client_type eth_client_type, enum ipa_eth_pipe_direction dir);
bool ipa_eth_client_exist(
enum ipa_eth_client_type eth_client_type, int inst_id);
#endif // _IPA_ETH_H_

View file

@ -162,6 +162,8 @@ struct ipa_usb_data {
int (*ipa_usb_xdci_resume)(u32 ul_clnt_hdl, u32 dl_clnt_hdl,
enum ipa_usb_teth_prot teth_prot);
bool (*ipa_usb_is_teth_prot_connected)(enum ipa_usb_teth_prot usb_teth_prot);
};
struct ipa_wdi3_data {
@ -199,6 +201,8 @@ struct ipa_wdi3_data {
int (*ipa_wdi_sw_stats)(struct ipa_wdi_tx_info *info);
int (*ipa_get_wdi_version)(void);
bool (*ipa_wdi_is_tx1_used)(void);
};
struct ipa_qdss_data {
@ -327,6 +331,13 @@ struct ipa_eth_data {
int (*ipa_eth_client_conn_evt)(struct ipa_ecm_msg *msg);
int (*ipa_eth_client_disconn_evt)(struct ipa_ecm_msg *msg);
enum ipa_client_type (*ipa_eth_get_ipa_client_type_from_eth_type)(
enum ipa_eth_client_type eth_client_type,
enum ipa_eth_pipe_direction dir);
bool (*ipa_eth_client_exist)(
enum ipa_eth_client_type eth_client_type, int inst_id);
};
#if IS_ENABLED(CONFIG_IPA3)

View file

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
*/
#ifndef _IPA_USB_H_
@ -292,6 +292,15 @@ int ipa_usb_xdci_suspend(u32 ul_clnt_hdl, u32 dl_clnt_hdl,
int ipa_usb_xdci_resume(u32 ul_clnt_hdl, u32 dl_clnt_hdl,
enum ipa_usb_teth_prot teth_prot);
/**
* ipa_usb_is_teth_prot_connected - Internal API for checking USB
* protocol is connected
*
* @usb_teth_prot: USB tethering protocol
* @Return true if connected, false if not
*/
bool ipa_usb_is_teth_prot_connected(enum ipa_usb_teth_prot usb_teth_prot);
#else /* IS_ENABLED(CONFIG_IPA3) */
static inline int ipa_usb_init_teth_prot(enum ipa_usb_teth_prot teth_prot,
@ -337,6 +346,11 @@ static inline int ipa_usb_xdci_resume(u32 ul_clnt_hdl, u32 dl_clnt_hdl,
return -EPERM;
}
static inline int ipa_usb_is_teth_prot_connected(enum ipa_usb_teth_prot usb_teth_prot)
{
return -EPERM;
}
#endif /* IS_ENABLED(CONFIG_IPA3) */

View file

@ -250,6 +250,12 @@ struct ipa_wdi_perf_profile {
int ipa_wdi_init(struct ipa_wdi_init_in_params *in,
struct ipa_wdi_init_out_params *out);
/** ipa_wdi_is_tx1_used - return if DBS mode is active
*
* @Return bool
*/
bool ipa_wdi_is_tx1_used(void);
/**
* ipa_wdi_cleanup - Client should call this function to
* clean up WDI IPA offload data path
@ -399,6 +405,11 @@ static inline int ipa_get_wdi_version(void)
return -EPERM;
}
static inline int ipa_wdi_is_tx1_used(void)
{
return -EPERM;
}
static inline int ipa_wdi_cleanup(void)
{
return -EPERM;

View file

@ -256,6 +256,47 @@
#define IPA_MAX_PDN_NUM 16
#define IPA_MAX_PDN_NUM_v4 5
/**
* Macros duplicated from ipa_lnx_spearhead_stats.h and
* ipa_lnx_stats.h. All three macros should match.
* This needs to be updated whenever the header file structure
* and structure length macros are updated to match exactly
* the same. This is done to overcome backward and forward
* compatibility between userspace and driver spearhead structures.
*/
/* IPA Linux basic stats structure macros */
#define IPA_LNX_PG_RECYCLE_STATS_STRUCT_LEN 32
#define IPA_LNX_EXCEPTION_STATS_STRUCT_LEN 40
#define IPA_LNX_ODL_EP_STATS_STRUCT_LEN 16
#define IPA_LNX_HOLB_DISCARD_STATS_STRUCT_LEN 16
#define IPA_LNX_HOLB_MONITOR_STATS_STRUCT_LEN 16
#define IPA_LNX_HOLB_DROP_AND_MON_STATS_STRUCT_LEN (8 + 16 + 16)
#define IPA_LNX_GENERIC_STATS_STRUCT_LEN (40 + 32 + 40 + 16 + 40)
/* IPA Linux clock stats structures */
#define IPA_LNX_PM_CLIENT_STATS_STRUCT_LEN 24
#define IPA_LNX_CLOCK_STATS_STRUCT_LEN (24 + 24)
/* Generic instance structures */
#define IPA_LNX_GSI_RX_DEBUG_STATS_STRUCT_LEN 48
#define IPA_LNX_GSI_TX_DEBUG_STATS_STRUCT_LEN 56
#define IPA_LNX_GSI_DEBUG_STATS_STRUCT_LEN (8 + 48 + 56)
#define IPA_LNX_PIPE_INFO_STATS_STRUCT_LEN 120
/* IPA Linux wlan instance stats structures */
#define IPA_LNX_WLAN_INSTANCE_INFO_STRUCT_LEN (32 + 112 + 120)
#define IPA_LNX_WLAN_INST_STATS_STRUCT_LEN (8 + 264)
/* IPA Linux eth instance stats structures */
#define IPA_LNX_ETH_INSTANCE_INFO_STRUCT_LEN (16 + 112 + 120)
#define IPA_LNX_ETH_INST_STATS_STRUCT_LEN (8 + 248)
/* IPA Linux usb instance stats structures */
#define IPA_LNX_USB_INSTANCE_INFO_STRUCT_LEN (16 + 112 + 120)
#define IPA_LNX_USB_INST_STATS_STRUCT_LEN (8 + 248)
/* IPA Linux mhip instance stats structures */
#define IPA_LNX_MHIP_INSTANCE_INFO_STRUCT_LEN (16 + 112 + 120)
#define IPA_LNX_MHIP_INST_STATS_STRUCT_LEN (8 + 248)
/* IPA Linux Instance allocation info structures */
#define IPA_LNX_EACH_INST_ALLOC_INFO_STRUCT_LEN (24 + 12 + 12 + 16)
#define IPA_LNX_STATS_ALL_INFO_STRUCT_LEN (32 + 128 + 128 + 128)
#define IPA_LNX_STATS_SPEARHEAD_CTX_STRUCT_LEN (8 + 4 + 416)
/**
* enum ipa_client_type - names for the various IPA "clients"
* these are from the perspective of the clients, for e.g.