aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-10-27 16:39:36 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-10-30 21:24:13 +0100
commitbd449f57a7914f3929a6b5be1cb31271db2ed1c0 (patch)
treee0ff7c89b8684f6e7427a622ee050c44d27e8c3b
parent870c601f1d7079ee1d0a1bf2a1bc1ccccbe4327b (diff)
tbf: Create tbf_name and use it in log statements
This is like gsm_lchan_name and should be used in log statements. This way we can easily change the information that is printed and we know how to search things. The other part is that direct use of tfi/tlli is removed which will allow us to make them private and at the same time start to resolve the "tlli" updated in many places. Not old log statements are changed yet. This will done whenever a bad log statement is seen on the console...
-rw-r--r--src/bts.cpp38
-rw-r--r--src/gprs_rlcmac.cpp2
-rw-r--r--src/tbf.cpp121
-rw-r--r--src/tbf.h2
4 files changed, 84 insertions, 79 deletions
diff --git a/src/bts.cpp b/src/bts.cpp
index 9518b197..2357e071 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -165,18 +165,16 @@ int BTS::add_paging(uint8_t chan_needed, uint8_t *identity_lv)
}
/* mark first slot found, if none is marked already */
if (ts == 8 && first_ts >= 0) {
- LOGP(DRLCMAC, LOGL_DEBUG, "- %s TFI=%d uses "
+ LOGP(DRLCMAC, LOGL_DEBUG, "- %s uses "
"TRX=%d TS=%d, so we mark\n",
- (tbf->direction == GPRS_RLCMAC_UL_TBF)
- ? "UL" : "DL",
- tbf->tfi, tbf->trx->trx_no, first_ts);
+ tbf_name(tbf),
+ tbf->trx->trx_no, first_ts);
slot_mask[tbf->trx->trx_no] |= (1 << first_ts);
} else
- LOGP(DRLCMAC, LOGL_DEBUG, "- %s TFI=%d uses "
+ LOGP(DRLCMAC, LOGL_DEBUG, "- %s uses "
"already marked TRX=%d TS=%d\n",
- (tbf->direction == GPRS_RLCMAC_UL_TBF)
- ? "UL" : "DL",
- tbf->tfi, tbf->trx->trx_no, ts);
+ tbf_name(tbf),
+ tbf->trx->trx_no, ts);
}
}
@@ -464,9 +462,7 @@ void BTS::trigger_dl_ass(
/* check for downlink tbf: */
if (old_tbf) {
LOGP(DRLCMAC, LOGL_DEBUG, "Send dowlink assignment on "
- "PACCH, because %s TFI=%d exists for TLLI=0x%08x\n",
- (old_tbf->direction == GPRS_RLCMAC_UL_TBF)
- ? "UL" : "DL", old_tbf->tfi, old_tbf->tlli);
+ "PACCH, because %s exists\n", tbf_name(old_tbf));
old_tbf->dl_ass_state = GPRS_RLCMAC_DL_ASS_SEND_ASS;
/* use TA from old TBF */
tbf->ta = old_tbf->ta;
@@ -476,7 +472,7 @@ void BTS::trigger_dl_ass(
/* start timer */
tbf_timer_start(tbf, 0, Tassign_pacch);
} else {
- LOGP(DRLCMAC, LOGL_DEBUG, "Send dowlink assignment for TFI=%d on PCH, no TBF exist (IMSI=%s)\n", tbf->tfi, imsi);
+ LOGP(DRLCMAC, LOGL_DEBUG, "Send dowlink assignment for %s on PCH, no TBF exist (IMSI=%s)\n", tbf_name(tbf), imsi);
if (!imsi || strlen(imsi) < 3) {
LOGP(DRLCMAC, LOGL_ERROR, "No valid IMSI!\n");
return;
@@ -496,7 +492,7 @@ void BTS::snd_dl_ass(gprs_rlcmac_tbf *tbf, uint8_t poll, const char *imsi)
int plen;
debug_diagram(this, tbf->diag, "IMM.ASS (PCH)");
- LOGP(DRLCMAC, LOGL_INFO, "TX: START TFI: %u TLLI: 0x%08x Immediate Assignment Downlink (PCH)\n", tbf->tfi, tbf->tlli);
+ LOGP(DRLCMAC, LOGL_INFO, "TX: START %s Immediate Assignment Downlink (PCH)\n", tbf_name(tbf));
bitvec *immediate_assignment = bitvec_alloc(22); /* without plen */
bitvec_unhex(immediate_assignment, "2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b");
/* use request reference that has maximum distance to current time,
@@ -887,12 +883,12 @@ void gprs_rlcmac_pdch::rcv_control_ack(Packet_Control_Acknowledgement_t *packet,
#warning "Silent TLLI changes... update TA.. and other structs"
tbf->tlli = tlli;
}
- LOGP(DRLCMAC, LOGL_DEBUG, "RX: [PCU <- BTS] TFI: %u TLLI: 0x%08x Packet Control Ack\n", tbf->tfi, tbf->tlli);
+ LOGP(DRLCMAC, LOGL_DEBUG, "RX: [PCU <- BTS] %s Packet Control Ack\n", tbf_name(tbf));
tbf->poll_state = GPRS_RLCMAC_POLL_NONE;
/* check if this control ack belongs to packet uplink ack */
if (tbf->ul_ack_state == GPRS_RLCMAC_UL_ACK_WAIT_ACK) {
- LOGP(DRLCMAC, LOGL_DEBUG, "TBF: [UPLINK] END TFI: %u TLLI: 0x%08x \n", tbf->tfi, tbf->tlli);
+ LOGP(DRLCMAC, LOGL_DEBUG, "TBF: [UPLINK] END %s\n", tbf_name(tbf));
tbf->ul_ack_state = GPRS_RLCMAC_UL_ACK_NONE;
debug_diagram(bts(), tbf->diag, "got CTL-ACK (fin)");
if ((tbf->state_flags &
@@ -900,13 +896,13 @@ void gprs_rlcmac_pdch::rcv_control_ack(Packet_Control_Acknowledgement_t *packet,
tbf->state_flags &=
~(1 << GPRS_RLCMAC_FLAG_TO_UL_ACK);
LOGP(DRLCMAC, LOGL_NOTICE, "Recovered uplink "
- "ack for UL TFI=%d\n", tbf->tfi);
+ "ack for UL %s\n", tbf_name(tbf));
}
tbf_free(tbf);
return;
}
if (tbf->dl_ass_state == GPRS_RLCMAC_DL_ASS_WAIT_ACK) {
- LOGP(DRLCMAC, LOGL_DEBUG, "TBF: [UPLINK] DOWNLINK ASSIGNED TFI: %u TLLI: 0x%08x \n", tbf->tfi, tbf->tlli);
+ LOGP(DRLCMAC, LOGL_DEBUG, "TBF: [UPLINK] DOWNLINK ASSIGNED %s\n", tbf_name(tbf));
/* reset N3105 */
tbf->n3105 = 0;
tbf->dl_ass_state = GPRS_RLCMAC_DL_ASS_NONE;
@@ -934,7 +930,7 @@ void gprs_rlcmac_pdch::rcv_control_ack(Packet_Control_Acknowledgement_t *packet,
return;
}
if (tbf->ul_ass_state == GPRS_RLCMAC_UL_ASS_WAIT_ACK) {
- LOGP(DRLCMAC, LOGL_DEBUG, "TBF: [DOWNLINK] UPLINK ASSIGNED TFI: %u TLLI: 0x%08x \n", tbf->tfi, tbf->tlli);
+ LOGP(DRLCMAC, LOGL_DEBUG, "TBF: [DOWNLINK] UPLINK ASSIGNED %s\n", tbf_name(tbf));
/* reset N3105 */
tbf->n3105 = 0;
tbf->ul_ass_state = GPRS_RLCMAC_UL_ASS_NONE;
@@ -954,7 +950,7 @@ void gprs_rlcmac_pdch::rcv_control_ack(Packet_Control_Acknowledgement_t *packet,
tbf->state_flags &=
~(1 << GPRS_RLCMAC_FLAG_TO_UL_ASS);
LOGP(DRLCMAC, LOGL_NOTICE, "Recovered uplink "
- "assignment for UL TFI=%d\n", tbf->tfi);
+ "assignment for UL %s\n", tbf_name(tbf));
}
tbf_assign_control_ts(tbf);
return;
@@ -991,7 +987,7 @@ void gprs_rlcmac_pdch::rcv_control_dl_ack_nack(Packet_Downlink_Ack_Nack_t *ack_n
/* reset N3105 */
tbf->n3105 = 0;
tbf->stop_t3191();
- LOGP(DRLCMAC, LOGL_DEBUG, "RX: [PCU <- BTS] TFI: %u TLLI: 0x%08x Packet Downlink Ack/Nack\n", tbf->tfi, tbf->tlli);
+ LOGP(DRLCMAC, LOGL_DEBUG, "RX: [PCU <- BTS] %s Packet Downlink Ack/Nack\n", tbf_name(tbf));
tbf->poll_state = GPRS_RLCMAC_POLL_NONE;
debug_diagram(bts(), tbf->diag, "got DL-ACK");
@@ -1093,7 +1089,7 @@ void gprs_rlcmac_pdch::rcv_resource_request(Packet_Resource_Request_t *request,
}
}
- LOGP(DRLCMAC, LOGL_ERROR, "RX: [PCU <- BTS] %s TFI: %u TLLI: 0x%08x FIXME: Packet resource request\n", (tbf->direction == GPRS_RLCMAC_UL_TBF) ? "UL" : "DL", tbf->tfi, tbf->tlli);
+ LOGP(DRLCMAC, LOGL_ERROR, "RX: [PCU <- BTS] %s FIXME: Packet resource request\n", tbf_name(tbf));
}
void gprs_rlcmac_pdch::rcv_measurement_report(Packet_Measurement_Report_t *report, uint32_t fn)
diff --git a/src/gprs_rlcmac.cpp b/src/gprs_rlcmac.cpp
index 8abe4752..d11e37e5 100644
--- a/src/gprs_rlcmac.cpp
+++ b/src/gprs_rlcmac.cpp
@@ -121,7 +121,7 @@ int gprs_rlcmac_tx_ul_ud(gprs_rlcmac_tbf *tbf)
unsigned msg_len = NS_HDR_LEN + BSSGP_HDR_LEN + tbf->llc_index;
struct bssgp_bvc_ctx *bctx = gprs_bssgp_pcu_current_bctx();
- LOGP(DBSSGP, LOGL_INFO, "LLC [PCU -> SGSN] TFI: %u TLLI: 0x%08x len=%d\n", tbf->tfi, tbf->tlli, tbf->llc_index);
+ LOGP(DBSSGP, LOGL_INFO, "LLC [PCU -> SGSN] %s len=%d\n", tbf_name(tbf), tbf->llc_index);
if (!bctx) {
LOGP(DBSSGP, LOGL_ERROR, "No bctx\n");
return -EIO;
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 43b13ef6..143cdcdb 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -91,10 +91,11 @@ static int tbf_append_data(struct gprs_rlcmac_tbf *tbf,
const uint16_t pdu_delay_csec,
const uint8_t *data, const uint16_t len)
{
- LOGP(DRLCMAC, LOGL_INFO, "TBF: APPEND TFI: %u TLLI: 0x%08x\n", tbf->tfi, tbf->tlli);
+ LOGP(DRLCMAC, LOGL_INFO, "%s append\n", tbf_name(tbf));
if (tbf->state_is(GPRS_RLCMAC_WAIT_RELEASE)) {
- LOGP(DRLCMAC, LOGL_DEBUG, "TBF in WAIT RELEASE state "
- "(T3193), so reuse TBF\n");
+ LOGP(DRLCMAC, LOGL_DEBUG,
+ "%s in WAIT RELEASE state "
+ "(T3193), so reuse TBF\n", tbf_name(tbf));
memcpy(tbf->llc_frame, data, len);
tbf->llc_length = len;
/* reset rlc states */
@@ -198,9 +199,7 @@ static int tbf_new_dl_assignment(struct gprs_rlcmac_bts *bts,
tbf->tlli_valid = 1;
tbf->ta = ta;
- LOGP(DRLCMAC, LOGL_DEBUG,
- "TBF: [DOWNLINK] START TFI: %d TLLI: 0x%08x \n",
- tbf->tfi, tbf->tlli);
+ LOGP(DRLCMAC, LOGL_DEBUG, "%s [DOWNLINK] START\n", tbf_name(tbf));
/* new TBF, so put first frame */
memcpy(tbf->llc_frame, data, len);
@@ -309,19 +308,19 @@ void tbf_free(struct gprs_rlcmac_tbf *tbf)
debug_diagram(tbf->bts, tbf->diag, "+---------------+");
debug_diagram(tbf->bts, tbf->diag, "| THE END |");
debug_diagram(tbf->bts, tbf->diag, "+---------------+");
- LOGP(DRLCMAC, LOGL_INFO, "Free %s TFI=%d with TLLI=0x%08x.\n",
- (tbf->direction == GPRS_RLCMAC_UL_TBF) ? "UL" : "DL", tbf->tfi,
- tbf->tlli);
+ LOGP(DRLCMAC, LOGL_INFO, "%s free\n", tbf_name(tbf));
if (tbf->ul_ass_state != GPRS_RLCMAC_UL_ASS_NONE)
- LOGP(DRLCMAC, LOGL_ERROR, "Software error: Pending uplink "
+ LOGP(DRLCMAC, LOGL_ERROR, "%s Software error: Pending uplink "
"assignment. This may not happen, because the "
"assignment message never gets transmitted. Please "
- "be sure not to free in this state. PLEASE FIX!\n");
+ "be sure not to free in this state. PLEASE FIX!\n",
+ tbf_name(tbf));
if (tbf->dl_ass_state != GPRS_RLCMAC_DL_ASS_NONE)
- LOGP(DRLCMAC, LOGL_ERROR, "Software error: Pending downlink "
+ LOGP(DRLCMAC, LOGL_ERROR, "%s Software error: Pending downlink "
"assignment. This may not happen, because the "
"assignment message never gets transmitted. Please "
- "be sure not to free in this state. PLEASE FIX!\n");
+ "be sure not to free in this state. PLEASE FIX!\n",
+ tbf_name(tbf));
tbf->stop_timer();
#warning "TODO: Could/Should generate bssgp_tx_llc_discarded"
while ((msg = msgb_dequeue(&tbf->llc_queue))) {
@@ -395,8 +394,8 @@ void tbf_new_state(struct gprs_rlcmac_tbf *tbf,
enum gprs_rlcmac_tbf_state state)
{
debug_diagram(tbf->bts, tbf->diag, "->%s", tbf_state_name[state]);
- LOGP(DRLCMAC, LOGL_DEBUG, "%s TFI=%d changes state from %s to %s\n",
- (tbf->direction == GPRS_RLCMAC_UL_TBF) ? "UL" : "DL", tbf->tfi,
+ LOGP(DRLCMAC, LOGL_DEBUG, "%s changes state from %s to %s\n",
+ tbf_name(tbf),
tbf_state_name[tbf->state], tbf_state_name[state]);
tbf->set_state(state);
}
@@ -405,14 +404,12 @@ void tbf_timer_start(struct gprs_rlcmac_tbf *tbf, unsigned int T,
unsigned int seconds, unsigned int microseconds)
{
if (!osmo_timer_pending(&tbf->timer))
- LOGP(DRLCMAC, LOGL_DEBUG, "Starting %s TFI=%d timer %u.\n",
- (tbf->direction == GPRS_RLCMAC_UL_TBF) ? "UL" : "DL",
- tbf->tfi, T);
+ LOGP(DRLCMAC, LOGL_DEBUG, "%s starting timer %u.\n",
+ tbf_name(tbf), T);
else
- LOGP(DRLCMAC, LOGL_DEBUG, "Restarting %s TFI=%d timer %u "
+ LOGP(DRLCMAC, LOGL_DEBUG, "%s restarting timer %u "
"while old timer %u pending \n",
- (tbf->direction == GPRS_RLCMAC_UL_TBF) ? "UL" : "DL",
- tbf->tfi, T, tbf->T);
+ tbf_name(tbf), T, tbf->T);
tbf->T = T;
tbf->num_T_exp = 0;
@@ -432,16 +429,16 @@ void gprs_rlcmac_tbf::stop_t3191()
void gprs_rlcmac_tbf::stop_timer()
{
if (osmo_timer_pending(&timer)) {
- LOGP(DRLCMAC, LOGL_DEBUG, "Stopping %s TFI=%d timer %u.\n",
- (direction == GPRS_RLCMAC_UL_TBF) ? "UL" : "DL", tfi, T);
+ LOGP(DRLCMAC, LOGL_DEBUG, "%s stopping timer %u.\n",
+ tbf_name(this), T);
osmo_timer_del(&timer);
}
}
void gprs_rlcmac_tbf::poll_timeout()
{
- LOGP(DRLCMAC, LOGL_NOTICE, "Poll timeout for %s TFI=%d\n",
- (direction == GPRS_RLCMAC_UL_TBF) ? "UL" : "DL", tfi);
+ LOGP(DRLCMAC, LOGL_NOTICE, "%s poll timeout\n",
+ tbf_name(this));
poll_state = GPRS_RLCMAC_POLL_NONE;
@@ -632,8 +629,8 @@ static void tbf_timer_cb(void *_tbf)
void gprs_rlcmac_tbf::handle_timeout()
{
- LOGP(DRLCMAC, LOGL_DEBUG, "%s TFI=%d timer %u expired.\n",
- (direction == GPRS_RLCMAC_UL_TBF) ? "UL" : "DL", tfi, T);
+ LOGP(DRLCMAC, LOGL_DEBUG, "%s timer %u expired.\n",
+ tbf_name(this), T);
num_T_exp++;
@@ -641,12 +638,12 @@ void gprs_rlcmac_tbf::handle_timeout()
case 0: /* assignment */
if ((state_flags & (1 << GPRS_RLCMAC_FLAG_PACCH))) {
if (state_is(GPRS_RLCMAC_ASSIGN)) {
- LOGP(DRLCMAC, LOGL_NOTICE, "TFI=%d releasing due to "
- "PACCH assignment timeout.\n", tfi);
+ LOGP(DRLCMAC, LOGL_NOTICE, "%s releasing due to "
+ "PACCH assignment timeout.\n", tbf_name(this));
tbf_free(this);
} else
- LOGP(DRLCMAC, LOGL_ERROR, "Error: TBF TFI=%d is not "
- "in assign state\n", tfi);
+ LOGP(DRLCMAC, LOGL_ERROR, "Error: %s is not "
+ "in assign state\n", tbf_name(this));
}
if ((state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH))) {
/* change state to FLOW, so scheduler will start transmission */
@@ -655,28 +652,28 @@ void gprs_rlcmac_tbf::handle_timeout()
tbf_new_state(this, GPRS_RLCMAC_FLOW);
tbf_assign_control_ts(this);
} else
- LOGP(DRLCMAC, LOGL_NOTICE, "TFI=%d Continue flow after "
- "IMM.ASS confirm\n", tfi);
+ LOGP(DRLCMAC, LOGL_NOTICE, "%s Continue flow after "
+ "IMM.ASS confirm\n", tbf_name(this));
}
break;
case 3169:
case 3191:
case 3195:
- LOGP(DRLCMAC, LOGL_NOTICE, "TBF TFI=%d TLLI=0x%08x T%d timeout during "
- "transsmission\n", tfi, tlli, T);
+ LOGP(DRLCMAC, LOGL_NOTICE, "%s T%d timeout during "
+ "transsmission\n", tbf_name(this), T);
rlcmac_diag();
/* fall through */
case 3193:
if (T == 3193)
debug_diagram(bts, diag, "T3193 timeout");
LOGP(DRLCMAC, LOGL_DEBUG,
- "TBF TFI=%d will be freed due to timeout\n", tfi);
+ "%s will be freed due to timeout\n", tbf_name(this));
/* free TBF */
tbf_free(this);
break;
default:
LOGP(DRLCMAC, LOGL_ERROR,
- "TFI=%d Timer expired in unknown mode: %u\n", tfi, T);
+ "%s timer expired in unknown mode: %u\n", tbf_name(this), T);
}
}
@@ -713,9 +710,9 @@ struct msgb *gprs_rlcmac_tbf::llc_dequeue(bssgp_bvc_ctx *bctx)
&& (tv_now.tv_sec > tv->tv_sec /* and secs expired */
|| (tv_now.tv_sec == tv->tv_sec /* .. or if secs equal .. */
&& tv_now.tv_usec > tv->tv_usec))) { /* .. usecs expired */
- LOGP(DRLCMACDL, LOGL_NOTICE, "Discarding LLC PDU of "
- "DL TFI=%d, because lifetime limit reached\n",
- tfi);
+ LOGP(DRLCMACDL, LOGL_NOTICE, "%s Discarding LLC PDU "
+ "because lifetime limit reached\n",
+ tbf_name(this));
bts->timedout_frame();
frames++;
octets += msg->len;
@@ -765,8 +762,8 @@ int gprs_rlcmac_tbf::assemble_forward_llc(uint8_t *data, uint8_t len)
/* Parse frame offsets from length indicator(s), if any. */
while (1) {
if (frames == (int)sizeof(frame_offset)) {
- LOGP(DRLCMACUL, LOGL_ERROR, "Too many frames in "
- "block\n");
+ LOGP(DRLCMACUL, LOGL_ERROR, "%s too many frames in "
+ "block\n", tbf_name(this));
return -EINVAL;
}
frame_offset[frames++] = offset;
@@ -776,9 +773,9 @@ int gprs_rlcmac_tbf::assemble_forward_llc(uint8_t *data, uint8_t len)
break;
/* M == 0 and E == 0 is not allowed in this version. */
if (!m && !e) {
- LOGP(DRLCMACUL, LOGL_NOTICE, "UL DATA TFI=%d "
+ LOGP(DRLCMACUL, LOGL_NOTICE, "%s UL DATA "
"ignored, because M='0' and E='0'.\n",
- this->tfi);
+ tbf_name(this));
return 0;
}
/* no more frames in this segment */
@@ -823,8 +820,8 @@ int gprs_rlcmac_tbf::assemble_forward_llc(uint8_t *data, uint8_t len)
/* TLLI */
if (rh->ti) {
if (len < 4) {
- LOGP(DRLCMACUL, LOGL_NOTICE, "UL DATA TLLI out of "
- "frame border\n");
+ LOGP(DRLCMACUL, LOGL_NOTICE, "%s UL DATA TLLI out of "
+ "frame border\n", tbf_name(this));
return -EINVAL;
}
data += 4;
@@ -838,8 +835,8 @@ int gprs_rlcmac_tbf::assemble_forward_llc(uint8_t *data, uint8_t len)
LOGP(DRLCMACUL, LOGL_ERROR, "ERROR: PFI not supported, "
"please disable in SYSTEM INFORMATION\n");
if (len < 1) {
- LOGP(DRLCMACUL, LOGL_NOTICE, "UL DATA PFI out of "
- "frame border\n");
+ LOGP(DRLCMACUL, LOGL_NOTICE, "%s UL DATA PFI out of "
+ "frame border\n", tbf_name(this));
return -EINVAL;
}
data++;
@@ -856,9 +853,9 @@ int gprs_rlcmac_tbf::assemble_forward_llc(uint8_t *data, uint8_t len)
/* Check if last offset would exceed frame. */
if (offset > len) {
- LOGP(DRLCMACUL, LOGL_NOTICE, "UL DATA TFI=%d ignored, "
+ LOGP(DRLCMACUL, LOGL_NOTICE, "%s UL DATA ignored, "
"because LI delimits data that exceeds block size.\n",
- this->tfi);
+ tbf_name(this));
return -EINVAL;
}
@@ -878,8 +875,8 @@ int gprs_rlcmac_tbf::assemble_forward_llc(uint8_t *data, uint8_t len)
LOGP(DRLCMACUL, LOGL_DEBUG, "-- Appending chunk (len=%d) to "
"frame at %d.\n", chunk, this->llc_index);
if (this->llc_index + chunk > LLC_MAX_LEN) {
- LOGP(DRLCMACUL, LOGL_NOTICE, "LLC frame exceeds "
- "maximum size.\n");
+ LOGP(DRLCMACUL, LOGL_NOTICE, "%s LLC frame exceeds "
+ "maximum size.\n", tbf_name(this));
chunk = LLC_MAX_LEN - this->llc_index;
}
memcpy(this->llc_frame + this->llc_index, data + frame_offset[i],
@@ -888,8 +885,8 @@ int gprs_rlcmac_tbf::assemble_forward_llc(uint8_t *data, uint8_t len)
/* not last frame. */
if (i != frames - 1) {
/* send frame to SGSN */
- LOGP(DRLCMACUL, LOGL_INFO, "Complete UL frame for "
- "TFI=%d: len=%d\n", this->tfi, this->llc_index);
+ LOGP(DRLCMACUL, LOGL_INFO, "%s complete UL frame len=%d\n",
+ tbf_name(this) , this->llc_index);
gprs_rlcmac_tx_ul_ud(this);
this->llc_index = 0; /* reset frame space */
/* also check if CV==0, because the frame may fill up the
@@ -898,9 +895,9 @@ int gprs_rlcmac_tbf::assemble_forward_llc(uint8_t *data, uint8_t len)
* delimiter added to this block. */
} else if (rh->cv == 0) {
/* send frame to SGSN */
- LOGP(DRLCMACUL, LOGL_INFO, "Complete UL frame for "
- "TFI=%d that fits precisely in last block: "
- "len=%d\n", this->tfi, this->llc_index);
+ LOGP(DRLCMACUL, LOGL_INFO, "%s complete UL frame "
+ "that fits precisely in last block: "
+ "len=%d\n", tbf_name(this), this->llc_index);
gprs_rlcmac_tx_ul_ud(this);
this->llc_index = 0; /* reset frame space */
}
@@ -1609,3 +1606,13 @@ void gprs_rlcmac_tbf::free_all(struct gprs_rlcmac_pdch *pdch)
tbf_free(tbf);
}
}
+
+const char *tbf_name(gprs_rlcmac_tbf *tbf)
+{
+ static char buf[40];
+ snprintf(buf, sizeof(buf), "TBF(TFI=%d TLLI=0x%08x DIR=%s)",
+ tbf->tfi, tbf->tlli,
+ tbf->direction == GPRS_RLCMAC_UL_TBF ? "UL" : "DL");
+ buf[sizeof(buf) - 1] = '\0';
+ return buf;
+}
diff --git a/src/tbf.h b/src/tbf.h
index e6981bce..83b36487 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -257,3 +257,5 @@ inline void gprs_rlcmac_tbf::set_state(enum gprs_rlcmac_tbf_state new_state)
{
state = new_state;
}
+
+const char *tbf_name(gprs_rlcmac_tbf *tbf);