lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

May 2023

  • 1 participants
  • 2583 discussions
[S] Change in osmocom-bb[master]: trxcon/l1sched: cosmetic: get rid of amr_is_cmr/fn_is_cmi
by fixeria 22 May '23

22 May '23
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/32918 ) Change subject: trxcon/l1sched: cosmetic: get rid of amr_is_cmr/fn_is_cmi ...................................................................... trxcon/l1sched: cosmetic: get rid of amr_is_cmr/fn_is_cmi Change-Id: Ic8df73326befa387daead0a0dcbb8c9a1461021e Related: OS#4396 --- M src/host/trxcon/src/sched_lchan_tchf.c M src/host/trxcon/src/sched_lchan_tchh.c 2 files changed, 25 insertions(+), 18 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/18/32918/1 diff --git a/src/host/trxcon/src/sched_lchan_tchf.c b/src/host/trxcon/src/sched_lchan_tchf.c index 1a00a93..3674bb7 100644 --- a/src/host/trxcon/src/sched_lchan_tchf.c +++ b/src/host/trxcon/src/sched_lchan_tchf.c @@ -66,7 +66,6 @@ size_t l2_len; int amr = 0; uint8_t ft; - bool amr_is_cmr; /* Set up pointers */ mask = &lchan->rx_burst_mask; @@ -122,20 +121,19 @@ 1, 1, &n_errors, &n_bits_total); break; case GSM48_CMODE_SPEECH_AMR: /* AMR */ - /* the first FN 4,13,21 defines that CMI is included in frame, - * the first FN 0,8,17 defines that CMR/CMC is included in frame. - * NOTE: A frame ends 7 FN after start. - */ - amr_is_cmr = !sched_tchf_dl_amr_cmi_map[bi->fn % 26]; - /* we store tch_data + 2 header bytes, the amr variable set to * 2 will allow us to skip the first 2 bytes in case we did * receive an FACCH frame instead of a voice frame (we do not * know this before we actually decode the frame) */ amr = 2; rc = gsm0503_tch_afs_decode_dtx(l2 + amr, buffer, - amr_is_cmr, lchan->amr.codec, lchan->amr.codecs, &lchan->amr.dl_ft, - &lchan->amr.dl_cmr, &n_errors, &n_bits_total, &lchan->amr.last_dtx); + !sched_tchf_dl_amr_cmi_map[bi->fn % 26], + lchan->amr.codec, + lchan->amr.codecs, + &lchan->amr.dl_ft, + &lchan->amr.dl_cmr, + &n_errors, &n_bits_total, + &lchan->amr.last_dtx); /* only good speech frames get rtp header */ if (rc != GSM_MACBLOCK_LEN && rc >= 4) { diff --git a/src/host/trxcon/src/sched_lchan_tchh.c b/src/host/trxcon/src/sched_lchan_tchh.c index 303d59e..04a8bff 100644 --- a/src/host/trxcon/src/sched_lchan_tchh.c +++ b/src/host/trxcon/src/sched_lchan_tchh.c @@ -243,7 +243,6 @@ size_t l2_len; int amr = 0; uint8_t ft; - bool fn_is_cmi; /* Set up pointers */ mask = &lchan->rx_burst_mask; @@ -307,17 +306,17 @@ &n_errors, &n_bits_total); break; case GSM48_CMODE_SPEECH_AMR: /* AMR */ - /* the first FN FN 4,13,21 or 5,14,22 defines that CMI is - * included in frame, the first FN FN 0,8,17 or 1,9,18 defines - * that CMR/CMC is included in frame. */ - fn_is_cmi = sched_tchh_dl_amr_cmi_map[bi->fn % 26]; - /* See comment in function rx_tchf_fn() */ amr = 2; rc = gsm0503_tch_ahs_decode_dtx(l2 + amr, buffer, - !sched_tchh_dl_facch_map[bi->fn % 26], - !fn_is_cmi, lchan->amr.codec, lchan->amr.codecs, &lchan->amr.dl_ft, - &lchan->amr.dl_cmr, &n_errors, &n_bits_total, &lchan->amr.last_dtx); + !sched_tchh_dl_facch_map[bi->fn % 26], + !sched_tchh_dl_amr_cmi_map[bi->fn % 26], + lchan->amr.codec, + lchan->amr.codecs, + &lchan->amr.dl_ft, + &lchan->amr.dl_cmr, + &n_errors, &n_bits_total, + &lchan->amr.last_dtx); /* only good speech frames get rtp header */ if (rc != GSM_MACBLOCK_LEN && rc >= 4) { -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/32918 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Ic8df73326befa387daead0a0dcbb8c9a1461021e Gerrit-Change-Number: 32918 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmocom-bb[master]: trxcon/l1sched: remove redundant TCH/[FH] prim length checks
by fixeria 22 May '23

22 May '23
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/32916 ) Change subject: trxcon/l1sched: remove redundant TCH/[FH] prim length checks ...................................................................... trxcon/l1sched: remove redundant TCH/[FH] prim length checks Both gsm0503_tch_[fh]r_encode() do check the given payload length in order to determine the payload and/or codec type. The same applies to gsm0503_tch_a[fh]s_encode(). There is no real need to implement additional length checks on top of that - drop them. Change-Id: Ib1adf4945fb762bc2a51a1008f6bef6784fb7833 Related: OS#4396 --- M src/host/trxcon/src/sched_lchan_tchf.c M src/host/trxcon/src/sched_lchan_tchh.c 2 files changed, 44 insertions(+), 57 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/16/32916/1 diff --git a/src/host/trxcon/src/sched_lchan_tchf.c b/src/host/trxcon/src/sched_lchan_tchf.c index 326713d..fca2108 100644 --- a/src/host/trxcon/src/sched_lchan_tchf.c +++ b/src/host/trxcon/src/sched_lchan_tchf.c @@ -219,7 +219,6 @@ ubit_t *buffer, *offset; const uint8_t *tsc; uint8_t *mask; - size_t l2_len; int rc; /* Set up pointers */ @@ -238,10 +237,16 @@ memcpy(buffer, buffer + 464, 464); /* populate the buffer with bursts */ - if (msgb_l2len(lchan->prim) == GSM_MACBLOCK_LEN) { - /* Encode payload */ - rc = gsm0503_tch_fr_encode(buffer, msgb_l2(lchan->prim), GSM_MACBLOCK_LEN, 1); - } else if (lchan->tch_mode == GSM48_CMODE_SPEECH_AMR) { + switch (lchan->tch_mode) { + case GSM48_CMODE_SIGN: + case GSM48_CMODE_SPEECH_V1: + case GSM48_CMODE_SPEECH_EFR: + rc = gsm0503_tch_fr_encode(buffer, + msgb_l2(lchan->prim), + msgb_l2len(lchan->prim), 1); + break; + case GSM48_CMODE_SPEECH_AMR: + { int len; uint8_t cmr_codec; int ft, cmr, i; @@ -295,31 +300,11 @@ lchan->amr.codecs, lchan->amr.ul_ft, lchan->amr.ul_cmr); - } else { - /* Determine and check the payload length */ - switch (lchan->tch_mode) { - case GSM48_CMODE_SIGN: - case GSM48_CMODE_SPEECH_V1: /* FR */ - l2_len = GSM_FR_BYTES; - break; - case GSM48_CMODE_SPEECH_EFR: /* EFR */ - l2_len = GSM_EFR_BYTES; - break; - default: - LOGP_LCHAND(lchan, LOGL_ERROR, - "Invalid TCH mode: %u, dropping frame...\n", - lchan->tch_mode); - l1sched_lchan_prim_drop(lchan); - return -EINVAL; - } - if (msgb_l2len(lchan->prim) != l2_len) { - LOGP_LCHAND(lchan, LOGL_ERROR, "Primitive has odd length %u " - "(expected %zu for TCH or %u for FACCH), so dropping...\n", - msgb_l2len(lchan->prim), l2_len, GSM_MACBLOCK_LEN); - l1sched_lchan_prim_drop(lchan); - return -EINVAL; - } - rc = gsm0503_tch_fr_encode(buffer, msgb_l2(lchan->prim), l2_len, 1); + break; + } + default: + LOGP_LCHAND(lchan, LOGL_ERROR, "Invalid TCH mode: %u\n", lchan->tch_mode); + return -EINVAL; } if (rc) { diff --git a/src/host/trxcon/src/sched_lchan_tchh.c b/src/host/trxcon/src/sched_lchan_tchh.c index 34781d3..e3e4cde 100644 --- a/src/host/trxcon/src/sched_lchan_tchh.c +++ b/src/host/trxcon/src/sched_lchan_tchh.c @@ -425,7 +425,6 @@ ubit_t *buffer, *offset; const uint8_t *tsc; uint8_t *mask; - size_t l2_len; int rc; /* Set up pointers */ @@ -459,10 +458,15 @@ } /* populate the buffer with bursts */ - if (msgb_l2len(lchan->prim) == GSM_MACBLOCK_LEN) { - rc = gsm0503_tch_hr_encode(buffer, msgb_l2(lchan->prim), GSM_MACBLOCK_LEN); - lchan->ul_facch_blocks = 6; - } else if (lchan->tch_mode == GSM48_CMODE_SPEECH_AMR) { + switch (lchan->tch_mode) { + case GSM48_CMODE_SIGN: + case GSM48_CMODE_SPEECH_V1: + rc = gsm0503_tch_hr_encode(buffer, + msgb_l2(lchan->prim), + msgb_l2len(lchan->prim)); + break; + case GSM48_CMODE_SPEECH_AMR: + { int len; uint8_t cmr_codec; int ft, cmr, i; @@ -516,28 +520,11 @@ lchan->amr.codecs, lchan->amr.ul_ft, lchan->amr.ul_cmr); - } else { - /* Determine and check the payload length */ - switch (lchan->tch_mode) { - case GSM48_CMODE_SIGN: - case GSM48_CMODE_SPEECH_V1: /* HR */ - l2_len = GSM_HR_BYTES + 1; - break; - default: - LOGP_LCHAND(lchan, LOGL_ERROR, - "Invalid TCH mode: %u, dropping frame...\n", - lchan->tch_mode); - l1sched_lchan_prim_drop(lchan); - return -EINVAL; - } - if (msgb_l2len(lchan->prim) != l2_len) { - LOGP_LCHAND(lchan, LOGL_ERROR, "Primitive has odd length %u " - "(expected %zu for TCH or %u for FACCH), so dropping...\n", - msgb_l2len(lchan->prim), l2_len, GSM_MACBLOCK_LEN); - l1sched_lchan_prim_drop(lchan); - return -EINVAL; - } - rc = gsm0503_tch_hr_encode(buffer, msgb_l2(lchan->prim), l2_len); + break; + } + default: + LOGP_LCHAND(lchan, LOGL_ERROR, "Invalid TCH mode: %u\n", lchan->tch_mode); + return -EINVAL; } if (rc) { -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/32916 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Ib1adf4945fb762bc2a51a1008f6bef6784fb7833 Gerrit-Change-Number: 32916 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmocom-bb[master]: trxcon/l1sched: rework burst buffer shifting for TCH/[FH]
by fixeria 22 May '23

