Removed SIB19 related UE arguments
- Removed ntn_koffset, ntn_ta_common, ntn_ta_commondrift arguments in order to be used directly from SIB19 - Removed global NTN_UE_Koffset variable and it's use - Introduced getter functions for ntn related parameters
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
#define _GNU_SOURCE
|
||||
#define SPEED_OF_LIGHT 299792458
|
||||
|
||||
//#include "mac_defs.h"
|
||||
#include "mac_defs.h"
|
||||
#include <NR_MAC_gNB/mac_proto.h>
|
||||
#include "NR_MAC_UE/mac_proto.h"
|
||||
#include "NR_MAC-CellGroupConfig.h"
|
||||
@@ -254,7 +254,7 @@ static void config_common_ue(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
mac->phy_config.Mod_id = mac->ue_id;
|
||||
mac->phy_config.CC_id = cc_idP;
|
||||
|
||||
|
||||
// carrier config
|
||||
LOG_D(MAC, "[UE %d] Entering UE Config Common\n", mac->ue_id);
|
||||
|
||||
@@ -1771,28 +1771,32 @@ static double calculate_ue_sat_ta(position_t *position_params, struct NR_Positio
|
||||
void nr_rrc_mac_config_req_sib19_r17(module_id_t module_id, NR_SIB19_r17_t *sib19_r17)
|
||||
{
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||
struct NR_NTN_Config_r17 *ntn_Config_r17 = mac->sc_info.ntn_Config_r17;
|
||||
|
||||
// ntn-Config-r17 deep copy into mac
|
||||
asn_copy(&asn_DEF_NR_NTN_Config_r17, (void **)&mac->sc_info.ntn_Config_r17, sib19_r17->ntn_Config_r17);
|
||||
// update ntn_Config_r17 with received values
|
||||
UPDATE_IE(ntn_Config_r17, sib19_r17->ntn_Config_r17, NR_NTN_Config_r17_t);
|
||||
|
||||
// populate ntn_ta structure from mac
|
||||
// if ephemerisInfo_r17 present in SIB19
|
||||
struct NR_EphemerisInfo_r17 *ephemeris_info = mac->sc_info.ntn_Config_r17->ephemerisInfo_r17;
|
||||
struct NR_PositionVelocity_r17 *position_velocity = mac->sc_info.ntn_Config_r17->ephemerisInfo_r17->choice.positionVelocity_r17;
|
||||
|
||||
if (ephemeris_info && position_velocity
|
||||
&& (position_velocity->positionX_r17 != 0 || position_velocity->positionY_r17 != 0
|
||||
|| position_velocity->positionZ_r17 != 0)) {
|
||||
mac->ntn_ta.N_UE_TA_adj =
|
||||
calculate_ue_sat_ta(get_position(module_id), mac->sc_info.ntn_Config_r17->ephemerisInfo_r17->choice.positionVelocity_r17);
|
||||
struct NR_EphemerisInfo_r17 *ephemeris_info = ntn_Config_r17->ephemerisInfo_r17;
|
||||
if (ephemeris_info) {
|
||||
struct NR_PositionVelocity_r17 *position_velocity = ntn_Config_r17->ephemerisInfo_r17->choice.positionVelocity_r17;
|
||||
if (position_velocity
|
||||
&& (position_velocity->positionX_r17 != 0 || position_velocity->positionY_r17 != 0
|
||||
|| position_velocity->positionZ_r17 != 0)) {
|
||||
mac->ntn_ta.N_UE_TA_adj = calculate_ue_sat_ta(get_position_coordinates(module_id), position_velocity);
|
||||
}
|
||||
}
|
||||
// if cellSpecificKoffset_r17 is present
|
||||
if (sib19_r17->ntn_Config_r17->cellSpecificKoffset_r17) {
|
||||
mac->ntn_ta.cell_specific_k_offset = *sib19_r17->ntn_Config_r17->cellSpecificKoffset_r17;
|
||||
if (ntn_Config_r17->cellSpecificKoffset_r17) {
|
||||
mac->ntn_ta.cell_specific_k_offset = *ntn_Config_r17->cellSpecificKoffset_r17;
|
||||
}
|
||||
// Check if ta_Info_r17 is present and convert directly ta_Common_r17 (is in units of 4.072e-3 µs)
|
||||
if (sib19_r17->ntn_Config_r17->ta_Info_r17) {
|
||||
mac->ntn_ta.N_common_ta_adj = sib19_r17->ntn_Config_r17->ta_Info_r17->ta_Common_r17 * 4.072e-6;
|
||||
if (ntn_Config_r17->ta_Info_r17) {
|
||||
mac->ntn_ta.N_common_ta_adj = ntn_Config_r17->ta_Info_r17->ta_Common_r17 * 4.072e-6;
|
||||
// ta_CommonDrift_r17 (is in units of 0.2e-3 µs/s)
|
||||
if (ntn_Config_r17->ta_Info_r17->ta_CommonDrift_r17)
|
||||
mac->ntn_ta.ntn_ta_commondrift = *ntn_Config_r17->ta_Info_r17->ta_CommonDrift_r17 * 0.2e-3;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2638,4 +2642,4 @@ void nr_rrc_mac_config_req_cg(module_id_t module_id,
|
||||
ue_init_config_request(mac, mac->current_DL_BWP->scs);
|
||||
ret = pthread_mutex_unlock(&mac->if_mutex);
|
||||
AssertFatal(!ret, "mutex failed %d\n", ret);
|
||||
}
|
||||
}
|
||||
@@ -485,7 +485,6 @@ typedef struct nr_lcordered_info_s {
|
||||
bool lc_SRMask;
|
||||
} nr_lcordered_info_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t payload[NR_CCCH_PAYLOAD_SIZE_MAX];
|
||||
} __attribute__ ((__packed__)) NR_CCCH_PDU;
|
||||
@@ -555,9 +554,13 @@ typedef struct {
|
||||
} si_schedInfo_t;
|
||||
|
||||
typedef struct ntn_timing_advance_components {
|
||||
// N_common_ta_adj and N_UE_TA_adj are in ms
|
||||
// N_common_ta_adj represents common propagation delay received in SIB19 (ms)
|
||||
double N_common_ta_adj;
|
||||
// N_UE_TA_adj calculated propagation delay from UE and SAT (ms)
|
||||
double N_UE_TA_adj;
|
||||
// drift rate of common ta in µs/s
|
||||
double ntn_ta_commondrift;
|
||||
// cell scheduling offset expressed in terms of 15kHz SCS
|
||||
long cell_specific_k_offset;
|
||||
} ntn_timing_advance_componets_t;
|
||||
|
||||
@@ -670,5 +673,9 @@ typedef struct NR_UE_MAC_INST_s {
|
||||
ue_mac_stats_t stats;
|
||||
} NR_UE_MAC_INST_t;
|
||||
|
||||
#define GET_NTN_UE_K_OFFSET(mac, scs) (mac->ntn_ta.cell_specific_k_offset << scs)
|
||||
#define GET_COMPLETE_TIME_ADVANCE_MS(mac) ((mac)->ntn_ta.N_common_ta_adj + (mac)->ntn_ta.N_UE_TA_adj * 2)
|
||||
#define GET_DURATION_RX_TO_TX(mac) (NR_UE_CAPABILITY_SLOT_RX_TO_TX + (mac)->ntn_ta.cell_specific_k_offset)
|
||||
|
||||
/*@}*/
|
||||
#endif /*__LAYER2_MAC_DEFS_H__ */
|
||||
|
||||
@@ -42,12 +42,6 @@
|
||||
#include "openair2/LAYER2/RLC/rlc.h"
|
||||
#include "openair2/LAYER2/NR_MAC_UE/mac_defs.h"
|
||||
|
||||
#include "nr-uesoftmodem.h"
|
||||
|
||||
static double get_ta_Common_ms(const ntn_timing_advance_componets_t* ntn_ta)
|
||||
{
|
||||
return (ntn_ta->N_common_ta_adj + ntn_ta->N_UE_TA_adj) * 2;
|
||||
}
|
||||
|
||||
int16_t get_prach_tx_power(NR_UE_MAC_INST_t *mac)
|
||||
{
|
||||
@@ -622,7 +616,7 @@ void nr_Msg3_transmitted(NR_UE_MAC_INST_t *mac, uint8_t CC_id, frame_t frameP, s
|
||||
{
|
||||
RA_config_t *ra = &mac->ra;
|
||||
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = mac->current_UL_BWP->rach_ConfigCommon;
|
||||
const double ta_Common_ms = get_ta_Common_ms(&mac->ntn_ta);
|
||||
const double ta_Common_ms = GET_COMPLETE_TIME_ADVANCE_MS(mac);
|
||||
const int mu = mac->current_UL_BWP->scs;
|
||||
const int slots_per_ms = nr_slots_per_frame[mu] / 10;
|
||||
|
||||
@@ -923,7 +917,7 @@ void nr_get_RA_window(NR_UE_MAC_INST_t *mac)
|
||||
|
||||
NR_RACH_ConfigCommon_t *setup = mac->current_UL_BWP->rach_ConfigCommon;
|
||||
AssertFatal(&setup->rach_ConfigGeneric != NULL, "In %s: FATAL! rach_ConfigGeneric is NULL...\n", __FUNCTION__);
|
||||
const double ta_Common_ms = get_ta_Common_ms(&mac->ntn_ta);
|
||||
const double ta_Common_ms = GET_COMPLETE_TIME_ADVANCE_MS(mac);
|
||||
const int mu = mac->current_DL_BWP->scs;
|
||||
const int slots_per_ms = nr_slots_per_frame[mu] / 10;
|
||||
|
||||
|
||||
@@ -147,13 +147,6 @@ static nr_dci_format_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
const uint8_t *dci_pdu,
|
||||
const int slot);
|
||||
|
||||
static int get_NTN_UE_Koffset(NR_NTN_Config_r17_t *ntn_Config_r17, int scs)
|
||||
{
|
||||
if (ntn_Config_r17 && ntn_Config_r17->cellSpecificKoffset_r17)
|
||||
return *ntn_Config_r17->cellSpecificKoffset_r17 << scs;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int get_rnti_type(const NR_UE_MAC_INST_t *mac, const uint16_t rnti)
|
||||
{
|
||||
const RA_config_t *ra = &mac->ra;
|
||||
@@ -506,7 +499,7 @@ static int nr_ue_process_dci_ul_00(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
frame_t frame_tx;
|
||||
int slot_tx;
|
||||
const int ntn_ue_koffset = get_NTN_UE_Koffset(mac->sc_info.ntn_Config_r17, mac->current_UL_BWP->scs);
|
||||
const int ntn_ue_koffset = GET_NTN_UE_K_OFFSET(mac, mac->current_UL_BWP->scs);
|
||||
if (-1 == nr_ue_pusch_scheduler(mac, 0, frame, slot, &frame_tx, &slot_tx, tda_info.k2 + ntn_ue_koffset)) {
|
||||
LOG_E(MAC, "Cannot schedule PUSCH\n");
|
||||
return -1;
|
||||
@@ -604,7 +597,7 @@ static int nr_ue_process_dci_ul_01(NR_UE_MAC_INST_t *mac,
|
||||
tda_info.k2 = csi_K2;
|
||||
}
|
||||
|
||||
const int ntn_ue_koffset = get_NTN_UE_Koffset(mac->sc_info.ntn_Config_r17, mac->current_UL_BWP->scs);
|
||||
const int ntn_ue_koffset = GET_NTN_UE_K_OFFSET(mac, mac->current_UL_BWP->scs);
|
||||
if (-1 == nr_ue_pusch_scheduler(mac, 0, frame, slot, &frame_tx, &slot_tx, tda_info.k2 + ntn_ue_koffset)) {
|
||||
LOG_E(MAC, "Cannot schedule PUSCH\n");
|
||||
return -1;
|
||||
@@ -921,14 +914,14 @@ static int nr_ue_process_dci_dl_10(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
/* PDSCH_TO_HARQ_FEEDBACK_TIME_IND */
|
||||
// according to TS 38.213 9.2.3
|
||||
const int ntn_ue_koffset = get_NTN_UE_Koffset(mac->sc_info.ntn_Config_r17, dlsch_pdu->SubcarrierSpacing);
|
||||
const int ntn_ue_koffset = GET_NTN_UE_K_OFFSET(mac, dlsch_pdu->SubcarrierSpacing);
|
||||
const uint16_t feedback_ti = 1 + dci->pdsch_to_harq_feedback_timing_indicator.val + ntn_ue_koffset;
|
||||
|
||||
if (rnti_type != TYPE_RA_RNTI_ && rnti_type != TYPE_SI_RNTI_) {
|
||||
AssertFatal(feedback_ti > DURATION_RX_TO_TX,
|
||||
"PDSCH to HARQ feedback time (%d) needs to be higher than DURATION_RX_TO_TX (%d).\n",
|
||||
AssertFatal(feedback_ti > GET_DURATION_RX_TO_TX(mac),
|
||||
"PDSCH to HARQ feedback time (%d) needs to be higher than DURATION_RX_TO_TX (%ld).\n",
|
||||
feedback_ti,
|
||||
DURATION_RX_TO_TX);
|
||||
GET_DURATION_RX_TO_TX(mac));
|
||||
// set the harq status at MAC for feedback
|
||||
const int tpc[] = {-1, 0, 1, 3};
|
||||
set_harq_status(mac,
|
||||
@@ -1266,14 +1259,14 @@ static int nr_ue_process_dci_dl_11(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
/* PDSCH_TO_HARQ_FEEDBACK_TIME_IND */
|
||||
// according to TS 38.213 Table 9.2.3-1
|
||||
const int ntn_ue_koffset = get_NTN_UE_Koffset(mac->sc_info.ntn_Config_r17, dlsch_pdu->SubcarrierSpacing);
|
||||
const int ntn_ue_koffset = GET_NTN_UE_K_OFFSET(mac, dlsch_pdu->SubcarrierSpacing);
|
||||
const uint16_t feedback_ti = pucch_Config->dl_DataToUL_ACK->list.array[dci->pdsch_to_harq_feedback_timing_indicator.val][0] + ntn_ue_koffset;
|
||||
|
||||
AssertFatal(feedback_ti > DURATION_RX_TO_TX,
|
||||
"PDSCH to HARQ feedback time (%d) needs to be higher than DURATION_RX_TO_TX (%d). Min feedback time set in config "
|
||||
AssertFatal(feedback_ti > GET_DURATION_RX_TO_TX(mac),
|
||||
"PDSCH to HARQ feedback time (%d) needs to be higher than DURATION_RX_TO_TX (%ld). Min feedback time set in config "
|
||||
"file (min_rxtxtime).\n",
|
||||
feedback_ti,
|
||||
DURATION_RX_TO_TX);
|
||||
GET_DURATION_RX_TO_TX(mac));
|
||||
|
||||
// set the harq status at MAC for feedback
|
||||
const int tpc[] = {-1, 0, 1, 3};
|
||||
@@ -3453,7 +3446,7 @@ static void set_time_alignment(NR_UE_MAC_INST_t *mac, int ta, ta_type_t type, in
|
||||
ul_time_alignment->ta_command = ta;
|
||||
ul_time_alignment->ta_apply = type;
|
||||
|
||||
const int ntn_ue_koffset = get_NTN_UE_Koffset(mac->sc_info.ntn_Config_r17, mac->current_UL_BWP->scs);
|
||||
const int ntn_ue_koffset = GET_NTN_UE_K_OFFSET(mac, mac->current_UL_BWP->scs);
|
||||
const int n_slots_frame = nr_slots_per_frame[mac->current_UL_BWP->scs];
|
||||
ul_time_alignment->frame = (frame + (slot + ntn_ue_koffset) / n_slots_frame) % MAX_FRAME_NUMBER;
|
||||
ul_time_alignment->slot = (slot + ntn_ue_koffset) % n_slots_frame;
|
||||
@@ -4108,7 +4101,7 @@ static void nr_ue_process_rar(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *d
|
||||
LOG_E(MAC, "Cannot schedule Msg3. Something wrong in TDA information\n");
|
||||
return;
|
||||
}
|
||||
const int ntn_ue_koffset = get_NTN_UE_Koffset(mac->sc_info.ntn_Config_r17, mac->current_UL_BWP->scs);
|
||||
const int ntn_ue_koffset = GET_NTN_UE_K_OFFSET(mac, mac->current_UL_BWP->scs);
|
||||
ret = nr_ue_pusch_scheduler(mac, is_Msg3, frame, slot, &frame_tx, &slot_tx, tda_info.k2 + ntn_ue_koffset);
|
||||
|
||||
// TA command
|
||||
|
||||
@@ -1266,9 +1266,9 @@ void nr_ue_aperiodic_srs_scheduling(NR_UE_MAC_INST_t *mac, long resource_trigger
|
||||
return;
|
||||
}
|
||||
|
||||
AssertFatal(slot_offset > DURATION_RX_TO_TX,
|
||||
"Slot offset between DCI and aperiodic SRS (%d) needs to be higher than DURATION_RX_TO_TX (%d)\n",
|
||||
slot_offset, DURATION_RX_TO_TX);
|
||||
AssertFatal(slot_offset > GET_DURATION_RX_TO_TX(mac),
|
||||
"Slot offset between DCI and aperiodic SRS (%d) needs to be higher than DURATION_RX_TO_TX (%ld)\n",
|
||||
slot_offset, GET_DURATION_RX_TO_TX(mac));
|
||||
int n_slots_frame = nr_slots_per_frame[current_UL_BWP->scs];
|
||||
int sched_slot = (slot + slot_offset) % n_slots_frame;
|
||||
NR_TDD_UL_DL_ConfigCommon_t *tdd_config = mac->tdd_UL_DL_ConfigurationCommon;
|
||||
@@ -1732,7 +1732,7 @@ static uint8_t nr_locate_BsrIndexByBufferSize(const uint32_t *table, int size, i
|
||||
// PUSCH scheduler:
|
||||
// - Calculate the slot in which ULSCH should be scheduled. This is current slot + K2,
|
||||
// - where K2 is the offset between the slot in which UL DCI is received and the slot
|
||||
// - in which ULSCH should be scheduled. K2 is configured in RRC configuration.
|
||||
// - in which ULSCH should be scheduled. K2 is configured in RRC configuration.
|
||||
// PUSCH Msg3 scheduler:
|
||||
// - scheduled by RAR UL grant according to 8.3 of TS 38.213
|
||||
// Note: Msg3 tx in the uplink symbols of mixed slot
|
||||
@@ -1772,24 +1772,24 @@ int nr_ue_pusch_scheduler(const NR_UE_MAC_INST_t *mac,
|
||||
AssertFatal(1 == 0, "Invalid numerology %i\n", mu);
|
||||
}
|
||||
|
||||
AssertFatal((k2 + delta) > DURATION_RX_TO_TX,
|
||||
"Slot offset (%ld) for Msg3 needs to be higher than DURATION_RX_TO_TX (%d). Please set min_rxtxtime at least to %d in gNB config file or gNBs.[0].min_rxtxtime=%d via command line.\n",
|
||||
AssertFatal((k2 + delta) > GET_DURATION_RX_TO_TX(mac),
|
||||
"Slot offset (%ld) for Msg3 needs to be higher than DURATION_RX_TO_TX (%ld). Please set min_rxtxtime at least to %ld in gNB config file or gNBs.[0].min_rxtxtime=%ld via command line.\n",
|
||||
k2,
|
||||
DURATION_RX_TO_TX,
|
||||
DURATION_RX_TO_TX,
|
||||
DURATION_RX_TO_TX);
|
||||
GET_DURATION_RX_TO_TX(mac),
|
||||
GET_DURATION_RX_TO_TX(mac),
|
||||
GET_DURATION_RX_TO_TX(mac));
|
||||
|
||||
*slot_tx = (current_slot + k2 + delta) % nr_slots_per_frame[mu];
|
||||
*frame_tx = (current_frame + (current_slot + k2 + delta) / nr_slots_per_frame[mu]) % MAX_FRAME_NUMBER;
|
||||
|
||||
} else {
|
||||
|
||||
AssertFatal(k2 > DURATION_RX_TO_TX,
|
||||
"Slot offset K2 (%ld) needs to be higher than DURATION_RX_TO_TX (%d). Please set min_rxtxtime at least to %d in gNB config file or gNBs.[0].min_rxtxtime=%d via command line.\n",
|
||||
AssertFatal(k2 > GET_DURATION_RX_TO_TX(mac),
|
||||
"Slot offset K2 (%ld) needs to be higher than DURATION_RX_TO_TX (%ld). Please set min_rxtxtime at least to %ld in gNB config file or gNBs.[0].min_rxtxtime=%ld via command line.\n",
|
||||
k2,
|
||||
DURATION_RX_TO_TX,
|
||||
DURATION_RX_TO_TX,
|
||||
DURATION_RX_TO_TX);
|
||||
GET_DURATION_RX_TO_TX(mac),
|
||||
GET_DURATION_RX_TO_TX(mac),
|
||||
GET_DURATION_RX_TO_TX(mac));
|
||||
|
||||
if (k2 < 0) { // This can happen when a false DCI is received
|
||||
LOG_W(PHY, "%d.%d. Received k2 %ld\n", current_frame, current_slot, k2);
|
||||
|
||||
Reference in New Issue
Block a user