Compare commits

...

4 Commits

Author SHA1 Message Date
Andreas Eversberg
2a2ea42fca Create NS instance at startup time and open/close it at BTS start/stop
The NS instance must be created at startup time before the config is
parsed, so the NS VTY elements will exist at this point. The NS instance
must persist.

Then during BTS start, the NS instance is opened/bound/connected to the
socket that is specified by BTS.

Then during BTS stop, the NS instance is closed, but the NS instance sill
exists.

At PCU stop, the NS instance is completely destroyed.
2013-06-30 10:12:01 +02:00
Andreas Eversberg
65d589bb24 Set debug level for CSN1 to ERROR
This is a workarround. It would be better to:

1. Actually do not save disabled log categories to config

Libosmocore saves all disabled log categories (see config_write_log_single).
This will cause these categories to be enabled after parsing config.

2. Change all CSN1 debug levels to DEBUG.
2013-06-30 09:17:57 +02:00
Andreas Eversberg
047a1a5e39 Add and set NS and BSSGP debugging category at libosmogb 2013-06-30 09:13:34 +02:00
Andreas Eversberg
2d4a477a0f Fix debugging the correct single block allocation frame number 2013-06-30 09:08:31 +02:00
6 changed files with 26 additions and 19 deletions

View File

@@ -468,7 +468,7 @@ int bssgp_prim_cb(struct osmo_prim_hdr *oph, void *ctx)
return 0;
}
static int sgsn_ns_cb(enum gprs_ns_evt event, struct gprs_nsvc *nsvc, struct msgb *msg, uint16_t bvci)
int sgsn_ns_cb(enum gprs_ns_evt event, struct gprs_nsvc *nsvc, struct msgb *msg, uint16_t bvci)
{
int rc = 0;
switch (event) {
@@ -590,18 +590,11 @@ int gprs_bssgp_create(uint16_t local_port, uint32_t sgsn_ip,
if (bctx)
return 0; /* if already created, must return 0: no error */
bssgp_nsi = gprs_ns_instantiate(&sgsn_ns_cb, tall_pcu_ctx);
if (!bssgp_nsi) {
LOGP(DBSSGP, LOGL_ERROR, "Failed to create NS instance\n");
return -EINVAL;
}
gprs_ns_vty_init(bssgp_nsi);
bssgp_nsi->nsip.local_port = local_port;
rc = gprs_ns_nsip_listen(bssgp_nsi);
if (rc < 0) {
LOGP(DBSSGP, LOGL_ERROR, "Failed to create socket\n");
gprs_ns_destroy(bssgp_nsi);
bssgp_nsi = NULL;
gprs_ns_close(bssgp_nsi);
return -EINVAL;
}
@@ -612,17 +605,16 @@ int gprs_bssgp_create(uint16_t local_port, uint32_t sgsn_ip,
nsvc = gprs_ns_nsip_connect(bssgp_nsi, &dest, nsei, nsvci);
if (!nsvc) {
LOGP(DBSSGP, LOGL_ERROR, "Failed to create NSVCt\n");
gprs_ns_destroy(bssgp_nsi);
bssgp_nsi = NULL;
gprs_ns_close(bssgp_nsi);
return -EINVAL;
}
bctx = btsctx_alloc(bvci, nsei);
if (!bctx) {
LOGP(DBSSGP, LOGL_ERROR, "Failed to create BSSGP context\n");
gprs_nsvc_delete(nsvc);
nsvc = NULL;
gprs_ns_destroy(bssgp_nsi);
bssgp_nsi = NULL;
gprs_ns_close(bssgp_nsi);
return -EINVAL;
}
bctx->ra_id.mcc = spoof_mcc ? : mcc;
@@ -637,13 +629,12 @@ int gprs_bssgp_create(uint16_t local_port, uint32_t sgsn_ip,
bvc_timer.cb = bvc_timeout;
return 0;
}
void gprs_bssgp_destroy(void)
{
if (!bssgp_nsi)
if (!bctx)
return;
if (osmo_timer_pending(&bvc_timer))
@@ -651,6 +642,7 @@ void gprs_bssgp_destroy(void)
osmo_signal_unregister_handler(SS_L_NS, nsvc_signal_cb, NULL);
gprs_nsvc_delete(nsvc);
nsvc = NULL;
/* FIXME: move this to libgb: btsctx_free() */
@@ -660,7 +652,6 @@ void gprs_bssgp_destroy(void)
/* FIXME: blocking... */
gprs_ns_destroy(bssgp_nsi);
bssgp_nsi = NULL;
gprs_ns_close(bssgp_nsi);
}

View File

@@ -51,6 +51,8 @@ int gprs_bssgp_pcu_rx_sign(struct msgb *msg, struct tlv_parsed *tp, struct bssgp
int gprs_bssgp_pcu_rcvmsg(struct msgb *msg);
int sgsn_ns_cb(enum gprs_ns_evt event, struct gprs_nsvc *nsvc, struct msgb *msg, uint16_t bvci);
int gprs_bssgp_create(uint16_t local_port, uint32_t sgsn_ip, uint16_t
sgsn_port, uint16_t nsei, uint16_t nsvci, uint16_t bvci,
uint16_t mcc, uint16_t mnc, uint16_t lac, uint16_t rac,

View File

@@ -33,7 +33,7 @@
/* default categories */
static const struct log_info_cat default_categories[] = {
{"DCSN1", "\033[1;31m", "Concrete Syntax Notation One (CSN1)", LOGL_INFO, 0},
{"DCSN1", "\033[1;31m", "Concrete Syntax Notation One (CSN1)", LOGL_ERROR, 0},
{"DL1IF", "\033[1;32m", "GPRS PCU L1 interface (L1IF)", LOGL_INFO, 1},
{"DRLCMAC", "\033[0;33m", "GPRS RLC/MAC layer (RLCMAC)", LOGL_NOTICE, 1},
{"DRLCMACDATA", "\033[0;33m", "GPRS RLC/MAC layer Data (RLCMAC)", LOGL_NOTICE, 1},
@@ -41,6 +41,7 @@ static const struct log_info_cat default_categories[] = {
{"DRLCMACUL", "\033[1;36m", "GPRS RLC/MAC layer Uplink (RLCMAC)", LOGL_NOTICE, 1},
{"DRLCMACSCHED", "\033[0;36m", "GPRS RLC/MAC layer Scheduling (RLCMAC)", LOGL_NOTICE, 1},
{"DRLCMACMEAS", "\033[1;31m", "GPRS RLC/MAC layer Measurements (RLCMAC)", LOGL_INFO, 1},
{"DNS","\033[0;34m", "GPRS Network Service (NS)", LOGL_INFO , 1},
{"DBSSGP","\033[1;34m", "GPRS BSS Gateway Protocol (BSSGP)", LOGL_INFO , 1},
{"DPCU", "\033[1;35m", "GPRS Packet Control Unit (PCU)", LOGL_NOTICE, 1},
};

View File

@@ -39,6 +39,7 @@ enum {
DRLCMACUL,
DRLCMACSCHED,
DRLCMACMEAS,
DNS,
DBSSGP,
DPCU,
aDebug_LastEntry

View File

@@ -257,7 +257,7 @@ int gprs_rlcmac_rcv_rts_block(uint8_t trx, uint8_t ts, uint16_t arfcn,
? "UL" : "DL", poll_tbf->tfi);
/* use free USF */
/* else. check for sba */
else if ((sba_fn = sched_sba(trx, ts, fn, block_nr) != 0xffffffff))
else if ((sba_fn = sched_sba(trx, ts, fn, block_nr)) != 0xffffffff)
LOGP(DRLCMACSCHED, LOGL_DEBUG, "Received RTS for PDCH: TRX=%d "
"TS=%d FN=%d block_nr=%d scheduling free USF for "
"single block allocation at FN=%d\n", trx, ts, fn,

View File

@@ -178,10 +178,19 @@ int main(int argc, char *argv[])
msgb_set_talloc_ctx(tall_pcu_ctx);
osmo_init_logging(&gprs_log_info);
bssgp_set_log_ss(DBSSGP);
gprs_ns_set_log_ss(DNS);
vty_init(&pcu_vty_info);
pcu_vty_init(&gprs_log_info);
bssgp_nsi = gprs_ns_instantiate(&sgsn_ns_cb, tall_pcu_ctx);
if (!bssgp_nsi) {
LOGP(DBSSGP, LOGL_ERROR, "Failed to create NS instance\n");
return -EINVAL;
}
gprs_ns_vty_init(bssgp_nsi);
handle_options(argc, argv);
if ((!!spoof_mcc) + (!!spoof_mnc) == 1) {
fprintf(stderr, "--mcc and --mnc must be specified "
@@ -248,6 +257,9 @@ int main(int argc, char *argv[])
pcu_l1if_close();
gprs_ns_destroy(bssgp_nsi);
bssgp_nsi = NULL;
flush_timing_advance();
talloc_free(gprs_rlcmac_bts);