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

Commit 4c8c248d authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ipa: add ipc logging for ipa driver"

parents aaac94d5 41d57c52
Loading
Loading
Loading
Loading
+27 −19
Original line number Diff line number Diff line
@@ -450,7 +450,7 @@ static int ipa_open(struct inode *inode, struct file *filp)
{
	struct ipa_context *ctx = NULL;

	IPADBG("ENTER\n");
	IPADBG_LOW("ENTER\n");
	ctx = container_of(inode->i_cdev, struct ipa_context, cdev);
	filp->private_data = ctx;

@@ -3051,11 +3051,11 @@ static int ipa_get_clks(struct device *dev)

void _ipa_enable_clks_v2_0(void)
{
	IPADBG("enabling gcc_ipa_clk\n");
	IPADBG_LOW("enabling gcc_ipa_clk\n");
	if (ipa_clk) {
		clk_prepare(ipa_clk);
		clk_enable(ipa_clk);
		IPADBG("curr_ipa_clk_rate=%d", ipa_ctx->curr_ipa_clk_rate);
		IPADBG_LOW("curr_ipa_clk_rate=%d", ipa_ctx->curr_ipa_clk_rate);
		clk_set_rate(ipa_clk, ipa_ctx->curr_ipa_clk_rate);
		ipa_uc_notify_clk_state(true);
	} else {
@@ -3187,7 +3187,7 @@ void _ipa_disable_clks_v1_1(void)

void _ipa_disable_clks_v2_0(void)
{
	IPADBG("disabling gcc_ipa_clk\n");
	IPADBG_LOW("disabling gcc_ipa_clk\n");
	ipa_suspend_apps_pipes(true);
	ipa_sps_irq_control_all(false);
	ipa_uc_notify_clk_state(false);
@@ -3208,7 +3208,7 @@ void _ipa_disable_clks_v2_0(void)
*/
void ipa_disable_clks(void)
{
	IPADBG("disabling IPA clocks and bus voting\n");
	IPADBG_LOW("disabling IPA clocks and bus voting\n");

	ipa_ctx->ctrl->ipa_disable_clks();

@@ -3352,7 +3352,7 @@ void ipa2_inc_client_enable_clks(struct ipa_active_client_logging_info *id)
	ipa_ctx->ipa_active_clients.cnt++;
	if (ipa_ctx->ipa_active_clients.cnt == 1)
		ipa_enable_clks();
	IPADBG("active clients = %d\n", ipa_ctx->ipa_active_clients.cnt);
	IPADBG_LOW("active clients = %d\n", ipa_ctx->ipa_active_clients.cnt);
	ipa_active_clients_unlock();
}

@@ -3384,7 +3384,7 @@ int ipa2_inc_client_enable_clks_no_block(struct ipa_active_client_logging_info
	ipa2_active_clients_log_inc(id, true);

	ipa_ctx->ipa_active_clients.cnt++;
	IPADBG("active clients = %d\n", ipa_ctx->ipa_active_clients.cnt);
	IPADBG_LOW("active clients = %d\n", ipa_ctx->ipa_active_clients.cnt);
bail:
	ipa_active_clients_trylock_unlock(&flags);

@@ -3412,7 +3412,7 @@ void ipa2_dec_client_disable_clks(struct ipa_active_client_logging_info *id)
	ipa_active_clients_lock();
	ipa2_active_clients_log_dec(id, false);
	ipa_ctx->ipa_active_clients.cnt--;
	IPADBG("active clients = %d\n", ipa_ctx->ipa_active_clients.cnt);
	IPADBG_LOW("active clients = %d\n", ipa_ctx->ipa_active_clients.cnt);
	if (ipa_ctx->ipa_active_clients.cnt == 0) {
		if (ipa_ctx->tag_process_before_gating) {
			IPA_ACTIVE_CLIENTS_PREP_SPECIAL(log_info,
@@ -3452,7 +3452,7 @@ void ipa_inc_acquire_wakelock(enum ipa_wakelock_ref_client ref_client)
	ipa_ctx->wakelock_ref_cnt.cnt |= (1 << ref_client);
	if (ipa_ctx->wakelock_ref_cnt.cnt)
		__pm_stay_awake(&ipa_ctx->w_lock);
	IPADBG("active wakelock ref cnt = %d client enum %d\n",
	IPADBG_LOW("active wakelock ref cnt = %d client enum %d\n",
		ipa_ctx->wakelock_ref_cnt.cnt, ref_client);
	spin_unlock_irqrestore(&ipa_ctx->wakelock_ref_cnt.spinlock, flags);
}
@@ -3473,7 +3473,7 @@ void ipa_dec_release_wakelock(enum ipa_wakelock_ref_client ref_client)
		return;
	spin_lock_irqsave(&ipa_ctx->wakelock_ref_cnt.spinlock, flags);
	ipa_ctx->wakelock_ref_cnt.cnt &= ~(1 << ref_client);
	IPADBG("active wakelock ref cnt = %d client enum %d\n",
	IPADBG_LOW("active wakelock ref cnt = %d client enum %d\n",
		ipa_ctx->wakelock_ref_cnt.cnt, ref_client);
	if (ipa_ctx->wakelock_ref_cnt.cnt == 0)
		__pm_relax(&ipa_ctx->w_lock);
@@ -3517,7 +3517,7 @@ int ipa2_set_required_perf_profile(enum ipa_voltage_level floor_voltage,
	enum ipa_voltage_level needed_voltage;
	u32 clk_rate;

	IPADBG("floor_voltage=%d, bandwidth_mbps=%u",
	IPADBG_LOW("floor_voltage=%d, bandwidth_mbps=%u",
					floor_voltage, bandwidth_mbps);

	if (floor_voltage < IPA_VOLTAGE_UNSPECIFIED ||
@@ -3527,7 +3527,7 @@ int ipa2_set_required_perf_profile(enum ipa_voltage_level floor_voltage,
	}

	if (ipa_ctx->enable_clock_scaling) {
		IPADBG("Clock scaling is enabled\n");
		IPADBG_LOW("Clock scaling is enabled\n");
		if (bandwidth_mbps >=
			ipa_ctx->ctrl->clock_scaling_bw_threshold_turbo)
			needed_voltage = IPA_VOLTAGE_TURBO;
@@ -3537,7 +3537,7 @@ int ipa2_set_required_perf_profile(enum ipa_voltage_level floor_voltage,
		else
			needed_voltage = IPA_VOLTAGE_SVS;
	} else {
		IPADBG("Clock scaling is disabled\n");
		IPADBG_LOW("Clock scaling is disabled\n");
		needed_voltage = IPA_VOLTAGE_NOMINAL;
	}

@@ -3559,13 +3559,13 @@ int ipa2_set_required_perf_profile(enum ipa_voltage_level floor_voltage,
	}

	if (clk_rate == ipa_ctx->curr_ipa_clk_rate) {
		IPADBG("Same voltage\n");
		IPADBG_LOW("Same voltage\n");
		return 0;
	}

	ipa_active_clients_lock();
	ipa_ctx->curr_ipa_clk_rate = clk_rate;
	IPADBG("setting clock rate to %u\n", ipa_ctx->curr_ipa_clk_rate);
	IPADBG_LOW("setting clock rate to %u\n", ipa_ctx->curr_ipa_clk_rate);
	if (ipa_ctx->ipa_active_clients.cnt > 0) {
		struct ipa_active_client_logging_info log_info;

@@ -3588,11 +3588,10 @@ int ipa2_set_required_perf_profile(enum ipa_voltage_level floor_voltage,
		/* remove the vote added here */
		IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
	} else {
		IPADBG("clocks are gated, not setting rate\n");
		 ipa_active_clients_unlock();
		IPADBG_LOW("clocks are gated, not setting rate\n");
	}
	IPADBG("Done\n");

	ipa_active_clients_unlock();
	IPADBG_LOW("Done\n");
	return 0;
}

@@ -3888,6 +3887,13 @@ static int ipa_init(const struct ipa_plat_drv_res *resource_p,
		goto fail_mem_ctx;
	}

	ipa_ctx->logbuf = ipc_log_context_create(IPA_IPC_LOG_PAGES, "ipa", 0);
	if (ipa_ctx->logbuf == NULL) {
		IPAERR("failed to get logbuf\n");
		result = -ENOMEM;
		goto fail_logbuf;
	}

	ipa_ctx->pdev = ipa_dev;
	ipa_ctx->uc_pdev = ipa_dev;
	ipa_ctx->smmu_present = smmu_info.present;
@@ -4423,6 +4429,8 @@ static int ipa_init(const struct ipa_plat_drv_res *resource_p,
fail_bind:
	kfree(ipa_ctx->ctrl);
fail_mem_ctrl:
	ipc_log_context_destroy(ipa_ctx->logbuf);
fail_logbuf:
	kfree(ipa_ctx);
	ipa_ctx = NULL;
fail_mem_ctx:
+49 −0
Original line number Diff line number Diff line
@@ -1817,6 +1817,44 @@ static ssize_t ipa_write_polling_iteration(struct file *file,
	return count;
}

static ssize_t ipa_enable_ipc_low(struct file *file,
	const char __user *ubuf, size_t count, loff_t *ppos)
{
	unsigned long missing;
	s8 option = 0;

	if (sizeof(dbg_buff) < count + 1)
		return -EFAULT;

	missing = copy_from_user(dbg_buff, ubuf, count);
	if (missing)
		return -EFAULT;

	dbg_buff[count] = '\0';
	if (kstrtos8(dbg_buff, 0, &option))
		return -EFAULT;

	if (option) {
		if (!ipa_ctx->logbuf_low) {
			ipa_ctx->logbuf_low =
				ipc_log_context_create(IPA_IPC_LOG_PAGES,
				"ipa_low", 0);
		}

		if (ipa_ctx->logbuf_low == NULL) {
			IPAERR("failed to get logbuf_low\n");
			return -EFAULT;
		}

	} else {
		if (ipa_ctx->logbuf_low)
			ipc_log_context_destroy(ipa_ctx->logbuf_low);
			ipa_ctx->logbuf_low = NULL;
	}

	return count;
}

const struct file_operations ipa_gen_reg_ops = {
	.read = ipa_read_gen_reg,
};
@@ -1895,6 +1933,10 @@ const struct file_operations ipa2_active_clients = {
	.write = ipa2_clear_active_clients_log,
};

const struct file_operations ipa_ipc_low_ops = {
	.write = ipa_enable_ipc_low,
};

const struct file_operations ipa_rx_poll_time_ops = {
	.read = ipa_read_rx_polling_timeout,
	.write = ipa_write_rx_polling_timeout,
@@ -2110,6 +2152,13 @@ void ipa_debugfs_init(void)
		goto fail;
	}

	file = debugfs_create_file("enable_low_prio_print", write_only_mode,
		dent, 0, &ipa_ipc_low_ops);
	if (!file) {
		IPAERR("could not create enable_low_prio_print file\n");
		goto fail;
	}

	return;

fail:
+39 −12
Original line number Diff line number Diff line
@@ -32,16 +32,39 @@
#define IPADMA_DRV_NAME "ipa_dma"

#define IPADMA_DBG(fmt, args...) \
	do { \
		pr_debug(IPADMA_DRV_NAME " %s:%d " fmt, \
		 __func__, __LINE__, ## args)
		__func__, __LINE__, ## args); \
		IPA_IPC_LOGGING(ipa_get_ipc_logbuf(), \
			IPADMA_DRV_NAME " %s:%d " fmt, ## args); \
		IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \
			IPADMA_DRV_NAME " %s:%d " fmt, ## args); \
	} while (0)

#define IPADMA_DBG_LOW(fmt, args...) \
	do { \
		pr_debug(IPADMA_DRV_NAME " %s:%d " fmt, \
			__func__, __LINE__, ## args); \
		IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \
			IPADMA_DRV_NAME " %s:%d " fmt, ## args); \
	} while (0)

#define IPADMA_ERR(fmt, args...) \
	pr_err(IPADMA_DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args)
	do { \
		pr_err(IPADMA_DRV_NAME " %s:%d " fmt, \
			__func__, __LINE__, ## args); \
		IPA_IPC_LOGGING(ipa_get_ipc_logbuf(), \
			IPADMA_DRV_NAME " %s:%d " fmt, ## args); \
		IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \
			IPADMA_DRV_NAME " %s:%d " fmt, ## args); \
	} while (0)

#define IPADMA_FUNC_ENTRY() \
	IPADMA_DBG("ENTRY\n")
	IPADMA_DBG_LOW("ENTRY\n")

#define IPADMA_FUNC_EXIT() \
	IPADMA_DBG("EXIT\n")
	IPADMA_DBG_LOW("EXIT\n")


#ifdef CONFIG_DEBUG_FS
#define IPADMA_MAX_MSG_LEN 1024
@@ -270,7 +293,7 @@ int ipa2_dma_enable(void)
	}
	mutex_lock(&ipa_dma_ctx->enable_lock);
	if (ipa_dma_ctx->is_enabled) {
		IPADMA_DBG("Already enabled.\n");
		IPADMA_ERR("Already enabled.\n");
		mutex_unlock(&ipa_dma_ctx->enable_lock);
		return -EPERM;
	}
@@ -296,7 +319,7 @@ static bool ipa_dma_work_pending(void)
		IPADMA_DBG("pending uc\n");
		return true;
	}
	IPADMA_DBG("no pending work\n");
	IPADMA_DBG_LOW("no pending work\n");
	return false;
}

@@ -324,7 +347,7 @@ int ipa2_dma_disable(void)
	mutex_lock(&ipa_dma_ctx->enable_lock);
	spin_lock_irqsave(&ipa_dma_ctx->pending_lock, flags);
	if (!ipa_dma_ctx->is_enabled) {
		IPADMA_DBG("Already disabled.\n");
		IPADMA_ERR("Already disabled.\n");
		spin_unlock_irqrestore(&ipa_dma_ctx->pending_lock, flags);
		mutex_unlock(&ipa_dma_ctx->enable_lock);
		return -EPERM;
@@ -371,6 +394,8 @@ int ipa2_dma_sync_memcpy(u64 dest, u64 src, int len)

	IPADMA_FUNC_ENTRY();

	IPADMA_DBG_LOW("dest =  0x%llx, src = 0x%llx, len = %d\n",
		dest, src, len);
	if (ipa_dma_ctx == NULL) {
		IPADMA_ERR("IPADMA isn't initialized, can't memcpy\n");
		return -EPERM;
@@ -398,7 +423,7 @@ int ipa2_dma_sync_memcpy(u64 dest, u64 src, int len)
	if (atomic_read(&ipa_dma_ctx->sync_memcpy_pending_cnt) >=
		IPA_DMA_MAX_PENDING_SYNC) {
		atomic_dec(&ipa_dma_ctx->sync_memcpy_pending_cnt);
		IPADMA_DBG("Reached pending requests limit\n");
		IPADMA_ERR("Reached pending requests limit\n");
		return -EFAULT;
	}

@@ -531,6 +556,8 @@ int ipa2_dma_async_memcpy(u64 dest, u64 src, int len,
	unsigned long flags;

	IPADMA_FUNC_ENTRY();
	IPADMA_DBG_LOW("dest =  0x%llx, src = 0x%llx, len = %d\n",
		dest, src, len);
	if (ipa_dma_ctx == NULL) {
		IPADMA_ERR("IPADMA isn't initialized, can't memcpy\n");
		return -EPERM;
@@ -562,7 +589,7 @@ int ipa2_dma_async_memcpy(u64 dest, u64 src, int len,
	if (atomic_read(&ipa_dma_ctx->async_memcpy_pending_cnt) >=
		IPA_DMA_MAX_PENDING_ASYNC) {
		atomic_dec(&ipa_dma_ctx->async_memcpy_pending_cnt);
		IPADMA_DBG("Reached pending requests limit\n");
		IPADMA_ERR("Reached pending requests limit\n");
		return -EFAULT;
	}

@@ -692,7 +719,7 @@ void ipa2_dma_destroy(void)

	IPADMA_FUNC_ENTRY();
	if (!ipa_dma_ctx) {
		IPADMA_DBG("IPADMA isn't initialized\n");
		IPADMA_ERR("IPADMA isn't initialized\n");
		return;
	}

@@ -836,7 +863,7 @@ static ssize_t ipa_dma_debugfs_reset_statistics(struct file *file,
	switch (in_num) {
	case 0:
		if (ipa_dma_work_pending())
			IPADMA_DBG("Note, there are pending memcpy\n");
			IPADMA_ERR("Note, there are pending memcpy\n");

		atomic_set(&ipa_dma_ctx->total_async_memcpy, 0);
		atomic_set(&ipa_dma_ctx->total_sync_memcpy, 0);
+49 −45
Original line number Diff line number Diff line
@@ -346,7 +346,7 @@ int ipa_send_one(struct ipa_sys_context *sys, struct ipa_desc *desc,
	if (desc->type == IPA_IMM_CMD_DESC) {
		sps_flags |= SPS_IOVEC_FLAG_IMME;
		len = desc->opcode;
		IPADBG("sending cmd=%d pyld_len=%d sps_flags=%x\n",
		IPADBG_LOW("sending cmd=%d pyld_len=%d sps_flags=%x\n",
				desc->opcode, desc->len, sps_flags);
		IPA_DUMP_BUFF(desc->pyld, dma_address, desc->len);
	} else {
@@ -627,7 +627,7 @@ static void ipa_sps_irq_cmd_ack(void *user1, int user2)
		WARN_ON(1);
		return;
	}
	IPADBG("got ack for cmd=%d\n", desc->opcode);
	IPADBG_LOW("got ack for cmd=%d\n", desc->opcode);
	complete(&desc->xfer_done);
}

@@ -644,11 +644,12 @@ static void ipa_sps_irq_cmd_ack(void *user1, int user2)
int ipa_send_cmd(u16 num_desc, struct ipa_desc *descr)
{
	struct ipa_desc *desc;
	int result = 0;
	int i, result = 0;
	struct ipa_sys_context *sys;
	int ep_idx;

	IPADBG("sending command\n");
	for (i = 0; i < num_desc; i++)
		IPADBG_LOW("sending imm cmd %d\n", descr[i].opcode);

	ep_idx = ipa2_get_ep_mapping(IPA_CLIENT_APPS_CMD_PROD);
	if (-1 == ep_idx) {
@@ -709,7 +710,7 @@ static void ipa_sps_irq_tx_notify(struct sps_event_notify *notify)
	struct ipa_sys_context *sys = (struct ipa_sys_context *)notify->user;
	int ret;

	IPADBG("event %d notified\n", notify->event_id);
	IPADBG_LOW("event %d notified\n", notify->event_id);

	switch (notify->event_id) {
	case SPS_EVENT_EOT:
@@ -752,7 +753,7 @@ static void ipa_sps_irq_tx_no_aggr_notify(struct sps_event_notify *notify)
{
	struct ipa_tx_pkt_wrapper *tx_pkt;

	IPADBG("event %d notified\n", notify->event_id);
	IPADBG_LOW("event %d notified\n", notify->event_id);

	switch (notify->event_id) {
	case SPS_EVENT_EOT:
@@ -1599,7 +1600,7 @@ static void ipa_tx_comp_usr_notify_release(void *user1, int user2)
	struct sk_buff *skb = (struct sk_buff *)user1;
	int ep_idx = user2;

	IPADBG("skb=%p ep=%d\n", skb, ep_idx);
	IPADBG_LOW("skb=%p ep=%d\n", skb, ep_idx);

	IPA_STATS_INC_CNT(ipa_ctx->stats.tx_pkts_compl);

@@ -1920,7 +1921,7 @@ static void ipa_replenish_wlan_rx_cache(struct ipa_sys_context *sys)
	int ret;
	u32 rx_len_cached = 0;

	IPADBG("\n");
	IPADBG_LOW("\n");

	spin_lock_bh(&ipa_ctx->wc_memb.wlan_spinlock);
	rx_len_cached = sys->len;
@@ -2350,7 +2351,7 @@ static int ipa_lan_rx_pyld_hdlr(struct sk_buff *skb,
	}

	if (sys->len_partial) {
		IPADBG("len_partial %d\n", sys->len_partial);
		IPADBG_LOW("len_partial %d\n", sys->len_partial);
		buf = skb_push(skb, sys->len_partial);
		memcpy(buf, sys->prev_skb->data, sys->len_partial);
		sys->len_partial = 0;
@@ -2363,7 +2364,7 @@ static int ipa_lan_rx_pyld_hdlr(struct sk_buff *skb,
	 * (status+data)
	 */
	if (sys->len_rem) {
		IPADBG("rem %d skb %d pad %d\n", sys->len_rem, skb->len,
		IPADBG_LOW("rem %d skb %d pad %d\n", sys->len_rem, skb->len,
				sys->len_pad);
		if (sys->len_rem <= skb->len) {
			if (sys->prev_skb) {
@@ -2414,7 +2415,7 @@ static int ipa_lan_rx_pyld_hdlr(struct sk_buff *skb,
begin:
	while (skb->len) {
		sys->drop_packet = false;
		IPADBG("LEN_REM %d\n", skb->len);
		IPADBG_LOW("LEN_REM %d\n", skb->len);

		if (skb->len < IPA_PKT_STATUS_SIZE) {
			WARN_ON(sys->prev_skb != NULL);
@@ -2425,7 +2426,7 @@ static int ipa_lan_rx_pyld_hdlr(struct sk_buff *skb,
		}

		status = (struct ipa_hw_pkt_status *)skb->data;
		IPADBG("STATUS opcode=%d src=%d dst=%d len=%d\n",
		IPADBG_LOW("STATUS opcode=%d src=%d dst=%d len=%d\n",
				status->status_opcode, status->endp_src_idx,
				status->endp_dest_idx, status->pkt_len);
		if (sys->status_stat) {
@@ -2463,7 +2464,7 @@ static int ipa_lan_rx_pyld_hdlr(struct sk_buff *skb,
		if (status->status_mask & IPA_HW_PKT_STATUS_MASK_TAG_VALID) {
			struct ipa_tag_completion *comp;

			IPADBG("TAG packet arrived\n");
			IPADBG_LOW("TAG packet arrived\n");
			if (status->tag_f_2 == IPA_COOKIE) {
				skb_pull(skb, IPA_PKT_STATUS_SIZE);
				if (skb->len < sizeof(comp)) {
@@ -2503,7 +2504,7 @@ static int ipa_lan_rx_pyld_hdlr(struct sk_buff *skb,
			if (skb->len == IPA_PKT_STATUS_SIZE &&
					!status->exception) {
				WARN_ON(sys->prev_skb != NULL);
				IPADBG("Ins header in next buffer\n");
				IPADBG_LOW("Ins header in next buffer\n");
				sys->prev_skb = skb_copy(skb, GFP_KERNEL);
				sys->len_partial =	 skb->len;
				return rc;
@@ -2514,12 +2515,13 @@ static int ipa_lan_rx_pyld_hdlr(struct sk_buff *skb,

			len = status->pkt_len + pad_len_byte +
				IPA_SIZE_DL_CSUM_META_TRAILER;
			IPADBG("pad %d pkt_len %d len %d\n", pad_len_byte,
			IPADBG_LOW("pad %d pkt_len %d len %d\n", pad_len_byte,
					status->pkt_len, len);

			if (status->exception ==
					IPA_HW_PKT_STATUS_EXCEPTION_DEAGGR) {
				IPADBG("Dropping packet on DeAggr Exception\n");
				IPADBG_LOW("Dropping packet");
				IPADBG_LOW(" on DeAggr Exception\n");
				sys->drop_packet = true;
			}

@@ -2528,7 +2530,7 @@ static int ipa_lan_rx_pyld_hdlr(struct sk_buff *skb,
			skb2 = ipa_skb_copy_for_client(skb, skb2_len);
			if (likely(skb2)) {
				if (skb->len < len + IPA_PKT_STATUS_SIZE) {
					IPADBG("SPL skb len %d len %d\n",
					IPADBG_LOW("SPL skb len %d len %d\n",
							skb->len, len);
					sys->prev_skb = skb2;
					sys->len_rem = len - skb->len +
@@ -2538,7 +2540,7 @@ static int ipa_lan_rx_pyld_hdlr(struct sk_buff *skb,
				} else {
					skb_trim(skb2, status->pkt_len +
							IPA_PKT_STATUS_SIZE);
					IPADBG("rx avail for %d\n",
					IPADBG_LOW("rx avail for %d\n",
							status->endp_dest_idx);
					if (sys->drop_packet) {
						dev_kfree_skb_any(skb2);
@@ -2582,11 +2584,12 @@ static int ipa_lan_rx_pyld_hdlr(struct sk_buff *skb,
			}
			/* TX comp */
			ipa_wq_write_done_status(src_pipe);
			IPADBG("tx comp imp for %d\n", src_pipe);
			IPADBG_LOW("tx comp imp for %d\n", src_pipe);
		} else {
			/* TX comp */
			ipa_wq_write_done_status(status->endp_src_idx);
			IPADBG("tx comp exp for %d\n", status->endp_src_idx);
			IPADBG_LOW
				("tx comp exp for %d\n", status->endp_src_idx);
			skb_pull(skb, IPA_PKT_STATUS_SIZE);
			IPA_STATS_INC_CNT(ipa_ctx->stats.stat_compl);
			IPA_STATS_DEC_CNT(
@@ -2622,13 +2625,13 @@ static void wan_rx_handle_splt_pyld(struct sk_buff *skb,
{
	struct sk_buff *skb2;

	IPADBG("rem %d skb %d\n", sys->len_rem, skb->len);
	IPADBG_LOW("rem %d skb %d\n", sys->len_rem, skb->len);
	if (sys->len_rem <= skb->len) {
		if (sys->prev_skb) {
			skb2 = join_prev_skb(sys->prev_skb, skb,
					sys->len_rem);
			if (likely(skb2)) {
				IPADBG(
				IPADBG_LOW(
					"removing Status element from skb and sending to WAN client");
				skb_pull(skb2, IPA_PKT_STATUS_SIZE);
				skb2->truesize = skb2->len +
@@ -2691,14 +2694,14 @@ static int ipa_wan_rx_pyld_hdlr(struct sk_buff *skb,


	while (skb->len) {
		IPADBG("LEN_REM %d\n", skb->len);
		IPADBG_LOW("LEN_REM %d\n", skb->len);
		if (skb->len < IPA_PKT_STATUS_SIZE) {
			IPAERR("status straddles buffer\n");
			WARN_ON(1);
			goto bail;
		}
		status = (struct ipa_hw_pkt_status *)skb->data;
		IPADBG("STATUS opcode=%d src=%d dst=%d len=%d\n",
		IPADBG_LOW("STATUS opcode=%d src=%d dst=%d len=%d\n",
				status->status_opcode, status->endp_src_idx,
				status->endp_dest_idx, status->pkt_len);

@@ -2729,7 +2732,7 @@ static int ipa_wan_rx_pyld_hdlr(struct sk_buff *skb,
			goto bail;
		}
		if (status->pkt_len == 0) {
			IPADBG("Skip aggr close status\n");
			IPADBG_LOW("Skip aggr close status\n");
			skb_pull(skb, IPA_PKT_STATUS_SIZE);
			IPA_STATS_DEC_CNT(ipa_ctx->stats.rx_pkts);
			IPA_STATS_INC_CNT(ipa_ctx->stats.wan_aggr_close);
@@ -2756,11 +2759,11 @@ static int ipa_wan_rx_pyld_hdlr(struct sk_buff *skb,

		/*QMAP is BE: convert the pkt_len field from BE to LE*/
		pkt_len_with_pad = ntohs((qmap_hdr>>16) & 0xffff);
		IPADBG("pkt_len with pad %d\n", pkt_len_with_pad);
		IPADBG_LOW("pkt_len with pad %d\n", pkt_len_with_pad);
		/*get the CHECKSUM_PROCESS bit*/
		checksum_trailer_exists = status->status_mask &
				IPA_HW_PKT_STATUS_MASK_CKSUM_PROCESS;
		IPADBG("checksum_trailer_exists %d\n",
		IPADBG_LOW("checksum_trailer_exists %d\n",
				checksum_trailer_exists);

		frame_len = IPA_PKT_STATUS_SIZE +
@@ -2768,7 +2771,7 @@ static int ipa_wan_rx_pyld_hdlr(struct sk_buff *skb,
			    pkt_len_with_pad;
		if (checksum_trailer_exists)
			frame_len += IPA_DL_CHECKSUM_LENGTH;
		IPADBG("frame_len %d\n", frame_len);
		IPADBG_LOW("frame_len %d\n", frame_len);

		skb2 = skb_clone(skb, GFP_KERNEL);
		if (likely(skb2)) {
@@ -2777,16 +2780,16 @@ static int ipa_wan_rx_pyld_hdlr(struct sk_buff *skb,
			 * payload split across 2 buff
			 */
			if (skb->len < frame_len) {
				IPADBG("SPL skb len %d len %d\n",
				IPADBG_LOW("SPL skb len %d len %d\n",
						skb->len, frame_len);
				sys->prev_skb = skb2;
				sys->len_rem = frame_len - skb->len;
				skb_pull(skb, skb->len);
			} else {
				skb_trim(skb2, frame_len);
				IPADBG("rx avail for %d\n",
				IPADBG_LOW("rx avail for %d\n",
						status->endp_dest_idx);
				IPADBG(
				IPADBG_LOW(
					"removing Status element from skb and sending to WAN client");
				skb_pull(skb2, IPA_PKT_STATUS_SIZE);
				skb2->truesize = skb2->len +
@@ -2927,7 +2930,7 @@ void ipa_lan_rx_cb(void *priv, enum ipa_dp_evt_type evt, unsigned long data)
	 *  ------------------------------------------
	 */
	*(u16 *)rx_skb->cb = ((metadata >> 16) & 0xFFFF);
	IPADBG("meta_data: 0x%x cb: 0x%x\n",
	IPADBG_LOW("meta_data: 0x%x cb: 0x%x\n",
			metadata, *(u32 *)rx_skb->cb);

	ep->client_notify(ep->priv, IPA_RECEIVE, (unsigned long)(rx_skb));
@@ -3030,7 +3033,7 @@ static void ipa_wlan_wq_rx_common(struct ipa_sys_context *sys, u32 size)
static void ipa_dma_memcpy_notify(struct ipa_sys_context *sys,
	struct sps_iovec *iovec)
{
	IPADBG("ENTER.\n");
	IPADBG_LOW("ENTER.\n");
	if (unlikely(list_empty(&sys->head_desc_list))) {
		IPAERR("descriptor list is empty!\n");
		WARN_ON(1);
@@ -3077,7 +3080,8 @@ void ipa_sps_irq_rx_no_aggr_notify(struct sps_event_notify *notify)
		if (IPA_CLIENT_IS_APPS_CONS(rx_pkt->sys->ep->client))
			atomic_set(&ipa_ctx->sps_pm.eot_activity, 1);
		rx_pkt->len = notify->data.transfer.iovec.size;
		IPADBG("event %d notified sys=%p len=%u\n", notify->event_id,
		IPADBG_LOW
			("event %d notified sys=%p len=%u\n", notify->event_id,
				notify->user, rx_pkt->len);
		queue_work(rx_pkt->sys->wq, &rx_pkt->work);
		break;
@@ -3383,15 +3387,15 @@ static void ipa_tx_client_rx_notify_release(void *user1, int user2)
	struct ipa_tx_data_desc *dd = (struct ipa_tx_data_desc *)user1;
	int ep_idx = user2;

	IPADBG("Received data desc anchor:%p\n", dd);
	IPADBG_LOW("Received data desc anchor:%p\n", dd);

	atomic_inc(&ipa_ctx->ep[ep_idx].avail_fifo_desc);
	ipa_ctx->ep[ep_idx].wstats.rx_pkts_status_rcvd++;

  /* wlan host driver waits till tx complete before unload */
	IPADBG("ep=%d fifo_desc_free_count=%d\n",
	IPADBG_LOW("ep=%d fifo_desc_free_count=%d\n",
		ep_idx, atomic_read(&ipa_ctx->ep[ep_idx].avail_fifo_desc));
	IPADBG("calling client notify callback with priv:%p\n",
	IPADBG_LOW("calling client notify callback with priv:%p\n",
		ipa_ctx->ep[ep_idx].priv);

	if (ipa_ctx->ep[ep_idx].client_notify) {
@@ -3455,7 +3459,7 @@ int ipa2_tx_dp_mul(enum ipa_client_type src,
		return -EINVAL;
	}

	IPADBG("Received data desc anchor:%p\n", data_desc);
	IPADBG_LOW("Received data desc anchor:%p\n", data_desc);

	spin_lock_bh(&ipa_ctx->wc_memb.ipa_tx_mul_spinlock);

@@ -3464,7 +3468,7 @@ int ipa2_tx_dp_mul(enum ipa_client_type src,
		IPAERR("dest EP does not exist.\n");
		goto fail_send;
	}
	IPADBG("ep idx:%d\n", ep_idx);
	IPADBG_LOW("ep idx:%d\n", ep_idx);
	sys = ipa_ctx->ep[ep_idx].sys;

	if (unlikely(ipa_ctx->ep[ep_idx].valid == 0)) {
@@ -3478,7 +3482,7 @@ int ipa2_tx_dp_mul(enum ipa_client_type src,
	list_for_each_entry(entry, &data_desc->link, link) {
		num_desc++;
	}
	IPADBG("Number of Data Descriptors:%d", num_desc);
	IPADBG_LOW("Number of Data Descriptors:%d", num_desc);

	if (atomic_read(&sys->ep->avail_fifo_desc) < num_desc) {
		IPAERR("Insufficient data descriptors available\n");
@@ -3488,7 +3492,7 @@ int ipa2_tx_dp_mul(enum ipa_client_type src,
	/* Assign callback only for last data descriptor */
	cnt = 0;
	list_for_each_entry(entry, &data_desc->link, link) {
		IPADBG("Parsing data desc :%d\n", cnt);
		IPADBG_LOW("Parsing data desc :%d\n", cnt);
		cnt++;
		((u8 *)entry->pyld_buffer)[IPA_WLAN_HDR_QMAP_ID_OFFSET] =
			(u8)sys->ep->cfg.meta.qmap_id;
@@ -3497,18 +3501,18 @@ int ipa2_tx_dp_mul(enum ipa_client_type src,
		desc.type = IPA_DATA_DESC_SKB;
		desc.user1 = data_desc;
		desc.user2 = ep_idx;
		IPADBG("priv:%p pyld_buf:0x%p pyld_len:%d\n",
		IPADBG_LOW("priv:%p pyld_buf:0x%p pyld_len:%d\n",
			entry->priv, desc.pyld, desc.len);

		/* In case of last descriptor populate callback */
		if (cnt == num_desc) {
			IPADBG("data desc:%p\n", data_desc);
			IPADBG_LOW("data desc:%p\n", data_desc);
			desc.callback = ipa_tx_client_rx_notify_release;
		} else {
			desc.callback = ipa_tx_client_rx_pkt_status;
		}

		IPADBG("calling ipa_send_one()\n");
		IPADBG_LOW("calling ipa_send_one()\n");
		if (ipa_send_one(sys, &desc, true)) {
			IPAERR("fail to send skb\n");
			sys->ep->wstats.rx_pkt_leak += (cnt-1);
@@ -3520,7 +3524,7 @@ int ipa2_tx_dp_mul(enum ipa_client_type src,
			atomic_dec(&sys->ep->avail_fifo_desc);

		sys->ep->wstats.rx_pkts_rcvd++;
		IPADBG("ep=%d fifo desc=%d\n",
		IPADBG_LOW("ep=%d fifo desc=%d\n",
			ep_idx, atomic_read(&sys->ep->avail_fifo_desc));
	}

+15 −13
Original line number Diff line number Diff line
@@ -209,7 +209,7 @@ static int ipa_generate_flt_hw_rule(enum ipa_ip_type ip,
		}
	}

	IPADBG("en_rule 0x%x, action=%d, rt_idx=%d, uc=%d, retain_hdr=%d\n",
	IPADBG_LOW("en_rule 0x%x, action=%d, rt_idx=%d, uc=%d, retain_hdr=%d\n",
			en_rule,
			hdr->u.hdr.action,
			hdr->u.hdr.rt_tbl_idx,
@@ -601,7 +601,7 @@ static void __ipa_reap_sys_flt_tbls(enum ipa_ip_type ip)

	tbl = &ipa_ctx->glob_flt_tbl[ip];
	if (tbl->prev_mem.phys_base) {
		IPADBG("reaping glob flt tbl (prev) ip=%d\n", ip);
		IPADBG_LOW("reaping glob flt tbl (prev) ip=%d\n", ip);
		dma_free_coherent(ipa_ctx->pdev, tbl->prev_mem.size,
				tbl->prev_mem.base, tbl->prev_mem.phys_base);
		memset(&tbl->prev_mem, 0, sizeof(tbl->prev_mem));
@@ -609,7 +609,7 @@ static void __ipa_reap_sys_flt_tbls(enum ipa_ip_type ip)

	if (list_empty(&tbl->head_flt_rule_list)) {
		if (tbl->curr_mem.phys_base) {
			IPADBG("reaping glob flt tbl (curr) ip=%d\n", ip);
			IPADBG_LOW("reaping glob flt tbl (curr) ip=%d\n", ip);
			dma_free_coherent(ipa_ctx->pdev, tbl->curr_mem.size,
					tbl->curr_mem.base,
					tbl->curr_mem.phys_base);
@@ -620,7 +620,8 @@ static void __ipa_reap_sys_flt_tbls(enum ipa_ip_type ip)
	for (i = 0; i < ipa_ctx->ipa_num_pipes; i++) {
		tbl = &ipa_ctx->flt_tbl[i][ip];
		if (tbl->prev_mem.phys_base) {
			IPADBG("reaping flt tbl (prev) pipe=%d ip=%d\n", i, ip);
			IPADBG_LOW("reaping flt tbl");
			IPADBG_LOW("(prev) pipe=%d ip=%d\n", i, ip);
			dma_free_coherent(ipa_ctx->pdev, tbl->prev_mem.size,
					tbl->prev_mem.base,
					tbl->prev_mem.phys_base);
@@ -629,7 +630,8 @@ static void __ipa_reap_sys_flt_tbls(enum ipa_ip_type ip)

		if (list_empty(&tbl->head_flt_rule_list)) {
			if (tbl->curr_mem.phys_base) {
				IPADBG("reaping flt tbl (curr) pipe=%d ip=%d\n",
				IPADBG_LOW("reaping flt tbl");
				IPADBG_LOW("(curr) pipe=%d ip=%d\n",
						i, ip);
				dma_free_coherent(ipa_ctx->pdev,
						tbl->curr_mem.size,
@@ -899,7 +901,7 @@ int __ipa_commit_flt_v2(enum ipa_ip_type ip)

	for (i = 0; i < 6; i++) {
		if (ipa_ctx->skip_ep_cfg_shadow[i]) {
			IPADBG("skip %d\n", i);
			IPADBG_LOW("skip %d\n", i);
			continue;
		}

@@ -908,7 +910,7 @@ int __ipa_commit_flt_v2(enum ipa_ip_type ip)
			ipa2_get_ep_mapping(IPA_CLIENT_APPS_CMD_PROD) == i ||
			(ipa2_get_ep_mapping(IPA_CLIENT_APPS_LAN_WAN_PROD) == i
			&& ipa_ctx->modem_cfg_emb_pipe_flt)) {
			IPADBG("skip %d\n", i);
			IPADBG_LOW("skip %d\n", i);
			continue;
		}

@@ -934,12 +936,12 @@ int __ipa_commit_flt_v2(enum ipa_ip_type ip)

	for (i = 11; i < ipa_ctx->ipa_num_pipes; i++) {
		if (ipa_ctx->skip_ep_cfg_shadow[i]) {
			IPADBG("skip %d\n", i);
			IPADBG_LOW("skip %d\n", i);
			continue;
		}
		if (ipa2_get_ep_mapping(IPA_CLIENT_APPS_LAN_WAN_PROD) == i &&
			ipa_ctx->modem_cfg_emb_pipe_flt) {
			IPADBG("skip %d\n", i);
			IPADBG_LOW("skip %d\n", i);
			continue;
		}
		if (ip == IPA_IP_v4) {
@@ -1074,7 +1076,7 @@ static int __ipa_add_flt_rule(struct ipa_flt_tbl *tbl, enum ipa_ip_type ip,
	}
	*rule_hdl = id;
	entry->id = id;
	IPADBG("add flt rule rule_cnt=%d\n", tbl->rule_cnt);
	IPADBG_LOW("add flt rule rule_cnt=%d\n", tbl->rule_cnt);

	return 0;
ipa_insert_failed:
@@ -1108,7 +1110,7 @@ static int __ipa_del_flt_rule(u32 rule_hdl)
	entry->tbl->rule_cnt--;
	if (entry->rt_tbl)
		entry->rt_tbl->ref_cnt--;
	IPADBG("del flt rule rule_cnt=%d\n", entry->tbl->rule_cnt);
	IPADBG_LOW("del flt rule rule_cnt=%d\n", entry->tbl->rule_cnt);
	entry->cookie = 0;
	kmem_cache_free(ipa_ctx->flt_rule_cache, entry);

@@ -1194,7 +1196,7 @@ static int __ipa_add_global_flt_rule(enum ipa_ip_type ip,
	}

	tbl = &ipa_ctx->glob_flt_tbl[ip];
	IPADBG("add global flt rule ip=%d\n", ip);
	IPADBG_LOW("add global flt rule ip=%d\n", ip);

	return __ipa_add_flt_rule(tbl, ip, rule, add_rear, rule_hdl);
}
@@ -1221,7 +1223,7 @@ static int __ipa_add_ep_flt_rule(enum ipa_ip_type ip, enum ipa_client_type ep,
		IPADBG("ep not connected ep_idx=%d\n", ipa_ep_idx);

	tbl = &ipa_ctx->flt_tbl[ipa_ep_idx][ip];
	IPADBG("add ep flt rule ip=%d ep=%d\n", ip, ep);
	IPADBG_LOW("add ep flt rule ip=%d ep=%d\n", ip, ep);

	return __ipa_add_flt_rule(tbl, ip, rule, add_rear, rule_hdl);
}
Loading