Commit 43afdc90 authored by lfq's avatar lfq

add log

parent 321e76e8
......@@ -40,6 +40,7 @@
\param no_prefix if 1 prefix is removed by HW
\param reset_freq_est if non-zero it resets the frequency offset estimation loop
*/
uint cal_amp(int16_t *dataIn, int len);
int slot_fep(PHY_VARS_UE *phy_vars_ue,
unsigned char l,
......
......@@ -34,6 +34,19 @@
#define LOG_I(A,B...) printf(A)
#endif*/
uint cal_amp(int16_t *dataIn, int len)
{
int i;
uint sumA = 0;
for(i=0;i<len;i++)
{
sumA += abs(dataIn[i]);
}
sumA = sumA/len;
return sumA;
}
int nr_slot_fep(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
unsigned char symbol,
......
......@@ -1297,6 +1297,21 @@ static void inner_rx(PHY_VARS_gNB *gNB,
frame_parms);
}
}
unsigned int pusch_amp;
if (symbol == (rel15_ul->start_symbol_index + rel15_ul->nr_of_symbols - 1)) {
static int cnt = 0;
if (((cnt & 0x7F) == 0) || (cnt < 0x80))
//if ( (cnt < 0x100))
{
pusch_amp = cal_amp(&rxFext[0][0], rel15_ul->rb_size * NR_NB_SC_PER_RB);
//LOG_I(PHY, "UL AMP frame %d %d, symbol %d, rbs %d, res %d, time %d, freq %d \n", frame, slot, symbol, nb_re_pusch/12, nb_re_pusch, g_ul_time_amp[symbol], g_ul_freq_amp[symbol], pusch_amp);
LOG_I(PHY, "UL AMP frame %d %d, symbol %d, rbs %d, pusch amp %d \n", 0, slot, symbol, rel15_ul->rb_size, pusch_amp);
}
cnt++;
}
c16_t rho[nb_layer][nb_layer][buffer_length] __attribute__((aligned(32)));
c16_t rxF_ch_maga [nb_layer][buffer_length] __attribute__((aligned(32)));
c16_t rxF_ch_magb [nb_layer][buffer_length] __attribute__((aligned(32)));
......
......@@ -420,6 +420,12 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
frame_parms,
dlsch[0].dlsch_config.dlDmrsSymbPos,
ue->chest_time);
if ((pilots == 0) & ((symbol == (startSymbIdx + nbSymb -1))))
{
unsigned int pdsch_amp;
pdsch_amp = cal_amp((int16_t *)&rxdataF_ext[0][0], nb_rb_pdsch * 12);
LOG_I(PHY, "frame %d %d, symbol %d pdsch_amp %d, rb %d\n", frame, nr_slot_rx, symbol, pdsch_amp, nb_rb_pdsch);
}
if (meas_enabled) {
stop_meas(&meas);
LOG_D(PHY,
......@@ -647,6 +653,9 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
codeword_TB0,
codeword_TB1,
layer_llr);
// if (llr[0][0]) abort();
for (int i=0; i<NR_MAX_NB_LAYERS; i++)
free(layer_llr[i]);
......
......@@ -71,6 +71,9 @@
#define CONFIG_STRING_MACRLC_MIN_GRANT_PRB "min_grant_prb"
#define CONFIG_STRING_MACRLC_MIN_GRANT_MCS "min_grant_mcs"
#define CONFIG_STRING_MACRLC_IDENTITY_PM "identity_precoding_matrix"
#define CONFIG_STRING_MACRLC_TARGET_DL_RB "target_dl_rb"
#define CONFIG_STRING_MACRLC_TARGET_DL_MCS "target_dl_mcs"
#define CONFIG_STRING_MACRLC_TARGET_DL_SLOT_MAP "target_dl_slotmap"
#define HLP_MACRLC_UL_PRBBLACK "SNR threshold to decide whether a PRB will be blacklisted or not"
#define HLP_MACRLC_DL_BLER_UP "Upper threshold of BLER to decrease DL MCS"
......@@ -125,6 +128,9 @@
{CONFIG_STRING_MACRLC_MIN_GRANT_PRB, HLP_MACRLC_MIN_GRANT_PRB, 0, .u8ptr=NULL, .defintval=5, TYPE_UINT8, 0}, \
{CONFIG_STRING_MACRLC_MIN_GRANT_MCS, HLP_MACRLC_MIN_GRANT_MCS, 0, .u8ptr=NULL, .defintval=9, TYPE_UINT8, 0}, \
{CONFIG_STRING_MACRLC_IDENTITY_PM, HLP_MACRLC_IDENTITY_PM, PARAMFLAG_BOOL, .u8ptr=NULL, .defintval=0, TYPE_UINT8, 0}, \
{CONFIG_STRING_MACRLC_TARGET_DL_RB, NULL, 0, .iptr=NULL, .defintval=50, TYPE_INT, 0}, \
{CONFIG_STRING_MACRLC_TARGET_DL_MCS, NULL, 0, .u8ptr=NULL, .defintval=9, TYPE_UINT8, 0}, \
{CONFIG_STRING_MACRLC_TARGET_DL_SLOT_MAP, NULL, 0, .u64ptr=NULL, .defintval=9, TYPE_INT, 0}, \
}
// clang-format off
......@@ -162,6 +168,10 @@
#define MACRLC_MIN_GRANT_PRB_IDX 31
#define MACRLC_MIN_GRANT_MCS_IDX 32
#define MACRLC_IDENTITY_PM_IDX 33
#define MACRLC_TARGET_DL_RB_IDX 34
#define MACRLC_TARGET_DL_MCS_IDX 35
#define MACRLC_TARGET_DL_SLOTMAP_IDX 36
#define MACRLCPARAMS_CHECK { \
{ .s5 = { NULL } }, \
......@@ -198,6 +208,9 @@
{ .s5 = { NULL } }, \
{ .s5 = { NULL } }, \
{ .s2 = { NULL } }, \
{ .s5 = { NULL } }, \
{ .s5 = { NULL } }, \
{ .s5 = { NULL } }, \
}
/*---------------------------------------------------------------------------------------------------------------------------------------------------------*/
......
......@@ -1257,13 +1257,19 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg)
RC.nrmac[j]->ul_prbblack_SNR_threshold = *(MacRLC_ParamList.paramarray[j][MACRLC_UL_PRBBLACK_SNR_THRESHOLD_IDX].iptr);
RC.nrmac[j]->pucch_failure_thres = *(MacRLC_ParamList.paramarray[j][MACRLC_PUCCHFAILURETHRES_IDX].iptr);
RC.nrmac[j]->pusch_failure_thres = *(MacRLC_ParamList.paramarray[j][MACRLC_PUSCHFAILURETHRES_IDX].iptr);
RC.nrmac[j]->target_dl_mcs = *(MacRLC_ParamList.paramarray[j][MACRLC_TARGET_DL_MCS_IDX].iptr);
RC.nrmac[j]->target_dl_rb = *(MacRLC_ParamList.paramarray[j][MACRLC_TARGET_DL_RB_IDX].iptr);
RC.nrmac[j]->target_dl_slotmap = *(MacRLC_ParamList.paramarray[j][MACRLC_TARGET_DL_SLOTMAP_IDX].iptr);
LOG_I(NR_MAC,
"PUSCH Target %d, PUCCH Target %d, PUCCH Failure %d, PUSCH Failure %d\n",
"PUSCH Target %d, PUCCH Target %d, PUCCH Failure %d, PUSCH Failure %d, target dl mcs %d rb %d slotmap %x\n",
RC.nrmac[j]->pusch_target_snrx10,
RC.nrmac[j]->pucch_target_snrx10,
RC.nrmac[j]->pucch_failure_thres,
RC.nrmac[j]->pusch_failure_thres);
RC.nrmac[j]->pusch_failure_thres,
RC.nrmac[j]->target_dl_mcs,
RC.nrmac[j]->target_dl_rb,
(unsigned int)RC.nrmac[j]->target_dl_slotmap);
if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_RRC") == 0) {
// check number of instances is same as RRC/PDCP
......
......@@ -51,6 +51,10 @@ void nr_preprocessor_phytest(module_id_t module_id,
sub_frame_t slot)
{
/* already mutex protected: held in gNB_dlsch_ulsch_scheduler() */
gNB_MAC_INST *gNB_mac = RC.nrmac[module_id];
target_dl_bw = gNB_mac->target_dl_rb;
dlsch_slot_bitmap = gNB_mac->target_dl_slotmap;
if (!is_xlsch_in_slot(dlsch_slot_bitmap, slot))
return;
NR_UE_info_t *UE = RC.nrmac[module_id]->UE_info.list[0];
......@@ -161,11 +165,11 @@ void nr_preprocessor_phytest(module_id_t module_id,
&tda_info,
target_dl_Nl);
sched_pdsch->mcs = target_dl_mcs;
sched_pdsch->mcs = gNB_mac->target_dl_mcs;
sched_pdsch->nrOfLayers = target_dl_Nl;
sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, dl_bwp->mcsTableIdx);
sched_pdsch->R = nr_get_code_rate_dl(sched_pdsch->mcs, dl_bwp->mcsTableIdx);
sched_ctrl->dl_bler_stats.mcs = target_dl_mcs; /* for logging output */
sched_ctrl->dl_bler_stats.mcs = gNB_mac->target_dl_mcs; /* for logging output */
sched_pdsch->tb_size = nr_compute_tbs(sched_pdsch->Qm,
sched_pdsch->R,
sched_pdsch->rbSize,
......@@ -183,7 +187,7 @@ void nr_preprocessor_phytest(module_id_t module_id,
for (int rb = 0; rb < sched_pdsch->rbSize; rb++)
vrb_map[rb + sched_pdsch->rbStart + BWPStart] = SL_to_bitmap(tda_info.startSymbolIndex, tda_info.nrOfSymbols);
if ((frame&127) == 0) LOG_D(MAC,"phytest: %d.%d DL mcs %d, DL rbStart %d, DL rbSize %d\n", frame, slot, sched_pdsch->mcs, rbStart,rbSize);
if ((frame&127) == 0) LOG_I(MAC,"phytest: %d.%d rnti %d, DL mcs %d(qm %d, tbsize %d), DL rbStart %d, DL rbSize %d\n", frame, slot, UE->rnti, sched_pdsch->mcs, sched_pdsch->Qm, sched_pdsch->tb_size, rbStart,rbSize);
}
uint32_t target_ul_mcs = 9;
......
......@@ -89,6 +89,10 @@ size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset
const char *begin = output;
const char *end = output + strlen;
static uint64_t dl_bytes_old = 0;
static uint64_t ul_bytes_old = 0;
uint64_t dl_bytes_new = 0;
uint64_t ul_bytes_new = 0;
/* this function is called from gNB_dlsch_ulsch_scheduler(), so assumes the
* scheduler to be locked*/
NR_SCHED_ENSURE_LOCKED(&gNB->sched_lock);
......@@ -99,6 +103,8 @@ size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset
NR_mac_stats_t *stats = &UE->mac_stats;
const int avg_rsrp = stats->num_rsrp_meas > 0 ? stats->cumul_rsrp / stats->num_rsrp_meas : 0;
dl_bytes_new = stats->dl.total_bytes;
ul_bytes_new = stats->ul.total_bytes;
output += snprintf(output,
end - output,
"UE RNTI %04x (%d) PH %d dB PCMAX %d dBm, average RSRP %d (%d meas)\n",
......@@ -175,6 +181,20 @@ size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset
stats->dl.lc_bytes[lc_id],
stats->ul.lc_bytes[lc_id]);
}
output += snprintf(output,
end - output,
"UE %04x: dl thoughtput %"PRIu64" kbps, dl_bytes_old %"PRIu64 "dl_bytes_new %"PRIu64 "\n",
UE->rnti, (uint64_t)((dl_bytes_new - dl_bytes_old) * 25 / 4000), dl_bytes_old, dl_bytes_new);
output += snprintf(output,
end - output,
"UE %04x: ul thoughtput %"PRIu64" kbps, ul_bytes_old %"PRIu64 "ul_bytes_new %"PRIu64 "\n",
UE->rnti, (uint64_t)((ul_bytes_new - ul_bytes_old) * 25 / 4000), ul_bytes_old, ul_bytes_new);
if (true == reset_rsrp)
{
dl_bytes_old = dl_bytes_new;
ul_bytes_old = ul_bytes_new;
}
}
NR_SCHED_UNLOCK(&gNB->UE_info.mutex);
return output - begin;
......
......@@ -759,6 +759,9 @@ typedef struct gNB_MAC_INST_s {
/// Subcarrier Offset
int ssb_SubcarrierOffset;
int ssb_OffsetPointA;
int target_dl_mcs;
int target_dl_rb;
uint64_t target_dl_slotmap;
/// Common cell resources
NR_COMMON_channels_t common_channels[NFAPI_CC_MAX];
......
......@@ -192,6 +192,9 @@ MACRLCs = (
pusch_FailureThres = 1000;
ulsch_max_frame_inactivity = 0;
ul_max_mcs = 28;
target_dl_rb = 100;
target_dl_mcs = 18;
target_dl_slotmap = 4;
}
);
......@@ -209,7 +212,7 @@ RUs = (
local_rf = "yes"
nb_tx = 1
nb_rx = 1
att_tx = 0;
att_tx = 30;
att_rx = 0;
bands = [78];
max_pdschReferenceSignalPower = -27;
......@@ -217,7 +220,7 @@ RUs = (
eNB_instances = [0];
#beamforming 1x4 matrix:
bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000];
sdr_addrs = "dev=pciex:0,auxdac1=1508";
sdr_addrs = "dev=pciex:0,auxdac1=1660";
clock_src = "internal";
}
);
......
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