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/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/15702
Change subject: bts-trx: Log TRXC and TRXD socket recv()/send() failures
......................................................................
bts-trx: Log TRXC and TRXD socket recv()/send() failures
Related: OS#4215
Change-Id: Ic3e41d82b43459495d45873d612a3bd349ac174a
---
M src/osmo-bts-trx/trx_if.c
1 file changed, 25 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/02/15702/1
diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c
index 9933109..af64ed6 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -94,14 +94,18 @@
struct phy_link *plink = ofd->data;
struct phy_instance *pinst = phy_instance_by_num(plink, 0);
char buf[1500];
- int len;
+ ssize_t len;
uint32_t fn;
OSMO_ASSERT(pinst);
len = recv(ofd->fd, buf, sizeof(buf) - 1, 0);
- if (len <= 0)
+ if (len <= 0) {
+ strerror_r(errno, (char *)buf, sizeof(buf));
+ LOGPPHI(pinst, DTRX, LOGL_ERROR,
+ "recv() failed on TRXD with rc=%zd (%s)\n", len, buf);
return len;
+ }
buf[len] = '\0';
if (!!strncmp(buf, "IND CLOCK ", 10)) {
@@ -144,6 +148,7 @@
struct trx_ctrl_msg *tcm;
char buf[1500];
int len;
+ ssize_t snd_len;
/* get first command */
if (llist_empty(&l1h->trx_ctrl_list))
@@ -155,7 +160,12 @@
LOGPPHI(l1h->phy_inst, DTRX, LOGL_DEBUG, "Sending control '%s'\n", buf);
/* send command */
- send(l1h->trx_ofd_ctrl.fd, buf, len+1, 0);
+ snd_len = send(l1h->trx_ofd_ctrl.fd, buf, len+1, 0);
+ if (snd_len <= 0) {
+ strerror_r(errno, (char *)buf, sizeof(buf));
+ LOGPPHI(l1h->phy_inst, DTRX, LOGL_ERROR,
+ "send() failed on TRXC with rc=%zd (%s)\n", snd_len, buf);
+ }
/* start timer */
osmo_timer_schedule(&l1h->trx_ctrl_timer, 2, 0);
@@ -979,8 +989,9 @@
buf_len = recv(ofd->fd, buf, sizeof(buf), 0);
if (buf_len <= 0) {
+ strerror_r(errno, (char *)buf, sizeof(buf));
LOGPPHI(l1h->phy_inst, DTRX, LOGL_ERROR,
- "recv() failed on TRXD with rc=%zd\n", buf_len);
+ "recv() failed on TRXD with rc=%zd (%s)\n", buf_len, buf);
return buf_len;
}
@@ -1058,6 +1069,7 @@
int trx_if_send_burst(struct trx_l1h *l1h, uint8_t tn, uint32_t fn, uint8_t pwr,
const ubit_t *bits, uint16_t nbits)
{
+ ssize_t snd_len;
uint8_t hdr_ver = l1h->config.trxd_hdr_ver_use;
uint8_t buf[TRX_DATA_MSG_MAX_LEN];
@@ -1094,11 +1106,19 @@
/* we must be sure that TRX is on */
if (trx_if_powered(l1h)) {
- send(l1h->trx_ofd_data.fd, buf, nbits + 6, 0);
+ snd_len = send(l1h->trx_ofd_data.fd, buf, nbits + 6, 0);
+ if (snd_len <= 0)
+ goto snd_err;
} else
LOGPPHI(l1h->phy_inst, DTRX, LOGL_ERROR, "Ignoring TX data, transceiver powered off.\n");
return 0;
+
+snd_err:
+ strerror_r(errno, (char *)buf, sizeof(buf));
+ LOGPPHI(l1h->phy_inst, DTRX, LOGL_ERROR,
+ "send() failed on TRXD with rc=%zd (%s)\n", snd_len, buf);
+ return -2;
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/15702
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ic3e41d82b43459495d45873d612a3bd349ac174a
Gerrit-Change-Number: 15702
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191008/4b618791/attachment.htm>