msm: ipa: Add support to set exception route table index
Add IOCTL support to configure route table index in case of NAT suppression and Conntrack suppression being enabled. Change-Id: Id2ba72c71e8c541ea54488078f30a9103c0d3eba Signed-off-by: Chaitanya Pratapa <quic_cpratapa@quicinc.com>
Esse commit está contido em:
@@ -4064,6 +4064,14 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
macsec_map);
|
||||
break;
|
||||
|
||||
case IPA_IOC_SET_NAT_EXC_RT_TBL_IDX:
|
||||
retval = ipa3_set_nat_conn_track_exc_rt_tbl(arg, IPA_IP_v4);
|
||||
break;
|
||||
|
||||
case IPA_IOC_SET_CONN_TRACK_EXC_RT_TBL_IDX:
|
||||
retval = ipa3_set_nat_conn_track_exc_rt_tbl(arg, IPA_IP_v6);
|
||||
break;
|
||||
|
||||
default:
|
||||
IPA_ACTIVE_CLIENTS_DEC_SIMPLE();
|
||||
return -ENOTTY;
|
||||
@@ -6160,6 +6168,12 @@ long compat_ipa3_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||
case IPA_IOC_DEL_EoGRE_MAPPING32:
|
||||
cmd = IPA_IOC_DEL_EoGRE_MAPPING;
|
||||
break;
|
||||
case IPA_IOC_SET_NAT_EXC_RT_TBL_IDX32:
|
||||
cmd = IPA_IOC_SET_NAT_EXC_RT_TBL_IDX;
|
||||
break;
|
||||
case IPA_IOC_SET_CONN_TRACK_EXC_RT_TBL_IDX32:
|
||||
cmd = IPA_IOC_SET_CONN_TRACK_EXC_RT_TBL_IDX;
|
||||
break;
|
||||
case IPA_IOC_COMMIT_HDR:
|
||||
case IPA_IOC_RESET_HDR:
|
||||
case IPA_IOC_COMMIT_RT:
|
||||
|
@@ -524,6 +524,12 @@ enum {
|
||||
#define IPA_IOC_DEL_EoGRE_MAPPING32 _IOWR(IPA_IOC_MAGIC, \
|
||||
IPA_IOCTL_DEL_EoGRE_MAPPING, \
|
||||
compat_uptr_t)
|
||||
#define IPA_IOC_SET_NAT_EXC_RT_TBL_IDX32 _IOWR(IPA_IOC_MAGIC, \
|
||||
IPA_IOCTL_SET_NAT_EXC_RT_TBL_IDX, \
|
||||
compat_uptr_t)
|
||||
#define IPA_IOC_SET_CONN_TRACK_EXC_RT_TBL_IDX32 _IOWR(IPA_IOC_MAGIC, \
|
||||
IPA_IOCTL_SET_CONN_TRACK_EXC_RT_TBL_IDX, \
|
||||
compat_uptr_t)
|
||||
#endif /* #ifdef CONFIG_COMPAT */
|
||||
|
||||
#define IPA_TZ_UNLOCK_ATTRIBUTE 0x0C0311
|
||||
@@ -2876,6 +2882,8 @@ int ipa3_mdfy_rt_rule(struct ipa_ioc_mdfy_rt_rule *rules);
|
||||
|
||||
int ipa3_mdfy_rt_rule_v2(struct ipa_ioc_mdfy_rt_rule_v2 *rules);
|
||||
|
||||
int ipa3_set_nat_conn_track_exc_rt_tbl(u32 rt_tbl_hdl, enum ipa_ip_type ip);
|
||||
|
||||
/*
|
||||
* Filtering
|
||||
*/
|
||||
|
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/bitops.h>
|
||||
@@ -2547,3 +2548,54 @@ bail:
|
||||
iounmap(ipa_sram_mmio);
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* ipa3_set_nat_conn_track_exc_rt_tbl() - Set the exception routing handle
|
||||
* @rt_tbl_hdl: [in] the routing table handle to be set
|
||||
*
|
||||
* Returns: 0 on success, negative on failure
|
||||
*
|
||||
* Note: Should not be called from atomic context
|
||||
*/
|
||||
int ipa3_set_nat_conn_track_exc_rt_tbl(u32 rt_tbl_hdl, enum ipa_ip_type ip)
|
||||
{
|
||||
struct ipa3_rt_tbl *entry;
|
||||
int result = 0;
|
||||
|
||||
if (((ip != IPA_IP_v4) && (ip != IPA_IP_v6)) ||
|
||||
(ipa3_ctx->ipa_hw_type < IPA_HW_v5_5)) {
|
||||
IPAERR_RL("bad params: %d,\n", ip);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mutex_lock(&ipa3_ctx->lock);
|
||||
entry = ipa3_id_find(rt_tbl_hdl);
|
||||
if (entry == NULL) {
|
||||
IPAERR_RL("lookup failed\n");
|
||||
result = -EINVAL;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
if ((entry->cookie != IPA_RT_TBL_COOKIE) || entry->ref_cnt == 0) {
|
||||
IPAERR_RL("bad params\n");
|
||||
result = -EINVAL;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
if (ip == IPA_IP_v4)
|
||||
ipahal_write_reg_mn(IPA_IPV4_NAT_EXC_SUPPRESS_ROUT_TABLE_INDX,
|
||||
0, 0, entry->idx);
|
||||
else
|
||||
ipahal_write_reg_mn(IPA_IPV6_CONN_TRACK_EXC_SUPPRESS_ROUT_TABLE_INDX,
|
||||
0, 0, entry->idx);
|
||||
|
||||
IPADBG("Set exception routing table for %d, ID: %d", ip, entry->idx);
|
||||
|
||||
result = 0;
|
||||
|
||||
ret:
|
||||
mutex_unlock(&ipa3_ctx->lock);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@@ -181,6 +181,8 @@ static const char *ipareg_name_to_str[IPA_REG_MAX] = {
|
||||
__stringify(IPA_RAM_EGRESS_SHAPING_PROD_DB_BASE_ADDR),
|
||||
__stringify(IPA_RAM_EGRESS_SHAPING_TC_DB_BASE_ADDR),
|
||||
__stringify(IPA_COAL_MASTER_CFG),
|
||||
__stringify(IPA_IPV4_NAT_EXC_SUPPRESS_ROUT_TABLE_INDX),
|
||||
__stringify(IPA_IPV6_CONN_TRACK_EXC_SUPPRESS_ROUT_TABLE_INDX),
|
||||
};
|
||||
|
||||
static void ipareg_construct_dummy(enum ipahal_reg_name reg,
|
||||
@@ -5024,6 +5026,12 @@ static struct ipahal_reg_obj ipahal_reg_objs[IPA_HW_MAX][IPA_REG_MAX] = {
|
||||
ipareg_construct_timers_pulse_gran_cfg_v5_0,
|
||||
ipareg_parse_timers_pulse_gran_cfg_v5_0,
|
||||
0x0000004B4, 0, 0, 0, 1, 0},
|
||||
[IPA_HW_v5_5][IPA_IPV4_NAT_EXC_SUPPRESS_ROUT_TABLE_INDX] = {
|
||||
ipareg_construct_dummy, ipareg_parse_dummy,
|
||||
0x0000004E4, 0, 0, 0, 0, 0},
|
||||
[IPA_HW_v5_5][IPA_IPV6_CONN_TRACK_EXC_SUPPRESS_ROUT_TABLE_INDX] = {
|
||||
ipareg_construct_dummy, ipareg_parse_dummy,
|
||||
0x0000004E8, 0, 0, 0, 0, 0},
|
||||
[IPA_HW_v5_5][IPA_SRC_RSRC_GRP_01_RSRC_TYPE_n] = {
|
||||
ipareg_construct_rsrg_grp_xy_v5_0, ipareg_parse_dummy,
|
||||
0x00000500, 0x20, 0, 0, 0, 0},
|
||||
|
@@ -179,6 +179,8 @@ enum ipahal_reg_name {
|
||||
IPA_RAM_EGRESS_SHAPING_PROD_DB_BASE_ADDR,
|
||||
IPA_RAM_EGRESS_SHAPING_TC_DB_BASE_ADDR,
|
||||
IPA_COAL_MASTER_CFG,
|
||||
IPA_IPV4_NAT_EXC_SUPPRESS_ROUT_TABLE_INDX,
|
||||
IPA_IPV6_CONN_TRACK_EXC_SUPPRESS_ROUT_TABLE_INDX,
|
||||
IPA_REG_MAX,
|
||||
};
|
||||
|
||||
|
Referência em uma nova issue
Block a user