22 May '23
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/32921 ) Change subject: trxcon/l1sched: rework burst buffer shifting for TCH/[FH] ...................................................................... trxcon/l1sched: rework burst buffer shifting for TCH/[FH] This is how the buffer shifting is implemented in osmo-bts-trx. Keep trxcon's l1sched implementation as close to osmo-bts-trx as possible in order to simplify the integration of CSD support. Change-Id: Idb6e415f37f41b8ab92a3864962dac0a40c2fbaa Related: OS#4396 --- M src/host/trxcon/src/sched_lchan_tchf.c M src/host/trxcon/src/sched_lchan_tchh.c 2 files changed, 45 insertions(+), 42 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/21/32921/1 diff --git a/src/host/trxcon/src/sched_lchan_tchf.c b/src/host/trxcon/src/sched_lchan_tchf.c index f38c82a..f749ff4 100644 --- a/src/host/trxcon/src/sched_lchan_tchf.c +++ b/src/host/trxcon/src/sched_lchan_tchf.c @@ -75,9 +75,16 @@ LOGP_LCHAND(lchan, LOGL_DEBUG, "Traffic received: fn=%u bid=%u\n", bi->fn, bi->bid); - /* Align to the first burst of a block */ - if (*mask == 0x00 && bi->bid != 0) - return 0; + if (bi->bid == 0) { + /* Shift the burst buffer by 4 bursts leftwards */ + memcpy(&bursts_p[0], &bursts_p[464], 464); + memset(&bursts_p[464], 0, 464); + *mask = *mask << 4; + } else { + /* Align to the first burst of a block */ + if (*mask == 0x00) + return 0; + } /* Update mask */ *mask |= (1 << bi->bid); @@ -108,9 +115,6 @@ } - /* Keep the mask updated */ - *mask = *mask << 4; - switch (lchan->tch_mode) { case GSM48_CMODE_SIGN: case GSM48_CMODE_SPEECH_V1: /* FR */ @@ -157,9 +161,6 @@ return -EINVAL; } - /* Shift buffer by 4 bursts for interleaving */ - memcpy(bursts_p, bursts_p + 464, 464); - /* Check decoding result */ if (rc < 4) { LOGP_LCHAND(lchan, LOGL_ERROR, @@ -224,16 +225,13 @@ mask = &lchan->tx_burst_mask; bursts_p = lchan->tx_bursts; - /* If we have encoded bursts */ - if (*mask) + /* Send burst, if we already got a frame */ + if (br->bid > 0) goto send_burst; - /* Wait until a first burst in period */ - if (br->bid > 0) - return 0; - - /* Shift buffer by 4 bursts back for interleaving */ - memcpy(bursts_p, bursts_p + 464, 464); + /* Shift the burst buffer by 4 bursts leftwards for interleaving */ + memcpy(&bursts_p[0], &bursts_p[464], 464); + memset(&bursts_p[464], 0, 464); /* populate the buffer with bursts */ switch (lchan->tch_mode) { diff --git a/src/host/trxcon/src/sched_lchan_tchh.c b/src/host/trxcon/src/sched_lchan_tchh.c index e8dc463..9e53e50 100644 --- a/src/host/trxcon/src/sched_lchan_tchh.c +++ b/src/host/trxcon/src/sched_lchan_tchh.c @@ -252,6 +252,14 @@ LOGP_LCHAND(lchan, LOGL_DEBUG, "Traffic received: fn=%u bid=%u\n", bi->fn, bi->bid); + if (bi->bid == 0) { + /* Shift the burst buffer by 2 bursts leftwards */ + memcpy(&bursts_p[0], &bursts_p[232], 232); + memcpy(&bursts_p[232], &bursts_p[464], 232); + memset(&bursts_p[464], 0, 232); + *mask = *mask << 2; + } + if (*mask == 0x00) { /* Align to the first burst */ if (bi->bid > 0) @@ -286,17 +294,17 @@ if (lchan->tch_mode == GSM48_CMODE_SIGN) { /* FACCH/H is interleaved over 6 bursts */ if ((*mask & 0x3f) != 0x3f) - goto bfi_shift; + goto bfi; } else { /* Traffic is interleaved over 4 bursts */ if ((*mask & 0x0f) != 0x0f) - goto bfi_shift; + goto bfi; } /* Skip decoding attempt in case of FACCH/H */ if (lchan->dl_ongoing_facch) { lchan->dl_ongoing_facch = false; - goto bfi_shift; /* 2/2 BFI */ + goto bfi; /* 2/2 BFI */ } switch (lchan->tch_mode) { @@ -340,13 +348,6 @@ return -EINVAL; } - /* Shift buffer by 4 bursts for interleaving */ - memcpy(bursts_p, bursts_p + 232, 232); - memcpy(bursts_p + 232, bursts_p + 464, 232); - - /* Shift burst mask */ - *mask = *mask << 2; - /* Check decoding result */ if (rc < 4) { /* Calculate AVG of the measurements (assuming 4 bursts) */ @@ -384,14 +385,6 @@ return l1sched_lchan_emit_data_ind(lchan, &tch_data[0], tch_data_len, n_errors, n_bits_total, true); -bfi_shift: - /* Shift buffer */ - memcpy(bursts_p, bursts_p + 232, 232); - memcpy(bursts_p + 232, bursts_p + 464, 232); - - /* Shift burst mask */ - *mask = *mask << 2; - bfi: /* Didn't try to decode, fake measurements */ if (n_errors < 0) { @@ -445,17 +438,15 @@ return 0; } - /* Shift buffer by 2 bursts back for interleaving */ - memcpy(bursts_p, bursts_p + 232, 232); - - /* Also shift TX burst mask */ + /* Shift the burst buffer by 2 bursts leftwards for interleaving */ + memcpy(&bursts_p[0], &bursts_p[232], 232); + memcpy(&bursts_p[232], &bursts_p[464], 232); + memset(&bursts_p[464], 0, 232); *mask = *mask << 2; /* If FACCH/H blocks are still pending */ - if (lchan->ul_facch_blocks > 2) { - memcpy(bursts_p + 232, bursts_p + 464, 232); + if (lchan->ul_facch_blocks > 2) goto send_burst; - } /* populate the buffer with bursts */ switch (lchan->tch_mode) { -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/32921 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Idb6e415f37f41b8ab92a3864962dac0a40c2fbaa Gerrit-Change-Number: 32921 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmocom-bb[master]: trxcon/l1sched: use sched_tchh_dl_facch_map[] in rx_tchh_fn()
by fixeria 22 May '23

22 May '23
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/32919 ) Change subject: trxcon/l1sched: use sched_tchh_dl_facch_map[] in rx_tchh_fn() ...................................................................... trxcon/l1sched: use sched_tchh_dl_facch_map[] in rx_tchh_fn() This is a more effecient way to check if FACCH/H is allowed. The mapping was added in a53e93fe9 and is already used for AMR. Change-Id: Ib4b409956326480679a436d28224b539d00779e2 Related: a53e93fe9 "trxcon: Initial support for forwarding AMR" Related: OS#4396 --- M src/host/trxcon/src/sched_lchan_tchh.c 1 file changed, 16 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/19/32919/1 diff --git a/src/host/trxcon/src/sched_lchan_tchh.c b/src/host/trxcon/src/sched_lchan_tchh.c index 04a8bff..acf362e 100644 --- a/src/host/trxcon/src/sched_lchan_tchh.c +++ b/src/host/trxcon/src/sched_lchan_tchh.c @@ -302,8 +302,8 @@ case GSM48_CMODE_SIGN: case GSM48_CMODE_SPEECH_V1: /* HR */ rc = gsm0503_tch_hr_decode(l2, buffer, - !l1sched_tchh_facch_end(lchan->type, bi->fn, 0), - &n_errors, &n_bits_total); + !sched_tchh_dl_facch_map[bi->fn % 26], + &n_errors, &n_bits_total); break; case GSM48_CMODE_SPEECH_AMR: /* AMR */ /* See comment in function rx_tchf_fn() */ -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/32919 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Ib4b409956326480679a436d28224b539d00779e2 Gerrit-Change-Number: 32919 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmocom-bb[master]: trxcon/l1sched: use variable names like in osmo-bts-trx
by fixeria 22 May '23

