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/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/20860 )
Change subject: Move dl_tbf allocation code to correct file
......................................................................
Move dl_tbf allocation code to correct file
Change-Id: I50d41b1c6f244edcfb78646d0fac4e47c2e3e561
---
M src/tbf.cpp
M src/tbf.h
M src/tbf_dl.cpp
M src/tbf_dl.h
4 files changed, 116 insertions(+), 111 deletions(-)
Approvals:
fixeria: Looks good to me, approved
laforge: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/src/tbf.cpp b/src/tbf.cpp
index b2aad0c..2fbf5bf 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -109,25 +109,6 @@
{ "rlc:nacked", "RLC Nacked " },
};
-static const struct rate_ctr_desc tbf_dl_gprs_ctr_description[] = {
- { "gprs:downlink:cs1", "CS1 " },
- { "gprs:downlink:cs2", "CS2 " },
- { "gprs:downlink:cs3", "CS3 " },
- { "gprs:downlink:cs4", "CS4 " },
-};
-
-static const struct rate_ctr_desc tbf_dl_egprs_ctr_description[] = {
- { "egprs:downlink:mcs1", "MCS1 " },
- { "egprs:downlink:mcs2", "MCS2 " },
- { "egprs:downlink:mcs3", "MCS3 " },
- { "egprs:downlink:mcs4", "MCS4 " },
- { "egprs:downlink:mcs5", "MCS5 " },
- { "egprs:downlink:mcs6", "MCS6 " },
- { "egprs:downlink:mcs7", "MCS7 " },
- { "egprs:downlink:mcs8", "MCS8 " },
- { "egprs:downlink:mcs9", "MCS9 " },
-};
-
const struct rate_ctr_group_desc tbf_ctrg_desc = {
"pcu:tbf",
"TBF Statistics",
@@ -136,22 +117,6 @@
tbf_ctr_description,
};
-static const struct rate_ctr_group_desc tbf_dl_gprs_ctrg_desc = {
- "tbf:gprs",
- "Data Blocks",
- OSMO_STATS_CLASS_SUBSCRIBER,
- ARRAY_SIZE(tbf_dl_gprs_ctr_description),
- tbf_dl_gprs_ctr_description,
-};
-
-static const struct rate_ctr_group_desc tbf_dl_egprs_ctrg_desc = {
- "tbf:egprs",
- "Data Blocks",
- OSMO_STATS_CLASS_SUBSCRIBER,
- ARRAY_SIZE(tbf_dl_egprs_ctr_description),
- tbf_dl_egprs_ctr_description,
-};
-
static void setup_egprs_mode(gprs_rlcmac_bts *bts, GprsMs *ms)
{
if (mcs_is_edge_gmsk(mcs_get_egprs_by_num(bts->max_mcs_ul)) &&
@@ -894,80 +859,6 @@
return 0;
}
-static int dl_tbf_dtor(struct gprs_rlcmac_dl_tbf *tbf)
-{
- tbf->~gprs_rlcmac_dl_tbf();
- return 0;
-}
-
-struct gprs_rlcmac_dl_tbf *tbf_alloc_dl_tbf(struct gprs_rlcmac_bts *bts, GprsMs *ms, int8_t use_trx, bool single_slot)
-{
- struct gprs_rlcmac_dl_tbf *tbf;
- int rc;
-
- OSMO_ASSERT(ms != NULL);
-
- if (ms->egprs_ms_class() == 0 && bts->egprs_enabled) {
- if (ms->ms_class() > 0) {
- LOGP(DTBF, LOGL_NOTICE, "Not accepting non-EGPRS phone in EGPRS-only mode\n");
- bts->bts->do_rate_ctr_inc(CTR_TBF_FAILED_EGPRS_ONLY);
- return NULL;
- }
- ms->set_egprs_ms_class(1);
- }
-
- LOGP(DTBF, LOGL_DEBUG, "********** DL-TBF starts here **********\n");
- LOGP(DTBF, LOGL_INFO, "Allocating DL TBF: MS_CLASS=%d/%d\n",
- ms->ms_class(), ms->egprs_ms_class());
-
- tbf = talloc(tall_pcu_ctx, struct gprs_rlcmac_dl_tbf);
-
- if (!tbf)
- return NULL;
-
- talloc_set_destructor(tbf, dl_tbf_dtor);
- new (tbf) gprs_rlcmac_dl_tbf(bts->bts, ms);
-
- rc = tbf->setup(use_trx, single_slot);
- /* if no resource */
- if (rc < 0) {
- talloc_free(tbf);
- return NULL;
- }
-
- if (tbf->is_egprs_enabled()) {
- tbf->set_window_size();
- tbf->m_dl_egprs_ctrs = rate_ctr_group_alloc(tbf,
- &tbf_dl_egprs_ctrg_desc,
- tbf->m_ctrs->idx);
- if (!tbf->m_dl_egprs_ctrs) {
- LOGPTBF(tbf, LOGL_ERROR, "Couldn't allocate EGPRS DL counters\n");
- talloc_free(tbf);
- return NULL;
- }
- } else {
- tbf->m_dl_gprs_ctrs = rate_ctr_group_alloc(tbf,
- &tbf_dl_gprs_ctrg_desc,
- tbf->m_ctrs->idx);
- if (!tbf->m_dl_gprs_ctrs) {
- LOGPTBF(tbf, LOGL_ERROR, "Couldn't allocate GPRS DL counters\n");
- talloc_free(tbf);
- return NULL;
- }
- }
-
- llist_add(&tbf->list(), &bts->bts->dl_tbfs());
- tbf->bts->do_rate_ctr_inc(CTR_TBF_DL_ALLOCATED);
-
- tbf->m_last_dl_poll_fn = -1;
- tbf->m_last_dl_drained_fn = -1;
-
- osmo_clock_gettime(CLOCK_MONOTONIC, &tbf->m_bw.dl_bw_tv);
- osmo_clock_gettime(CLOCK_MONOTONIC, &tbf->m_bw.dl_loss_tv);
-
- return tbf;
-}
-
static void tbf_timer_cb(void *_tbf)
{
struct gprs_rlcmac_tbf *tbf = (struct gprs_rlcmac_tbf *)_tbf;
diff --git a/src/tbf.h b/src/tbf.h
index 65654ea..08d0d1d 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -348,8 +348,6 @@
mutable char m_name_buf[60];
};
-struct gprs_rlcmac_dl_tbf *tbf_alloc_dl_tbf(struct gprs_rlcmac_bts *bts, GprsMs *ms, int8_t use_trx, bool single_slot);
-
void tbf_free(struct gprs_rlcmac_tbf *tbf);
int tbf_assign_control_ts(struct gprs_rlcmac_tbf *tbf);
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 0d692cc..b41c161 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -43,6 +43,7 @@
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/rate_ctr.h>
+ #include <osmocom/core/stats.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/utils.h>
#include <osmocom/gsm/gsm_utils.h>
@@ -56,6 +57,43 @@
/* After sending these frames, we poll for ack/nack. */
#define POLL_ACK_AFTER_FRAMES 20
+extern void *tall_pcu_ctx;
+
+static const struct rate_ctr_desc tbf_dl_gprs_ctr_description[] = {
+ { "gprs:downlink:cs1", "CS1 " },
+ { "gprs:downlink:cs2", "CS2 " },
+ { "gprs:downlink:cs3", "CS3 " },
+ { "gprs:downlink:cs4", "CS4 " },
+};
+
+static const struct rate_ctr_desc tbf_dl_egprs_ctr_description[] = {
+ { "egprs:downlink:mcs1", "MCS1 " },
+ { "egprs:downlink:mcs2", "MCS2 " },
+ { "egprs:downlink:mcs3", "MCS3 " },
+ { "egprs:downlink:mcs4", "MCS4 " },
+ { "egprs:downlink:mcs5", "MCS5 " },
+ { "egprs:downlink:mcs6", "MCS6 " },
+ { "egprs:downlink:mcs7", "MCS7 " },
+ { "egprs:downlink:mcs8", "MCS8 " },
+ { "egprs:downlink:mcs9", "MCS9 " },
+};
+
+static const struct rate_ctr_group_desc tbf_dl_gprs_ctrg_desc = {
+ "tbf:gprs",
+ "Data Blocks",
+ OSMO_STATS_CLASS_SUBSCRIBER,
+ ARRAY_SIZE(tbf_dl_gprs_ctr_description),
+ tbf_dl_gprs_ctr_description,
+};
+
+static const struct rate_ctr_group_desc tbf_dl_egprs_ctrg_desc = {
+ "tbf:egprs",
+ "Data Blocks",
+ OSMO_STATS_CLASS_SUBSCRIBER,
+ ARRAY_SIZE(tbf_dl_egprs_ctr_description),
+ tbf_dl_egprs_ctr_description,
+};
+
static inline void tbf_update_ms_class(struct gprs_rlcmac_tbf *tbf,
const uint8_t ms_class)
{
@@ -85,6 +123,80 @@
timespecclear(&dl_loss_tv);
}
+static int dl_tbf_dtor(struct gprs_rlcmac_dl_tbf *tbf)
+{
+ tbf->~gprs_rlcmac_dl_tbf();
+ return 0;
+}
+
+struct gprs_rlcmac_dl_tbf *tbf_alloc_dl_tbf(struct gprs_rlcmac_bts *bts, GprsMs *ms, int8_t use_trx, bool single_slot)
+{
+ struct gprs_rlcmac_dl_tbf *tbf;
+ int rc;
+
+ OSMO_ASSERT(ms != NULL);
+
+ if (ms->egprs_ms_class() == 0 && bts->egprs_enabled) {
+ if (ms->ms_class() > 0) {
+ LOGP(DTBF, LOGL_NOTICE, "Not accepting non-EGPRS phone in EGPRS-only mode\n");
+ bts->bts->do_rate_ctr_inc(CTR_TBF_FAILED_EGPRS_ONLY);
+ return NULL;
+ }
+ ms->set_egprs_ms_class(1);
+ }
+
+ LOGP(DTBF, LOGL_DEBUG, "********** DL-TBF starts here **********\n");
+ LOGP(DTBF, LOGL_INFO, "Allocating DL TBF: MS_CLASS=%d/%d\n",
+ ms->ms_class(), ms->egprs_ms_class());
+
+ tbf = talloc(tall_pcu_ctx, struct gprs_rlcmac_dl_tbf);
+
+ if (!tbf)
+ return NULL;
+
+ talloc_set_destructor(tbf, dl_tbf_dtor);
+ new (tbf) gprs_rlcmac_dl_tbf(bts->bts, ms);
+
+ rc = tbf->setup(use_trx, single_slot);
+ /* if no resource */
+ if (rc < 0) {
+ talloc_free(tbf);
+ return NULL;
+ }
+
+ if (tbf->is_egprs_enabled()) {
+ tbf->set_window_size();
+ tbf->m_dl_egprs_ctrs = rate_ctr_group_alloc(tbf,
+ &tbf_dl_egprs_ctrg_desc,
+ tbf->m_ctrs->idx);
+ if (!tbf->m_dl_egprs_ctrs) {
+ LOGPTBF(tbf, LOGL_ERROR, "Couldn't allocate EGPRS DL counters\n");
+ talloc_free(tbf);
+ return NULL;
+ }
+ } else {
+ tbf->m_dl_gprs_ctrs = rate_ctr_group_alloc(tbf,
+ &tbf_dl_gprs_ctrg_desc,
+ tbf->m_ctrs->idx);
+ if (!tbf->m_dl_gprs_ctrs) {
+ LOGPTBF(tbf, LOGL_ERROR, "Couldn't allocate GPRS DL counters\n");
+ talloc_free(tbf);
+ return NULL;
+ }
+ }
+
+ llist_add(&tbf->list(), &bts->bts->dl_tbfs());
+ tbf->bts->do_rate_ctr_inc(CTR_TBF_DL_ALLOCATED);
+
+ tbf->m_last_dl_poll_fn = -1;
+ tbf->m_last_dl_drained_fn = -1;
+
+ osmo_clock_gettime(CLOCK_MONOTONIC, &tbf->m_bw.dl_bw_tv);
+ osmo_clock_gettime(CLOCK_MONOTONIC, &tbf->m_bw.dl_loss_tv);
+
+ return tbf;
+}
+
gprs_rlcmac_dl_tbf::gprs_rlcmac_dl_tbf(BTS *bts_, GprsMs *ms) :
gprs_rlcmac_tbf(bts_, ms, GPRS_RLCMAC_DL_TBF),
m_tx_counter(0),
diff --git a/src/tbf_dl.h b/src/tbf_dl.h
index 9da942f..caa439a 100644
--- a/src/tbf_dl.h
+++ b/src/tbf_dl.h
@@ -149,4 +149,8 @@
else
return NULL;
}
+
+struct gprs_rlcmac_dl_tbf *tbf_alloc_dl_tbf(struct gprs_rlcmac_bts *bts, GprsMs *ms,
+ int8_t use_trx, bool single_slot);
+
#endif
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/20860
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I50d41b1c6f244edcfb78646d0fac4e47c2e3e561
Gerrit-Change-Number: 20860
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201026/b9d9f7a3/attachment.htm>