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

Commit 7039c1b7 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: show equation based filter rule info through debugfs"

parents 956fe5d7 3597751b
Loading
Loading
Loading
Loading
+196 −120
Original line number Original line Diff line number Diff line
@@ -22,71 +22,6 @@
#define IPA_DBG_CNTR_ON 127265
#define IPA_DBG_CNTR_ON 127265
#define IPA_DBG_CNTR_OFF 127264
#define IPA_DBG_CNTR_OFF 127264


const char *ipa_client_name[] = {
	__stringify(IPA_CLIENT_HSIC1_PROD),
	__stringify(IPA_CLIENT_WLAN1_PROD),
	__stringify(IPA_CLIENT_HSIC2_PROD),
	__stringify(IPA_CLIENT_USB2_PROD),
	__stringify(IPA_CLIENT_HSIC3_PROD),
	__stringify(IPA_CLIENT_USB3_PROD),
	__stringify(IPA_CLIENT_HSIC4_PROD),
	__stringify(IPA_CLIENT_USB4_PROD),
	__stringify(IPA_CLIENT_HSIC5_PROD),
	__stringify(IPA_CLIENT_USB_PROD),
	__stringify(IPA_CLIENT_A5_WLAN_AMPDU_PROD),
	__stringify(IPA_CLIENT_A2_EMBEDDED_PROD),
	__stringify(IPA_CLIENT_A2_TETHERED_PROD),
	__stringify(IPA_CLIENT_APPS_LAN_WAN_PROD),
	__stringify(IPA_CLIENT_APPS_CMD_PROD),
	__stringify(IPA_CLIENT_Q6_LAN_PROD),
	__stringify(IPA_CLIENT_Q6_CMD_PROD),

	__stringify(IPA_CLIENT_HSIC1_CONS),
	__stringify(IPA_CLIENT_WLAN1_CONS),
	__stringify(IPA_CLIENT_HSIC2_CONS),
	__stringify(IPA_CLIENT_USB2_CONS),
	__stringify(IPA_CLIENT_WLAN2_CONS),
	__stringify(IPA_CLIENT_HSIC3_CONS),
	__stringify(IPA_CLIENT_USB3_CONS),
	__stringify(IPA_CLIENT_WLAN3_CONS),
	__stringify(IPA_CLIENT_HSIC4_CONS),
	__stringify(IPA_CLIENT_USB4_CONS),
	__stringify(IPA_CLIENT_WLAN4_CONS),
	__stringify(IPA_CLIENT_HSIC5_CONS),
	__stringify(IPA_CLIENT_USB_CONS),
	__stringify(IPA_CLIENT_A2_EMBEDDED_CONS),
	__stringify(IPA_CLIENT_A2_TETHERED_CONS),
	__stringify(IPA_CLIENT_A5_LAN_WAN_CONS),
	__stringify(IPA_CLIENT_APPS_LAN_CONS),
	__stringify(IPA_CLIENT_APPS_WAN_CONS),
	__stringify(IPA_CLIENT_Q6_LAN_CONS),
	__stringify(IPA_CLIENT_Q6_WAN_CONS),
	__stringify(IPA_CLIENT_Q6_DUN_CONS),
};

const char *ipa_ic_name[] = {
	__stringify_1(IPA_IP_CMD_INVALID),
	__stringify_1(IPA_DECIPH_INIT),
	__stringify_1(IPA_PPP_FRM_INIT),
	__stringify_1(IPA_IP_V4_FILTER_INIT),
	__stringify_1(IPA_IP_V6_FILTER_INIT),
	__stringify_1(IPA_IP_V4_NAT_INIT),
	__stringify_1(IPA_IP_V6_NAT_INIT),
	__stringify_1(IPA_IP_V4_ROUTING_INIT),
	__stringify_1(IPA_IP_V6_ROUTING_INIT),
	__stringify_1(IPA_HDR_INIT_LOCAL),
	__stringify_1(IPA_HDR_INIT_SYSTEM),
	__stringify_1(IPA_DECIPH_SETUP),
	__stringify_1(IPA_INSERT_NAT_RULE),
	__stringify_1(IPA_DELETE_NAT_RULE),
	__stringify_1(IPA_NAT_DMA),
	__stringify_1(IPA_IP_PACKET_TAG),
	__stringify_1(IPA_IP_PACKET_INIT),
	__stringify_1(IPA_IP_UNUSED),
	__stringify_1(IPA_IP_UNUSED),
	__stringify_1(IPA_DMA_SHARED_MEM),
};

