[gprs] Add new 'NS' and 'BSSGP' logging categories

This commit is contained in:
Harald Welte 2010-05-11 05:54:22 +02:00
parent d81856bc3d
commit b8a6a83be6
2 changed files with 44 additions and 44 deletions

View File

@ -188,7 +188,7 @@ int bssgp_tx_status(uint8_t cause, uint16_t *bvci, struct msgb *orig_msg)
struct bssgp_normal_hdr *bgph =
(struct bssgp_normal_hdr *) msgb_put(msg, sizeof(*bgph));
DEBUGPC(DGPRS, "BSSGP: TX STATUS, cause=%s\n", bssgp_cause_str(cause));
DEBUGPC(DBSSGP, "BSSGP: TX STATUS, cause=%s\n", bssgp_cause_str(cause));
msgb_nsei(msg) = msgb_nsei(orig_msg);
msgb_bvci(msg) = 0;
@ -223,7 +223,7 @@ static int bssgp_rx_bvc_reset(struct msgb *msg, struct tlv_parsed *tp,
int rc;
bvci = ntohs(*(uint16_t *)TLVP_VAL(tp, BSSGP_IE_BVCI));
DEBUGPC(DGPRS, "BVCI=%u, cause=%s\n", bvci,
DEBUGPC(DBSSGP, "BVCI=%u, cause=%s\n", bvci,
bssgp_cause_str(*TLVP_VAL(tp, BSSGP_IE_CAUSE)));
/* look-up or create the BTS context for this BVC */
@ -235,14 +235,14 @@ static int bssgp_rx_bvc_reset(struct msgb *msg, struct tlv_parsed *tp,
* informs us about its RAC + Cell ID, so we can create a mapping */
if (bvci != 0 && bvci != 1) {
if (!TLVP_PRESENT(tp, BSSGP_IE_CELL_ID)) {
LOGP(DGPRS, LOGL_ERROR, "BSSGP RESET BVCI=%u "
LOGP(DBSSGP, LOGL_ERROR, "BSSGP RESET BVCI=%u "
"missing mandatory IE\n", bvci);
return -EINVAL;
}
/* actually extract RAC / CID */
bctx->cell_id = bssgp_parse_cell_id(&bctx->ra_id,
TLVP_VAL(tp, BSSGP_IE_CELL_ID));
LOGP(DGPRS, LOGL_NOTICE, "Cell %u-%u-%u-%u CI %u on BVCI %u\n",
LOGP(DBSSGP, LOGL_NOTICE, "Cell %u-%u-%u-%u CI %u on BVCI %u\n",
bctx->ra_id.mcc, bctx->ra_id.mnc, bctx->ra_id.lac,
bctx->ra_id.rac, bctx->cell_id, bvci);
}
@ -261,7 +261,7 @@ static int bssgp_rx_ul_ud(struct msgb *msg)
struct tlv_parsed tp;
int rc;
DEBUGP(DGPRS, "BSSGP UL-UD\n");
DEBUGP(DBSSGP, "BSSGP UL-UD\n");
/* extract TLLI and parse TLV IEs */
msgb_tlli(msg) = ntohl(budh->tlli);
@ -289,7 +289,7 @@ static int bssgp_rx_suspend(struct msgb *msg)
struct tlv_parsed tp;
int rc;
DEBUGP(DGPRS, "BSSGP SUSPEND\n");
DEBUGP(DBSSGP, "BSSGP SUSPEND\n");
rc = bssgp_tlv_parse(&tp, bgph->data, data_len);
if (rc < 0)
@ -311,7 +311,7 @@ static int bssgp_rx_resume(struct msgb *msg)
struct tlv_parsed tp;
int rc;
DEBUGP(DGPRS, "BSSGP RESUME\n");
DEBUGP(DBSSGP, "BSSGP RESUME\n");
rc = bssgp_tlv_parse(&tp, bgph->data, data_len);
if (rc < 0)
@ -329,7 +329,7 @@ static int bssgp_rx_resume(struct msgb *msg)
static int bssgp_rx_fc_bvc(struct msgb *msg, struct tlv_parsed *tp)
{
DEBUGP(DGPRS, "BSSGP FC BVC\n");
DEBUGP(DBSSGP, "BSSGP FC BVC\n");
if (!TLVP_PRESENT(tp, BSSGP_IE_TAG) ||
!TLVP_PRESENT(tp, BSSGP_IE_BVC_BUCKET_SIZE) ||
@ -371,11 +371,11 @@ int gprs_bssgp_rcvmsg(struct msgb *msg)
break;
case BSSGP_PDUT_RA_CAPABILITY:
/* BSS requests RA capability or IMSI */
DEBUGP(DGPRS, "BSSGP RA CAPABILITY UPDATE\n");
DEBUGP(DBSSGP, "BSSGP RA CAPABILITY UPDATE\n");
/* FIXME: send RA_CAPA_UPDATE_ACK */
break;
case BSSGP_PDUT_RADIO_STATUS:
DEBUGP(DGPRS, "BSSGP RADIO STATUS\n");
DEBUGP(DBSSGP, "BSSGP RADIO STATUS\n");
/* BSS informs us of some exception */
/* FIXME: notify GMM */
break;
@ -389,13 +389,13 @@ int gprs_bssgp_rcvmsg(struct msgb *msg)
break;
case BSSGP_PDUT_FLUSH_LL:
/* BSS informs MS has moved to one cell to other cell */
DEBUGP(DGPRS, "BSSGP FLUSH LL\n");
DEBUGP(DBSSGP, "BSSGP FLUSH LL\n");
/* FIXME: notify GMM */
/* Send FLUSH_LL_ACK */
break;
case BSSGP_PDUT_LLC_DISCARD:
/* BSS informs that some LLC PDU's have been discarded */
DEBUGP(DGPRS, "BSSGP LLC DISCARDED\n");
DEBUGP(DBSSGP, "BSSGP LLC DISCARDED\n");
/* FIXME: notify GMM */
break;
case BSSGP_PDUT_FLOW_CONTROL_BVC:
@ -404,18 +404,18 @@ int gprs_bssgp_rcvmsg(struct msgb *msg)
break;
case BSSGP_PDUT_FLOW_CONTROL_MS:
/* BSS informs us of available bandwidth to one MS */
DEBUGP(DGPRS, "BSSGP FC MS\n");
DEBUGP(DBSSGP, "BSSGP FC MS\n");
/* FIXME: actually implement flow control */
/* FIXME: Send FLOW_CONTROL_MS_ACK */
break;
case BSSGP_PDUT_BVC_BLOCK:
/* BSS tells us that BVC shall be blocked */
DEBUGP(DGPRS, "BSSGP BVC BLOCK ");
DEBUGP(DBSSGP, "BSSGP BVC BLOCK ");
if (!TLVP_PRESENT(&tp, BSSGP_IE_BVCI) ||
!TLVP_PRESENT(&tp, BSSGP_IE_CAUSE))
goto err_mand_ie;
bvci = ntohs(*(uint16_t *)TLVP_VAL(&tp, BSSGP_IE_BVCI));
DEBUGPC(DGPRS, "BVCI=%u, cause=%s\n", bvci,
DEBUGPC(DBSSGP, "BVCI=%u, cause=%s\n", bvci,
bssgp_cause_str(*TLVP_VAL(&tp, BSSGP_IE_CAUSE)));
/* We always acknowledge the BLOCKing */
rc = bssgp_tx_simple_bvci(BSSGP_PDUT_BVC_BLOCK_ACK,
@ -423,18 +423,18 @@ int gprs_bssgp_rcvmsg(struct msgb *msg)
break;
case BSSGP_PDUT_BVC_UNBLOCK:
/* BSS tells us that BVC shall be unblocked */
DEBUGP(DGPRS, "BSSGP BVC UNBLOCK ");
DEBUGP(DBSSGP, "BSSGP BVC UNBLOCK ");
if (!TLVP_PRESENT(&tp, BSSGP_IE_BVCI))
goto err_mand_ie;
bvci = ntohs(*(uint16_t *)TLVP_VAL(&tp, BSSGP_IE_BVCI));
DEBUGPC(DGPRS, "BVCI=%u\n", bvci);
DEBUGPC(DBSSGP, "BVCI=%u\n", bvci);
/* We always acknowledge the unBLOCKing */
rc = bssgp_tx_simple_bvci(BSSGP_PDUT_BVC_UNBLOCK_ACK,
msgb_nsei(msg), bvci, ns_bvci);
break;
case BSSGP_PDUT_BVC_RESET:
/* BSS tells us that BVC init is required */
DEBUGP(DGPRS, "BSSGP BVC RESET ");
DEBUGP(DBSSGP, "BSSGP BVC RESET ");
if (!TLVP_PRESENT(&tp, BSSGP_IE_BVCI) ||
!TLVP_PRESENT(&tp, BSSGP_IE_CAUSE))
goto err_mand_ie;
@ -448,7 +448,7 @@ int gprs_bssgp_rcvmsg(struct msgb *msg)
case BSSGP_PDUT_CREATE_BSS_PFC_NACK:
case BSSGP_PDUT_MODIFY_BSS_PFC:
case BSSGP_PDUT_DELETE_BSS_PFC_ACK:
DEBUGP(DGPRS, "BSSGP PDU type 0x%02x not [yet] implemented\n",
DEBUGP(DBSSGP, "BSSGP PDU type 0x%02x not [yet] implemented\n",
pdu_type);
break;
/* those only exist in the SGSN -> BSS direction */
@ -466,12 +466,12 @@ int gprs_bssgp_rcvmsg(struct msgb *msg)
case BSSGP_PDUT_BVC_BLOCK_ACK:
case BSSGP_PDUT_BVC_UNBLOCK_ACK:
case BSSGP_PDUT_SGSN_INVOKE_TRACE:
DEBUGP(DGPRS, "BSSGP PDU type 0x%02x only exists in DL\n",
DEBUGP(DBSSGP, "BSSGP PDU type 0x%02x only exists in DL\n",
pdu_type);
rc = -EINVAL;
break;
default:
DEBUGP(DGPRS, "BSSGP PDU type 0x%02x unknown\n", pdu_type);
DEBUGP(DBSSGP, "BSSGP PDU type 0x%02x unknown\n", pdu_type);
break;
}
@ -496,7 +496,7 @@ int gprs_bssgp_tx_dl_ud(struct msgb *msg)
/* Identifiers from UP: TLLI, BVCI, NSEI (all in msgb->cb) */
if (bvci < 2) {
LOGP(DGPRS, LOGL_ERROR, "Cannot send DL-UD to BVCI %u\n",
LOGP(DBSSGP, LOGL_ERROR, "Cannot send DL-UD to BVCI %u\n",
bvci);
return -EINVAL;
}

View File

@ -160,7 +160,7 @@ static int gprs_ns_tx(struct gprs_nsvc *nsvc, struct msgb *msg)
ret = nsip_sendmsg(nsvc, msg);
break;
default:
LOGP(DGPRS, LOGL_ERROR, "unsupported NS linklayer %u\n", nsvc->nsi->ll);
LOGP(DNS, LOGL_ERROR, "unsupported NS linklayer %u\n", nsvc->nsi->ll);
msgb_free(msg);
ret = -EIO;
break;
@ -234,7 +234,7 @@ static void gprs_ns_timer_cb(void *data)
if (nsvc->alive_retries > NS_ALIVE_RETRIES) {
/* mark as dead and blocked */
nsvc->state = NSE_S_BLOCKED;
DEBUGP(DGPRS, "NSEI=%u Tns-alive expired more then "
DEBUGP(DNS, "NSEI=%u Tns-alive expired more then "
"%u times, blocking NS-VC\n", nsvc->nsei,
NS_ALIVE_RETRIES);
/* FIXME: inform higher layers */
@ -273,7 +273,7 @@ static int gprs_ns_tx_reset_ack(struct gprs_nsvc *nsvc)
nsh->pdu_type = NS_PDUT_RESET_ACK;
DEBUGP(DGPRS, "NSEI=%u Tx NS RESET ACK (NSVCI=%u)\n",
DEBUGP(DNS, "NSEI=%u Tx NS RESET ACK (NSVCI=%u)\n",
nsvc->nsei, nsvc->nsvci);
msgb_tvlv_put(msg, NS_IE_VCI, 2, (uint8_t *)&nsvci);
@ -291,25 +291,25 @@ int gprs_ns_sendmsg(struct gprs_ns_inst *nsi, struct msgb *msg)
nsvc = nsvc_by_nsei(nsi, msgb_nsei(msg));
if (!nsvc) {
LOGP(DGPRS, LOGL_ERROR, "Unable to resolve NSEI %u "
LOGP(DNS, LOGL_ERROR, "Unable to resolve NSEI %u "
"to NS-VC!\n", msgb_nsei(msg));
return -EINVAL;
}
if (!(nsvc->state & NSE_S_ALIVE)) {
LOGP(DGPRS, LOGL_ERROR, "NSEI=%u is not alive, cannot send\n",
LOGP(DNS, LOGL_ERROR, "NSEI=%u is not alive, cannot send\n",
nsvc->nsei);
return -EBUSY;
}
if (nsvc->state & NSE_S_BLOCKED) {
LOGP(DGPRS, LOGL_ERROR, "NSEI=%u is blocked, cannot send\n",
LOGP(DNS, LOGL_ERROR, "NSEI=%u is blocked, cannot send\n",
nsvc->nsei);
return -EBUSY;
}
nsh = (struct gprs_ns_hdr *) msgb_push(msg, sizeof(*nsh) + 3);
if (!nsh) {
LOGP(DGPRS, LOGL_ERROR, "Not enough headroom for NS header\n");
LOGP(DNS, LOGL_ERROR, "Not enough headroom for NS header\n");
return -EIO;
}
@ -344,17 +344,17 @@ static int gprs_ns_rx_status(struct gprs_nsvc *nsvc, struct msgb *msg)
uint8_t cause;
int rc;
DEBUGP(DGPRS, "NSEI=%u NS STATUS ", nsvc->nsei);
DEBUGP(DNS, "NSEI=%u NS STATUS ", nsvc->nsei);
rc = tlv_parse(&tp, &ns_att_tlvdef, nsh->data, msgb_l2len(msg), 0, 0);
if (!TLVP_PRESENT(&tp, NS_IE_CAUSE)) {
DEBUGPC(DGPRS, "missing cause IE\n");
DEBUGPC(DNS, "missing cause IE\n");
return -EINVAL;
}
cause = *TLVP_VAL(&tp, NS_IE_CAUSE);
DEBUGPC(DGPRS, "cause=%s\n", gprs_ns_cause_str(cause));
DEBUGPC(DNS, "cause=%s\n", gprs_ns_cause_str(cause));
return 0;
}
@ -374,7 +374,7 @@ static int gprs_ns_rx_reset(struct gprs_nsvc *nsvc, struct msgb *msg)
!TLVP_PRESENT(&tp, NS_IE_VCI) ||
!TLVP_PRESENT(&tp, NS_IE_NSEI)) {
/* FIXME: respond with NS_CAUSE_MISSING_ESSENT_IE */
LOGP(DGPRS, LOGL_ERROR, "NS RESET Missing mandatory IE\n");
LOGP(DNS, LOGL_ERROR, "NS RESET Missing mandatory IE\n");
return -EINVAL;
}
@ -382,7 +382,7 @@ static int gprs_ns_rx_reset(struct gprs_nsvc *nsvc, struct msgb *msg)
nsvci = (uint16_t *) TLVP_VAL(&tp, NS_IE_VCI);
nsei = (uint16_t *) TLVP_VAL(&tp, NS_IE_NSEI);
DEBUGP(DGPRS, "NSEI=%u NS RESET (NSVCI=%u, cause=%s)\n",
DEBUGP(DNS, "NSEI=%u NS RESET (NSVCI=%u, cause=%s)\n",
nsvc->nsvci, nsvc->nsei, gprs_ns_cause_str(*cause));
nsvc->state = NSE_S_BLOCKED | NSE_S_ALIVE;
@ -409,13 +409,13 @@ int gprs_ns_rcvmsg(struct gprs_ns_inst *nsi, struct msgb *msg,
if (!nsvc) {
/* Only the RESET procedure creates a new NSVC */
if (nsh->pdu_type != NS_PDUT_RESET) {
LOGP(DGPRS, LOGL_INFO, "Ignoring NS PDU type 0x%0x "
LOGP(DNS, LOGL_INFO, "Ignoring NS PDU type 0x%0x "
"from %s for non-existing NS-VC\n",
nsh->pdu_type, inet_ntoa(saddr->sin_addr));
//gprs_ns_tx_reset(nsvc, NS_CAUSE_NSVC_UNKNOWN);
return -EIO;
}
LOGP(DGPRS, LOGL_INFO, "Creating NS-VC for BSS at %s:%u\n",
LOGP(DNS, LOGL_INFO, "Creating NS-VC for BSS at %s:%u\n",
inet_ntoa(saddr->sin_addr), ntohs(saddr->sin_port));
nsvc = nsvc_create(nsi, 0xffff);
nsvc->ip.bts_addr = *saddr;
@ -450,7 +450,7 @@ int gprs_ns_rcvmsg(struct gprs_ns_inst *nsi, struct msgb *msg,
rc = gprs_ns_rx_reset(nsvc, msg);
break;
case NS_PDUT_RESET_ACK:
DEBUGP(DGPRS, "NSEI=%u Rx NS RESET ACK\n", nsvc->nsei);
DEBUGP(DNS, "NSEI=%u Rx NS RESET ACK\n", nsvc->nsei);
/* mark remote NS-VC as blocked + active */
nsvc->remote_state = NSE_S_BLOCKED | NSE_S_ALIVE;
if (nsvc->remote_end_is_sgsn) {
@ -465,29 +465,29 @@ int gprs_ns_rcvmsg(struct gprs_ns_inst *nsi, struct msgb *msg,
break;
case NS_PDUT_UNBLOCK:
/* Section 7.2: unblocking procedure */
DEBUGP(DGPRS, "NSEI=%u Rx NS UNBLOCK\n", nsvc->nsei);
DEBUGP(DNS, "NSEI=%u Rx NS UNBLOCK\n", nsvc->nsei);
nsvc->state &= ~NSE_S_BLOCKED;
rc = gprs_ns_tx_simple(nsvc, NS_PDUT_UNBLOCK_ACK);
break;
case NS_PDUT_UNBLOCK_ACK:
DEBUGP(DGPRS, "NSEI=%u Rx NS UNBLOCK ACK\n", nsvc->nsei);
DEBUGP(DNS, "NSEI=%u Rx NS UNBLOCK ACK\n", nsvc->nsei);
/* mark remote NS-VC as unblocked + active */
nsvc->remote_state = NSE_S_ALIVE;
if (nsvc->remote_end_is_sgsn)
nsvc->state = NSE_S_ALIVE;
break;
case NS_PDUT_BLOCK:
DEBUGP(DGPRS, "NSEI=%u Rx NS BLOCK\n", nsvc->nsei);
DEBUGP(DNS, "NSEI=%u Rx NS BLOCK\n", nsvc->nsei);
nsvc->state |= NSE_S_BLOCKED;
rc = gprs_ns_tx_simple(nsvc, NS_PDUT_UNBLOCK_ACK);
break;
case NS_PDUT_BLOCK_ACK:
DEBUGP(DGPRS, "NSEI=%u Rx NS BLOCK ACK\n", nsvc->nsei);
DEBUGP(DNS, "NSEI=%u Rx NS BLOCK ACK\n", nsvc->nsei);
/* mark remote NS-VC as blocked + active */
nsvc->remote_state = NSE_S_BLOCKED | NSE_S_ALIVE;
break;
default:
DEBUGP(DGPRS, "NSEI=%u Rx Unknown NS PDU type 0x%02x\n",
DEBUGP(DNS, "NSEI=%u Rx Unknown NS PDU type 0x%02x\n",
nsvc->nsei, nsh->pdu_type);
rc = -EINVAL;
break;
@ -533,7 +533,7 @@ static struct msgb *read_nsip_msg(struct bsc_fd *bfd, int *error,
ret = recvfrom(bfd->fd, msg->data, NS_ALLOC_SIZE, 0,
(struct sockaddr *)saddr, &saddr_len);
if (ret < 0) {
LOGP(DGPRS, LOGL_ERROR, "recv error %s during NSIP recv\n",
LOGP(DNS, LOGL_ERROR, "recv error %s during NSIP recv\n",
strerror(errno));
msgb_free(msg);
*error = ret;
@ -634,7 +634,7 @@ struct gprs_nsvc *nsip_connect(struct gprs_ns_inst *nsi,
/* Initiate a RESET procedure */
if (gprs_ns_tx_reset(nsvc, NS_CAUSE_OM_INTERVENTION) < 0) {
LOGP(DGPRS, LOGL_ERROR, "NSEI=%u, error resetting NS-VC\n",
LOGP(DNS, LOGL_ERROR, "NSEI=%u, error resetting NS-VC\n",
nsei);
}
/* run a timer and re-transmit the reset request? */