pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/29839 )
Change subject: Call ms_store->get_ms() with GSM_RESERVED_TMSI instead of 0 ......................................................................
Call ms_store->get_ms() with GSM_RESERVED_TMSI instead of 0
That's the special value checked in the implementation of get_ms() to skip lookups based on TLLI. This should save some cicles trying to match TLLI 0.
Change-Id: I364d238ff8a82abb14281140fe18b273c0e8f541 --- M src/bts.cpp M src/pcu_vty_functions.cpp M src/tbf.cpp M src/tbf_dl.cpp M tests/ms/MsTest.cpp M tests/tbf/TbfTest.cpp 6 files changed, 15 insertions(+), 15 deletions(-)
Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve osmith: Looks good to me, approved
diff --git a/src/bts.cpp b/src/bts.cpp index f77c5a2..df08cc6 100644 --- a/src/bts.cpp +++ b/src/bts.cpp @@ -1389,7 +1389,7 @@
struct GprsMs *bts_ms_by_imsi(struct gprs_rlcmac_bts *bts, const char *imsi) { - return bts_ms_store(bts)->get_ms(0, 0, imsi); + return bts_ms_store(bts)->get_ms(GSM_RESERVED_TMSI, GSM_RESERVED_TMSI, imsi); }
const struct llist_head* bts_ms_list(struct gprs_rlcmac_bts *bts) diff --git a/src/pcu_vty_functions.cpp b/src/pcu_vty_functions.cpp index 1745eea..28ecebf 100644 --- a/src/pcu_vty_functions.cpp +++ b/src/pcu_vty_functions.cpp @@ -236,7 +236,7 @@ int pcu_vty_show_ms_by_imsi(struct vty *vty, struct gprs_rlcmac_bts *bts, const char *imsi) { - GprsMs *ms = bts_ms_store(bts)->get_ms(0, 0, imsi); + GprsMs *ms = bts_ms_store(bts)->get_ms(GSM_RESERVED_TMSI, GSM_RESERVED_TMSI, imsi); if (!ms) { vty_out(vty, "Unknown IMSI '%s'.%s", imsi, VTY_NEWLINE); return CMD_WARNING; diff --git a/src/tbf.cpp b/src/tbf.cpp index d15cd3d..cb5d9f3 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -225,7 +225,7 @@ if (!ms_check_tlli(ms(), tlli)) { GprsMs *old_ms;
- old_ms = bts_ms_store(bts)->get_ms(tlli, 0, NULL); + old_ms = bts_ms_store(bts)->get_ms(tlli, GSM_RESERVED_TMSI, NULL); if (old_ms) ms_merge_and_clear_ms(ms(), old_ms); } diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp index 9c99cf6..67ac573 100644 --- a/src/tbf_dl.cpp +++ b/src/tbf_dl.cpp @@ -295,7 +295,7 @@ /* If we got MS by TLLI above let's see if we already have another MS * object identified by IMSI and merge them */ if (ms && !ms_imsi_is_valid(ms) && imsi) { - ms_old = bts_ms_store(bts)->get_ms(0, 0, imsi); + ms_old = bts_ms_store(bts)->get_ms(GSM_RESERVED_TMSI, GSM_RESERVED_TMSI, imsi); if (ms_old && ms_old != ms) { /* The TLLI has changed (RAU), so there are two MS * objects for the same MS */ diff --git a/tests/ms/MsTest.cpp b/tests/ms/MsTest.cpp index 2ff2fc2..cbafee9 100644 --- a/tests/ms/MsTest.cpp +++ b/tests/ms/MsTest.cpp @@ -416,10 +416,10 @@ OSMO_ASSERT(ms == ms_tmp); OSMO_ASSERT(ms_tlli(ms) == tlli + 0);
- ms_tmp = store.get_ms(0, 0, imsi1); + ms_tmp = store.get_ms(GSM_RESERVED_TMSI, GSM_RESERVED_TMSI, imsi1); OSMO_ASSERT(ms == ms_tmp); OSMO_ASSERT(strcmp(ms_imsi(ms), imsi1) == 0); - ms_tmp = store.get_ms(0, 0, imsi2); + ms_tmp = store.get_ms(GSM_RESERVED_TMSI, GSM_RESERVED_TMSI, imsi2); OSMO_ASSERT(ms_tmp == NULL);
ms = prepare_ms(&store, tlli + 1, GPRS_RLCMAC_UL_TBF); @@ -432,10 +432,10 @@ OSMO_ASSERT(ms == ms_tmp); OSMO_ASSERT(ms_tlli(ms) == tlli + 1);
- ms_tmp = store.get_ms(0, 0, imsi1); + ms_tmp = store.get_ms(GSM_RESERVED_TMSI, GSM_RESERVED_TMSI, imsi1); OSMO_ASSERT(ms_tmp != NULL); OSMO_ASSERT(ms_tmp != ms); - ms_tmp = store.get_ms(0, 0, imsi2); + ms_tmp = store.get_ms(GSM_RESERVED_TMSI, GSM_RESERVED_TMSI, imsi2); OSMO_ASSERT(ms == ms_tmp); OSMO_ASSERT(strcmp(ms_imsi(ms), imsi2) == 0);
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp index 116b234..c18fa77 100644 --- a/tests/tbf/TbfTest.cpp +++ b/tests/tbf/TbfTest.cpp @@ -450,7 +450,7 @@ dl_tbf[1]->update_ms(0xf1000002, GPRS_RLCMAC_DL_TBF);
ms_set_imsi(dl_tbf[0]->ms(), "001001000000001"); - ms1 = bts_ms_store(bts)->get_ms(0, 0, "001001000000001"); + ms1 = bts_ms_store(bts)->get_ms(GSM_RESERVED_TMSI, GSM_RESERVED_TMSI, "001001000000001"); OSMO_ASSERT(ms1 != NULL); ms2 = bts_ms_store(bts)->get_ms(0xf1000001); OSMO_ASSERT(ms2 != NULL); @@ -459,9 +459,9 @@
/* change the IMSI on TBF 0 */ ms_set_imsi(dl_tbf[0]->ms(), "001001000000002"); - ms1 = bts_ms_store(bts)->get_ms(0, 0, "001001000000001"); + ms1 = bts_ms_store(bts)->get_ms(GSM_RESERVED_TMSI, GSM_RESERVED_TMSI, "001001000000001"); OSMO_ASSERT(ms1 == NULL); - ms1 = bts_ms_store(bts)->get_ms(0, 0, "001001000000002"); + ms1 = bts_ms_store(bts)->get_ms(GSM_RESERVED_TMSI, GSM_RESERVED_TMSI, "001001000000002"); OSMO_ASSERT(ms1 != NULL); OSMO_ASSERT(strcmp(ms_imsi(ms2), "001001000000002") == 0); OSMO_ASSERT(ms1 == ms2); @@ -470,7 +470,7 @@ { ms_ref(ms2); ms_set_imsi(dl_tbf[1]->ms(), "001001000000002"); - ms1 = bts_ms_store(bts)->get_ms(0, 0, "001001000000002"); + ms1 = bts_ms_store(bts)->get_ms(GSM_RESERVED_TMSI, GSM_RESERVED_TMSI, "001001000000002"); OSMO_ASSERT(ms1 != NULL); OSMO_ASSERT(ms1 != ms2); OSMO_ASSERT(strcmp(ms_imsi(ms1), "001001000000002") == 0); @@ -482,7 +482,7 @@ OSMO_ASSERT(ms2 == NULL);
tbf_free(dl_tbf[1]); - ms1 = bts_ms_store(bts)->get_ms(0, 0, "001001000000002"); + ms1 = bts_ms_store(bts)->get_ms(GSM_RESERVED_TMSI, GSM_RESERVED_TMSI, "001001000000002"); OSMO_ASSERT(ms1 == NULL);
TALLOC_FREE(the_pcu); @@ -565,7 +565,7 @@ delay_csec, buf, sizeof(buf)); OSMO_ASSERT(rc >= 0);
- ms = bts_ms_store(bts)->get_ms(0, 0, imsi); + ms = bts_ms_store(bts)->get_ms(GSM_RESERVED_TMSI, GSM_RESERVED_TMSI, imsi); OSMO_ASSERT(ms != NULL); OSMO_ASSERT(ms_dl_tbf(ms) != NULL); ms_dl_tbf(ms)->set_ta(0); @@ -1708,7 +1708,7 @@ { GprsMs *ms, *ms2;
- ms = bts_ms_store(bts)->get_ms(tlli, 0, imsi); + ms = bts_ms_store(bts)->get_ms(tlli, GSM_RESERVED_TMSI, imsi);
dl_tbf_handle(bts, tlli, 0, imsi, 0, 0, 1000, data, data_size);