mirror of https://github.com/PentHertz/srsLTE.git
Fix logic for UL HARQ retx causing Msg3 adaptive retx to be identified as a new transmission
This commit is contained in:
parent
af0b80b0a7
commit
cc7dfefa1a
|
@ -345,6 +345,7 @@ public:
|
|||
uint16_t rnti;
|
||||
bool phich_available;
|
||||
bool hi_value;
|
||||
bool is_rar;
|
||||
uint32_t tti_tx;
|
||||
} mac_grant_ul_t;
|
||||
|
||||
|
|
|
@ -267,6 +267,7 @@ typedef enum {
|
|||
SRSLTE_DCI_FORMATN0,
|
||||
SRSLTE_DCI_FORMATN1,
|
||||
SRSLTE_DCI_FORMATN2,
|
||||
SRSLTE_DCI_FORMAT_RAR, // Not a real LTE format. Used internally to indicate RAR grant
|
||||
SRSLTE_DCI_NOF_FORMATS
|
||||
} srslte_dci_format_t;
|
||||
|
||||
|
|
|
@ -721,6 +721,7 @@ void cc_worker::ul_phy_to_mac_grant(srslte_pusch_grant_t*
|
|||
mac_grant->tb.tbs = phy_grant->tb.tbs / (uint32_t)8;
|
||||
mac_grant->tb.rv = phy_grant->tb.rv;
|
||||
mac_grant->pid = pid;
|
||||
mac_grant->is_rar = dci_ul->format == SRSLTE_DCI_FORMAT_RAR;
|
||||
mac_grant->tti_tx = CURRENT_TTI_TX;
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,9 @@ void phy_common::set_rar_grant(uint8_t grant_payload[SRSLTE_RAR_GRAN
|
|||
Error("Converting RAR message to UL dci\n");
|
||||
return;
|
||||
}
|
||||
dci_ul.rnti = rnti;
|
||||
|
||||
dci_ul.format = SRSLTE_DCI_FORMAT_RAR; // Use this format to identify a RAR grant
|
||||
dci_ul.rnti = rnti;
|
||||
|
||||
uint32_t msg3_tx_tti;
|
||||
if (rar_grant.ul_delay) {
|
||||
|
|
|
@ -187,8 +187,6 @@ void ul_harq_entity::ul_harq_process::reset_ndi()
|
|||
cur_grant.tb.ndi = false;
|
||||
}
|
||||
|
||||
#define grant_is_rar() (grant.rnti == harq_entity->rntis->temp_rnti)
|
||||
|
||||
void ul_harq_entity::ul_harq_process::new_grant_ul(mac_interface_phy_lte::mac_grant_ul_t grant,
|
||||
mac_interface_phy_lte::tb_action_ul_t* action)
|
||||
{
|
||||
|
@ -201,7 +199,7 @@ void ul_harq_entity::ul_harq_process::new_grant_ul(mac_interface_phy_lte::mac_gr
|
|||
|
||||
// Get maximum retransmissions
|
||||
uint32_t max_retx;
|
||||
if (grant_is_rar()) {
|
||||
if (grant.rnti == harq_entity->rntis->temp_rnti) {
|
||||
max_retx = harq_entity->harq_cfg.max_harq_msg3_tx;
|
||||
} else {
|
||||
max_retx = harq_entity->harq_cfg.max_harq_tx;
|
||||
|
@ -210,11 +208,11 @@ void ul_harq_entity::ul_harq_process::new_grant_ul(mac_interface_phy_lte::mac_gr
|
|||
// Check maximum retransmissions, do not consider last retx ACK
|
||||
if (current_tx_nb >= max_retx && !grant.hi_value) {
|
||||
Info("UL %d: Maximum number of ReTX reached (%d). Discarding TB.\n", pid, max_retx);
|
||||
if (grant_is_rar()) {
|
||||
if (grant.rnti == harq_entity->rntis->temp_rnti) {
|
||||
harq_entity->ra_procedure->harq_max_retx();
|
||||
}
|
||||
reset();
|
||||
} else if (grant_is_rar() && current_tx_nb) {
|
||||
} else if (grant.rnti == harq_entity->rntis->temp_rnti && current_tx_nb) {
|
||||
harq_entity->ra_procedure->harq_retx();
|
||||
}
|
||||
}
|
||||
|
@ -233,9 +231,10 @@ void ul_harq_entity::ul_harq_process::new_grant_ul(mac_interface_phy_lte::mac_gr
|
|||
if (grant.tb.tbs == 0) {
|
||||
action->tb.enabled = true;
|
||||
|
||||
} else if ((grant.rnti == harq_entity->rntis->crnti && // If C-RNTI
|
||||
((grant.tb.ndi != get_ndi()) || !has_grant())) || // if NDI toggled or is first dci is a new tx
|
||||
grant_is_rar()) // If T-CRNTI received in RAR has no RV information
|
||||
// Decide if adaptive retx or new tx. 3 checks in 5.4.2.1
|
||||
} else if ((grant.rnti != harq_entity->rntis->temp_rnti && grant.tb.ndi != get_ndi()) || // If not addressed to T-CRNTI and NDI toggled
|
||||
(grant.rnti == harq_entity->rntis->crnti && !has_grant()) || // If addressed to C-RNTI and buffer is empty
|
||||
(grant.is_rar)) // Grant received in a RAR
|
||||
{
|
||||
// New transmission
|
||||
reset();
|
||||
|
@ -251,7 +250,7 @@ void ul_harq_entity::ul_harq_process::new_grant_ul(mac_interface_phy_lte::mac_gr
|
|||
}
|
||||
|
||||
// Uplink dci in a RAR and there is a PDU in the Msg3 buffer
|
||||
if (grant_is_rar()) {
|
||||
if (grant.is_rar) {
|
||||
if (harq_entity->mux_unit->msg3_is_pending()) {
|
||||
Debug("Getting Msg3 buffer payload, dci size=%d bytes\n", grant.tb.tbs);
|
||||
pdu_ptr = harq_entity->mux_unit->msg3_get(payload_buffer.get(), grant.tb.tbs);
|
||||
|
@ -281,7 +280,7 @@ void ul_harq_entity::ul_harq_process::new_grant_ul(mac_interface_phy_lte::mac_gr
|
|||
}
|
||||
if (harq_entity->pcap) {
|
||||
uint16_t rnti;
|
||||
if (grant_is_rar() && harq_entity->rntis->temp_rnti) {
|
||||
if (grant.rnti == harq_entity->rntis->temp_rnti && harq_entity->rntis->temp_rnti) {
|
||||
rnti = harq_entity->rntis->temp_rnti;
|
||||
} else {
|
||||
rnti = harq_entity->rntis->crnti;
|
||||
|
@ -377,7 +376,7 @@ void ul_harq_entity::ul_harq_process::generate_new_tx(mac_interface_phy_lte::mac
|
|||
current_tx_nb = 0;
|
||||
current_irv = 0;
|
||||
|
||||
Info("UL %d: New TX%s, RV=%d, TBS=%d\n", pid, grant_is_rar() ? " for Msg3" : "", get_rv(), cur_grant.tb.tbs);
|
||||
Info("UL %d: New TX%s, RV=%d, TBS=%d\n", pid, grant.rnti == harq_entity->rntis->temp_rnti ? " for Msg3" : "", get_rv(), cur_grant.tb.tbs);
|
||||
generate_tx(action);
|
||||
}
|
||||
|
||||
|
|
|
@ -242,23 +242,32 @@ public:
|
|||
return 0;
|
||||
}
|
||||
|
||||
int ul_grant_and_check_tv(mac* mac_h, bool ack, uint16_t rnti, uint32_t len, const uint8_t* tv)
|
||||
int ul_grant_and_check_tv(mac* mac_h, bool ack, uint16_t rnti, uint32_t len, const uint8_t* tv, bool is_rar = false, bool adaptive_retx = false)
|
||||
{
|
||||
|
||||
mac_interface_phy_lte::tb_action_ul_t ul_action = {};
|
||||
mac_interface_phy_lte::mac_grant_ul_t ul_mac_grant = {};
|
||||
|
||||
// Generate UL Grant
|
||||
ul_mac_grant.phich_available = !ack;
|
||||
ul_mac_grant.rnti = rnti;
|
||||
ul_mac_grant.tb.ndi = ul_ndi;
|
||||
ul_mac_grant.tb.ndi_present = ack;
|
||||
ul_mac_grant.tb.tbs = len;
|
||||
|
||||
if (ack) {
|
||||
ul_ndi = !ul_ndi;
|
||||
}
|
||||
|
||||
// Generate UL Grant
|
||||
if (!adaptive_retx) {
|
||||
ul_mac_grant.phich_available = !ack;
|
||||
ul_mac_grant.tb.ndi = ul_ndi;
|
||||
ul_mac_grant.tb.ndi_present = ack;
|
||||
} else {
|
||||
ul_mac_grant.hi_value = true;
|
||||
ul_mac_grant.phich_available = true;
|
||||
ul_mac_grant.tb.ndi = ul_ndi;
|
||||
ul_mac_grant.tb.ndi_present = true;
|
||||
}
|
||||
|
||||
ul_mac_grant.is_rar = is_rar;
|
||||
ul_mac_grant.rnti = rnti;
|
||||
ul_mac_grant.tb.tbs = len;
|
||||
|
||||
// Send grant to MAC and get action for this TB, then call tb_decoded to unlock MAC
|
||||
mac_h->new_grant_ul(0, ul_mac_grant, &ul_action);
|
||||
|
||||
|
@ -1273,9 +1282,9 @@ int run_mac_ra_test(struct ra_test test, mac* mac, phy_dummy* phy, uint32_t* tti
|
|||
}
|
||||
|
||||
if (test.crnti) {
|
||||
TESTASSERT(!phy->ul_grant_and_check_tv(mac, i == 0, temp_rnti, 3, tv_msg3_ce));
|
||||
TESTASSERT(!phy->ul_grant_and_check_tv(mac, i == 0, temp_rnti, 3, tv_msg3_ce, i == 0));
|
||||
} else {
|
||||
TESTASSERT(!phy->ul_grant_and_check_tv(mac, i == 0, temp_rnti, 9, tv_msg3));
|
||||
TESTASSERT(!phy->ul_grant_and_check_tv(mac, i == 0, temp_rnti, 9, tv_msg3, i == 0, i == 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -378,7 +378,8 @@ public:
|
|||
ul_grant.tb.ndi = get_ndi_for_new_ul_tx(tti);
|
||||
ul_grant.rnti = crnti;
|
||||
ul_grant.pid = get_pid(tti);
|
||||
|
||||
ul_grant.is_rar = true;
|
||||
|
||||
ue->new_grant_ul(ul_grant);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue