diff options
author | Skylar Chang <chiaweic@codeaurora.org> | 2015-04-15 17:06:36 -0700 |
---|---|---|
committer | Skylar Chang <chiaweic@codeaurora.org> | 2015-04-15 17:14:49 -0700 |
commit | bc9fa75d233819c9212f15fb9be5a1a6f25f6cb3 (patch) | |
tree | 58d269f3b69ab4e38ad5a74950be5e32a6014fb5 /ipanat | |
parent | d2c7e32758b4bc2cb7273c0ec94b61766c0ff9d5 (diff) | |
download | ipacfg-mgr-bc9fa75d233819c9212f15fb9be5a1a6f25f6cb3.tar.gz |
IPACM: Delete nat entries from cache
On receiving connection destroy event delete nat
entries from both temp and cache
Acked-by: Sunil Paidimarri <hisunil@qti.qualcomm.com>
Change-Id: I500430fe4ae22d74433c4d9f664869c1dc2140d8
Diffstat (limited to 'ipanat')
-rw-r--r-- | ipanat/inc/ipa_nat_drvi.h | 3 | ||||
-rw-r--r-- | ipanat/src/ipa_nat_drvi.c | 21 |
2 files changed, 18 insertions, 6 deletions
diff --git a/ipanat/inc/ipa_nat_drvi.h b/ipanat/inc/ipa_nat_drvi.h index 4c9f5f3..002c025 100644 --- a/ipanat/inc/ipa_nat_drvi.h +++ b/ipanat/inc/ipa_nat_drvi.h @@ -316,6 +316,9 @@ struct ipa_nat_ip4_table_cache { #ifdef IPA_ON_R3PC uint32_t mmap_offset; #endif + + uint16_t cur_tbl_cnt; + uint16_t cur_expn_tbl_cnt; }; struct ipa_nat_cache { diff --git a/ipanat/src/ipa_nat_drvi.c b/ipanat/src/ipa_nat_drvi.c index 32114b5..8ba2bdb 100644 --- a/ipanat/src/ipa_nat_drvi.c +++ b/ipanat/src/ipa_nat_drvi.c @@ -484,12 +484,18 @@ uint16_t ipa_nati_make_rule_hdl(uint16_t tbl_hdl, tbl_ptr = &ipv4_nat_cache.ip4_tbl[tbl_hdl-1]; if (tbl_entry >= tbl_ptr->table_entries) { + /* Increase the current expansion table count */ + tbl_ptr->cur_expn_tbl_cnt++; + /* Update the index into table */ rule_hdl = tbl_entry - tbl_ptr->table_entries; rule_hdl = (rule_hdl << IPA_NAT_RULE_HDL_TBL_TYPE_BITS); /* Update the table type mask */ rule_hdl = (rule_hdl | IPA_NAT_RULE_HDL_TBL_TYPE_MASK); } else { + /* Increase the current count */ + tbl_ptr->cur_tbl_cnt++; + rule_hdl = tbl_entry; rule_hdl = (rule_hdl << IPA_NAT_RULE_HDL_TBL_TYPE_BITS); } @@ -1152,11 +1158,13 @@ uint16_t ipa_nati_generate_tbl_rule(const ipa_nat_ipv4_rule *clnt_rule, /* On collision check for the free entry in expansion table */ new_entry = ipa_nati_expn_tbl_free_entry(expn_tbl, - tbl_ptr->expn_table_entries); + tbl_ptr->expn_table_entries); if (IPA_NAT_INVALID_NAT_ENTRY == new_entry) { /* Expansion table is full return*/ - IPAERR("expansion table is full\n"); + IPAERR("Expansion table is full\n"); + IPAERR("Current Table: %d & Expn Entries: %d\n", + tbl_ptr->cur_tbl_cnt, tbl_ptr->cur_expn_tbl_cnt); return IPA_NAT_INVALID_NAT_ENTRY; } new_entry += tbl_ptr->table_entries; @@ -1239,13 +1247,14 @@ uint16_t ipa_nati_generate_index_rule(const ipa_nat_ipv4_rule *clnt_rule, } /* On collision check for the free entry in expansion table */ - new_entry = ipa_nati_index_expn_get_free_entry( - indx_expn_tbl, - tbl_ptr->expn_table_entries); + new_entry = ipa_nati_index_expn_get_free_entry(indx_expn_tbl, + tbl_ptr->expn_table_entries); if (IPA_NAT_INVALID_NAT_ENTRY == new_entry) { /* Expansion table is full return*/ - IPAERR("index expansion table is full\n"); + IPAERR("Index expansion table is full\n"); + IPAERR("Current Table: %d & Expn Entries: %d\n", + tbl_ptr->cur_tbl_cnt, tbl_ptr->cur_expn_tbl_cnt); return IPA_NAT_INVALID_NAT_ENTRY; } new_entry += tbl_ptr->table_entries; |