const char *ipa_excp_name[] = {
const char *ipa_excp_name[] = {
	__stringify_1(IPA_A5_MUX_HDR_EXCP_RSVD0),
	__stringify_1(IPA_A5_MUX_HDR_EXCP_RSVD0),
	__stringify_1(IPA_A5_MUX_HDR_EXCP_RSVD1),
	__stringify_1(IPA_A5_MUX_HDR_EXCP_RSVD1),
@@ -98,6 +33,17 @@ const char *ipa_excp_name[] = {
	__stringify_1(IPA_A5_MUX_HDR_EXCP_FLAG_IP),
	__stringify_1(IPA_A5_MUX_HDR_EXCP_FLAG_IP),
};
};


const char *ipa_status_excp_name[] = {
	__stringify_1(IPA_EXCP_DEAGGR),
	__stringify_1(IPA_EXCP_REPLICATION),
	__stringify_1(IPA_EXCP_IP),
	__stringify_1(IPA_EXCP_IHL),
	__stringify_1(IPA_EXCP_FRAG_MISS),
	__stringify_1(IPA_EXCP_SW),
	__stringify_1(IPA_EXCP_NAT),
	__stringify_1(IPA_EXCP_NONE),
};

const char *ipa_event_name[] = {
const char *ipa_event_name[] = {
	__stringify(WLAN_CLIENT_CONNECT),
	__stringify(WLAN_CLIENT_CONNECT),
	__stringify(WLAN_CLIENT_DISCONNECT),
	__stringify(WLAN_CLIENT_DISCONNECT),
@@ -579,6 +525,110 @@ static int ipa_attrib_dump(char *buff, size_t sz,
	return cnt;
	return cnt;
}
}


static int ipa_attrib_dump_eq(char *buff, size_t sz,
		struct ipa_ipfltri_rule_eq *attrib)
{
	int nbytes = 0;
	int cnt = 0;
	uint8_t addr[16];
	uint8_t mask[16];
	int i;
	int j;

	if (attrib->tos_eq_present) {
		nbytes = scnprintf(buff + cnt, sz - cnt, "tos_value:%d ",
				attrib->tos_eq);
		cnt += nbytes;
	}

	if (attrib->protocol_eq_present) {
		nbytes = scnprintf(buff + cnt, sz - cnt, "protocol:%d ",
				attrib->protocol_eq);
		cnt += nbytes;
	}

	for (i = 0; i < attrib->num_ihl_offset_range_16; i++) {
		nbytes =
		   scnprintf(buff + cnt, sz - cnt,
			   "(ihl_ofst_range16: ofst:%u lo:%u hi:%u) ",
			   attrib->ihl_offset_range_16[i].offset,
			   attrib->ihl_offset_range_16[i].range_low,
			   attrib->ihl_offset_range_16[i].range_high);
		cnt += nbytes;
	}

	for (i = 0; i < attrib->num_offset_meq_32; i++) {
		nbytes =
		   scnprintf(buff + cnt, sz - cnt,
			   "(ofst_meq32: ofst:%u mask:0x%x val:0x%x) ",
			   attrib->offset_meq_32[i].offset,
			   attrib->offset_meq_32[i].mask,
			   attrib->offset_meq_32[i].value);
		cnt += nbytes;
	}

	if (attrib->tc_eq_present) {
		nbytes = scnprintf(buff + cnt, sz - cnt, "tc:%d ",
				attrib->tc_eq);
		cnt += nbytes;
	}

	if (attrib->fl_eq_present) {
		nbytes = scnprintf(buff + cnt, sz - cnt, "flow_label:%d ",
				attrib->fl_eq);
		cnt += nbytes;
	}

	if (attrib->ihl_offset_eq_16_present) {
		nbytes = scnprintf(buff + cnt, sz - cnt,
				"(ihl_ofst_eq16:%d val:0x%x) ",
				attrib->ihl_offset_eq_16.offset,
				attrib->ihl_offset_eq_16.value);
		cnt += nbytes;
	}

	for (i = 0; i < attrib->num_ihl_offset_meq_32; i++) {
		nbytes = scnprintf(buff + cnt, sz - cnt,
				"(ihl_ofst_meq32: ofts:%d mask:0x%x val:0x%x) ",
				attrib->ihl_offset_meq_32[i].offset,
				attrib->ihl_offset_meq_32[i].mask,
				attrib->ihl_offset_meq_32[i].value);
		cnt += nbytes;
	}

	for (i = 0; i < attrib->num_offset_meq_128; i++) {
		for (j = 0; j < 16; j++) {
			addr[j] = attrib->offset_meq_128[i].value[j];
			mask[j] = attrib->offset_meq_128[i].mask[j];
		}
		nbytes = scnprintf(buff + cnt, sz - cnt,
				"(ofst_meq128: ofst:%d mask:%pI6 val:%pI6) ",
				attrib->offset_meq_128[i].offset,
				mask + 0,
				addr + 0);
		cnt += nbytes;
	}

	if (attrib->metadata_meq32_present) {
		nbytes = scnprintf(buff + cnt, sz - cnt,
				"(metadata: ofst:%u mask:0x%x val:0x%x) ",
				attrib->metadata_meq32.offset,
				attrib->metadata_meq32.mask,
				attrib->metadata_meq32.value);
		cnt += nbytes;
	}

	if (attrib->ipv4_frag_eq_present) {
		nbytes = scnprintf(buff + cnt, sz - cnt, "frg ");
		cnt += nbytes;
	}

	nbytes = scnprintf(buff + cnt, sz - cnt, "\n");
	cnt += nbytes;

	return cnt;
}

static int ipa_open_dbg(struct inode *inode, struct file *file)
static int ipa_open_dbg(struct inode *inode, struct file *file)
{
{
	file->private_data = inode->i_private;
	file->private_data = inode->i_private;
@@ -635,10 +685,9 @@ static ssize_t ipa_read_rt(struct file *file, char __user *ubuf, size_t count,
				hdr_ofst = 0;
				hdr_ofst = 0;
			nbytes = scnprintf(dbg_buff + cnt,
			nbytes = scnprintf(dbg_buff + cnt,
					IPA_MAX_MSG_LEN - cnt,
					IPA_MAX_MSG_LEN - cnt,
					"tbl_idx:%d tbl_name:%s tbl_ref:%u rule_idx:%d dst:%d name:%s ep:%d S:%u hdr_ofst[words]:%u attrib_mask:%08x ",
					"tbl_idx:%d tbl_name:%s tbl_ref:%u rule_idx:%d dst:%d ep:%d S:%u hdr_ofst[words]:%u attrib_mask:%08x ",
					entry->tbl->idx, entry->tbl->name,
					entry->tbl->idx, entry->tbl->name,
					entry->tbl->ref_cnt, i, entry->rule.dst,
					entry->tbl->ref_cnt, i, entry->rule.dst,
					ipa_client_name[entry->rule.dst],
					ipa_get_ep_mapping(entry->rule.dst),
					ipa_get_ep_mapping(entry->rule.dst),
					!ipa_ctx->hdr_tbl_lcl,
					!ipa_ctx->hdr_tbl_lcl,
					hdr_ofst >> 2,
					hdr_ofst >> 2,
@@ -669,24 +718,39 @@ static ssize_t ipa_read_flt(struct file *file, char __user *ubuf, size_t count,
	enum ipa_ip_type ip = (enum ipa_ip_type)file->private_data;
	enum ipa_ip_type ip = (enum ipa_ip_type)file->private_data;
	struct ipa_rt_tbl *rt_tbl;
	struct ipa_rt_tbl *rt_tbl;
	u32 rt_tbl_idx;
	u32 rt_tbl_idx;
	u32 bitmap;
	bool eq;


	tbl = &ipa_ctx->glob_flt_tbl[ip];
	tbl = &ipa_ctx->glob_flt_tbl[ip];
	mutex_lock(&ipa_ctx->lock);
	mutex_lock(&ipa_ctx->lock);
	i = 0;
	i = 0;
	list_for_each_entry(entry, &tbl->head_flt_rule_list, link) {
	list_for_each_entry(entry, &tbl->head_flt_rule_list, link) {
		rt_tbl = (struct ipa_rt_tbl *)entry->rule.rt_tbl_hdl;
		if (entry->rule.eq_attrib_type) {
		if (rt_tbl == NULL)
			rt_tbl_idx = entry->rule.rt_tbl_idx;
			rt_tbl_idx = entry->rule.rt_tbl_idx;
		else
			bitmap = entry->rule.eq_attrib.rule_eq_bitmap;
			eq = true;
		} else {
			rt_tbl = (struct ipa_rt_tbl *)entry->rule.rt_tbl_hdl;
			if (rt_tbl)
				rt_tbl_idx = rt_tbl->idx;
				rt_tbl_idx = rt_tbl->idx;
			else
				rt_tbl_idx = ~0;
			bitmap = entry->rule.attrib.attrib_mask;
			eq = false;
		}
		nbytes = scnprintf(dbg_buff + cnt, IPA_MAX_MSG_LEN - cnt,
		nbytes = scnprintf(dbg_buff + cnt, IPA_MAX_MSG_LEN - cnt,
			   "ep_idx:global rule_idx:%d act:%d rt_tbl_idx:%d "
			   "ep_idx:global rule_idx:%d act:%d rt_tbl_idx:%d "
				   "attrib_mask:%08x to_uc:%d, retain_hdr:%d ",
			   "attrib_mask:%08x to_uc:%d, retain_hdr:%d eq:%d ",
				   i, entry->rule.action, rt_tbl_idx,
			   i, entry->rule.action, rt_tbl_idx, bitmap,
				   entry->rule.attrib.attrib_mask,
			   entry->rule.to_uc, entry->rule.retain_hdr, eq);
				   entry->rule.to_uc, entry->rule.retain_hdr);
		cnt += nbytes;
		cnt += nbytes;
		cnt += ipa_attrib_dump(dbg_buff + cnt, IPA_MAX_MSG_LEN - cnt,
		if (eq)
			cnt += ipa_attrib_dump_eq(dbg_buff + cnt,
				IPA_MAX_MSG_LEN - cnt,
				&entry->rule.eq_attrib);
		else
			cnt += ipa_attrib_dump(dbg_buff + cnt,
				IPA_MAX_MSG_LEN - cnt,
				&entry->rule.attrib, ip);
				&entry->rule.attrib, ip);
		i++;
		i++;
	}
	}
@@ -696,26 +760,35 @@ static ssize_t ipa_read_flt(struct file *file, char __user *ubuf, size_t count,
		i = 0;
		i = 0;
		list_for_each_entry(entry, &tbl->head_flt_rule_list, link) {
		list_for_each_entry(entry, &tbl->head_flt_rule_list, link) {
			rt_tbl = (struct ipa_rt_tbl *)entry->rule.rt_tbl_hdl;
			rt_tbl = (struct ipa_rt_tbl *)entry->rule.rt_tbl_hdl;
			if (rt_tbl == NULL)
			if (entry->rule.eq_attrib_type) {
				rt_tbl_idx = ~0;
				rt_tbl_idx = entry->rule.rt_tbl_idx;
			else
				bitmap = entry->rule.eq_attrib.rule_eq_bitmap;
				eq = true;
			} else {
				if (rt_tbl)
					rt_tbl_idx = rt_tbl->idx;
					rt_tbl_idx = rt_tbl->idx;
				else
					rt_tbl_idx = ~0;
				bitmap = entry->rule.attrib.attrib_mask;
				eq = false;
			}
			k = ipa_get_client_mapping(j);
			k = ipa_get_client_mapping(j);
			nbytes = scnprintf(dbg_buff + cnt,
			nbytes = scnprintf(dbg_buff + cnt,
				IPA_MAX_MSG_LEN - cnt,
				IPA_MAX_MSG_LEN - cnt,
					"ep_idx:%d name:%s rule_idx:%d act:%d rt_tbl_idx:%d "
				"ep_idx:%d rule_idx:%d act:%d rt_tbl_idx:%d "
					"attrib_mask:%08x to_uc:%d, retain_hdr:%d ",
				"attrib_mask:%08x to_uc:%d, retain_hdr:%d eq:%d ",
					j, ipa_client_name[k], i,
				j, i, entry->rule.action,
					entry->rule.action, rt_tbl_idx,
				rt_tbl_idx, bitmap, entry->rule.to_uc,
					entry->rule.attrib.attrib_mask,
				entry->rule.retain_hdr, eq);
					entry->rule.to_uc,
			cnt += nbytes;
					entry->rule.retain_hdr);
			if (eq)
			cnt += nbytes;
				cnt += ipa_attrib_dump_eq(dbg_buff + cnt,
			cnt +=
			   ipa_attrib_dump(dbg_buff + cnt,
					IPA_MAX_MSG_LEN - cnt,
					IPA_MAX_MSG_LEN - cnt,
					   &entry->rule.attrib,
					&entry->rule.eq_attrib);
					   ip);
			else
				cnt += ipa_attrib_dump(dbg_buff + cnt,
					IPA_MAX_MSG_LEN - cnt,
					&entry->rule.attrib, ip);
			i++;
			i++;
		}
		}
	}
	}
@@ -735,13 +808,34 @@ static ssize_t ipa_read_stats(struct file *file, char __user *ubuf,
	for (i = 0; i < IPA_NUM_PIPES; i++)
	for (i = 0; i < IPA_NUM_PIPES; i++)
		connect |= (ipa_ctx->ep[i].valid << i);
		connect |= (ipa_ctx->ep[i].valid << i);


	if (ipa_ctx->ipa_hw_type == IPA_HW_v2_0) {
		nbytes = scnprintf(dbg_buff, IPA_MAX_MSG_LEN,
			"sw_tx=%u\n"
			"hw_tx=%u\n"
			"tx_compl=%u\n"
			"wan_rx=%u\n"
			"con_clnt_bmap=0x%x\n",
			ipa_ctx->stats.tx_sw_pkts,
			ipa_ctx->stats.tx_hw_pkts,
			ipa_ctx->stats.tx_pkts_compl,
			ipa_ctx->stats.rx_pkts,
			connect);
		cnt += nbytes;

		for (i = 0; i < MAX_NUM_EXCP; i++) {
			nbytes = scnprintf(dbg_buff + cnt,
				IPA_MAX_MSG_LEN - cnt,
				"lan_rx_excp[%u:%20s]=%u\n", i,
				ipa_status_excp_name[i],
				ipa_ctx->stats.rx_excp_pkts[i]);
			cnt += nbytes;
		}
	} else{
		nbytes = scnprintf(dbg_buff, IPA_MAX_MSG_LEN,
		nbytes = scnprintf(dbg_buff, IPA_MAX_MSG_LEN,
			"sw_tx=%u\n"
			"sw_tx=%u\n"
			"hw_tx=%u\n"
			"hw_tx=%u\n"
			"rx=%u\n"
			"rx=%u\n"
			"rx_repl_repost=%u\n"
			"rx_repl_repost=%u\n"
			"x_intr_repost=%u\n"
			"x_intr_repost_tx=%u\n"
			"rx_q_len=%u\n"
			"rx_q_len=%u\n"
			"act_clnt=%u\n"
			"act_clnt=%u\n"
			"con_clnt_bmap=0x%x\n"
			"con_clnt_bmap=0x%x\n"
@@ -755,8 +849,6 @@ static ssize_t ipa_read_stats(struct file *file, char __user *ubuf,
			ipa_ctx->stats.tx_hw_pkts,
			ipa_ctx->stats.tx_hw_pkts,
			ipa_ctx->stats.rx_pkts,
			ipa_ctx->stats.rx_pkts,
			ipa_ctx->stats.rx_repl_repost,
			ipa_ctx->stats.rx_repl_repost,
			ipa_ctx->stats.x_intr_repost,
			ipa_ctx->stats.x_intr_repost_tx,
			ipa_ctx->stats.rx_q_len,
			ipa_ctx->stats.rx_q_len,
			ipa_ctx->ipa_active_clients,
			ipa_ctx->ipa_active_clients,
			connect,
			connect,
@@ -769,28 +861,12 @@ static ssize_t ipa_read_stats(struct file *file, char __user *ubuf,
	cnt += nbytes;
	cnt += nbytes;


		for (i = 0; i < MAX_NUM_EXCP; i++) {
		for (i = 0; i < MAX_NUM_EXCP; i++) {
		nbytes = scnprintf(dbg_buff + cnt, IPA_MAX_MSG_LEN - cnt,
			nbytes = scnprintf(dbg_buff + cnt,
				IPA_MAX_MSG_LEN - cnt,
				"rx_excp[%u:%35s]=%u\n", i, ipa_excp_name[i],
				"rx_excp[%u:%35s]=%u\n", i, ipa_excp_name[i],
				ipa_ctx->stats.rx_excp_pkts[i]);
				ipa_ctx->stats.rx_excp_pkts[i]);
			cnt += nbytes;
			cnt += nbytes;
		}
		}

	for (i = 0; i < IPA_BRIDGE_TYPE_MAX; i++) {
		nbytes = scnprintf(dbg_buff + cnt, IPA_MAX_MSG_LEN - cnt,
				"brg_pkt[%u:%s][dl]=%u\n"
				"brg_pkt[%u:%s][ul]=%u\n",
				i, (i == 0) ? "teth" : "embd",
				ipa_ctx->stats.bridged_pkts[i][0],
				i, (i == 0) ? "teth" : "embd",
				ipa_ctx->stats.bridged_pkts[i][1]);
		cnt += nbytes;
	}

	for (i = 0; i < ARRAY_SIZE(ipa_ic_name); i++) {
		nbytes = scnprintf(dbg_buff + cnt, IPA_MAX_MSG_LEN - cnt,
				"IC[%2u:%22s]=%u\n", i, ipa_ic_name[i],
				ipa_ctx->stats.imm_cmds[i]);
		cnt += nbytes;
	}
	}


	return simple_read_from_buffer(ubuf, count, ppos, dbg_buff, cnt);
	return simple_read_from_buffer(ubuf, count, ppos, dbg_buff, cnt);
+6 −7
Original line number Original line Diff line number Diff line
@@ -203,7 +203,6 @@ static void ipa_tx_switch_to_intr_mode(struct ipa_sys_context *sys)
	return;
	return;


fail:
fail:
	IPA_STATS_INC_CNT(ipa_ctx->stats.x_intr_repost_tx);
	queue_delayed_work(sys->wq, &sys->switch_to_intr_work,
	queue_delayed_work(sys->wq, &sys->switch_to_intr_work,
			msecs_to_jiffies(1));
			msecs_to_jiffies(1));
	return;
	return;
@@ -610,7 +609,6 @@ int ipa_send_cmd(u16 num_desc, struct ipa_desc *descr)
		wait_for_completion(&desc->xfer_done);
		wait_for_completion(&desc->xfer_done);
	}
	}


	IPA_STATS_INC_IC_CNT(num_desc, descr, ipa_ctx->stats.imm_cmds);
bail:
bail:
	ipa_dec_client_disable_clks();
	ipa_dec_client_disable_clks();
	return result;
	return result;
@@ -767,7 +765,6 @@ static void ipa_rx_switch_to_intr_mode(struct ipa_sys_context *sys)
	return;
	return;


fail:
fail:
	IPA_STATS_INC_CNT(ipa_ctx->stats.x_intr_repost);
	queue_delayed_work(sys->wq, &sys->switch_to_intr_work,
	queue_delayed_work(sys->wq, &sys->switch_to_intr_work,
			msecs_to_jiffies(1));
			msecs_to_jiffies(1));
}
}
@@ -1132,8 +1129,7 @@ static void ipa_tx_comp_usr_notify_release(void *user1, void *user2)


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


	IPA_STATS_INC_TX_CNT(ep_idx, ipa_ctx->stats.tx_sw_pkts,
	IPA_STATS_INC_CNT(ipa_ctx->stats.tx_pkts_compl);
			ipa_ctx->stats.tx_hw_pkts);


	if (ipa_ctx->ep[ep_idx].client_notify)
	if (ipa_ctx->ep[ep_idx].client_notify)
		ipa_ctx->ep[ep_idx].client_notify(ipa_ctx->ep[ep_idx].priv,
		ipa_ctx->ep[ep_idx].client_notify(ipa_ctx->ep[ep_idx].priv,
@@ -1236,7 +1232,7 @@ int ipa_tx_dp(enum ipa_client_type dst, struct sk_buff *skb,
			IPAERR("fail to send immediate command\n");
			IPAERR("fail to send immediate command\n");
			goto fail_send;
			goto fail_send;
		}
		}
		IPA_STATS_INC_CNT(ipa_ctx->stats.imm_cmds[IPA_IP_PACKET_INIT]);
		IPA_STATS_INC_CNT(ipa_ctx->stats.tx_sw_pkts);
	} else {
	} else {
		/* HW data path */
		/* HW data path */
		desc[0].pyld = skb->data;
		desc[0].pyld = skb->data;
@@ -1250,6 +1246,7 @@ int ipa_tx_dp(enum ipa_client_type dst, struct sk_buff *skb,
			IPAERR("fail to send skb\n");
			IPAERR("fail to send skb\n");
			goto fail_gen;
			goto fail_gen;
		}
		}
		IPA_STATS_INC_CNT(ipa_ctx->stats.tx_hw_pkts);
	}
	}


	return 0;
	return 0;
@@ -1579,12 +1576,13 @@ begin:
		IPADBG("STATUS opcode=%d src=%d dst=%d len=%d\n",
		IPADBG("STATUS opcode=%d src=%d dst=%d len=%d\n",
				status->status_opcode, status->endp_src_idx,
				status->status_opcode, status->endp_src_idx,
				status->endp_dest_idx, status->pkt_len);
				status->endp_dest_idx, status->pkt_len);

		if (status->status_opcode != IPA_HW_STATUS_OPCODE_PACKET) {
		if (status->status_opcode != IPA_HW_STATUS_OPCODE_PACKET) {
			IPAERR("unsupported opcode\n");
			IPAERR("unsupported opcode\n");
			skb_pull(skb, IPA_PKT_STATUS_SIZE);
			skb_pull(skb, IPA_PKT_STATUS_SIZE);
			continue;
			continue;
		}
		}
		IPA_STATS_EXCP_CNT(status->exception,
				ipa_ctx->stats.rx_excp_pkts);
		if (status->endp_dest_idx >= IPA_NUM_PIPES ||
		if (status->endp_dest_idx >= IPA_NUM_PIPES ||
			status->endp_src_idx >= IPA_NUM_PIPES ||
			status->endp_src_idx >= IPA_NUM_PIPES ||
			status->pkt_len > IPA_GENERIC_AGGR_BYTE_LIMIT * 1024) {
			status->pkt_len > IPA_GENERIC_AGGR_BYTE_LIMIT * 1024) {
@@ -1764,6 +1762,7 @@ static int ipa_wan_rx_pyld_hdlr(struct sk_buff *skb,
			skb_pull(skb, IPA_PKT_STATUS_SIZE);
			skb_pull(skb, IPA_PKT_STATUS_SIZE);
			continue;
			continue;
		}
		}
		IPA_STATS_INC_CNT(ipa_ctx->stats.rx_pkts);
		if (status->endp_dest_idx >= IPA_NUM_PIPES ||
		if (status->endp_dest_idx >= IPA_NUM_PIPES ||
			status->endp_src_idx >= IPA_NUM_PIPES ||
			status->endp_src_idx >= IPA_NUM_PIPES ||
			status->pkt_len > IPA_GENERIC_AGGR_BYTE_LIMIT * 1024) {
			status->pkt_len > IPA_GENERIC_AGGR_BYTE_LIMIT * 1024) {
+1 −15
Original line number Original line Diff line number Diff line
/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * it under the terms of the GNU General Public License version 2 and
@@ -35,20 +35,6 @@
#define IPA_IP_PACKET_INIT    (16)
#define IPA_IP_PACKET_INIT    (16)
#define IPA_DMA_SHARED_MEM    (19)
#define IPA_DMA_SHARED_MEM    (19)


#define IPA_INTERFACE_ID_EXCEPTION         (0)
#define IPA_INTERFACE_ID_A2_WWAN        (0x10)
#define IPA_INTERFACE_ID_HSUSB_RMNET1   (0x21)
#define IPA_INTERFACE_ID_HSUSB_RMNET2   (0x22)
#define IPA_INTERFACE_ID_HSUSB_RMNET3   (0x23)
#define IPA_INTERFACE_ID_HSIC_WLAN_WAN  (0x31)
#define IPA_INTERFACE_ID_HSIC_WLAN_LAN1 (0x32)
#define IPA_INTERFACE_ID_HSIC_WLAN_LAN2 (0x33)
#define IPA_INTERFACE_ID_HSIC_RMNET1    (0x41)
#define IPA_INTERFACE_ID_HSIC_RMNET2    (0x42)
#define IPA_INTERFACE_ID_HSIC_RMNET3    (0x43)
#define IPA_INTERFACE_ID_HSIC_RMNET4    (0x44)
#define IPA_INTERFACE_ID_HSIC_RMNET5    (0x45)

/**
/**
 * struct ipa_flt_rule_hw_hdr - HW header of IPA filter rule
 * struct ipa_flt_rule_hw_hdr - HW header of IPA filter rule
 * @word: filtering rule properties
 * @word: filtering rule properties
+4 −19
Original line number Original line Diff line number Diff line
@@ -50,7 +50,6 @@
#define WLAN4_CONS_RX_EP  18
#define WLAN4_CONS_RX_EP  18


#define MAX_NUM_EXCP     8
#define MAX_NUM_EXCP     8
#define MAX_NUM_IMM_CMD 20


#define IPA_STATS
#define IPA_STATS


@@ -66,17 +65,8 @@
			for (i = 0; i < MAX_NUM_EXCP; i++)	\
			for (i = 0; i < MAX_NUM_EXCP; i++)	\
				if (flags & BIT(i))		\
				if (flags & BIT(i))		\
					++base[i];		\
					++base[i];		\
			} while (0)
			if (flags == 0)				\
#define IPA_STATS_INC_TX_CNT(ep, sw, hw) do {		\
				++base[MAX_NUM_EXCP - 1];	\
			if (ep == WLAN_AMPDU_TX_EP)	\
				++hw;			\
			else				\
				++sw;			\
			} while (0)
#define IPA_STATS_INC_IC_CNT(num, base, stat_base) do {			\
			int i;						\
			for (i = 0; i < num; i++)			\
				++stat_base[base[i].opcode];		\
			} while (0)
			} while (0)
#define IPA_STATS_INC_BRIDGE_CNT(type, dir, base) do {		\
#define IPA_STATS_INC_BRIDGE_CNT(type, dir, base) do {		\
			++base[type][dir];			\
			++base[type][dir];			\
@@ -85,8 +75,6 @@
#define IPA_STATS_INC_CNT(x) do { } while (0)
#define IPA_STATS_INC_CNT(x) do { } while (0)
#define IPA_STATS_INC_CNT_SAFE(x) do { } while (0)
#define IPA_STATS_INC_CNT_SAFE(x) do { } while (0)
#define IPA_STATS_EXCP_CNT(flags, base) do { } while (0)
#define IPA_STATS_EXCP_CNT(flags, base) do { } while (0)
#define IPA_STATS_INC_TX_CNT(ep, sw, hw) do { } while (0)
#define IPA_STATS_INC_IC_CNT(num, base, stat_base) do { } while (0)
#define IPA_STATS_INC_BRIDGE_CNT(type, dir, base) do { } while (0)
#define IPA_STATS_INC_BRIDGE_CNT(type, dir, base) do { } while (0)
#endif
#endif


@@ -554,15 +542,12 @@ enum ipa_config_this_ep {
};
};


struct ipa_stats {
struct ipa_stats {
	u32 imm_cmds[MAX_NUM_IMM_CMD];
	u32 tx_sw_pkts;
	u32 tx_sw_pkts;
	u32 tx_hw_pkts;
	u32 tx_hw_pkts;
	u32 rx_pkts;
	u32 rx_pkts;
	u32 rx_excp_pkts[MAX_NUM_EXCP];
	u32 rx_excp_pkts[MAX_NUM_EXCP];
	u32 bridged_pkts[IPA_BRIDGE_TYPE_MAX][IPA_BRIDGE_DIR_MAX];
	u32 rx_repl_repost;
	u32 rx_repl_repost;
	u32 x_intr_repost;
	u32 tx_pkts_compl;
	u32 x_intr_repost_tx;
	u32 rx_q_len;
	u32 rx_q_len;
	u32 msg_w[IPA_EVENT_MAX];
	u32 msg_w[IPA_EVENT_MAX];
	u32 msg_r[IPA_EVENT_MAX];
	u32 msg_r[IPA_EVENT_MAX];