gsmtap-rlp: Add support for skipping generating NULL frames

If there's nothing to transmit over a CSD NT channel, both ends generate
NULL frames.  Let's add an option to suppress GSMTAP output for those,
creating pcap files with less noise.

Change-Id: I85a2159cfaa01bfb4205c1462e3a9dbda68e4bad
Depends: libosmocore.git I2d9bd8eb4f0cd0f72c436996767b199429596917
This commit is contained in:
Harald Welte 2023-11-26 18:28:26 +01:00 committed by laforge
parent 7786d9b673
commit 1f755bcfee
5 changed files with 24 additions and 5 deletions

View File

@ -8,3 +8,4 @@
# If any interfaces have been removed or changed since the last public release: c:r:0.
#library what description / commit summary line
libosmogsm >1.9.0 added new PRIM_INFO to include/osmocom/gsm/l1sap.h
libosmogsm >1.9.0 use of RLP code in libosmogsm

View File

@ -378,6 +378,7 @@ struct gsm_bts {
uint32_t sapi_mask;
uint8_t sapi_acch;
bool rlp;
bool rlp_skip_null;
} gsmtap;
struct osmux_state osmux;

View File

@ -33,6 +33,7 @@
#include <osmocom/gsm/l1sap.h>
#include <osmocom/gsm/gsm_utils.h>
#include <osmocom/gsm/rsl.h>
#include <osmocom/gsm/rlp.h>
#include <osmocom/core/gsmtap.h>
#include <osmocom/core/gsmtap_util.h>
#include <osmocom/core/utils.h>
@ -1855,6 +1856,7 @@ static void gsmtap_csd_rlp_process(struct gsm_lchan *lchan, bool is_uplink,
{
struct gsm_bts_trx *trx = lchan->ts->trx;
struct gsmtap_inst *inst = trx->bts->gsmtap.inst;
struct osmo_rlp_frame_decoded rlpf;
pbit_t *rlp_buf;
int byte_len;
@ -1908,6 +1910,12 @@ static void gsmtap_csd_rlp_process(struct gsm_lchan *lchan, bool is_uplink,
byte_len = osmo_ubit2pbit_ext(rlp_buf, 0, data, 0, data_len, 1);
}
if (trx->bts->gsmtap.rlp_skip_null) {
int rc = osmo_rlp_decode(&rlpf, 0, rlp_buf, byte_len);
if (rc == 0 && rlpf.ftype == OSMO_RLP_FT_U && rlpf.u_ftype == OSMO_RLP_U_FT_NULL)
return;
}
gsmtap_send_ex(inst, GSMTAP_TYPE_GSM_RLP, trx->arfcn | is_uplink ? GSMTAP_ARFCN_F_UPLINK : 0,
lchan->ts->nr,
lchan->type == GSM_LCHAN_TCH_H ? GSMTAP_CHANNEL_VOICE_H : GSMTAP_CHANNEL_VOICE_F,

View File

@ -447,8 +447,12 @@ static void config_write_bts_single(struct vty *vty, const struct gsm_bts *bts)
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);
}
if (bts->gsmtap.rlp)
vty_out(vty, " gsmtap-rlp%s", VTY_NEWLINE);
if (bts->gsmtap.rlp) {
if (bts->gsmtap.rlp_skip_null)
vty_out(vty, " gsmtap-rlp skip-null%s", VTY_NEWLINE);
else
vty_out(vty, " gsmtap-rlp%s", VTY_NEWLINE);
}
vty_out(vty, " min-qual-rach %d%s", bts->min_qual_rach,
VTY_NEWLINE);
vty_out(vty, " min-qual-norm %d%s", bts->min_qual_norm,
@ -2389,11 +2393,16 @@ DEFUN(cfg_bts_no_gsmtap_sapi, cfg_bts_no_gsmtap_sapi_cmd,
}
DEFUN(cfg_bts_gsmtap_rlp, cfg_bts_gsmtap_rlp_cmd,
"gsmtap-rlp",
"Enable generation of GSMTAP frames for RLP (non-transparent CSD)\n")
"gsmtap-rlp [skip-null]",
"Enable generation of GSMTAP frames for RLP (non-transparent CSD)\n"
"Skip the generation of GSMTAP for RLP NULL frames\n")
{
struct gsm_bts *bts = vty->index;
bts->gsmtap.rlp = true;
if (argc >= 1 && !strcmp(argv[0], "skip-null"))
bts->gsmtap.rlp_skip_null = true;
else
bts->gsmtap.rlp_skip_null = false;
return CMD_SUCCESS;
}

View File

@ -262,7 +262,7 @@ OsmoBTS(bts)# list
gsmtap-sapi (enable-all|disable-all)
gsmtap-sapi (bcch|ccch|rach|agch|pch|sdcch|tch/f|tch/h|pacch|pdtch|ptcch|cbch|sacch)
no gsmtap-sapi (bcch|ccch|rach|agch|pch|sdcch|tch/f|tch/h|pacch|pdtch|ptcch|cbch|sacch)
gsmtap-rlp
gsmtap-rlp [skip-null]
no gsmtap-rlp
osmux
trx <0-254>