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/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/12868
Change subject: OML: Reduce code duplication in down_mom/down_fom
......................................................................
OML: Reduce code duplication in down_mom/down_fom
Simply use a "mo" variable on the stack rather than having duplicate
but otherwise identical calls to oml_tx_failure_event_rep()
Change-Id: Ibe6c79e95405b13d041047549d2ffa39aa355eb2
---
M src/common/oml.c
1 file changed, 10 insertions(+), 18 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/68/12868/1
diff --git a/src/common/oml.c b/src/common/oml.c
index 6d44710..cbd2e1b 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -1089,6 +1089,7 @@
{
struct abis_om_fom_hdr *foh = msgb_l3(msg);
struct gsm_bts_trx *trx;
+ struct gsm_abis_mo *mo = &bts->mo;
int ret;
if (msgb_l2len(msg) < sizeof(*foh)) {
@@ -1136,16 +1137,10 @@
break;
default:
trx = gsm_bts_trx_num(bts, foh->obj_inst.trx_nr);
- if (trx) {
- oml_tx_failure_event_rep(&trx->mo, OSMO_EVT_MAJ_UKWN_MSG,
- "unknown Formatted O&M "
- "msg_type 0x%02x",
- foh->msg_type);
- } else
- oml_tx_failure_event_rep(&bts->mo, OSMO_EVT_MAJ_UKWN_MSG,
- "unknown Formatted O&M "
- "msg_type 0x%02x",
- foh->msg_type);
+ if (trx)
+ mo = &trx->mo;
+ oml_tx_failure_event_rep(mo, OSMO_EVT_MAJ_UKWN_MSG, "unknown Formatted O&M "
+ "msg_type 0x%02x", foh->msg_type);
ret = oml_fom_ack_nack(msg, NM_NACK_MSGTYPE_INVAL);
}
@@ -1371,6 +1366,7 @@
static int down_mom(struct gsm_bts *bts, struct msgb *msg)
{
struct abis_om_hdr *oh = msgb_l2(msg);
+ struct gsm_abis_mo *mo = &bts->mo;
struct abis_om_fom_hdr *foh;
struct gsm_bts_trx *trx;
uint8_t idstrlen = oh->data[0];
@@ -1412,14 +1408,10 @@
break;
default:
trx = gsm_bts_trx_num(bts, foh->obj_inst.trx_nr);
- if (trx) {
- oml_tx_failure_event_rep(&trx->mo, OSMO_EVT_MAJ_UKWN_MSG,
- "unknown Manufacturer O&M msg_type 0x%02x",
- foh->msg_type);
- } else
- oml_tx_failure_event_rep(&bts->mo, OSMO_EVT_MAJ_UKWN_MSG,
- "unknown Manufacturer O&M msg_type 0x%02x",
- foh->msg_type);
+ if (trx)
+ mo = &trx->mo;
+ oml_tx_failure_event_rep(mo, OSMO_EVT_MAJ_UKWN_MSG, "unknown Manufacturer O&M "
+ "msg_type 0x%02x", foh->msg_type);
ret = oml_fom_ack_nack(msg, NM_NACK_MSGTYPE_INVAL);
}
--
To view, visit https://gerrit.osmocom.org/12868
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibe6c79e95405b13d041047549d2ffa39aa355eb2
Gerrit-Change-Number: 12868
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190209/38e0dfdd/attachment.htm>