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

Commit 5bf4bf24 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ipa3: EoGRE feature"

parents 695ec32a 978a8221
Loading
Loading
Loading
Loading
+111 −13
Original line number Diff line number Diff line
@@ -138,6 +138,8 @@
#define IPA_IOCTL_SET_SW_FLT                    85
#define IPA_IOCTL_GET_HW_FEATURE_SUPPORT        86
#define IPA_IOCTL_SET_PKT_THRESHOLD             87
#define IPA_IOCTL_ADD_EoGRE_MAPPING             88
#define IPA_IOCTL_DEL_EoGRE_MAPPING             89

/**
 * max size of the header to be inserted
@@ -834,7 +836,14 @@ enum ipa_move_nat_table_event {
#define IPA_MOVE_NAT_EVENT_MAX IPA_MOVE_NAT_EVENT_MAX
};

#define IPA_EVENT_MAX_NUM (IPA_MOVE_NAT_EVENT_MAX)
enum ipa_eogre_event {
	IPA_EoGRE_UP_EVENT = IPA_MOVE_NAT_EVENT_MAX,
	IPA_EoGRE_DOWN_EVENT,
	IPA_EoGRE_EVENT_MAX
#define IPA_EoGRE_EVENT_MAX IPA_EoGRE_EVENT_MAX
};

#define IPA_EVENT_MAX_NUM (IPA_EoGRE_EVENT_MAX)
#define IPA_EVENT_MAX ((int)IPA_EVENT_MAX_NUM)

/**
@@ -1266,17 +1275,23 @@ enum ipa_hdr_l2_type {

/**
 * enum ipa_hdr_l2_type - Processing context type
 *
 * IPA_HDR_PROC_NONE:                   No processing context
 * IPA_HDR_PROC_ETHII_TO_ETHII:         Process Ethernet II to Ethernet II
 * IPA_HDR_PROC_ETHII_TO_802_3:         Process Ethernet II to 802_3
 * IPA_HDR_PROC_802_3_TO_ETHII:         Process 802_3 to Ethernet II
 * IPA_HDR_PROC_802_3_TO_802_3:         Process 802_3 to 802_3
 * IPA_HDR_PROC_L2TP_HEADER_ADD:
 * IPA_HDR_PROC_L2TP_HEADER_REMOVE:
 * IPA_HDR_PROC_ETHII_TO_ETHII_EX:      Process Ethernet II to Ethernet II with
 *                                      generic lengths of src and dst headers
 * IPA_HDR_PROC_L2TP_UDP_HEADER_ADD:    Process WLAN To Ethernet packets to
 *                                      add L2TP UDP header.
 * IPA_HDR_PROC_L2TP_UDP_HEADER_REMOVE: Process Ethernet To WLAN packets to
 *                                      remove L2TP UDP header.
 * IPA_HDR_PROC_SET_DSCP:
 * IPA_HDR_PROC_EoGRE_HEADER_ADD:       Add IPV[46] GRE header
 * IPA_HDR_PROC_EoGRE_HEADER_REMOVE:    Remove IPV[46] GRE header
 */
