Merge "msm: ipa3: add support on sockv5 info"

This commit is contained in:
qctecmdr 2020-12-09 07:54:25 -08:00 • committed by Gerrit - the friendly Code Review server
commit fada40633a
2 changed files with 311 additions and 2 deletions

View file

@ -6,10 +6,12 @@
#ifndef _IPA_H_
#define _IPA_H_
#include <linux/if_ether.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
#include <linux/msm_ipa.h>
#include <linux/skbuff.h>
#include <linux/types.h>
#include <linux/if_ether.h>
#include <linux/ipa_qmi_service_v01.h>
#include <linux/msm_gsi.h>
@ -17,6 +19,23 @@
#define IPA_BW_THRESHOLD_MAX 3
#define IPA_MAX_CH_STATS_SUPPORTED 5
/**
* the attributes of the socksv5 options
*/
#define IPA_SOCKSv5_ENTRY_VALID (1ul << 0)
#define IPA_SOCKSv5_IPV4 (1ul << 1)
#define IPA_SOCKSv5_IPV6 (1ul << 2)
#define IPA_SOCKSv5_OPT_TS (1ul << 3)
#define IPA_SOCKSv5_OPT_SACK (1ul << 4)
#define IPA_SOCKSv5_OPT_WS_STC (1ul << 5)
#define IPA_SOCKSv5_OPT_WS_DMC (1ul << 6)
#define IPA_SOCKsv5_ADD_COM_ID 15
#define IPA_SOCKsv5_ADD_V6_V4_COM_PM 1
#define IPA_SOCKsv5_ADD_V4_V6_COM_PM 2
#define IPA_SOCKsv5_ADD_V6_V6_COM_PM 3
/**
* enum ipa_transport_type
* transport type: either GSI or SPS
@ -1240,6 +1259,102 @@ struct ipa_smmu_out_params {
bool shared_cb;
};
struct iphdr_rsv {
struct iphdr ipv4_temp; /* 20 bytes */
uint32_t rsv1;
uint32_t rsv2;
uint32_t rsv3;
uint32_t rsv4;
uint32_t rsv5;
} __packed;
union ip_hdr_temp {
struct iphdr_rsv ipv4_rsv; /* 40 bytes */
struct ipv6hdr ipv6_temp; /* 40 bytes */
} __packed;
struct ipa_socksv5_uc_tmpl {
uint16_t cmd_id;
uint16_t rsv;
uint32_t cmd_param;
uint16_t pkt_count;
uint16_t rsv2;
uint32_t byte_count;
union ip_hdr_temp ip_hdr;
/* 2B src/dst port */
uint16_t src_port;
uint16_t dst_port;
/* attribute mask */
uint32_t ipa_sockv5_mask;
/* reqquired update 4B/4B Seq/Ack/SACK */
uint32_t out_irs;
uint32_t out_iss;
uint32_t in_irs;
uint32_t in_iss;
/* option 10B: time-stamp */
uint32_t out_ircv_tsval;
uint32_t in_ircv_tsecr;
uint32_t out_ircv_tsecr;
uint32_t in_ircv_tsval;
/* option 2B: window-scaling/dynamic */
uint16_t in_isnd_wscale:4;
uint16_t out_isnd_wscale:4;
uint16_t in_ircv_wscale:4;
uint16_t out_ircv_wscale:4;
uint16_t MAX_WINDOW_SIZE;
/* 11*4 + 40 bytes = 84 bytes */
uint32_t rsv3;
uint32_t rsv4;
uint32_t rsv5;
uint32_t rsv6;
uint32_t rsv7;
uint32_t rsv8;
uint32_t rsv9;
} __packed;
/*reserve 16 bytes : 16 bytes+ 40 bytes + 44 bytes = 100 bytes (28 bytes left)*/
struct ipa_socksv5_info {
/* ipa-uc info */
struct ipa_socksv5_uc_tmpl ul_out;
struct ipa_socksv5_uc_tmpl dl_out;
/* ipacm info */
struct ipacm_socksv5_info ul_in;
struct ipacm_socksv5_info dl_in;
/* output: handle (index) */
uint16_t handle;
};
struct ipa_ipv6_nat_uc_tmpl {
uint16_t cmd_id;
uint16_t rsv;
uint32_t cmd_param;
uint16_t pkt_count;
uint16_t rsv2;
uint32_t byte_count;
uint64_t private_address_lsb;
uint64_t private_address_msb;
uint64_t public_address_lsb;
uint64_t public_address_msb;
uint16_t private_port;
uint16_t public_port;
uint32_t rsv3;
uint64_t rsv4;
uint64_t rsv5;
uint64_t rsv6;
uint64_t rsv7;
uint64_t rsv8;
uint64_t rsv9;
uint64_t rsv10;
uint64_t rsv11;
uint64_t rsv12;
} __packed;
#if IS_ENABLED(CONFIG_IPA3)
/*
* Configuration
@ -1674,6 +1789,15 @@ int ipa_is_vlan_mode(enum ipa_vlan_ifaces iface, bool *res);
* ipa_get_lan_rx_napi - returns true if NAPI is enabled in the LAN RX dp
*/
bool ipa_get_lan_rx_napi(void);
/*
* ipa_add_socksv5_conn - add socksv5 info to ipa driver
*/
int ipa_add_socksv5_conn(struct ipa_socksv5_info *info);
/*
* ipa_del_socksv5_conn - del socksv5 info to ipa driver
*/
int ipa_del_socksv5_conn(uint32_t handle);
int ipa_mhi_handle_ipa_config_req(struct ipa_config_req_msg_v01 *config_req);
int ipa_wigig_save_regs(void);
@ -1930,6 +2054,16 @@ static inline bool ipa_get_lan_rx_napi(void)
return false;
}
static inline int ipa_add_socksv5_conn(struct ipa_socksv5_info *info)
{
return -EPERM;
}
static inline int ipa_del_socksv5_conn(uint32_t handle)
{
return -EPERM;
}
static inline const struct ipa_gsi_ep_config *ipa_get_gsi_ep_info(
enum ipa_client_type client)
{
@ -2209,3 +2343,4 @@ static inline int ipa_uc_dereg_rdyCB(void)
}
#endif /* _IPA_H_ */

