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

Commit adaa3246 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 new IPA filtering bitmap"

parents 0fea7ce3 a969e0ff
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
 *
 * 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
@@ -580,6 +580,15 @@ static int ipa_attrib_dump(struct ipa_rule_attrib *attrib,
	if (attrib->attrib_mask & IPA_FLT_MAC_ETHER_TYPE)
		pr_err("ether_type:%x ", attrib->ether_type);

	if (attrib->attrib_mask & IPA_FLT_L2TP_INNER_IP_TYPE)
		pr_err("l2tp inner ip type: %d ", attrib->type);

	if (attrib->attrib_mask & IPA_FLT_L2TP_INNER_IPV4_DST_ADDR) {
		addr[0] = htonl(attrib->u.v4.dst_addr);
		mask[0] = htonl(attrib->u.v4.dst_addr_mask);
		pr_err("dst_addr:%pI4 dst_addr_mask:%pI4 ", addr, mask);
	}

	pr_err("\n");
	return 0;
}
+61 −0
Original line number Diff line number Diff line
@@ -1527,6 +1527,37 @@ int ipa_generate_hw_rule(enum ipa_ip_type ip,
			ihl_ofst_meq32++;
		}

		if (attrib->attrib_mask & IPA_FLT_L2TP_INNER_IP_TYPE) {
			if (ipa_ihl_ofst_meq32[ihl_ofst_meq32] == -1) {
				IPAERR("ran out of ihl_meq32 eq\n");
				return -EPERM;
			}
			*en_rule |= ipa_ihl_ofst_meq32[ihl_ofst_meq32];
			/* 22  => offset of IP type after v6 header */
			*buf = ipa_write_8(22, *buf);
			*buf = ipa_write_32(0xF0000000, *buf);
			if (attrib->type == 0x40)
				*buf = ipa_write_32(0x40000000, *buf);
			else
				*buf = ipa_write_32(0x60000000, *buf);
			*buf = ipa_pad_to_32(*buf);
			ihl_ofst_meq32++;
		}

		if (attrib->attrib_mask & IPA_FLT_L2TP_INNER_IPV4_DST_ADDR) {
			if (ipa_ihl_ofst_meq32[ihl_ofst_meq32] == -1) {
				IPAERR("ran out of ihl_meq32 eq\n");
				return -EPERM;
			}
			*en_rule |= ipa_ihl_ofst_meq32[ihl_ofst_meq32];
			/* 38  => offset of inner IPv4 addr */
			*buf = ipa_write_8(38, *buf);
			*buf = ipa_write_32(attrib->u.v4.dst_addr_mask, *buf);
			*buf = ipa_write_32(attrib->u.v4.dst_addr, *buf);
			*buf = ipa_pad_to_32(*buf);
			ihl_ofst_meq32++;
		}

		if (attrib->attrib_mask & IPA_FLT_SRC_PORT) {
			if (ipa_ihl_ofst_rng16[ihl_ofst_rng16] == -1) {
				IPAERR("ran out of ihl_rng16 eq\n");
@@ -2126,6 +2157,36 @@ int ipa_generate_flt_eq(enum ipa_ip_type ip,
			ihl_ofst_meq32++;
		}

		if (attrib->attrib_mask & IPA_FLT_L2TP_INNER_IP_TYPE) {
			if (ipa_ihl_ofst_meq32[ihl_ofst_meq32] == -1) {
				IPAERR("ran out of ihl_meq32 eq\n");
				return -EPERM;
			}
			*en_rule |= ipa_ihl_ofst_meq32[ihl_ofst_meq32];
			/* 22  => offset of inner IP type after v6 header */
			eq_atrb->ihl_offset_meq_32[ihl_ofst_meq32].offset = 22;
			eq_atrb->ihl_offset_meq_32[ihl_ofst_meq32].mask =
				0xF0000000;
			eq_atrb->ihl_offset_meq_32[ihl_ofst_meq32].value =
				(u32)attrib->type << 24;
			ihl_ofst_meq32++;
		}

		if (attrib->attrib_mask & IPA_FLT_L2TP_INNER_IPV4_DST_ADDR) {
			if (ipa_ihl_ofst_meq32[ihl_ofst_meq32] == -1) {
				IPAERR("ran out of ihl_meq32 eq\n");
				return -EPERM;
			}
			*en_rule |= ipa_ihl_ofst_meq32[ihl_ofst_meq32];
			/* 38  => offset of inner IPv4 addr */
			eq_atrb->ihl_offset_meq_32[ihl_ofst_meq32].offset = 38;
			eq_atrb->ihl_offset_meq_32[ihl_ofst_meq32].mask =
				attrib->u.v4.dst_addr_mask;
			eq_atrb->ihl_offset_meq_32[ihl_ofst_meq32].value =
				attrib->u.v4.dst_addr;
			ihl_ofst_meq32++;
		}

		if (attrib->attrib_mask & IPA_FLT_SRC_PORT) {
			if (ipa_ihl_ofst_rng16[ihl_ofst_rng16] == -1) {
				IPAERR_RL("ran out of ihl_rng16 eq\n");
+10 −1
Original line number Diff line number Diff line
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
 *
 * 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
@@ -514,6 +514,15 @@ static int ipa3_attrib_dump(struct ipa_rule_attrib *attrib,
	if (attrib->attrib_mask & IPA_FLT_TCP_SYN_L2TP)
		pr_err("tcp syn l2tp ");

	if (attrib->attrib_mask & IPA_FLT_L2TP_INNER_IP_TYPE)
		pr_err("l2tp inner ip type: %d ", attrib->type);

	if (attrib->attrib_mask & IPA_FLT_L2TP_INNER_IPV4_DST_ADDR) {
		addr[0] = htonl(attrib->u.v4.dst_addr);
		mask[0] = htonl(attrib->u.v4.dst_addr_mask);
		pr_err("dst_addr:%pI4 dst_addr_mask:%pI4 ", addr, mask);
	}

	pr_err("\n");
	return 0;
}
+59 −0
Original line number Diff line number Diff line
@@ -2736,6 +2736,35 @@ static int ipa3_generate_hw_rule_ip6(u16 *en_rule,
		ihl_ofst_meq32 += 2;
	}

	if (attrib->attrib_mask & IPA_FLT_L2TP_INNER_IP_TYPE) {
		if (ipa_ihl_ofst_meq32[ihl_ofst_meq32] == -1) {
			IPAERR("ran out of ihl_meq32 eq\n");
			goto err;
		}
		*en_rule |= ipa_ihl_ofst_meq32[ihl_ofst_meq32];
		/* 22  => offset of IP type after v6 header */
		extra = ipa3_write_8(22, extra);
		rest = ipa3_write_32(0xF0000000, rest);
		if (attrib->type == 0x40)
			rest = ipa3_write_32(0x40000000, rest);
		else
			rest = ipa3_write_32(0x60000000, rest);
		ihl_ofst_meq32++;
	}

	if (attrib->attrib_mask & IPA_FLT_L2TP_INNER_IPV4_DST_ADDR) {
		if (ipa_ihl_ofst_meq32[ihl_ofst_meq32] == -1) {
			IPAERR("ran out of ihl_meq32 eq\n");
			goto err;
		}
		*en_rule |= ipa_ihl_ofst_meq32[ihl_ofst_meq32];
		/* 38  => offset of inner IPv4 addr */
		extra = ipa3_write_8(38, extra);
		rest = ipa3_write_32(attrib->u.v4.dst_addr_mask, rest);
		rest = ipa3_write_32(attrib->u.v4.dst_addr, rest);
		ihl_ofst_meq32++;
	}

	if (attrib->attrib_mask & IPA_FLT_META_DATA) {
		*en_rule |= IPA_METADATA_COMPARE;
		rest = ipa3_write_32(attrib->meta_data_mask, rest);
@@ -3555,6 +3584,36 @@ int ipa3_generate_flt_eq_ip6(enum ipa_ip_type ip,
		ihl_ofst_meq32 += 2;
	}

	if (attrib->attrib_mask & IPA_FLT_L2TP_INNER_IP_TYPE) {
		if (ipa_ihl_ofst_meq32[ihl_ofst_meq32] == -1) {
			IPAERR("ran out of ihl_meq32 eq\n");
			return -EPERM;
		}
		*en_rule |= ipa_ihl_ofst_meq32[ihl_ofst_meq32];
		/* 22  => offset of inner IP type after v6 header */
		eq_atrb->ihl_offset_meq_32[ihl_ofst_meq32].offset = 22;
		eq_atrb->ihl_offset_meq_32[ihl_ofst_meq32].mask =
			0xF0000000;
		eq_atrb->ihl_offset_meq_32[ihl_ofst_meq32].value =
			(u32)attrib->type << 24;
		ihl_ofst_meq32++;
	}

	if (attrib->attrib_mask & IPA_FLT_L2TP_INNER_IPV4_DST_ADDR) {
		if (ipa_ihl_ofst_meq32[ihl_ofst_meq32] == -1) {
			IPAERR("ran out of ihl_meq32 eq\n");
			return -EPERM;
		}
		*en_rule |= ipa_ihl_ofst_meq32[ihl_ofst_meq32];
		/* 38  => offset of inner IPv4 addr */
		eq_atrb->ihl_offset_meq_32[ihl_ofst_meq32].offset = 38;
		eq_atrb->ihl_offset_meq_32[ihl_ofst_meq32].mask =
			attrib->u.v4.dst_addr_mask;
		eq_atrb->ihl_offset_meq_32[ihl_ofst_meq32].value =
			attrib->u.v4.dst_addr;
		ihl_ofst_meq32++;
	}

	if (attrib->attrib_mask & IPA_FLT_MAC_ETHER_TYPE) {
		if (ipa_ofst_meq32[ofst_meq32] == -1) {
			IPAERR("ran out of meq128 eq\n");
+2 −0
Original line number Diff line number Diff line
@@ -166,6 +166,8 @@
#define IPA_FLT_MAC_DST_ADDR_L2TP	(1ul << 22)
#define IPA_FLT_TCP_SYN			(1ul << 23)
#define IPA_FLT_TCP_SYN_L2TP		(1ul << 24)
#define IPA_FLT_L2TP_INNER_IP_TYPE  (1ul << 25)
#define IPA_FLT_L2TP_INNER_IPV4_DST_ADDR (1ul << 26)

/**
 * maximal number of NAT PDNs in the PDN config table