Commit 62c67620 authored by Cedric Roux's avatar Cedric Roux

Merge remote-tracking branch 'origin/flexran-mac-stats' into develop_integration_2018_w08

parents 8acfccb9 524be876
......@@ -62,7 +62,7 @@ int flexran_agent_mac_stats_reply(mid_t mod_id,
// Protocol__FlexHeader *header;
int i, j, k;
// int cc_id = 0;
int cc_id = 0;
int enb_id = mod_id;
/* Allocate memory for list of UE reports */
......@@ -490,6 +490,101 @@ int flexran_agent_mac_stats_reply(mid_t mod_id,
}
if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_STATS) {
Protocol__FlexMacStats *macstats;
macstats = malloc(sizeof(Protocol__FlexMacStats));
if (macstats == NULL)
goto error;
protocol__flex_mac_stats__init(macstats);
macstats->total_bytes_sdus_dl = flexran_get_total_size_dl_mac_sdus(mod_id, i, cc_id);
macstats->has_total_bytes_sdus_dl = 1;
macstats->total_bytes_sdus_ul = flexran_get_total_size_ul_mac_sdus(mod_id, i, cc_id);
macstats->has_total_bytes_sdus_ul = 1;
macstats->tbs_dl = flexran_get_TBS_dl(mod_id, i, cc_id);
macstats->has_tbs_dl = 1;
macstats->tbs_ul = flexran_get_TBS_ul(mod_id, i, cc_id);
macstats->has_tbs_ul = 1;
macstats->prb_retx_dl = flexran_get_num_prb_retx_dl_per_ue(mod_id, i, cc_id);
macstats->has_prb_retx_dl = 1;
macstats->prb_retx_ul = flexran_get_num_prb_retx_ul_per_ue(mod_id, i, cc_id);
macstats->has_prb_retx_ul = 1;
macstats->prb_dl = flexran_get_num_prb_dl_tx_per_ue(mod_id, i, cc_id);
macstats->has_prb_dl = 1;
macstats->prb_ul = flexran_get_num_prb_ul_rx_per_ue(mod_id, i, cc_id);
macstats->has_prb_ul = 1;
macstats->mcs1_dl = flexran_get_mcs1_dl(mod_id, i, cc_id);
macstats->has_mcs1_dl = 1;
macstats->mcs2_dl = flexran_get_mcs2_dl(mod_id, i, cc_id);
macstats->has_mcs2_dl = 1;
macstats->mcs1_ul = flexran_get_mcs1_ul(mod_id, i, cc_id);
macstats->has_mcs1_ul = 1;
macstats->mcs2_ul = flexran_get_mcs2_ul(mod_id, i, cc_id);
macstats->has_mcs2_ul = 1;
macstats->total_prb_dl = flexran_get_total_prb_dl_tx_per_ue(mod_id, i, cc_id);
macstats->has_total_prb_dl = 1;
macstats->total_prb_ul = flexran_get_total_prb_ul_rx_per_ue(mod_id, i, cc_id);
macstats->has_total_prb_ul = 1;
macstats->total_pdu_dl = flexran_get_total_num_pdu_dl(mod_id, i, cc_id);
macstats->has_total_pdu_dl = 1;
macstats->total_pdu_ul = flexran_get_total_num_pdu_ul(mod_id, i, cc_id);
macstats->has_total_pdu_ul = 1;
macstats->total_tbs_dl = flexran_get_total_TBS_dl(mod_id, i, cc_id);
macstats->has_total_tbs_dl = 1;
macstats->total_tbs_ul = flexran_get_total_TBS_ul(mod_id, i, cc_id);
macstats->has_total_tbs_ul = 1;
macstats->harq_round = flexran_get_harq_round(mod_id, cc_id, i);
macstats->has_harq_round = 1;
Protocol__FlexMacSdusDl ** mac_sdus;
mac_sdus = malloc(sizeof(Protocol__FlexMacSdusDl) * flexran_get_num_mac_sdu_tx(mod_id, i, cc_id));
if (mac_sdus == NULL)
goto error;
macstats->n_mac_sdus_dl = flexran_get_num_mac_sdu_tx(mod_id, i, cc_id);
for (j = 0; j < macstats->n_mac_sdus_dl; j++){
mac_sdus[j] = malloc(sizeof(Protocol__FlexMacSdusDl));
protocol__flex_mac_sdus_dl__init(mac_sdus[j]);
mac_sdus[j]->lcid = flexran_get_mac_sdu_lcid_index(mod_id, i, cc_id, j);
mac_sdus[j]->has_lcid = 1;
mac_sdus[j]->sdu_length = flexran_get_mac_sdu_size(mod_id, i, cc_id, mac_sdus[j]->lcid);
mac_sdus[j]->has_sdu_length = 1;
}
macstats->mac_sdus_dl = mac_sdus;
ue_report[i]->mac_stats = macstats;
}
......
......@@ -269,3 +269,39 @@ message flex_pdcp_stats {
optional uint64 sfn=17;
}
//
// MAC Stats
//
message flex_mac_stats {
optional uint32 tbs_dl = 1;
optional uint32 tbs_ul = 2;
optional uint32 prb_retx_dl = 3;
optional uint32 prb_retx_ul = 4;
optional uint32 prb_dl = 5;
optional uint32 prb_ul = 6;
optional uint32 mcs1_dl = 7;
optional uint32 mcs2_dl = 8;
optional uint32 mcs1_ul = 9;
optional uint32 mcs2_ul = 10;
optional uint32 total_bytes_sdus_ul = 11;
optional uint32 total_bytes_sdus_dl = 12;
optional uint32 total_prb_retx_dl = 13;
optional uint32 total_prb_retx_ul = 14;
optional uint32 total_prb_dl = 15;
optional uint32 total_prb_ul = 16;
optional uint32 total_pdu_dl = 17;
optional uint32 total_pdu_ul = 18;
optional uint32 total_tbs_dl = 19;
optional uint32 total_tbs_ul = 20;
repeated flex_mac_sdus_dl mac_sdus_dl = 21;
optional uint32 harq_round = 22;
}
message flex_mac_sdus_dl {
optional uint32 sdu_length = 1;
optional uint32 lcid = 2;
}
......@@ -49,6 +49,7 @@ message flex_ue_stats_report {
optional flex_ul_cqi_report ul_cqi_report = 9;
optional flex_rrc_measurements rrc_measurements = 10;
optional flex_pdcp_stats pdcp_stats = 11;
optional flex_mac_stats mac_stats = 12;
}
//
......@@ -85,9 +86,11 @@ enum flex_ue_stats_type {
FLUST_DL_CQI = 16;
FLUST_PBS = 32;
FLUST_UL_CQI = 64;
FLUST_MAC_STATS = 128;
FLUST_PDCP_STATS = 1024;
FLUST_RRC_MEASUREMENTS = 65536;
// To be extended with more types of stats
}
......@@ -132,7 +132,7 @@ int8_t flexran_get_ue_phr(mid_t mod_id, mid_t ue_id)
uint8_t flexran_get_ue_wcqi(mid_t mod_id, mid_t ue_id)
{
if (!phy_is_present(mod_id, 0)) return 0;
return RC.eNB[mod_id][0]->UE_stats[ue_id].DL_cqi[0];
return RC.mac[mod_id]->UE_list.UE_sched_ctrl[ue_id].dl_cqi[0];
}
rlc_buffer_occupancy_t flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id)
......@@ -188,12 +188,145 @@ int32_t flexran_get_TA(mid_t mod_id, mid_t ue_id, uint8_t cc_id)
}
}
uint32_t flexran_get_total_size_dl_mac_sdus(mid_t mod_id, mid_t ue_id, int cc_id)
{
if (!mac_is_present(mod_id)) return 0;
return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].total_sdu_bytes;
}
uint32_t flexran_get_total_size_ul_mac_sdus(mid_t mod_id, mid_t ue_id, int cc_id)
{
if (!mac_is_present(mod_id)) return 0;
return RC.mac[mod_id]->eNB_stats[cc_id].total_ulsch_bytes_rx;
}
uint32_t flexran_get_TBS_dl(mid_t mod_id, mid_t ue_id, int cc_id)
{
if (!mac_is_present(mod_id)) return 0;
return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].TBS;
}
uint32_t flexran_get_TBS_ul(mid_t mod_id, mid_t ue_id, int cc_id)
{
if (!mac_is_present(mod_id)) return 0;
return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].ulsch_TBS;
}
uint16_t flexran_get_num_prb_retx_dl_per_ue(mid_t mod_id, mid_t ue_id, int cc_id)
{
if (!mac_is_present(mod_id)) return 0;
return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].rbs_used_retx;
}
uint32_t flexran_get_num_prb_retx_ul_per_ue(mid_t mod_id, mid_t ue_id, int cc_id)
{
if (!mac_is_present(mod_id)) return 0;
return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].rbs_used_retx_rx;
}
uint16_t flexran_get_num_prb_dl_tx_per_ue(mid_t mod_id, mid_t ue_id, int cc_id)
{
if (!mac_is_present(mod_id)) return 0;
return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].rbs_used;
}
uint16_t flexran_get_num_prb_ul_rx_per_ue(mid_t mod_id, mid_t ue_id, int cc_id)
{
if (!mac_is_present(mod_id)) return 0;
return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].rbs_used_rx;
}
uint8_t flexran_get_ue_wpmi(mid_t mod_id, mid_t ue_id, uint8_t cc_id)
{
if (!mac_is_present(mod_id)) return 0;
return RC.mac[mod_id]->UE_list.UE_sched_ctrl[ue_id].periodic_wideband_pmi[cc_id];
}
uint8_t flexran_get_mcs1_dl(mid_t mod_id, mid_t ue_id, int cc_id)
{
if (!mac_is_present(mod_id)) return 0;
return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].dlsch_mcs1;
}
uint8_t flexran_get_mcs2_dl(mid_t mod_id, mid_t ue_id, int cc_id)
{
if (!mac_is_present(mod_id)) return 0;
return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].dlsch_mcs2;
}
uint8_t flexran_get_mcs1_ul(mid_t mod_id, mid_t ue_id, int cc_id)
{
if (!mac_is_present(mod_id)) return 0;
return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].ulsch_mcs1;
}
uint8_t flexran_get_mcs2_ul(mid_t mod_id, mid_t ue_id, int cc_id)
{
if (!mac_is_present(mod_id)) return 0;
return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].ulsch_mcs2;
}
uint32_t flexran_get_total_prb_dl_tx_per_ue(mid_t mod_id, mid_t ue_id, int cc_id)
{
if (!mac_is_present(mod_id)) return 0;
return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].total_rbs_used;
}
uint32_t flexran_get_total_prb_ul_rx_per_ue(mid_t mod_id, mid_t ue_id, int cc_id)
{
if (!mac_is_present(mod_id)) return 0;
return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].total_rbs_used_rx;
}
uint32_t flexran_get_total_num_pdu_dl(mid_t mod_id, mid_t ue_id, int cc_id)
{
if (!mac_is_present(mod_id)) return 0;
return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].total_num_pdus;
}
uint32_t flexran_get_total_num_pdu_ul(mid_t mod_id, mid_t ue_id, int cc_id)
{
if (!mac_is_present(mod_id)) return 0;
return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].total_num_pdus_rx;
}
uint64_t flexran_get_total_TBS_dl(mid_t mod_id, mid_t ue_id, int cc_id)
{
if (!mac_is_present(mod_id)) return 0;
return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].total_pdu_bytes;
}
uint64_t flexran_get_total_TBS_ul(mid_t mod_id, mid_t ue_id, int cc_id)
{
if (!mac_is_present(mod_id)) return 0;
return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].total_ulsch_TBS;
}
int flexran_get_harq_round(mid_t mod_id, uint8_t cc_id, mid_t ue_id)
{
if (!mac_is_present(mod_id)) return 0;
return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].harq_round;
}
uint32_t flexran_get_num_mac_sdu_tx(mid_t mod_id, mid_t ue_id, int cc_id)
{
if (!mac_is_present(mod_id)) return 0;
return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].num_mac_sdu_tx;
}
unsigned char flexran_get_mac_sdu_lcid_index(mid_t mod_id, mid_t ue_id, int cc_id, int index)
{
if (!mac_is_present(mod_id)) return 0;
return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].lcid_sdu[index];
}
uint32_t flexran_get_mac_sdu_size(mid_t mod_id, mid_t ue_id, int cc_id, int lcid)
{
if (!mac_is_present(mod_id)) return 0;
return RC.mac[mod_id]->UE_list.eNB_UE_stats[cc_id][ue_id].sdu_length_tx[lcid];
}
/* TODO needs to be revised */
void flexran_update_TA(mid_t mod_id, mid_t ue_id, uint8_t cc_id)
{
......
......@@ -107,6 +107,81 @@ void flexran_update_TA(mid_t mod_id, mid_t ue_id, uint8_t cc_id); */
/* this function is broken */
int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id, uint8_t cc_id);
/*Get number of mac SDU DL*/
uint32_t flexran_get_num_mac_sdu_tx(mid_t mod_id, mid_t ue_id, int cc_id);
/*Return the MAC sdu size got from logical channel lcid */
uint32_t flexran_get_mac_sdu_size(mid_t mod_id, mid_t ue_id, int cc_id, int lcid);
/*Return number of MAC SDUs obtained in MAC layer*/
uint32_t flexran_get_num_mac_sdu_tx(mid_t mod_id, mid_t ue_id, int cc_id);
/*Get mac sdu lcid index*/
unsigned char flexran_get_mac_sdu_lcid_index(mid_t mod_id, mid_t ue_id, int cc_id, int index);
/*Get MAC size sdus length dl*/
uint32_t flexran_get_size_dl_mac_sdus(mid_t mod_id, int cc_id);
/*Get MAC size sdus length ul */
uint32_t flexran_get_size_ul_mac_sdus(mid_t mod_id, int cc_id);
/*Get total size DL MAC SDUS*/
uint32_t flexran_get_total_size_dl_mac_sdus(mid_t mod_id, mid_t ue_id, int cc_id);
/*Get total size of UL mac SDUS*/
uint32_t flexran_get_total_size_ul_mac_sdus(mid_t mod_id, mid_t ue_id, int cc_id);
/*Get total number of PDU DL*/
uint32_t flexran_get_total_num_pdu_dl(mid_t mod_id, mid_t ue_id, int cc_id);
/*Get total number of PDU UL*/
uint32_t flexran_get_total_num_pdu_ul(mid_t mod_id, mid_t ue_id, int cc_id);
/*Get total PRB dl TODO Should be changed*/
uint32_t flexran_get_total_prb_dl_tx_per_ue(mid_t mod_id, mid_t ue_id, int cc_id);
/*Get total PRB ul TODO Should be changed*/
uint32_t flexran_get_total_prb_ul_rx_per_ue(mid_t mod_id, mid_t ue_id, int cc_id);
/*Get number of prb for tx per UE DL*/
uint16_t flexran_get_num_prb_dl_tx_per_ue(mid_t mod_id, mid_t ue_id, int cc_id);
/*Get number of prb for rx per UE UL*/
uint16_t flexran_get_num_prb_ul_rx_per_ue(mid_t mod_id, mid_t ue_id, int cc_id);
/*Get number of prb for retx per UE UL*/
uint32_t flexran_get_num_prb_retx_ul_per_ue(mid_t mod_id, mid_t ue_id, int cc_id);
/*Get number of prb for retx per UE*/
uint16_t flexran_get_num_prb_retx_dl_per_ue(mid_t mod_id, mid_t ue_id, int cc_id);
/*MCS before rate adaptation DL*/
uint8_t flexran_get_mcs1_dl(mid_t mod_id, mid_t ue_id, int cc_id);
/*MCS after rate adaptation DL*/
uint8_t flexran_get_mcs2_dl(mid_t mod_id, mid_t ue_id, int cc_id);
/*MCS before rate adaptation UL*/
uint8_t flexran_get_mcs1_ul(mid_t mod_id, mid_t ue_id, int cc_id);
/*MCS after rate adaptation UL*/
uint8_t flexran_get_mcs2_ul(mid_t mod_id, mid_t ue_id, int cc_id);
/*Get downlink TBS*/
uint32_t flexran_get_TBS_dl(mid_t mod_id, mid_t ue_id, int cc_id);
/*Get uplink TBS */
uint32_t flexran_get_TBS_ul(mid_t mod_id, mid_t ue_id, int cc_id);
/*Get total TBS DL*/
uint64_t flexran_get_total_TBS_dl(mid_t mod_id, mid_t ue_id, int cc_id);
/*Get total TBS DL*/
uint64_t flexran_get_total_TBS_ul(mid_t mod_id, mid_t ue_id, int cc_id);
/* Get the current HARQ round for UE ue_id */
int flexran_get_harq_round(mid_t mod_id, uint8_t cc_id, mid_t ue_id);
/* Get the number of active component carriers for a specific UE */
int flexran_get_active_CC(mid_t mod_id, mid_t ue_id);
......
......@@ -562,6 +562,13 @@ typedef struct {
uint32_t num_retransmission;
/// instantaneous tx throughput for each TTI
// uint32_t tti_throughput[NB_RB_MAX];
// Number of received MAC SDU
uint32_t num_mac_sdu_tx;
// LCID related to SDU
unsigned char lcid_sdu[NB_RB_MAX];
// Length of SDU Got from LC DL
uint32_t sdu_length_tx[NB_RB_MAX];
/// overall
//
......@@ -608,6 +615,8 @@ typedef struct {
/// uplink transport block size
uint32_t ulsch_TBS;
uint32_t total_ulsch_TBS;
/// total rb used for a new uplink transmission
uint32_t num_retransmission_rx;
/// total rb used for a new uplink transmission
......@@ -648,6 +657,10 @@ typedef struct {
uint32_t total_num_pdus_rx;
/// num of error pdus
uint32_t total_num_errors_rx;
// Number of error PDUS
uint32_t num_mac_sdu_rx;
// Length of SDU Got from LC UL - Size array can be refined
uint32_t sdu_length_rx[NB_RB_MAX];
} eNB_UE_STATS;
/*! \brief eNB template for UE context information */
......
......@@ -1036,6 +1036,8 @@ schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP,
module_idP, CC_id, sdu_lengths[0]);
sdu_length_total = sdu_lengths[0];
sdu_lcids[0] = DCCH;
UE_list->eNB_UE_stats[CC_id][UE_id].lcid_sdu[0] = DCCH;
UE_list->eNB_UE_stats[CC_id][UE_id].sdu_length_tx[DCCH] = sdu_lengths[0];
UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[DCCH] += 1;
UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[DCCH] += sdu_lengths[0];
num_sdus = 1;
......@@ -1079,6 +1081,8 @@ schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP,
sdu_lcids[num_sdus] = DCCH1;
sdu_length_total += sdu_lengths[num_sdus];
header_len_dcch += 2;
UE_list->eNB_UE_stats[CC_id][UE_id].lcid_sdu[num_sdus] = DCCH1;
UE_list->eNB_UE_stats[CC_id][UE_id].sdu_length_tx[DCCH1] = sdu_lengths[num_sdus];
UE_list->eNB_UE_stats[CC_id][UE_id].
num_pdu_tx[DCCH1] += 1;
UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[DCCH1] += sdu_lengths[num_sdus];
......@@ -1153,6 +1157,8 @@ schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP,
UE_list->
eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid]
+= 1;
UE_list->eNB_UE_stats[CC_id][UE_id].lcid_sdu[num_sdus] = lcid;
UE_list->eNB_UE_stats[CC_id][UE_id].sdu_length_tx[lcid] = sdu_lengths[num_sdus];
UE_list->
eNB_UE_stats[CC_id][UE_id].num_bytes_tx
[lcid] += sdu_lengths[num_sdus];
......@@ -1355,6 +1361,7 @@ schedule_ue_spec(module_id_t module_idP,slice_id_t slice_idP,
eNB->eNB_stats[CC_id].dlsch_pdus_tx += 1;
UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb;
UE_list->eNB_UE_stats[CC_id][UE_id].num_mac_sdu_tx = num_sdus;
UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb;
UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1 = eNB_UE_stats->dlsch_mcs1;
UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2 = mcs;
......
......@@ -1315,6 +1315,7 @@ schedule_ulsch_rnti(module_id_t module_idP,
rb_table[rb_table_index]);
UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_rx += rb_table[rb_table_index];
UE_list->eNB_UE_stats[CC_id][UE_id].ulsch_TBS = UE_template->TBS_UL[harq_pid];
UE_list->eNB_UE_stats[CC_id][UE_id].total_ulsch_TBS += UE_template->TBS_UL[harq_pid];
// buffer_occupancy -= TBS;
T(T_ENB_MAC_UE_UL_SCHEDULE, T_INT(module_idP),
......
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