aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/bts.cpp1
-rw-r--r--src/bts.h3
-rw-r--r--src/pcu_vty.c8
-rw-r--r--src/tbf.cpp14
-rw-r--r--tests/tbf/TbfTest.cpp34
-rw-r--r--tests/tbf/TbfTest.err2
-rw-r--r--tests/tbf/TbfTest.ok2
7 files changed, 59 insertions, 5 deletions
diff --git a/src/bts.cpp b/src/bts.cpp
index eb079186..1c10596c 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -57,6 +57,7 @@ static const struct rate_ctr_desc bts_ctr_description[] = {
{ "tbf.reused", "TBF Reused "},
{ "tbf.alloc.algo-a", "TBF Alloc Algo A "},
{ "tbf.alloc.algo-b", "TBF Alloc Algo B "},
+ { "tbf.failed.egprs-only", "TBF Failed EGPRS-only"},
{ "rlc.sent", "RLC Sent "},
{ "rlc.resent", "RLC Resent "},
{ "rlc.restarted", "RLC Restarted "},
diff --git a/src/bts.h b/src/bts.h
index 52154cb2..e467c1ed 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -215,6 +215,7 @@ public:
CTR_TBF_REUSED,
CTR_TBF_ALLOC_ALGO_A,
CTR_TBF_ALLOC_ALGO_B,
+ CTR_TBF_FAILED_EGPRS_ONLY,
CTR_RLC_SENT,
CTR_RLC_RESENT,
CTR_RLC_RESTARTED,
@@ -288,6 +289,7 @@ public:
void tbf_reused();
void tbf_alloc_algo_a();
void tbf_alloc_algo_b();
+ void tbf_failed_egprs_only();
void rlc_sent();
void rlc_resent();
void rlc_restarted();
@@ -425,6 +427,7 @@ CREATE_COUNT_INLINE(tbf_ul_freed, CTR_TBF_UL_FREED)
CREATE_COUNT_INLINE(tbf_reused, CTR_TBF_REUSED)
CREATE_COUNT_INLINE(tbf_alloc_algo_a, CTR_TBF_ALLOC_ALGO_A)
CREATE_COUNT_INLINE(tbf_alloc_algo_b, CTR_TBF_ALLOC_ALGO_B)
+CREATE_COUNT_INLINE(tbf_failed_egprs_only, CTR_TBF_FAILED_EGPRS_ONLY)
CREATE_COUNT_INLINE(rlc_sent, CTR_RLC_SENT)
CREATE_COUNT_INLINE(rlc_resent, CTR_RLC_RESENT)
CREATE_COUNT_INLINE(rlc_restarted, CTR_RLC_RESTARTED)
diff --git a/src/pcu_vty.c b/src/pcu_vty.c
index fe3009b1..97be4c72 100644
--- a/src/pcu_vty.c
+++ b/src/pcu_vty.c
@@ -55,9 +55,7 @@ static int config_write_pcu(struct vty *vty)
vty_out(vty, "pcu%s", VTY_NEWLINE);
if (bts->egprs_enabled)
- vty_out(vty, " egprs%s", VTY_NEWLINE);
- else
- vty_out(vty, " no egprs%s", VTY_NEWLINE);
+ vty_out(vty, " egprs only%s", VTY_NEWLINE);
vty_out(vty, " flow-control-interval %d%s", bts->fc_interval,
VTY_NEWLINE);
@@ -171,8 +169,8 @@ DEFUN(cfg_pcu,
DEFUN(cfg_pcu_egprs,
cfg_pcu_egprs_cmd,
- "egprs",
- EGPRS_STR)
+ "egprs only",
+ EGPRS_STR "Use EGPRS and disable plain GPRS\n")
{
struct gprs_rlcmac_bts *bts = bts_main_data();
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 1f0576af..db63a08d 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -609,6 +609,13 @@ struct gprs_rlcmac_ul_tbf *tbf_alloc_ul_tbf(struct gprs_rlcmac_bts *bts,
struct gprs_rlcmac_ul_tbf *tbf;
int rc;
+ if (egprs_ms_class == 0 && bts->egprs_enabled) {
+ LOGP(DRLCMAC, LOGL_NOTICE,
+ "Not accepting non-EGPRS phone in EGPRS-only mode\n");
+ bts->bts->tbf_failed_egprs_only();
+ return NULL;
+ }
+
LOGP(DRLCMAC, LOGL_DEBUG, "********** TBF starts here **********\n");
LOGP(DRLCMAC, LOGL_INFO, "Allocating %s TBF: MS_CLASS=%d/%d\n",
"UL", ms_class, egprs_ms_class);
@@ -679,6 +686,13 @@ struct gprs_rlcmac_dl_tbf *tbf_alloc_dl_tbf(struct gprs_rlcmac_bts *bts,
struct gprs_rlcmac_dl_tbf *tbf;
int rc;
+ if (egprs_ms_class == 0 && bts->egprs_enabled) {
+ LOGP(DRLCMAC, LOGL_NOTICE,
+ "Not accepting non-EGPRS phone in EGPRS-only mode\n");
+ bts->bts->tbf_failed_egprs_only();
+ return NULL;
+ }
+
LOGP(DRLCMAC, LOGL_DEBUG, "********** TBF starts here **********\n");
LOGP(DRLCMAC, LOGL_INFO, "Allocating %s TBF: MS_CLASS=%d/%d\n",
"DL", ms_class, egprs_ms_class);
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp
index f9431f60..895ba8e5 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -1071,6 +1071,39 @@ static void test_tbf_dl_reuse()
printf("=== end %s ===\n", __func__);
}
+static void test_tbf_gprs_egprs()
+{
+ BTS the_bts;
+ gprs_rlcmac_bts *bts;
+ uint8_t ts_no = 4;
+ uint8_t ms_class = 45;
+ int rc = 0;
+ uint32_t tlli = 0xc0006789;
+ const char *imsi = "001001123456789";
+ unsigned delay_csec = 1000;
+
+ uint8_t buf[256] = {0};
+
+ printf("=== start %s ===\n", __func__);
+
+ bts = the_bts.bts_data();
+ setup_bts(&the_bts, ts_no);
+
+ /* EGPRS-only */
+ bts->egprs_enabled = 1;
+
+ gprs_bssgp_create_and_connect(bts, 33001, 0, 33001,
+ 1234, 1234, 1234, 1, 1, 0, 0, 0);
+
+ /* Does not support EGPRS */
+ rc = gprs_rlcmac_dl_tbf::handle(bts, tlli, 0, imsi, ms_class, 0,
+ delay_csec, buf, sizeof(buf));
+
+ OSMO_ASSERT(rc == -EBUSY);
+ printf("=== end %s ===\n", __func__);
+
+ gprs_bssgp_destroy();
+}
static const struct log_info_cat default_categories[] = {
{"DCSN1", "\033[1;31m", "Concrete Syntax Notation One (CSN1)", LOGL_INFO, 0},
@@ -1129,6 +1162,7 @@ int main(int argc, char **argv)
test_tbf_dl_flow_and_rach_two_phase();
test_tbf_dl_flow_and_rach_single_phase();
test_tbf_dl_reuse();
+ test_tbf_gprs_egprs();
if (getenv("TALLOC_REPORT_FULL"))
talloc_report_full(tall_pcu_ctx, stderr);
diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err
index 7b36b310..0ca4b829 100644
--- a/tests/tbf/TbfTest.err
+++ b/tests/tbf/TbfTest.err
@@ -3039,3 +3039,5 @@ TBF(TFI=1 TLLI=0xf1223344 DIR=DL STATE=FINISHED) starting timer 3191.
TBF(TFI=1 TLLI=0xf1223344 DIR=DL STATE=FINISHED) Scheduled Ack/Nack polling on FN=2654461, TS=7
msg block (BSN 10, CS-1): 0f 03 14 4d 43 20 50 41 43 4b 45 54 20 30 39 20 28 54 42 46 20 32 29
Sending data request: trx=0 ts=7 sapi=5 arfcn=0 fn=2654448 block=1 data=08 03 14 4d 43 20 50 41 43 4b 45 54 20 30 39 20 28 54 42 46 20 32 29
+Not accepting non-EGPRS phone in EGPRS-only mode
+No PDCH resource
diff --git a/tests/tbf/TbfTest.ok b/tests/tbf/TbfTest.ok
index 916ea52b..c4bc8705 100644
--- a/tests/tbf/TbfTest.ok
+++ b/tests/tbf/TbfTest.ok
@@ -26,3 +26,5 @@
=== end test_tbf_dl_flow_and_rach_single_phase ===
=== start test_tbf_dl_reuse ===
=== end test_tbf_dl_reuse ===
+=== start test_tbf_gprs_egprs ===
+=== end test_tbf_gprs_egprs ===