-
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): Modifed code to port hash list of ue contexts to protobuf map #13895
Conversation
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
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
|
@@ -54,7 +48,7 @@ void delete_pending_procedures( | |||
base_proc1 = base_proc2; | |||
} | |||
LIST_INIT(ctx_p->pending_procedures); | |||
free_wrapper((void**)&ctx_p->pending_procedures); | |||
free_cpp_wrapper((void**)&ctx_p->pending_procedures); |
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]
if (ue_context_p) { | ||
sgw_s11_teid_t* p1 = LIST_FIRST(&(ue_context_p->sgw_s11_teid_list)); | ||
while (p1) { | ||
if (p1->sgw_s11_teid == teid) { | ||
LIST_REMOVE(p1, entries); | ||
free_wrapper((void**)&p1); | ||
free_cpp_wrapper((void**)&p1); |
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]
delete_pending_procedures( | ||
&(context_p->sgw_eps_bearer_context_information)); | ||
|
||
free_cpp_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]
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.
Please fix lint warnings
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
sgw_s11_teid_t* p2 = nullptr; | ||
while (p1) { | ||
p2 = LIST_NEXT(p1, entries); | ||
LIST_REMOVE(p1, entries); | ||
free_wrapper((void**)&p1); | ||
free_cpp_wrapper((void**)&p1); |
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
@@ -97,7 +97,7 @@ void sgw_remove_sgw_bearer_context_information(sgw_state_t* sgw_state, | |||
while (p1) { | |||
if (p1->sgw_s11_teid == teid) { | |||
LIST_REMOVE(p1, entries); | |||
free_wrapper((void**)&p1); | |||
free_cpp_wrapper((void**)&p1); |
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.
Please fix lint warning
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 cpplint warning
@@ -1475,7 +1474,7 @@ | |||
if (pgw_ni_cbr_proc && (LIST_EMPTY(pgw_ni_cbr_proc->pending_eps_bearers))) { | |||
pgw_base_proc_t* base_proc1 = LIST_FIRST(sgw_context_p->pending_procedures); | |||
LIST_REMOVE(base_proc1, entries); | |||
free_wrapper((void**)&sgw_context_p->pending_procedures); | |||
free_cpp_wrapper((void**)&sgw_context_p->pending_procedures); |
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
@@ -119,6 +118,7 @@ TEST(SPGWStateConverterTest, TestUEContextConversion) { | |||
EXPECT_TRUE(!memcmp(&want_sgw.last_known_cell_Id, | |||
&got_sgw.last_known_cell_Id, | |||
sizeof(want_sgw.last_known_cell_Id))); | |||
sgw_free_ue_context((void**)&final_ctx); |
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.
Please fix lint warning
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
…text_ht Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
Oops! Looks like you failed the Howto
♻️ Updated: ❌ The check is still failing the DCO check after the last commit. |
@rsarwad Can you fix the conflicts and the linter warnings? |
spgw_free_s11_bearer_context_information(&new_bearer_context_information); | ||
return NULL; | ||
} | ||
|
||
/* | ||
* Trying to insert the new tunnel into the tree. |
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.
Please update the comment
* Trying to insert the new tunnel into the tree. | |
* Trying to insert the new tunnel into the map. |
"Failed to free teid from state_teid_ht \n"); | ||
return temp; | ||
"Failed to free teid from state_teid_map \n"); | ||
return magma::PROTO_MAP_KEY_ALREADY_EXISTS; |
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 should be an explicit error, not that key already exists. Can we add an error code for PROTO_MAP_REMOVE_KEY_FAILED
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.
The above comment is addressed at https://github.com/magma/magma/pull/13895/files#diff-8dbb5820f4aef5a4b6295c1040d13d405728e409346d63b37cfac400b8004312R189
state_teid_map_t* state_teid_map = get_spgw_teid_state(); | ||
if (!state_teid_map) { | ||
OAILOG_ERROR(LOG_SPGW_APP, "Failed to get state_teid_map"); | ||
return spgw_bearer_context_info; |
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.
Better to just return a nullptr
(which is the value of spgw_bearer_context_info at this point) since this is an error scenario.
return spgw_bearer_context_info; | |
return nullptr; |
map_uint64_spgw_ue_context_t* state_ue_map = get_spgw_ue_state(); | ||
if (!state_ue_map) { | ||
OAILOG_ERROR(LOG_SPGW_APP, "Failed to find spgw_ue_state"); | ||
OAILOG_FUNC_RETURN(LOG_SPGW_APP, ue_context_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.
Same comment as above
OAILOG_FUNC_RETURN(LOG_SPGW_APP, ue_context_p); | |
OAILOG_FUNC_RETURN(LOG_SPGW_APP, nullptr); |
OAILOG_ERROR(LOG_SPGW_APP, "Failed to find spgw_ue_state"); | ||
OAILOG_FUNC_RETURN(LOG_SPGW_APP, ue_context_p); | ||
} | ||
state_ue_map->get(imsi64, &ue_context_p); | ||
OAILOG_FUNC_RETURN(LOG_SPGW_APP, ue_context_p); | ||
} | ||
|
||
spgw_ue_context_t* spgw_create_or_get_ue_context(imsi64_t imsi64) { | ||
OAILOG_FUNC_IN(LOG_SPGW_APP); | ||
spgw_ue_context_t* ue_context_p = NULL; |
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.
spgw_ue_context_t* ue_context_p = NULL; | |
spgw_ue_context_t* ue_context_p = nullptr; |
map_uint64_spgw_ue_context_t* state_ue_map = get_spgw_ue_state(); | ||
if (!state_ue_map) { | ||
OAILOG_ERROR(LOG_SPGW_APP, "Failed to find spgw_ue_state"); | ||
OAILOG_FUNC_RETURN(LOG_SPGW_APP, ue_context_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.
OAILOG_FUNC_RETURN(LOG_SPGW_APP, ue_context_p); | |
OAILOG_FUNC_RETURN(LOG_SPGW_APP, nullptr); |
@@ -1984,7 +1989,8 @@ void handle_failed_create_bearer_response( | |||
pgw_base_proc_t* base_proc1 = | |||
LIST_FIRST(sgw_context_p->pending_procedures); | |||
LIST_REMOVE(base_proc1, entries); | |||
free_wrapper((void**)&sgw_context_p->pending_procedures); | |||
delete sgw_context_p->pending_procedures; |
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.
Please use free_cpp_wrapper
delete_pending_procedures( | ||
&(context_p->sgw_eps_bearer_context_information)); | ||
|
||
free_cpp_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.
Please fix lint warnings
@@ -215,8 +215,10 @@ void SpgwStateConverter::sgw_pdn_connection_to_proto( | |||
|
|||
void SpgwStateConverter::proto_to_sgw_pdn_connection( | |||
const oai::SgwPdnConnection& proto, sgw_pdn_connection_t* state_pdn) { | |||
state_pdn->apn_in_use = | |||
strndup(proto.apn_in_use().c_str(), proto.apn_in_use().length()); | |||
if ((proto.apn_in_use().length())) { |
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.
Can we use proto.has_apn_in_use()
here?
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.
apn_in_use is of string type. For string data type, protobuf doesn't generate api, has_<field_name>;
It's in https://developers.google.com/protocol-buffers/docs/reference/cpp-generated#proto3_string
If field is not set then it returns empty string, but again in code we need to check empty string using memcmp; So I thought to use length of string.
@@ -97,7 +97,7 @@ void sgw_remove_sgw_bearer_context_information(sgw_state_t* sgw_state, | |||
while (p1) { | |||
if (p1->sgw_s11_teid == teid) { | |||
LIST_REMOVE(p1, entries); | |||
free_wrapper((void**)&p1); | |||
free_cpp_wrapper((void**)&p1); |
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.
Please fix lint warning
@@ -119,6 +118,7 @@ TEST(SPGWStateConverterTest, TestUEContextConversion) { | |||
EXPECT_TRUE(!memcmp(&want_sgw.last_known_cell_Id, | |||
&got_sgw.last_known_cell_Id, | |||
sizeof(want_sgw.last_known_cell_Id))); | |||
sgw_free_ue_context((void**)&final_ctx); |
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.
Please fix lint warning
@@ -44,9 +44,9 @@ void put_spgw_state(void); | |||
* Returns pointer to SPGW UE state | |||
* @return hashtable_ts_t struct with SPGW UE context structs as data |
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.
Update the return type in comment
@@ -1,70 +0,0 @@ | |||
/* |
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 this not used anywhere?
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.
sgw.hpp is nowhere used
"An error occurred while destroying SGW s11_bearer_context_information " | ||
"hashtable"); | ||
if (state_ue_map.map && state_ue_map.destroy_map() != PROTO_MAP_OK) { | ||
OAI_FPRINTF_ERR("An error occurred while destroying SPGW's state ue 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.
What doe FPRINTF do? Can we replace this with OAILOG_ERROR
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 think we need to keep "OAI_FPRINTF_ERR" because free_state() would be called when tasks exits. So can't rely on logging task as it might have already exited.
Let me change at other places in this function.
@@ -97,7 +97,7 @@ void sgw_remove_sgw_bearer_context_information(sgw_state_t* sgw_state, | |||
while (p1) { | |||
if (p1->sgw_s11_teid == teid) { | |||
LIST_REMOVE(p1, entries); | |||
free_wrapper((void**)&p1); | |||
free_cpp_wrapper((void**)&p1); |
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 cpplint warning
@@ -1475,7 +1474,7 @@ | |||
if (pgw_ni_cbr_proc && (LIST_EMPTY(pgw_ni_cbr_proc->pending_eps_bearers))) { | |||
pgw_base_proc_t* base_proc1 = LIST_FIRST(sgw_context_p->pending_procedures); | |||
LIST_REMOVE(base_proc1, entries); | |||
free_wrapper((void**)&sgw_context_p->pending_procedures); | |||
free_cpp_wrapper((void**)&sgw_context_p->pending_procedures); |
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
@@ -119,6 +118,7 @@ TEST(SPGWStateConverterTest, TestUEContextConversion) { | |||
EXPECT_TRUE(!memcmp(&want_sgw.last_known_cell_Id, | |||
&got_sgw.last_known_cell_Id, | |||
sizeof(want_sgw.last_known_cell_Id))); | |||
sgw_free_ue_context((void**)&final_ctx); |
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
sgw_s11_teid_t* p2 = nullptr; | ||
while (p1) { | ||
p2 = LIST_NEXT(p1, entries); | ||
LIST_REMOVE(p1, entries); | ||
free_wrapper((void**)&p1); | ||
free_cpp_wrapper((void**)&p1); |
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
delete_pending_procedures( | ||
&(context_p->sgw_eps_bearer_context_information)); | ||
|
||
free_cpp_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.
Fix the warning
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
6a85922
to
8eafe02
Compare
magma#14139) otherwise hanging containers take up to 20s to restart and tests run into timeouts. Signed-off-by: Marco Pfirrmann <marco.pfirrmann@tngtech.com> Co-authored-by: Marco Pfirrmann <christian.kraemer@tngtech.com> Addressed review comment Signed-off-by: Rashmi <rashmi.sarwad@radisys.com> feat(agw): time before killing containers during restart is reduced as (magma#14139) otherwise hanging containers take up to 20s to restart and tests run into timeouts. Signed-off-by: Marco Pfirrmann <marco.pfirrmann@tngtech.com> Co-authored-by: Marco Pfirrmann <christian.kraemer@tngtech.com> Addressed review comment Signed-off-by: Rashmi <rashmi.sarwad@radisys.com> feat(agw): time before killing containers during restart is reduced as (magma#14139) otherwise hanging containers take up to 20s to restart and tests run into timeouts. Signed-off-by: Marco Pfirrmann <marco.pfirrmann@tngtech.com> Co-authored-by: Marco Pfirrmann <christian.kraemer@tngtech.com> fix(ci): there was a bit too much deleted in magma#14050 (magma#14143) Signed-off-by: Fritz Lehnert <13189449+Neudrino@users.noreply.github.com>
e4b4fc0
to
bff7cc9
Compare
…text_ht Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
@@ -112,8 +114,7 @@ status_code_e SpgwStateManager::read_ue_state_from_db() { | |||
return RETURNerror; | |||
} | |||
OAILOG_DEBUG(log_task, "Reading UE state from db for key %s", key.c_str()); | |||
spgw_ue_context_t* ue_context_p = | |||
(spgw_ue_context_t*)calloc(1, sizeof(spgw_ue_context_t)); | |||
spgw_ue_context_t* ue_context_p = new spgw_ue_context_t(); |
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 ue_context_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.
In C++ the new
operator already throws an exception (bad_alloc
) if it is not able to allocate memory I guess. Why we should need the Null check?
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.
@ajahl should we catch the exception?
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.
Only if we can handle the error, maybe to log the error. However, the application should be stopped.
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.
Then it's good to catch the exception to understand where the application is going wrong. @ssanadhya May I know your thoughts on this?
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.
@rsarwad , since this would be a system error, it is best to let the process terminate as a result of bad_alloc
exception. No need to catch that exception.
@@ -55,8 +55,7 @@ status_code_e mock_read_spgw_ue_state_db( | |||
return RETURNerror; | |||
} | |||
|
|||
spgw_ue_context_t* ue_context_p = | |||
(spgw_ue_context_t*)calloc(1, sizeof(spgw_ue_context_t)); | |||
spgw_ue_context_t* ue_context_p = new spgw_ue_context_t(); |
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 missing
@@ -76,8 +76,7 @@ TEST(SPGWStateConverterTest, TestUEContextConversion) { | |||
auto want_teid = LIST_FIRST(&initial_ctx->sgw_s11_teid_list)->sgw_s11_teid; | |||
|
|||
oai::SpgwUeContext proto_ctx; | |||
spgw_ue_context_t* final_ctx = | |||
(spgw_ue_context_t*)calloc(1, sizeof(spgw_ue_context_t)); | |||
spgw_ue_context_t* final_ctx = new spgw_ue_context_t(); |
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 missing
LIST_INIT(s11_proc_create_bearer->pending_eps_bearers); | ||
for (auto& eps_bearer_proto : proto.pending_eps_bearers()) { | ||
sgw_eps_bearer_ctxt_t* eps_bearer = | ||
(sgw_eps_bearer_ctxt_t*)calloc(1, sizeof(sgw_eps_bearer_ctxt_t)); | ||
sgw_eps_bearer_ctxt_t* eps_bearer = new sgw_eps_bearer_ctxt_t(); |
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 missing
@@ -937,26 +936,23 @@ void SpgwStateConverter::insert_proc_into_sgw_pending_procedures( | |||
const oai::PgwCbrProcedure& proto, | |||
sgw_eps_bearer_context_information_t::pending_procedures_s* | |||
pending_procedures) { | |||
pgw_ni_cbr_proc_t* s11_proc_create_bearer = | |||
(pgw_ni_cbr_proc_t*)calloc(1, sizeof(pgw_ni_cbr_proc_t)); | |||
pgw_ni_cbr_proc_t* s11_proc_create_bearer = new pgw_ni_cbr_proc_t(); |
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 missing
@@ -233,8 +233,7 @@ void SpgwStateConverter::proto_to_sgw_pdn_connection( | |||
|
|||
for (int i = 0; i < BEARERS_PER_UE; i++) { | |||
if (proto.eps_bearer_list(i).eps_bearer_id()) { | |||
auto* eps_bearer_entry = | |||
(sgw_eps_bearer_ctxt_t*)calloc(1, sizeof(sgw_eps_bearer_ctxt_t)); | |||
auto* eps_bearer_entry = new sgw_eps_bearer_ctxt_t(); |
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 missing
@@ -72,8 +70,7 @@ pgw_ni_cbr_proc_t* pgw_create_procedure_create_bearer( | |||
LIST_INSERT_HEAD((ctx_p->pending_procedures), base_proc, entries); | |||
|
|||
s11_proc_create_bearer->pending_eps_bearers = | |||
(pgw_ni_cbr_proc_s::pending_eps_bearers_s*)calloc( | |||
1, sizeof(s11_proc_create_bearer->pending_eps_bearers)); | |||
new pgw_ni_cbr_proc_s::pending_eps_bearers_s(); |
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 missing
pgw_ni_cbr_proc_t* s11_proc_create_bearer = | ||
reinterpret_cast<pgw_ni_cbr_proc_t*>( | ||
calloc(1, sizeof(pgw_ni_cbr_proc_t))); | ||
pgw_ni_cbr_proc_t* s11_proc_create_bearer = new pgw_ni_cbr_proc_t(); |
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 missing
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
sgw_eps_bearer_entry_wrapper->sgw_eps_bearer_entry = eps_bearer; | ||
LIST_INSERT_HEAD((s11_proc_create_bearer->pending_eps_bearers), | ||
sgw_eps_bearer_entry_wrapper, entries); | ||
} | ||
if (failed_to_allocate) { | ||
pgw_free_procedure_create_bearer( | ||
(pgw_ni_cbr_proc_t**)&s11_proc_create_bearer); |
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<pgw_ni_cbr_proc_t**>(...) instead [readability/casting] [4]
hashtable_ts_create(SGW_STATE_CONTEXT_HT_MAX_SIZE, nullptr, | ||
(void (*)(void**))sgw_free_ue_context, nullptr); | ||
state_ue_map.map = new google::protobuf::Map<uint64_t, spgw_ue_context_s*>(); | ||
if (!(state_ue_map.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.
If you use new to instantiate an object in C++ the Null check is always needless because of the bad_alloc exception.
sgw_eps_bearer_ctxt_t* eps_bearer_ctxt_p = | ||
reinterpret_cast<sgw_eps_bearer_ctxt_t*>( | ||
calloc(1, sizeof(sgw_eps_bearer_ctxt_t))); | ||
sgw_eps_bearer_ctxt_t* eps_bearer_ctxt_p = new sgw_eps_bearer_ctxt_t(); | ||
|
||
if (!eps_bearer_ctxt_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.
The Null check is always needless because of C++ throws a bad_alloc exception.
@@ -660,8 +657,7 @@ status_code_e create_temporary_dedicated_bearer_context( | |||
} | |||
} | |||
struct sgw_eps_bearer_entry_wrapper_s* sgw_eps_bearer_entry_p = | |||
reinterpret_cast<sgw_eps_bearer_entry_wrapper_s*>( | |||
calloc(1, sizeof(*sgw_eps_bearer_entry_p))); | |||
new sgw_eps_bearer_entry_wrapper_s(); | |||
if (!sgw_eps_bearer_entry_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.
The Null check is always needless because of C++ throws a bad_alloc exception.
reinterpret_cast<pgw_ni_cbr_proc_t*>( | ||
calloc(1, sizeof(pgw_ni_cbr_proc_t))); | ||
pgw_ni_cbr_proc_t* s11_proc_create_bearer = new pgw_ni_cbr_proc_t(); | ||
if (!s11_proc_create_bearer) { |
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.
The Null check is always needless because of C++ throws a bad_alloc exception.
s11_proc_create_bearer->proc.type = | ||
PGW_BASE_PROC_TYPE_NETWORK_INITATED_CREATE_BEARER_REQUEST; | ||
pgw_base_proc_t* base_proc = (pgw_base_proc_t*)s11_proc_create_bearer; | ||
|
||
if (!ctx_p->pending_procedures) { | ||
ctx_p->pending_procedures = | ||
new sgw_eps_bearer_context_information_s::pending_procedures_s(); | ||
if (!ctx_p->pending_procedures) { |
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.
The Null check is always needless because of C++ throws a bad_alloc exception.
* Malloc failed, may be ENOMEM error | ||
*/ | ||
new_tunnel = new mme_sgw_tunnel_t(); | ||
if (new_tunnel == 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.
The Null check after call the new operator is always needless because of C++ throws a bad_alloc exception.
…text_ht Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
1a21c6c
to
0f7be0e
Compare
Oops! Looks like you failed the Howto
♻️ Updated: ❌ The check is still failing the PR Check DCO after the last commit. |
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
0754a91
to
a35732f
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
…text_ht Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
cd8575e
to
a149ec6
Compare
Summary
fix(agw): Modifed code to port hash list of ue contexts to protobuf map
Test Plan
Executed s1ap sanity test suite and unit test cases.
Because of DCO check failure, the changes have been duplicated PR, #14342