Commit e839c77d authored by Florian Kaltenberger's avatar Florian Kaltenberger Committed by Florian Kaltenberger

adapting previous commit to F1AP measurement request

parent 0d9bba4c
...@@ -527,8 +527,10 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, c ...@@ -527,8 +527,10 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, c
} }
//configure SRS for secondary cell //configure SRS for secondary cell
//we can't do this here anymore. the SRS config needs to come from NRPPA measurement requesst
/*
int curr_bwp = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth,MAX_BWP_SIZE); int curr_bwp = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth,MAX_BWP_SIZE);
RC.nrmac[Mod_idP]->setup_srs_config[0] = calloc(1,sizeof(NR_SetupRelease_SRS_Config_t)); RC.nrmac[Mod_idP]->setup_srs_config[0] = calloc(1,sizeof(NR_SetupRelease_SRS_Config_t));
config_srs(scc, config_srs(scc,
RC.nrmac[Mod_idP]->setup_srs_config[0], RC.nrmac[Mod_idP]->setup_srs_config[0],
...@@ -538,6 +540,7 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, c ...@@ -538,6 +540,7 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, c
0, //res_id = 0 for initial BWP 0, //res_id = 0 for initial BWP
1, //maxMIMO_Layers 1, //maxMIMO_Layers
1); //do_srsg 1); //do_srsg
*/
//NR_SCHED_UNLOCK(&nrmac->sched_lock); //NR_SCHED_UNLOCK(&nrmac->sched_lock);
} }
......
...@@ -232,8 +232,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_ ...@@ -232,8 +232,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_
nr_schedule_srs(module_idP, frame, slot); nr_schedule_srs(module_idP, frame, slot);
if ((slot==0) && (get_softmodem_params()->phy_test == 0)) nr_schedule_srs_secondary(module_idP,frame,slot);
nr_schedule_srs_secondary(module_idP,frame,0/*UE_id*/);
// This schedule RA procedure if not in phy_test mode // This schedule RA procedure if not in phy_test mode
// Otherwise consider 5G already connected // Otherwise consider 5G already connected
......
...@@ -475,13 +475,80 @@ static void nr_configure_srs(nfapi_nr_srs_pdu_t *srs_pdu, ...@@ -475,13 +475,80 @@ static void nr_configure_srs(nfapi_nr_srs_pdu_t *srs_pdu,
vrb_map_UL[i + srs_pdu->bwp_start] |= mask; vrb_map_UL[i + srs_pdu->bwp_start] |= mask;
} }
static void nr_configure_srs_f1ap(nfapi_nr_srs_pdu_t *srs_pdu,
int slot,
int module_id,
int CC_id,
NR_UE_info_t *UE,
f1ap_srs_resource_set_t *srs_resource_set,
f1ap_srs_resource_t *srs_resource,
int buffer_index)
{
NR_UE_UL_BWP_t *current_BWP = &UE->current_UL_BWP;
srs_pdu->rnti = UE->rnti;
srs_pdu->handle = 0;
srs_pdu->bwp_size = current_BWP->BWPSize;
srs_pdu->bwp_start = current_BWP->BWPStart;
srs_pdu->subcarrier_spacing = current_BWP->scs;
srs_pdu->cyclic_prefix = 0;
srs_pdu->num_ant_ports = srs_resource->nrofSRS_Ports;
srs_pdu->num_symbols = srs_resource->nrofSymbols;
srs_pdu->num_repetitions = srs_resource->repetitionFactor;
srs_pdu->time_start_position = srs_resource->startPosition;
srs_pdu->config_index = srs_resource->c_SRS;
srs_pdu->sequence_id = srs_resource->sequenceId;
srs_pdu->bandwidth_index = srs_resource->b_SRS;
srs_pdu->comb_size = srs_resource->transmissionComb.present;
switch(srs_resource->transmissionComb.present) {
case f1ap_transmission_comb_pr_n2:
srs_pdu->comb_offset = srs_resource->transmissionComb.choice.n2.combOffset_n2;
srs_pdu->cyclic_shift = srs_resource->transmissionComb.choice.n2.cyclicShift_n2;
break;
case f1ap_transmission_comb_pr_n4:
srs_pdu->comb_offset = srs_resource->transmissionComb.choice.n4.combOffset_n4;
srs_pdu->cyclic_shift = srs_resource->transmissionComb.choice.n4.cyclicShift_n4;
break;
default:
LOG_W(NR_MAC, "Invalid or not implemented comb_size!\n");
}
srs_pdu->frequency_position = srs_resource->freqDomainPosition;
srs_pdu->frequency_shift = srs_resource->freqDomainShift;
srs_pdu->frequency_hopping = srs_resource->b_hop;
srs_pdu->group_or_sequence_hopping = srs_resource->groupOrSequenceHopping;
srs_pdu->resource_type = srs_resource->resourceType.present;
srs_pdu->t_srs = srs_period[srs_resource->resourceType.choice.periodic.periodicity];
srs_pdu->t_offset = srs_resource->resourceType.choice.periodic.offset;
// TODO: This should be completed
srs_pdu->srs_parameters_v4.srs_bandwidth_size = m_SRS[srs_pdu->config_index];
srs_pdu->srs_parameters_v4.usage = 1; //codebook - to be checked
srs_pdu->srs_parameters_v4.report_type[0] = 1;
srs_pdu->srs_parameters_v4.iq_representation = 1;
srs_pdu->srs_parameters_v4.prg_size = 1;
srs_pdu->srs_parameters_v4.num_total_ue_antennas = 1<<srs_pdu->num_ant_ports;
if (/*usage==*/1) {
srs_pdu->beamforming.trp_scheme = 0;
srs_pdu->beamforming.num_prgs = m_SRS[srs_pdu->config_index];
srs_pdu->beamforming.prg_size = 1;
}
uint16_t *vrb_map_UL = &RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[buffer_index * MAX_BWP_SIZE];
uint64_t mask = SL_to_bitmap(13 - srs_pdu->time_start_position, srs_pdu->num_symbols);
for (int i = 0; i < srs_pdu->bwp_size; ++i)
vrb_map_UL[i + srs_pdu->bwp_start] |= mask;
}
static void nr_fill_nfapi_srs(int module_id, static void nr_fill_nfapi_srs(int module_id,
int CC_id, int CC_id,
NR_UE_info_t *UE, NR_UE_info_t *UE,
int frame, int frame,
int slot, int slot,
NR_SRS_ResourceSet_t *srs_resource_set, void *srs_resource_set,
NR_SRS_Resource_t *srs_resource) void *srs_resource,
int is_f1ap)
{ {
int index = ul_buffer_index(frame, slot, UE->current_UL_BWP.scs, RC.nrmac[module_id]->UL_tti_req_ahead_size); int index = ul_buffer_index(frame, slot, UE->current_UL_BWP.scs, RC.nrmac[module_id]->UL_tti_req_ahead_size);
...@@ -495,7 +562,25 @@ static void nr_fill_nfapi_srs(int module_id, ...@@ -495,7 +562,25 @@ static void nr_fill_nfapi_srs(int module_id,
memset(srs_pdu, 0, sizeof(nfapi_nr_srs_pdu_t)); memset(srs_pdu, 0, sizeof(nfapi_nr_srs_pdu_t));
future_ul_tti_req->n_pdus += 1; future_ul_tti_req->n_pdus += 1;
index = ul_buffer_index(frame, slot, UE->current_UL_BWP.scs, RC.nrmac[module_id]->vrb_map_UL_size); index = ul_buffer_index(frame, slot, UE->current_UL_BWP.scs, RC.nrmac[module_id]->vrb_map_UL_size);
nr_configure_srs(srs_pdu, slot, module_id, CC_id, UE, srs_resource_set, srs_resource, index); if (is_f1ap)
nr_configure_srs_f1ap(srs_pdu,
slot,
module_id,
CC_id,
UE,
(f1ap_srs_resource_set_t *) srs_resource_set,
(f1ap_srs_resource_t *) srs_resource,
index);
else
nr_configure_srs(srs_pdu,
slot,
module_id,
CC_id,
UE,
(NR_SRS_ResourceSet_t*) srs_resource_set,
(NR_SRS_Resource_t*) srs_resource,
index);
} }
/******************************************************************* /*******************************************************************
...@@ -581,7 +666,7 @@ void nr_schedule_srs(int module_id, frame_t frame, int slot) ...@@ -581,7 +666,7 @@ void nr_schedule_srs(int module_id, frame_t frame, int slot)
// Check if UE will transmit the SRS in this frame // Check if UE will transmit the SRS in this frame
if ((sched_frame * n_slots_frame + sched_slot - offset) % period == 0) { if ((sched_frame * n_slots_frame + sched_slot - offset) % period == 0) {
LOG_D(NR_MAC," %d.%d Scheduling SRS reception for %d.%d\n", frame, slot, sched_frame, sched_slot); LOG_D(NR_MAC," %d.%d Scheduling SRS reception for %d.%d\n", frame, slot, sched_frame, sched_slot);
nr_fill_nfapi_srs(module_id, CC_id, UE, sched_frame, sched_slot, srs_resource_set, srs_resource); nr_fill_nfapi_srs(module_id, CC_id, UE, sched_frame, sched_slot, srs_resource_set, srs_resource, 0);
sched_ctrl->sched_srs.frame = sched_frame; sched_ctrl->sched_srs.frame = sched_frame;
sched_ctrl->sched_srs.slot = sched_slot; sched_ctrl->sched_srs.slot = sched_slot;
sched_ctrl->sched_srs.srs_scheduled = true; sched_ctrl->sched_srs.srs_scheduled = true;
...@@ -602,7 +687,7 @@ void nr_schedule_srs(int module_id, frame_t frame, int slot) ...@@ -602,7 +687,7 @@ void nr_schedule_srs(int module_id, frame_t frame, int slot)
* Only for periodic scheduling yet. * Only for periodic scheduling yet.
* *
*********************************************************************/ *********************************************************************/
void nr_schedule_srs_secondary(int module_id, frame_t frame, int UE_id) { void nr_schedule_srs_secondary(int module_id, frame_t frame, int slot) {
const int CC_id = 0; const int CC_id = 0;
// lets configure SRS on the initial BWP. This will only work for cell sizes of 60MHz or lower. // lets configure SRS on the initial BWP. This will only work for cell sizes of 60MHz or lower.
...@@ -610,47 +695,49 @@ void nr_schedule_srs_secondary(int module_id, frame_t frame, int UE_id) { ...@@ -610,47 +695,49 @@ void nr_schedule_srs_secondary(int module_id, frame_t frame, int UE_id) {
NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[CC_id].ServingCellConfigCommon; NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[CC_id].ServingCellConfigCommon;
NR_SRS_Config_t *srs_config = RC.nrmac[module_id]->setup_srs_config[0]->choice.setup; //NR_SRS_Config_t *srs_config = RC.nrmac[module_id]->setup_srs_config[0]->choice.setup;
if(!scc) { if(!scc) {
LOG_W(MAC,"no scc, returning\n"); LOG_W(MAC,"no scc, returning\n");
return; return;
} }
f1ap_measurement_req_t *f1ap_meas_req = RC.nrmac[module_id]->f1ap_meas_req;
for(int rs = 0; rs < srs_config->srs_ResourceSetToAddModList->list.count; rs++) { if (!f1ap_meas_req) {
LOG_I(MAC,"No F1AP Measurement Request, skipping SRS measurement\n");
// Find periodic resource set return;
NR_SRS_ResourceSet_t *srs_resource_set = srs_config->srs_ResourceSetToAddModList->list.array[rs]; }
if (srs_resource_set->resourceType.present != NR_SRS_ResourceSet__resourceType_PR_periodic) {
continue; f1ap_srs_configuration_t *srs_configuration = &f1ap_meas_req->srs_configuration;
} if (!srs_configuration) {
LOG_I(MAC, "no srs configuration in F1AP measurement reuqest, skipping\n");
// Find the corresponding srs resource return;
NR_SRS_Resource_t *srs_resource = NULL; }
for (int r1 = 0; r1 < srs_resource_set->srs_ResourceIdList->list.count; r1++) {
for (int r2 = 0; r2 < srs_config->srs_ResourceToAddModList->list.count; r2++) { for (int srs_idx = 0; srs_idx<srs_configuration->srs_carrier_list.srs_carrier_list_length; srs_idx++) {
if ((*srs_resource_set->srs_ResourceIdList->list.array[r1] ==
srs_config->srs_ResourceToAddModList->list.array[r2]->srs_ResourceId) && f1ap_srs_config_t *sRSConfig = &srs_configuration->srs_carrier_list.srs_carrier_list_item[srs_idx].active_ul_bwp.sRSConfig;
(srs_config->srs_ResourceToAddModList->list.array[r2]->resourceType.present == if (sRSConfig->sRSResource_List.srs_resource_list_length != 1 ||
NR_SRS_Resource__resourceType_PR_periodic)) { sRSConfig->sRSResourceSet_List.srs_resource_set_list_length != 1) {
srs_resource = srs_config->srs_ResourceToAddModList->list.array[r2]; LOG_I(MAC, "Need exactly 1 SRS Resoure and 1 SRS Resource set in F1AP measurment request\n");
break; return;
}
}
} }
if (srs_resource == NULL) { f1ap_srs_resource_t *srs_resource = sRSConfig->sRSResource_List.srs_resource;
continue; f1ap_srs_resource_set_t *srs_resource_set = sRSConfig->sRSResourceSet_List.srs_resource_set;
if (srs_resource == NULL || srs_resource_set == NULL) {
LOG_I(MAC, "SRS resource or resource set is Null\n");
return;
} }
NR_BWP_t ubwp = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; NR_BWP_t ubwp = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters;
uint16_t period = srs_period[srs_resource->resourceType.choice.periodic->periodicityAndOffset_p.present]; uint16_t period = srs_period[srs_resource->resourceType.choice.periodic.periodicity];
uint16_t offset = get_nr_srs_offset(srs_resource->resourceType.choice.periodic->periodicityAndOffset_p); uint16_t offset = srs_resource->resourceType.choice.periodic.offset;
int n_slots_frame = nr_slots_per_frame[ubwp.subcarrierSpacing]; int n_slots_frame = nr_slots_per_frame[ubwp.subcarrierSpacing];
NR_UE_info_t dummy_ue_info; NR_UE_info_t dummy_ue_info;
dummy_ue_info.current_UL_BWP.BWPSize = NRRIV2BW(ubwp.locationAndBandwidth,MAX_BWP_SIZE); dummy_ue_info.current_UL_BWP.BWPSize = NRRIV2BW(ubwp.locationAndBandwidth,MAX_BWP_SIZE);
dummy_ue_info.current_UL_BWP.BWPStart = NRRIV2PRBOFFSET(ubwp.locationAndBandwidth,MAX_BWP_SIZE); dummy_ue_info.current_UL_BWP.BWPStart = NRRIV2PRBOFFSET(ubwp.locationAndBandwidth,MAX_BWP_SIZE);
...@@ -659,8 +746,7 @@ void nr_schedule_srs_secondary(int module_id, frame_t frame, int UE_id) { ...@@ -659,8 +746,7 @@ void nr_schedule_srs_secondary(int module_id, frame_t frame, int UE_id) {
// Check if UE will transmit the SRS in this frame // Check if UE will transmit the SRS in this frame
if ( ((frame - offset/n_slots_frame)*n_slots_frame)%period == 0) { if ( ((frame - offset/n_slots_frame)*n_slots_frame)%period == 0) {
LOG_D(NR_MAC,"Scheduling SRS reception for %d.%d\n", frame, offset%n_slots_frame); LOG_D(NR_MAC,"Scheduling SRS reception for %d.%d\n", frame, offset%n_slots_frame);
nr_fill_nfapi_srs(module_id, CC_id, &dummy_ue_info, offset%n_slots_frame, srs_resource); nr_fill_nfapi_srs(module_id, CC_id, &dummy_ue_info, frame, slot, srs_resource_set, srs_resource, 1);
} }
} }
} }
...@@ -619,8 +619,14 @@ void positioning_measurement_request(const f1ap_measurement_req_t *req) ...@@ -619,8 +619,14 @@ void positioning_measurement_request(const f1ap_measurement_req_t *req)
AssertFatal(false, "Not implemented\n"); AssertFatal(false, "Not implemented\n");
} }
// move this to the response function // we need to check if this message is for the serving cell or neighboring cell. In case of neighboring cell we need to program the SRS measurement somehow.
/* response has same type as request... */ gNB_MAC_INST *mac = RC.nrmac[req->nrppa_msg_info.instance];
//store the whole measurement request (incl SRS config) from measurement in MAC
//TODO: we have to copy the whole memory of this nested structure
mac->f1ap_meas_req = req;
/* response has same type as request... */
f1ap_measurement_resp_t resp = { f1ap_measurement_resp_t resp = {
.transaction_id = req->transaction_id, .transaction_id = req->transaction_id,
.lmf_measurement_id = req->lmf_measurement_id, .lmf_measurement_id = req->lmf_measurement_id,
...@@ -635,7 +641,6 @@ void positioning_measurement_request(const f1ap_measurement_req_t *req) ...@@ -635,7 +641,6 @@ void positioning_measurement_request(const f1ap_measurement_req_t *req)
}; };
//call the response handler //call the response handler
gNB_MAC_INST *mac = RC.nrmac[req->nrppa_msg_info.instance];
mac->mac_rrc.positioning_measurement_response(&resp); mac->mac_rrc.positioning_measurement_response(&resp);
} }
......
...@@ -872,7 +872,9 @@ typedef struct gNB_MAC_INST_s { ...@@ -872,7 +872,9 @@ typedef struct gNB_MAC_INST_s {
//holds the SRS config for UEs of neighboring cells //holds the SRS config for UEs of neighboring cells
//to be expanded to multiple users later //to be expanded to multiple users later
NR_SetupRelease_SRS_Config_t *setup_srs_config[1]; NR_SetupRelease_SRS_Config_t *setup_srs_config[1];
f1ap_measurement_req_t *f1ap_meas_req;
} gNB_MAC_INST; } gNB_MAC_INST;
#endif /*__LAYER2_NR_MAC_GNB_H__ */ #endif /*__LAYER2_NR_MAC_GNB_H__ */
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