Add per-line rate counter group to count various errors
Change-Id: I766b717843d7cd8ac00d4ce18c38773ac50ec3e6
This commit is contained in:
parent
a74aaf172c
commit
8f3064a2c8
11
src/e1d.h
11
src/e1d.h
|
@ -26,7 +26,17 @@
|
|||
|
||||
#include <osmocom/core/isdnhdlc.h>
|
||||
#include <osmocom/core/linuxlist.h>
|
||||
#include <osmocom/core/rate_ctr.h>
|
||||
|
||||
#define line_ctr_add(line, idx, add) rate_ctr_add(&(line)->ctrs->ctr[idx], add)
|
||||
|
||||
enum e1d_line_ctr {
|
||||
LINE_CTR_LOS,
|
||||
LINE_CTR_LOA,
|
||||
LINE_CTR_CRC_ERR,
|
||||
LINE_CTR_RX_OVFL,
|
||||
LINE_CTR_TX_UNFL,
|
||||
};
|
||||
|
||||
enum e1_ts_mode {
|
||||
E1_TS_MODE_OFF = 0,
|
||||
|
@ -81,6 +91,7 @@ struct e1_line {
|
|||
enum e1_line_mode mode;
|
||||
|
||||
void *drv_data;
|
||||
struct rate_ctr_group *ctrs;
|
||||
|
||||
/* timeslots for channelized mode */
|
||||
struct e1_ts ts[32];
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
|
||||
#include <osmocom/core/isdnhdlc.h>
|
||||
#include <osmocom/core/utils.h>
|
||||
#include <osmocom/core/stats.h>
|
||||
#include <osmocom/core/rate_ctr.h>
|
||||
#include <osmocom/e1d/proto.h>
|
||||
|
||||
#include "e1d.h"
|
||||
|
@ -44,6 +46,22 @@ const struct value_string e1_driver_names[] = {
|
|||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static const struct rate_ctr_desc line_ctr_description[] = {
|
||||
[LINE_CTR_LOS] = { "rx:signal_lost", "Rx Signal Lost" },
|
||||
[LINE_CTR_LOA] = { "rx:alignment_lost", "Rx Alignment Lost" },
|
||||
[LINE_CTR_CRC_ERR] = { "rx:crc_errors", "E1 Rx CRC Errors" },
|
||||
[LINE_CTR_RX_OVFL] = { "rx:overflow", "E1 Rx Overflow" },
|
||||
[LINE_CTR_TX_UNFL] = { "tx:underflow", "E1 Tx Underflow" },
|
||||
};
|
||||
|
||||
static const struct rate_ctr_group_desc line_ctrg_desc = {
|
||||
.group_name_prefix = "e1d_line",
|
||||
.group_description = "Counters for each line in e1d",
|
||||
.class_id = OSMO_STATS_CLASS_GLOBAL,
|
||||
.num_ctr = ARRAY_SIZE(line_ctr_description),
|
||||
.ctr_desc = line_ctr_description,
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// e1d structures
|
||||
// ---------------------------------------------------------------------------
|
||||
|
@ -122,6 +140,9 @@ e1_line_new(struct e1_intf *intf, void *drv_data)
|
|||
line->id = l->id + 1;
|
||||
}
|
||||
|
||||
line->ctrs = rate_ctr_group_alloc(line, &line_ctrg_desc, line->id);
|
||||
OSMO_ASSERT(line->ctrs);
|
||||
|
||||
llist_add_tail(&line->list, &intf->lines);
|
||||
|
||||
LOGPLI(line, DE1D, LOGL_NOTICE, "Created\n");
|
||||
|
|
12
src/usb.c
12
src/usb.c
|
@ -287,6 +287,12 @@ e1uf_start(struct e1_usb_flow *flow)
|
|||
|
||||
static int resubmit_irq(struct e1_line *line);
|
||||
|
||||
/* compute how much advanced 'cur' is copared to 'prev', in modulo-0xffff for wraps */
|
||||
static uint32_t delta_mod_u16(uint32_t cur, uint32_t prev)
|
||||
{
|
||||
return ((cur + 0xffff) - prev) % 0xffff;
|
||||
}
|
||||
|
||||
static void rx_interrupt_errcnt(struct e1_line *line, const struct ice1usb_irq_err *errcnt)
|
||||
{
|
||||
struct e1_usb_line_data *ld = (struct e1_usb_line_data *) line->drv_data;
|
||||
|
@ -295,21 +301,25 @@ static void rx_interrupt_errcnt(struct e1_line *line, const struct ice1usb_irq_e
|
|||
if (errcnt->crc != last->crc) {
|
||||
LOGPLI(line, DE1D, LOGL_ERROR, "CRC error count %d (was %d)\n",
|
||||
errcnt->crc, last->crc);
|
||||
line_ctr_add(line, LINE_CTR_CRC_ERR, delta_mod_u16(errcnt->crc, last->crc));
|
||||
}
|
||||
|
||||
if (errcnt->align != last->align) {
|
||||
LOGPLI(line, DE1D, LOGL_ERROR, "ALIGNMENT error count %d (was %d)\n",
|
||||
errcnt->align, last->align);
|
||||
line_ctr_add(line, LINE_CTR_LOA, delta_mod_u16(errcnt->align, last->align));
|
||||
}
|
||||
|
||||
if (errcnt->ovfl != last->ovfl) {
|
||||
LOGPLI(line, DE1D, LOGL_ERROR, "OVERFLOW error count %d (was %d)\n",
|
||||
errcnt->ovfl, last->ovfl);
|
||||
line_ctr_add(line, LINE_CTR_RX_OVFL, delta_mod_u16(errcnt->ovfl, last->ovfl));
|
||||
}
|
||||
|
||||
if (errcnt->unfl != last->unfl) {
|
||||
LOGPLI(line, DE1D, LOGL_ERROR, "UNDERFLOW error count %d (was %d)\n",
|
||||
errcnt->unfl, last->unfl);
|
||||
line_ctr_add(line, LINE_CTR_TX_UNFL, delta_mod_u16(errcnt->unfl, last->unfl));
|
||||
}
|
||||
|
||||
if ((errcnt->flags & ICE1USB_ERR_F_ALIGN_ERR) != (last->flags & ICE1USB_ERR_F_ALIGN_ERR)) {
|
||||
|
@ -320,6 +330,8 @@ static void rx_interrupt_errcnt(struct e1_line *line, const struct ice1usb_irq_e
|
|||
if ((errcnt->flags & ICE1USB_ERR_F_TICK_ERR) != (last->flags & ICE1USB_ERR_F_TICK_ERR)) {
|
||||
LOGPLI(line, DE1D, LOGL_ERROR, "Rx Clock %s\n",
|
||||
errcnt->flags & ICE1USB_ERR_F_TICK_ERR ? "LOST" : "REGAINED");
|
||||
if (errcnt->flags & ICE1USB_ERR_F_TICK_ERR)
|
||||
line_ctr_add(line, LINE_CTR_LOS, 1);
|
||||
}
|
||||
|
||||
ld->irq.last_errcnt = *errcnt;
|
||||
|
|
|
@ -125,6 +125,8 @@ static void vty_dump_line(struct vty *vty, const struct e1_line *line)
|
|||
vty_out(vty, " SC: Mode %s, FD %d, Peer PID %d%s",
|
||||
get_value_string(e1_ts_mode_names, line->superchan.mode),
|
||||
line->superchan.fd, get_remote_pid(line->superchan.fd), VTY_NEWLINE);
|
||||
|
||||
vty_out_rate_ctr_group(vty, " ", line->ctrs);
|
||||
}
|
||||
|
||||
DEFUN(show_line, show_line_cmd, "show line [<0-255>]",
|
||||
|
|
Loading…
Reference in New Issue