Transceiver: Add several rate_ctr for rx error conditions

Since there's now a rate counter, we can drop log level for those events
which can be bursty and hence print lots of output in short periods of
time, which may affect performance. This way setting them to INFO it's
enough to avoid getting them in stderr unless explicitly configured by
the user (for instance to debug stuff), while still allowing a good
enough level to be enabled for other targets such as gsmtap.

Related: OS#4679
Change-Id: I000f7112e35ac68d3d922444f78468b1ea74cbba
This commit is contained in:
Pau Espin 2020-07-27 11:52:42 +02:00
parent 199a306d27
commit 1d165a043e
4 changed files with 33 additions and 5 deletions

View File

@ -65,4 +65,7 @@ struct trx_counters {
unsigned int tx_trxd_fn_repeated;
unsigned int tx_trxd_fn_outoforder;
unsigned int tx_trxd_fn_skipped;
unsigned int rx_empty_burst;
unsigned int rx_clipping;
unsigned int rx_no_burst_detected;
};

View File

@ -107,6 +107,9 @@ const struct value_string trx_chan_ctr_names[] = {
{ TRX_CTR_TRX_TRXD_FN_REPEATED, "tx_trxd_fn_repeated" },
{ TRX_CTR_TRX_TRXD_FN_OUTOFORDER, "tx_trxd_fn_outoforder" },
{ TRX_CTR_TRX_TRXD_FN_SKIPPED, "tx_trxd_fn_skipped" },
{ TRX_CTR_TRX_RX_EMPTY_BURST, "rx_empty_burst" },
{ TRX_CTR_TRX_RX_CLIPPING, "rx_clipping" },
{ TRX_CTR_TRX_RX_NO_BURST_DETECTED, "rx_no_burst_detected" },
{ 0, NULL }
};
@ -122,6 +125,9 @@ static const struct rate_ctr_desc trx_chan_ctr_desc[] = {
[TRX_CTR_TRX_TRXD_FN_REPEATED] = { "trx:tx_trxd_fn_repeated", "Number of Tx burts received from TRXD with repeated FN" },
[TRX_CTR_TRX_TRXD_FN_OUTOFORDER] = { "trx:tx_trxd_fn_outoforder","Number of Tx burts received from TRXD with a past FN" },
[TRX_CTR_TRX_TRXD_FN_SKIPPED] = { "trx:tx_trxd_fn_skipped", "Number of Tx burts potentially skipped due to FN jumps" },
[TRX_CTR_TRX_RX_EMPTY_BURST] = { "trx:rx_empty_burst", "Number of Rx bursts empty" },
[TRX_CTR_TRX_RX_CLIPPING] = { "trx:rx_clipping", "Number of Rx bursts discarded due to clipping" },
[TRX_CTR_TRX_RX_NO_BURST_DETECTED] = { "trx:rx_no_burst_detected", "Number of Rx burts discarded due to burst detection error" },
};
static const struct rate_ctr_group_desc trx_chan_ctr_group_desc = {
@ -182,6 +188,12 @@ static int trx_rate_ctr_timerfd_cb(struct osmo_fd *ofd, unsigned int what) {
rate_ctr_add(ctr, trx_ctrs_pending[chan].tx_trxd_fn_outoforder - ctr->current);
ctr = &rate_ctrs[chan]->ctr[TRX_CTR_TRX_TRXD_FN_SKIPPED];
rate_ctr_add(ctr, trx_ctrs_pending[chan].tx_trxd_fn_skipped - ctr->current);
ctr = &rate_ctrs[chan]->ctr[TRX_CTR_TRX_RX_EMPTY_BURST];
rate_ctr_add(ctr, trx_ctrs_pending[chan].rx_empty_burst - ctr->current);
ctr = &rate_ctrs[chan]->ctr[TRX_CTR_TRX_RX_CLIPPING];
rate_ctr_add(ctr, trx_ctrs_pending[chan].rx_clipping - ctr->current);
ctr = &rate_ctrs[chan]->ctr[TRX_CTR_TRX_RX_NO_BURST_DETECTED];
rate_ctr_add(ctr, trx_ctrs_pending[chan].rx_no_burst_detected - ctr->current);
/* Mark as done */
trx_ctrs_pending[chan].chan = PENDING_CHAN_NONE;
}

View File

@ -15,6 +15,9 @@ enum TrxCtr {
TRX_CTR_TRX_TRXD_FN_REPEATED,
TRX_CTR_TRX_TRXD_FN_OUTOFORDER,
TRX_CTR_TRX_TRXD_FN_SKIPPED,
TRX_CTR_TRX_RX_EMPTY_BURST,
TRX_CTR_TRX_RX_CLIPPING,
TRX_CTR_TRX_RX_NO_BURST_DETECTED,
};
struct ctr_threshold {

View File

@ -638,6 +638,7 @@ int Transceiver::pullRadioVector(size_t chan, struct trx_ul_burst_ind *bi)
GSM::Time burstTime;
SoftVector *rxBurst;
TransceiverState *state = &mStates[chan];
bool ctr_changed = false;
/* Blocking FIFO read */
radioVector *radio_burst = mReceiveFIFO[chan]->read();
@ -687,7 +688,9 @@ int Transceiver::pullRadioVector(size_t chan, struct trx_ul_burst_ind *bi)
}
if (max_i < 0) {
LOGCHAN(chan, DTRXDUL, FATAL) << "Received empty burst";
LOGCHAN(chan, DTRXDUL, INFO) << "Received empty burst";
state->ctrs.rx_empty_burst++;
ctr_changed = true;
goto ret_idle;
}
@ -713,10 +716,15 @@ int Transceiver::pullRadioVector(size_t chan, struct trx_ul_burst_ind *bi)
/* Detect normal or RACH bursts */
rc = detectAnyBurst(*burst, mTSC, BURST_THRESH, mSPSRx, type, max_toa, &ebp);
if (rc <= 0) {
if (rc == -SIGERR_CLIP)
LOGCHAN(chan, DTRXDUL, NOTICE) << "Clipping detected on received RACH or Normal Burst";
else if (rc != SIGERR_NONE)
LOGCHAN(chan, DTRXDUL, NOTICE) << "Unhandled RACH or Normal Burst detection error";
if (rc == -SIGERR_CLIP) {
LOGCHAN(chan, DTRXDUL, INFO) << "Clipping detected on received RACH or Normal Burst";
state->ctrs.rx_clipping++;
ctr_changed = true;
} else if (rc != SIGERR_NONE) {
LOGCHAN(chan, DTRXDUL, INFO) << "Unhandled RACH or Normal Burst detection error";
state->ctrs.rx_no_burst_detected++;
ctr_changed = true;
}
goto ret_idle;
}
@ -743,6 +751,8 @@ int Transceiver::pullRadioVector(size_t chan, struct trx_ul_burst_ind *bi)
return 0;
ret_idle:
if (ctr_changed)
dispatch_trx_rate_ctr_change(state, chan);
bi->idle = true;
delete radio_burst;
return 0;