22 May '23
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/32920 ) Change subject: trxcon/l1sched: use variable names like in osmo-bts-trx ...................................................................... trxcon/l1sched: use variable names like in osmo-bts-trx This way it's easier to keep trxcon in sync with osmo-bts-trx. Change-Id: I8138a45cca4e9063bf7d36ebc920b20b755138dd Related: OS#4396 --- M src/host/trxcon/src/sched_lchan_pdtch.c M src/host/trxcon/src/sched_lchan_tchf.c M src/host/trxcon/src/sched_lchan_tchh.c M src/host/trxcon/src/sched_lchan_xcch.c 4 files changed, 93 insertions(+), 79 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/20/32920/1 diff --git a/src/host/trxcon/src/sched_lchan_pdtch.c b/src/host/trxcon/src/sched_lchan_pdtch.c index 6702d9d..b6c3b4c 100644 --- a/src/host/trxcon/src/sched_lchan_pdtch.c +++ b/src/host/trxcon/src/sched_lchan_pdtch.c @@ -38,12 +38,12 @@ { uint8_t l2[GPRS_L2_MAX_LEN], *mask; int n_errors, n_bits_total, rc; - sbit_t *buffer, *offset; + sbit_t *bursts_p, *burst; size_t l2_len; /* Set up pointers */ mask = &lchan->rx_burst_mask; - buffer = lchan->rx_bursts; + bursts_p = lchan->rx_bursts; LOGP_LCHAND(lchan, LOGL_DEBUG, "Packet data received: fn=%u bid=%u\n", bi->fn, bi->bid); @@ -59,9 +59,9 @@ l1sched_lchan_meas_push(lchan, bi); /* Copy burst to buffer of 4 bursts */ - offset = buffer + bi->bid * 116; - memcpy(offset, bi->burst + 3, 58); - memcpy(offset + 58, bi->burst + 87, 58); + burst = bursts_p + bi->bid * 116; + memcpy(burst, bi->burst + 3, 58); + memcpy(burst + 58, bi->burst + 87, 58); /* Wait until complete set of bursts */ if (bi->bid != 3) @@ -84,7 +84,7 @@ *mask = *mask << 4; /* Attempt to decode */ - rc = gsm0503_pdtch_decode(l2, buffer, + rc = gsm0503_pdtch_decode(l2, bursts_p, NULL, &n_errors, &n_bits_total); if (rc < 0) { LOGP_LCHAND(lchan, LOGL_ERROR, @@ -105,14 +105,14 @@ int tx_pdtch_fn(struct l1sched_lchan_state *lchan, struct l1sched_burst_req *br) { - ubit_t *buffer, *offset; + ubit_t *bursts_p, *burst; const uint8_t *tsc; uint8_t *mask; int rc; /* Set up pointers */ mask = &lchan->tx_burst_mask; - buffer = lchan->tx_bursts; + bursts_p = lchan->tx_bursts; if (br->bid > 0) { /* If we have encoded bursts */ @@ -123,7 +123,7 @@ } /* Encode payload */ - rc = gsm0503_pdtch_encode(buffer, msgb_l2(lchan->prim), msgb_l2len(lchan->prim)); + rc = gsm0503_pdtch_encode(bursts_p, msgb_l2(lchan->prim), msgb_l2len(lchan->prim)); if (rc < 0) { LOGP_LCHAND(lchan, LOGL_ERROR, "Failed to encode L2 payload (len=%u): %s\n", msgb_l2len(lchan->prim), msgb_hexdump_l2(lchan->prim)); @@ -133,7 +133,7 @@ send_burst: /* Determine which burst should be sent */ - offset = buffer + br->bid * 116; + burst = bursts_p + br->bid * 116; /* Update mask */ *mask |= (1 << br->bid); @@ -143,9 +143,9 @@ /* Compose a new burst */ memset(br->burst, 0, 3); /* TB */ - memcpy(br->burst + 3, offset, 58); /* Payload 1/2 */ + memcpy(br->burst + 3, burst, 58); /* Payload 1/2 */ memcpy(br->burst + 61, tsc, 26); /* TSC */ - memcpy(br->burst + 87, offset + 58, 58); /* Payload 2/2 */ + memcpy(br->burst + 87, burst + 58, 58); /* Payload 2/2 */ memset(br->burst + 145, 0, 3); /* TB */ br->burst_len = GSM_NBITS_NB_GMSK_BURST; diff --git a/src/host/trxcon/src/sched_lchan_tchf.c b/src/host/trxcon/src/sched_lchan_tchf.c index 3674bb7..f38c82a 100644 --- a/src/host/trxcon/src/sched_lchan_tchf.c +++ b/src/host/trxcon/src/sched_lchan_tchf.c @@ -61,15 +61,16 @@ const struct l1sched_burst_ind *bi) { int n_errors = -1, n_bits_total = 0, rc; - sbit_t *buffer, *offset; - uint8_t l2[128], *mask; - size_t l2_len; + sbit_t *bursts_p, *burst; + uint8_t tch_data[128]; + size_t tch_data_len; + uint8_t *mask; int amr = 0; uint8_t ft; /* Set up pointers */ mask = &lchan->rx_burst_mask; - buffer = lchan->rx_bursts; + bursts_p = lchan->rx_bursts; LOGP_LCHAND(lchan, LOGL_DEBUG, "Traffic received: fn=%u bid=%u\n", bi->fn, bi->bid); @@ -85,9 +86,9 @@ l1sched_lchan_meas_push(lchan, bi); /* Copy burst to end of buffer of 8 bursts */ - offset = buffer + bi->bid * 116 + 464; - memcpy(offset, bi->burst + 3, 58); - memcpy(offset + 58, bi->burst + 87, 58); + burst = bursts_p + bi->bid * 116 + 464; + memcpy(burst, bi->burst + 3, 58); + memcpy(burst + 58, bi->burst + 87, 58); /* Wait until complete set of bursts */ if (bi->bid != 3) @@ -113,11 +114,11 @@ switch (lchan->tch_mode) { case GSM48_CMODE_SIGN: case GSM48_CMODE_SPEECH_V1: /* FR */ - rc = gsm0503_tch_fr_decode(l2, buffer, + rc = gsm0503_tch_fr_decode(&tch_data[0], bursts_p, 1, 0, &n_errors, &n_bits_total); break; case GSM48_CMODE_SPEECH_EFR: /* EFR */ - rc = gsm0503_tch_fr_decode(l2, buffer, + rc = gsm0503_tch_fr_decode(&tch_data[0], bursts_p, 1, 1, &n_errors, &n_bits_total); break; case GSM48_CMODE_SPEECH_AMR: /* AMR */ @@ -126,7 +127,7 @@ * receive an FACCH frame instead of a voice frame (we do not * know this before we actually decode the frame) */ amr = 2; - rc = gsm0503_tch_afs_decode_dtx(l2 + amr, buffer, + rc = gsm0503_tch_afs_decode_dtx(&tch_data[amr], bursts_p, !sched_tchf_dl_amr_cmi_map[bi->fn % 26], lchan->amr.codec, lchan->amr.codecs, @@ -143,9 +144,9 @@ /* SID frames will always get Frame Type Index 8 (AMR_SID) */ ft = AMR_SID; } - rc = osmo_amr_rtp_enc(l2, - lchan->amr.codec[lchan->amr.dl_cmr], - ft, AMR_GOOD); + rc = osmo_amr_rtp_enc(&tch_data[0], + lchan->amr.codec[lchan->amr.dl_cmr], + ft, AMR_GOOD); if (rc < 0) LOGP_LCHAND(lchan, LOGL_ERROR, "osmo_amr_rtp_enc() returned rc=%d\n", rc); @@ -157,7 +158,7 @@ } /* Shift buffer by 4 bursts for interleaving */ - memcpy(buffer, buffer + 464, 464); + memcpy(bursts_p, bursts_p + 464, 464); /* Check decoding result */ if (rc < 4) { @@ -169,7 +170,7 @@ goto bfi; } else if (rc == GSM_MACBLOCK_LEN) { /* FACCH received, forward it to the higher layers */ - l1sched_lchan_emit_data_ind(lchan, l2 + amr, GSM_MACBLOCK_LEN, + l1sched_lchan_emit_data_ind(lchan, &tch_data[amr], GSM_MACBLOCK_LEN, n_errors, n_bits_total, false); /* Send BFI substituting a stolen TCH frame */ @@ -177,11 +178,11 @@ goto bfi; } else { /* A good TCH frame received */ - l2_len = rc; + tch_data_len = rc; } /* Send a traffic frame to the higher layers */ - return l1sched_lchan_emit_data_ind(lchan, l2, l2_len, + return l1sched_lchan_emit_data_ind(lchan, &tch_data[0], tch_data_len, n_errors, n_bits_total, true); bfi: @@ -204,24 +205,24 @@ } /* Bad frame indication */ - l2_len = l1sched_bad_frame_ind(l2, lchan); + tch_data_len = l1sched_bad_frame_ind(&tch_data[0], lchan); /* Send a BFI frame to the higher layers */ - return l1sched_lchan_emit_data_ind(lchan, l2, l2_len, + return l1sched_lchan_emit_data_ind(lchan, &tch_data[0], tch_data_len, n_errors, n_bits_total, true); } int tx_tchf_fn(struct l1sched_lchan_state *lchan, struct l1sched_burst_req *br) { - ubit_t *buffer, *offset; + ubit_t *bursts_p, *burst; const uint8_t *tsc; uint8_t *mask; int rc; /* Set up pointers */ mask = &lchan->tx_burst_mask; - buffer = lchan->tx_bursts; + bursts_p = lchan->tx_bursts; /* If we have encoded bursts */ if (*mask) @@ -232,14 +233,14 @@ return 0; /* Shift buffer by 4 bursts back for interleaving */ - memcpy(buffer, buffer + 464, 464); + memcpy(bursts_p, bursts_p + 464, 464); /* populate the buffer with bursts */ switch (lchan->tch_mode) { case GSM48_CMODE_SIGN: case GSM48_CMODE_SPEECH_V1: case GSM48_CMODE_SPEECH_EFR: - rc = gsm0503_tch_fr_encode(buffer, + rc = gsm0503_tch_fr_encode(bursts_p, msgb_l2(lchan->prim), msgb_l2len(lchan->prim), 1); break; @@ -290,7 +291,7 @@ } else { lchan->amr.ul_cmr = cmr; } - rc = gsm0503_tch_afs_encode(buffer, + rc = gsm0503_tch_afs_encode(bursts_p, msgb_l2(lchan->prim) + 2, msgb_l2len(lchan->prim) - 2, amr_fn_is_cmr, @@ -317,7 +318,7 @@ send_burst: /* Determine which burst should be sent */ - offset = buffer + br->bid * 116; + burst = bursts_p + br->bid * 116; /* Update mask */ *mask |= (1 << br->bid); @@ -327,9 +328,9 @@ /* Compose a new burst */ memset(br->burst, 0, 3); /* TB */ - memcpy(br->burst + 3, offset, 58); /* Payload 1/2 */ + memcpy(br->burst + 3, burst, 58); /* Payload 1/2 */ memcpy(br->burst + 61, tsc, 26); /* TSC */ - memcpy(br->burst + 87, offset + 58, 58); /* Payload 2/2 */ + memcpy(br->burst + 87, burst + 58, 58); /* Payload 2/2 */ memset(br->burst + 145, 0, 3); /* TB */ br->burst_len = GSM_NBITS_NB_GMSK_BURST; diff --git a/src/host/trxcon/src/sched_lchan_tchh.c b/src/host/trxcon/src/sched_lchan_tchh.c index acf362e..e8dc463 100644 --- a/src/host/trxcon/src/sched_lchan_tchh.c +++ b/src/host/trxcon/src/sched_lchan_tchh.c @@ -238,15 +238,16 @@ const struct l1sched_burst_ind *bi) { int n_errors = -1, n_bits_total = 0, rc; - sbit_t *buffer, *offset; - uint8_t l2[128], *mask; - size_t l2_len; + sbit_t *bursts_p, *burst; + uint8_t tch_data[128]; + size_t tch_data_len; + uint8_t *mask; int amr = 0; uint8_t ft; /* Set up pointers */ mask = &lchan->rx_burst_mask; - buffer = lchan->rx_bursts; + bursts_p = lchan->rx_bursts; LOGP_LCHAND(lchan, LOGL_DEBUG, "Traffic received: fn=%u bid=%u\n", bi->fn, bi->bid); @@ -273,9 +274,9 @@ l1sched_lchan_meas_push(lchan, bi); /* Copy burst to the end of buffer of 6 bursts */ - offset = buffer + bi->bid * 116 + 464; - memcpy(offset, bi->burst + 3, 58); - memcpy(offset + 58, bi->burst + 87, 58); + burst = bursts_p + bi->bid * 116 + 464; + memcpy(burst, bi->burst + 3, 58); + memcpy(burst + 58, bi->burst + 87, 58); /* Wait until the second burst */ if (bi->bid != 1) @@ -301,14 +302,14 @@ switch (lchan->tch_mode) { case GSM48_CMODE_SIGN: case GSM48_CMODE_SPEECH_V1: /* HR */ - rc = gsm0503_tch_hr_decode(l2, buffer, + rc = gsm0503_tch_hr_decode(&tch_data[0], bursts_p, !sched_tchh_dl_facch_map[bi->fn % 26], &n_errors, &n_bits_total); break; case GSM48_CMODE_SPEECH_AMR: /* AMR */ /* See comment in function rx_tchf_fn() */ amr = 2; - rc = gsm0503_tch_ahs_decode_dtx(l2 + amr, buffer, + rc = gsm0503_tch_ahs_decode_dtx(&tch_data[amr], bursts_p, !sched_tchh_dl_facch_map[bi->fn % 26], !sched_tchh_dl_amr_cmi_map[bi->fn % 26], lchan->amr.codec, @@ -326,7 +327,7 @@ /* SID frames will always get Frame Type Index 8 (AMR_SID) */ ft = AMR_SID; } - rc = osmo_amr_rtp_enc(l2, + rc = osmo_amr_rtp_enc(&tch_data[0], lchan->amr.codec[lchan->amr.dl_cmr], ft, AMR_GOOD); if (rc < 0) @@ -340,8 +341,8 @@ } /* Shift buffer by 4 bursts for interleaving */ - memcpy(buffer, buffer + 232, 232); - memcpy(buffer + 232, buffer + 464, 232); + memcpy(bursts_p, bursts_p + 232, 232); + memcpy(bursts_p + 232, bursts_p + 464, 232); /* Shift burst mask */ *mask = *mask << 2; @@ -365,7 +366,7 @@ l1sched_lchan_meas_avg(lchan, 6); /* FACCH/H received, forward to the higher layers */ - l1sched_lchan_emit_data_ind(lchan, l2 + amr, GSM_MACBLOCK_LEN, + l1sched_lchan_emit_data_ind(lchan, &tch_data[amr], GSM_MACBLOCK_LEN, n_errors, n_bits_total, false); /* Send BFI substituting 1/2 stolen TCH frames */ @@ -373,20 +374,20 @@ goto bfi; } else { /* A good TCH frame received */ - l2_len = rc; + tch_data_len = rc; /* Calculate AVG of the measurements (traffic takes 4 bursts) */ l1sched_lchan_meas_avg(lchan, 4); } /* Send a traffic frame to the higher layers */ - return l1sched_lchan_emit_data_ind(lchan, l2, l2_len, + return l1sched_lchan_emit_data_ind(lchan, &tch_data[0], tch_data_len, n_errors, n_bits_total, true); bfi_shift: /* Shift buffer */ - memcpy(buffer, buffer + 232, 232); - memcpy(buffer + 232, buffer + 464, 232); + memcpy(bursts_p, bursts_p + 232, 232); + memcpy(bursts_p + 232, bursts_p + 464, 232); /* Shift burst mask */ *mask = *mask << 2; @@ -411,24 +412,24 @@ } /* Bad frame indication */ - l2_len = l1sched_bad_frame_ind(l2, lchan); + tch_data_len = l1sched_bad_frame_ind(&tch_data[0], lchan); /* Send a BFI frame to the higher layers */ - return l1sched_lchan_emit_data_ind(lchan, l2, l2_len, + return l1sched_lchan_emit_data_ind(lchan, &tch_data[0], tch_data_len, n_errors, n_bits_total, true); } int tx_tchh_fn(struct l1sched_lchan_state *lchan, struct l1sched_burst_req *br) { - ubit_t *buffer, *offset; + ubit_t *bursts_p, *burst; const uint8_t *tsc; uint8_t *mask; int rc; /* Set up pointers */ mask = &lchan->tx_burst_mask; - buffer = lchan->tx_bursts; + bursts_p = lchan->tx_bursts; if (br->bid > 0) { /* Align to the first burst */ @@ -445,14 +446,14 @@ } /* Shift buffer by 2 bursts back for interleaving */ - memcpy(buffer, buffer + 232, 232); + memcpy(bursts_p, bursts_p + 232, 232); /* Also shift TX burst mask */ *mask = *mask << 2; /* If FACCH/H blocks are still pending */ if (lchan->ul_facch_blocks > 2) { - memcpy(buffer + 232, buffer + 464, 232); + memcpy(bursts_p + 232, bursts_p + 464, 232); goto send_burst; } @@ -460,7 +461,7 @@ switch (lchan->tch_mode) { case GSM48_CMODE_SIGN: case GSM48_CMODE_SPEECH_V1: - rc = gsm0503_tch_hr_encode(buffer, + rc = gsm0503_tch_hr_encode(bursts_p, msgb_l2(lchan->prim), msgb_l2len(lchan->prim)); break; @@ -511,7 +512,7 @@ } else { lchan->amr.ul_cmr = cmr; } - rc = gsm0503_tch_ahs_encode(buffer, + rc = gsm0503_tch_ahs_encode(bursts_p, msgb_l2(lchan->prim) + 2, msgb_l2len(lchan->prim) - 2, amr_fn_is_cmr, @@ -538,7 +539,7 @@ send_burst: /* Determine which burst should be sent */ - offset = buffer + br->bid * 116; + burst = bursts_p + br->bid * 116; /* Update mask */ *mask |= (1 << br->bid); @@ -548,9 +549,9 @@ /* Compose a new burst */ memset(br->burst, 0, 3); /* TB */ - memcpy(br->burst + 3, offset, 58); /* Payload 1/2 */ + memcpy(br->burst + 3, burst, 58); /* Payload 1/2 */ memcpy(br->burst + 61, tsc, 26); /* TSC */ - memcpy(br->burst + 87, offset + 58, 58); /* Payload 2/2 */ + memcpy(br->burst + 87, burst + 58, 58); /* Payload 2/2 */ memset(br->burst + 145, 0, 3); /* TB */ br->burst_len = GSM_NBITS_NB_GMSK_BURST; diff --git a/src/host/trxcon/src/sched_lchan_xcch.c b/src/host/trxcon/src/sched_lchan_xcch.c index 0dca098..b246a17 100644 --- a/src/host/trxcon/src/sched_lchan_xcch.c +++ b/src/host/trxcon/src/sched_lchan_xcch.c @@ -38,11 +38,11 @@ { uint8_t l2[GSM_MACBLOCK_LEN], *mask; int n_errors, n_bits_total, rc; - sbit_t *buffer, *offset; + sbit_t *bursts_p, *burst; /* Set up pointers */ mask = &lchan->rx_burst_mask; - buffer = lchan->rx_bursts; + bursts_p = lchan->rx_bursts; LOGP_LCHAND(lchan, LOGL_DEBUG, "Data received: fn=%u bid=%u\n", bi->fn, bi->bid); @@ -58,9 +58,9 @@ l1sched_lchan_meas_push(lchan, bi); /* Copy burst to buffer of 4 bursts */ - offset = buffer + bi->bid * 116; - memcpy(offset, bi->burst + 3, 58); - memcpy(offset + 58, bi->burst + 87, 58); + burst = bursts_p + bi->bid * 116; + memcpy(burst, bi->burst + 3, 58); + memcpy(burst + 58, bi->burst + 87, 58); /* Wait until complete set of bursts */ if (bi->bid != 3) @@ -86,7 +86,7 @@ *mask = *mask << 4; /* Attempt to decode */ - rc = gsm0503_xcch_decode(l2, buffer, &n_errors, &n_bits_total); + rc = gsm0503_xcch_decode(l2, bursts_p, &n_errors, &n_bits_total); if (rc) { LOGP_LCHAND(lchan, LOGL_ERROR, "Received bad frame (rc=%d, ber=%d/%d) at fn=%u\n", @@ -101,14 +101,14 @@ int tx_data_fn(struct l1sched_lchan_state *lchan, struct l1sched_burst_req *br) { - ubit_t *buffer, *offset; + ubit_t *bursts_p, *burst; const uint8_t *tsc; uint8_t *mask; int rc; /* Set up pointers */ mask = &lchan->tx_burst_mask; - buffer = lchan->tx_bursts; + bursts_p = lchan->tx_bursts; if (br->bid > 0) { /* If we have encoded bursts */ @@ -128,7 +128,7 @@ } /* Encode payload */ - rc = gsm0503_xcch_encode(buffer, msgb_l2(lchan->prim)); + rc = gsm0503_xcch_encode(bursts_p, msgb_l2(lchan->prim)); if (rc) { LOGP_LCHAND(lchan, LOGL_ERROR, "Failed to encode L2 payload (len=%u): %s\n", msgb_l2len(lchan->prim), msgb_hexdump_l2(lchan->prim)); @@ -138,7 +138,7 @@ send_burst: /* Determine which burst should be sent */ - offset = buffer + br->bid * 116; + burst = bursts_p + br->bid * 116; /* Update mask */ *mask |= (1 << br->bid); @@ -148,9 +148,9 @@ /* Compose a new burst */ memset(br->burst, 0, 3); /* TB */ - memcpy(br->burst + 3, offset, 58); /* Payload 1/2 */ + memcpy(br->burst + 3, burst, 58); /* Payload 1/2 */ memcpy(br->burst + 61, tsc, 26); /* TSC */ - memcpy(br->burst + 87, offset + 58, 58); /* Payload 2/2 */ + memcpy(br->burst + 87, burst + 58, 58); /* Payload 2/2 */ memset(br->burst + 145, 0, 3); /* TB */ br->burst_len = GSM_NBITS_NB_GMSK_BURST; -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/32920 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I8138a45cca4e9063bf7d36ebc920b20b755138dd Gerrit-Change-Number: 32920 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmocom-bb[master]: trxcon/l1sched: implement CSD scheduling support
by fixeria 22 May '23

