Change in osmocom-bb[master]: trxcon/scheduler: pass lchan to sched_bad_frame_ind()

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/.

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Wed Aug 15 02:46:03 UTC 2018


Vadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/10456


Change subject: trxcon/scheduler: pass lchan to sched_bad_frame_ind()
......................................................................

trxcon/scheduler: pass lchan to sched_bad_frame_ind()

Instead of passing the information about a logical channel, it
makes sense to pass the pointer to its state where everything
is stored. This approach would allow to avoid adding more
arguments every time, e.g. in case of AMR.

Change-Id: I91fe86fef43aac68776a58c9acc37ef2a9ee8042
---
M src/host/trxcon/sched_lchan_common.c
M src/host/trxcon/sched_lchan_tchf.c
M src/host/trxcon/sched_prim.c
M src/host/trxcon/sched_trx.h
4 files changed, 10 insertions(+), 14 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/56/10456/1

diff --git a/src/host/trxcon/sched_lchan_common.c b/src/host/trxcon/sched_lchan_common.c
index 47b0162..03cdc67 100644
--- a/src/host/trxcon/sched_lchan_common.c
+++ b/src/host/trxcon/sched_lchan_common.c
@@ -139,17 +139,17 @@
  * Composes a bad frame indication message
  * according to the current tch_mode.
  *
- * @param  l2       Pointer to allocated byte array
- * @param  tch_mode Current TCH mode
+ * @param  l2       Caller-allocated byte array
+ * @param  lchan    Logical channel to generate BFI for
  * @return          How much bytes were written
  */
-size_t sched_bad_frame_ind(uint8_t *l2, uint8_t rsl_cmode, uint8_t tch_mode)
+size_t sched_bad_frame_ind(uint8_t *l2, struct trx_lchan_state *lchan)
 {
 	/* BFI is only required for speech */
-	if (rsl_cmode != RSL_CMOD_SPD_SPEECH)
+	if (lchan->rsl_cmode != RSL_CMOD_SPD_SPEECH)
 		return 0;
 
-	switch (tch_mode) {
+	switch (lchan->tch_mode) {
 	case GSM48_CMODE_SIGN:
 	case GSM48_CMODE_SPEECH_V1: /* Full Rate */
 		memset(l2, 0x00, GSM_FR_BYTES);
@@ -163,7 +163,7 @@
 		/* FIXME: AMR is not implemented yet */
 		return 0;
 	default:
-		LOGP(DSCH, LOGL_ERROR, "Invalid TCH mode: %u\n", tch_mode);
+		LOGP(DSCH, LOGL_ERROR, "Invalid TCH mode: %u\n", lchan->tch_mode);
 		return 0;
 	}
 }
diff --git a/src/host/trxcon/sched_lchan_tchf.c b/src/host/trxcon/sched_lchan_tchf.c
index e20b461..86cdb12 100644
--- a/src/host/trxcon/sched_lchan_tchf.c
+++ b/src/host/trxcon/sched_lchan_tchf.c
@@ -166,7 +166,7 @@
 
 bfi:
 	/* Bad frame indication */
-	l2_len = sched_bad_frame_ind(l2, rsl_cmode, tch_mode);
+	l2_len = sched_bad_frame_ind(l2, lchan);
 
 	/* Didn't try to decode */
 	if (n_errors < 0)
diff --git a/src/host/trxcon/sched_prim.c b/src/host/trxcon/sched_prim.c
index acd08bf..2aeaa5d 100644
--- a/src/host/trxcon/sched_prim.c
+++ b/src/host/trxcon/sched_prim.c
@@ -373,12 +373,8 @@
 	 * other channels: LAPDm fill frame.
 	 */
 	if (CHAN_IS_TCH(chan) && TCH_MODE_IS_SPEECH(tch_mode)) {
-		/**
-		 * Silence frame indication
-		 * HACK: use actual rsl_cmode!
-		 */
-		prim_len = sched_bad_frame_ind(prim_buffer,
-			RSL_CMOD_SPD_SPEECH, tch_mode);
+		/* Bad frame indication */
+		prim_len = sched_bad_frame_ind(prim_buffer, lchan);
 	} else if (CHAN_IS_TCH(chan) && TCH_MODE_IS_DATA(tch_mode)) {
 		/* FIXME: should we do anything for CSD? */
 		return 0;
diff --git a/src/host/trxcon/sched_trx.h b/src/host/trxcon/sched_trx.h
index f3fa9df..2aafbf0 100644
--- a/src/host/trxcon/sched_trx.h
+++ b/src/host/trxcon/sched_trx.h
@@ -317,7 +317,7 @@
 /* Shared declarations for lchan handlers */
 extern const uint8_t sched_nb_training_bits[8][26];
 
-size_t sched_bad_frame_ind(uint8_t *l2, uint8_t rsl_cmode, uint8_t tch_mode);
+size_t sched_bad_frame_ind(uint8_t *l2, struct trx_lchan_state *lchan);
 int sched_send_dt_ind(struct trx_instance *trx, struct trx_ts *ts,
 	struct trx_lchan_state *lchan, uint8_t *l2, size_t l2_len,
 	int bit_error_count, bool dec_failed, bool traffic);

-- 
To view, visit https://gerrit.osmocom.org/10456
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I91fe86fef43aac68776a58c9acc37ef2a9ee8042
Gerrit-Change-Number: 10456
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180815/9200fd8a/attachment.htm>


More information about the gerrit-log mailing list