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:
Holger Hans Peter Freyther 2013-11-13 18:15:45 +01:00
parent b1302b083e
commit 55cf994c29
2 changed files with 26 additions and 24 deletions

View File

@ -98,17 +98,8 @@ int gprs_rlcmac_tbf::append_data(const uint8_t ms_class,
LOGP(DRLCMAC, LOGL_DEBUG,
"%s in WAIT RELEASE state "
"(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);
update();
bts->trigger_dl_ass(this, this, NULL);
reuse_tbf(data, len);
} else {
/* the TBF exists, so we must write it in the queue
* 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;
}
#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
* set the state to ASSIGN. also we set old_downlink, because we
* re-use this tbf. */
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);
/* we have more data so we will re-use this tbf */
reuse_tbf(msg->data, msg->len);
msgb_free(msg);
return 0;
}
@ -1851,3 +1831,24 @@ const char *tbf_name(gprs_rlcmac_tbf *tbf)
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);
}

View File

@ -240,6 +240,7 @@ struct gprs_rlcmac_tbf {
char m_imsi[16];
protected:
void reuse_tbf(const uint8_t *data, const uint16_t len);
gprs_rlcmac_bts *bts_data() const;
int append_data(const uint8_t ms_class,