msm: ipa: Cache CNE event

Provide support to cache CNE event for debugging purpose.

Change-Id: I00d101d3b9a627d7aba3e4524ff301797ea6085e
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
This commit is contained in:
Mohammed Javid 2017-08-29 01:05:46 +05:30
parent e91bfdb176
commit bb96b54c01
4 changed files with 68 additions and 8 deletions

View file

@ -531,7 +531,7 @@ static void ipa_wan_msg_free_cb(void *buff, u32 len, u32 type)
kfree(buff);
}
static int ipa_send_wan_msg(unsigned long usr_param, uint8_t msg_type)
static int ipa_send_wan_msg(unsigned long usr_param, uint8_t msg_type, bool is_cache)
{
int retval;
struct ipa_wan_msg *wan_msg;
@ -559,6 +559,25 @@ static int ipa_send_wan_msg(unsigned long usr_param, uint8_t msg_type)
return retval;
}
if (is_cache) {
mutex_lock(&ipa_ctx->ipa_cne_evt_lock);
/* cache the cne event */
memcpy(&ipa_ctx->ipa_cne_evt_req_cache[
ipa_ctx->num_ipa_cne_evt_req].wan_msg,
wan_msg,
sizeof(struct ipa_wan_msg));
memcpy(&ipa_ctx->ipa_cne_evt_req_cache[
ipa_ctx->num_ipa_cne_evt_req].msg_meta,
&msg_meta,
sizeof(struct ipa_msg_meta));
ipa_ctx->num_ipa_cne_evt_req++;
ipa_ctx->num_ipa_cne_evt_req %= IPA_MAX_NUM_REQ_CACHE;
mutex_unlock(&ipa_ctx->ipa_cne_evt_lock);
}
return 0;
}
@ -1328,21 +1347,21 @@ static long ipa_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
}
break;
case IPA_IOC_NOTIFY_WAN_UPSTREAM_ROUTE_ADD:
retval = ipa_send_wan_msg(arg, WAN_UPSTREAM_ROUTE_ADD);
retval = ipa_send_wan_msg(arg, WAN_UPSTREAM_ROUTE_ADD, true);
if (retval) {
IPAERR("ipa_send_wan_msg failed: %d\n", retval);
break;
}
break;
case IPA_IOC_NOTIFY_WAN_UPSTREAM_ROUTE_DEL:
retval = ipa_send_wan_msg(arg, WAN_UPSTREAM_ROUTE_DEL);
retval = ipa_send_wan_msg(arg, WAN_UPSTREAM_ROUTE_DEL, true);
if (retval) {
IPAERR("ipa_send_wan_msg failed: %d\n", retval);
break;
}
break;
case IPA_IOC_NOTIFY_WAN_EMBMS_CONNECTED:
retval = ipa_send_wan_msg(arg, WAN_EMBMS_CONNECT);
retval = ipa_send_wan_msg(arg, WAN_EMBMS_CONNECT, false);
if (retval) {
IPAERR("ipa_send_wan_msg failed: %d\n", retval);
break;
@ -4165,6 +4184,7 @@ static int ipa_init(const struct ipa_plat_drv_res *resource_p,
mutex_init(&ipa_ctx->lock);
mutex_init(&ipa_ctx->nat_mem.lock);
mutex_init(&ipa_ctx->ipa_cne_evt_lock);
idr_init(&ipa_ctx->ipa_idr);
spin_lock_init(&ipa_ctx->idr_lock);

View file

@ -65,6 +65,8 @@
#define IPA_IPC_LOG_PAGES 50
#define IPA_MAX_NUM_REQ_CACHE 10
#define IPADBG(fmt, args...) \
do { \
pr_debug(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\
@ -996,6 +998,11 @@ struct ipacm_client_info {
bool uplink;
};
struct ipa_cne_evt {
struct ipa_wan_msg wan_msg;
struct ipa_msg_meta msg_meta;
};
/**
* struct ipa_context - IPA context
* @class: pointer to the struct class
@ -1197,6 +1204,9 @@ struct ipa_context {
u32 ipa_rx_max_timeout_usec;
u32 ipa_polling_iteration;
bool ipa_uc_monitor_holb;
struct ipa_cne_evt ipa_cne_evt_req_cache[IPA_MAX_NUM_REQ_CACHE];
int num_ipa_cne_evt_req;
struct mutex ipa_cne_evt_lock;
};
/**

View file

@ -598,7 +598,7 @@ static void ipa3_wan_msg_free_cb(void *buff, u32 len, u32 type)
kfree(buff);
}
static int ipa3_send_wan_msg(unsigned long usr_param, uint8_t msg_type)
static int ipa3_send_wan_msg(unsigned long usr_param, uint8_t msg_type, bool is_cache)
{
int retval;
struct ipa_wan_msg *wan_msg;
@ -626,6 +626,25 @@ static int ipa3_send_wan_msg(unsigned long usr_param, uint8_t msg_type)
return retval;
}
if (is_cache) {
mutex_lock(&ipa3_ctx->ipa_cne_evt_lock);
/* cache the cne event */
memcpy(&ipa3_ctx->ipa_cne_evt_req_cache[
ipa3_ctx->num_ipa_cne_evt_req].wan_msg,
wan_msg,
sizeof(struct ipa_wan_msg));
memcpy(&ipa3_ctx->ipa_cne_evt_req_cache[
ipa3_ctx->num_ipa_cne_evt_req].msg_meta,
&msg_meta,
sizeof(struct ipa_msg_meta));
ipa3_ctx->num_ipa_cne_evt_req++;
ipa3_ctx->num_ipa_cne_evt_req %= IPA_MAX_NUM_REQ_CACHE;
mutex_unlock(&ipa3_ctx->ipa_cne_evt_lock);
}
return 0;
}
@ -1603,21 +1622,21 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
}
break;
case IPA_IOC_NOTIFY_WAN_UPSTREAM_ROUTE_ADD:
retval = ipa3_send_wan_msg(arg, WAN_UPSTREAM_ROUTE_ADD);
retval = ipa3_send_wan_msg(arg, WAN_UPSTREAM_ROUTE_ADD, true);
if (retval) {
IPAERR("ipa3_send_wan_msg failed: %d\n", retval);
break;
}
break;
case IPA_IOC_NOTIFY_WAN_UPSTREAM_ROUTE_DEL:
retval = ipa3_send_wan_msg(arg, WAN_UPSTREAM_ROUTE_DEL);
retval = ipa3_send_wan_msg(arg, WAN_UPSTREAM_ROUTE_DEL, true);
if (retval) {
IPAERR("ipa3_send_wan_msg failed: %d\n", retval);
break;
}
break;
case IPA_IOC_NOTIFY_WAN_EMBMS_CONNECTED:
retval = ipa3_send_wan_msg(arg, WAN_EMBMS_CONNECT);
retval = ipa3_send_wan_msg(arg, WAN_EMBMS_CONNECT, false);
if (retval) {
IPAERR("ipa3_send_wan_msg failed: %d\n", retval);
break;
@ -4820,6 +4839,7 @@ static int ipa3_pre_init(const struct ipa3_plat_drv_res *resource_p,
mutex_init(&ipa3_ctx->lock);
mutex_init(&ipa3_ctx->nat_mem.lock);
mutex_init(&ipa3_ctx->q6_proxy_clk_vote_mutex);
mutex_init(&ipa3_ctx->ipa_cne_evt_lock);
idr_init(&ipa3_ctx->ipa_idr);
spin_lock_init(&ipa3_ctx->idr_lock);

View file

@ -64,6 +64,8 @@
#define IPA_IPC_LOG_PAGES 50
#define IPA_MAX_NUM_REQ_CACHE 10
#define IPADBG(fmt, args...) \
do { \
pr_debug(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\
@ -1049,6 +1051,11 @@ struct ipa_dma_task_info {
struct ipahal_imm_cmd_pyld *cmd_pyld;
};
struct ipa_cne_evt {
struct ipa_wan_msg wan_msg;
struct ipa_msg_meta msg_meta;
};
/**
* struct ipa3_context - IPA context
* @class: pointer to the struct class
@ -1270,6 +1277,9 @@ struct ipa3_context {
u32 ipa_tz_unlock_reg_num;
struct ipa_tz_unlock_reg_info *ipa_tz_unlock_reg;
struct ipa_dma_task_info dma_task_info;
struct ipa_cne_evt ipa_cne_evt_req_cache[IPA_MAX_NUM_REQ_CACHE];
int num_ipa_cne_evt_req;
struct mutex ipa_cne_evt_lock;
};
/**