Commit c6c1ffee authored by Thomas Schlichter's avatar Thomas Schlichter

improve NTN k2 value usage

parent 32dd605c
...@@ -813,7 +813,6 @@ uint8_t nr_ue_get_rach(module_id_t mod_id, ...@@ -813,7 +813,6 @@ uint8_t nr_ue_get_rach(module_id_t mod_id,
return ra->ra_state; return ra->ra_state;
} }
extern uint16_t NTN_UE_k2; //the additional k2 value at UE
void nr_get_RA_window(NR_UE_MAC_INST_t *mac) void nr_get_RA_window(NR_UE_MAC_INST_t *mac)
{ {
RA_config_t *ra = &mac->ra; RA_config_t *ra = &mac->ra;
......
...@@ -2170,15 +2170,12 @@ bool get_downlink_ack(NR_UE_MAC_INST_t *mac, frame_t frame, int slot, PUCCH_sche ...@@ -2170,15 +2170,12 @@ bool get_downlink_ack(NR_UE_MAC_INST_t *mac, frame_t frame, int slot, PUCCH_sche
if (current_harq->active) { if (current_harq->active) {
sched_slot = current_harq->dl_slot + current_harq->feedback_to_ul; sched_slot = current_harq->dl_slot + current_harq->feedback_to_ul + NTN_UE_k2;
int frame_offset = 1;
if (NTN_UE_k2 > 0)
frame_offset = NTN_UE_k2/slots_per_frame;
sched_frame = current_harq->dl_frame; sched_frame = current_harq->dl_frame;
if (sched_slot >= slots_per_frame) { if (sched_slot >= slots_per_frame) {
sched_frame = (sched_frame + sched_slot / slots_per_frame) % MAX_FRAME_NUMBER;
sched_slot %= slots_per_frame; sched_slot %= slots_per_frame;
sched_frame = (sched_frame + frame_offset) % 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\n", dl_harq_pid, sched_frame, sched_slot, current_harq->dl_slot, current_harq->feedback_to_ul); LOG_D(PHY, "HARQ pid %d is active for %d.%d (dl_slot %d, feedback_to_ul %d\n", dl_harq_pid, sched_frame, sched_slot, current_harq->dl_slot, current_harq->feedback_to_ul);
......
...@@ -1470,7 +1470,7 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac, uint8_t is_Msg3, frame_t curren ...@@ -1470,7 +1470,7 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac, uint8_t is_Msg3, frame_t curren
DURATION_RX_TO_TX); DURATION_RX_TO_TX);
*slot_tx = (current_slot + k2 + delta) % nr_slots_per_frame[mu]; *slot_tx = (current_slot + k2 + delta) % nr_slots_per_frame[mu];
*frame_tx = (current_frame + (current_slot + k2 + delta)/nr_slots_per_frame[mu]) % 1024; *frame_tx = (current_frame + (current_slot + k2 + delta)/nr_slots_per_frame[mu]) % MAX_FRAME_NUMBER;
} else { } else {
...@@ -1481,7 +1481,7 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac, uint8_t is_Msg3, frame_t curren ...@@ -1481,7 +1481,7 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac, uint8_t is_Msg3, frame_t curren
// Calculate TX slot and frame // Calculate TX slot and frame
*slot_tx = (current_slot + k2) % nr_slots_per_frame[mu]; *slot_tx = (current_slot + k2) % nr_slots_per_frame[mu];
*frame_tx = (current_frame + (current_slot + k2)/nr_slots_per_frame[mu]) % 1024; *frame_tx = (current_frame + (current_slot + k2)/nr_slots_per_frame[mu]) % MAX_FRAME_NUMBER;
} }
......
...@@ -708,7 +708,6 @@ static void nr_generate_Msg3_retransmission(module_id_t module_idP, ...@@ -708,7 +708,6 @@ static void nr_generate_Msg3_retransmission(module_id_t module_idP,
NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = ul_bwp->tdaList_Common; NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = ul_bwp->tdaList_Common;
int mu = ul_bwp->scs; int mu = ul_bwp->scs;
uint16_t K2 = *pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->k2 + NTN_gNB_k2; uint16_t K2 = *pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->k2 + NTN_gNB_k2;
//const int sched_frame = (frame + (slot + K2 >= nr_slots_per_frame[mu])) % 1024;
const int sched_frame = (frame + (slot + K2) / nr_slots_per_frame[mu]) % MAX_FRAME_NUMBER; const int sched_frame = (frame + (slot + K2) / nr_slots_per_frame[mu]) % MAX_FRAME_NUMBER;
const int sched_slot = (slot + K2) % nr_slots_per_frame[mu]; const int sched_slot = (slot + K2) % nr_slots_per_frame[mu];
...@@ -915,7 +914,7 @@ static void nr_get_Msg3alloc(module_id_t module_id, ...@@ -915,7 +914,7 @@ static void nr_get_Msg3alloc(module_id_t module_id,
for (int i=0; i<pusch_TimeDomainAllocationList->list.count; i++) { for (int i=0; i<pusch_TimeDomainAllocationList->list.count; i++) {
startSymbolAndLength = pusch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength; startSymbolAndLength = pusch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength;
SLIV2SL(startSymbolAndLength, &StartSymbolIndex, &NrOfSymbols); SLIV2SL(startSymbolAndLength, &StartSymbolIndex, &NrOfSymbols);
k2 = *pusch_TimeDomainAllocationList->list.array[i]->k2 + NTN_gNB_k2; k2 = *pusch_TimeDomainAllocationList->list.array[i]->k2 + NTN_gNB_k2;
LOG_D(NR_MAC,"Checking Msg3 TDA %d for Msg3_slot %d Msg3_start %d Msg3_nsymb %d: k2 %d, sliv %d,S %d L %d\n", LOG_D(NR_MAC,"Checking Msg3 TDA %d for Msg3_slot %d Msg3_start %d Msg3_nsymb %d: k2 %d, sliv %d,S %d L %d\n",
i, msg3_slot, Msg3start, Msg3maxsymb, (int)k2, (int)pusch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength, StartSymbolIndex, NrOfSymbols); i, msg3_slot, Msg3start, Msg3maxsymb, (int)k2, (int)pusch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength, StartSymbolIndex, NrOfSymbols);
// we want to transmit in the uplink symbols of mixed slot or the first uplink slot // we want to transmit in the uplink symbols of mixed slot or the first uplink slot
......
...@@ -2535,8 +2535,7 @@ int get_pdsch_to_harq_feedback(NR_PUCCH_Config_t *pucch_Config, ...@@ -2535,8 +2535,7 @@ int get_pdsch_to_harq_feedback(NR_PUCCH_Config_t *pucch_Config,
else { else {
AssertFatal(pucch_Config != NULL && pucch_Config->dl_DataToUL_ACK != NULL,"dl_DataToUL_ACK shouldn't be null here\n"); AssertFatal(pucch_Config != NULL && pucch_Config->dl_DataToUL_ACK != NULL,"dl_DataToUL_ACK shouldn't be null here\n");
for (int i = 0; i < pucch_Config->dl_DataToUL_ACK->list.count; i++) { for (int i = 0; i < pucch_Config->dl_DataToUL_ACK->list.count; i++) {
pdsch_to_harq_feedback[i] = *pucch_Config->dl_DataToUL_ACK->list.array[i]; pdsch_to_harq_feedback[i] = *pucch_Config->dl_DataToUL_ACK->list.array[i] + NTN_gNB_k2;
pdsch_to_harq_feedback[i] += NTN_gNB_k2;
} }
return pucch_Config->dl_DataToUL_ACK->list.count; return pucch_Config->dl_DataToUL_ACK->list.count;
} }
......
...@@ -308,7 +308,7 @@ void nr_schedule_srs(int module_id, frame_t frame, int slot) ...@@ -308,7 +308,7 @@ void nr_schedule_srs(int module_id, frame_t frame, int slot)
// we are sheduling SRS max_k2 slot in advance for the presence of SRS to be taken into account when scheduling PUSCH // we are sheduling SRS max_k2 slot in advance for the presence of SRS to be taken into account when scheduling PUSCH
const int n_slots_frame = nr_slots_per_frame[current_BWP->scs]; const int n_slots_frame = nr_slots_per_frame[current_BWP->scs];
const int sched_slot = (slot + max_k2) % n_slots_frame; const int sched_slot = (slot + max_k2) % n_slots_frame;
const int sched_frame = (frame + ((slot + max_k2) / n_slots_frame)) % 1024; const int sched_frame = (frame + ((slot + max_k2) / n_slots_frame)) % MAX_FRAME_NUMBER;
const uint16_t period = srs_period[srs_resource->resourceType.choice.periodic->periodicityAndOffset_p.present]; const uint16_t period = srs_period[srs_resource->resourceType.choice.periodic->periodicityAndOffset_p.present];
const uint16_t offset = get_nr_srs_offset(srs_resource->resourceType.choice.periodic->periodicityAndOffset_p); const uint16_t offset = get_nr_srs_offset(srs_resource->resourceType.choice.periodic->periodicityAndOffset_p);
......
...@@ -1262,7 +1262,7 @@ int nr_acknack_scheduling(gNB_MAC_INST *mac, ...@@ -1262,7 +1262,7 @@ int nr_acknack_scheduling(gNB_MAC_INST *mac,
// check if the slot is UL // check if the slot is UL
if(pucch_slot%nr_slots_period < first_ul_slot_period) if(pucch_slot%nr_slots_period < first_ul_slot_period)
continue; continue;
const int pucch_frame = (frame + ((slot + pdsch_to_harq_feedback[f]) / n_slots_frame)) & 1023; const int pucch_frame = (frame + ((slot + pdsch_to_harq_feedback[f]) / n_slots_frame)) % MAX_FRAME_NUMBER;
// we store PUCCH resources according to slot, TDD configuration and size of the vector containing PUCCH structures // we store PUCCH resources according to slot, TDD configuration and size of the vector containing PUCCH structures
const int pucch_index = get_pucch_index(pucch_frame, pucch_slot, n_slots_frame, tdd, sched_ctrl->sched_pucch_size); const int pucch_index = get_pucch_index(pucch_frame, pucch_slot, n_slots_frame, tdd, sched_ctrl->sched_pucch_size);
NR_sched_pucch_t *curr_pucch = &sched_ctrl->sched_pucch[pucch_index]; NR_sched_pucch_t *curr_pucch = &sched_ctrl->sched_pucch[pucch_index];
......
...@@ -1946,7 +1946,6 @@ static bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_ ...@@ -1946,7 +1946,6 @@ static bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_
const int temp_tda = get_ul_tda(nr_mac, scc, frame, slot); const int temp_tda = get_ul_tda(nr_mac, scc, frame, slot);
NR_PUSCH_TimeDomainResourceAllocationList_t *tdaList = get_ul_tdalist(current_BWP, sched_ctrl->coreset->controlResourceSetId, sched_ctrl->search_space->searchSpaceType->present, NR_RNTI_C); NR_PUSCH_TimeDomainResourceAllocationList_t *tdaList = get_ul_tdalist(current_BWP, sched_ctrl->coreset->controlResourceSetId, sched_ctrl->search_space->searchSpaceType->present, NR_RNTI_C);
int K2 = get_K2(tdaList, temp_tda, mu); int K2 = get_K2(tdaList, temp_tda, mu);
//const int sched_frame = (frame + (slot + K2 >= nr_slots_per_frame[mu])) & 1023;
const int sched_frame = (frame + (slot + K2) / nr_slots_per_frame[mu]) % MAX_FRAME_NUMBER; const int sched_frame = (frame + (slot + K2) / nr_slots_per_frame[mu]) % MAX_FRAME_NUMBER;
const int sched_slot = (slot + K2) % nr_slots_per_frame[mu]; const int sched_slot = (slot + K2) % nr_slots_per_frame[mu];
const int tda = get_ul_tda(nr_mac, scc, sched_frame, sched_slot); const int tda = get_ul_tda(nr_mac, scc, sched_frame, sched_slot);
......
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