22 May '23
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/32922 ) Change subject: trxcon/l1sched: implement CSD scheduling support ...................................................................... trxcon/l1sched: implement CSD scheduling support Change-Id: I0d7389a9a5f7019b9316ab1c0115797ff54a0e41 Related: OS#4396, OS#1572 --- M src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h M src/host/trxcon/src/sched_lchan_common.c M src/host/trxcon/src/sched_lchan_desc.c M src/host/trxcon/src/sched_lchan_pdtch.c M src/host/trxcon/src/sched_lchan_tchf.c M src/host/trxcon/src/sched_lchan_tchh.c M src/host/trxcon/src/sched_lchan_xcch.c 7 files changed, 162 insertions(+), 36 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/22/32922/1 diff --git a/src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h b/src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h index 39aeeb9..f72ee71 100644 --- a/src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h +++ b/src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h @@ -220,9 +220,9 @@ /*! Burst type: GMSK or 8PSK */ enum l1sched_burst_type burst_type; /*! Mask of received bursts */ - uint8_t rx_burst_mask; + uint32_t rx_burst_mask; /*! Mask of transmitted bursts */ - uint8_t tx_burst_mask; + uint32_t tx_burst_mask; /*! Burst buffer for RX */ sbit_t *rx_bursts; /*! Burst buffer for TX */ @@ -409,7 +409,7 @@ /* Shared declarations for lchan handlers */ extern const uint8_t l1sched_nb_training_bits[8][26]; -const char *l1sched_burst_mask2str(const uint8_t *mask, int bits); +const char *l1sched_burst_mask2str(const uint32_t *mask, int bits); size_t l1sched_bad_frame_ind(uint8_t *l2, struct l1sched_lchan_state *lchan); /* Interleaved TCH/H block TDMA frame mapping */ diff --git a/src/host/trxcon/src/sched_lchan_common.c b/src/host/trxcon/src/sched_lchan_common.c index cddc9e5..84763f7 100644 --- a/src/host/trxcon/src/sched_lchan_common.c +++ b/src/host/trxcon/src/sched_lchan_common.c @@ -78,13 +78,12 @@ * Examples: " ****.." (incomplete, 4/6 bursts) * " ****" (complete, all 4 bursts) * "**.***.." (incomplete, 5/8 bursts) */ -const char *l1sched_burst_mask2str(const uint8_t *mask, int bits) +const char *l1sched_burst_mask2str(const uint32_t *mask, int bits) { - /* TODO: CSD is interleaved over 22 bursts, so the mask needs to be extended */ - static char buf[8 + 1]; + static char buf[32 + 1]; char *ptr = buf; - OSMO_ASSERT(bits <= 8 && bits > 0); + OSMO_ASSERT(bits <= 32 && bits > 0); while (--bits >= 0) *(ptr++) = (*mask & (1 << bits)) ? '*' : '.'; diff --git a/src/host/trxcon/src/sched_lchan_desc.c b/src/host/trxcon/src/sched_lchan_desc.c index 3b37c57..5163269 100644 --- a/src/host/trxcon/src/sched_lchan_desc.c +++ b/src/host/trxcon/src/sched_lchan_desc.c @@ -130,7 +130,7 @@ * * The MS shall continuously transmit bursts, even if there is nothing * to send, unless DTX (Discontinuous Transmission) is used. */ - .burst_buf_size = 8 * GSM_NBITS_NB_GMSK_PAYLOAD, + .burst_buf_size = 22 * GSM_NBITS_NB_GMSK_PAYLOAD, .flags = L1SCHED_CH_FLAG_CBTX, .rx_fn = rx_tchf_fn, .tx_fn = tx_tchf_fn, @@ -157,7 +157,7 @@ * * The MS shall continuously transmit bursts, even if there is nothing * to send, unless DTX (Discontinuous Transmission) is used. */ - .burst_buf_size = 6 * GSM_NBITS_NB_GMSK_PAYLOAD, + .burst_buf_size = 22 * GSM_NBITS_NB_GMSK_PAYLOAD, .flags = L1SCHED_CH_FLAG_CBTX, .rx_fn = rx_tchh_fn, .tx_fn = tx_tchh_fn, @@ -169,7 +169,7 @@ .link_id = L1SCHED_CH_LID_DEDIC, /* Same as for L1SCHED_TCHH_0, see above. */ - .burst_buf_size = 6 * GSM_NBITS_NB_GMSK_PAYLOAD, + .burst_buf_size = 22 * GSM_NBITS_NB_GMSK_PAYLOAD, .flags = L1SCHED_CH_FLAG_CBTX, .rx_fn = rx_tchh_fn, .tx_fn = tx_tchh_fn, diff --git a/src/host/trxcon/src/sched_lchan_pdtch.c b/src/host/trxcon/src/sched_lchan_pdtch.c index b6c3b4c..90021e3 100644 --- a/src/host/trxcon/src/sched_lchan_pdtch.c +++ b/src/host/trxcon/src/sched_lchan_pdtch.c @@ -36,10 +36,11 @@ int rx_pdtch_fn(struct l1sched_lchan_state *lchan, const struct l1sched_burst_ind *bi) { - uint8_t l2[GPRS_L2_MAX_LEN], *mask; + uint8_t l2[GPRS_L2_MAX_LEN]; int n_errors, n_bits_total, rc; sbit_t *bursts_p, *burst; size_t l2_len; + uint32_t *mask; /* Set up pointers */ mask = &lchan->rx_burst_mask; @@ -107,7 +108,7 @@ { ubit_t *bursts_p, *burst; const uint8_t *tsc; - uint8_t *mask; + uint32_t *mask; int rc; /* Set up pointers */ diff --git a/src/host/trxcon/src/sched_lchan_tchf.c b/src/host/trxcon/src/sched_lchan_tchf.c index f749ff4..f64ecb7 100644 --- a/src/host/trxcon/src/sched_lchan_tchf.c +++ b/src/host/trxcon/src/sched_lchan_tchf.c @@ -3,7 +3,7 @@ * TDMA scheduler: handlers for DL / UL bursts on logical channels * * (C) 2017-2022 by Vadim Yanitskiy <axilirator(a)gmail.com> - * Contributions by sysmocom - s.f.m.c. GmbH + * (C) 2021-2023 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> * * All Rights Reserved * @@ -28,6 +28,7 @@ #include <osmocom/gsm/protocol/gsm_04_08.h> #include <osmocom/gsm/gsm_utils.h> +#include <osmocom/gsm/gsm0502.h> #include <osmocom/coding/gsm0503_coding.h> #include <osmocom/coding/gsm0503_amr_dtx.h> @@ -36,6 +37,9 @@ #include <osmocom/bb/l1sched/l1sched.h> #include <osmocom/bb/l1sched/logging.h> +/* Burst Payload LENgth (short alias) */ +#define BPLEN GSM_NBITS_NB_GMSK_PAYLOAD + /* 3GPP TS 45.009, table 3.2.1.3-{1,3}: AMR on Downlink TCH/F. * * +---+---+---+---+---+---+---+---+ @@ -64,7 +68,7 @@ sbit_t *bursts_p, *burst; uint8_t tch_data[128]; size_t tch_data_len; - uint8_t *mask; + uint32_t *mask; int amr = 0; uint8_t ft; @@ -77,8 +81,8 @@ if (bi->bid == 0) { /* Shift the burst buffer by 4 bursts leftwards */ - memcpy(&bursts_p[0], &bursts_p[464], 464); - memset(&bursts_p[464], 0, 464); + memmove(&bursts_p[0], &bursts_p[4 * BPLEN], 18 * BPLEN); + memset(&bursts_p[18 * BPLEN], 0, 4 * BPLEN); *mask = *mask << 4; } else { /* Align to the first burst of a block */ @@ -92,8 +96,8 @@ /* Store the measurements */ l1sched_lchan_meas_push(lchan, bi); - /* Copy burst to end of buffer of 8 bursts */ - burst = bursts_p + bi->bid * 116 + 464; + /* Copy burst to end of buffer of 22 bursts */ + burst = bursts_p + (bi->bid + 18) * BPLEN; memcpy(burst, bi->burst + 3, 58); memcpy(burst + 58, bi->burst + 87, 58); @@ -115,6 +119,11 @@ } + /* TCH/F: speech and signalling frames are interleaved over 8 bursts, while + * CSD frames are interleaved over 22 bursts. Unless we're in CSD mode, + * decode only the last 8 bursts to avoid introducing additional delays. */ + bursts_p += (22 - 8) * BPLEN; + switch (lchan->tch_mode) { case GSM48_CMODE_SIGN: case GSM48_CMODE_SPEECH_V1: /* FR */ @@ -156,6 +165,24 @@ "osmo_amr_rtp_enc() returned rc=%d\n", rc); } break; + /* CSD (TCH/F9.6): 12.0 kbit/s radio interface rate */ + case GSM48_CMODE_DATA_12k0: + rc = gsm0503_tch_fr96_decode(&tch_data[0], bursts_p, &n_errors, &n_bits_total); + break; + /* CSD (TCH/F4.8): 6.0 kbit/s radio interface rate */ + case GSM48_CMODE_DATA_6k0: + rc = gsm0503_tch_fr48_decode(&tch_data[0], bursts_p, &n_errors, &n_bits_total); + break; +#if 0 + /* TODO: CSD (TCH/F2.4): 3.6 kbit/s radio interface rate */ + case GSM48_CMODE_DATA_3k6: + rc = gsm0503_tch_fr24_decode(&tch_data[0], bursts_p, &n_errors, &n_bits_total); + break; +#endif + /* CSD (TCH/F14.4): 14.5 kbit/s radio interface rate */ + case GSM48_CMODE_DATA_14k5: + rc = gsm0503_tch_fr144_decode(&tch_data[0], bursts_p, &n_errors, &n_bits_total); + break; default: LOGP_LCHAND(lchan, LOGL_ERROR, "Invalid TCH mode: %u\n", lchan->tch_mode); return -EINVAL; @@ -218,7 +245,7 @@ { ubit_t *bursts_p, *burst; const uint8_t *tsc; - uint8_t *mask; + uint32_t *mask; int rc; /* Set up pointers */ @@ -230,8 +257,8 @@ goto send_burst; /* Shift the burst buffer by 4 bursts leftwards for interleaving */ - memcpy(&bursts_p[0], &bursts_p[464], 464); - memset(&bursts_p[464], 0, 464); + memmove(&bursts_p[0], &bursts_p[4 * BPLEN], 18 * BPLEN); + memset(&bursts_p[18 * BPLEN], 0, 4 * BPLEN); /* populate the buffer with bursts */ switch (lchan->tch_mode) { @@ -299,6 +326,28 @@ lchan->amr.ul_cmr); break; } + /* CSD (TCH/F9.6): 12.0 kbit/s radio interface rate */ + case GSM48_CMODE_DATA_12k0: + OSMO_ASSERT(msgb_l2len(lchan->prim) == OSMO_BYTES_FOR_BITS(4 * 60)); + rc = gsm0503_tch_fr96_encode(bursts_p, msgb_l2(lchan->prim)); + break; + /* CSD (TCH/F4.8): 6.0 kbit/s radio interface rate */ + case GSM48_CMODE_DATA_6k0: + OSMO_ASSERT(msgb_l2len(lchan->prim) == OSMO_BYTES_FOR_BITS(2 * 60)); + rc = gsm0503_tch_fr48_encode(bursts_p, msgb_l2(lchan->prim)); + break; +#if 0 + /* TODO: CSD (TCH/F2.4): 3.6 kbit/s radio interface rate */ + case GSM48_CMODE_DATA_3k6: + OSMO_ASSERT(msgb_l2len(lchan->prim) == OSMO_BYTES_FOR_BITS(2 * 36)); + rc = gsm0503_tch_fr24_encode(bursts_p, msgb_l2(lchan->prim)); + break; +#endif + /* CSD (TCH/F14.4): 14.5 kbit/s radio interface rate */ + case GSM48_CMODE_DATA_14k5: + OSMO_ASSERT(msgb_l2len(lchan->prim) == OSMO_BYTES_FOR_BITS(290)); + rc = gsm0503_tch_fr144_encode(bursts_p, msgb_l2(lchan->prim)); + break; default: LOGP_LCHAND(lchan, LOGL_ERROR, "TCH mode %s is unknown or not supported\n", @@ -316,7 +365,7 @@ send_burst: /* Determine which burst should be sent */ - burst = bursts_p + br->bid * 116; + burst = bursts_p + br->bid * BPLEN; /* Update mask */ *mask |= (1 << br->bid); diff --git a/src/host/trxcon/src/sched_lchan_tchh.c b/src/host/trxcon/src/sched_lchan_tchh.c index 9e53e50..1c4dae4 100644 --- a/src/host/trxcon/src/sched_lchan_tchh.c +++ b/src/host/trxcon/src/sched_lchan_tchh.c @@ -4,7 +4,7 @@ * * (C) 2018-2022 by Vadim Yanitskiy <axilirator(a)gmail.com> * (C) 2018 by Harald Welte <laforge(a)gnumonks.org> - * Contributions by sysmocom - s.f.m.c. GmbH + * (C) 2020-2023 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> * * All Rights Reserved * @@ -31,6 +31,7 @@ #include <osmocom/gsm/protocol/gsm_04_08.h> #include <osmocom/gsm/gsm_utils.h> +#include <osmocom/gsm/gsm0502.h> #include <osmocom/coding/gsm0503_coding.h> #include <osmocom/coding/gsm0503_amr_dtx.h> @@ -39,6 +40,9 @@ #include <osmocom/bb/l1sched/l1sched.h> #include <osmocom/bb/l1sched/logging.h> +/* Burst Payload LENgth (short alias) */ +#define BPLEN GSM_NBITS_NB_GMSK_PAYLOAD + /* 3GPP TS 45.009, table 3.2.1.3-{2,4}: AMR on Downlink TCH/H. * * +---+---+---+---+---+---+ @@ -123,6 +127,41 @@ [7] = 1, /* FACCH/H(1): B2(22,24,1,3,5,7) */ }; +/* 3GPP TS 45.002, table 2 in clause 7: Mapping tables for TCH/H2.4 and TCH/H4.8. + * + * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ + * | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v | + * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ + * + * TCH/H(0): B0(0,2,4,6,8,10,13,15,17,19,21,23,0,2,4,6,8,10,13,15,17,19) + * TCH/H(1): B0(1,3,5,7,9,11,14,16,18,20,22,24,1,3,5,7,9,11,14,16,18,20) + * TCH/H(0): B1(8,10,13,15,17,19,21,23,0,2,4,6,8,10,13,15,17,19,21,23,0,2) + * TCH/H(1): B1(9,11,14,16,18,20,22,24,1,3,5,7,9,11,14,16,18,20,22,24,1,3) + * TCH/H(0): B2(17,19,21,23,0,2,4,6,8,10,13,15,17,19,21,23,0,2,4,6,8,10) + * TCH/H(1): B2(18,20,22,24,1,3,5,7,9,11,14,16,18,20,22,24,1,3,5,7,9,11) + * + * TDMA frame number of burst 'a' % 26 is the table index. + * This mapping is valid for both TCH/H(0) and TCH/H(1). */ +static const uint8_t sched_tchh_ul_csd_map[26] = { + [0] = 1, /* TCH/H(0): B0(0 ... 19) */ + [1] = 1, /* TCH/H(1): B0(1 ... 20) */ + [8] = 1, /* TCH/H(0): B1(8 ... 2) */ + [9] = 1, /* TCH/H(1): B1(9 ... 3) */ + [17] = 1, /* TCH/H(0): B2(17 ... 10) */ + [18] = 1, /* TCH/H(1): B2(18 ... 11) */ +}; + +/* TDMA frame number of burst 'v' % 26 is the table index. + * This mapping is valid for both TCH/H(0) and TCH/H(1). */ +static const uint8_t sched_tchh_dl_csd_map[26] = { + [19] = 1, /* TCH/H(0): B0(0 ... 19) */ + [20] = 1, /* TCH/H(1): B0(1 ... 20) */ + [2] = 1, /* TCH/H(0): B1(8 ... 2) */ + [3] = 1, /* TCH/H(1): B1(9 ... 3) */ + [10] = 1, /* TCH/H(0): B2(17 ... 10) */ + [11] = 1, /* TCH/H(1): B2(18 ... 11) */ +}; + /** * Can a TCH/H block transmission be initiated / finished * on a given frame number and a given channel type? @@ -241,7 +280,7 @@ sbit_t *bursts_p, *burst; uint8_t tch_data[128]; size_t tch_data_len; - uint8_t *mask; + uint32_t *mask; int amr = 0; uint8_t ft; @@ -254,9 +293,8 @@ if (bi->bid == 0) { /* Shift the burst buffer by 2 bursts leftwards */ - memcpy(&bursts_p[0], &bursts_p[232], 232); - memcpy(&bursts_p[232], &bursts_p[464], 232); - memset(&bursts_p[464], 0, 232); + memmove(&bursts_p[0], &bursts_p[2 * BPLEN], 20 * BPLEN); + memset(&bursts_p[20 * BPLEN], 0, 2 * BPLEN); *mask = *mask << 2; } @@ -281,8 +319,8 @@ /* Store the measurements */ l1sched_lchan_meas_push(lchan, bi); - /* Copy burst to the end of buffer of 6 bursts */ - burst = bursts_p + bi->bid * 116 + 464; + /* Copy burst to the end of buffer of 22 bursts */ + burst = bursts_p + (bi->bid + 20) * BPLEN; memcpy(burst, bi->burst + 3, 58); memcpy(burst + 58, bi->burst + 87, 58); @@ -307,6 +345,17 @@ goto bfi; /* 2/2 BFI */ } + /* TCH/H: speech and signalling frames are interleaved over 4 and 6 bursts, + * respectively, while CSD frames are interleaved over 22 bursts. Unless + * we're in CSD mode, decode only the last 6 bursts to avoid introducing + * additional delays. */ + bursts_p += (22 - 6) * BPLEN; + +#if 0 + else if (!sched_tchh_ul_csd_map[bi->fn % 26]) + return 0; /* CSD: skip decoding attempt, need 2 more bursts */ +#endif + switch (lchan->tch_mode) { case GSM48_CMODE_SIGN: case GSM48_CMODE_SPEECH_V1: /* HR */ @@ -343,6 +392,14 @@ "osmo_amr_rtp_enc() returned rc=%d\n", rc); } break; + /* CSD (TCH/H4.8): 6.0 kbit/s radio interface rate */ + case GSM48_CMODE_DATA_6k0: + rc = gsm0503_tch_hr48_decode(&tch_data[0], bursts_p, &n_errors, &n_bits_total); + break; + /* CSD (TCH/H2.4): 3.6 kbit/s radio interface rate */ + case GSM48_CMODE_DATA_3k6: + rc = gsm0503_tch_hr24_decode(&tch_data[0], bursts_p, &n_errors, &n_bits_total); + break; default: LOGP_LCHAND(lchan, LOGL_ERROR, "Invalid TCH mode: %u\n", lchan->tch_mode); return -EINVAL; @@ -417,7 +474,7 @@ { ubit_t *bursts_p, *burst; const uint8_t *tsc; - uint8_t *mask; + uint32_t *mask; int rc; /* Set up pointers */ @@ -439,9 +496,8 @@ } /* Shift the burst buffer by 2 bursts leftwards for interleaving */ - memcpy(&bursts_p[0], &bursts_p[232], 232); - memcpy(&bursts_p[232], &bursts_p[464], 232); - memset(&bursts_p[464], 0, 232); + memmove(&bursts_p[0], &bursts_p[2 * BPLEN], 20 * BPLEN); + memset(&bursts_p[20 * BPLEN], 0, 2 * BPLEN); *mask = *mask << 2; /* If FACCH/H blocks are still pending */ @@ -513,6 +569,16 @@ lchan->amr.ul_cmr); break; } + /* CSD (TCH/H4.8): 6.0 kbit/s radio interface rate */ + case GSM48_CMODE_DATA_6k0: + OSMO_ASSERT(msgb_l2len(lchan->prim) == OSMO_BYTES_FOR_BITS(4 * 60)); + rc = gsm0503_tch_hr48_encode(bursts_p, msgb_l2(lchan->prim)); + break; + /* CSD (TCH/H2.4): 3.6 kbit/s radio interface rate */ + case GSM48_CMODE_DATA_3k6: + OSMO_ASSERT(msgb_l2len(lchan->prim) == OSMO_BYTES_FOR_BITS(2 * 36)); + rc = gsm0503_tch_hr24_encode(bursts_p, msgb_l2(lchan->prim)); + break; default: LOGP_LCHAND(lchan, LOGL_ERROR, "TCH mode %s is unknown or not supported\n", @@ -530,7 +596,7 @@ send_burst: /* Determine which burst should be sent */ - burst = bursts_p + br->bid * 116; + burst = bursts_p + br->bid * BPLEN; /* Update mask */ *mask |= (1 << br->bid); diff --git a/src/host/trxcon/src/sched_lchan_xcch.c b/src/host/trxcon/src/sched_lchan_xcch.c index b246a17..09eac8a 100644 --- a/src/host/trxcon/src/sched_lchan_xcch.c +++ b/src/host/trxcon/src/sched_lchan_xcch.c @@ -36,9 +36,10 @@ int rx_data_fn(struct l1sched_lchan_state *lchan, const struct l1sched_burst_ind *bi) { - uint8_t l2[GSM_MACBLOCK_LEN], *mask; + uint8_t l2[GSM_MACBLOCK_LEN]; int n_errors, n_bits_total, rc; sbit_t *bursts_p, *burst; + uint32_t *mask; /* Set up pointers */ mask = &lchan->rx_burst_mask; @@ -103,7 +104,7 @@ { ubit_t *bursts_p, *burst; const uint8_t *tsc; - uint8_t *mask; + uint32_t *mask; int rc; /* Set up pointers */ -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/32922 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I0d7389a9a5f7019b9316ab1c0115797ff54a0e41 Gerrit-Change-Number: 32922 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmo-hnbgw[master]: drop dead code: cnlink.T_RafC
by Jenkins Builder 22 May '23

