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

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

msm: ipa: Add support to L2TP over UDP



L2TP over UDP requires new commands to be send to uC
to use the new header length for additition and deletion.

Change-Id: I6c642e745386bad5fb7ef63b4167e91ce561e0dd
Signed-off-by: default avatarChaitanya Pratapa <cpratapa@codeaurora.org>
parent 1e8f2043
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -864,7 +864,7 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
	int i;
	u32 usr_pyld_sz;
	u32 pyld_sz;
	u8 header[128] = { 0 };
	u8 header[256] = { 0 };
	u8 *param = NULL;
	u8 *kptr = NULL;
	unsigned long uptr = 0;
+11 −3
Original line number Diff line number Diff line
@@ -100,6 +100,8 @@ const char *ipa3_hdr_proc_type_name[] = {
	__stringify(IPA_HDR_PROC_L2TP_HEADER_ADD),
	__stringify(IPA_HDR_PROC_L2TP_HEADER_REMOVE),
	__stringify(IPA_HDR_PROC_ETHII_TO_ETHII_EX),
	__stringify(IPA_HDR_PROC_L2TP_UDP_HEADER_ADD),
	__stringify(IPA_HDR_PROC_L2TP_UDP_HEADER_REMOVE),
};

static struct dentry *dent;
@@ -541,11 +543,16 @@ static int ipa3_attrib_dump(struct ipa_rule_attrib *attrib,
	if ((attrib->attrib_mask & IPA_FLT_MAC_DST_ADDR_ETHER_II) ||
		(attrib->attrib_mask & IPA_FLT_MAC_DST_ADDR_802_3) ||
		(attrib->attrib_mask & IPA_FLT_MAC_DST_ADDR_L2TP) ||
		(attrib->attrib_mask & IPA_FLT_MAC_DST_ADDR_802_1Q)) {
		(attrib->attrib_mask & IPA_FLT_MAC_DST_ADDR_802_1Q) ||
		(attrib->attrib_mask & IPA_FLT_L2TP_UDP_INNER_MAC_DST_ADDR)) {
		pr_err("dst_mac_addr:%pM ", attrib->dst_mac_addr);
	}

	if (attrib->attrib_mask & IPA_FLT_MAC_ETHER_TYPE)
	if (attrib->ext_attrib_mask & IPA_FLT_EXT_MTU)
		pr_err("Payload Length:%d ", attrib->payload_length);

	if (attrib->attrib_mask & IPA_FLT_MAC_ETHER_TYPE ||
		attrib->ext_attrib_mask & IPA_FLT_EXT_L2TP_UDP_INNER_ETHER_TYPE)
		pr_err("ether_type:%x ", attrib->ether_type);

	if (attrib->attrib_mask & IPA_FLT_VLAN_ID)
@@ -554,7 +561,8 @@ static int ipa3_attrib_dump(struct ipa_rule_attrib *attrib,
	if (attrib->attrib_mask & IPA_FLT_TCP_SYN)
		pr_err("tcp syn ");

	if (attrib->attrib_mask & IPA_FLT_TCP_SYN_L2TP)
	if (attrib->attrib_mask & IPA_FLT_TCP_SYN_L2TP ||
		attrib->ext_attrib_mask & IPA_FLT_EXT_L2TP_UDP_TCP_SYN)
		pr_err("tcp syn l2tp ");

	if (attrib->attrib_mask & IPA_FLT_L2TP_INNER_IP_TYPE)
+6 −2
Original line number Diff line number Diff line
/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2020, 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
@@ -13,7 +13,7 @@
#include "ipa_i.h"
#include "ipahal/ipahal.h"

static const u32 ipa_hdr_bin_sz[IPA_HDR_BIN_MAX] = { 8, 16, 24, 36, 64};
static const u32 ipa_hdr_bin_sz[IPA_HDR_BIN_MAX] = { 8, 16, 24, 36, 64, 128};
static const u32 ipa_hdr_proc_ctx_bin_sz[IPA_HDR_PROC_CTX_BIN_MAX] = { 32, 64};

#define HDR_TYPE_IS_VALID(type) \
@@ -545,6 +545,10 @@ static int __ipa_add_hdr(struct ipa_hdr_add *hdr, bool user)
		bin = IPA_HDR_BIN3;
	else if (hdr->hdr_len <= ipa_hdr_bin_sz[IPA_HDR_BIN4])
		bin = IPA_HDR_BIN4;
	/* Starting from IPA4.5, HW supports larger headers. */
	else if ((hdr->hdr_len <= ipa_hdr_bin_sz[IPA_HDR_BIN5]) &&
		(ipa3_ctx->ipa_hw_type >= IPA_HW_v4_5))
		bin = IPA_HDR_BIN5;
	else {
		IPAERR_RL("unexpected hdr len %d\n", hdr->hdr_len);
		goto bad_hdr_len;
+2 −1
Original line number Diff line number Diff line
@@ -183,7 +183,8 @@
#define IPA_HDR_BIN2 2
#define IPA_HDR_BIN3 3
#define IPA_HDR_BIN4 4
#define IPA_HDR_BIN_MAX 5
#define IPA_HDR_BIN5 5
#define IPA_HDR_BIN_MAX 6

#define IPA_HDR_PROC_CTX_BIN0 0
#define IPA_HDR_PROC_CTX_BIN1 1
+43 −7
Original line number Diff line number Diff line
/* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2020, 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
@@ -1239,7 +1239,8 @@ static int ipahal_cp_proc_ctx_to_hw_buff_v3(enum ipa_hdr_proc_type type,
		ctx->end.type = IPA_PROC_CTX_TLV_TYPE_END;
		ctx->end.length = 0;
		ctx->end.value = 0;
	} else if (type == IPA_HDR_PROC_L2TP_HEADER_ADD) {
	} else if ((type == IPA_HDR_PROC_L2TP_HEADER_ADD) ||
		(type == IPA_HDR_PROC_L2TP_UDP_HEADER_ADD)) {
		struct ipa_hw_hdr_proc_ctx_add_l2tp_hdr_cmd_seq *ctx;

		ctx = (struct ipa_hw_hdr_proc_ctx_add_l2tp_hdr_cmd_seq *)
@@ -1257,8 +1258,14 @@ static int ipahal_cp_proc_ctx_to_hw_buff_v3(enum ipa_hdr_proc_type type,
			ctx->hdr_add.hdr_addr_hi = 0;
		ctx->l2tp_params.tlv.type = IPA_PROC_CTX_TLV_TYPE_PROC_CMD;
		ctx->l2tp_params.tlv.length = 1;
		if (type == IPA_HDR_PROC_L2TP_HEADER_ADD)
			ctx->l2tp_params.tlv.value =
					IPA_HDR_UCP_L2TP_HEADER_ADD;
		else
			ctx->l2tp_params.tlv.value =
					IPA_HDR_UCP_L2TP_UDP_HEADER_ADD;
		ctx->l2tp_params.l2tp_params.second_pass =
			l2tp_params->hdr_add_param.second_pass;
		ctx->l2tp_params.l2tp_params.eth_hdr_retained =
			l2tp_params->hdr_add_param.eth_hdr_retained;
		ctx->l2tp_params.l2tp_params.input_ip_version =
@@ -1306,6 +1313,35 @@ static int ipahal_cp_proc_ctx_to_hw_buff_v3(enum ipa_hdr_proc_type type,
		IPAHAL_DBG("endianness: %d\n",
			ctx->l2tp_params.l2tp_params.hdr_endianness);

		IPAHAL_DBG("command id %d\n", ctx->l2tp_params.tlv.value);
		ctx->end.type = IPA_PROC_CTX_TLV_TYPE_END;
		ctx->end.length = 0;
		ctx->end.value = 0;
	} else if (type == IPA_HDR_PROC_L2TP_UDP_HEADER_REMOVE) {
		struct ipa_hw_hdr_proc_ctx_remove_l2tp_udp_hdr_cmd_seq *ctx;

		ctx = (struct ipa_hw_hdr_proc_ctx_remove_l2tp_udp_hdr_cmd_seq *)
			(base + offset);
		ctx->l2tp_params.tlv.type = IPA_PROC_CTX_TLV_TYPE_PROC_CMD;
		ctx->l2tp_params.tlv.length = 1;
		ctx->l2tp_params.tlv.value =
				IPA_HDR_UCP_L2TP_UDP_HEADER_REMOVE;
		ctx->l2tp_params.l2tp_params.hdr_len_remove =
			l2tp_params->hdr_remove_param.hdr_len_remove;
		ctx->l2tp_params.l2tp_params.eth_hdr_retained =
			l2tp_params->hdr_remove_param.eth_hdr_retained;
		ctx->l2tp_params.l2tp_params.hdr_ofst_pkt_size_valid =
			l2tp_params->hdr_remove_param.hdr_ofst_pkt_size_valid;
		ctx->l2tp_params.l2tp_params.hdr_ofst_pkt_size =
			l2tp_params->hdr_remove_param.hdr_ofst_pkt_size;
		ctx->l2tp_params.l2tp_params.hdr_endianness =
			l2tp_params->hdr_remove_param.hdr_endianness;
		IPAHAL_DBG("hdr ofst valid: %d, hdr ofst pkt size: %d\n",
			ctx->l2tp_params.l2tp_params.hdr_ofst_pkt_size_valid,
			ctx->l2tp_params.l2tp_params.hdr_ofst_pkt_size);
		IPAHAL_DBG("endianness: %d\n",
			ctx->l2tp_params.l2tp_params.hdr_endianness);

		IPAHAL_DBG("command id %d\n", ctx->l2tp_params.tlv.value);
		ctx->end.type = IPA_PROC_CTX_TLV_TYPE_END;
		ctx->end.length = 0;
Loading