osmith has uploaded this change for review.

View Change

bsc_nat_fsm: drop LOG_SCCP macro

After implementing more functionallity (see follow-up patches), it
became clear that this macro is not so useful:

* Using the macro creates unnecessary overhead,
'LOG_SCCP(sccp_inst, peer_addr_in,' is much longer than 'LOGP('

* The RI and SSN are always the same, so it's not useful to print them
all the time, this is the generated prefix:
'(RI=SSN_PC,PC=0.23.3,SSN=BSSAP from CN)'

Related: SYS#5560
Change-Id: I49187d4e3d804c4786ee52eaebdd911e6c6cfa6c
---
M src/osmo-bsc-nat/bsc_nat_fsm.c
1 file changed, 4 insertions(+), 16 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-bsc-nat refs/changes/68/27468/1
diff --git a/src/osmo-bsc-nat/bsc_nat_fsm.c b/src/osmo-bsc-nat/bsc_nat_fsm.c
index 4d71420..a0ff4d2 100644
--- a/src/osmo-bsc-nat/bsc_nat_fsm.c
+++ b/src/osmo-bsc-nat/bsc_nat_fsm.c
@@ -32,18 +32,6 @@
#define DEFAULT_PC_RAN "0.23.1" /* same as default for OsmoMSC */
#define DEFAULT_PC_CN "0.23.3" /* same as default for OsmoBSC */

-static char log_buf[255];
-
-#define LOG_SCCP(sccp_inst, peer_addr_in, level, fmt, args...) do { \
- if (peer_addr_in) \
- osmo_sccp_addr_to_str_buf(log_buf, sizeof(log_buf), NULL, peer_addr_in); \
- LOGP(DMAIN, level, "(%s%s%s) " fmt, \
- peer_addr_in ? log_buf : "", \
- peer_addr_in ? " from " : "", \
- sccp_inst == g_bsc_nat->ran ? "RAN" : "CN", \
- ## args); \
-} while (0)
-
#define X(s) (1 << (s))

enum bsc_nat_fsm_states {
@@ -83,7 +71,7 @@
osmo_sccp_addr_to_str_buf(buf_called, sizeof(buf_called), NULL, called_addr);
osmo_sccp_addr_to_str_buf(buf_calling, sizeof(buf_calling), NULL, calling_addr);

- LOG_SCCP(src, NULL, LOGL_ERROR, "Invalid connection oriented message, locally configured address %s"
+ LOGP(DMAIN, LOGL_ERROR, "Invalid connection oriented message, locally configured address %s"
" is neither called address %s nor calling address %s!\n",
osmo_sccp_inst_addr_name(NULL, &src->local_sccp_addr), buf_called, buf_calling);
return -1;
@@ -98,12 +86,12 @@

if (src == g_bsc_nat->ran) {
if (osmo_sccp_addr_by_name_local(peer_addr_out, "msc", dest->ss7_inst) < 0) {
- LOG_SCCP(src, peer_addr_in, LOGL_ERROR, "Could not find MSC in address book\n");
+ LOGP(DMAIN, LOGL_ERROR, "Could not find MSC in address book\n");
return -1;
}
} else {
if (osmo_sccp_addr_by_name_local(peer_addr_out, "bsc", dest->ss7_inst) < 0) {
- LOG_SCCP(src, peer_addr_in, LOGL_ERROR, "Could not find BSC in address book\n");
+ LOGP(DMAIN, LOGL_ERROR, "Could not find BSC in address book\n");
return -2;
}
}
@@ -201,7 +189,7 @@
break;

default:
- LOG_SCCP(src, NULL, LOGL_ERROR, "%s(%s) is not implemented!\n", __func__, osmo_scu_prim_name(oph));
+ LOGP(DMAIN, LOGL_ERROR, "%s(%s) is not implemented!\n", __func__, osmo_scu_prim_name(oph));
break;
}


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

Gerrit-Project: osmo-bsc-nat
Gerrit-Branch: master
Gerrit-Change-Id: I49187d4e3d804c4786ee52eaebdd911e6c6cfa6c
Gerrit-Change-Number: 27468
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-MessageType: newchange