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

Currently defined max PDN number is generic for all
hardware version which is incorrect. Define PDN based
on hardware version to support correct number of PDN.

Change-Id: I3e898a32104562584b4702132c57b7f1cb8deeca
Signed-off-by: Pooja Kumari <kumarip@codeaurora.org>
This commit is contained in:
Pooja Kumari 2020-06-08 15:08:27 +05:30 committed by Gerrit - the friendly Code Review server
parent 64750dee01
commit 36fa513315
6 changed files with 24 additions and 5 deletions

View File

@ -1917,7 +1917,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

@ -857,7 +857,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

@ -2874,6 +2874,7 @@ int ipa3_query_intf(struct ipa_ioc_query_intf *lookup);
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);

View File

@ -763,7 +763,8 @@ 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(
@ -1179,7 +1180,8 @@ 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)
@ -1714,7 +1716,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

@ -9301,3 +9301,18 @@ error:
mutex_unlock(&ipa3_ctx->act_tbl_lock);
return res;
}
/**
* 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;
}

View File

@ -236,6 +236,7 @@
* maximal number of NAT PDNs in the PDN config table
*/
#define IPA_MAX_PDN_NUM 7
#define IPA_MAX_PDN_NUM_v4 5
/**
* enum ipa_client_type - names for the various IPA "clients"