mtp: Assign a name to linkset, use this name in the log messages
This commit is contained in:
parent
c5562bde48
commit
38d936a445
|
@ -45,6 +45,8 @@ struct mtp_link_set {
|
|||
int ni;
|
||||
int spare;
|
||||
|
||||
const char *name;
|
||||
|
||||
/* internal state */
|
||||
/* the MTP1 link is up */
|
||||
int available;
|
||||
|
|
|
@ -99,6 +99,7 @@ int link_init(struct bsc_data *bsc)
|
|||
struct mtp_udp_link *lnk;
|
||||
|
||||
bsc->link_set = mtp_link_set_alloc();
|
||||
bsc->link_set->name = talloc_strdup(bsc->link_set, "MTP");
|
||||
bsc->link_set->dpc = bsc->dpc;
|
||||
bsc->link_set->opc = bsc->opc;
|
||||
bsc->link_set->sccp_opc = bsc->sccp_opc > -1 ? bsc->sccp_opc : bsc->opc;
|
||||
|
@ -145,7 +146,9 @@ int link_init(struct bsc_data *bsc)
|
|||
bsc->start_timer.cb = start_rest;
|
||||
bsc->start_timer.data = &bsc;
|
||||
bsc_schedule_timer(&bsc->start_timer, lnk->reset_timeout, 0);
|
||||
LOGP(DMSC, LOGL_NOTICE, "Making sure SLTM will timeout.\n");
|
||||
LOGP(DMSC, LOGL_NOTICE,
|
||||
"Making sure SLTM will timeout on %s/%d\n",
|
||||
lnk->base.set->name, lnk->base.link_no);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -253,6 +253,7 @@ int main(int argc, char **argv)
|
|||
bsc.m2ua_set->ni = 3;
|
||||
bsc.m2ua_set->bsc = &bsc;
|
||||
bsc.m2ua_set->pcap_fd = bsc.pcap_fd;
|
||||
bsc.m2ua_set->name = talloc_strdup(bsc.m2ua_set, "M2UA");
|
||||
|
||||
/* for both links we want to have all isup messages */
|
||||
bsc.m2ua_set->pass_all_isup = 1;
|
||||
|
|
|
@ -297,7 +297,7 @@ static int linkset_up(struct mtp_link *link)
|
|||
|
||||
set->linkset_up = 1;
|
||||
LOGP(DINP, LOGL_NOTICE,
|
||||
"The linkset %p is considered running.\n", set);
|
||||
"The linkset %s is considered running.\n", set->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -320,9 +320,9 @@ static int mtp_link_sign_msg(struct mtp_link_set *link, struct mtp_level_3_hdr *
|
|||
case MTP_TRF_RESTR_MSG_GRP:
|
||||
switch (cmn->h1) {
|
||||
case MTP_RESTR_MSG_ALLWED:
|
||||
LOGP(DINP, LOGL_INFO, "Received Restart Allowed. SST could be next: %p\n", link);
|
||||
LOGP(DINP, LOGL_INFO, "Received Restart Allowed. SST could be next: %s\n", link->name);
|
||||
link->sccp_up = 1;
|
||||
LOGP(DINP, LOGL_INFO, "SCCP traffic allowed. %p\n", link);
|
||||
LOGP(DINP, LOGL_INFO, "SCCP traffic allowed. %s\n", link->name);
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
|
@ -466,7 +466,8 @@ int mtp_link_set_data(struct mtp_link *link, struct msgb *msg)
|
|||
return -1;
|
||||
|
||||
if (!link->set->running) {
|
||||
LOGP(DINP, LOGL_ERROR, "Link is not running. Call mtp_link_reset first: %p\n", link);
|
||||
LOGP(DINP, LOGL_ERROR, "Link is not running. Call mtp_link_reset first: %s/%d\n",
|
||||
link->set->name, link->link_no);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,12 +75,16 @@ static void mtp_sltm_t1_timeout(void *_link)
|
|||
rate_ctr_inc(&link->ctrg->ctr[MTP_LNK_SLTM_TOUT]);
|
||||
|
||||
if (link->slta_misses == 0) {
|
||||
LOGP(DINP, LOGL_ERROR, "No SLTM response. Retrying. Link: %p\n", link);
|
||||
LOGP(DINP, LOGL_ERROR,
|
||||
"No SLTM response. Retrying. Link: %s/%d\n",
|
||||
link->set->name, link->link_no);
|
||||
++link->slta_misses;
|
||||
mtp_send_sltm(link);
|
||||
bsc_schedule_timer(&link->t1_timer, MTP_T1);
|
||||
} else {
|
||||
LOGP(DINP, LOGL_ERROR, "Two missing SLTAs. Restart link: %p\n", link);
|
||||
LOGP(DINP, LOGL_ERROR,
|
||||
"Two missing SLTAs. Restart link: %s/%d\n",
|
||||
link->set->name, link->link_no);
|
||||
bsc_del_timer(&link->t2_timer);
|
||||
mtp_link_failure(link);
|
||||
}
|
||||
|
@ -91,7 +95,9 @@ static void mtp_sltm_t2_timeout(void *_link)
|
|||
struct mtp_link *link = (struct mtp_link *) _link;
|
||||
|
||||
if (!link->set->running) {
|
||||
LOGP(DINP, LOGL_INFO, "The linkset is not active. Stopping SLTM now. %p\n", link);
|
||||
LOGP(DINP, LOGL_INFO,
|
||||
"The linkset is not active. Stopping SLTM now. %s/%d\n",
|
||||
link->set->name, link->link_no);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -163,7 +169,8 @@ int mtp_link_slta(struct mtp_link *link, uint16_t l3_len,
|
|||
|
||||
void mtp_link_failure(struct mtp_link *link)
|
||||
{
|
||||
LOGP(DINP, LOGL_ERROR, "Link has failed. Resetting it: 0x%p\n", link);
|
||||
LOGP(DINP, LOGL_ERROR, "Link has failed. Resetting it: %s/%d\n",
|
||||
link->set->name, link->link_no);
|
||||
rate_ctr_inc(&link->ctrg->ctr[MTP_LNK_ERROR]);
|
||||
link->reset(link);
|
||||
}
|
||||
|
|
Reference in New Issue