View file

@ -133,6 +133,8 @@
#define IPA_IOCTL_PDN_CONFIG 80
#define IPA_IOCTL_SET_MAC_FLT 81
#define IPA_IOCTL_GET_PHERIPHERAL_EP_INFO 82
#define IPA_IOCTL_ADD_UC_ACT_ENTRY 83
#define IPA_IOCTL_DEL_UC_ACT_ENTRY 84
/**
* max size of the header to be inserted
@ -772,7 +774,14 @@ enum ipa_mac_flt_event {
#define IPA_MAC_FLT_EVENT_MAX IPA_MAC_FLT_EVENT_MAX
};
#define IPA_EVENT_MAX_NUM (IPA_MAC_FLT_EVENT_MAX)
enum ipa_sockv5_event {
IPA_SOCKV5_ADD = IPA_MAC_FLT_EVENT_MAX,
IPA_SOCKV5_DEL,
IPA_SOCKV5_EVENT_MAX
#define IPA_SOCKV5_EVENT_MAX IPA_SOCKV5_EVENT_MAX
};
#define IPA_EVENT_MAX_NUM (IPA_SOCKV5_EVENT_MAX)
#define IPA_EVENT_MAX ((int)IPA_EVENT_MAX_NUM)
/**
@ -2527,6 +2536,163 @@ struct ipa_wan_msg {
uint32_t ipv6_addr_gw[IPA_WAN_MSG_IPv6_ADDR_GW_LEN];
};
/* uc activation command Ids */
#define IPA_SOCKSV5_ADD_COM_ID 15
#define IPA_IPv6_NAT_COM_ID 16
/**
* ipa_kernel_tests_socksv5_uc_tmpl - uc activation entry info
* @cmd_id: uc command id
* @cmd_param: uC command param
* @ipa_kernel_tests_ip_hdr_temp: ip header
* @src_port: source port
* @dst_port: destination port
* @ipa_sockv5_mask: uc attribute mask for options/etc
* @out_irs: 4B/4B Seq/Ack/SACK
* @out_iss
* @in_irs
* @in_iss
* @out_ircv_tsval: timestamp attributes
* @in_ircv_tsecr
* @out_ircv_tsecr
* @in_ircv_tsval
* @in_isnd_wscale: window scale attributes
* @out_isnd_wscale
* @in_ircv_wscale
* @out_ircv_wscale
* @direction: 1 for UL 0 for DL
* @handle: uc activation table index
*/
struct ipa_kernel_tests_socksv5_uc_tmpl {
/* direction 1 = UL, 0 = DL */
__u8 direction;
__u8 padding1;
/* output: handle (index) */
__u16 handle;
__u16 cmd_id;
__u16 padding2;
__u32 cmd_param;
__be32 ip_src_addr;
__be32 ip_dst_addr;
__be32 ipv6_src_addr[4];
__be32 ipv6_dst_addr[4];
/* 2B src/dst port */
__u16 src_port;
__u16 dst_port;
/* attribute mask */
__u32 ipa_sockv5_mask;
/* required update 4B/4B Seq/Ack/SACK */
__u32 out_irs;
__u32 out_iss;
__u32 in_irs;
__u32 in_iss;
/* option 10B: time-stamp */
__u32 out_ircv_tsval;
__u32 in_ircv_tsecr;
__u32 out_ircv_tsecr;
__u32 in_ircv_tsval;
/* option 2B: window-scaling/dynamic */
__u16 in_isnd_wscale : 4;
__u16 out_isnd_wscale : 4;
__u16 in_ircv_wscale : 4;
__u16 out_ircv_wscale : 4;
__u32 padding3;
};
/**
* struct ipacm_socksv5_info - To hold information about socksv5 connections
* @ip_type: ip type
* @ipv4_src: ipv4 src address
* @ipv4_dst: ipv4 dst address
* @ipv6_src: ipv6 src address
* @ipv6_dst: ipv6 dst address
* @src_port: src port number
* @dst_port: dst port number
* @index: the uc activation tbl index
*/
struct ipacm_socksv5_info {
/* ip-type */
enum ipa_ip_type ip_type;
/* ipv4 */
__u32 ipv4_src;
__u32 ipv4_dst;
/* ipv6 */
__u32 ipv6_src[4];
__u32 ipv6_dst[4];
/* 2B src/dst port */
__u16 src_port;
__u16 dst_port;
/* uc-tbl index */
__u16 index;
__u16 padding;
};
/**
* struct ipa_socksv5_msg - To hold information about socksv5 client
* @ul_in: uplink connection info
* @dl_in: downlink connection info
* @handle: used for ipacm to distinguish connections
*
* CnE need to pass the name of default wan iface when connected/disconnected.
* CNE need to pass the gw info in wlan AP+STA mode.
* netmgr need to pass the name of wan eMBMS iface when connected.
*/
struct ipa_socksv5_msg {
struct ipacm_socksv5_info ul_in;
struct ipacm_socksv5_info dl_in;
/* handle (index) */
__u16 handle;
__u16 padding;
};
/**
* struct ipa_ioc_ipv6_nat_uc_act_entry - To hold information about IPv6 NAT
* uC entry
* @cmd_id[in]: IPv6 NAT uC CMD ID - used for identifying uc activation type
* @private_address_lsb[in]: client private address lsb
* @private_address_msb[in]: client private address msbst
* @public_address_lsb[in]: client public address lsb
* @public_address_msb[in]: client public address msb
* @private_port[in]: client private port
* @public_port[in]: client public port
* @index[out]: uC activation entry index
*/
struct ipa_ioc_ipv6_nat_uc_act_entry {
__u16 cmd_id;
__u16 index;
__u32 padding;
__u32 private_port;
__u32 public_port;
__u64 private_address_lsb;
__u64 private_address_msb;
__u64 public_address_lsb;
__u64 public_address_msb;
};
/**
* union ipa_ioc_uc_activation_entry - To hold information about uC activation
* entry
* @socks[in]: fill here if entry is Socksv5 entry
* @ipv6_nat[in]: fill here if entry is IPv6 NAT entry
*/
union ipa_ioc_uc_activation_entry {
struct ipa_kernel_tests_socksv5_uc_tmpl socks;
struct ipa_ioc_ipv6_nat_uc_act_entry ipv6_nat;
};
/**
* struct ipa_ioc_rm_dependency - parameters for add/delete dependency
* @resource_name: name of dependent resource
@ -3068,6 +3234,14 @@ struct ipa_ioc_mac_client_list_type {
IPA_IOCTL_GET_PHERIPHERAL_EP_INFO, \
struct ipa_ioc_get_ep_info)
#define IPA_IOC_ADD_UC_ACT_ENTRY _IOWR(IPA_IOC_MAGIC, \
IPA_IOCTL_ADD_UC_ACT_ENTRY, \
union ipa_ioc_uc_activation_entry)
#define IPA_IOC_DEL_UC_ACT_ENTRY _IOWR(IPA_IOC_MAGIC, \
IPA_IOCTL_DEL_UC_ACT_ENTRY, \
__u16)
/*
* unique magic number of the Tethering bridge ioctls
*/