Transmit Msg3 only if available (2)

master
Ismael Gomez 7 years ago
parent ca4a22aeaf
commit 13a16e200c

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

@ -238,7 +238,7 @@ private:
reset(); reset();
// Uplink grant in a RAR and there is a PDU in the Msg3 buffer // 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]); 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]); pdu_ptr = harq_entity->mux_unit->msg3_get(payload_buffer, grant->n_bytes[0]);
if (pdu_ptr) { if (pdu_ptr) {
@ -246,6 +246,7 @@ private:
} else { } else {
Warning("UL RAR grant available but no Msg3 on buffer\n"); Warning("UL RAR grant available but no Msg3 on buffer\n");
} }
printf("Transmitted Msg3\n");
// Normal UL grant // Normal UL grant
} else { } else {

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

@ -349,7 +349,8 @@ void ra_proc::tb_decoded_ok() {
// Preamble selected by Network // Preamble selected by Network
state = COMPLETION; state = COMPLETION;
} else { } 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(); 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()); phy_h->pdcch_dl_search(SRSLTE_RNTI_TEMP, rar_pdu_msg.get()->get_temp_crnti());

Loading…
Cancel
Save