stats: Start handling stats for a mtp_link
This commit is contained in:
parent
a0215b1d46
commit
ffb70fb66a
|
@ -37,6 +37,7 @@
|
||||||
|
|
||||||
struct bsc_data;
|
struct bsc_data;
|
||||||
struct snmp_mtp_session;
|
struct snmp_mtp_session;
|
||||||
|
struct rate_ctr_group;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A link to the underlying MTP2 library or such
|
* A link to the underlying MTP2 library or such
|
||||||
|
@ -62,6 +63,7 @@ struct link_data {
|
||||||
int pcap_fd;
|
int pcap_fd;
|
||||||
struct bsc_data *bsc;
|
struct bsc_data *bsc;
|
||||||
struct mtp_link_set *the_link;
|
struct mtp_link_set *the_link;
|
||||||
|
struct rate_ctr_group *ctrg;
|
||||||
|
|
||||||
int available;
|
int available;
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <mtp_pcap.h>
|
#include <mtp_pcap.h>
|
||||||
#include <snmp_mtp.h>
|
#include <snmp_mtp.h>
|
||||||
#include <cellmgr_debug.h>
|
#include <cellmgr_debug.h>
|
||||||
|
#include <counter.h>
|
||||||
|
|
||||||
#include <osmocore/talloc.h>
|
#include <osmocore/talloc.h>
|
||||||
|
|
||||||
|
@ -91,11 +92,13 @@ static int udp_read_cb(struct bsc_fd *fd)
|
||||||
|
|
||||||
if (hdr->data_type == UDP_DATA_RETR_COMPL || hdr->data_type == UDP_DATA_RETR_IMPOS) {
|
if (hdr->data_type == UDP_DATA_RETR_COMPL || hdr->data_type == UDP_DATA_RETR_IMPOS) {
|
||||||
LOGP(DINP, LOGL_ERROR, "Link retrieval done. Restarting the link.\n");
|
LOGP(DINP, LOGL_ERROR, "Link retrieval done. Restarting the link.\n");
|
||||||
|
rate_ctr_inc(&link->ctrg->ctr[MTP_LNK_ERROR]);
|
||||||
mtp_link_down(link);
|
mtp_link_down(link);
|
||||||
mtp_link_up(link);
|
mtp_link_up(link);
|
||||||
goto exit;
|
goto exit;
|
||||||
} else if (hdr->data_type > UDP_DATA_MSU_PRIO_3) {
|
} else if (hdr->data_type > UDP_DATA_MSU_PRIO_3) {
|
||||||
LOGP(DINP, LOGL_ERROR, "Link failure. retrieved message.\n");
|
LOGP(DINP, LOGL_ERROR, "Link failure. retrieved message.\n");
|
||||||
|
rate_ctr_inc(&link->ctrg->ctr[MTP_LNK_ERROR]);
|
||||||
mtp_link_down(link);
|
mtp_link_down(link);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -113,6 +116,7 @@ static int udp_read_cb(struct bsc_fd *fd)
|
||||||
LOGP(DINP, LOGL_DEBUG, "MSU data on: %p data %s.\n", link, hexdump(msg->data, msg->len));
|
LOGP(DINP, LOGL_DEBUG, "MSU data on: %p data %s.\n", link, hexdump(msg->data, msg->len));
|
||||||
if (link->pcap_fd >= 0)
|
if (link->pcap_fd >= 0)
|
||||||
mtp_pcap_write_msu(link->pcap_fd, msg->l2h, msgb_l2len(msg));
|
mtp_pcap_write_msu(link->pcap_fd, msg->l2h, msgb_l2len(msg));
|
||||||
|
rate_ctr_inc(&link->ctrg->ctr[MTP_LNK_IN]);
|
||||||
mtp_link_set_data(link->the_link, msg);
|
mtp_link_set_data(link->the_link, msg);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <cellmgr_debug.h>
|
#include <cellmgr_debug.h>
|
||||||
#include <mtp_data.h>
|
#include <mtp_data.h>
|
||||||
#include <snmp_mtp.h>
|
#include <snmp_mtp.h>
|
||||||
|
#include <counter.h>
|
||||||
|
|
||||||
#include <osmocore/talloc.h>
|
#include <osmocore/talloc.h>
|
||||||
|
|
||||||
|
@ -73,6 +74,7 @@ void mtp_link_set_sccp_down(struct mtp_link_set *link)
|
||||||
|
|
||||||
void mtp_link_submit(struct link_data *link, struct msgb *msg)
|
void mtp_link_submit(struct link_data *link, struct msgb *msg)
|
||||||
{
|
{
|
||||||
|
rate_ctr_inc(&link->ctrg->ctr[MTP_LNK_OUT]);
|
||||||
link->write(link, msg);
|
link->write(link, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,6 +112,8 @@ int link_init(struct bsc_data *bsc)
|
||||||
bsc->link_set->bsc = bsc;
|
bsc->link_set->bsc = bsc;
|
||||||
|
|
||||||
lnk = talloc_zero(bsc->link_set, struct link_data);
|
lnk = talloc_zero(bsc->link_set, struct link_data);
|
||||||
|
lnk->ctrg = rate_ctr_group_alloc(lnk,
|
||||||
|
mtp_link_rate_ctr_desc(), 1);
|
||||||
lnk->bsc = bsc;
|
lnk->bsc = bsc;
|
||||||
lnk->udp.link_index = 1;
|
lnk->udp.link_index = 1;
|
||||||
lnk->pcap_fd = bsc->pcap_fd;
|
lnk->pcap_fd = bsc->pcap_fd;
|
||||||
|
|
Reference in New Issue