Merge remote-tracking branch 'origin/develop' into develop-SRS-feedback
# Conflicts: # openair1/SCHED_NR/phy_procedures_nr_gNB.c # openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
This commit is contained in:
@@ -708,12 +708,12 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
uint16_t msi_control_element[29], *msi_ptr;
|
||||
// MSI buffer pointer
|
||||
char *buffer_pointer=NULL;
|
||||
if (msi_flag == 1) {
|
||||
// Create MSI here
|
||||
msi_ptr = &msi_control_element[0];
|
||||
if (msi_flag == 1 && cc->mbms_SessionList) {
|
||||
// Create MSI here
|
||||
msi_ptr = &msi_control_element[0];
|
||||
|
||||
//Header for MTCHs
|
||||
num_mtch = cc->mbms_SessionList[mbms_mch_i]->list.count;
|
||||
// Header for MTCHs
|
||||
num_mtch = cc->mbms_SessionList[mbms_mch_i]->list.count;
|
||||
|
||||
TBS =
|
||||
get_TBS_DL(cc->MCH_pdu.mcs, to_prb(cc->mib->message.dl_Bandwidth));
|
||||
@@ -867,52 +867,63 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
//if ((i == 0) && ((RC.mac[module_idP]->MBMS_flag != multicast_relay) || (RC.mac[module_idP]->mcch_active==0))) {
|
||||
|
||||
// there is MTCHs, loop if there are more than 1
|
||||
if (mtch_flag == 1 ) {
|
||||
// Calculate TBS
|
||||
// get MTCH data from RLC (like for DTCH)
|
||||
LOG_D(MAC,"[eNB %d] CC_id %d Frame %d subframeP %d: Schedule MTCH (area %d, sfAlloc %d)\n",
|
||||
module_idP, CC_id, frameP, subframeP, i, j);
|
||||
// BAd race condition: all this struct is filled by another thread, no mutex or any code to make it coherent
|
||||
if (mtch_flag == 1 && cc->mbms_SessionList && cc->mbms_SessionList[0] && cc->mbms_SessionList[0]->list.array[0]) {
|
||||
// Calculate TBS
|
||||
// get MTCH data from RLC (like for DTCH)
|
||||
LOG_D(MAC, "[eNB %d] CC_id %d Frame %d subframeP %d: Schedule MTCH (area %d, sfAlloc %d)\n", module_idP, CC_id, frameP, subframeP, i, j);
|
||||
|
||||
header_len_mtch = 3;
|
||||
LOG_D(MAC,"[eNB %d], CC_id %d, Frame %d, MTCH->MCH, Checking RLC status (rab %d, tbs %d, len %d)\n",
|
||||
module_idP, CC_id, frameP, MTCH, TBS,
|
||||
TBS - header_len_mcch - header_len_msi - sdu_length_total -
|
||||
header_len_mtch);
|
||||
header_len_mtch = 3;
|
||||
LOG_D(MAC,
|
||||
"[eNB %d], CC_id %d, Frame %d, MTCH->MCH, Checking RLC status (rab %d, tbs %d, len %d)\n",
|
||||
module_idP,
|
||||
CC_id,
|
||||
frameP,
|
||||
MTCH,
|
||||
TBS,
|
||||
TBS - header_len_mcch - header_len_msi - sdu_length_total - header_len_mtch);
|
||||
|
||||
//TODO
|
||||
mbms_rab_id = cc->mbms_SessionList[0/*mbms_mch_i*/]->list.array[0]->logicalChannelIdentity_r9;
|
||||
// TODO
|
||||
mbms_rab_id = cc->mbms_SessionList[0 /*mbms_mch_i*/]->list.array[0]->logicalChannelIdentity_r9;
|
||||
|
||||
rlc_status =
|
||||
mac_rlc_status_ind(module_idP, 0xfffd, frameP, subframeP,
|
||||
module_idP, ENB_FLAG_YES, MBMS_FLAG_YES,
|
||||
cc->mbms_SessionList[mbms_mch_i]->list.array[0]->logicalChannelIdentity_r9,
|
||||
//MTCH,
|
||||
0, 0
|
||||
);
|
||||
rlc_status = mac_rlc_status_ind(module_idP,
|
||||
0xfffd,
|
||||
frameP,
|
||||
subframeP,
|
||||
module_idP,
|
||||
ENB_FLAG_YES,
|
||||
MBMS_FLAG_YES,
|
||||
cc->mbms_SessionList[mbms_mch_i]->list.array[0]->logicalChannelIdentity_r9,
|
||||
// MTCH,
|
||||
0,
|
||||
0);
|
||||
|
||||
bytes_in_buffer = rlc_status.bytes_in_buffer;
|
||||
bytes_in_buffer = rlc_status.bytes_in_buffer;
|
||||
|
||||
//TOCHECK is this really neede?
|
||||
if( !(mcch_flag==1 || msi_flag==1) )
|
||||
msi_sfs = rlc_status.bytes_in_buffer/(TBS- header_len_mcch - header_len_msi -sdu_length_total - header_len_mtch)+(rlc_status.bytes_in_buffer%(TBS- header_len_mcch - header_len_msi -sdu_length_total - header_len_mtch)?1:0);
|
||||
// TOCHECK is this really neede?
|
||||
if (!(mcch_flag == 1 || msi_flag == 1))
|
||||
msi_sfs = rlc_status.bytes_in_buffer / (TBS - header_len_mcch - header_len_msi - sdu_length_total - header_len_mtch)
|
||||
+ (rlc_status.bytes_in_buffer % (TBS - header_len_mcch - header_len_msi - sdu_length_total - header_len_mtch) ? 1 : 0);
|
||||
|
||||
uint16_t TBS_MTCH =
|
||||
get_TBS_DL(cc->pmch_Config[mbms_mch_i]->dataMCS_r9, to_prb(cc->mib->message.dl_Bandwidth));
|
||||
uint16_t TBS_MTCH = get_TBS_DL(cc->pmch_Config[mbms_mch_i]->dataMCS_r9, to_prb(cc->mib->message.dl_Bandwidth));
|
||||
|
||||
if(msi_flag==1 && buffer_pointer!=NULL){
|
||||
// msi_ptr = &msi_control_element[0];
|
||||
if (msi_flag == 1 && buffer_pointer != NULL) {
|
||||
// msi_ptr = &msi_control_element[0];
|
||||
|
||||
msi_pmch_stop = (rlc_status.bytes_in_buffer - header_len_mcch - header_len_msi -sdu_length_total - header_len_mtch)/(TBS_MTCH/*- header_len_mcch - header_len_msi -sdu_length_total*/ - header_len_mtch)+((rlc_status.bytes_in_buffer-TBS-header_len_mcch - header_len_msi -sdu_length_total)%(TBS_MTCH/*- header_len_mcch - header_len_msi -sdu_length_total*/ - header_len_mtch)?0:0);
|
||||
msi_pmch_stop =
|
||||
(rlc_status.bytes_in_buffer - header_len_mcch - header_len_msi - sdu_length_total - header_len_mtch) / (TBS_MTCH /*- header_len_mcch - header_len_msi -sdu_length_total*/ - header_len_mtch)
|
||||
+ ((rlc_status.bytes_in_buffer - TBS - header_len_mcch - header_len_msi - sdu_length_total) % (TBS_MTCH /*- header_len_mcch - header_len_msi -sdu_length_total*/ - header_len_mtch) ? 0
|
||||
: 0);
|
||||
|
||||
for (k = 0; k < num_mtch; k++) { // loop for all session in this MCH (MCH[0]) at this moment
|
||||
msi_ptr = &msi_control_element[k];
|
||||
for (k = 0; k < num_mtch; k++) { // loop for all session in this MCH (MCH[0]) at this moment
|
||||
msi_ptr = &msi_control_element[k];
|
||||
|
||||
((MSI_ELEMENT *) msi_ptr)->lcid = cc->mbms_SessionList[mbms_mch_i]->list.array[k]->logicalChannelIdentity_r9; //mtch_lcid;
|
||||
((MSI_ELEMENT *)msi_ptr)->lcid = cc->mbms_SessionList[mbms_mch_i]->list.array[k]->logicalChannelIdentity_r9; // mtch_lcid;
|
||||
|
||||
if( msi_pmch_stop > cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9)
|
||||
LOG_E(MAC,"e-MBMS Buffer Overflow\n");
|
||||
if (msi_pmch_stop > cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9)
|
||||
LOG_E(MAC, "e-MBMS Buffer Overflow\n");
|
||||
|
||||
if(msi_pmch_stop>=num_sf_alloc /*&& msi_pmch_stop <=cc->pmch_Config[0]->sf_AllocEnd_r9*/) {
|
||||
if (msi_pmch_stop >= num_sf_alloc /*&& msi_pmch_stop <=cc->pmch_Config[0]->sf_AllocEnd_r9*/) {
|
||||
((MSI_ELEMENT *) msi_ptr)->stop_sf_MSB = (((msi_pmch_stop <=cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9 ? msi_pmch_stop: cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9) >> 8) & 0x7f);
|
||||
((MSI_ELEMENT *) msi_ptr)->stop_sf_LSB = ((msi_pmch_stop <=cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9 ? msi_pmch_stop: cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9) & 0xff);
|
||||
msi_pmch_stop = (msi_pmch_stop <=cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9 ? msi_pmch_stop: cc->pmch_Config[mbms_mch_i]->sf_AllocEnd_r9);
|
||||
|
||||
@@ -2076,7 +2076,7 @@ void get_delta_arfcn(int i, uint32_t nrarfcn, uint64_t N_OFFs){
|
||||
uint32_t delta_arfcn = nrarfcn - N_OFFs;
|
||||
|
||||
if(delta_arfcn%(nr_bandtable[i].step_size)!=0)
|
||||
AssertFatal(1 == 0, "nrarfcn %u is not on the channel raster for step size %lu", nrarfcn, nr_bandtable[i].step_size);
|
||||
AssertFatal(1==0, "nrarfcn %u is not on the channel raster for step size %lu", nrarfcn, nr_bandtable[i].step_size);
|
||||
|
||||
}
|
||||
|
||||
@@ -2096,10 +2096,10 @@ uint32_t to_nrarfcn(int nr_bandP,
|
||||
"Band %d, bw %u : DL carrier frequency %llu kHz < %llu\n",
|
||||
nr_bandP, bw, (long long unsigned int)dl_CarrierFreq_by_1k,
|
||||
(long long unsigned int)nr_bandtable[i].dl_min);
|
||||
AssertFatal(dl_CarrierFreq_by_1k <= (nr_bandtable[i].dl_max - bw_kHz),
|
||||
AssertFatal(dl_CarrierFreq_by_1k <= (nr_bandtable[i].dl_max - bw_kHz/2),
|
||||
"Band %d, dl_CarrierFreq %llu bw %u: DL carrier frequency %llu kHz > %llu\n",
|
||||
nr_bandP, (long long unsigned int)dl_CarrierFreq,bw, (long long unsigned int)dl_CarrierFreq_by_1k,
|
||||
(long long unsigned int)(nr_bandtable[i].dl_max - bw_kHz));
|
||||
(long long unsigned int)(nr_bandtable[i].dl_max - bw_kHz/2));
|
||||
|
||||
int deltaFglobal = 60;
|
||||
uint32_t N_REF_Offs = 2016667;
|
||||
@@ -2119,7 +2119,7 @@ uint32_t to_nrarfcn(int nr_bandP,
|
||||
// This is equation before Table 5.4.2.1-1 in 38101-1-f30
|
||||
// F_REF=F_REF_Offs + deltaF_Global(N_REF-NREF_REF_Offs)
|
||||
nrarfcn = (((dl_CarrierFreq_by_1k - F_REF_Offs_khz)/deltaFglobal)+N_REF_Offs);
|
||||
get_delta_arfcn(i, nrarfcn, nr_bandtable[i].N_OFFs_DL);
|
||||
//get_delta_arfcn(i, nrarfcn, nr_bandtable[i].N_OFFs_DL);
|
||||
|
||||
return nrarfcn;
|
||||
}
|
||||
|
||||
@@ -512,6 +512,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
|
||||
int nr_dl_slots = n;
|
||||
int nr_ulstart_slot = 0;
|
||||
if (tdd) {
|
||||
nr_ulstart_slot = tdd->nrofDownlinkSlots + (tdd->nrofUplinkSymbols == 0);
|
||||
nr_dl_slots = tdd->nrofDownlinkSlots + (tdd->nrofDownlinkSymbols != 0);
|
||||
nr_ulstart_slot = tdd->nrofDownlinkSlots + (tdd->nrofUplinkSymbols == 0);
|
||||
nr_slots_period /= get_nb_periods_per_frame(tdd->dl_UL_TransmissionPeriodicity);
|
||||
|
||||
@@ -181,8 +181,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
|
||||
|
||||
if ((slot == 0) && (frame & 127) == 0) {
|
||||
char stats_output[16384];
|
||||
stats_output[0] = '\0';
|
||||
char stats_output[16000] = {0};
|
||||
dump_mac_stats(RC.nrmac[module_idP], stats_output, sizeof(stats_output), true);
|
||||
LOG_I(NR_MAC, "Frame.Slot %d.%d\n%s\n", frame, slot, stats_output);
|
||||
}
|
||||
|
||||
@@ -1109,8 +1109,8 @@ int nr_srs_tpmi_estimation(const NR_PUSCH_Config_t *pusch_Config,
|
||||
void handle_nr_srs_measurements(const module_id_t module_id,
|
||||
const frame_t frame,
|
||||
const sub_frame_t slot,
|
||||
const nfapi_nr_srs_indication_pdu_t *srs_ind) {
|
||||
|
||||
const nfapi_nr_srs_indication_pdu_t *srs_ind)
|
||||
{
|
||||
LOG_D(NR_MAC, "(%d.%d) Received SRS indication for UE %04x\n", frame, slot, srs_ind->rnti);
|
||||
|
||||
#ifdef SRS_IND_DEBUG
|
||||
@@ -1125,7 +1125,12 @@ void handle_nr_srs_measurements(const module_id_t module_id,
|
||||
|
||||
NR_UE_info_t *UE = find_nr_UE(&RC.nrmac[module_id]->UE_info, srs_ind->rnti);
|
||||
if (!UE) {
|
||||
LOG_W(NR_MAC, "Could not find UE %04x\n", srs_ind->rnti);
|
||||
LOG_W(NR_MAC, "Could not find UE for RNTI %04x\n", srs_ind->rnti);
|
||||
return;
|
||||
}
|
||||
|
||||
if (srs_ind->timing_advance_offset == 0xFFFF) {
|
||||
LOG_W(NR_MAC, "Invalid timing advance offset for RNTI %04x\n", srs_ind->rnti);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1133,39 +1138,45 @@ void handle_nr_srs_measurements(const module_id_t module_id,
|
||||
NR_mac_stats_t *stats = &UE->mac_stats;
|
||||
|
||||
switch (srs_ind->srs_usage) {
|
||||
|
||||
case NR_SRS_ResourceSet__usage_beamManagement: {
|
||||
|
||||
nfapi_nr_srs_beamforming_report_t nr_srs_beamforming_report;
|
||||
unpack_nr_srs_beamforming_report(srs_ind->report_tlv->value,
|
||||
srs_ind->report_tlv->length,
|
||||
&nr_srs_beamforming_report,
|
||||
sizeof(nfapi_nr_srs_beamforming_report_t));
|
||||
|
||||
if (nr_srs_beamforming_report.wide_band_snr == 0xFF) {
|
||||
LOG_W(NR_MAC, "Invalid wide_band_snr for RNTI %04x\n", srs_ind->rnti);
|
||||
return;
|
||||
}
|
||||
|
||||
int wide_band_snr_dB = (nr_srs_beamforming_report.wide_band_snr >> 1) - 64;
|
||||
|
||||
#ifdef SRS_IND_DEBUG
|
||||
LOG_I(NR_MAC, "nr_srs_beamforming_report.prg_size = %i\n", nr_srs_beamforming_report.prg_size);
|
||||
LOG_I(NR_MAC, "nr_srs_beamforming_report.num_symbols = %i\n", nr_srs_beamforming_report.num_symbols);
|
||||
LOG_I(NR_MAC, "nr_srs_beamforming_report.wide_band_snr = %i (%i dB)\n", nr_srs_beamforming_report.wide_band_snr, (nr_srs_beamforming_report.wide_band_snr>>1)-64);
|
||||
LOG_I(NR_MAC, "nr_srs_beamforming_report.wide_band_snr = %i (%i dB)\n", nr_srs_beamforming_report.wide_band_snr, wide_band_snr_dB);
|
||||
LOG_I(NR_MAC, "nr_srs_beamforming_report.num_reported_symbols = %i\n", nr_srs_beamforming_report.num_reported_symbols);
|
||||
LOG_I(NR_MAC, "nr_srs_beamforming_report.prgs[0].num_prgs = %i\n", nr_srs_beamforming_report.prgs[0].num_prgs);
|
||||
for(int prg_idx = 0; prg_idx < nr_srs_beamforming_report.prgs[0].num_prgs; prg_idx++) {
|
||||
LOG_I(NR_MAC, "nr_srs_beamforming_report.prgs[0].prg_list[%3i].rb_snr = %i (%i dB)\n",
|
||||
for (int prg_idx = 0; prg_idx < nr_srs_beamforming_report.prgs[0].num_prgs; prg_idx++) {
|
||||
LOG_I(NR_MAC,
|
||||
"nr_srs_beamforming_report.prgs[0].prg_list[%3i].rb_snr = %i (%i dB)\n",
|
||||
prg_idx,
|
||||
nr_srs_beamforming_report.prgs[0].prg_list[prg_idx].rb_snr,
|
||||
(nr_srs_beamforming_report.prgs[0].prg_list[prg_idx].rb_snr>>1)-64);
|
||||
(nr_srs_beamforming_report.prgs[0].prg_list[prg_idx].rb_snr >> 1) - 64);
|
||||
}
|
||||
#endif
|
||||
|
||||
sprintf(stats->srs_stats,"UL-SNR %i dB", (nr_srs_beamforming_report.wide_band_snr>>1)-64);
|
||||
sprintf(stats->srs_stats, "UL-SNR %i dB", wide_band_snr_dB);
|
||||
|
||||
const int ul_prbblack_SNR_threshold = nr_mac->ul_prbblack_SNR_threshold;
|
||||
uint16_t *ulprbbl = nr_mac->ulprbbl;
|
||||
|
||||
uint8_t num_rbs = nr_srs_beamforming_report.prg_size * nr_srs_beamforming_report.prgs[0].num_prgs;
|
||||
memset(ulprbbl, 0, num_rbs*sizeof(uint16_t));
|
||||
memset(ulprbbl, 0, num_rbs * sizeof(uint16_t));
|
||||
for (int rb = 0; rb < num_rbs; rb++) {
|
||||
int snr = (nr_srs_beamforming_report.prgs[0].prg_list[rb/nr_srs_beamforming_report.prg_size].rb_snr>>1)-64;
|
||||
if (snr < ul_prbblack_SNR_threshold) {
|
||||
int snr = (nr_srs_beamforming_report.prgs[0].prg_list[rb / nr_srs_beamforming_report.prg_size].rb_snr >> 1) - 64;
|
||||
if (snr < wide_band_snr_dB - ul_prbblack_SNR_threshold) {
|
||||
ulprbbl[rb] = 0x3FFF; // all symbols taken
|
||||
}
|
||||
LOG_D(NR_MAC, "ulprbbl[%3i] = 0x%x\n", rb, ulprbbl[rb]);
|
||||
@@ -1175,7 +1186,6 @@ void handle_nr_srs_measurements(const module_id_t module_id,
|
||||
}
|
||||
|
||||
case NR_SRS_ResourceSet__usage_codebook: {
|
||||
|
||||
nfapi_nr_srs_normalized_channel_iq_matrix_t nr_srs_normalized_channel_iq_matrix;
|
||||
unpack_nr_srs_normalized_channel_iq_matrix(srs_ind->report_tlv->value,
|
||||
srs_ind->report_tlv->length,
|
||||
@@ -1230,9 +1240,8 @@ void handle_nr_srs_measurements(const module_id_t module_id,
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(1==0,"Invalid SRS usage\n");
|
||||
AssertFatal(1 == 0, "Invalid SRS usage\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
long get_K2(NR_PUSCH_TimeDomainResourceAllocationList_t *tdaList,
|
||||
@@ -2268,7 +2277,14 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
|
||||
dci_pdu_rel15_t uldci_payload;
|
||||
memset(&uldci_payload, 0, sizeof(uldci_payload));
|
||||
|
||||
config_uldci(sib1, scc, pusch_pdu, &uldci_payload, &sched_ctrl->srs_feedback, ps->time_domain_allocation, UE->UE_sched_ctrl.tpc0, current_BWP);
|
||||
config_uldci(sib1,
|
||||
scc,
|
||||
pusch_pdu,
|
||||
&uldci_payload,
|
||||
&sched_ctrl->srs_feedback,
|
||||
ps->time_domain_allocation,
|
||||
UE->UE_sched_ctrl.tpc0,
|
||||
current_BWP);
|
||||
|
||||
fill_dci_pdu_rel15(scc,
|
||||
cg,
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
|
||||
#define MACSTATSSTRLEN 65536
|
||||
#define MACSTATSSTRLEN 16000
|
||||
|
||||
void *nrmac_stats_thread(void *arg) {
|
||||
|
||||
|
||||
@@ -1102,7 +1102,7 @@ void nr_rlc_tick(int frame, int subframe)
|
||||
}
|
||||
|
||||
/* This is a hack, to compile the gNB.
|
||||
* TODO: remove it. The solution is to cleanup cmake_targets/CMakeLists.txt
|
||||
* TODO: remove it. The solution is to cleanup CMakeLists.txt
|
||||
*/
|
||||
void rlc_tick(int a, int b)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user