22 May '23
Jenkins Builder has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/32911 ) Change subject: drop dead code: cnlink.T_RafC ...................................................................... Patch Set 1: (2 comments) File src/osmo-hnbgw/hnbgw_cn.c: Robot Comment from checkpatch (run ID jenkins-gerrit-lint-7229): https://gerrit.osmocom.org/c/osmo-hnbgw/+/32911/comment/5e28b619_ed6b2bd2 PS1, Line 41: -- this code will soon move to new file cnlink.c -- space prohibited after that '--' (ctx:ExW) Robot Comment from checkpatch (run ID jenkins-gerrit-lint-7229): https://gerrit.osmocom.org/c/osmo-hnbgw/+/32911/comment/d49582eb_689f1dfb PS1, Line 41: -- this code will soon move to new file cnlink.c -- space prohibited before that '--' (ctx:WxE) -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/32911 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I7cacaec631051cf5420202f2f0dd9665a5565b17 Gerrit-Change-Number: 32911 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-Comment-Date: Mon, 22 May 2023 17:03:10 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-hnbgw[master]: vty_go_parent(): remove legacy cruft
by neels 22 May '23

22 May '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/32914 ) Change subject: vty_go_parent(): remove legacy cruft ...................................................................... vty_go_parent(): remove legacy cruft We do not need to restore the parent node on vty_go_parent() anymore, only call the ss7 go-parent callback to trigger actions on vty node exit. Change-Id: Id3ecc53885436294d2217c52130910872dde550e --- M src/osmo-hnbgw/hnbgw_vty.c 1 file changed, 14 insertions(+), 24 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/14/32914/1 diff --git a/src/osmo-hnbgw/hnbgw_vty.c b/src/osmo-hnbgw/hnbgw_vty.c index 2952913..47db695 100644 --- a/src/osmo-hnbgw/hnbgw_vty.c +++ b/src/osmo-hnbgw/hnbgw_vty.c @@ -104,30 +104,7 @@ int hnbgw_vty_go_parent(struct vty *vty) { - switch (vty->node) { - case IUH_NODE: - case IUCS_NODE: - case IUPS_NODE: - vty->node = HNBGW_NODE; - vty->index = NULL; - break; - case MGCP_NODE: - vty->node = HNBGW_NODE; - vty->index = NULL; - break; - case HNBGW_NODE: - vty->node = CONFIG_NODE; - vty->index = NULL; - break; - case CONFIG_NODE: - vty->node = ENABLE_NODE; - vty->index = NULL; - break; - default: - osmo_ss7_vty_go_parent(vty); - break; - } - + osmo_ss7_vty_go_parent(vty); return vty->node; } -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/32914 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: Id3ecc53885436294d2217c52130910872dde550e Gerrit-Change-Number: 32914 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmo-hnbgw[master]: immediately SCCP RLSD on HNB re-register
by neels 22 May '23

22 May '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/32915 ) Change subject: immediately SCCP RLSD on HNB re-register ...................................................................... immediately SCCP RLSD on HNB re-register The RUA side may disconnect a) gracefully (Disconnect with RANAP IU Release Complete) or b) by detecting that the HNB is gone / has restarted For a), the SCCP side waits for a RLSD from the CN that follows the IU Release Complete. For b), we so far also wait for a RLSD from CN, which will never come, and only after a timeout send an SCCP RLSD to the CN. Instead, for b), immediately send an SCCP RLSD. To distinguish between the graceful release (a) and the disruptive release (b), add new state MAP_RUA_ST_DISRUPTED on the RUA side, and add new event MAP_SCCP_EV_RAN_LINK_LOST for the SCCP side. Any non-graceful disconnect of RUA enters ST_DISRUPTED. disrupted_onenter() dispatches EV_RAN_LINK_LOST to SCCP, and SCCP directly sends RLSD to the CN without timeout. These changes are also shown in doc/charts/hnbgw_context_map.msc. Change-Id: I4e78617ad39bb73fe92097c8a1a8069da6a7f6a1 --- M doc/charts/hnbgw_context_map.msc M include/osmocom/hnbgw/context_map.h M src/osmo-hnbgw/context_map_rua.c M src/osmo-hnbgw/context_map_sccp.c 4 files changed, 95 insertions(+), 15 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/15/32915/1 diff --git a/doc/charts/hnbgw_context_map.msc b/doc/charts/hnbgw_context_map.msc index 7a4da55..d287d89 100644 --- a/doc/charts/hnbgw_context_map.msc +++ b/doc/charts/hnbgw_context_map.msc @@ -65,7 +65,7 @@ sccp abox sccp [label="MAP_SCCP_ST_DISCONNECTED"]; rua <= sccp [label="MAP_RUA_EV_CN_DISC"]; hnb <= rua [label="RUA Disconnect"]; - rua abox rua [label="MAP_RUA_ST_DISCONNECTED"]; + rua abox rua [label="MAP_RUA_ST_DISRUPTED"]; rua rbox sccp [label="map_check_released()"]; rua rbox sccp [label="hnbgw_context_map_free()"]; @@ -81,10 +81,10 @@ --- [label="Ungraceful release from HNB"]; hnb -x rua [label="link loss"]; rua rbox rua [label="MAP_RUA_EV_HNB_LINK_LOST"]; - rua => sccp [label="MAP_SCCP_EV_RAN_DISC"]; + rua abox rua [label="MAP_RUA_ST_DISRUPTED"]; + rua => sccp [label="MAP_SCCP_EV_RAN_LINK_LOST"]; sccp => cn [label="SCCP Released"]; sccp abox sccp [label="MAP_SCCP_ST_DISCONNECTED"]; - rua abox rua [label="MAP_RUA_ST_DISCONNECTED"]; rua rbox sccp [label="map_check_released()"]; rua rbox sccp [label="hnbgw_context_map_free()"]; @@ -98,10 +98,8 @@ rua rbox rua [label="MAP_RUA_EV_HNB_LINK_LOST"]; hnb <= rua [label="RUA Disconnect"]; hnb note rua [label="TODO: does it make sense to send\nRUA Disconnect per context when HNB is/was gone?\nOr has the HNB implicitly discarded these?"]; - rua abox rua [label="MAP_RUA_ST_DISCONNECTED"]; - rua => sccp [label="MAP_SCCP_EV_RAN_DISC\nfrom map_rua_disconnected_onenter()"]; - sccp abox sccp [label="MAP_SCCP_ST_WAIT_RLSD"]; - rua => sccp [label="MAP_SCCP_EV_RAN_DISC\nto skip waiting for SCCP Released from CN"]; + rua abox rua [label="MAP_RUA_ST_DISRUPTED"]; + rua => sccp [label="MAP_SCCP_EV_RAN_LINK_LOST\nfrom map_rua_disrupted_onenter()"]; sccp => cn [label="SCCP Released"]; sccp abox sccp [label="MAP_SCCP_ST_DISCONNECTED"]; rua rbox sccp [label="map_check_released()"]; diff --git a/include/osmocom/hnbgw/context_map.h b/include/osmocom/hnbgw/context_map.h index a2e76c3..9320ce0 100644 --- a/include/osmocom/hnbgw/context_map.h +++ b/include/osmocom/hnbgw/context_map.h @@ -51,6 +51,8 @@ * CN should have received an Iu-ReleaseComplete with or before this, give CN a chance to send an SCCP RLSD; * after a timeout we will send a non-standard RLSD to the CN instead. */ MAP_SCCP_EV_RAN_DISC, + /* The RAN released ungracefully. We will directly disconnect the SCCP connection, too. */ + MAP_SCCP_EV_RAN_LINK_LOST, /* Receiving an SCCP RLSD from CN, or libosmo-sigtran tells us about SCCP connection timeout. All done. */ MAP_SCCP_EV_RX_RELEASED, }; diff --git a/src/osmo-hnbgw/context_map_rua.c b/src/osmo-hnbgw/context_map_rua.c index f50f711..9e8f028 100644 --- a/src/osmo-hnbgw/context_map_rua.c +++ b/src/osmo-hnbgw/context_map_rua.c @@ -41,6 +41,7 @@ MAP_RUA_ST_INIT, MAP_RUA_ST_CONNECTED, MAP_RUA_ST_DISCONNECTED, + MAP_RUA_ST_DISRUPTED, }; static const struct value_string map_rua_fsm_event_names[] = { @@ -58,6 +59,7 @@ static const struct osmo_tdef_state_timeout map_rua_fsm_timeouts[32] = { [MAP_RUA_ST_INIT] = { .T = -31 }, [MAP_RUA_ST_DISCONNECTED] = { .T = -31 }, + [MAP_RUA_ST_DISRUPTED] = { .T = -31 }, }; /* Transition to a state, using the T timer defined in map_rua_fsm_timeouts. @@ -93,6 +95,7 @@ return MAP_S_ACTIVE; default: case MAP_RUA_ST_DISCONNECTED: + case MAP_RUA_ST_DISRUPTED: return MAP_S_DISCONNECTING; } } @@ -103,6 +106,7 @@ return false; switch (map->rua_fi->state) { case MAP_RUA_ST_DISCONNECTED: + case MAP_RUA_ST_DISRUPTED: return false; default: return true; @@ -114,10 +118,11 @@ /* Return 1 to terminate FSM instance, 0 to keep running */ switch (fi->state) { default: - map_rua_fsm_state_chg(MAP_RUA_ST_DISCONNECTED); + map_rua_fsm_state_chg(MAP_RUA_ST_DISRUPTED); return 0; case MAP_RUA_ST_DISCONNECTED: + case MAP_RUA_ST_DISRUPTED: return 1; } } @@ -210,8 +215,6 @@ return; case MAP_RUA_EV_RX_DISCONNECT: - case MAP_RUA_EV_CN_DISC: - case MAP_RUA_EV_HNB_LINK_LOST: /* Unlikely that SCCP is active, but let the SCCP FSM decide about that. */ handle_rx_rua(fi, ranap_msg); /* There is a reason to shut down this RUA connection. Super unlikely, we haven't even processed the @@ -220,6 +223,11 @@ map_rua_fsm_state_chg(MAP_RUA_ST_DISCONNECTED); break; + case MAP_RUA_EV_CN_DISC: + case MAP_RUA_EV_HNB_LINK_LOST: + map_rua_fsm_state_chg(MAP_RUA_ST_DISRUPTED); + break; + default: OSMO_ASSERT(false); } @@ -276,14 +284,14 @@ case MAP_RUA_EV_HNB_LINK_LOST: /* The HNB is gone. Cannot gracefully cleanup the RUA connection, just be gone. */ - map_rua_fsm_state_chg(MAP_RUA_ST_DISCONNECTED); + map_rua_fsm_state_chg(MAP_RUA_ST_DISRUPTED); return; case MAP_RUA_EV_CN_DISC: /* There is a disruptive reason to shut down this RUA connection, HNB is still there */ OSMO_ASSERT(data == NULL); map_rua_tx_disconnect(fi); - map_rua_fsm_state_chg(MAP_RUA_ST_DISCONNECTED); + map_rua_fsm_state_chg(MAP_RUA_ST_DISRUPTED); return; default: @@ -291,23 +299,35 @@ } } -static void map_rua_disconnected_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state) +static void map_rua_free_if_done(struct hnbgw_context_map *map, uint32_t sccp_event) { - struct hnbgw_context_map *map = fi->priv; /* From RUA's POV, we can now free the hnbgw_context_map. * If SCCP is still active, tell it to disconnect -- in that case the SCCP side will call context_map_free(). * If SCCP is no longer active, free this map. */ if (map_sccp_is_active(map)) - map_sccp_dispatch(map, MAP_SCCP_EV_RAN_DISC, NULL); + map_sccp_dispatch(map, sccp_event, NULL); else context_map_free(map); } +static void map_rua_disconnected_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state) +{ + struct hnbgw_context_map *map = fi->priv; + map_rua_free_if_done(map, MAP_SCCP_EV_RAN_DISC); +} + static void map_rua_disconnected_action(struct osmo_fsm_inst *fi, uint32_t event, void *data) { struct msgb *ranap_msg = data; if (msg_has_l2_data(ranap_msg)) LOGPFSML(fi, LOGL_ERROR, "RUA not connected, cannot dispatch RANAP message\n"); + /* Ignore all events. */ +} + +static void map_rua_disrupted_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state) +{ + struct hnbgw_context_map *map = fi->priv; + map_rua_free_if_done(map, MAP_SCCP_EV_RAN_LINK_LOST); } void map_rua_fsm_cleanup(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause) @@ -331,6 +351,7 @@ | S(MAP_RUA_ST_INIT) | S(MAP_RUA_ST_CONNECTED) | S(MAP_RUA_ST_DISCONNECTED) + | S(MAP_RUA_ST_DISRUPTED) , .action = map_rua_init_action, }, @@ -345,6 +366,7 @@ , .out_state_mask = 0 | S(MAP_RUA_ST_DISCONNECTED) + | S(MAP_RUA_ST_DISRUPTED) , .action = map_rua_connected_action, }, @@ -357,6 +379,16 @@ .onenter = map_rua_disconnected_onenter, .action = map_rua_disconnected_action, }, + [MAP_RUA_ST_DISRUPTED] = { + .name = "disrupted", + .in_event_mask = 0 + | S(MAP_RUA_EV_CN_DISC) + | S(MAP_RUA_EV_HNB_LINK_LOST) + , + .onenter = map_rua_disrupted_onenter, + /* same as MAP_RUA_ST_DISCONNECTED: */ + .action = map_rua_disconnected_action, + }, }; static struct osmo_fsm map_rua_fsm = { diff --git a/src/osmo-hnbgw/context_map_sccp.c b/src/osmo-hnbgw/context_map_sccp.c index 132d03e..3de8215 100644 --- a/src/osmo-hnbgw/context_map_sccp.c +++ b/src/osmo-hnbgw/context_map_sccp.c @@ -52,6 +52,7 @@ OSMO_VALUE_STRING(MAP_SCCP_EV_RX_DATA_INDICATION), OSMO_VALUE_STRING(MAP_SCCP_EV_TX_DATA_REQUEST), OSMO_VALUE_STRING(MAP_SCCP_EV_RAN_DISC), + OSMO_VALUE_STRING(MAP_SCCP_EV_RAN_LINK_LOST), OSMO_VALUE_STRING(MAP_SCCP_EV_RX_RELEASED), {} }; @@ -262,6 +263,7 @@ map_sccp_fsm_state_chg(MAP_SCCP_ST_WAIT_CC); return; + case MAP_SCCP_EV_RAN_LINK_LOST: case MAP_SCCP_EV_RAN_DISC: /* No CR has been sent yet, just go to disconnected state. */ if (msg_has_l2_data(ranap_msg)) @@ -297,6 +299,7 @@ LOGPFSML(fi, LOGL_ERROR, "Connection not yet confirmed, cannot forward RANAP to CN\n"); return; + case MAP_SCCP_EV_RAN_LINK_LOST: case MAP_SCCP_EV_RAN_DISC: /* RUA connection was terminated. First wait for the CC before releasing the SCCP conn. */ if (msg_has_l2_data(ranap_msg)) @@ -351,6 +354,16 @@ tx_sccp_df1(fi, ranap_msg); return; + case MAP_SCCP_EV_RAN_LINK_LOST: + /* RUA has disconnected ungracefully, so there is no Iu Release that told the CN to disconnect. + * Disconnect on the SCCP layer, ungracefully. */ + /* There won't be any ranap_msg, but if a caller wants to dispatch a msg, forward it before + * disconnecting. */ + tx_sccp_df1(fi, ranap_msg); + tx_sccp_rlsd(fi); + map_sccp_fsm_state_chg(MAP_SCCP_ST_DISCONNECTED); + return; + case MAP_SCCP_EV_RX_RELEASED: /* The CN sends an N-Disconnect (SCCP Released) out of the usual sequence. Not what we expected, but * handle it. */ @@ -480,6 +493,7 @@ .in_event_mask = 0 | S(MAP_SCCP_EV_TX_DATA_REQUEST) | S(MAP_SCCP_EV_RAN_DISC) + | S(MAP_SCCP_EV_RAN_LINK_LOST) | S(MAP_SCCP_EV_RX_RELEASED) , .out_state_mask = 0 @@ -495,6 +509,7 @@ | S(MAP_SCCP_EV_RX_CONNECTION_CONFIRM) | S(MAP_SCCP_EV_TX_DATA_REQUEST) | S(MAP_SCCP_EV_RAN_DISC) + | S(MAP_SCCP_EV_RAN_LINK_LOST) | S(MAP_SCCP_EV_RX_RELEASED) , .out_state_mask = 0 @@ -509,6 +524,7 @@ | S(MAP_SCCP_EV_RX_DATA_INDICATION) | S(MAP_SCCP_EV_TX_DATA_REQUEST) | S(MAP_SCCP_EV_RAN_DISC) + | S(MAP_SCCP_EV_RAN_LINK_LOST) | S(MAP_SCCP_EV_RX_RELEASED) | S(MAP_SCCP_EV_RX_CONNECTION_CONFIRM) , @@ -526,6 +542,7 @@ | S(MAP_SCCP_EV_RX_DATA_INDICATION) | S(MAP_SCCP_EV_TX_DATA_REQUEST) | S(MAP_SCCP_EV_RAN_DISC) + | S(MAP_SCCP_EV_RAN_LINK_LOST) | S(MAP_SCCP_EV_RX_CONNECTION_CONFIRM) , .out_state_mask = 0 @@ -539,6 +556,7 @@ .in_event_mask = 0 | S(MAP_SCCP_EV_TX_DATA_REQUEST) | S(MAP_SCCP_EV_RAN_DISC) + | S(MAP_SCCP_EV_RAN_LINK_LOST) , .onenter = map_sccp_disconnected_onenter, .action = map_sccp_disconnected_action, -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/32915 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I4e78617ad39bb73fe92097c8a1a8069da6a7f6a1 Gerrit-Change-Number: 32915 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmo-hnbgw[master]: remove obsolete context_map_check_released() call
by neels 22 May '23

22 May '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/32912 ) Change subject: remove obsolete context_map_check_released() call ...................................................................... remove obsolete context_map_check_released() call When in map_rua_fsm_cleanup(), we are always already deallocating the context map, i.e. neither RUA nor SCCP are active anymore. No need to call context_map_check_released() again. Change-Id: I4bf9a9de7861296ec38c3a37de0254ad9a41ef1b --- M src/osmo-hnbgw/context_map_rua.c 1 file changed, 13 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/12/32912/1 diff --git a/src/osmo-hnbgw/context_map_rua.c b/src/osmo-hnbgw/context_map_rua.c index bc012f3..5a715c4 100644 --- a/src/osmo-hnbgw/context_map_rua.c +++ b/src/osmo-hnbgw/context_map_rua.c @@ -314,7 +314,6 @@ { struct hnbgw_context_map *map = fi->priv; map->rua_fi = NULL; - context_map_check_released(map); } #define S(x) (1 << (x)) -- To view, visit https://gerrit.osmocom.org/c/osmo-hnbgw/+/32912 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-hnbgw Gerrit-Branch: master Gerrit-Change-Id: I4bf9a9de7861296ec38c3a37de0254ad9a41ef1b Gerrit-Change-Number: 32912 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • ...
  • 259
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.