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

Commit 43d92c9f authored by Perry Randise's avatar Perry Randise
Browse files

msm: ipa3: SRAM NAT, DDR NAT, back-and-forth NAT



A new application level feature has NAT running out of SRAM, DDR,
or both. The addtion of just this feature's header to the kernel will
allow it to be propagated to older kernels, such that they can be
compatible (in terms of structure size) with the new application level
feature.

Change-Id: I16b5bfaa1156c69e0a6ae0c2ca4be416a283d049
CRs-Fixed: 2437567
Signed-off-by: default avatarPerry Randise <prandise@codeaurora.org>
parent 5c9d4548
Loading
Loading
Loading
Loading
+55 −4
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
#define _UAPI_MSM_IPA_H_

#ifndef __KERNEL__
#include <stdio.h>
#include <stdint.h>
#include <stddef.h>
#include <sys/stat.h>
@@ -108,7 +109,7 @@
#define IPA_IOCTL_GSB_CONNECT                   61
#define IPA_IOCTL_GSB_DISCONNECT                62
#define IPA_IOCTL_GET_PHERIPHERAL_EP_INFO       63

#define IPA_IOCTL_GET_NAT_IN_SRAM_INFO          64

/**
 * max size of the header to be inserted
@@ -439,8 +440,28 @@ enum ipa_client_type {
#define IPA_CLIENT_IS_TEST(client) \
	(IPA_CLIENT_IS_TEST_PROD(client) || IPA_CLIENT_IS_TEST_CONS(client))

/**
 * The following is used to describe the types of memory NAT can
 * reside in.
 *
 * PLEASE KEEP THE FOLLOWING IN SYNC WITH ipa3_nat_mem_in_as_str()
 * BELOW.
 */
enum ipa3_nat_mem_in {
	IPA_NAT_MEM_IN_DDR  = 0,
	IPA_NAT_MEM_IN_SRAM = 1,

	IPA_NAT_MEM_IN_MAX
};

#define IPA_VALID_NAT_MEM_IN(t) \
	((t) >= IPA_NAT_MEM_IN_DDR && (t) < IPA_NAT_MEM_IN_MAX)

/**
 * enum ipa_ip_type - Address family: IPv4 or IPv6
 *
 * PLEASE KEEP THE FOLLOWING IN SYNC WITH ipa_ip_type_as_str()
 * BELOW.
 */
enum ipa_ip_type {
	IPA_IP_v4,
@@ -448,6 +469,9 @@ enum ipa_ip_type {
	IPA_IP_MAX
};

#define VALID_IPA_IP_TYPE(t) \
	((t) >= IPA_IP_v4 && (t) < IPA_IP_MAX)

/**
 * enum ipa_rule_type - Type of routing or filtering rule
 * Hashable: Rule will be located at the hashable tables
@@ -1636,6 +1660,8 @@ struct ipa_ioc_nat_ipv6ct_table_alloc {
 * @expn_table_entries: input parameter, ipv4 expansion rules table number of
 *                      entries
 * @ip_addr: input parameter, public ip address
 * @mem_type: input parameter, type of memory the table resides in
 * @focus_change: input parameter, are we moving to/from sram or ddr
 */
struct ipa_ioc_v4_nat_init {
	uint8_t  tbl_index;
@@ -1648,6 +1674,9 @@ struct ipa_ioc_v4_nat_init {
	uint16_t table_entries;
	uint16_t expn_table_entries;
	uint32_t ip_addr;

	uint8_t  mem_type;
	uint8_t  focus_change;
};

/**
@@ -1680,9 +1709,11 @@ struct ipa_ioc_v4_nat_del {
/**
 * struct ipa_ioc_nat_ipv6ct_table_del - NAT/IPv6CT table delete parameter
 * @table_index: input parameter, index of the table
 * @mem_type: input parameter, type of memory the table resides in
 */
struct ipa_ioc_nat_ipv6ct_table_del {
	uint8_t table_index;
	uint8_t mem_type;
};

/**
@@ -1706,11 +1737,12 @@ struct ipa_ioc_nat_dma_one {
 * struct ipa_ioc_nat_dma_cmd - To hold multiple nat/ipv6ct dma commands
 * @entries: number of dma commands in use
 * @dma: data pointer to the dma commands
 * @mem_type: input parameter, type of memory the table resides in
 */
struct ipa_ioc_nat_dma_cmd {
	uint8_t entries;
	uint8_t mem_type;
	struct ipa_ioc_nat_dma_one dma[0];

};

/**
@@ -2244,6 +2276,10 @@ struct ipa_ioc_bridge_vlan_mapping_info {
				IPA_IOCTL_GET_PHERIPHERAL_EP_INFO, \
				struct ipa_ioc_get_ep_info)

#define IPA_IOC_GET_NAT_IN_SRAM_INFO _IOWR(IPA_IOC_MAGIC, \
				IPA_IOCTL_GET_NAT_IN_SRAM_INFO, \
				struct ipa_nat_in_sram_info)

/*
 * unique magic number of the Tethering bridge ioctls
 */
@@ -2333,6 +2369,21 @@ struct teth_ioc_aggr_params {
	uint16_t lcid;
};

/**
 * struct ipa_nat_in_sram_info - query for nat in sram particulars
 * @sram_mem_available_for_nat: Amount SRAM available to fit nat table
 * @nat_table_offset_into_mmap: Offset into mmap'd vm where table will be
 * @best_nat_in_sram_size_rqst: The size to request for mmap
 *
 * The last two elements above are required to deal with situations
 * where the SRAM's physical address and size don't play nice with
 * mmap'ings page size and boundary attributes.
 */
struct ipa_nat_in_sram_info {
	uint32_t sram_mem_available_for_nat;
	uint32_t nat_table_offset_into_mmap;
	uint32_t best_nat_in_sram_size_rqst;
};

#define TETH_BRIDGE_IOC_SET_BRIDGE_MODE _IOW(TETH_BRIDGE_IOC_MAGIC, \
				TETH_BRIDGE_IOCTL_SET_BRIDGE_MODE, \