aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2021-04-29 19:58:52 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2021-05-27 17:06:21 +0200
commitd508143dd37cb604d9000cf073de0ac9a8fe883a (patch)
tree948779d31dc296b7cc0c5997d3ca25ddab0e45df /tests
parent025d27a31945e935a90065735a48d84938df714a (diff)
AMR config cleanup step 3: generate AMR LV on msg composition
Firstly, do not store the encoded AMR length-value bits in gsm_lchan->* before an activation/modify has actually succeeded. And secondly, do not store the AMR LV structure in struct gsm_lchan at all, but only generate the TLV exactly when a message is being composed. In gsm48_multirate_config(), generate the LV directly to a msgb instead of a static buffer first. gsm0408_test.c expected output verifies that the generated LV bytes remain unchanged. In lchan_mr_config(), introduce a target mr_conf argument, so that Chan Act and Mode Modify may generate the filtered AMR config to different locations (lchan->{activate,modify}.mr_conf_filtered). Only after receiving an ACK for Activate/Modify, set lchan->current_mr_conf from lchan->{activate,modify}.mr_conf_filtered. Use the properly scoped lchan->activate.mr_conf_filtered for Chan Act, lchan->modify.mr_conf_filtered for Mode Modify and new_lchan->current_mr_conf for Handover Command as appropriate. Related: SYS#5315 OS#4940 OS#3787 OS#3833 Change-Id: Ie57f9d0e3912632903d9740291225bfd1634ed47
Diffstat (limited to 'tests')
-rw-r--r--tests/gsm0408/gsm0408_test.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/tests/gsm0408/gsm0408_test.c b/tests/gsm0408/gsm0408_test.c
index 8220c4fc5..a1aa5f494 100644
--- a/tests/gsm0408/gsm0408_test.c
+++ b/tests/gsm0408/gsm0408_test.c
@@ -780,10 +780,10 @@ static void test_gsm48_ra_id_by_bts()
static void test_gsm48_multirate_config()
{
- uint8_t lv[7];
struct gsm48_multi_rate_conf *gsm48_ie;
struct amr_multirate_conf mr;
int rc;
+ struct msgb *msg = msgb_alloc(32, "test_gsm48_multirate_config");
memset(&mr, 0, sizeof(mr));
@@ -807,17 +807,19 @@ static void test_gsm48_multirate_config()
mr.ms_mode[1].mode = 4;
mr.ms_mode[2].mode = 5;
mr.ms_mode[3].mode = 7;
- rc = gsm48_multirate_config(lv, gsm48_ie, mr.ms_mode, 4);
+ msgb_trim(msg, 0);
+ rc = gsm48_multirate_config(msg, gsm48_ie, mr.ms_mode, 4);
OSMO_ASSERT(rc == 0);
printf("gsm48_multirate_config(): rc=%i, lv=%s\n", rc,
- osmo_hexdump_nospc(lv, 1 + lv[0]));
+ osmo_hexdump_nospc(msg->data, msg->len));
/* Test #2: 4 active set members, but wrong mode order: */
mr.ms_mode[3].mode = 2;
mr.ms_mode[2].mode = 4;
mr.ms_mode[1].mode = 5;
mr.ms_mode[0].mode = 7;
- rc = gsm48_multirate_config(lv, gsm48_ie, mr.ms_mode, 4);
+ msgb_trim(msg, 0);
+ rc = gsm48_multirate_config(msg, gsm48_ie, mr.ms_mode, 4);
OSMO_ASSERT(rc == -EINVAL);
/* Test #3: Normal configuration with 3 active set members */
@@ -829,16 +831,18 @@ static void test_gsm48_multirate_config()
mr.ms_mode[2].threshold = 0;
mr.ms_mode[2].hysteresis = 0;
- rc = gsm48_multirate_config(lv, gsm48_ie, mr.ms_mode, 4);
+ msgb_trim(msg, 0);
+ rc = gsm48_multirate_config(msg, gsm48_ie, mr.ms_mode, 3);
OSMO_ASSERT(rc == 0);
printf("gsm48_multirate_config(): rc=%i, lv=%s\n", rc,
- osmo_hexdump_nospc(lv, 1 + lv[0]));
+ osmo_hexdump_nospc(msg->data, msg->len));
/* Test #4: 3 active set members, but wrong mode order: */
mr.ms_mode[0].mode = 2;
mr.ms_mode[2].mode = 4;
mr.ms_mode[1].mode = 5;
- rc = gsm48_multirate_config(lv, gsm48_ie, mr.ms_mode, 4);
+ msgb_trim(msg, 0);
+ rc = gsm48_multirate_config(msg, gsm48_ie, mr.ms_mode, 3);
OSMO_ASSERT(rc == -EINVAL);
/* Test #5: Normal configuration with 2 active set members */
@@ -850,15 +854,17 @@ static void test_gsm48_multirate_config()
mr.ms_mode[1].threshold = 0;
mr.ms_mode[1].hysteresis = 0;
- rc = gsm48_multirate_config(lv, gsm48_ie, mr.ms_mode, 4);
+ msgb_trim(msg, 0);
+ rc = gsm48_multirate_config(msg, gsm48_ie, mr.ms_mode, 2);
OSMO_ASSERT(rc == 0);
printf("gsm48_multirate_config(): rc=%i, lv=%s\n", rc,
- osmo_hexdump_nospc(lv, 1 + lv[0]));
+ osmo_hexdump_nospc(msg->data, msg->len));
/* Test #6: 2 active set members, but wrong mode order: */
mr.ms_mode[1].mode = 2;
mr.ms_mode[0].mode = 4;
- rc = gsm48_multirate_config(lv, gsm48_ie, mr.ms_mode, 4);
+ msgb_trim(msg, 0);
+ rc = gsm48_multirate_config(msg, gsm48_ie, mr.ms_mode, 2);
OSMO_ASSERT(rc == -EINVAL);
/* Test #7: Normal configuration with 1 active set member */
@@ -870,15 +876,19 @@ static void test_gsm48_multirate_config()
mr.ms_mode[0].threshold = 0;
mr.ms_mode[0].hysteresis = 0;
- rc = gsm48_multirate_config(lv, gsm48_ie, mr.ms_mode, 4);
+ msgb_trim(msg, 0);
+ rc = gsm48_multirate_config(msg, gsm48_ie, mr.ms_mode, 1);
OSMO_ASSERT(rc == 0);
printf("gsm48_multirate_config(): rc=%i, lv=%s\n", rc,
- osmo_hexdump_nospc(lv, 1 + lv[0]));
+ osmo_hexdump_nospc(msg->data, msg->len));
/* Test #8: 0 active set members: */
mr.ms_mode[0].mode = 0;
- rc = gsm48_multirate_config(lv, gsm48_ie, mr.ms_mode, 4);
+ msgb_trim(msg, 0);
+ rc = gsm48_multirate_config(msg, gsm48_ie, mr.ms_mode, 1);
OSMO_ASSERT(rc == -EINVAL);
+
+ msgb_free(msg);
}
static const struct log_info_cat log_categories[] = {