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/+/22893 ) Change subject: GSMTAP: move 'struct gsmtap_inst' and masks to 'struct gsm_bts' ...................................................................... GSMTAP: move 'struct gsmtap_inst' and masks to 'struct gsm_bts' Change-Id: I1c5cb8561dfdcbfd1b23ab28cf95aea7a18c7481 --- M include/osmo-bts/bts.h M include/osmo-bts/l1sap.h M src/common/l1sap.c M src/common/main.c M src/common/vty.c 5 files changed, 29 insertions(+), 25 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve osmith: Looks good to me, approved diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h index f6389ad..3adafcc 100644 --- a/include/osmo-bts/bts.h +++ b/include/osmo-bts/bts.h @@ -343,6 +343,13 @@ char *sock_path; } pcu; + /* GSMTAP Um logging (disabled by default) */ + struct { + struct gsmtap_inst *inst; + uint32_t sapi_mask; + uint8_t sapi_acch; + } gsmtap; + struct osmo_fsm_inst *shutdown_fi; /* FSM instance to manage shutdown procedure during process exit */ struct osmo_tdef *T_defs; /* Timer defines */ diff --git a/include/osmo-bts/l1sap.h b/include/osmo-bts/l1sap.h index af58d5e..fe77431 100644 --- a/include/osmo-bts/l1sap.h +++ b/include/osmo-bts/l1sap.h @@ -127,10 +127,6 @@ extern uint16_t l1sap_log_ctx_sapi; extern const struct value_string l1sap_common_sapi_names[]; -extern struct gsmtap_inst *gsmtap; -extern uint32_t gsmtap_sapi_mask; -extern uint8_t gsmtap_sapi_acch; - int add_l1sap_header(struct gsm_bts_trx *trx, struct msgb *rmsg, struct gsm_lchan *lchan, uint8_t chan_nr, uint32_t fn, uint16_t ber10k, int16_t lqual_cb, int8_t rssi, diff --git a/src/common/l1sap.c b/src/common/l1sap.c index 9b3b087..eb652db 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -346,10 +346,6 @@ } } -struct gsmtap_inst *gsmtap = NULL; -uint32_t gsmtap_sapi_mask = 0; -uint8_t gsmtap_sapi_acch = 0; - /* send primitive as gsmtap */ static int gsmtap_ph_data(const struct osmo_phsap_prim *l1sap, uint8_t *chan_type, uint8_t *ss, uint32_t fn, @@ -491,7 +487,8 @@ int8_t signal_dbm; int rc; - if (!gsmtap) + struct gsmtap_inst *inst = trx->bts->gsmtap.inst; + if (!inst) return 0; switch (OSMO_PRIM_HDR(&l1sap->oph)) { @@ -524,10 +521,10 @@ if (len == 0) return 0; if ((chan_type & GSMTAP_CHANNEL_ACCH)) { - if (!gsmtap_sapi_acch) + if (!trx->bts->gsmtap.sapi_acch) return 0; } else { - if (!((1 << (chan_type & 31)) & gsmtap_sapi_mask)) + if (!((1 << (chan_type & 31)) & trx->bts->gsmtap.sapi_mask)) return 0; } @@ -536,7 +533,7 @@ if (is_fill_frame(chan_type, data, len)) return 0; - gsmtap_send(gsmtap, trx->arfcn | uplink, tn, chan_type, ss, fn, + gsmtap_send(inst, trx->arfcn | uplink, tn, chan_type, ss, fn, signal_dbm, 0 /* TODO: SNR */, data, len); return 0; diff --git a/src/common/main.c b/src/common/main.c index 76e0d43..38f517c 100644 --- a/src/common/main.c +++ b/src/common/main.c @@ -321,12 +321,12 @@ } if (gsmtap_ip) { - gsmtap = gsmtap_source_init(gsmtap_ip, GSMTAP_UDP_PORT, 1); - if (!gsmtap) { + g_bts->gsmtap.inst = gsmtap_source_init(gsmtap_ip, GSMTAP_UDP_PORT, 1); + if (g_bts->gsmtap.inst == NULL) { fprintf(stderr, "Failed during gsmtap_init()\n"); exit(1); } - gsmtap_source_add_sink(gsmtap); + gsmtap_source_add_sink(g_bts->gsmtap.inst); } if (bts_init(g_bts) < 0) { diff --git a/src/common/vty.c b/src/common/vty.c index 976ccfa..f2c7954 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -316,7 +316,7 @@ bts->agch_queue.high_level, VTY_NEWLINE); for (i = 0; i < sizeof(uint32_t) * 8; i++) { - if (gsmtap_sapi_mask & ((uint32_t) 1 << i)) { + if (bts->gsmtap.sapi_mask & ((uint32_t) 1 << i)) { sapi_buf = get_value_string_or_null(gsmtap_sapi_names, i); if (sapi_buf == NULL) continue; @@ -324,7 +324,7 @@ vty_out(vty, " gsmtap-sapi %s%s", sapi_buf, VTY_NEWLINE); } } - if (gsmtap_sapi_acch) { + if (bts->gsmtap.sapi_acch) { sapi_buf = osmo_str_tolower(get_value_string(gsmtap_sapi_names, GSMTAP_CHANNEL_ACCH)); vty_out(vty, " gsmtap-sapi %s%s", sapi_buf, VTY_NEWLINE); } @@ -1832,12 +1832,14 @@ "Enable all kinds of messages (all SAPI)\n" "Disable all kinds of messages (all SAPI)\n") { + struct gsm_bts *bts = vty->index; + if (argv[0][0] == 'e') { - gsmtap_sapi_mask = UINT32_MAX; - gsmtap_sapi_acch = 1; + bts->gsmtap.sapi_mask = UINT32_MAX; + bts->gsmtap.sapi_acch = 1; } else { - gsmtap_sapi_mask = 0x00; - gsmtap_sapi_acch = 0; + bts->gsmtap.sapi_mask = 0x00; + bts->gsmtap.sapi_acch = 0; } return CMD_SUCCESS; @@ -1846,15 +1848,16 @@ DEFUN(cfg_bts_gsmtap_sapi, cfg_bts_gsmtap_sapi_cmd, "HIDDEN", "HIDDEN") { + struct gsm_bts *bts = vty->index; int sapi; sapi = get_string_value(gsmtap_sapi_names, argv[0]); OSMO_ASSERT(sapi >= 0); if (sapi == GSMTAP_CHANNEL_ACCH) - gsmtap_sapi_acch = 1; + bts->gsmtap.sapi_acch = 1; else - gsmtap_sapi_mask |= (1 << sapi); + bts->gsmtap.sapi_mask |= (1 << sapi); return CMD_SUCCESS; } @@ -1862,15 +1865,16 @@ DEFUN(cfg_trx_no_gsmtap_sapi, cfg_bts_no_gsmtap_sapi_cmd, "HIDDEN", "HIDDEN") { + struct gsm_bts *bts = vty->index; int sapi; sapi = get_string_value(gsmtap_sapi_names, argv[0]); OSMO_ASSERT(sapi >= 0); if (sapi == GSMTAP_CHANNEL_ACCH) - gsmtap_sapi_acch = 0; + bts->gsmtap.sapi_acch = 0; else - gsmtap_sapi_mask &= ~(1 << sapi); + bts->gsmtap.sapi_mask &= ~(1 << sapi); return CMD_SUCCESS; } -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/22893 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I1c5cb8561dfdcbfd1b23ab28cf95aea7a18c7481 Gerrit-Change-Number: 22893 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de> Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: osmith <osmith at sysmocom.de> Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210215/79a88d5f/attachment.htm>