diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2022-08-11 18:03:52 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2022-08-11 23:04:46 +0200 |
commit | 755546028ee8dd76eb567d04cf35fcc7950acca7 (patch) | |
tree | 776238bbf08133e1641522303752b944fe143061 | |
parent | fff806bc923093c471a305002a47d2aa9efaca96 (diff) |
Move lchan_dl_tch_queue_enqueue to lchan.c and make it public
It will be used too by osmux code present in another file. This is a
preparation commit to simplify the one adding osmux support.
Change-Id: Ie7fa57bb04db9ad9b03971467e12ee7b8e4c190a
-rw-r--r-- | include/osmo-bts/lchan.h | 2 | ||||
-rw-r--r-- | src/common/l1sap.c | 13 | ||||
-rw-r--r-- | src/common/lchan.c | 13 |
3 files changed, 15 insertions, 13 deletions
diff --git a/include/osmo-bts/lchan.h b/include/osmo-bts/lchan.h index 64b7efa1..484fccc8 100644 --- a/include/osmo-bts/lchan.h +++ b/include/osmo-bts/lchan.h @@ -360,6 +360,8 @@ int lchan_rtp_socket_create(struct gsm_lchan *lchan, const char *bind_ip); int lchan_rtp_socket_connect(struct gsm_lchan *lchan, const struct in_addr *ia, uint16_t connect_port); void lchan_rtp_socket_free(struct gsm_lchan *lchan); +void lchan_dl_tch_queue_enqueue(struct gsm_lchan *lchan, struct msgb *msg, unsigned int limit); + static inline bool lchan_is_dcch(const struct gsm_lchan *lchan) { switch (lchan->type) { diff --git a/src/common/l1sap.c b/src/common/l1sap.c index 640ff577..acb2683d 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -152,19 +152,6 @@ static uint32_t fn_ms_adj(uint32_t fn, const struct gsm_lchan *lchan) return GSM_RTP_DURATION; } -/*! limit number of queue entries to %u; drops any surplus messages */ -static void lchan_dl_tch_queue_enqueue(struct gsm_lchan *lchan, struct msgb *msg, unsigned int limit) -{ - if (lchan->dl_tch_queue_len > limit) - LOGPLCHAN(lchan, DL1P, LOGL_NOTICE, "freeing %d queued frames\n", - lchan->dl_tch_queue_len - limit); - while (lchan->dl_tch_queue_len > limit) { - struct msgb *tmp = msgb_dequeue_count(&lchan->dl_tch_queue, &lchan->dl_tch_queue_len); - msgb_free(tmp); - } - msgb_enqueue_count(&lchan->dl_tch_queue, msg, &lchan->dl_tch_queue_len); -} - /* allocate a msgb containing a osmo_phsap_prim + optional l2 data * in order to wrap femtobts header around l2 data, there must be enough space * in front and behind data pointer */ diff --git a/src/common/lchan.c b/src/common/lchan.c index c7d8d452..c521f262 100644 --- a/src/common/lchan.c +++ b/src/common/lchan.c @@ -641,3 +641,16 @@ void lchan_rtp_socket_free(struct gsm_lchan *lchan) msgb_queue_free(&lchan->dl_tch_queue); lchan->dl_tch_queue_len = 0; } + +/*! limit number of queue entries to %u; drops any surplus messages */ +void lchan_dl_tch_queue_enqueue(struct gsm_lchan *lchan, struct msgb *msg, unsigned int limit) +{ + if (lchan->dl_tch_queue_len > limit) + LOGPLCHAN(lchan, DL1P, LOGL_NOTICE, "freeing %d queued frames\n", + lchan->dl_tch_queue_len - limit); + while (lchan->dl_tch_queue_len > limit) { + struct msgb *tmp = msgb_dequeue_count(&lchan->dl_tch_queue, &lchan->dl_tch_queue_len); + msgb_free(tmp); + } + msgb_enqueue_count(&lchan->dl_tch_queue, msg, &lchan->dl_tch_queue_len); +} |