Skip to content
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): Migrate hash list of state_ue to protobuf_map #13508

Merged
merged 94 commits into from
Sep 2, 2022

Conversation

rsarwad
Copy link
Contributor

@rsarwad rsarwad commented Aug 4, 2022

Summary

Modified code to replace hashtable with protobuf map for state_ue hash table in s1ap module
The PR partially addresses the issue, #11190

Test Plan

Executed s1ap sanity test suite and unit test case.
Verified manually with test_attact_detach_with_mme_restart.py test case, to check whether contents of map, state ue map is correctly formed after mme recovery

Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
…tion_10869

Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
…_c_to_cpp

Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
…tion_10869

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>
…_c_to_cpp

Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
…ad/magma into rsarwad_s1ap_integrate_proto_map

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>
…ad/magma into rsarwad_s1ap_integrate_proto_map

Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
…_c_to_cpp

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>
…tion_10869

Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
…tion_10869

Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
…odule

Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
…tion_10869

Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
hashtable_rc_code2string(hashrc));
free_wrapper((void**)&ue_ref);
magma::map_rc_code2string(rc));
free_cpp_wrapper((void**)&ue_ref);
Copy link
Contributor

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]

@rsarwad rsarwad force-pushed the rsarwad_migrate_state_ue_ht_s1ap branch from 90f5518 to 4d2837d Compare August 4, 2022 13:50
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
@rsarwad rsarwad force-pushed the rsarwad_migrate_state_ue_ht_s1ap branch from 4d2837d to 68afe56 Compare August 4, 2022 13:59
…tate_ue_ht_s1ap

Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
@github-actions
Copy link
Contributor

github-actions bot commented Aug 4, 2022

feg-workflow

    2 files  203 suites   40s ⏱️
374 tests 374 ✔️ 0 💤 0
388 runs  388 ✔️ 0 💤 0

Results for commit 6bdf077.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 4, 2022

dp-workflow

14 tests   14 ✔️  2m 28s ⏱️
  1 suites    0 💤
  1 files      0

Results for commit 6bdf077.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 4, 2022

agw-workflow

615 tests   611 ✔️  5m 34s ⏱️
    2 suites      4 💤
    2 files        0

Results for commit 6bdf077.

♻️ This comment has been updated with latest results.

@@ -152,23 +152,23 @@ status_code_e S1apStateManager::read_ue_state_from_db() {
for (const auto& key : keys) {
OAILOG_DEBUG(log_task, "Reading UE state from db for %s", key.c_str());
UeDescription ue_proto = UeDescription();
auto* ue_context = (ue_description_t*)calloc(1, sizeof(ue_description_t));
auto* ue_context = new ue_description_t();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add NULL check for ue_context

ue_description_t* final_ue =
(ue_description_t*)calloc(1, sizeof(ue_description_t));
ue_description_t* ue = new ue_description_t();
ue_description_t* final_ue = new ue_description_t();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add NULL check

Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
…tate_ue_ht_s1ap

Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
@rsarwad rsarwad requested a review from ssanadhya August 18, 2022 07:27
Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
…tate_ue_ht_s1ap

Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
@@ -458,8 +459,8 @@ void s1ap_remove_ue(s1ap_state_t* state, ue_description_t* ue_ref) {
ue_ref->s1ap_ue_context_rel_timer.id = S1AP_TIMER_INACTIVE_ID;
}

hash_table_ts_t* state_ue_ht = get_s1ap_ue_state();
hashtable_ts_free(state_ue_ht, ue_ref->comp_s1ap_id);
map_uint64_ue_description_t* s1ap_ue_state = get_s1ap_ue_state();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add NULL check for s1ap_ue_state

@@ -3550,8 +3535,8 @@ static bool s1ap_send_enb_deregistered_ind(__attribute__((unused))
ue_description_t* ue_ref_p = NULL;

// Ask for the release of each UE context associated to the eNB
hash_table_ts_t* s1ap_ue_state = get_s1ap_ue_state();
hashtable_ts_get(s1ap_ue_state, (const hash_key_t)dataP, (void**)&ue_ref_p);
map_uint64_ue_description_t* s1ap_ue_state = get_s1ap_ue_state();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add NULL check

@@ -3618,8 +3603,8 @@ bool construct_s1ap_mme_full_reset_req(uint32_t keyP, const uint64_t dataP,
reinterpret_cast<arg_s1ap_construct_enb_reset_req_t*>(argP);
ue_description_t* ue_ref = reinterpret_cast<ue_description_t*>(dataP);

hash_table_ts_t* s1ap_ue_state = get_s1ap_ue_state();
hashtable_ts_get(s1ap_ue_state, (const hash_key_t)dataP, (void**)&ue_ref);
map_uint64_ue_description_t* s1ap_ue_state = get_s1ap_ue_state();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General comment: Add NULL check for s1ap_ue_state after get_s1ap_ue_state()

Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
@rsarwad rsarwad force-pushed the rsarwad_migrate_state_ue_ht_s1ap branch from 1964ed9 to a895d5d Compare August 22, 2022 12:40
Copy link
Contributor

@pruthvihebbani pruthvihebbani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

…tate_ue_ht_s1ap

Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
…tate_ue_ht_s1ap

Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
ue_description_t* final_ue =
(ue_description_t*)calloc(1, sizeof(ue_description_t));
ue_description_t* ue = new ue_description_t();
EXPECT_TRUE(ue != nullptr);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, the nullptr check here is not required when using new ... since C++ returns an instance or throws a std::bad_alloc exception.


if (HASH_TABLE_OK != hashrc) {
if (magma::PROTO_MAP_OK != rc) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (magma::PROTO_MAP_OK != rc) {
if (rc != magma::PROTO_MAP_OK) {

if (HASH_TABLE_OK != h_rc) {
proto_map_rc_t rc =
state_ue_map.insert(ue_context->comp_s1ap_id, ue_context);
if (PROTO_MAP_OK != rc) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (PROTO_MAP_OK != rc) {
if (rc != PROTO_MAP_OK) {


if (HASH_TABLE_OK != h_rc) {
if (magma::PROTO_MAP_OK != rc) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (magma::PROTO_MAP_OK != rc) {
if (rc != magma::PROTO_MAP_OK) {

Copy link
Collaborator

@ssanadhya ssanadhya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm, please address the nit comments

Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
@rsarwad rsarwad force-pushed the rsarwad_migrate_state_ue_ht_s1ap branch from 891923f to 6c6175c Compare September 2, 2022 05:17
…tate_ue_ht_s1ap

Signed-off-by: Rashmi <rashmi.sarwad@radisys.com>
@rsarwad rsarwad merged commit b9bf710 into magma:master Sep 2, 2022
rsarwad added a commit to rsarwad/magma that referenced this pull request Sep 4, 2022
Modified code to replace hashtable with protobuf map for state_ue hash table in s1ap module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: agw Access gateway-related issue size/L Denotes a Pull Request that changes 100-499 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants