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/967 DTX: move scheduling check inside repeat_last_sid Note: this also require changes to properly link against libosmocodec. Change-Id: I96594cf3aa1013d505bd20069d5bf261d9a2aefb --- M include/osmo-bts/msg_utils.h M src/common/Makefile.am M src/common/msg_utils.c M src/osmo-bts-litecell15/tch.c M src/osmo-bts-sysmo/Makefile.am M src/osmo-bts-sysmo/tch.c M tests/misc/Makefile.am 7 files changed, 64 insertions(+), 79 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/67/967/1 diff --git a/include/osmo-bts/msg_utils.h b/include/osmo-bts/msg_utils.h index 456ff3c..f07623d 100644 --- a/include/osmo-bts/msg_utils.h +++ b/include/osmo-bts/msg_utils.h @@ -6,6 +6,8 @@ #include <osmo-bts/gsm_data.h> +#include <osmocom/codec/codec.h> + #include <stdbool.h> struct msgb; @@ -28,7 +30,5 @@ size_t length, uint32_t fn, int update, uint8_t cmr, int8_t cmi); uint8_t repeat_last_sid(struct gsm_lchan *lchan, uint8_t *dst, uint32_t fn); -bool dtx_amr_sid_optional(const struct gsm_lchan *lchan, uint32_t fn); -bool dtx_sched_optional(struct gsm_lchan *lchan, uint32_t fn); int msg_verify_ipa_structure(struct msgb *msg); int msg_verify_oml_structure(struct msgb *msg); diff --git a/src/common/Makefile.am b/src/common/Makefile.am index fbb6572..856f741 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -1,6 +1,6 @@ AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(OPENBSC_INCDIR) -AM_CFLAGS = -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOTRAU_CFLAGS) -LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOTRAU_LIBS) +AM_CFLAGS = -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOTRAU_CFLAGS) $(LIBOSMOCODEC_CFLAGS) +LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOTRAU_LIBS) $(LIBOSMOCODEC_LIBS) noinst_LIBRARIES = libbts.a libl1sched.a libbts_a_SOURCES = gsm_data_shared.c sysinfo.c logging.c abis.c oml.c bts.c \ diff --git a/src/common/msg_utils.c b/src/common/msg_utils.c index ae2dd28..4b944dc 100644 --- a/src/common/msg_utils.c +++ b/src/common/msg_utils.c @@ -126,32 +126,13 @@ memcpy(lchan->tch.last_sid.buf + amr, l1_payload, copy_len); } -/* repeat last SID if possible, returns SID length + 1 or 0 */ -/*! \brief Repeat last SID if possible in case of DTX - * \param[in] lchan Logical channel on which we check scheduling - * \param[in] dst Buffer to copy last SID into - * \returns Number of bytes copied + 1 (to accommodate for extra byte with - * payload type) or 0 if there's nothing to copy - */ -uint8_t repeat_last_sid(struct gsm_lchan *lchan, uint8_t *dst, uint32_t fn) -{ - if (lchan->tch.last_sid.len) { - memcpy(dst, lchan->tch.last_sid.buf, lchan->tch.last_sid.len); - lchan->tch.last_sid.fn = fn; - return lchan->tch.last_sid.len + 1; - } - LOGP(DL1C, LOGL_NOTICE, "Have to send %s frame on TCH but SID buffer " - "is empty - sent nothing\n", - get_value_string(gsm48_chan_mode_names, lchan->tch_mode)); - return 0; -} - /*! \brief Check if enough time has passed since last SID (if any) to repeat it * \param[in] lchan Logical channel on which we check scheduling * \param[in] fn Frame Number for which we check scheduling * \returns true if transmission can be omitted, false otherwise */ -bool dtx_amr_sid_optional(const struct gsm_lchan *lchan, uint32_t fn) +static inline bool dtx_amr_sid_optional(const struct gsm_lchan *lchan, + uint32_t fn) { /* Compute approx. time delta based on Fn duration */ uint32_t delta = GSM_FN_TO_MS(fn - lchan->tch.last_sid.fn); @@ -183,7 +164,7 @@ * \param[in] fn Frame Number for which we check scheduling * \returns true if transmission can be omitted, false otherwise */ -bool dtx_sched_optional(struct gsm_lchan *lchan, uint32_t fn) +static inline bool dtx_sched_optional(struct gsm_lchan *lchan, uint32_t fn) { /* According to 3GPP TS 45.008 § 8.3: */ static const uint8_t f[] = { 52, 53, 54, 55, 56, 57, 58, 59 }, @@ -198,6 +179,42 @@ return false; } +/* repeat last SID if possible, returns SID length + 1 or 0 */ +/*! \brief Repeat last SID if possible in case of DTX + * \param[in] lchan Logical channel on which we check scheduling + * \param[in] dst Buffer to copy last SID into + * \returns Number of bytes copied + 1 (to accommodate for extra byte with + * payload type), 0 if there's nothing to copy + */ +uint8_t repeat_last_sid(struct gsm_lchan *lchan, uint8_t *dst, uint32_t fn) +{ + /* FIXME: add EFR support */ + if (lchan->tch_mode == GSM48_CMODE_SPEECH_EFR) + return 0; + + if (lchan->tch_mode != GSM48_CMODE_SPEECH_AMR) { + if (dtx_sched_optional(lchan, fn)) + return 0; + } else + if (dtx_amr_sid_optional(lchan, fn)) + return 0; + + if (lchan->tch.last_sid.len) { + memcpy(dst, lchan->tch.last_sid.buf, lchan->tch.last_sid.len); + lchan->tch.last_sid.fn = fn; + return lchan->tch.last_sid.len + 1; + } + + if (lchan->tch_mode == GSM48_CMODE_SPEECH_AMR) + return 1 + osmo_amr_rtp_enc(dst, 0, AMR_NO_DATA, AMR_GOOD); + + LOGP(DL1C, LOGL_DEBUG, "Have to send %s frame on TCH but SID buffer " + "is empty - sent nothing\n", + get_value_string(gsm48_chan_mode_names, lchan->tch_mode)); + + return 0; +} + /** * Return 0 in case the IPA structure is okay and in this * case the l2h will be set to the beginning of the data. diff --git a/src/osmo-bts-litecell15/tch.c b/src/osmo-bts-litecell15/tch.c index fb3dca7..33545c5 100644 --- a/src/osmo-bts-litecell15/tch.c +++ b/src/osmo-bts-litecell15/tch.c @@ -35,7 +35,6 @@ #include <osmocom/core/select.h> #include <osmocom/core/timer.h> #include <osmocom/core/bits.h> -#include <osmocom/codec/codec.h> #include <osmocom/gsm/gsm_utils.h> #include <osmocom/trau/osmo_ortp.h> @@ -451,6 +450,7 @@ GsmL1_MsgUnitParam_t *msu_param; uint8_t *payload_type; uint8_t *l1_payload; + int rc; msg = l1p_msgb_alloc(); if (!msg) @@ -465,43 +465,27 @@ switch (lchan->tch_mode) { case GSM48_CMODE_SPEECH_AMR: *payload_type = GsmL1_TchPlType_Amr; - if (dtx_amr_sid_optional(lchan, fn)) { - msgb_free(msg); - return NULL; - } - msu_param->u8Size = repeat_last_sid(lchan, l1_payload, fn); - if (!msu_param->u8Size) - osmo_amr_rtp_enc(l1_payload, 0, AMR_NO_DATA, AMR_GOOD); break; case GSM48_CMODE_SPEECH_V1: if (lchan->type == GSM_LCHAN_TCH_F) *payload_type = GsmL1_TchPlType_Fr; else *payload_type = GsmL1_TchPlType_Hr; - /* unlike AMR, FR & HR schedued based on absolute FN value */ - if (dtx_sched_optional(lchan, fn)) { - msgb_free(msg); - return NULL; - } - msu_param->u8Size = repeat_last_sid(lchan, l1_payload, fn); - if (!msu_param->u8Size) - return NULL; break; case GSM48_CMODE_SPEECH_EFR: *payload_type = GsmL1_TchPlType_Efr; - if (dtx_sched_optional(lchan, fn)) { - msgb_free(msg); - return NULL; - } - msu_param->u8Size = repeat_last_sid(lchan, l1_payload, fn); - if (!msu_param->u8Size) - return NULL; break; default: msgb_free(msg); - msg = NULL; - break; + return NULL; } + rc = repeat_last_sid(lchan, l1_payload, fn); + if (!rc) { + msgb_free(msg); + return NULL; + } + msu_param->u8Size = rc; + return msg; } diff --git a/src/osmo-bts-sysmo/Makefile.am b/src/osmo-bts-sysmo/Makefile.am index 34f4bb0..8e39a3a 100644 --- a/src/osmo-bts-sysmo/Makefile.am +++ b/src/osmo-bts-sysmo/Makefile.am @@ -29,7 +29,7 @@ misc/sysmobts_mgr_temp.c \ misc/sysmobts_mgr_calib.c \ eeprom.c -sysmobts_mgr_LDADD = $(LIBGPS_LIBS) $(LIBOSMOCORE_LIBS) $(LIBOSMOVTY_LIBS) $(LIBOSMOABIS_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOCTRL_LIBS) $(top_builddir)/src/common/libbts.a +sysmobts_mgr_LDADD = $(LIBGPS_LIBS) $(LIBOSMOCORE_LIBS) $(LIBOSMOVTY_LIBS) $(LIBOSMOABIS_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOCTRL_LIBS) $(top_builddir)/src/common/libbts.a $(COMMON_LDADD) sysmobts_util_SOURCES = misc/sysmobts_util.c misc/sysmobts_par.c eeprom.c sysmobts_util_LDADD = $(LIBOSMOCORE_LIBS) diff --git a/src/osmo-bts-sysmo/tch.c b/src/osmo-bts-sysmo/tch.c index 879ed33..908ec4c 100644 --- a/src/osmo-bts-sysmo/tch.c +++ b/src/osmo-bts-sysmo/tch.c @@ -32,7 +32,6 @@ #include <osmocom/core/select.h> #include <osmocom/core/timer.h> #include <osmocom/core/bits.h> -#include <osmocom/codec/codec.h> #include <osmocom/gsm/gsm_utils.h> #include <osmocom/trau/osmo_ortp.h> @@ -553,6 +552,7 @@ GsmL1_MsgUnitParam_t *msu_param; uint8_t *payload_type; uint8_t *l1_payload; + int rc; msg = l1p_msgb_alloc(); if (!msg) @@ -567,43 +567,27 @@ switch (lchan->tch_mode) { case GSM48_CMODE_SPEECH_AMR: *payload_type = GsmL1_TchPlType_Amr; - if (dtx_amr_sid_optional(lchan, fn)) { - msgb_free(msg); - return NULL; - } - msu_param->u8Size = repeat_last_sid(lchan, l1_payload, fn); - if (!msu_param->u8Size) - osmo_amr_rtp_enc(l1_payload, 0, AMR_NO_DATA, AMR_GOOD); break; case GSM48_CMODE_SPEECH_V1: if (lchan->type == GSM_LCHAN_TCH_F) *payload_type = GsmL1_TchPlType_Fr; else *payload_type = GsmL1_TchPlType_Hr; - /* unlike AMR, FR & HR schedued based on absolute FN value */ - if (dtx_sched_optional(lchan, fn)) { - msgb_free(msg); - return NULL; - } - msu_param->u8Size = repeat_last_sid(lchan, l1_payload, fn); - if (!msu_param->u8Size) - return NULL; break; case GSM48_CMODE_SPEECH_EFR: *payload_type = GsmL1_TchPlType_Efr; - if (dtx_sched_optional(lchan, fn)) { - msgb_free(msg); - return NULL; - } - msu_param->u8Size = repeat_last_sid(lchan, l1_payload, fn); - if (!msu_param->u8Size) - return NULL; break; default: msgb_free(msg); - msg = NULL; - break; + return NULL; } + rc = repeat_last_sid(lchan, l1_payload, fn); + if (!rc) { + msgb_free(msg); + return NULL; + } + msu_param->u8Size = rc; + return msg; } diff --git a/tests/misc/Makefile.am b/tests/misc/Makefile.am index f60325b..d5acb18 100644 --- a/tests/misc/Makefile.am +++ b/tests/misc/Makefile.am @@ -1,6 +1,6 @@ AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(OPENBSC_INCDIR) -AM_CFLAGS = -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) -LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) +AM_CFLAGS = -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOCODEC_CFLAGS) +LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOCODEC_LIBS) noinst_PROGRAMS = misc_test EXTRA_DIST = misc_test.ok -- To view, visit https://gerrit.osmocom.org/967 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I96594cf3aa1013d505bd20069d5bf261d9a2aefb Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max <msuraev at sysmocom.de>