Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c3a6cc0f authored by Mohammed Javid's avatar Mohammed Javid
Browse files

msm: ipa: Cache CNE event



Provide support to cache CNE event for debugging purpose.

Change-Id: I00d101d3b9a627d7aba3e4524ff301797ea6085e
Signed-off-by: default avatarMohammed Javid <mjavid@codeaurora.org>
parent 714bfa4f
Loading
Loading
Loading
Loading
+25 −4
Original line number Diff line number Diff line
@@ -532,7 +532,8 @@ 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;
@@ -560,6 +561,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;
}

@@ -1329,21 +1349,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;
@@ -4180,6 +4200,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);
+10 −0
Original line number Diff line number Diff line
@@ -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);\
@@ -988,6 +990,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
@@ -1188,6 +1195,9 @@ struct ipa_context {
	u32 ipa_rx_min_timeout_usec;
	u32 ipa_rx_max_timeout_usec;
	u32 ipa_polling_iteration;
	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;
};

/**
+25 −4
Original line number Diff line number Diff line
@@ -598,7 +598,8 @@ 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 +627,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;
}

@@ -1646,21 +1666,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;
@@ -5111,6 +5131,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);
+9 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@
#define IPA_IPC_LOG_PAGES 50

#define IPA_PM_THRESHOLD_MAX 2
#define IPA_MAX_NUM_REQ_CACHE 10

#define IPADBG(fmt, args...) \
	do { \
@@ -1106,6 +1107,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
@@ -1333,6 +1339,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;
};

/**