rlc: Begin to move the rlc block handling into a separate object
The secret of gprs_rlc will be the manipulation of the blocks for the current window. We might add the window handling in this class as well.
This commit is contained in:
parent
e9429b5d3e
commit
9241fd0957
18
src/tbf.cpp
18
src/tbf.cpp
|
@ -964,7 +964,7 @@ do_resend:
|
|||
|
||||
/* now we still have untransmitted LLC data, so we fill mac block */
|
||||
index = dir.dl.v_s & mod_sns_half;
|
||||
data = rlc_block[index];
|
||||
data = m_rlc.block[index];
|
||||
#warning "Selection of the CS doesn't belong here"
|
||||
if (cs == 0) {
|
||||
cs = bts_data()->initial_cs_dl;
|
||||
|
@ -1102,8 +1102,8 @@ do_resend:
|
|||
break;
|
||||
}
|
||||
LOGP(DRLCMACDL, LOGL_DEBUG, "data block: %s\n",
|
||||
osmo_hexdump(rlc_block[index], block_length));
|
||||
rlc_block_len[index] = block_length;
|
||||
osmo_hexdump(m_rlc.block[index], block_length));
|
||||
m_rlc.block_len[index] = block_length;
|
||||
/* raise send state and set ack state array */
|
||||
dir.dl.v_b[index] = 'U'; /* unacked */
|
||||
dir.dl.v_s = (dir.dl.v_s + 1) & mod_sns; /* inc send state */
|
||||
|
@ -1121,8 +1121,8 @@ struct msgb *gprs_rlcmac_tbf::create_dl_acked_block(
|
|||
uint8_t len;
|
||||
|
||||
/* get data and header from current block */
|
||||
data = rlc_block[index];
|
||||
len = rlc_block_len[index];
|
||||
data = m_rlc.block[index];
|
||||
len = m_rlc.block_len[index];
|
||||
rh = (struct rlc_dl_header *)data;
|
||||
|
||||
/* Clear Polling, if still set in history buffer */
|
||||
|
@ -1701,8 +1701,8 @@ int gprs_rlcmac_tbf::rcv_data_block_acknowledged(const uint8_t *data, size_t len
|
|||
}
|
||||
/* Write block to buffer and set receive state array. */
|
||||
index = rh->bsn & mod_sns_half; /* memory index of block */
|
||||
memcpy(this->rlc_block[index], data, len); /* Copy block. */
|
||||
this->rlc_block_len[index] = len;
|
||||
memcpy(m_rlc.block[index], data, len); /* Copy block. */
|
||||
m_rlc.block_len[index] = len;
|
||||
this->dir.ul.v_n[index] = 'R'; /* Mark received block. */
|
||||
LOGP(DRLCMACUL, LOGL_DEBUG, "- BSN %d storing in window (%d..%d)\n",
|
||||
rh->bsn, this->dir.ul.v_q,
|
||||
|
@ -1731,7 +1731,7 @@ int gprs_rlcmac_tbf::rcv_data_block_acknowledged(const uint8_t *data, size_t len
|
|||
"V(Q) to %d\n", this->dir.ul.v_q,
|
||||
(this->dir.ul.v_q + 1) & mod_sns);
|
||||
/* get LLC data from block */
|
||||
this->assemble_forward_llc(this->rlc_block[index], this->rlc_block_len[index]);
|
||||
this->assemble_forward_llc(m_rlc.block[index], m_rlc.block_len[index]);
|
||||
/* raise V(Q), because block already received */
|
||||
this->dir.ul.v_q = (this->dir.ul.v_q + 1) & mod_sns;
|
||||
}
|
||||
|
@ -1740,7 +1740,7 @@ int gprs_rlcmac_tbf::rcv_data_block_acknowledged(const uint8_t *data, size_t len
|
|||
if (this->state_is(GPRS_RLCMAC_FLOW) /* still in flow state */
|
||||
&& this->dir.ul.v_q == this->dir.ul.v_r) { /* if complete */
|
||||
struct rlc_ul_header *last_rh = (struct rlc_ul_header *)
|
||||
this->rlc_block[(this->dir.ul.v_r - 1) & mod_sns_half];
|
||||
m_rlc.block[(this->dir.ul.v_r - 1) & mod_sns_half];
|
||||
LOGP(DRLCMACUL, LOGL_DEBUG, "- No gaps in received block, "
|
||||
"last block: BSN=%d CV=%d\n", last_rh->bsn,
|
||||
last_rh->cv);
|
||||
|
|
13
src/tbf.h
13
src/tbf.h
|
@ -85,6 +85,15 @@ enum gprs_rlcmac_tbf_direction {
|
|||
#define GPRS_RLCMAC_FLAG_TO_DL_ASS 7
|
||||
#define GPRS_RLCMAC_FLAG_TO_MASK 0xf0 /* timeout bits */
|
||||
|
||||
/*
|
||||
* I hold the currently transferred blocks and will provide
|
||||
* the routines to manipulate these arrays.
|
||||
*/
|
||||
struct gprs_rlc {
|
||||
uint8_t block[RLC_MAX_SNS/2][RLC_MAX_LEN]; /* block history */
|
||||
uint8_t block_len[RLC_MAX_SNS/2]; /* block len of history */
|
||||
};
|
||||
|
||||
struct gprs_rlcmac_tbf {
|
||||
|
||||
static void free_all(struct gprs_rlcmac_trx *trx);
|
||||
|
@ -187,8 +196,8 @@ struct gprs_rlcmac_tbf {
|
|||
uint8_t final_ack_sent; /* set if we sent final ack */
|
||||
} ul;
|
||||
} dir;
|
||||
uint8_t rlc_block[RLC_MAX_SNS/2][RLC_MAX_LEN]; /* block history */
|
||||
uint8_t rlc_block_len[RLC_MAX_SNS/2]; /* block len of history */
|
||||
|
||||
gprs_rlc m_rlc;
|
||||
|
||||
uint8_t n3105; /* N3105 counter */
|
||||
|
||||
|
|
Loading…
Reference in New Issue