This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Max gerrit-no-reply at lists.osmocom.orgReview at https://gerrit.osmocom.org/6241 Move EGPRS WS computation to C code Don't access BTS struct when computing EGPRS window size: let the caller obtain necessary parameters and call corresponding function from C code. This makes it easier to unit-test and follow actual WS computation. Change-Id: Ie411ea2bbfca442b33405584f15687a7ffcbb53c Related: OS#1759 --- M src/mslot_class.c M src/mslot_class.h M src/tbf.cpp M src/tbf.h M src/tbf_dl.cpp M src/tbf_ul.cpp 6 files changed, 13 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/41/6241/1 diff --git a/src/mslot_class.c b/src/mslot_class.c index 12d6d9e..dd172ae 100644 --- a/src/mslot_class.c +++ b/src/mslot_class.c @@ -170,3 +170,9 @@ { return get_mslot_table(ms_cl)->type; } + +uint16_t egprs_window_size(uint16_t ws_base, uint16_t ws_pdch, uint8_t num_pdch) +{ + return OSMO_MIN((num_pdch != 1) ? (128 * num_pdch) : 192, OSMO_MAX(64, + (ws_base + num_pdch * ws_pdch) / 32 * 32)); +} diff --git a/src/mslot_class.h b/src/mslot_class.h index a6366fc..ccacb3e 100644 --- a/src/mslot_class.h +++ b/src/mslot_class.h @@ -46,3 +46,6 @@ uint8_t mslot_class_get_sum(uint8_t ms_cl); uint8_t mslot_class_get_type(uint8_t ms_cl); uint8_t mslot_class_max(); + +/* window size helpers */ +uint16_t egprs_window_size(uint16_t ws_base, uint16_t ws_pdch, uint8_t num_pdch); diff --git a/src/tbf.cpp b/src/tbf.cpp index 8cfca3a..1cdfa6b 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -482,14 +482,6 @@ talloc_free(tbf); } -uint16_t egprs_window_size(const struct gprs_rlcmac_bts *bts_data, uint8_t slots) -{ - uint8_t num_pdch = pcu_bitcount(slots); - - return OSMO_MIN((num_pdch != 1) ? (128 * num_pdch) : 192, - OSMO_MAX(64, (bts_data->ws_base + num_pdch * bts_data->ws_pdch) / 32 * 32)); -} - int gprs_rlcmac_tbf::update() { struct gprs_rlcmac_bts *bts_data = bts->bts_data(); diff --git a/src/tbf.h b/src/tbf.h index 2ed63f9..a5e6651 100644 --- a/src/tbf.h +++ b/src/tbf.h @@ -820,6 +820,4 @@ return NULL; } -uint16_t egprs_window_size(const struct gprs_rlcmac_bts *bts_data, uint8_t slots); - #endif diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp index dc4fa6a..df1f528 100644 --- a/src/tbf_dl.cpp +++ b/src/tbf_dl.cpp @@ -35,6 +35,7 @@ #include <osmocom/core/msgb.h> #include <osmocom/core/talloc.h> #include <osmocom/gprs/gprs_bssgp_bss.h> + #include <mslot_class.h> } #include <errno.h> @@ -1347,7 +1348,7 @@ void gprs_rlcmac_dl_tbf::set_window_size() { - uint16_t ws = egprs_window_size(bts->bts_data(), dl_slots()); + uint16_t ws = egprs_window_size(bts->bts_data()->ws_base, bts->bts_data()->ws_pdch, pcu_bitcount(dl_slots())); LOGPTBFDL(this, LOGL_INFO, "setting EGPRS DL window size to %u, base(%u) slots(%u) ws_pdch(%u)\n", ws, bts->bts_data()->ws_base, pcu_bitcount(dl_slots()), bts->bts_data()->ws_pdch); m_window.set_ws(ws); diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp index 46d4d12..b5fb362 100644 --- a/src/tbf_ul.cpp +++ b/src/tbf_ul.cpp @@ -34,6 +34,7 @@ extern "C" { #include <osmocom/core/msgb.h> #include <osmocom/core/talloc.h> + #include <mslot_class.h> } #include <errno.h> @@ -584,7 +585,7 @@ void gprs_rlcmac_ul_tbf::set_window_size() { - uint16_t ws = egprs_window_size(bts->bts_data(), ul_slots()); + uint16_t ws = egprs_window_size(bts->bts_data()->ws_base, bts->bts_data()->ws_pdch, pcu_bitcount(ul_slots())); LOGPTBFUL(this, LOGL_INFO, "setting EGPRS UL window size to %u, base(%u) slots(%u) ws_pdch(%u)\n", ws, bts->bts_data()->ws_base, pcu_bitcount(ul_slots()), bts->bts_data()->ws_pdch); m_window.set_ws(ws); -- To view, visit https://gerrit.osmocom.org/6241 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie411ea2bbfca442b33405584f15687a7ffcbb53c Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: Max <msuraev at sysmocom.de>