Commit 3533b6d3 authored by Robert Schmidt's avatar Robert Schmidt

Make L2-sim UE's CQI configurable through telnet

parent 27f413ed
......@@ -44,6 +44,14 @@ nfapi_dl_config_request_t* dl_config_req = NULL;
nfapi_ul_config_request_t* ul_config_req = NULL;
nfapi_hi_dci0_request_t* hi_dci0_req = NULL;
int cqi[MAX_MOBILES_PER_ENB] = { [0 ... MAX_MOBILES_PER_ENB-1] = 15};
int get_ue_cqi(int mod_id) {
if (cqi[mod_id] >= 0 && cqi[mod_id] <= 15)
return cqi[mod_id];
else
return 6 + rand() % 10;
}
extern nfapi_tx_request_pdu_t* tx_request_pdu[1023][10][10];
//extern int timer_subframe;
//extern int timer_frame;
......@@ -254,7 +262,7 @@ void fill_ulsch_cqi_indication_UE_MAC(int Mod_id,
pdu->ul_cqi_information.channel = 1; // PUSCH
// eNB_scheduler_primitives.c:4839: the upper four bits seem to be the CQI
const int cqi = 15;
const int cqi = get_ue_cqi(Mod_id);
raw_pdu->pdu[0] = cqi << 4;
UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis++;
......
......@@ -74,8 +74,39 @@ int ue_enable_cmd(char *s, int debug, telnet_printfunc_t prnt)
UE_mac_inst[ue].UE_mode[0] = NOT_SYNCHED;
return 0;
}
extern int cqi[MAX_MOBILES_PER_ENB];
int ue_cqi_set(char *s, int debug, telnet_printfunc_t prnt) {
LOG_W(MAC, "%s(): input %s\n", __func__, s);
const char *sue = strtok(s, " ");
if (!sue) {
LOG_E(MAC, "error: could not strtok() UE part of input!\n");
return -1;
}
/* try to convert: if valid number, use it, else if it might be zero, check
* that string was zero, otherwise give -1 (any) */
const int ue = atoi(sue) ? atoi(sue) : (strcmp(s, "0") == 0 ? 0 : -1);
const char *scqi = strtok(NULL, " ");
if (!scqi) {
LOG_E(MAC, "error: could not strtok() CQI part of input!\n");
return -1;
}
const int c = atoi(scqi) ? atoi(scqi) : (strcmp(s, "0") == 0 ? 0 : -1);
if (ue >= 0)
cqi[ue] = c;
else
for (int i = 0; i < MAX_MOBILES_PER_ENB; ++i)
cqi[i] = c;
LOG_W(MAC,
"set ue %d (%s) to cqi %d (%s)\n",
ue,
ue < 0 ? "all UEs" : "single UE",
c,
c >= 0 && c <= 15 ? "fixed CQI" : "random CQI");
return 0;
}
telnetshell_cmddef_t ue_status_cmdarray[] = {
{"ue", "any number >=0", ue_enable_cmd},
{"cqi", "[UE] [CQI] -> UE=* for all, CQI=* for random", ue_cqi_set},
{"","",NULL},
};
telnetshell_vardef_t ue_status_vardef[] = {
......
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