Commit 8c81c70d authored by francescomani's avatar francescomani Committed by Robert Schmidt

Fix AckNack and SR multiplexing in PUCCH2

- correctly reset HARQ structure for HARQ Ack/Nack/PUCCH0
- reduce max PUCCH2 bits to have room for SR
parent 7f910a2e
...@@ -370,6 +370,7 @@ void nr_decode_pucch1(int32_t **rxdataF, ...@@ -370,6 +370,7 @@ void nr_decode_pucch1(int32_t **rxdataF,
uint8_t nr_bit); uint8_t nr_bit);
void nr_decode_pucch2(PHY_VARS_gNB *gNB, void nr_decode_pucch2(PHY_VARS_gNB *gNB,
int frame,
int slot, int slot,
nfapi_nr_uci_pucch_pdu_format_2_3_4_t* uci_pdu, nfapi_nr_uci_pucch_pdu_format_2_3_4_t* uci_pdu,
nfapi_nr_pucch_pdu_t* pucch_pdu); nfapi_nr_pucch_pdu_t* pucch_pdu);
...@@ -380,10 +381,5 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, ...@@ -380,10 +381,5 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
nfapi_nr_uci_pucch_pdu_format_0_1_t* uci_pdu, nfapi_nr_uci_pucch_pdu_format_0_1_t* uci_pdu,
nfapi_nr_pucch_pdu_t* pucch_pdu); nfapi_nr_pucch_pdu_t* pucch_pdu);
void nr_decode_pucch2(PHY_VARS_gNB *gNB,
int slot,
nfapi_nr_uci_pucch_pdu_format_2_3_4_t* uci_pdu,
nfapi_nr_pucch_pdu_t* pucch_pdu);
#endif /*__NR_TRANSPORT__H__*/ #endif /*__NR_TRANSPORT__H__*/
...@@ -1136,6 +1136,7 @@ void init_pucch2_luts() { ...@@ -1136,6 +1136,7 @@ void init_pucch2_luts() {
void nr_decode_pucch2(PHY_VARS_gNB *gNB, void nr_decode_pucch2(PHY_VARS_gNB *gNB,
int frame,
int slot, int slot,
nfapi_nr_uci_pucch_pdu_format_2_3_4_t* uci_pdu, nfapi_nr_uci_pucch_pdu_format_2_3_4_t* uci_pdu,
nfapi_nr_pucch_pdu_t* pucch_pdu) { nfapi_nr_pucch_pdu_t* pucch_pdu) {
...@@ -1720,13 +1721,19 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, ...@@ -1720,13 +1721,19 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
uci_pdu->pduBitmap|=2; uci_pdu->pduBitmap|=2;
uci_pdu->harq.harq_payload = (uint8_t*)malloc(harq_bytes); uci_pdu->harq.harq_payload = (uint8_t*)malloc(harq_bytes);
uci_pdu->harq.harq_crc = decoderState; uci_pdu->harq.harq_crc = decoderState;
LOG_D(PHY,"[DLSCH/PDSCH/PUCCH2] %d.%d HARQ bytes (%d) Decoder state %d\n",
frame,slot,harq_bytes,decoderState);
int i=0; int i=0;
for (;i<harq_bytes-1;i++) { for (;i<harq_bytes-1;i++) {
uci_pdu->harq.harq_payload[i] = decodedPayload[0] & 255; uci_pdu->harq.harq_payload[i] = decodedPayload[0] & 255;
LOG_D(PHY,"[DLSCH/PDSCH/PUCCH2] %d.%d HARQ paylod (%d) = %d\n",
frame,slot,i,uci_pdu->harq.harq_payload[i]);
decodedPayload[0]>>=8; decodedPayload[0]>>=8;
} }
bit_left = pucch_pdu->bit_len_harq-((harq_bytes-1)<<3); bit_left = pucch_pdu->bit_len_harq-((harq_bytes-1)<<3);
uci_pdu->harq.harq_payload[i] = decodedPayload[0] & ((1<<bit_left)-1); uci_pdu->harq.harq_payload[i] = decodedPayload[0] & ((1<<bit_left)-1);
LOG_D(PHY,"[DLSCH/PDSCH/PUCCH2] %d.%d HARQ paylod (%d) = %d\n",
frame,slot,i,uci_pdu->harq.harq_payload[i]);
decodedPayload[0] >>= pucch_pdu->bit_len_harq; decodedPayload[0] >>= pucch_pdu->bit_len_harq;
} }
......
...@@ -711,6 +711,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { ...@@ -711,6 +711,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
LOG_D(PHY,"%d.%d Calling nr_decode_pucch2\n",frame_rx,slot_rx); LOG_D(PHY,"%d.%d Calling nr_decode_pucch2\n",frame_rx,slot_rx);
nr_decode_pucch2(gNB, nr_decode_pucch2(gNB,
frame_rx,
slot_rx, slot_rx,
uci_pdu_format2, uci_pdu_format2,
pucch_pdu); pucch_pdu);
......
...@@ -705,7 +705,7 @@ int main(int argc, char **argv) ...@@ -705,7 +705,7 @@ int main(int argc, char **argv)
pucch_pdu.second_hop_prb = N_RB_DL-1; pucch_pdu.second_hop_prb = N_RB_DL-1;
} }
else pucch_pdu.freq_hop_flag = 0; else pucch_pdu.freq_hop_flag = 0;
nr_decode_pucch2(gNB,nr_slot_tx,&uci_pdu,&pucch_pdu); nr_decode_pucch2(gNB,nr_frame_tx,nr_slot_tx,&uci_pdu,&pucch_pdu);
int csi_part1_bytes=pucch_pdu.bit_len_csi_part1>>3; int csi_part1_bytes=pucch_pdu.bit_len_csi_part1>>3;
if ((pucch_pdu.bit_len_csi_part1&7) > 0) csi_part1_bytes++; if ((pucch_pdu.bit_len_csi_part1&7) > 0) csi_part1_bytes++;
for (int i=0;i<csi_part1_bytes;i++) { for (int i=0;i<csi_part1_bytes;i++) {
......
...@@ -1598,7 +1598,6 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac, ...@@ -1598,7 +1598,6 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac,
// TODO verify if SR can be transmitted in this mode // TODO verify if SR can be transmitted in this mode
pucch_pdu->payload = (pucch->sr_payload << O_ACK) | pucch->ack_payload; pucch_pdu->payload = (pucch->sr_payload << O_ACK) | pucch->ack_payload;
} }
else if (pucch->pucch_resource != NULL) { else if (pucch->pucch_resource != NULL) {
...@@ -1799,8 +1798,6 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac, ...@@ -1799,8 +1798,6 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac,
default: default:
AssertFatal(1==0,"Group hopping flag undefined (0,1,2) \n"); AssertFatal(1==0,"Group hopping flag undefined (0,1,2) \n");
} }
} }
...@@ -2195,7 +2192,8 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac, ...@@ -2195,7 +2192,8 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac,
sched_frame = (sched_frame + 1) % 1024; sched_frame = (sched_frame + 1) % 1024;
} }
AssertFatal(sched_slot < slots_per_frame, "sched_slot was calculated incorrect %d\n", sched_slot); AssertFatal(sched_slot < slots_per_frame, "sched_slot was calculated incorrect %d\n", sched_slot);
LOG_D(PHY,"HARQ pid %d is active for %d.%d (dl_slot %d, feedback_to_ul %d, is_common %d\n",dl_harq_pid, sched_frame,sched_slot,current_harq->dl_slot,current_harq->feedback_to_ul,current_harq->is_common); LOG_D(PHY,"HARQ pid %d is active for %d.%d (dl_slot %d, feedback_to_ul %d, is_common %d\n",
dl_harq_pid, sched_frame,sched_slot,current_harq->dl_slot,current_harq->feedback_to_ul,current_harq->is_common);
/* check if current tx slot should transmit downlink acknowlegment */ /* check if current tx slot should transmit downlink acknowlegment */
if (sched_frame == frame && sched_slot == slot) { if (sched_frame == frame && sched_slot == slot) {
if (get_softmodem_params()->emulate_l1) { if (get_softmodem_params()->emulate_l1) {
......
...@@ -1306,9 +1306,10 @@ int nr_acknack_scheduling(int mod_id, ...@@ -1306,9 +1306,10 @@ int nr_acknack_scheduling(int mod_id,
csi_pucch->ul_slot == pucch->ul_slot) { csi_pucch->ul_slot == pucch->ul_slot) {
// skip the CSI PUCCH if it is present and if in the next frame/slot // skip the CSI PUCCH if it is present and if in the next frame/slot
// and if we don't multiplex // and if we don't multiplex
// FIXME currently we support at most 11 bits in pucch2 so skip also in that case /* FIXME currently we support at most 11 bits in pucch2 so skip also in that case.
We need to set the limit to 10 because SR scheduling has been moved afterwards */
if(!csi_pucch->simultaneous_harqcsi if(!csi_pucch->simultaneous_harqcsi
|| ((csi_pucch->csi_bits + csi_pucch->dai_c) >= 11)) { || ((csi_pucch->csi_bits + csi_pucch->dai_c) >= 10)) {
LOG_D(NR_MAC,"Cannot multiplex csi_pucch %d +csi_pucch->dai_c %d for %d.%d\n",csi_pucch->csi_bits,csi_pucch->dai_c,csi_pucch->frame,csi_pucch->ul_slot); LOG_D(NR_MAC,"Cannot multiplex csi_pucch %d +csi_pucch->dai_c %d for %d.%d\n",csi_pucch->csi_bits,csi_pucch->dai_c,csi_pucch->frame,csi_pucch->ul_slot);
nr_fill_nfapi_pucch(RC.nrmac[mod_id], frame, slot, csi_pucch, UE); nr_fill_nfapi_pucch(RC.nrmac[mod_id], frame, slot, csi_pucch, UE);
memset(csi_pucch, 0, sizeof(*csi_pucch)); memset(csi_pucch, 0, sizeof(*csi_pucch));
...@@ -1328,9 +1329,7 @@ int nr_acknack_scheduling(int mod_id, ...@@ -1328,9 +1329,7 @@ int nr_acknack_scheduling(int mod_id,
else { else {
csi_pucch->timing_indicator = ind_found; csi_pucch->timing_indicator = ind_found;
csi_pucch->dai_c++; csi_pucch->dai_c++;
// keep updating format 2 indicator memset(pucch,0,sizeof(*pucch));
pucch->timing_indicator = ind_found; // index in the list of timing indicators
pucch->dai_c++;
LOG_D(NR_MAC,"multiplexing csi_pucch %d +csi_pucch->dai_c %d for %d.%d\n",csi_pucch->csi_bits,csi_pucch->dai_c,csi_pucch->frame,csi_pucch->ul_slot); LOG_D(NR_MAC,"multiplexing csi_pucch %d +csi_pucch->dai_c %d for %d.%d\n",csi_pucch->csi_bits,csi_pucch->dai_c,csi_pucch->frame,csi_pucch->ul_slot);
return 1; return 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment