Merge "msm: ipa3: Add max PDN num based on hardware version"

This commit is contained in:
qctecmdr 2020-10-20 02:46:57 -07:00 committed by Gerrit - the friendly Code Review server
commit db1950ae4f
5 changed files with 22 additions and 5 deletions

View File

@ -2058,7 +2058,7 @@ static void ipa3_read_pdn_table(void)
}
for (i = 0, pdn_entry = ipa3_ctx->nat_mem.pdn_mem.base;
i < IPA_MAX_PDN_NUM;
i < ipa3_get_max_pdn();
++i, pdn_entry += pdn_entry_size) {
result = ipahal_nat_is_entry_zeroed(

View File

@ -852,7 +852,7 @@ static int __ipa_validate_flt_rule(const struct ipa_flt_rule_i *rule,
"PDN index should be 0 when action is not pass to NAT\n");
goto error;
} else {
if (rule->pdn_idx >= IPA_MAX_PDN_NUM) {
if (rule->pdn_idx >= ipa3_get_max_pdn()) {
IPAERR_RL("PDN index %d is too large\n",
rule->pdn_idx);
goto error;

View File

@ -2872,6 +2872,8 @@ int ipa3_query_intf_tx_props(struct ipa_ioc_query_intf_tx_props *tx);
int ipa3_query_intf_rx_props(struct ipa_ioc_query_intf_rx_props *rx);
int ipa3_query_intf_ext_props(struct ipa_ioc_query_intf_ext_props *ext);
int ipa3_get_max_pdn(void);
void wwan_cleanup(void);
int ipa3_teth_bridge_driver_init(void);

View File

@ -704,7 +704,7 @@ int ipa3_allocate_nat_table(
ipahal_nat_entry_size(IPAHAL_NAT_IPV4_PDN, &pdn_entry_size);
pdn_mem_ptr->size = pdn_entry_size * IPA_MAX_PDN_NUM;
pdn_mem_ptr->size = pdn_entry_size * ipa3_get_max_pdn();
if (IPA_MEM_PART(pdn_config_size) < pdn_mem_ptr->size) {
IPAERR(
@ -1118,7 +1118,7 @@ static int ipa3_nat_create_modify_pdn_cmd(
IPADBG("\n");
ipahal_nat_entry_size(IPAHAL_NAT_IPV4_PDN, &pdn_entry_size);
mem_size = pdn_entry_size * IPA_MAX_PDN_NUM;
mem_size = pdn_entry_size * ipa3_get_max_pdn();
/* Before providing physical base address check pointer exist or not*/
if (!ipa3_ctx->nat_mem.pdn_mem.base)
@ -1653,7 +1653,7 @@ int ipa3_nat_mdfy_pdn(
goto bail;
}
if (mdfy_pdn->pdn_index > (IPA_MAX_PDN_NUM - 1)) {
if (mdfy_pdn->pdn_index > (ipa3_get_max_pdn() - 1)) {
IPAERR_RL("pdn index out of range %d\n", mdfy_pdn->pdn_index);
result = -EPERM;
goto bail;

View File

@ -267,6 +267,7 @@ enum ipa_ver {
IPA_4_5,
IPA_4_5_MHI,
IPA_4_5_APQ,
IPA_4_5_AUTO,
IPA_4_7,
IPA_4_9,
IPA_4_11,
@ -9590,3 +9591,17 @@ int ipa3_get_prot_id(enum ipa_client_type client)
return prot_id;
}
/**
* ipa3_get_max_pdn() - get max PDN number based on hardware version
* Returns: IPA_MAX_PDN_NUM of IPAv4_5 and IPA_MAX_PDN_NUM_v4_2 for others
*
*/
int ipa3_get_max_pdn(void)
{
if (ipa3_get_hw_type_index() == IPA_4_5_AUTO)
return IPA_MAX_PDN_NUM;
else
return IPA_MAX_PDN_NUM_v4;
}