Commit 2a2769c0 authored by jperaldi's avatar jperaldi

Need to cleanup VT port management: no need to wait for ACK message from Client now

parent 5d6c4fa3
...@@ -63,7 +63,6 @@ typedef struct SSConfigContext_s { ...@@ -63,7 +63,6 @@ typedef struct SSConfigContext_s {
uint16_t sfn; uint16_t sfn;
uint8_t sf; uint8_t sf;
bool vtp_enabled;
ss_set_timinfo_t vtinfo; ss_set_timinfo_t vtinfo;
hash_table_t *vt_timer_table ; // key is SFN_SF hash_table_t *vt_timer_table ; // key is SFN_SF
......
...@@ -262,7 +262,8 @@ static inline void ss_enable_vtp() ...@@ -262,7 +262,8 @@ static inline void ss_enable_vtp()
}*/ }*/
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
static inline void ss_eNB_read_from_vtp_socket(acpCtx_t ctx) static bool isConnected = false;
static inline void ss_eNB_read_from_vtp_socket(acpCtx_t ctx, bool vtInit)
{ {
struct VirtualTimeInfo_Type *virtualTime = NULL; struct VirtualTimeInfo_Type *virtualTime = NULL;
const size_t size = 16 * 1024; const size_t size = 16 * 1024;
...@@ -294,23 +295,21 @@ static inline void ss_eNB_read_from_vtp_socket(acpCtx_t ctx) ...@@ -294,23 +295,21 @@ static inline void ss_eNB_read_from_vtp_socket(acpCtx_t ctx)
} }
else if (userId == -ACP_PEER_DISCONNECTED){ else if (userId == -ACP_PEER_DISCONNECTED){
LOG_A(GNB_APP, "[SS_SRB] Peer ordered shutdown\n"); LOG_A(GNB_APP, "[SS_SRB] Peer ordered shutdown\n");
isConnected = false;
} }
else if (userId == -ACP_PEER_CONNECTED){ else if (userId == -ACP_PEER_CONNECTED){
LOG_A(GNB_APP, "[SS_SRB] Peer connection established\n"); LOG_A(GNB_APP, "[SS_SRB] Peer connection established\n");
isConnected = true;
} }
// else
// {
// LOG_A(ENB_APP, "[SS-VTP] Invalid userId: %d \n", userId);
// break;
// }
} }
if (userId == 0) if (isConnected == false || vtInit == true)
{ {
// No message (timeout on socket) // No message (timeout on socket)
break; break;
} }
else if (userId == MSG_SysVTEnquireTimingAck_userId)
if (userId == MSG_SysVTEnquireTimingAck_userId)
{ {
LOG_A(ENB_APP, "[SS-VTP] Received VTEnquireTimingAck Request\n"); LOG_A(ENB_APP, "[SS-VTP] Received VTEnquireTimingAck Request\n");
...@@ -367,6 +366,7 @@ void *ss_eNB_vtp_process_itti_msg(void *notUsed) ...@@ -367,6 +366,7 @@ void *ss_eNB_vtp_process_itti_msg(void *notUsed)
{ {
MessageDef *received_msg = NULL; MessageDef *received_msg = NULL;
int result; int result;
itti_receive_msg(TASK_VTP, &received_msg); itti_receive_msg(TASK_VTP, &received_msg);
/* Check if there is a packet to handle */ /* Check if there is a packet to handle */
...@@ -381,7 +381,7 @@ void *ss_eNB_vtp_process_itti_msg(void *notUsed) ...@@ -381,7 +381,7 @@ void *ss_eNB_vtp_process_itti_msg(void *notUsed)
tinfo.sfn = SS_UPD_TIM_INFO(received_msg).sfn; tinfo.sfn = SS_UPD_TIM_INFO(received_msg).sfn;
LOG_A(ENB_APP, "[VTP] received VTP_UPD_TIM_INFO SFN: %d SF: %d\n", tinfo.sfn, tinfo.sf); LOG_A(ENB_APP, "[VTP] received VTP_UPD_TIM_INFO SFN: %d SF: %d\n", tinfo.sfn, tinfo.sf);
LOG_A(ENB_APP,"[VTP] received VTP_UPD_TIM_INFO SFN: %d SF: %d\n", tinfo.sfn, tinfo.sf); LOG_A(ENB_APP,"[VTP] received VTP_UPD_TIM_INFO SFN: %d SF: %d\n", tinfo.sfn, tinfo.sf);
if (SS_context.vtp_enabled == 1) if (isConnected == true)
ss_vtp_send_tinfo(TASK_VTP, &tinfo); ss_vtp_send_tinfo(TASK_VTP, &tinfo);
} }
break; break;
...@@ -409,8 +409,8 @@ void *ss_eNB_vtp_process_itti_msg(void *notUsed) ...@@ -409,8 +409,8 @@ void *ss_eNB_vtp_process_itti_msg(void *notUsed)
AssertFatal(result == EXIT_SUCCESS, "[SYS] Failed to free memory (%d)!\n", result); AssertFatal(result == EXIT_SUCCESS, "[SYS] Failed to free memory (%d)!\n", result);
received_msg = NULL; received_msg = NULL;
} }
ss_eNB_read_from_vtp_socket(ctx_vtp_g, false);
ss_eNB_read_from_vtp_socket(ctx_vtp_g);
return NULL; return NULL;
} }
...@@ -467,13 +467,12 @@ static void ss_eNB_wait_first_msg(void) ...@@ -467,13 +467,12 @@ static void ss_eNB_wait_first_msg(void)
size_t msg_sz = size; size_t msg_sz = size;
while (1) while (1)
{ {
int ret = acpRecvMsg(ctx_vtp_g, &msg_sz, buffer); ss_eNB_read_from_vtp_socket(ctx_vtp_g, true);
if (ret == MSG_SysVTEnquireTimingAck_userId) if (isConnected == true){
{ LOG_A(ENB_APP, "[SS_VTP] VT-HANDSHAKE with Client Completed (on-start) \n");
LOG_A(ENB_APP, "[SS_VTP] First VT-ACK From Client Received (on-start) \n");
break; break;
} }
LOG_A(ENB_APP, "[SS_VTP] Waiting for First VT-ACK From Client(on-start) \n"); LOG_A(ENB_APP, "[SS_VTP] Waiting for VT-HANDSHAKE with Client(on-start) \n");
} }
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -489,7 +488,6 @@ void* ss_eNB_vtp_task(void *arg) { ...@@ -489,7 +488,6 @@ void* ss_eNB_vtp_task(void *arg) {
ss_eNB_wait_first_msg(); ss_eNB_wait_first_msg();
SS_context.vtp_enabled = 1;
RC.ss.vtp_ready = 1; RC.ss.vtp_ready = 1;
ss_enable_vtp(); ss_enable_vtp();
sleep(1); sleep(1);
......
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