Commit 28f2129d authored by Ejaz Ahmed's avatar Ejaz Ahmed

Added harq_feedback condition; Added more logs

parent 238a7837
......@@ -2280,7 +2280,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
LOG_D(NR_PHY, "calling sl_indication: RX %d.%d TX %d.%d %s\n",proc->frame_rx,proc->nr_slot_rx,proc->frame_tx,proc->nr_slot_tx, __FUNCTION__);
nr_fill_sl_indication(&sl_indication, NULL, &sci_ind, proc, ue, phy_data);
ue->if_inst->sl_indication(&sl_indication);
LOG_I(NR_PHY,"Returning from SCI2 SL indication\n");
LOG_D(NR_PHY,"Returning from SCI2 SL indication\n");
//
}
} // (not ML || nrOfLayers==1 ) AND pssch and sci2 REs to handle
......
......@@ -746,7 +746,7 @@ int phy_procedures_nrUE_SL_TX(PHY_VARS_NR_UE *ue,
&phy_data->nr_sl_psfch_pdu);
sl_phy_params->psfch.num_psfch_tx ++;
tx_action = 1;
LOG_I(NR_PHY, "Sending SL data frame %d slot %d\n", frame_tx, slot_tx);
LOG_D(NR_PHY, "Sending SL data frame %d slot %d\n", frame_tx, slot_tx);
}
if (tx_action) {
nr_ue_pusch_common_procedures(ue,
......
......@@ -64,13 +64,13 @@ bool nr_schedule_slsch(NR_UE_MAC_INST_t *mac, int frameP,int slotP, nr_sci_pdu_t
sci_pdu->beta_offset_indicator = 0;
// Fill SCI2A
sci2_pdu->harq_pid = slotP; // slotP FIXIT - The value should only be 0-15 which can be in 4-bits
sci2_pdu->harq_pid = slotP%16; // slotP FIXIT - The value should only be 0-15 which can be in 4-bits
sci2_pdu->ndi = (1-sci2_pdu->ndi)&1;
sci2_pdu->rv_index=0;
sci2_pdu->source_id=0x12;
sci2_pdu->dest_id=0xabcd;
sci2_pdu->harq_feedback=1;
sci2_pdu->cast_type=2;
sci2_pdu->cast_type=1;
if (format2==NR_SL_SCI_FORMAT_2C || format2==NR_SL_SCI_FORMAT_2A)
sci2_pdu->csi_req=1;
if (format2==NR_SL_SCI_FORMAT_2B)
......
......@@ -645,55 +645,55 @@ void nr_ue_process_mac_sl_pdu(int module_idP,
return;
}
LOG_D(NR_MAC, "Filling psfch pdu %d\n", module_idP);
NR_SL_PSFCH_Config_r16_t *sl_psfch_config = mac->sl_tx_res_pool->sl_PSFCH_Config_r16->choice.setup;
const uint8_t time_gap[] = {2, 3};
uint8_t psfch_min_time_gap = time_gap[*sl_psfch_config->sl_MinTimeGapPSFCH_r16];
uint8_t harq_pid = (rx_ind->rx_indication_body + pdu_id)->rx_slsch_pdu.harq_pid;
mac->sl_info.list[0] = calloc(1, sizeof(NR_SL_UE_info_t));
harq_proc = &mac->sl_info.list[0]->UE_sched_ctrl.sl_harq_processes[harq_pid];
const uint8_t psfch_periods[] = {0,1,2,4};
long psfch_period = (sl_psfch_config->sl_PSFCH_Period_r16)
? psfch_periods[*sl_psfch_config->sl_PSFCH_Period_r16] : 0;
int delta_slots = (slot + psfch_min_time_gap) % psfch_period ? psfch_period - (slot + psfch_min_time_gap) % psfch_period: 0;
sched_slot = slot + psfch_min_time_gap + delta_slots;
sched_frame = frame;
if (sched_slot >= NR_MAX_SLOTS_PER_FRAME) {
sched_slot %= NR_MAX_SLOTS_PER_FRAME;
sched_frame = (sched_frame + 1) %1024;
}
if (mac->sci_pdu_rx.harq_feedback) {
NR_SL_PSFCH_Config_r16_t *sl_psfch_config = mac->sl_tx_res_pool->sl_PSFCH_Config_r16->choice.setup;
const uint8_t time_gap[] = {2, 3};
uint8_t psfch_min_time_gap = time_gap[*sl_psfch_config->sl_MinTimeGapPSFCH_r16];
uint8_t harq_pid = (rx_ind->rx_indication_body + pdu_id)->rx_slsch_pdu.harq_pid;
harq_proc->feedback_slot = sched_slot;
harq_proc->feedback_frame = sched_frame;
harq_proc->is_active = true;
LOG_I(NR_MAC, "harq pid: %p:%d:%d psfch_period %d, delta_slots %d, feedback frame:slot %d:%d, frame:slot %d:%d, time_gap %d\n", harq_proc, harq_pid, mac->sl_info.list[0]->UE_sched_ctrl.sl_harq_processes[harq_pid].is_active, psfch_period, delta_slots, harq_proc->feedback_frame, harq_proc->feedback_slot, frame, slot, psfch_min_time_gap);
uint8_t ack_nack = (rx_ind->rx_indication_body + pdu_id)->rx_slsch_pdu.ack_nack;
mac->sl_tx_config_psfch_pdu[harq_pid] = calloc(1, sizeof(sl_nr_tx_config_psfch_pdu_t));
uint16_t m0 = compute_m0(module_idP);
mac->sl_tx_config_psfch_pdu[harq_pid]->initial_cyclic_shift = m0;
if (mac->sci1_pdu.second_stage_sci_format == 2 ||
mac->sci_pdu_rx.cast_type == 1 ||
mac->sci_pdu_rx.cast_type == 2) {
mac->sl_tx_config_psfch_pdu[harq_pid]->mcs = sequence_cyclic_shift_harq_ack_or_ack_or_only_nack[ack_nack];
} else if (mac->sci1_pdu.second_stage_sci_format == 1 ||
(mac->sci1_pdu.second_stage_sci_format == 1 && mac->sci_pdu_rx.cast_type == 3)) {
mac->sl_tx_config_psfch_pdu[harq_pid]->mcs = sequence_cyclic_shift_harq_ack_or_ack_or_only_nack[0];
}
mac->sl_info.list[0] = calloc(1, sizeof(NR_SL_UE_info_t));
harq_proc = &mac->sl_info.list[0]->UE_sched_ctrl.sl_harq_processes[harq_pid];
const uint8_t psfch_periods[] = {0,1,2,4};
long psfch_period = (sl_psfch_config->sl_PSFCH_Period_r16)
? psfch_periods[*sl_psfch_config->sl_PSFCH_Period_r16] : 0;
int delta_slots = (slot + psfch_min_time_gap) % psfch_period ? psfch_period - (slot + psfch_min_time_gap) % psfch_period: 0;
sched_slot = slot + psfch_min_time_gap + delta_slots;
sched_frame = frame;
if (sched_slot >= NR_MAX_SLOTS_PER_FRAME) {
sched_slot %= NR_MAX_SLOTS_PER_FRAME;
sched_frame = (sched_frame + 1) % 1024;
}
const uint8_t values[] = {7, 8, 9, 10, 11, 12, 13, 14};
NR_SL_BWP_Generic_r16_t *sl_bwp = mac->sl_bwp->sl_BWP_Generic_r16;
uint8_t sl_num_symbols = *sl_bwp->sl_LengthSymbols_r16 ?
values[*sl_bwp->sl_LengthSymbols_r16] : 0;
mac->sl_tx_config_psfch_pdu[harq_pid]->start_symbol_index = *sl_bwp->sl_StartSymbol_r16 + sl_num_symbols - 2; // start_symbol_index has been used as lprime and lprime should be computed as lprime = start symbol + sl_LengthSymbols_r16 - 2
mac->sl_tx_config_psfch_pdu[harq_pid]->hopping_id = *mac->sl_bwp->sl_BWP_PoolConfigCommon_r16->sl_TxPoolSelectedNormal_r16->list.array[0]->sl_ResourcePool_r16->sl_PSFCH_Config_r16->choice.setup->sl_PSFCH_HopID_r16;
mac->sl_tx_config_psfch_pdu[harq_pid]->prb = 1;
mac->sl_tx_config_psfch_pdu[harq_pid]->psfch_payload = 1;
mac->sl_tx_config_psfch_pdu[harq_pid]->bit_len_harq = 1;
LOG_I(NR_MAC,"Filled psfch pdu\n");
harq_proc->feedback_slot = sched_slot;
harq_proc->feedback_frame = sched_frame;
harq_proc->is_active = true;
LOG_D(NR_MAC, "harq pid: %p:%d:%d psfch_period %d, delta_slots %d, feedback frame:slot %d:%d, frame:slot %d:%d, time_gap %d, harq feedback %d\n", harq_proc, harq_pid, mac->sl_info.list[0]->UE_sched_ctrl.sl_harq_processes[harq_pid].is_active, psfch_period, delta_slots, harq_proc->feedback_frame, harq_proc->feedback_slot, frame, slot, psfch_min_time_gap, mac->sci_pdu_rx.harq_feedback);
uint8_t ack_nack = (rx_ind->rx_indication_body + pdu_id)->rx_slsch_pdu.ack_nack;
mac->sl_tx_config_psfch_pdu[harq_pid] = calloc(1, sizeof(sl_nr_tx_config_psfch_pdu_t));
uint16_t m0 = compute_m0(module_idP);
mac->sl_tx_config_psfch_pdu[harq_pid]->initial_cyclic_shift = m0;
if (mac->sci1_pdu.second_stage_sci_format == 2 ||
mac->sci_pdu_rx.cast_type == 1 ||
mac->sci_pdu_rx.cast_type == 2) {
mac->sl_tx_config_psfch_pdu[harq_pid]->mcs = sequence_cyclic_shift_harq_ack_or_ack_or_only_nack[ack_nack];
} else if (mac->sci1_pdu.second_stage_sci_format == 1 ||
(mac->sci1_pdu.second_stage_sci_format == 1 && mac->sci_pdu_rx.cast_type == 3)) {
mac->sl_tx_config_psfch_pdu[harq_pid]->mcs = sequence_cyclic_shift_harq_ack_or_ack_or_only_nack[0];
}
const uint8_t values[] = {7, 8, 9, 10, 11, 12, 13, 14};
NR_SL_BWP_Generic_r16_t *sl_bwp = mac->sl_bwp->sl_BWP_Generic_r16;
uint8_t sl_num_symbols = *sl_bwp->sl_LengthSymbols_r16 ?
values[*sl_bwp->sl_LengthSymbols_r16] : 0;
mac->sl_tx_config_psfch_pdu[harq_pid]->start_symbol_index = *sl_bwp->sl_StartSymbol_r16 + sl_num_symbols - 2; // start_symbol_index has been used as lprime and lprime should be computed as lprime = start symbol + sl_LengthSymbols_r16 - 2
mac->sl_tx_config_psfch_pdu[harq_pid]->hopping_id = *mac->sl_bwp->sl_BWP_PoolConfigCommon_r16->sl_TxPoolSelectedNormal_r16->list.array[0]->sl_ResourcePool_r16->sl_PSFCH_Config_r16->choice.setup->sl_PSFCH_HopID_r16;
mac->sl_tx_config_psfch_pdu[harq_pid]->prb = 1;
mac->sl_tx_config_psfch_pdu[harq_pid]->psfch_payload = 1;
mac->sl_tx_config_psfch_pdu[harq_pid]->bit_len_harq = 1;
LOG_I(NR_MAC,"Filled psfch pdu\n");
}
if ((rx_ind->rx_indication_body + pdu_id)->rx_slsch_pdu.ack_nack == 0)
return;
......
......@@ -3293,6 +3293,7 @@ bool nr_ue_sl_pssch_scheduler(NR_UE_MAC_INST_t *mac,
NR_SL_SCI_FORMAT_2A);
int buflen = tx_config->tx_config_list[0].tx_pscch_pssch_config_pdu.tb_size;
LOG_I(NR_MAC, "\n", tx_config->tx_config_list[0].tx_pscch_pssch_config_pdu.sci2_payload);
NR_UE_MAC_CE_INFO mac_ce_info = {0};
NR_UE_MAC_CE_INFO *mac_ce_p=&mac_ce_info;
......@@ -3539,11 +3540,10 @@ void nr_ue_sidelink_scheduler(nr_sidelink_indication_t *sl_ind) {
if (sl_ind->slot_type == SIDELINK_SLOT_TYPE_TX) {
frame = sl_ind->frame_tx;
slot = sl_ind->slot_tx;
LOG_D(NR_PHY, "frame: %d, slot %d, type: %d\n", frame, slot, sl_ind->slot_type);
}
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
LOG_D(NR_MAC, "harq feedback %d\n", mac->sci_pdu_rx.harq_feedback);
LOG_I(NR_MAC, "frame: %d, slot %d, slot type: %d, harq feedback %d\n", frame, slot, sl_ind->slot_type, mac->sci_pdu_rx.harq_feedback);
sl_nr_ue_mac_params_t *sl_mac = mac->SL_MAC_PARAMS;
sl_nr_phy_config_request_t *sl_cfg = &sl_mac->sl_phy_config.sl_config_req;
......@@ -3607,7 +3607,7 @@ void nr_ue_sidelink_scheduler(nr_sidelink_indication_t *sl_ind) {
//Check if reserved slot or a sidelink resource configured in Rx/Tx resource pool timeresource bitmap
nr_ue_sl_pssch_scheduler(mac,sl_ind, mac->sl_bwp, mac->sl_tx_res_pool,&tx_config, &tti_action);
}
// harq_feedback value has issue, more often it is displaying as zero
// FIXIT: harq_feedback value has issue, more often it is displaying as zero
if (sl_ind->slot_type == SIDELINK_SLOT_TYPE_TX && mac->sci_pdu_rx.harq_feedback) {
NR_SL_PSFCH_Config_r16_t *sl_psfch_config = mac->sl_tx_res_pool->sl_PSFCH_Config_r16->choice.setup;
const uint8_t psfch_periods[] = {0,1,2,4};
......@@ -3617,23 +3617,24 @@ void nr_ue_sidelink_scheduler(nr_sidelink_indication_t *sl_ind) {
if (slot%psfch_period == 0) {
for (int harq_pid = 0; harq_pid < 16; harq_pid++) {
current_harq = &mac->sl_info.list[0]->UE_sched_ctrl.sl_harq_processes[harq_pid];
//if (current_harq->is_active)
LOG_D(NR_MAC, "harq is active %p:%d\n", current_harq, current_harq->is_active);
sl_ind->slot_tx = current_harq->feedback_slot;
sl_ind->frame_tx = current_harq->feedback_frame;
if (current_harq->feedback_slot > 0 && current_harq->feedback_frame > 0 && current_harq->is_active) {
LOG_D(NR_MAC, "Feedback frame %d:%d HARQ is_active %d\n", current_harq->feedback_frame, current_harq->feedback_slot, current_harq->is_active);
if (current_harq->is_active) {
LOG_D(NR_MAC, "harq pid %d, sl_ind->frame_tx %d, sl_ind->slot_tx %d, frame %d, slot %d\n", harq_pid, sl_ind->frame_tx, sl_ind->slot_tx, frame, slot);
if (current_harq->feedback_slot == slot && current_harq->feedback_frame == frame && current_harq->is_active) {
LOG_I(NR_MAC, "Scheduling PSFCH transmission at frame %d slot %d for harq_pid %d\n", current_harq->feedback_frame, current_harq->feedback_slot, harq_pid);
LOG_D(NR_MAC, "Scheduling PSFCH transmission at frame %d slot %d for harq_pid %d\n", current_harq->feedback_frame, current_harq->feedback_slot, harq_pid);
nr_ue_sl_psfch_scheduler(mac, sl_ind, mac->sl_bwp, mac->sl_tx_res_pool, &tx_config, &tti_action);
current_harq->is_active = false;
current_harq->feedback_slot = -1;
current_harq->feedback_frame = -1;
break;
}
}
}
}
}
//}
if (tti_action == SL_NR_CONFIG_TYPE_RX_PSBCH || tti_action == SL_NR_CONFIG_TYPE_RX_PSCCH || tti_action == SL_NR_CONFIG_TYPE_RX_PSSCH_SCI || tti_action == SL_NR_CONFIG_TYPE_RX_PSSCH_SLSCH) {
fill_scheduled_response(&scheduled_response, NULL, NULL, NULL, &rx_config, NULL, mod_id, 0,frame, slot, sl_ind->phy_data);
}
......
......@@ -816,7 +816,7 @@ int nr_ue_process_sci2_indication_pdu(NR_UE_MAC_INST_t *mac,module_id_t mod_id,f
sci->sci_format_type,sci->Nid,sci->subch_index,sci->sci_payloadlen,*(unsigned long long*)sci->sci_payloadBits);
AssertFatal(sci->sci_format_type == SL_SCI_FORMAT_2_ON_PSSCH, "need to have format 2 here only\n");
extract_pssch_sci_pdu((uint64_t *)sci->sci_payloadBits, sci->sci_payloadlen,sl_bwp, sl_res_pool, sci_pdu);
LOG_D(NR_MAC,"SCI2A: harq_pid %d ndi %d RV %d SRC %x DST %x HARQ_FB %d Cast %d CSI_Req %d\n", sci_pdu->harq_pid,sci_pdu->ndi,sci_pdu->rv_index,sci_pdu->source_id,sci_pdu->dest_id,sci_pdu->harq_feedback,sci_pdu->cast_type,sci_pdu->csi_req);
LOG_I(NR_MAC,"SCI2A: harq_pid %d ndi %d RV %d SRC %x DST %x HARQ_FB %d Cast %d CSI_Req %d\n", sci_pdu->harq_pid,sci_pdu->ndi,sci_pdu->rv_index,sci_pdu->source_id,sci_pdu->dest_id,sci_pdu->harq_feedback,sci_pdu->cast_type,sci_pdu->csi_req);
// send schedule response
sl_nr_rx_config_request_t rx_config;
......@@ -882,7 +882,7 @@ extract_pssch_sci_pdu(uint64_t *sci2_payload, int len,
fsize = 1;
pos+=fsize;
sci_pdu->harq_feedback = *sci2_payload>>(sci2_size-pos)&((1<<fsize)-1);
LOG_D(NR_MAC,"harq_feedback (%d) in pos %d\n",sci_pdu->harq_feedback,pos-fsize);
LOG_I(NR_MAC,"harq_feedback (%d) in pos %d sci2_payload %lu, (sci2_size-pos) %d, mask %d\n",sci_pdu->harq_feedback, pos-fsize, *sci2_payload, (sci2_size-pos), ((1<<fsize)-1));
//cast_type // 2 bits formac 2A
fsize = 2;
......
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