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/.
fixeria gerrit-no-reply at lists.osmocom.orgfixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/23867 )
Change subject: osmo-bts-trx: reduce code nasting in trx_if_send_burst()
......................................................................
osmo-bts-trx: reduce code nasting in trx_if_send_burst()
If the PHY is not powered on and we are not supposed to send any
bursts to it, then trx_if_send_burst() should just return early.
Change-Id: I578bd5a731ad88ebff283c75bb7eb268d9e7e787
Related: SYS#4895, OS#4941, OS#4006
---
M src/osmo-bts-trx/trx_if.c
1 file changed, 15 insertions(+), 12 deletions(-)
Approvals:
laforge: Looks good to me, approved
dexter: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c
index 9e2cd75..18c5011 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -999,6 +999,13 @@
uint8_t pdu_ver = l1h->config.trxd_pdu_ver_use;
uint8_t *buf = &trx_data_buf[0];
+ /* Make sure that the PHY is powered on */
+ if (!trx_if_powered(l1h)) {
+ LOGPPHI(l1h->phy_inst, DTRX, LOGL_ERROR,
+ "Ignoring Tx data, transceiver is powered off\n");
+ return -ENODEV;
+ }
+
if ((br->burst_len != GSM_BURST_LEN) && (br->burst_len != EGPRS_BURST_LEN)) {
LOGPPHI(l1h->phy_inst, DTRX, LOGL_ERROR, "Tx burst length %zu invalid\n",
br->burst_len);
@@ -1027,18 +1034,14 @@
/* copy ubits {0,1} */
memcpy(buf + 6, br->burst, br->burst_len);
- /* we must be sure that TRX is on */
- if (trx_if_powered(l1h)) {
- snd_len = send(l1h->trx_ofd_data.fd, trx_data_buf, br->burst_len + 6, 0);
- if (snd_len <= 0) {
- strerror_r(errno, (char *) trx_data_buf, sizeof(trx_data_buf));
- LOGPPHI(l1h->phy_inst, DTRX, LOGL_ERROR,
- "send() failed on TRXD with rc=%zd (%s)\n",
- snd_len, trx_data_buf);
- return -2;
- }
- } else
- LOGPPHI(l1h->phy_inst, DTRX, LOGL_ERROR, "Ignoring TX data, transceiver powered off.\n");
+ snd_len = send(l1h->trx_ofd_data.fd, trx_data_buf, br->burst_len + 6, 0);
+ if (snd_len <= 0) {
+ strerror_r(errno, (char *) trx_data_buf, sizeof(trx_data_buf));
+ LOGPPHI(l1h->phy_inst, DTRX, LOGL_ERROR,
+ "send() failed on TRXD with rc=%zd (%s)\n",
+ snd_len, trx_data_buf);
+ return -2;
+ }
return 0;
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/23867
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I578bd5a731ad88ebff283c75bb7eb268d9e7e787
Gerrit-Change-Number: 23867
Gerrit-PatchSet: 4
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210430/c29d8fc9/attachment.htm>