-
Notifications
You must be signed in to change notification settings - Fork 592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(agw): Modified code to port teid has list to protobuf in sgw_s8 task #14006
Conversation
…edure_id to protobuf map Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
Thanks for opening a PR! 💯
Howto
More infoPlease take a moment to read through the Magma project's
If this is your first Magma PR, also consider reading
|
} | ||
free_wrapper((void**)sgw_eps_context); | ||
free_wrapper((void**)ptr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[cpplint] reported by reviewdog 🐶
Using C-style cast. Use reinterpret_cast<void**>(...) instead [readability/casting] [4]
} | ||
} | ||
state_cache_p->temporary_create_session_procedure_id_map.map = nullptr; | ||
free_cpp_wrapper((void**)&state_cache_p); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[cpplint] reported by reviewdog 🐶
Using C-style cast. Use reinterpret_cast<void**>(...) instead [readability/casting] [4]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the warning
@rsarwad Can you fix the linter warnings and rebase your PR? |
@@ -170,15 +170,15 @@ struct proto_map_s { | |||
** the map. If key does not exists returns error ** | |||
** ** | |||
***************************************************************************/ | |||
proto_map_rc_t remove(const keyT key) { | |||
proto_map_rc_t remove(const keyT key, bool free_an_entry = true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the need of this flag? Shouldn`t the entry be freed always?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If flag is set, an entry for corresponding key would be removed and also contents are freed.
But in this PR, sgw_context would be initially in map, temporary_create_session_procedure_id_map. On reception of create session response, sgw_context would be removed from temporary_create_session_procedure_id_map and inserted into state_tied_map
sgw_eps_bearer_context_information_t* sgw_bearer_context_info = NULL; | ||
hash_table_ts_t* state_imsi_ht = get_sgw_ue_state(); | ||
sgw_eps_bearer_context_information_t* sgw_bearer_context_info = nullptr; | ||
map_uint32_sgw_eps_bearer_context_t* state_teid_ht = get_s8_state_teid_map(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NULL check for state_teid_ht
} | ||
} | ||
state_cache_p->temporary_create_session_procedure_id_map.map = nullptr; | ||
free_cpp_wrapper((void**)&state_cache_p); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the warning
@@ -130,5 +148,14 @@ status_code_e SgwStateManager::read_ue_state_from_db() { | |||
sgw_state_t* SgwStateManager::get_state(bool read_from_db) { | |||
return state_cache_p; | |||
} | |||
|
|||
map_uint32_sgw_eps_bearer_context_t* SgwStateManager::get_s8_state_teid_map() { | |||
AssertFatal( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Error log instead of assertFatal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's mandatory to have this flag, is_initialized to be initialized. So I think assertFatal should be fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, if the state is not cleanly initialized from Redis, the service should fail to start up.
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
…d_hl Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
"s11_bearer_context_information_htbl"; | ||
constexpr char SGW_STATE_TABLE_NAME[] = "sgw_state"; | ||
constexpr char SGW_TASK_NAME[] = "SGW"; | ||
constexpr char SGW_S8_CSR_PROC_ID_MAP[] = "sgw_s8_csr_proc_id_map"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constexpr char SGW_S8_CSR_PROC_ID_MAP[] = "sgw_s8_csr_proc_id_map"; | |
constexpr char SGW_S8_CSR_PROC_ID_MAP_NAME[] = "sgw_s8_csr_proc_id_map"; |
@@ -130,5 +148,14 @@ status_code_e SgwStateManager::read_ue_state_from_db() { | |||
sgw_state_t* SgwStateManager::get_state(bool read_from_db) { | |||
return state_cache_p; | |||
} | |||
|
|||
map_uint32_sgw_eps_bearer_context_t* SgwStateManager::get_s8_state_teid_map() { | |||
AssertFatal( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, if the state is not cleanly initialized from Redis, the service should fail to start up.
(const hash_key_t)session_rsp_p->temporary_create_session_procedure_id, | ||
(void**)&sgw_context_p); | ||
sgw_eps_bearer_context_information_t* sgw_context_p = nullptr; | ||
sgw_state->temporary_create_session_procedure_id_map.get( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of getting this entry before removing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While handling create session request, sgw_context is created and inserted into map, temporary_create_session_procedure_id_map. Because for roaming users, sgw_s11_teid would be allocated by external PGW, shall be received in create session response message. So on reception of create session response, sgw_context is removed from map, but not freed.
So first we get the sgw_context, remove from map, temporary_create_session_procedure_id_map and insert into state_teid_map
@@ -1846,17 +1850,30 @@ sgw_eps_bearer_context_information_t* update_sgw_context_to_s11_teid_map( | |||
OAILOG_FUNC_RETURN(LOG_SGW_S8, sgw_context_p); | |||
} | |||
|
|||
if (sgw_state->temporary_create_session_procedure_id_map.remove( | |||
session_rsp_p->temporary_create_session_procedure_id, false) != |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need the remove with false
flag here? In the original logic the entry is being removed and freed from the hash table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the original code, only entry is removed but not freed from hash table. This is taken care by API, hashtable_ts_remove() which only removes an entry from hash table but doesn't free. For API, hashtable_ts_free() free_wrapper is called as here https://github.com/magma/magma/blob/master/lte/gateway/c/core/oai/lib/hashtable/hashtable.c#L664
But same is not true for hashtable_ts_remove(), https://github.com/magma/magma/blob/master/lte/gateway/c/core/oai/lib/hashtable/hashtable.c#L691
The original code is here, https://github.com/magma/magma/pull/14006/files#diff-89dd268674e287dc1dc45f2515f69e41f864be6074f3e03529324cb1eeecb374L1837
To implement same behavior, I added new flag.
} | ||
free_wrapper((void**)sgw_eps_context); | ||
free_wrapper(reinterpret_cast<void**>(ptr)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
free_wrapper(reinterpret_cast<void**>(ptr)); | |
free_cpp_wrapper(reinterpret_cast<void**>(ptr)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this PR, memory for sgw_eps_bearer_context_information_t is allocated with calloc. But in other PR, memory is allocated with new(). It's here, https://github.com/magma/magma/pull/13895/files#diff-89dd268674e287dc1dc45f2515f69e41f864be6074f3e03529324cb1eeecb374R189
It's shall be taken care while rebasing.
1ca936d
to
5215f3e
Compare
} | ||
s8_state_teid_map.map = nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason that you can not set map
to nullptr
in function destroy_map()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had missed it. Thanks for bringing into notice
"temporary_create_session_procedure_id_map "); | ||
} | ||
} | ||
state_cache_p->temporary_create_session_procedure_id_map.map = nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
5215f3e
to
2ecc05e
Compare
…d_hl Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@rsarwad Please rebase the PR |
…d_hl Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
5161a80
to
b49a9fa
Compare
@@ -124,7 +124,6 @@ void SgwStateManager::free_state() { | |||
"temporary_create_session_procedure_id_map "); | |||
} | |||
} | |||
s8_state_teid_map.map = nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is removed because map is set to nullptr within destroy_map() itself. This change is done while addressing the comment, #14006 (comment)
@@ -136,7 +135,6 @@ void SgwStateManager::free_state() { | |||
"temporary_create_session_procedure_id_map "); | |||
} | |||
} | |||
state_cache_p->temporary_create_session_procedure_id_map.map = nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is removed because map is set to nullptr within destroy_map() itself. This change is done while addressing the comment, #14006 (comment)
2b6408c
to
0a83b01
Compare
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
0a83b01
to
6be4c38
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
@rsarwad , please rebase to retrigger CI. |
…d_hl Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
Summary
fix(agw): Modified code to port teid has list to protobuf in sgw_s8 task
Test Plan
Executed only unit test suite. For in-bound roaming, End2End scenarios used to be tested in Tera VM setup. Since we are not using the Tera VM setup. We couldn't validate End2End scenario.
Additional Information
Once federated integ_test supports mocked external PGW, we can validate the End2End scenarios for inbound roaming UE