Commit 57fbbf53 authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/develop-SRS-feedback' into integration_2022_wk40

parents 4ba95087 6c33346d
......@@ -328,6 +328,7 @@ The following features are valid for the gNB and the 5G-NR UE.
- HARQ procedures for uplink
- Scheduler procedures for SRS reception
- Periodic SRS reception
- TPMI computation based on SRS up 4 antenna ports and 1 layer
- MAC procedures to handle CSI measurement report
- evalution of RSRP report
- evaluation of CQI report
......
......@@ -4060,4 +4060,42 @@ int nfapi_p7_update_checksum(uint8_t* buffer, uint32_t len);
*/
int nfapi_p7_update_transmit_timestamp(uint8_t* buffer, uint32_t timestamp);
/*! \brief Encodes a nfapi_nr_srs_normalized_channel_iq_matrix_t to a buffer
*
* \param pMessageBuf A pointer to a nfapi_nr_srs_normalized_channel_iq_matrix_t structure
* \param pPackedBuf A pointer to the buffer that the nfapi_nr_srs_normalized_channel_iq_matrix_t will be packed into
* \param packedBufLen The size of the buffer
* \return number of bytes written to the buffer
*/
int pack_nr_srs_normalized_channel_iq_matrix(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen);
/*! \brief Decodes a nfapi_nr_srs_normalized_channel_iq_matrix_t from a buffer
*
* \param pMessageBuf A pointer to an encoded nfapi_nr_srs_normalized_channel_iq_matrix_t
* \param messageBufLen The size of the encoded nfapi_nr_srs_normalized_channel_iq_matrix_t
* \param pUnpackedBuf A pointer to the nfapi_nr_srs_normalized_channel_iq_matrix_t
* \param unpackedBufLen The size of nfapi_nr_srs_normalized_channel_iq_matrix_t structure.
* \return 0 means success, -1 means failure.
*/
int unpack_nr_srs_normalized_channel_iq_matrix(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen);
/*! \brief Encodes a nfapi_nr_srs_beamforming_report_t to a buffer
*
* \param pMessageBuf A pointer to a nfapi_nr_srs_beamforming_report_t structure
* \param pPackedBuf A pointer to the buffer that the nfapi_nr_srs_beamforming_report_t will be packed into
* \param packedBufLen The size of the buffer
* \return number of bytes written to the buffer
*/
int pack_nr_srs_beamforming_report(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen);
/*! \brief Decodes a nfapi_nr_srs_beamforming_report_t from a buffer
*
* \param pMessageBuf A pointer to an encoded nfapi_nr_srs_beamforming_report_t
* \param messageBufLen The size of the encoded nfapi_nr_srs_beamforming_report_t
* \param pUnpackedBuf A pointer to the nfapi_nr_srs_beamforming_report_t
* \param unpackedBufLen The size of nfapi_nr_srs_beamforming_report_t structure.
* \return 0 means success, -1 means failure.
*/
int unpack_nr_srs_beamforming_report(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen);
#endif /* _NFAPI_INTERFACE_H_ */
This diff is collapsed.
......@@ -73,13 +73,9 @@ int nr_srs_channel_estimation(const PHY_VARS_gNB *gNB,
const nr_srs_info_t *nr_srs_info,
const int32_t **srs_generated_signal,
int32_t srs_received_signal[][gNB->frame_parms.ofdm_symbol_size*(1<<srs_pdu->num_symbols)],
int32_t srs_ls_estimated_channel[][1<<srs_pdu->num_ant_ports][gNB->frame_parms.ofdm_symbol_size*(1<<srs_pdu->num_symbols)],
int32_t srs_estimated_channel_freq[][1<<srs_pdu->num_ant_ports][gNB->frame_parms.ofdm_symbol_size*(1<<srs_pdu->num_symbols)],
int32_t srs_estimated_channel_time[][1<<srs_pdu->num_ant_ports][gNB->frame_parms.ofdm_symbol_size],
int32_t srs_estimated_channel_time_shifted[][1<<srs_pdu->num_ant_ports][gNB->frame_parms.ofdm_symbol_size],
uint32_t *signal_power,
uint32_t *noise_power_per_rb,
uint32_t *noise_power,
int8_t *snr_per_rb,
int8_t *snr);
#endif
......@@ -53,7 +53,7 @@
#define mulhi_s1_int16(a,b) vshlq_n_s16(vqdmulhq_s16(a,b),1)
#define adds_int16(a,b) vqaddq_s16(a,b)
#define mullo_int16(a,b) vmulq_s16(a,b)
#define _mm_empty()
#define _mm_empty()
#define _m_empty()
#endif
......@@ -74,6 +74,11 @@ extern "C" {
float i;
} cf_t;
typedef struct complex8 {
int8_t r;
int8_t i;
} c8_t;
typedef struct complex16 {
int16_t r;
int16_t i;
......@@ -98,14 +103,14 @@ extern "C" {
.i = (int16_t)((a.r * b.i + a.i * b.r) >> Shift)
};
}
__attribute__((always_inline)) inline c16_t c16divShift(const c16_t a, const c16_t b, const int Shift) {
return (c16_t) {
.r = (int16_t)((a.r * b.r + a.i * b.i) >> Shift),
.i = (int16_t)((a.r * b.i - a.i * b.r) >> Shift)
};
}
__attribute__((always_inline)) inline c16_t c16maddShift(const c16_t a, const c16_t b, c16_t c, const int Shift) {
return (c16_t) {
.r = (int16_t)(((a.r * b.r - a.i * b.i ) >> Shift) + c.r),
......@@ -136,8 +141,8 @@ extern "C" {
// On N complex numbers
// y.r += (x * alpha.r) >> 14
// y.i += (x * alpha.i) >> 14
// y.r += (x * alpha.r) >> 14
// y.i += (x * alpha.i) >> 14
// See regular C implementation at the end
__attribute__((always_inline)) inline void c16multaddVectRealComplex(const int16_t *x,
const c16_t *alpha,
......@@ -153,7 +158,7 @@ extern "C" {
10,11,10+16,11+16,
12,13,12+16,13+16,
14,15,14+16,15+16};
__m256i alpha256= _mm256_set1_epi32(*(int32_t *)alpha);
__m128i *x128=(__m128i *)x;
__m128i *y128=(__m128i *)y;
......@@ -169,11 +174,11 @@ extern "C" {
*y128= _mm_adds_epi16(_mm256_extracti128_si256(x_mul_alpha_x2,1),*y128);
y128++;
x128++;
}
}
#elif defined(__x86_64__) || defined(__i386__) || defined(__arm__)
uint32_t i;
// do 8 multiplications at a time
simd_q15_t alpha_r_128,alpha_i_128,yr,yi,*x_128=(simd_q15_t*)x,*y_128=(simd_q15_t*)y;
int j;
......@@ -199,7 +204,7 @@ extern "C" {
y_128[j] = adds_int16(y_128[j],yint.val[0]);
j++;
y_128[j] = adds_int16(y_128[j],yint.val[1]);
j++;
#endif
}
......@@ -260,7 +265,7 @@ __attribute__((always_inline)) inline void multadd_real_four_symbols_vector_comp
_mm_storeu_si128((simd_q15_t*)y, y_128);
}
/*!\fn void multadd_complex_vector_real_scalar(int16_t *x,int16_t alpha,int16_t *y,uint8_t zero_flag,uint32_t N)
This function performs componentwise multiplication and accumulation of a real scalar and a complex vector.
@param x Vector input (Q1.15) in the format |Re0 Im0|Re1 Im 1| ...
......
......@@ -98,6 +98,7 @@
#define NB_RX_ANTENNAS_MAX 64
#define TC_NSEC_x32768 16667
typedef enum {TDD=1,FDD=0} frame_type_t;
......
This diff is collapsed.
......@@ -5,25 +5,73 @@ int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { re
int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { return(0); }
int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return(0); }
//int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { return(0); }
int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0); }
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); }
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); }
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); }
int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) { return(0); }
int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { return(0); }
int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { return(0); }
int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { return(0); }
int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { return(0); }
int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req)
{
return (0);
}
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req)
{
return (0);
}
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req)
{
return (0);
}
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req)
{
return (0);
}
int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind)
{
return (0);
}
int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind)
{
return (0);
}
int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind)
{
return (0);
}
int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind)
{
return (0);
}
int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind)
{
return (0);
}
int pack_nr_srs_beamforming_report(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen)
{
return 0;
}
int pack_nr_srs_normalized_channel_iq_matrix(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen)
{
return 0;
}
int32_t get_uldl_offset(int nr_bandP) { return(0); }
NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {return(NULL);}
int32_t get_uldl_offset(int nr_bandP)
{
return (0);
}
NR_IF_Module_t *NR_IF_Module_init(int Mod_id)
{
return (NULL);
}
nfapi_mode_t nfapi_mod;
nfapi_mode_t nfapi_getmode(void) {
nfapi_mode_t nfapi_getmode(void)
{
return nfapi_mod;
}
void nfapi_setmode(nfapi_mode_t nfapi_mode) {}
void nfapi_setmode(nfapi_mode_t nfapi_mode)
{
}
int dummy_nr_ue_dl_indication(nr_downlink_indication_t *dl_info) { return(0); }
int dummy_nr_ue_dl_indication(nr_downlink_indication_t *dl_info)
{
return (0);
}
int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { return(0); }
void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind,
fapi_nr_dci_indication_t *dci_ind,
......
......@@ -540,5 +540,29 @@ typedef struct nr_csi_report {
int N2;
} nr_csi_report_t;
typedef enum {
NR_SRS_SRI_0 = 0,
NR_SRS_SRI_1,
NR_SRS_SRI_2,
NR_SRS_SRI_3,
NR_SRS_SRI_0_1,
NR_SRS_SRI_0_2,
NR_SRS_SRI_0_3,
NR_SRS_SRI_1_2,
NR_SRS_SRI_1_3,
NR_SRS_SRI_2_3,
NR_SRS_SRI_0_1_2,
NR_SRS_SRI_0_1_3,
NR_SRS_SRI_0_2_3,
NR_SRS_SRI_1_2_3,
NR_SRS_SRI_0_1_2_3
} nr_srs_sri_t;
typedef struct nr_srs_feedback {
uint8_t sri;
uint8_t ul_ri;
uint8_t tpmi;
} nr_srs_feedback_t;
#endif /*__LAYER2_MAC_H__ */
......@@ -64,6 +64,19 @@ int is_nr_DL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon,slo
int is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, slot_t slotP, frame_type_t frame_type);
uint8_t compute_srs_resource_indicator(NR_PUSCH_ServingCellConfig_t *pusch_servingcellconfig,
NR_PUSCH_Config_t *pusch_Config,
NR_SRS_Config_t *srs_config,
nr_srs_feedback_t *srs_feedback,
uint16_t *val);
uint8_t compute_precoding_information(NR_PUSCH_Config_t *pusch_Config,
NR_SRS_Config_t *srs_config,
dci_field_t srs_resource_indicator,
nr_srs_feedback_t *srs_feedback,
const uint8_t *nrOfLayers,
uint16_t *val);
uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDLBWP,
const NR_BWP_UplinkCommon_t *initialULBWP,
const NR_CellGroupConfig_t *cg,
......
......@@ -143,4 +143,7 @@ extern const float table_38213_13_12_c3[16];
extern const int32_t table_38213_10_1_1_c2[5];
extern const char table_38211_6_3_1_5_1[6][2][1];
extern const char table_38211_6_3_1_5_2[28][4][1];
extern const char table_38211_6_3_1_5_3[28][4][1];
#endif //DEF_H
......@@ -830,6 +830,7 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t
scc,
pusch_pdu,
&uldci_payload,
NULL,
ra->Msg3_tda_id,
ra->msg3_TPC,
&ra->UL_BWP);
......
......@@ -882,6 +882,7 @@ void config_uldci(const NR_SIB1_t *sib1,
const NR_ServingCellConfigCommon_t *scc,
const nfapi_nr_pusch_pdu_t *pusch_pdu,
dci_pdu_rel15_t *dci_pdu_rel15,
nr_srs_feedback_t *srs_feedback,
int time_domain_assignment,
uint8_t tpc,
NR_UE_UL_BWP_t *ul_bwp) {
......@@ -916,13 +917,14 @@ void config_uldci(const NR_SIB1_t *sib1,
pusch_Config->txConfig != NULL) {
AssertFatal(*pusch_Config->txConfig == NR_PUSCH_Config__txConfig_codebook,
"Non Codebook configuration non supported\n");
dci_pdu_rel15->srs_resource_indicator.val = 0; // taking resource 0 for SRS
compute_srs_resource_indicator(ul_bwp->pusch_servingcellconfig, pusch_Config, ul_bwp->srs_Config, srs_feedback, &dci_pdu_rel15->srs_resource_indicator.val);
}
dci_pdu_rel15->precoding_information.val= 0;
if (pusch_pdu->nrOfLayers == 2)
dci_pdu_rel15->precoding_information.val = 4;
else if (pusch_pdu->nrOfLayers == 4)
dci_pdu_rel15->precoding_information.val = 11;
compute_precoding_information(pusch_Config,
ul_bwp->srs_Config,
dci_pdu_rel15->srs_resource_indicator,
srs_feedback,
&pusch_pdu->nrOfLayers,
&dci_pdu_rel15->precoding_information.val);
// antenna_ports.val = 0 for transform precoder is disabled, dmrs-Type=1, maxLength=1, Rank=1/2/3/4
// Antenna Ports
......@@ -1018,7 +1020,7 @@ int nr_get_pucch_resource(NR_ControlResourceSet_t *coreset,
// This function configures pucch pdu fapi structure
void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu,
NR_ServingCellConfigCommon_t *scc,
NR_UE_info_t* UE,
NR_UE_info_t *UE,
uint8_t pucch_resource,
uint16_t O_csi,
uint16_t O_ack,
......@@ -2456,6 +2458,12 @@ void configure_UE_BWP(gNB_MAC_INST *nr_mac,
false);
}
void reset_srs_stats(NR_UE_info_t *UE) {
if (UE) {
UE->mac_stats.srs_stats[0] = '\0';
}
}
//------------------------------------------------------------------------------
NR_UE_info_t *add_new_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rntiP, NR_CellGroupConfig_t *CellGroup)
{
......@@ -2522,6 +2530,8 @@ NR_UE_info_t *add_new_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rntiP, NR_CellGroupConf
create_nr_list(&sched_ctrl->feedback_ul_harq, 16);
create_nr_list(&sched_ctrl->retrans_ul_harq, 16);
reset_srs_stats(UE);
pthread_mutex_lock(&UE_info->mutex);
int i;
for(i=0; i<MAX_MOBILES_PER_GNB; i++) {
......@@ -2929,6 +2939,8 @@ void nr_mac_update_timers(module_id_t module_id,
if (sched_ctrl->rrc_processing_timer == 0) {
LOG_I(NR_MAC, "(%d.%d) De-activating RRC processing timer for UE %04x\n", frame, slot, UE->rnti);
reset_srs_stats(UE);
NR_CellGroupConfig_t *cg = NULL;
uper_decode(NULL,
&asn_DEF_NR_CellGroupConfig, //might be added prefix later
......
......@@ -35,7 +35,12 @@
extern RAN_CONTEXT_t RC;
void nr_configure_srs(nfapi_nr_srs_pdu_t *srs_pdu, int module_id, int CC_id,NR_UE_info_t* UE, NR_SRS_Resource_t *srs_resource) {
const uint16_t m_SRS[64] = { 4, 8, 12, 16, 16, 20, 24, 24, 28, 32, 36, 40, 48, 48, 52, 56, 60, 64, 72, 72, 76, 80, 88,
96, 96, 104, 112, 120, 120, 120, 128, 128, 128, 132, 136, 144, 144, 144, 144, 152, 160,
160, 160, 168, 176, 184, 192, 192, 192, 192, 208, 216, 224, 240, 240, 240, 240, 256, 256,
256, 264, 272, 272, 272 };
void nr_configure_srs(nfapi_nr_srs_pdu_t *srs_pdu, int module_id, int CC_id,NR_UE_info_t* UE, NR_SRS_ResourceSet_t *srs_resource_set, NR_SRS_Resource_t *srs_resource) {
NR_UE_UL_BWP_t *current_BWP = &UE->current_UL_BWP;
......@@ -74,9 +79,22 @@ void nr_configure_srs(nfapi_nr_srs_pdu_t *srs_pdu, int module_id, int CC_id,NR_U
srs_pdu->resource_type = srs_resource->resourceType.present - 1;
srs_pdu->t_srs = srs_period[srs_resource->resourceType.choice.periodic->periodicityAndOffset_p.present];
srs_pdu->t_offset = get_nr_srs_offset(srs_resource->resourceType.choice.periodic->periodicityAndOffset_p);
// 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<<srs_resource_set->usage;
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 (srs_resource_set->usage == NR_SRS_ResourceSet__usage_beamManagement) {
srs_pdu->beamforming.trp_scheme = 0;
srs_pdu->beamforming.num_prgs = m_SRS[srs_pdu->config_index];
srs_pdu->beamforming.prg_size = 1;
}
}
void nr_fill_nfapi_srs(int module_id, int CC_id, NR_UE_info_t* UE, sub_frame_t slot, NR_SRS_Resource_t *srs_resource) {
void nr_fill_nfapi_srs(int module_id, int CC_id, NR_UE_info_t* UE, sub_frame_t slot, NR_SRS_ResourceSet_t *srs_resource_set, NR_SRS_Resource_t *srs_resource) {
nfapi_nr_ul_tti_request_t *future_ul_tti_req = &RC.nrmac[module_id]->UL_tti_req_ahead[0][slot];
AssertFatal(future_ul_tti_req->n_pdus <
......@@ -88,7 +106,7 @@ void nr_fill_nfapi_srs(int module_id, int CC_id, NR_UE_info_t* UE, sub_frame_t s
memset(srs_pdu, 0, sizeof(nfapi_nr_srs_pdu_t));
future_ul_tti_req->n_pdus += 1;
nr_configure_srs(srs_pdu, module_id, CC_id, UE, srs_resource);
nr_configure_srs(srs_pdu, module_id, CC_id, UE, srs_resource_set, srs_resource);
}
/*******************************************************************
......@@ -158,7 +176,7 @@ void nr_schedule_srs(int module_id, frame_t frame) {
// Check if UE will transmit the SRS in this frame
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);
nr_fill_nfapi_srs(module_id, CC_id, UE, offset%n_slots_frame, srs_resource);
nr_fill_nfapi_srs(module_id, CC_id, UE, offset%n_slots_frame, srs_resource_set, srs_resource);
sched_ctrl->sched_srs.frame = frame;
sched_ctrl->sched_srs.slot = offset%n_slots_frame;
sched_ctrl->sched_srs.srs_scheduled = true;
......
......@@ -189,6 +189,7 @@ void config_uldci(const NR_SIB1_t *sib1,
const NR_ServingCellConfigCommon_t *scc,
const nfapi_nr_pusch_pdu_t *pusch_pdu,
dci_pdu_rel15_t *dci_pdu_rel15,
nr_srs_feedback_t *srs_feedback,
int time_domain_assignment,
uint8_t tpc,
NR_UE_UL_BWP_t *ul_bwp);
......@@ -441,12 +442,7 @@ void handle_nr_ul_harq(const int CC_idP,
void handle_nr_srs_measurements(const module_id_t module_id,
const frame_t frame,
const sub_frame_t slot,
const rnti_t rnti,
const uint16_t timing_advance,
const uint8_t num_symbols,
const uint8_t wide_band_snr,
const uint8_t num_reported_symbols,
nfapi_nr_srs_indication_reported_symbol_t* reported_symbol_list);
const nfapi_nr_srs_indication_pdu_t *srs_ind);
int16_t ssb_index_from_prach(module_id_t module_idP,
frame_t frameP,
......
......@@ -93,14 +93,14 @@ size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset
output += snprintf(output,
end - output,
"UE RNTI %04x (%d) PH %d dB PCMAX %d dBm, average RSRP %d (%d meas), UL-SNR %d dB\n",
"UE RNTI %04x (%d) PH %d dB PCMAX %d dBm, average RSRP %d (%d meas)\n",
UE->rnti,
num++,
sched_ctrl->ph,
sched_ctrl->pcmax,
avg_rsrp,
stats->num_rsrp_meas,
stats->srs_wide_band_snr);
stats->num_rsrp_meas);
output += snprintf(output,
end - output,
"UE %04x: CQI %d, RI %d, PMI (%d,%d)\n",
......@@ -110,6 +110,10 @@ size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset
sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.pmi_x1,
sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.pmi_x2);
if (stats->srs_stats[0] != '\0') {
output += snprintf(output, end - output, "UE %04x: %s\n", UE->rnti, stats->srs_stats);
}
output += snprintf(output,
end - output,
"UE %04x: dlsch_rounds ", UE->rnti);
......
......@@ -634,7 +634,7 @@ typedef struct {
NR_list_t feedback_ul_harq;
/// UL HARQ processes that await retransmission
NR_list_t retrans_ul_harq;
NR_UE_mac_ce_ctrl_t UE_mac_ce_ctrl;// MAC CE related information
NR_UE_mac_ce_ctrl_t UE_mac_ce_ctrl; // MAC CE related information
/// number of active DL LCs
uint8_t dl_lc_num;
/// order in which DLSCH scheduler should allocate LCs
......@@ -642,6 +642,9 @@ typedef struct {
/// Timer for RRC processing procedures
uint32_t rrc_processing_timer;
/// sri, ul_ri and tpmi based on SRS
nr_srs_feedback_t srs_feedback;
} NR_UE_sched_ctrl_t;
typedef struct {
......@@ -668,7 +671,7 @@ typedef struct NR_mac_stats {
uint32_t pucch0_DTX;
int cumul_rsrp;
uint8_t num_rsrp_meas;
int8_t srs_wide_band_snr;
char srs_stats[50]; // Statistics may differ depending on SRS usage
} NR_mac_stats_t;
typedef struct NR_bler_options {
......
......@@ -239,12 +239,7 @@ void handle_nr_srs(NR_UL_IND_t *UL_info) {
handle_nr_srs_measurements(module_id,
frame,
slot,
srs_ind->rnti,
srs_ind->timing_advance,
srs_ind->num_symbols,
srs_ind->wide_band_snr,
srs_ind->num_reported_symbols,
srs_ind->reported_symbol_list);
&srs_list[i]);
}
UL_info->srs_ind.number_of_pdus = 0;
......
......@@ -1002,9 +1002,10 @@ void fill_initial_SpCellConfig(int uid,
SpCellConfig->spCellConfigDedicated = calloc(1,sizeof(*SpCellConfig->spCellConfigDedicated));
SpCellConfig->spCellConfigDedicated->uplinkConfig = calloc(1,sizeof(*SpCellConfig->spCellConfigDedicated->uplinkConfig));
NR_UplinkConfig_t *uplinkConfig = SpCellConfig->spCellConfigDedicated->uplinkConfig;
NR_BWP_UplinkDedicated_t *initialUplinkBWP = calloc(1,sizeof(*initialUplinkBWP));
SpCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP = initialUplinkBWP;
uplinkConfig->initialUplinkBWP = initialUplinkBWP;
initialUplinkBWP->pucch_Config = calloc(1,sizeof(*initialUplinkBWP->pucch_Config));
initialUplinkBWP->pucch_Config->present = NR_SetupRelease_PUCCH_Config_PR_setup;
NR_PUCCH_Config_t *pucch_Config = calloc(1,sizeof(*pucch_Config));
......@@ -1090,9 +1091,15 @@ void fill_initial_SpCellConfig(int uid,
pusch_Config->uci_OnPUSCH=NULL;
pusch_Config->tp_pi2BPSK=NULL;
long maxMIMO_Layers = uplinkConfig &&
uplinkConfig->pusch_ServingCellConfig &&
uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1 &&
uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers ?
*uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers : 1;
// We are using do_srs = 0 here because the periodic SRS will only be enabled in update_cellGroupConfig() if do_srs == 1
initialUplinkBWP->srs_Config = calloc(1,sizeof(*initialUplinkBWP->srs_Config));
config_srs(initialUplinkBWP->srs_Config, NULL, curr_bwp, uid, 0, 0);
config_srs(initialUplinkBWP->srs_Config, NULL, curr_bwp, uid, 0, maxMIMO_Layers, 0);
scheduling_request_config(scc, pucch_Config);
......@@ -1216,7 +1223,7 @@ void fill_initial_SpCellConfig(int uid,
n_ul_bwp = servingcellconfigdedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count;
}
if(n_ul_bwp>0) {
SpCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList = calloc(1,sizeof(*SpCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList));
uplinkConfig->uplinkBWP_ToAddModList = calloc(1,sizeof(*uplinkConfig->uplinkBWP_ToAddModList));
for (int bwp_loop = 0; bwp_loop < n_ul_bwp; bwp_loop++) {
NR_BWP_Uplink_t *ubwp = calloc(1, sizeof(*ubwp));
config_uplinkBWP(ubwp, bwp_loop, true, uid,
......@@ -1224,13 +1231,12 @@ void fill_initial_SpCellConfig(int uid,
servingcellconfigdedicated,
scc,
NULL);
ASN_SEQUENCE_ADD(&SpCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list, ubwp);
ASN_SEQUENCE_ADD(&uplinkConfig->uplinkBWP_ToAddModList->list, ubwp);
}
SpCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id = calloc(1,sizeof(*SpCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id));
*SpCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id = servingcellconfigdedicated->uplinkConfig->firstActiveUplinkBWP_Id ? *servingcellconfigdedicated->uplinkConfig->firstActiveUplinkBWP_Id : 1;
uplinkConfig->firstActiveUplinkBWP_Id = calloc(1,sizeof(*uplinkConfig->firstActiveUplinkBWP_Id));
*uplinkConfig->firstActiveUplinkBWP_Id = servingcellconfigdedicated->uplinkConfig->firstActiveUplinkBWP_Id ? *servingcellconfigdedicated->uplinkConfig->firstActiveUplinkBWP_Id : 1;
}
SpCellConfig->spCellConfigDedicated->csi_MeasConfig=calloc(1,sizeof(*SpCellConfig->spCellConfigDedicated->csi_MeasConfig));
SpCellConfig->spCellConfigDedicated->csi_MeasConfig->present = NR_SetupRelease_CSI_MeasConfig_PR_setup;
......@@ -1585,6 +1591,12 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
if(scc) {
int curr_bwp = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth,MAX_BWP_SIZE);
NR_UplinkConfig_t *uplinkConfig = SpCellConfig && SpCellConfig->spCellConfigDedicated ? SpCellConfig->spCellConfigDedicated->uplinkConfig : NULL;
long maxMIMO_Layers = uplinkConfig &&
uplinkConfig->pusch_ServingCellConfig &&
uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1 &&
uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers ?
*uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers : 1;
// SRS configuration
if (configuration->do_SRS &&
SpCellConfig &&
......@@ -1600,6 +1612,7 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
curr_bwp,
uid,
0,
maxMIMO_Layers,
configuration->do_SRS);
}
......@@ -1625,6 +1638,7 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
bwp_size,
uid,
i+1,
maxMIMO_Layers,
configuration->do_SRS);
}
}
......
......@@ -356,8 +356,9 @@ void config_srs(NR_SetupRelease_SRS_Config_t *setup_release_srs_Config,
const int curr_bwp,
const int uid,
const int res_id,
const int do_srs) {
const long maxMIMO_Layers,
const int do_srs)
{
setup_release_srs_Config->present = NR_SetupRelease_SRS_Config_PR_setup;
NR_SRS_Config_t *srs_Config;
......@@ -419,26 +420,45 @@ void config_srs(NR_SetupRelease_SRS_Config_t *setup_release_srs_Config,
NR_SRS_Resource_t *srs_res0=calloc(1,sizeof(*srs_res0));
srs_res0->srs_ResourceId = res_id;
srs_res0->nrofSRS_Ports = NR_SRS_Resource__nrofSRS_Ports_port1;
// if (uecap &&
// uecap->featureSets &&
// uecap->featureSets->featureSetsUplink &&
// uecap->featureSets->featureSetsUplink->list.count > 0) {
// NR_FeatureSetUplink_t *ul_feature_setup = uecap->featureSets->featureSetsUplink->list.array[0];
// switch (ul_feature_setup->supportedSRS_Resources->maxNumberSRS_Ports_PerResource) {
// case NR_SRS_Resources__maxNumberSRS_Ports_PerResource_n1:
// srs_res0->nrofSRS_Ports = NR_SRS_Resource__nrofSRS_Ports_port1;
// break;
// case NR_SRS_Resources__maxNumberSRS_Ports_PerResource_n2:
// srs_res0->nrofSRS_Ports = NR_SRS_Resource__nrofSRS_Ports_ports2;
// break;
// case NR_SRS_Resources__maxNumberSRS_Ports_PerResource_n4:
// srs_res0->nrofSRS_Ports = NR_SRS_Resource__nrofSRS_Ports_ports4;
// break;
// default:
// LOG_E(NR_RRC, "Max Number of SRS Ports Per Resource %ld is invalid!\n",
// ul_feature_setup->supportedSRS_Resources->maxNumberSRS_Ports_PerResource);
// }
// }
if (do_srs) {
long nrofSRS_Ports = 1;
if (uecap &&
uecap->featureSets &&
uecap->featureSets->featureSetsUplink &&
uecap->featureSets->featureSetsUplink->list.count > 0) {
NR_FeatureSetUplink_t *ul_feature_setup = uecap->featureSets->featureSetsUplink->list.array[0];
switch (ul_feature_setup->supportedSRS_Resources->maxNumberSRS_Ports_PerResource) {
case NR_SRS_Resources__maxNumberSRS_Ports_PerResource_n1:
nrofSRS_Ports = 1;
break;
case NR_SRS_Resources__maxNumberSRS_Ports_PerResource_n2:
nrofSRS_Ports = 2;
break;
case NR_SRS_Resources__maxNumberSRS_Ports_PerResource_n4:
nrofSRS_Ports = 4;
break;
default:
LOG_E(NR_RRC, "Max Number of SRS Ports Per Resource %ld is invalid!\n",
ul_feature_setup->supportedSRS_Resources->maxNumberSRS_Ports_PerResource);
}
nrofSRS_Ports = min(nrofSRS_Ports, maxMIMO_Layers);
switch (nrofSRS_Ports) {
case 1:
srs_res0->nrofSRS_Ports = NR_SRS_Resource__nrofSRS_Ports_port1;
break;
case 2:
srs_res0->nrofSRS_Ports = NR_SRS_Resource__nrofSRS_Ports_ports2;
break;
case 4:
srs_res0->nrofSRS_Ports = NR_SRS_Resource__nrofSRS_Ports_ports4;
break;
default:
LOG_E(NR_RRC, "Number of SRS Ports Per Resource %ld is invalid!\n",
ul_feature_setup->supportedSRS_Resources->maxNumberSRS_Ports_PerResource);
}
}
LOG_I(NR_RRC, "SRS configured with %d ports\n", 1<<srs_res0->nrofSRS_Ports);
}
srs_res0->ptrs_PortIndex = NULL;
srs_res0->transmissionComb.present = NR_SRS_Resource__transmissionComb_PR_n2;
srs_res0->transmissionComb.choice.n2 = calloc(1,sizeof(*srs_res0->transmissionComb.choice.n2));
......@@ -1136,12 +1156,20 @@ void config_uplinkBWP(NR_BWP_Uplink_t *ubwp,
pusch_Config->uci_OnPUSCH=NULL;
pusch_Config->tp_pi2BPSK=NULL;
long maxMIMO_Layers = servingcellconfigdedicated &&
servingcellconfigdedicated->uplinkConfig
&& servingcellconfigdedicated->uplinkConfig->pusch_ServingCellConfig
&& servingcellconfigdedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1
&& servingcellconfigdedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers ?
*servingcellconfigdedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers : 1;
ubwp->bwp_Dedicated->srs_Config = calloc(1,sizeof(*ubwp->bwp_Dedicated->srs_Config));
config_srs(ubwp->bwp_Dedicated->srs_Config,
NULL,
curr_bwp,
uid,
bwp_loop+1,
maxMIMO_Layers,
configuration->do_SRS);
ubwp->bwp_Dedicated->configuredGrantConfig = NULL;
......
......@@ -150,6 +150,7 @@ void config_srs(NR_SetupRelease_SRS_Config_t *setup_release_srs_Config,
const int curr_bwp,
const int uid,
const int res_id,
const long maxMIMO_Layers,
const int do_srs);
void set_dl_mcs_table(int scs,
NR_UE_NR_Capability_t *cap,
......
......@@ -91,6 +91,12 @@
#define NR_RRC_RECONFIGURATION_DELAY_MS 10
#define NR_RRC_BWP_SWITCHING_DELAY_MS 6
// 3GPP TS 38.133 - Section 8 - Table 8.2.1.2.7-2: Parameters which cause interruption other than SCS
// This table was recently added to 3GPP. It shows that changing the parameters locationAndBandwidth, nrofSRS-Ports or
// maxMIMO-Layers-r16 causes an interruption. This parameter is not yet being used in code, but has been placed here
// for future reference.
#define NR_OF_SRS_PORTS_SWITCHING_DELAY_MS 30
#define NR_UE_MODULE_INVALID ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!!
#define NR_UE_INDEX_INVALID ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!! used to be -1
......
......@@ -479,9 +479,15 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
LOG_I(RRC,"TRANSFORM PRECODING ENABLED......\n");
}
long maxMIMO_Layers = servingcellconfigdedicated->uplinkConfig &&
servingcellconfigdedicated->uplinkConfig->pusch_ServingCellConfig &&
servingcellconfigdedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1 &&
servingcellconfigdedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers ?
*servingcellconfigdedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->ext1->maxMIMO_Layers : 1;
int curr_bwp = NRRIV2BW(servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth,MAX_BWP_SIZE);
initialUplinkBWP->srs_Config = calloc(1,sizeof(*initialUplinkBWP->srs_Config));
config_srs(initialUplinkBWP->srs_Config, NULL, curr_bwp, uid, 0, configuration->do_SRS);
config_srs(initialUplinkBWP->srs_Config, NULL, curr_bwp, uid, 0, maxMIMO_Layers, configuration->do_SRS);
// Downlink BWPs
int n_dl_bwp = 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