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

Commit ea0da718 authored by Chaitanya Pratapa's avatar Chaitanya Pratapa
Browse files

msm: ipa: enhancements to L2TP over UDP



When L2TP over UDP tunnelling is used, add provision to filter
out based on next header in case if specific packets like
ICMPv6 packets need to be routed to apps.

Change-Id: I48076cc0fa5fcf5476761b3cbf78d5235a6b2b79
Signed-off-by: default avatarChaitanya Pratapa <cpratapa@codeaurora.org>
parent d0b1b302
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1446,6 +1446,13 @@ static int ipahal_get_proc_ctx_needed_len_v3(enum ipa_hdr_proc_type type)
		ret =
		sizeof(struct ipa_hw_hdr_proc_ctx_remove_l2tp_hdr_cmd_seq);
		break;
	case IPA_HDR_PROC_L2TP_UDP_HEADER_ADD:
		ret = sizeof(struct ipa_hw_hdr_proc_ctx_add_l2tp_hdr_cmd_seq);
		break;
	case IPA_HDR_PROC_L2TP_UDP_HEADER_REMOVE:
		ret =
		sizeof(struct ipa_hw_hdr_proc_ctx_remove_l2tp_udp_hdr_cmd_seq);
		break;
	case IPA_HDR_PROC_ETHII_TO_ETHII_EX:
		ret = sizeof(struct ipa_hw_hdr_proc_ctx_add_hdr_cmd_seq_ex);
		break;
+35 −0
Original line number Diff line number Diff line
@@ -1662,6 +1662,41 @@ static int ipa_fltrt_generate_hw_rule_bdy_ip6(u16 *en_rule,
		ihl_ofst_meq32 += 2;
	}

	if (attrib->ext_attrib_mask & IPA_FLT_EXT_L2TP_UDP_INNER_NEXT_HDR) {
		if (IPA_IS_RAN_OUT_OF_EQ(ipa3_0_ihl_ofst_meq32,
			ihl_ofst_meq32)) {
			IPAHAL_ERR("ran out of ihl_meq32 eq\n");
			goto err;
		}
		*en_rule |= IPA_GET_RULE_EQ_BIT_PTRN(
			ipa3_0_ihl_ofst_meq32[ihl_ofst_meq32]);

		/* Populate next header */
		if (attrib->ether_type == 0x0800) {
			/* 46 => offset of inner next hdr type in
			 * L2TP over UDP (IPv4).
			 * 46 = UDP (8) + L2TP (16) + ETH (14) + 8 bytes
			 * in Ipv4 header.
			 */
			extra = ipa_write_8(46, extra);
			rest = ipa_write_32(0xFF0000, rest);
			rest = ipa_write_32((attrib->l2tp_udp_next_hdr << 16),
				rest);
		} else {
			/* 42 => offset of inner next hdr type in
			 * L2TP over UDP (Ipv6).
			 * 42 = UDP (8) + L2TP (16) + ETH (14) + 4 bytes
			 * in Ipv6 header.
			 */
			extra = ipa_write_8(42, extra);
			rest = ipa_write_32(0xFF00, rest);
			rest = ipa_write_32((attrib->l2tp_udp_next_hdr << 8),
				rest);
		}

		ihl_ofst_meq32++;
	}

	if (attrib->attrib_mask & IPA_FLT_TCP_SYN) {
		if (IPA_IS_RAN_OUT_OF_EQ(ipa3_0_ihl_ofst_meq32,
			ihl_ofst_meq32)) {
+3 −1
Original line number Diff line number Diff line
@@ -222,7 +222,7 @@
#define IPA_FLT_EXT_L2TP_UDP_TCP_SYN        (1ul << 0)
#define IPA_FLT_EXT_L2TP_UDP_INNER_ETHER_TYPE       (1ul << 1)
#define IPA_FLT_EXT_MTU     (1ul << 2)

#define IPA_FLT_EXT_L2TP_UDP_INNER_NEXT_HDR		(1ul << 3)

/**
 * maximal number of NAT PDNs in the PDN config table
@@ -841,6 +841,7 @@ enum ipa_hw_type {
 * @vlan_id: vlan id value
 * @payload_length: Payload length.
 * @ext_attrib_mask: Extended attributes.
 * @l2tp_udp_next_hdr: next header in L2TP tunneling
 */
struct ipa_rule_attrib {
	uint32_t attrib_mask;
@@ -884,6 +885,7 @@ struct ipa_rule_attrib {
	uint16_t vlan_id;
	uint16_t payload_length;
	uint32_t ext_attrib_mask;
	uint8_t l2tp_udp_next_hdr;
};

/*! @brief The maximum number of Mask Equal 32 Eqns */