enum ipa_hdr_proc_type {
	IPA_HDR_PROC_NONE,
@@ -1289,9 +1304,11 @@ enum ipa_hdr_proc_type {
	IPA_HDR_PROC_ETHII_TO_ETHII_EX,
	IPA_HDR_PROC_L2TP_UDP_HEADER_ADD,
	IPA_HDR_PROC_L2TP_UDP_HEADER_REMOVE,
	IPA_HDR_PROC_SET_DSCP
	IPA_HDR_PROC_SET_DSCP,
	IPA_HDR_PROC_EoGRE_HEADER_ADD,
	IPA_HDR_PROC_EoGRE_HEADER_REMOVE,
};
#define IPA_HDR_PROC_MAX (IPA_HDR_PROC_SET_DSCP + 1)
#define IPA_HDR_PROC_MAX (IPA_HDR_PROC_EoGRE_HEADER_REMOVE + 1)

/**
 * struct ipa_rt_rule - attributes of a routing rule
@@ -1452,6 +1469,78 @@ struct ipa_l2tp_hdr_proc_ctx_params {
	enum ipa_client_type dst_pipe;
};

#define IPA_EoGRE_MAX_PCP_IDX 8 /* From 802.1Q tag format (reflects IEEE P802.1p) */
#define IPA_EoGRE_MAX_VLAN    8 /* Our supported number of VLAN id's */

/* vlan 12 bits + pcp 3 bites <-> dscp 6 bits */
struct IpaDscpVlanPcpMap_t {
	/*
	 * valid only lower 12 bits
	 */
	uint16_t vlan[IPA_EoGRE_MAX_VLAN];
	/*
	 * dscp[vlan][pcp], valid only lower 6 bits, using pcp as index
	 */
	uint8_t dscp[IPA_EoGRE_MAX_VLAN][IPA_EoGRE_MAX_PCP_IDX];
	uint8_t num_vlan; /* indicate how many vlans valid */
	uint8_t reserved0;
} __packed;

struct ipa_ipgre_info {
	/* ip address type */
	enum ipa_ip_type iptype;
	/* ipv4 */
	uint32_t ipv4_src;
	uint32_t ipv4_dst;
	/* ipv6 */
	uint32_t ipv6_src[4];
	uint32_t ipv6_dst[4];
	/* gre header info */
	uint16_t gre_protocol;
};

struct ipa_ioc_eogre_info {
	/* ip and gre info */
	struct ipa_ipgre_info ipgre_info;
	/* mapping info */
	struct IpaDscpVlanPcpMap_t map_info;
};

/**
 * struct ipa_eogre_header_add_procparams -
 * @eth_hdr_retained:  Specifies if Ethernet header is retained or not
 * @input_ip_version:  Specifies if Input header is IPV4(0) or IPV6(1)
 * @output_ip_version: Specifies if template header's outer IP is IPV4(0) or IPV6(1)
 * @second_pass:       Specifies if the data should be processed again.
 */
struct ipa_eogre_header_add_procparams {
	uint32_t eth_hdr_retained :1;
	uint32_t input_ip_version :1;
	uint32_t output_ip_version :1;
	uint32_t second_pass :1;
	uint32_t reserved :28;
};

/**
 * struct ipa_eogre_header_remove_procparams -
 * @hdr_len_remove: Specifies how much (in bytes) of the header needs
 *                  to be removed
 */
struct ipa_eogre_header_remove_procparams {
	uint32_t hdr_len_remove:8; /* 44 bytes for IPV6, 24 for IPV4 */
	uint32_t reserved:24;
};

/**
 * struct ipa_eogre_hdr_proc_ctx_params -
 * @hdr_add_param: parameters for header add
 * @hdr_remove_param: parameters for header remove
 */
struct ipa_eogre_hdr_proc_ctx_params {
	struct ipa_eogre_header_add_procparams hdr_add_param;
	struct ipa_eogre_header_remove_procparams hdr_remove_param;
};

/**
 * struct ipa_eth_II_to_eth_II_ex_procparams -
 * @input_ethhdr_negative_offset: Specifies where the ethernet hdr offset is
@@ -1474,6 +1563,7 @@ struct ipa_eth_II_to_eth_II_ex_procparams {
 * @type: processing context type
 * @hdr_hdl: in parameter, handle to header
 * @l2tp_params: l2tp parameters
 * @eogre_params: eogre parameters
 * @generic_params: generic proc_ctx params
 * @proc_ctx_hdl: out parameter, handle to proc_ctx, valid when status is 0
 * @status:	out parameter, status of header add operation,
@@ -1486,6 +1576,7 @@ struct ipa_hdr_proc_ctx_add {
	uint32_t proc_ctx_hdl;
	int status;
	struct ipa_l2tp_hdr_proc_ctx_params l2tp_params;
	struct ipa_eogre_hdr_proc_ctx_params eogre_params;
	struct ipa_eth_II_to_eth_II_ex_procparams generic_params;
};

@@ -3435,6 +3526,13 @@ struct ipa_ioc_sw_flt_list_type {
#define IPA_IOC_SET_PKT_THRESHOLD _IOWR(IPA_IOC_MAGIC, \
				IPA_IOCTL_SET_PKT_THRESHOLD, \
				struct ipa_ioc_set_pkt_threshold)

#define IPA_IOC_ADD_EoGRE_MAPPING _IOWR(IPA_IOC_MAGIC,	\
				IPA_IOCTL_ADD_EoGRE_MAPPING, \
				struct ipa_ioc_eogre_info)
#define IPA_IOC_DEL_EoGRE_MAPPING _IOWR(IPA_IOC_MAGIC, \
				IPA_IOCTL_DEL_EoGRE_MAPPING, \
				struct ipa_ioc_eogre_info)
/*
 * unique magic number of the Tethering bridge ioctls
 */