Commit bcbf2b38 authored by Robert Schmidt's avatar Robert Schmidt Committed by Chieh-Chun Chen

Add more MAC stats

parent 61312ca6
......@@ -133,6 +133,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
gNB->tdd_beam_association[i] = -1;
}
gNB->frame = frame;
gNB->slot = slot;
start_meas(&RC.nrmac[module_idP]->eNB_scheduler);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_IN);
......
......@@ -888,6 +888,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
UE->mac_stats.dl.current_bytes = 0;
UE->mac_stats.dl.current_rbs = 0;
NR_CellGroupConfig_t *cg = UE->CellGroup;
/* update TA and set ta_apply every 10 frames.
......@@ -1185,6 +1186,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
current_harq_pid);
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, TBS));
UE->mac_stats.dl.total_rbs_retx += sched_pdsch->rbSize;
} else { /* initial transmission */
LOG_D(NR_MAC, "[%s] Initial HARQ transmission in %d.%d\n", __FUNCTION__, frame, slot);
uint8_t *buf = (uint8_t *) harq->transportBlock;
......@@ -1200,6 +1202,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
int dlsch_total_bytes = 0;
/* next, get RLC data */
start_meas(&gNB_mac->rlc_data_req);
int sdus = 0;
if (sched_ctrl->num_total_bytes > 0) {
/* loop over all activated logical channels */
......@@ -1251,6 +1254,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
buf += len+sizeof(NR_MAC_SUBHEADER_LONG);
dlsch_total_bytes += len;
lcid_bytes += len;
sdus += 1;
}
UE->mac_stats.dl.lc_bytes[lcid] += lcid_bytes;
......@@ -1278,6 +1282,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
}
for (; buf < bufEnd; buf++)
*buf = lrand48() & 0xff;
sdus +=1;
}
}
......@@ -1295,6 +1300,10 @@ void nr_schedule_ue_spec(module_id_t module_id,
UE->mac_stats.dl.total_bytes += TBS;
UE->mac_stats.dl.current_bytes = TBS;
UE->mac_stats.dl.total_rbs += sched_pdsch->rbSize;
UE->mac_stats.dl.num_mac_sdu += sdus;
UE->mac_stats.dl.current_rbs = sched_pdsch->rbSize;
/* save retransmission information */
harq->sched_pdsch = *sched_pdsch;
/* save which time allocation has been used, to be used on
......
......@@ -88,6 +88,7 @@ int nr_process_mac_pdu( instance_t module_idP,
uint8_t done = 0;
int sdus = 0;
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
......@@ -349,6 +350,7 @@ int nr_process_mac_pdu( instance_t module_idP,
1,
NULL);
sdus += 1;
/* Updated estimated buffer when receiving data */
if (sched_ctrl->estimated_ul_buffer >= mac_len) {
sched_ctrl->estimated_ul_buffer -= mac_len;
......@@ -357,6 +359,7 @@ int nr_process_mac_pdu( instance_t module_idP,
}
break;
sdus += 1;
default:
LOG_E(NR_MAC, "Received unknown MAC header (LCID = 0x%02x)\n", rx_lcid);
......@@ -388,6 +391,9 @@ int nr_process_mac_pdu( instance_t module_idP,
return 0;
}
}
UE->mac_stats.ul.num_mac_sdu += sdus;
return 0;
}
......@@ -1494,6 +1500,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
NR_UE_UL_BWP_t *current_BWP = &UE->current_UL_BWP;
UE->mac_stats.ul.current_bytes = 0;
UE->mac_stats.ul.current_rbs = 0;
/* dynamic PUSCH values (RB alloc, MCS, hence R, Qm, TBS) that change in
* every TTI are pre-populated by the preprocessor and used below */
......@@ -1548,6 +1555,8 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
* retransmissions */
cur_harq->sched_pusch.time_domain_allocation = ps->time_domain_allocation;
sched_ctrl->sched_ul_bytes += sched_pusch->tb_size;
UE->mac_stats.ul.total_rbs += sched_pusch->rbSize;
} else {
LOG_D(NR_MAC,
"%d.%2d UL retransmission RNTI %04x sched %d.%2d HARQ PID %d round %d NDI %d\n",
......@@ -1559,8 +1568,10 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
harq_id,
cur_harq->round,
cur_harq->ndi);
UE->mac_stats.ul.total_rbs_retx += sched_pusch->rbSize;
}
UE->mac_stats.ul.current_bytes = sched_pusch->tb_size;
UE->mac_stats.ul.current_rbs = sched_pusch->rbSize;
sched_ctrl->last_ul_frame = sched_pusch->frame;
sched_ctrl->last_ul_slot = sched_pusch->slot;
......
......@@ -667,6 +667,10 @@ typedef struct NR_mac_dir_stats {
uint64_t errors;
uint64_t total_bytes;
uint32_t current_bytes;
uint32_t total_rbs;
uint32_t total_rbs_retx;
uint32_t num_mac_sdu;
uint32_t current_rbs;
} NR_mac_dir_stats_t;
typedef struct NR_mac_stats {
......@@ -849,6 +853,10 @@ typedef struct gNB_MAC_INST_s {
uint8_t min_grant_mcs;
nr_mac_rrc_ul_if_t mac_rrc;
int16_t frame;
int16_t slot;
} gNB_MAC_INST;
#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