tbf: Re-use the code that is re-using the tbf
Address the fixme and re-use the code. Fix the counting in the final ack case and provide a log message in the other case. Prefix it with the tbf name
This commit is contained in:
parent
b1302b083e
commit
55cf994c29
49
src/tbf.cpp
49
src/tbf.cpp
|
@ -98,17 +98,8 @@ int gprs_rlcmac_tbf::append_data(const uint8_t ms_class,
|
||||||
LOGP(DRLCMAC, LOGL_DEBUG,
|
LOGP(DRLCMAC, LOGL_DEBUG,
|
||||||
"%s in WAIT RELEASE state "
|
"%s in WAIT RELEASE state "
|
||||||
"(T3193), so reuse TBF\n", tbf_name(this));
|
"(T3193), so reuse TBF\n", tbf_name(this));
|
||||||
bts->tbf_reused();
|
|
||||||
m_llc.put_frame(data, len);
|
|
||||||
bts->llc_frame_sched();
|
|
||||||
/* reset rlc states */
|
|
||||||
memset(&dir.dl, 0, sizeof(dir.dl));
|
|
||||||
/* keep to flags */
|
|
||||||
state_flags &= GPRS_RLCMAC_FLAG_TO_MASK;
|
|
||||||
state_flags &= ~(1 << GPRS_RLCMAC_FLAG_CCCH);
|
|
||||||
tbf_update_ms_class(this, ms_class);
|
tbf_update_ms_class(this, ms_class);
|
||||||
update();
|
reuse_tbf(data, len);
|
||||||
bts->trigger_dl_ass(this, this, NULL);
|
|
||||||
} else {
|
} else {
|
||||||
/* the TBF exists, so we must write it in the queue
|
/* the TBF exists, so we must write it in the queue
|
||||||
* we prepend lifetime in front of PDU */
|
* we prepend lifetime in front of PDU */
|
||||||
|
@ -1536,21 +1527,10 @@ int gprs_rlcmac_tbf::snd_dl_ack(uint8_t final, uint8_t ssn, uint8_t *rbb)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#warning "Copy and paste on the sender path"
|
|
||||||
m_llc.put_frame(msg->data, msg->len);
|
|
||||||
bts->llc_frame_sched();
|
|
||||||
msgb_free(msg);
|
|
||||||
|
|
||||||
/* we have a message, so we trigger downlink assignment, and there
|
/* we have more data so we will re-use this tbf */
|
||||||
* set the state to ASSIGN. also we set old_downlink, because we
|
reuse_tbf(msg->data, msg->len);
|
||||||
* re-use this tbf. */
|
msgb_free(msg);
|
||||||
LOGP(DRLCMAC, LOGL_DEBUG, "Trigger dowlink assignment on PACCH, "
|
|
||||||
"because another LLC PDU has arrived in between\n");
|
|
||||||
memset(&dir.dl, 0, sizeof(dir.dl)); /* reset RLC states */
|
|
||||||
state_flags &= GPRS_RLCMAC_FLAG_TO_MASK; /* keep TO flags */
|
|
||||||
state_flags &= ~(1 << GPRS_RLCMAC_FLAG_CCCH);
|
|
||||||
update();
|
|
||||||
bts->trigger_dl_ass(this, this, NULL);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1851,3 +1831,24 @@ const char *tbf_name(gprs_rlcmac_tbf *tbf)
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void gprs_rlcmac_tbf::reuse_tbf(const uint8_t *data, const uint16_t len)
|
||||||
|
{
|
||||||
|
bts->tbf_reused();
|
||||||
|
m_llc.put_frame(data, len);
|
||||||
|
bts->llc_frame_sched();
|
||||||
|
|
||||||
|
/* reset rlc states */
|
||||||
|
memset(&dir.dl, 0, sizeof(dir.dl));
|
||||||
|
|
||||||
|
/* keep to flags */
|
||||||
|
state_flags &= GPRS_RLCMAC_FLAG_TO_MASK;
|
||||||
|
state_flags &= ~(1 << GPRS_RLCMAC_FLAG_CCCH);
|
||||||
|
|
||||||
|
update();
|
||||||
|
|
||||||
|
LOGP(DRLCMAC, LOGL_DEBUG, "%s Trigger dowlink assignment on PACCH, "
|
||||||
|
"because another LLC PDU has arrived in between\n",
|
||||||
|
tbf_name(this));
|
||||||
|
bts->trigger_dl_ass(this, this, NULL);
|
||||||
|
}
|
||||||
|
|
|
@ -240,6 +240,7 @@ struct gprs_rlcmac_tbf {
|
||||||
char m_imsi[16];
|
char m_imsi[16];
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void reuse_tbf(const uint8_t *data, const uint16_t len);
|
||||||
gprs_rlcmac_bts *bts_data() const;
|
gprs_rlcmac_bts *bts_data() const;
|
||||||
|
|
||||||
int append_data(const uint8_t ms_class,
|
int append_data(const uint8_t ms_class,
|
||||||
|
|
Loading…
Reference in New Issue