Transmit Msg3 only if available (2)

This commit is contained in:
Ismael Gomez 2018-02-13 23:31:52 +01:00
parent ca4a22aeaf
commit 13a16e200c
4 changed files with 20 additions and 3 deletions

View File

@ -67,6 +67,9 @@ public:
void msg3_flush();
bool msg3_is_transmitted();
void msg3_prepare();
bool msg3_is_pending();
void append_crnti_ce_next_tx(uint16_t crnti);
@ -105,6 +108,7 @@ private:
/* PDU Buffer */
srslte::sch_pdu pdu_msg;
bool msg3_has_been_transmitted;
bool msg3_pending;
};
} // namespace srsue

View File

@ -238,7 +238,7 @@ private:
reset();
// Uplink grant in a RAR and there is a PDU in the Msg3 buffer
if (grant->is_from_rar && !harq_entity->mux_unit->msg3_is_transmitted()) {
if (grant->is_from_rar && harq_entity->mux_unit->msg3_is_pending()) {
Debug("Getting Msg3 buffer payload, grant size=%d bytes\n", grant->n_bytes[0]);
pdu_ptr = harq_entity->mux_unit->msg3_get(payload_buffer, grant->n_bytes[0]);
if (pdu_ptr) {
@ -246,6 +246,7 @@ private:
} else {
Warning("UL RAR grant available but no Msg3 on buffer\n");
}
printf("Transmitted Msg3\n");
// Normal UL grant
} else {

View File

@ -65,6 +65,7 @@ void mux::reset()
for (uint32_t i=0;i<lch.size();i++) {
lch[i].Bj = 0;
}
msg3_pending = false;
pending_crnti_ce = 0;
}
@ -343,7 +344,8 @@ void mux::msg3_flush()
if (log_h) {
Debug("Msg3 buffer flushed\n");
}
msg3_has_been_transmitted = false;
msg3_has_been_transmitted = false;
msg3_pending = false;
bzero(msg3_buff, sizeof(MSG3_BUFF_SZ));
}
@ -352,6 +354,14 @@ bool mux::msg3_is_transmitted()
return msg3_has_been_transmitted;
}
void mux::msg3_prepare() {
msg3_pending = true;
}
bool mux::msg3_is_pending() {
return msg3_pending;
}
/* Returns a pointer to the Msg3 buffer */
uint8_t* mux::msg3_get(uint8_t *payload, uint32_t pdu_sz)
{
@ -363,6 +373,7 @@ uint8_t* mux::msg3_get(uint8_t *payload, uint32_t pdu_sz)
}
memcpy(payload, msg3_buff_start_pdu, sizeof(uint8_t)*pdu_sz);
msg3_has_been_transmitted = true;
msg3_pending = false;
return payload;
} else {
Error("Msg3 size (%d) is longer than internal msg3_buff size=%d, (see mux.h)\n", pdu_sz, MSG3_BUFF_SZ-32);

View File

@ -349,7 +349,8 @@ void ra_proc::tb_decoded_ok() {
// Preamble selected by Network
state = COMPLETION;
} else {
// Preamble selected by UE MAC
// Preamble selected by UE MAC
mux_unit->msg3_prepare();
rntis->temp_rnti = rar_pdu_msg.get()->get_temp_crnti();
phy_h->pdcch_dl_search(SRSLTE_RNTI_TEMP, rar_pdu_msg.get()->get_temp_crnti());