Commit 021b546c authored by Robert Schmidt's avatar Robert Schmidt Committed by Teodora

Add UL mac stats and create a common struct for both DL and UL

DL stats (aggregated total and used PRBs) previosuly used only for O1 interface,
now finds the purpose for E2 interface as well.

New UL stats (aggregated total and used PRBs) serve for E2 interface only.
Co-authored-by: default avatarTeodora Vladić <teodora.vladic@openairinterface.org>
parent 17ee9db0
...@@ -105,10 +105,10 @@ static int get_stats(char *buf, int debug, telnet_printfunc_t prnt) ...@@ -105,10 +105,10 @@ static int get_stats(char *buf, int debug, telnet_printfunc_t prnt)
int bw_index = get_supported_band_index(scs, fr, nrb); int bw_index = get_supported_band_index(scs, fr, nrb);
int bw_mhz = get_supported_bw_mhz(fr, bw_index); int bw_mhz = get_supported_bw_mhz(fr, bw_index);
const mac_stats_t *stat = &mac->mac_stats; const dlul_mac_stats_t *stat = &mac->mac_stats;
static mac_stats_t last = {0}; static dlul_mac_stats_t last = {0};
int diff_used = stat->used_prb_aggregate - last.used_prb_aggregate; int diff_used = stat->dl.used_prb_aggregate - last.dl.used_prb_aggregate;
int diff_total = stat->total_prb_aggregate - last.total_prb_aggregate; int diff_total = stat->dl.total_prb_aggregate - last.dl.total_prb_aggregate;
int load = diff_total > 0 ? 100 * diff_used / diff_total : 0; int load = diff_total > 0 ? 100 * diff_used / diff_total : 0;
last = *stat; last = *stat;
......
...@@ -1224,7 +1224,7 @@ void post_process_dlsch(gNB_MAC_INST *nr_mac, post_process_pdsch_t *pdsch, NR_UE ...@@ -1224,7 +1224,7 @@ void post_process_dlsch(gNB_MAC_INST *nr_mac, post_process_pdsch_t *pdsch, NR_UE
T(T_GNB_MAC_RETRANSMISSION_DL_PDU_WITH_DATA, T_INT(module_id), T_INT(CC_id), T_INT(rnti), T(T_GNB_MAC_RETRANSMISSION_DL_PDU_WITH_DATA, T_INT(module_id), T_INT(CC_id), T_INT(rnti),
T_INT(frame), T_INT(slot), T_INT(current_harq_pid), T_INT(harq->round), T_BUFFER(harq->transportBlock.buf, TBS)); T_INT(frame), T_INT(slot), T_INT(current_harq_pid), T_INT(harq->round), T_BUFFER(harq->transportBlock.buf, TBS));
UE->mac_stats.dl.total_rbs_retx += sched_pdsch->rbSize; UE->mac_stats.dl.total_rbs_retx += sched_pdsch->rbSize;
nr_mac->mac_stats.used_prb_aggregate += sched_pdsch->rbSize; nr_mac->mac_stats.dl.used_prb_aggregate += sched_pdsch->rbSize;
} else { /* initial transmission */ } else { /* initial transmission */
LOG_D(NR_MAC, "Initial HARQ transmission in %d.%d\n", frame, slot); LOG_D(NR_MAC, "Initial HARQ transmission in %d.%d\n", frame, slot);
uint8_t *buf = allocate_transportBlock_buffer(&harq->transportBlock, TBS); uint8_t *buf = allocate_transportBlock_buffer(&harq->transportBlock, TBS);
...@@ -1338,7 +1338,7 @@ void post_process_dlsch(gNB_MAC_INST *nr_mac, post_process_pdsch_t *pdsch, NR_UE ...@@ -1338,7 +1338,7 @@ void post_process_dlsch(gNB_MAC_INST *nr_mac, post_process_pdsch_t *pdsch, NR_UE
UE->mac_stats.dl.num_mac_sdu += sdus; UE->mac_stats.dl.num_mac_sdu += sdus;
UE->mac_stats.dl.current_rbs = sched_pdsch->rbSize; UE->mac_stats.dl.current_rbs = sched_pdsch->rbSize;
UE->mac_stats.dl.total_sdu_bytes += dlsch_total_bytes; UE->mac_stats.dl.total_sdu_bytes += dlsch_total_bytes;
nr_mac->mac_stats.used_prb_aggregate += sched_pdsch->rbSize; nr_mac->mac_stats.dl.used_prb_aggregate += sched_pdsch->rbSize;
/* save retransmission information */ /* save retransmission information */
harq->sched_pdsch = *sched_pdsch; harq->sched_pdsch = *sched_pdsch;
...@@ -1388,7 +1388,7 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -1388,7 +1388,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
NR_ServingCellConfigCommon_t *scc = gNB_mac->common_channels[CC_id].ServingCellConfigCommon; NR_ServingCellConfigCommon_t *scc = gNB_mac->common_channels[CC_id].ServingCellConfigCommon;
int bw = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; int bw = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
gNB_mac->mac_stats.total_prb_aggregate += bw; gNB_mac->mac_stats.dl.total_prb_aggregate += bw;
nfapi_nr_dl_tti_request_body_t *dl_req = &DL_req->dl_tti_request_body; nfapi_nr_dl_tti_request_body_t *dl_req = &DL_req->dl_tti_request_body;
post_process_pdsch_t pdsch = { frame, slot, dl_req, TX_req }; post_process_pdsch_t pdsch = { frame, slot, dl_req, TX_req };
......
...@@ -2455,6 +2455,7 @@ void post_process_ulsch(gNB_MAC_INST *nr_mac, post_process_pusch_t *pusch, NR_UE ...@@ -2455,6 +2455,7 @@ void post_process_ulsch(gNB_MAC_INST *nr_mac, post_process_pusch_t *pusch, NR_UE
} }
UE->mac_stats.ul.current_bytes = sched_pusch->tb_size; UE->mac_stats.ul.current_bytes = sched_pusch->tb_size;
UE->mac_stats.ul.current_rbs = sched_pusch->rbSize; UE->mac_stats.ul.current_rbs = sched_pusch->rbSize;
nr_mac->mac_stats.ul.used_prb_aggregate += sched_pusch->rbSize;
sched_ctrl->last_ul_frame = sched_pusch->frame; sched_ctrl->last_ul_frame = sched_pusch->frame;
sched_ctrl->last_ul_slot = sched_pusch->slot; sched_ctrl->last_ul_slot = sched_pusch->slot;
...@@ -2697,6 +2698,7 @@ static void nr_ulsch_preprocessor(gNB_MAC_INST *nr_mac, post_process_pusch_t *pp ...@@ -2697,6 +2698,7 @@ static void nr_ulsch_preprocessor(gNB_MAC_INST *nr_mac, post_process_pusch_t *pp
int tda = seq_arr_dist(&nr_mac->ul_tda, seq_arr_front(&nr_mac->ul_tda), tda_info); int tda = seq_arr_dist(&nr_mac->ul_tda, seq_arr_front(&nr_mac->ul_tda), tda_info);
AssertFatal(tda >= 0 && tda < 16, "illegal TDA index %d\n", tda); AssertFatal(tda >= 0 && tda < 16, "illegal TDA index %d\n", tda);
nr_mac->mac_stats.ul.total_prb_aggregate += bw;
int len[num_beams]; int len[num_beams];
for (int i = 0; i < num_beams; i++) for (int i = 0; i < num_beams; i++)
len[i] = rb_len; len[i] = rb_len;
......
...@@ -870,6 +870,11 @@ typedef struct { ...@@ -870,6 +870,11 @@ typedef struct {
uint64_t used_prb_aggregate; uint64_t used_prb_aggregate;
} mac_stats_t; } mac_stats_t;
typedef struct dlul_mac_stats {
mac_stats_t dl;
mac_stats_t ul;
} dlul_mac_stats_t;
/// helper type to encapsulate a frame/slot combination in a single type. /// helper type to encapsulate a frame/slot combination in a single type.
/// Currently only used in the UL preprocessor. Note: if you use this type /// Currently only used in the UL preprocessor. Note: if you use this type
/// further, please refactor it into a common type first. /// further, please refactor it into a common type first.
...@@ -996,7 +1001,7 @@ typedef struct gNB_MAC_INST_s { ...@@ -996,7 +1001,7 @@ typedef struct gNB_MAC_INST_s {
pthread_mutex_t sched_lock; pthread_mutex_t sched_lock;
mac_stats_t mac_stats; dlul_mac_stats_t mac_stats;
uint64_t num_scheduled_prach_rx; uint64_t num_scheduled_prach_rx;
} gNB_MAC_INST; } gNB_MAC_INST;
......
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