Merge remote-tracking branch 'origin/NR_UE_trigger_reestablishment' into integration_2024_w46 (!2777)

NR UE trigger for re-establishment

The implementation in this MR triggers RRC re-establishment at the UE in case
of radio link failure either for out of sync messages from lower layers or in
case maximum number of RLC retransmissions is reached.
This commit is contained in:
Jaroslava Fiedlerova
2024-11-18 10:12:25 +01:00
20 changed files with 283 additions and 104 deletions
+13 -7
View File
@@ -67,6 +67,12 @@ static telnetsrv_params_t telnetparams;
#define TELNETSRV_OPTNAME_STATICMOD "staticmod"
#define TELNETSRV_OPTNAME_SHRMOD "shrmod"
#define TELNET_LOG(fmt, ...) \
do { \
printf("[TELNETSRV] " fmt __VA_OPT__(, ) __VA_ARGS__); \
fflush(stdout); \
} while (0)
// clang-format off
paramdef_t telnetoptions[] = {
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
@@ -653,10 +659,10 @@ void run_telnetsrv(void) {
using_history();
int plen=sprintf(prompt,"%s_%s> ",TELNET_PROMPT_PREFIX,get_softmodem_function(NULL));
printf("\nInitializing telnet server...\n");
TELNET_LOG("\nInitializing telnet server...\n");
while( (telnetparams.new_socket = accept(sock, &cli_addr, &cli_len)) ) {
printf("[TELNETSRV] Telnet client connected....\n");
TELNET_LOG("Telnet client connected....\n");
read_history(telnetparams.histfile);
stifle_history(telnetparams.histsize);
@@ -682,12 +688,12 @@ void run_telnetsrv(void) {
}
if(!readc) {
printf ("[TELNETSRV] Telnet Client disconnected.\n");
TELNET_LOG("Telnet Client disconnected.\n");
break;
}
if (telnetparams.telnetdbg > 0)
printf("[TELNETSRV] Command received: readc %i filled %i \"%s\"\n", readc, filled,buf);
TELNET_LOG("Command received: readc %i filled %i \"%s\"\n", readc, filled, buf);
if (buf[0] == '!') {
if (buf[1] == '!') {
@@ -720,7 +726,7 @@ void run_telnetsrv(void) {
send(telnetparams.new_socket, prompt, strlen(prompt), MSG_NOSIGNAL);
} else {
printf ("[TELNETSRV] Closing telnet connection...\n");
TELNET_LOG("Closing telnet connection...\n");
break;
}
}
@@ -728,7 +734,7 @@ void run_telnetsrv(void) {
write_history(telnetparams.histfile);
clear_history();
close(telnetparams.new_socket);
printf ("[TELNETSRV] Telnet server waitting for connection...\n");
TELNET_LOG("Telnet server waiting for connection...\n");
}
close(sock);
@@ -927,7 +933,7 @@ int add_telnetcmd(char *modulename, telnetshell_vardef_t *var, telnetshell_cmdde
cmd[j].qptr = afifo;
}
}
printf("[TELNETSRV] Telnet server: module %i = %s added to shell\n", i, telnetparams.CmdParsers[i].module);
TELNET_LOG("Telnet server: module %i = %s added to shell\n", i, telnetparams.CmdParsers[i].module);
break;
}
}
+31 -4
View File
@@ -37,6 +37,7 @@
#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include "openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h"
#include "openair2/LAYER2/nr_rlc/nr_rlc_entity_am.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#define TELNETSERVERCODE
#include "telnetsrv.h"
@@ -115,10 +116,8 @@ int get_reestab_count(char *buf, int debug, telnet_printfunc_t prnt)
return 0;
}
int trigger_reestab(char *buf, int debug, telnet_printfunc_t prnt)
int fetch_rnti(char *buf, telnet_printfunc_t prnt)
{
if (!RC.nrmac)
ERROR_MSG_RET("no MAC/RLC present, cannot trigger reestablishment\n");
int rnti = -1;
if (!buf) {
rnti = get_single_ue_rnti_mac();
@@ -129,9 +128,15 @@ int trigger_reestab(char *buf, int debug, telnet_printfunc_t prnt)
if (rnti < 1 || rnti >= 0xfffe)
ERROR_MSG_RET("RNTI needs to be [1,0xfffe]\n");
}
return rnti;
}
int trigger_reestab(char *buf, int debug, telnet_printfunc_t prnt)
{
if (!RC.nrmac)
ERROR_MSG_RET("no MAC/RLC present, cannot trigger reestablishment\n");
int rnti = fetch_rnti(buf, prnt);
nr_rlc_test_trigger_reestablishment(rnti);
prnt("Reset RLC counters of UE RNTI %04x to trigger reestablishment\n", rnti);
return 0;
}
@@ -163,7 +168,27 @@ int rrc_gNB_trigger_f1_ho(char *buf, int debug, telnet_printfunc_t prnt)
gNB_RRC_UE_t *UE = &ue->ue_context;
nr_HO_F1_trigger_telnet(RC.nrrrc[0], UE->rrc_ue_id);
prnt("RRC F1 handover triggered for UE %u\n", UE->rrc_ue_id);
return 0;
}
int force_ul_failure(char *buf, int debug, telnet_printfunc_t prnt)
{
if (!RC.nrmac)
ERROR_MSG_RET("no MAC/RLC present, force_ul_failure failed\n");
int rnti = fetch_rnti(buf, prnt);
NR_UE_info_t *UE = find_nr_UE(&RC.nrmac[0]->UE_info, rnti);
nr_mac_trigger_ul_failure(&UE->UE_sched_ctrl, UE->current_UL_BWP.scs);
return 0;
}
int force_ue_release(char *buf, int debug, telnet_printfunc_t prnt)
{
force_ul_failure(buf, debug, prnt);
int rnti = fetch_rnti(buf, prnt);
NR_UE_info_t *UE = find_nr_UE(&RC.nrmac[0]->UE_info, rnti);
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
sched_ctrl->ul_failure_timer = 2;
nr_mac_check_ul_failure(RC.nrmac[0], UE->rnti, sched_ctrl);
return 0;
}
@@ -171,6 +196,8 @@ static telnetshell_cmddef_t cicmds[] = {
{"get_single_rnti", "", get_single_rnti},
{"force_reestab", "[rnti(hex,opt)]", trigger_reestab},
{"get_reestab_count", "[rnti(hex,opt)]", get_reestab_count},
{"force_ue_release", "[rnti(hex,opt)]", force_ue_release},
{"force_ul_failure", "[rnti(hex,opt)]", force_ul_failure},
{"trigger_f1_ho", "[rrc_ue_id(int,opt)]", rrc_gNB_trigger_f1_ho},
{"", "", NULL},
};
+23
View File
@@ -36,6 +36,7 @@
#include <stdarg.h>
#include "openair2/LAYER2/NR_MAC_UE/mac_defs.h"
#include "openair2/LAYER2/NR_MAC_UE/mac_proto.h"
#include "openair2/RRC/NR_UE/rrc_proto.h"
#define TELNETSERVERCODE
#include "telnetsrv.h"
@@ -73,9 +74,31 @@ int get_sync_state(char *buf, int debug, telnet_printfunc_t prnt)
return 0;
}
/**
* Force RLF on UE
*/
int force_rlf(char *buf, int debug, telnet_printfunc_t prnt)
{
NR_UE_RRC_INST_t *rrc = get_NR_UE_rrc_inst(0);
handle_rlf_detection(rrc);
return 0;
}
/**
* Send UE to RRC_IDLE
*/
int force_RRC_IDLE(char *buf, int debug, telnet_printfunc_t prnt)
{
NR_UE_RRC_INST_t *rrc = get_NR_UE_rrc_inst(0);
nr_rrc_going_to_IDLE(rrc, OTHER, NULL);
return 0;
}
/* Telnet shell command definitions */
static telnetshell_cmddef_t cicmds[] = {
{"sync_state", "[UE_ID(int,opt)]", get_sync_state},
{"force_rlf", "", force_rlf},
{"force_RRC_IDLE", "", force_RRC_IDLE},
{"", "", NULL},
};