Timur Davydov has uploaded this change for review.

View Change

trx: factor out TRXD data submission helper

Extract TRXD data sending into trx_data_submit_msg() and
reuse it from trx_if_send_burst()

This separates transport-specific I/O from message construction
and prepares for alternative backends

No functional changes intended

Change-Id: Ie89ac6efe2f5af0b4cbe5a259a18770b8d2de859
---
M src/osmo-bts-trx/trx_if.c
1 file changed, 19 insertions(+), 10 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/97/42697/1
diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c
index f2e568c..9844b98 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -1155,6 +1155,23 @@
* write call-back even if we don't care about it */
}

+static int trx_data_submit_msg(struct trx_l1h *l1h, struct msgb *msg)
+{
+ int rc;
+
+ rc = osmo_iofd_write_msgb(l1h->trx_data_iofd, msg);
+ if (OSMO_UNLIKELY(rc < 0)) {
+ char errbuf[256];
+ strerror_r(errno, errbuf, sizeof(errbuf));
+ LOGPPHI(l1h->phy_inst, DTRX, LOGL_ERROR,
+ "osmo_iofd_write_msgb() failed on TRXD with rc=%d (%s)\n",
+ rc, errbuf);
+ msgb_free(msg);
+ }
+
+ return rc;
+}
+
/*! Send burst data for given FN/timeslot to TRX
* \param[inout] l1h TRX Layer1 handle referring to TX
* \param[in] br Downlink burst request structure
@@ -1164,7 +1181,6 @@
uint8_t pdu_ver = l1h->config.trxd_pdu_ver_use;
struct msgb *sndbuf = NULL;
uint8_t *buf = NULL;
- int rc;

/* Make sure that the PHY is powered on */
if (OSMO_UNLIKELY(!trx_if_powered(l1h))) {
@@ -1239,15 +1255,8 @@
if (pdu_ver >= 2)
sndbuf->l2h[1] &= ~(1 << 7);

- rc = osmo_iofd_write_msgb(l1h->trx_data_iofd, sndbuf);
- if (OSMO_UNLIKELY(rc < 0)) {
- char errbuf[256];
- strerror_r(errno, errbuf, sizeof(errbuf));
- LOGPPHI(l1h->phy_inst, DTRX, LOGL_ERROR,
- "osmo_iofd_write_msgb() failed on TRXD with rc=%d (%s)\n",
- rc, errbuf);
- msgb_free(sndbuf);
- }
+ trx_data_submit_msg(l1h, sndbuf);
+
l1h->data.sndbuf = NULL;
l1h->data.sndbuf_num_pdus = 0;


To view, visit change 42697. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ie89ac6efe2f5af0b4cbe5a259a18770b8d2de859
Gerrit-Change-Number: 42697
Gerrit-PatchSet: 1
Gerrit-Owner: Timur Davydov <dtv.comp@gmail.com>