aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2023-07-12 00:15:13 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2023-07-13 03:42:29 +0700
commitf3a63758d1c41ded71d4911e1e927d0f95f099d8 (patch)
treedb787456d0ecf59e9b68b76205af74c91a83bd43 /src
parent34077236f2676432f0f1a0c9b451c67fa7801509 (diff)
osmo-bts-trx: pull the AMR header in tch_dl_dequeue()
The goal is to unify encoding functions in tx_tch[fh]_fn(), so that in a follow-up change adding CSD we could use a switch statement. Change-Id: I15318e497b236128f779769e4fa99f307ea431ea Related: OS#1572
Diffstat (limited to 'src')
-rw-r--r--src/osmo-bts-trx/sched_lchan_tchf.c16
-rw-r--r--src/osmo-bts-trx/sched_lchan_tchh.c13
2 files changed, 17 insertions, 12 deletions
diff --git a/src/osmo-bts-trx/sched_lchan_tchf.c b/src/osmo-bts-trx/sched_lchan_tchf.c
index b8f83229..444cda2a 100644
--- a/src/osmo-bts-trx/sched_lchan_tchf.c
+++ b/src/osmo-bts-trx/sched_lchan_tchf.c
@@ -402,6 +402,9 @@ struct msgb *tch_dl_dequeue(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br
LOGL1SB(DL1P, LOGL_NOTICE, l1ts, br, "Transmitting 'bad AMR frame'\n");
goto free_bad_msg;
}
+ /* pull the AMR header, it's not being sent over Um */
+ msg_tch->l2h += sizeof(struct amr_hdr);
+ len -= sizeof(struct amr_hdr);
break;
default:
inval_mode2:
@@ -490,12 +493,13 @@ int tx_tchf_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br)
/* the first FN 4,13,21 defines that CMI is included in frame,
* the first FN 0,8,17 defines that CMR is included in frame.
*/
- gsm0503_tch_afs_encode(bursts_p, msg->l2h + sizeof(struct amr_hdr),
- msgb_l2len(msg) - sizeof(struct amr_hdr),
- !sched_tchf_dl_amr_cmi_map[br->fn % 26],
- chan_state->codec, chan_state->codecs,
- chan_state->dl_ft,
- chan_state->dl_cmr);
+ gsm0503_tch_afs_encode(bursts_p,
+ msgb_l2(msg), msgb_l2len(msg),
+ !sched_tchf_dl_amr_cmi_map[br->fn % 26],
+ chan_state->codec,
+ chan_state->codecs,
+ chan_state->dl_ft,
+ chan_state->dl_cmr);
} else {
gsm0503_tch_fr_encode(bursts_p, msg->l2h, msgb_l2len(msg), 1);
}
diff --git a/src/osmo-bts-trx/sched_lchan_tchh.c b/src/osmo-bts-trx/sched_lchan_tchh.c
index 97b85820..541feab8 100644
--- a/src/osmo-bts-trx/sched_lchan_tchh.c
+++ b/src/osmo-bts-trx/sched_lchan_tchh.c
@@ -412,12 +412,13 @@ int tx_tchh_fn(struct l1sched_ts *l1ts, struct trx_dl_burst_req *br)
/* the first FN 4,13,21 or 5,14,22 defines that CMI is included
* in frame, the first FN 0,8,17 or 1,9,18 defines that CMR is
* included in frame. */
- gsm0503_tch_ahs_encode(bursts_p, msg->l2h + sizeof(struct amr_hdr),
- msgb_l2len(msg) - sizeof(struct amr_hdr),
- !sched_tchh_dl_amr_cmi_map[br->fn % 26],
- chan_state->codec, chan_state->codecs,
- chan_state->dl_ft,
- chan_state->dl_cmr);
+ gsm0503_tch_ahs_encode(bursts_p,
+ msgb_l2(msg), msgb_l2len(msg),
+ !sched_tchh_dl_amr_cmi_map[br->fn % 26],
+ chan_state->codec,
+ chan_state->codecs,
+ chan_state->dl_ft,
+ chan_state->dl_cmr);
} else {
gsm0503_tch_hr_encode(bursts_p, msg->l2h, msgb_l2len(msg));
}