Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhongxiao
OpenXG-RAN
Commits
d91dd9ad
Commit
d91dd9ad
authored
Oct 12, 2022
by
Danil Ruban
Committed by
jperaldi
Nov 22, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugz #123365 VT for NR
parent
7b617970
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
143 additions
and
144 deletions
+143
-144
executables/nr-softmodem.c
executables/nr-softmodem.c
+12
-4
openair2/COMMON/ss_messages_types.h
openair2/COMMON/ss_messages_types.h
+2
-0
openair3/SS/ss_eNB_sys_task.c
openair3/SS/ss_eNB_sys_task.c
+6
-1
openair3/SS/ss_eNB_vtp_task.c
openair3/SS/ss_eNB_vtp_task.c
+3
-3
openair3/SS/ss_gNB_context.h
openair3/SS/ss_gNB_context.h
+2
-0
openair3/SS/ss_gNB_vtp_task.c
openair3/SS/ss_gNB_vtp_task.c
+117
-135
openair3/SS/ss_gNB_vtp_task.h
openair3/SS/ss_gNB_vtp_task.h
+1
-1
No files found.
executables/nr-softmodem.c
View file @
d91dd9ad
...
...
@@ -83,6 +83,8 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "ss_gNB_sys_task.h"
#include "ss_gNB_port_man_task.h"
#include "ss_gNB_srb_task.h"
#include "ss_gNB_vtp_task.h"
pthread_cond_t
nfapi_sync_cond
;
pthread_mutex_t
nfapi_sync_mutex
;
...
...
@@ -370,10 +372,16 @@ int create_gNB_tasks(uint32_t gnb_nb) {
}
}
if
(
itti_create_task
(
TASK_SS_SRB
,
ss_gNB_srb_task
,
NULL
)
<
0
)
{
LOG_E
(
SCTP
,
"Create task for SS SRB failed
\n
"
);
return
-
1
;
}
if
(
itti_create_task
(
TASK_SS_SRB
,
ss_gNB_srb_task
,
NULL
)
<
0
)
{
LOG_E
(
SCTP
,
"Create task for SS SRB failed
\n
"
);
return
-
1
;
}
if
(
itti_create_task
(
TASK_SS_SRB
,
ss_gNB_vtp_task
,
NULL
)
<
0
)
{
LOG_E
(
SCTP
,
"Create task for SS SRB failed
\n
"
);
return
-
1
;
}
LOG_I
(
NR_RRC
,
"Creating NR RRC gNB Task
\n
"
);
if
(
itti_create_task
(
TASK_RRC_GNB
,
rrc_gnb_task
,
NULL
)
<
0
)
{
...
...
openair2/COMMON/ss_messages_types.h
View file @
d91dd9ad
...
...
@@ -95,6 +95,8 @@ typedef struct ss_set_timinfo_s {
uint8_t
sf
;
int
cell_index
;
int
physCellId
;
int8_t
mu
;
/**< -1 == 'UNBOUND' */
uint8_t
slot
;
}
ss_set_timinfo_t
;
typedef
ss_set_timinfo_t
ss_upd_timinfo_t
;
...
...
openair3/SS/ss_eNB_sys_task.c
View file @
d91dd9ad
...
...
@@ -61,10 +61,14 @@
extern
RAN_CONTEXT_t
RC
;
extern
uint32_t
from_earfcn
(
int
eutra_bandP
,
uint32_t
dl_earfcn
);
#ifndef NR_RRC_VERSION
extern
pthread_cond_t
cell_config_done_cond
;
extern
pthread_mutex_t
cell_config_done_mutex
;
extern
int
cell_config_done
;
//extern uint16_t ss_rnti_g;
#endif
static
void
sys_send_proxy
(
void
*
msg
,
int
msgLen
);
int
cell_config_done_indication
(
void
);
static
uint16_t
paging_ue_index_g
=
0
;
...
...
@@ -167,7 +171,7 @@ static void bitStrint_to_byteArray(unsigned char arr[], int bit_length, unsigned
*/
int
cell_config_done_indication
()
{
#ifndef NR_RRC_VERSION
if
(
cell_config_done
<
0
)
{
printf
(
"[SYS] Signal to OAI main code about cell config
\n
"
);
...
...
@@ -178,6 +182,7 @@ int cell_config_done_indication()
}
return
0
;
#endif
}
/*
...
...
openair3/SS/ss_eNB_vtp_task.c
View file @
d91dd9ad
...
...
@@ -427,14 +427,14 @@ int ss_eNB_vtp_init(void)
IpAddress_t
ipaddr
;
const
char
*
hostIp
;
hostIp
=
RC
.
ss
.
hostIp
;
hostIp
=
RC
.
ss
.
hostIp
?
RC
.
ss
.
hostIp
:
"127.0.0.1"
;
acpConvertIp
(
hostIp
,
&
ipaddr
);
// Port number
int
port
=
RC
.
ss
.
Vtpport
;
if
(
port
!=
778
0
)
if
(
port
==
0
)
{
return
-
1
;
port
=
7780
;
}
LOG_A
(
ENB_APP
,
"[SS-VTP] Initializing VTP Port %s:%d
\n
"
,
hostIp
,
port
);
// acpInit(malloc, free, 1000);
...
...
openair3/SS/ss_gNB_context.h
View file @
d91dd9ad
...
...
@@ -37,6 +37,8 @@ typedef struct SSConfigContext_s {
uint16_t
eutra_cellId
;
uint16_t
nr_cellId
;
uint16_t
ss_rnti_g
;
uint8_t
vtp_enabled
;
ss_set_timinfo_t
vtinfo
;
/** TODO: To add more */
}
SSConfigContext_t
;
...
...
openair3/SS/ss_gNB_vtp_task.c
View file @
d91dd9ad
...
...
@@ -23,10 +23,10 @@
#include "common/ran_context.h"
#include "acpSys.h"
#include "ss_
e
NB_vtp_task.h"
#include "ss_
e
NB_context.h"
#include "ss_
g
NB_vtp_task.h"
#include "ss_
g
NB_context.h"
#include "ss_
e
NB_proxy_iface.h"
#include "ss_
g
NB_proxy_iface.h"
#include "SIDL_VIRTUAL_TIME_PORT.h"
#include "acpSysVT.h"
#define MSC_INTERFACE
...
...
@@ -63,7 +63,7 @@ static int vtp_send_init_udp(const vtp_udpSockReq_t *req)
UDP_INIT
(
message_p
).
port
=
req
->
port
;
//addr.s_addr = req->ss_ip_addr;
UDP_INIT
(
message_p
).
address
=
req
->
address
;
//inet_ntoa(addr);
LOG_A
(
E
NB_APP
,
"Tx UDP_INIT IP addr %s (%x)
\n
"
,
UDP_INIT
(
message_p
).
address
,
UDP_INIT
(
message_p
).
port
);
LOG_A
(
G
NB_APP
,
"Tx UDP_INIT IP addr %s (%x)
\n
"
,
UDP_INIT
(
message_p
).
address
,
UDP_INIT
(
message_p
).
port
);
MSC_LOG_EVENT
(
MSC_GTPU_ENB
,
"0 UDP bind %s:%u"
,
...
...
@@ -90,6 +90,28 @@ void ss_vtp_send_tinfo(
size_t
msgSize
=
size
;
memset
(
&
virtualTime
,
0
,
sizeof
(
virtualTime
));
virtualTime
.
Enable
=
true
;
virtualTime
.
TimingInfo
.
Slot
.
d
=
tinfo
->
mu
>
0
?
SlotTimingInfo_Type_SlotOffset
:
SlotTimingInfo_Type_UNBOUND_VALUE
;
virtualTime
.
TimingInfo
.
Slot
.
v
.
SlotOffset
.
d
=
(
enum
SlotOffset_Type_Sel
)
(
tinfo
->
mu
+
1
);
switch
(
virtualTime
.
TimingInfo
.
Slot
.
v
.
SlotOffset
.
d
)
{
case
SlotOffset_Type_Numerology0
:
break
;
case
SlotOffset_Type_Numerology1
:
virtualTime
.
TimingInfo
.
Slot
.
v
.
SlotOffset
.
v
.
Numerology1
=
tinfo
->
slot
;
break
;
case
SlotOffset_Type_Numerology2
:
virtualTime
.
TimingInfo
.
Slot
.
v
.
SlotOffset
.
v
.
Numerology2
=
tinfo
->
slot
;
break
;
case
SlotOffset_Type_Numerology3
:
virtualTime
.
TimingInfo
.
Slot
.
v
.
SlotOffset
.
v
.
Numerology3
=
tinfo
->
slot
;
break
;
case
SlotOffset_Type_Numerology4
:
virtualTime
.
TimingInfo
.
Slot
.
v
.
SlotOffset
.
v
.
Numerology4
=
tinfo
->
slot
;
break
;;
default:
virtualTime
.
TimingInfo
.
Slot
.
d
=
SlotTimingInfo_Type_UNBOUND_VALUE
;
break
;;
}
virtualTime
.
TimingInfo
.
SFN
.
d
=
true
;
virtualTime
.
TimingInfo
.
SFN
.
v
.
Number
=
tinfo
->
sfn
;
...
...
@@ -117,16 +139,16 @@ void ss_vtp_send_tinfo(
status
=
acpSendMsg
(
ctx_vtp_g
,
msgSize
,
buffer
);
if
(
status
!=
0
)
{
LOG_E
(
E
NB_APP
,
"[SS-VTP] acpSendMsg failed. Error : %d on fd: %d the VTP at SS will be disabled
\n
"
,
LOG_E
(
G
NB_APP
,
"[SS-VTP] acpSendMsg failed. Error : %d on fd: %d the VTP at SS will be disabled
\n
"
,
status
,
acpGetSocketFd
(
ctx_vtp_g
));
acpFree
(
buffer
);
//SS_context.vtp_enabled = VTP_DISABLE
;
SS_context
.
vtp_enabled
=
0
;
return
;
}
else
{
LOG_A
(
E
NB_APP
,
"[SS-VTP] acpSendMsg VTP_Send Success SFN %d SF %d virtualTime.Enable %d
\n
"
,
tinfo
->
sfn
,
tinfo
->
sf
,
virtualTime
.
Enable
);
LOG_A
(
G
NB_APP
,
"[SS-VTP] acpSendMsg VTP_Send Success SFN %d SF %d virtualTime.Enable %d
\n
"
,
tinfo
->
sfn
,
tinfo
->
sf
,
virtualTime
.
Enable
);
SS_context
.
vtinfo
=
*
tinfo
;
}
// Free allocated buffer
...
...
@@ -150,7 +172,7 @@ static int vtp_send_udp_msg(
if
(
message_p
)
{
LOG_A
(
E
NB_APP
,
"Sending UDP_DATA_REQ length %u offset %u buffer %d %d %d
\n
"
,
buffer_len
,
buffer_offset
,
buffer
[
0
],
buffer
[
1
],
buffer
[
2
]);
LOG_A
(
G
NB_APP
,
"Sending UDP_DATA_REQ length %u offset %u buffer %d %d %d
\n
"
,
buffer_len
,
buffer_offset
,
buffer
[
0
],
buffer
[
1
],
buffer
[
2
]);
udp_data_req_p
=
&
message_p
->
ittiMsg
.
udp_data_req
;
udp_data_req_p
->
peer_address
=
peerIpAddr
;
udp_data_req_p
->
peer_port
=
peerPort
;
...
...
@@ -161,7 +183,7 @@ static int vtp_send_udp_msg(
}
else
{
LOG_A
(
E
NB_APP
,
"Failed Sending UDP_DATA_REQ length %u offset %u"
,
buffer_len
,
buffer_offset
);
LOG_A
(
G
NB_APP
,
"Failed Sending UDP_DATA_REQ length %u offset %u"
,
buffer_len
,
buffer_offset
);
return
-
1
;
}
}
...
...
@@ -172,97 +194,66 @@ static int vtp_send_udp_msg(
*/
static
void
vtp_send_proxy
(
void
*
msg
,
int
msgLen
)
{
LOG_A
(
E
NB_APP
,
"In sys_send_proxy
\n
"
);
LOG_A
(
G
NB_APP
,
"In sys_send_proxy
\n
"
);
uint32_t
peerIpAddr
;
uint16_t
peerPort
=
vtp_proxy_send_port
;
IPV4_STR_ADDR_TO_INT_NWBO
(
vtp_local_address
,
peerIpAddr
,
" BAD IP Address"
);
//int8_t *temp = msg;
// for(int i =0 ; i <msgLen;i++)
// {
// LOG_A(ENB_APP, "%x ", temp[i]);
// }
LOG_A
(
ENB_APP
,
"
\n
Cell Config End of Buffer
\n
"
);
LOG_A
(
GNB_APP
,
"
\n
Cell Config End of Buffer
\n
"
);
/** Send to proxy */
vtp_send_udp_msg
((
uint8_t
*
)
msg
,
msgLen
,
0
,
peerIpAddr
,
peerPort
);
return
;
}
static
inline
void
ss_send_vtp_resp
(
struct
VirtualTimeInfo_Type
*
virtualTime
)
{
//MessageDef *message_p = itti_alloc_new_message(TASK_VTP, SS_VTP_PROXY_ACK);
//assert(message_p);
VtpCmdReq_t
*
req
=
(
VtpCmdReq_t
*
)
malloc
(
sizeof
(
VtpCmdReq_t
));
LOG_A
(
ENB_APP
,
"itti_alloc %p
\n
"
,
req
);
req
->
header
.
preamble
=
0xFEEDC0DE
;
req
->
header
.
msg_id
=
SS_VTP_RESP
;
req
->
header
.
length
=
sizeof
(
proxy_ss_header_t
);
req
->
header
.
cell_id
=
SS_context
.
cellId
;
req
->
tinfo
.
sfn
=
virtualTime
->
TimingInfo
.
SFN
.
v
.
Number
;
req
->
tinfo
.
sf
=
virtualTime
->
TimingInfo
.
Subframe
.
v
.
Number
;
LOG_A
(
ENB_APP
,
"VTP_ACK Command to proxy sent for cell_id: %d SFN %d SF %d
\n
"
,
req
->
header
.
cell_id
,
req
->
tinfo
.
sfn
,
req
->
tinfo
.
sf
);
vtp_send_proxy
((
void
*
)
req
,
sizeof
(
VtpCmdReq_t
));
/*
SS_VTP_PROXY_ACK(message_p).tinfo.sfn = virtualTime->TimingInfo.SFN.v.Number;
SS_VTP_PROXY_ACK(message_p).tinfo.sf = virtualTime->TimingInfo.Subframe.v.Number;
int res = itti_send_msg_to_task(TASK_SYS, 0, message_p);
if (res < 0)
{
LOG_E(ENB_APP, "[SS-VTP] Error in itti_send_msg_to_task\n");
VtpCmdReq_t
*
req
=
(
VtpCmdReq_t
*
)
malloc
(
sizeof
(
VtpCmdReq_t
));
LOG_A
(
GNB_APP
,
"itti_alloc %p
\n
"
,
req
);
req
->
header
.
preamble
=
0xFEEDC0DE
;
req
->
header
.
msg_id
=
SS_VTP_RESP
;
req
->
header
.
length
=
sizeof
(
proxy_ss_header_t
);
req
->
header
.
cell_id
=
SS_context
.
cellId
;
req
->
tinfo
.
mu
=
-
1
;
if
(
virtualTime
->
TimingInfo
.
Slot
.
d
!=
SlotTimingInfo_Type_UNBOUND_VALUE
)
{
req
->
tinfo
.
mu
=
virtualTime
->
TimingInfo
.
Slot
.
d
-
1
;
switch
(
virtualTime
->
TimingInfo
.
Slot
.
v
.
SlotOffset
.
d
)
{
case
SlotOffset_Type_Numerology0
:
break
;
case
SlotOffset_Type_Numerology1
:
req
->
tinfo
.
slot
=
virtualTime
->
TimingInfo
.
Slot
.
v
.
SlotOffset
.
v
.
Numerology1
;
break
;
case
SlotOffset_Type_Numerology2
:
req
->
tinfo
.
slot
=
virtualTime
->
TimingInfo
.
Slot
.
v
.
SlotOffset
.
v
.
Numerology2
;
break
;
case
SlotOffset_Type_Numerology3
:
req
->
tinfo
.
slot
=
virtualTime
->
TimingInfo
.
Slot
.
v
.
SlotOffset
.
v
.
Numerology3
;
break
;
case
SlotOffset_Type_Numerology4
:
req
->
tinfo
.
slot
=
virtualTime
->
TimingInfo
.
Slot
.
v
.
SlotOffset
.
v
.
Numerology4
;
break
;
default:
req
->
tinfo
.
mu
=
-
1
;
break
;
}
}
else
{
LOG_A(ENB_APP, "[SS-VTP] Send ITTI message to %s\n", ITTI_MSG_DESTINATION_NAME(message_p));
}*/
}
static
inline
void
ss_enable_vtp
()
{
//MessageDef *message_p = itti_alloc_new_message(TASK_VTP, SS_VTP_PROXY_ACK);
//assert(message_p);
VtpCmdReq_t
*
req
=
(
VtpCmdReq_t
*
)
malloc
(
sizeof
(
VtpCmdReq_t
));
req
->
header
.
preamble
=
0xFEEDC0DE
;
req
->
header
.
msg_id
=
SS_VTP_ENABLE
;
req
->
header
.
length
=
sizeof
(
proxy_ss_header_t
);
req
->
header
.
cell_id
=
SS_context
.
cellId
;
/* Initialize with zero */
req
->
tinfo
.
sfn
=
0
;
req
->
tinfo
.
sf
=
0
;
LOG_A
(
ENB_APP
,
"VTP_ENABLE Command to proxy sent for cell_id: %d SFN %d SF %d
\n
"
,
req
->
header
.
cell_id
,
req
->
tinfo
.
sfn
,
req
->
tinfo
.
sf
);
req
->
tinfo
.
sfn
=
virtualTime
->
TimingInfo
.
SFN
.
v
.
Number
;
req
->
tinfo
.
sfn
=
virtualTime
->
TimingInfo
.
SFN
.
v
.
Number
;
req
->
tinfo
.
sf
=
virtualTime
->
TimingInfo
.
Subframe
.
v
.
Number
;
LOG_A
(
GNB_APP
,
"VTP_ACK Command to proxy sent for cell_id: %d SFN: %d SF: %d mu: %d slot: %d
\n
"
,
req
->
header
.
cell_id
,
req
->
tinfo
.
sfn
,
req
->
tinfo
.
sf
,
req
->
tinfo
.
mu
,
req
->
tinfo
.
slot
);
LOG_A
(
ENB_APP
,
"VTP_ENABLE Command to proxy sent for cell_id: %d
\n
"
,
req
->
header
.
cell_id
);
vtp_send_proxy
((
void
*
)
req
,
sizeof
(
VtpCmdReq_t
));
vtp_send_proxy
((
void
*
)
req
,
sizeof
(
VtpCmdReq_t
));
/*
SS_VTP_PROXY_ACK(message_p).tinfo.sfn = virtualTime->TimingInfo.SFN.v.Number;
SS_VTP_PROXY_ACK(message_p).tinfo.sf = virtualTime->TimingInfo.Subframe.v.Number;
int res = itti_send_msg_to_task(TASK_SYS, 0, message_p);
if (res < 0)
{
LOG_E(ENB_APP, "[SS-VTP] Error in itti_send_msg_to_task\n");
}
else
{
LOG_A(ENB_APP, "[SS-VTP] Send ITTI message to %s\n", ITTI_MSG_DESTINATION_NAME(message_p));
}*/
}
//------------------------------------------------------------------------------
static
inline
void
ss_e
NB_read_from_vtp_socket
(
acpCtx_t
ctx
)
static
inline
uint8_t
ss_g
NB_read_from_vtp_socket
(
acpCtx_t
ctx
)
{
struct
VirtualTimeInfo_Type
*
virtualTime
=
NULL
;
const
size_t
size
=
16
*
1024
;
...
...
@@ -275,7 +266,7 @@ static inline void ss_eNB_read_from_vtp_socket(acpCtx_t ctx)
while
(
1
)
{
int
userId
=
acpRecvMsg
(
ctx
,
&
msgSize
,
buffer
);
LOG_A
(
E
NB_APP
,
"[SS-VTP] Received msgSize=%d, userId=%d
\n
"
,
(
int
)
msgSize
,
userId
);
LOG_A
(
G
NB_APP
,
"[SS-VTP] Received msgSize=%d, userId=%d
\n
"
,
(
int
)
msgSize
,
userId
);
// Error handling
if
(
userId
<
0
)
...
...
@@ -294,15 +285,11 @@ static inline void ss_eNB_read_from_vtp_socket(acpCtx_t ctx)
}
else
if
(
userId
==
-
ACP_PEER_DISCONNECTED
){
LOG_A
(
GNB_APP
,
"[SS_SRB] Peer ordered shutdown
\n
"
);
return
1
;
}
else
if
(
userId
==
-
ACP_PEER_CONNECTED
){
LOG_A
(
GNB_APP
,
"[SS_SRB] Peer connection established
\n
"
);
}
// else
// {
// LOG_A(ENB_APP, "[SS-VTP] Invalid userId: %d \n", userId);
// break;
// }
}
if
(
userId
==
0
)
...
...
@@ -312,47 +299,39 @@ static inline void ss_eNB_read_from_vtp_socket(acpCtx_t ctx)
}
else
if
(
userId
==
MSG_SysVTEnquireTimingAck_userId
)
{
LOG_A
(
E
NB_APP
,
"[SS-VTP] Received VTEnquireTimingAck Request
\n
"
);
LOG_A
(
G
NB_APP
,
"[SS-VTP] Received VTEnquireTimingAck Request
\n
"
);
if
(
acpSysVTEnquireTimingAckDecSrv
(
ctx
,
buffer
,
msgSize
,
&
virtualTime
)
!=
0
)
{
LOG_E
(
E
NB_APP
,
"[SS-VTP] acpVngProcessDecSrv failed
\n
"
);
LOG_E
(
G
NB_APP
,
"[SS-VTP] acpVngProcessDecSrv failed
\n
"
);
break
;
}
LOG_A
(
E
NB_APP
,
"[SS-VTP] Received VTEnquireTimingAck Request SFN %d Subframe %d Waiting for ACK of SFN %d SF %d
\n
"
,
LOG_A
(
G
NB_APP
,
"[SS-VTP] Received VTEnquireTimingAck Request SFN %d Subframe %d Waiting for ACK of SFN %d SF %d
\n
"
,
virtualTime
->
TimingInfo
.
SFN
.
v
.
Number
,
virtualTime
->
TimingInfo
.
Subframe
.
v
.
Number
,
SS_context
.
vtinfo
.
sfn
,
SS_context
.
vtinfo
.
sf
);
// if (SS_context.State < SS_STATE_CELL_ACTIVE)
// {
// LOG_E(ENB_APP, "[SS-VTP] Request received in an invalid state: %d \n", SS_context.State);
// break;
// }
// if((SS_context.vtinfo.sfn == virtualTime->TimingInfo.SFN.v.Number) &&
// (SS_context.vtinfo.sf == virtualTime->TimingInfo.Subframe.v.Number))
{
if
(
virtualTime
->
Enable
)
{
ss_send_vtp_resp
(
virtualTime
);
if
(
virtualTime
->
TimingInfo
.
SFN
.
d
)
{
LOG_A
(
E
NB_APP
,
"[SS-VTP] SFN: %d
\n
"
,
LOG_A
(
G
NB_APP
,
"[SS-VTP] SFN: %d
\n
"
,
virtualTime
->
TimingInfo
.
SFN
.
v
.
Number
);
}
if
(
virtualTime
->
TimingInfo
.
HSFN
.
d
)
{
LOG_A
(
E
NB_APP
,
"[SS-VTP] HSFN: %d
\n
"
,
LOG_A
(
G
NB_APP
,
"[SS-VTP] HSFN: %d
\n
"
,
virtualTime
->
TimingInfo
.
HSFN
.
v
.
Number
);
}
if
(
virtualTime
->
TimingInfo
.
Subframe
.
d
)
{
LOG_A
(
E
NB_APP
,
"[SS-VTP]SubFrame: %d
\n
"
,
LOG_A
(
G
NB_APP
,
"[SS-VTP]SubFrame: %d
\n
"
,
virtualTime
->
TimingInfo
.
Subframe
.
v
.
Number
);
}
}
else
{
ss_send_vtp_resp
(
virtualTime
);
LOG_A
(
E
NB_APP
,
"[SS-VTP] disabled
\n
"
);
LOG_A
(
G
NB_APP
,
"[SS-VTP] disabled
\n
"
);
}
acpSysVTEnquireTimingAckFreeSrv
(
virtualTime
);
// TODo forward the message to sys_task ACK
...
...
@@ -361,9 +340,10 @@ static inline void ss_eNB_read_from_vtp_socket(acpCtx_t ctx)
}
}
acpFree
(
buffer
);
return
0
;
}
void
*
ss_gNB_vtp_process_itti_msg
(
void
*
notUse
d
)
uint8_t
ss_gNB_vtp_process_itti_msg
(
voi
d
)
{
MessageDef
*
received_msg
=
NULL
;
int
result
;
...
...
@@ -379,30 +359,31 @@ void *ss_gNB_vtp_process_itti_msg(void *notUsed)
ss_set_timinfo_t
tinfo
;
tinfo
.
sf
=
SS_UPD_TIM_INFO
(
received_msg
).
sf
;
tinfo
.
sfn
=
SS_UPD_TIM_INFO
(
received_msg
).
sfn
;
LOG_A
(
E
NB_APP
,
"[VTP] received VTP_UPD_TIM_INFO SFN: %d SF: %d
\n
"
,
tinfo
.
sfn
,
tinfo
.
sf
);
LOG_A
(
E
NB_APP
,
"[VTP] received VTP_UPD_TIM_INFO SFN: %d SF: %d
\n
"
,
tinfo
.
sfn
,
tinfo
.
sf
);
// if (SS_context.vtp_enabled == 1)
LOG_A
(
G
NB_APP
,
"[VTP] received VTP_UPD_TIM_INFO SFN: %d SF: %d
\n
"
,
tinfo
.
sfn
,
tinfo
.
sf
);
LOG_A
(
G
NB_APP
,
"[VTP] received VTP_UPD_TIM_INFO SFN: %d SF: %d
\n
"
,
tinfo
.
sfn
,
tinfo
.
sf
);
if
(
SS_context
.
vtp_enabled
==
1
)
{
ss_vtp_send_tinfo
(
TASK_VTP
,
&
tinfo
);
}
}
break
;
//
case SS_VTP_PROXY_UPD:
//
{
// LOG_A(E
NB_APP, "[SS-VTP] VTP_Update receieved from proxy %s cmd: %d SFN: %d SF: %d\n",
//
ITTI_MSG_ORIGIN_NAME(received_msg), SS_VTP_PROXY_UPD(received_msg).cmd,
//
SS_VTP_PROXY_UPD(received_msg).tinfo.sfn, SS_VTP_PROXY_UPD(received_msg).tinfo.sf);
//
//
/** Send response here */
//
ss_vtp_send_tinfo(TASK_VTP, &SS_VTP_PROXY_UPD(received_msg).tinfo);
//
}
//
break;
//
case
SS_VTP_PROXY_UPD
:
{
LOG_A
(
G
NB_APP
,
"[SS-VTP] VTP_Update receieved from proxy %s cmd: %d SFN: %d SF: %d
\n
"
,
ITTI_MSG_ORIGIN_NAME
(
received_msg
),
SS_VTP_PROXY_UPD
(
received_msg
).
cmd
,
SS_VTP_PROXY_UPD
(
received_msg
).
tinfo
.
sfn
,
SS_VTP_PROXY_UPD
(
received_msg
).
tinfo
.
sf
);
/** Send response here */
ss_vtp_send_tinfo
(
TASK_VTP
,
&
SS_VTP_PROXY_UPD
(
received_msg
).
tinfo
);
}
break
;
case
TERMINATE_MESSAGE
:
{
itti_exit_task
();
break
;
}
default:
LOG_E
(
E
NB_APP
,
"[SS-VTP] Received unhandled message %d:%s
\n
"
,
LOG_E
(
G
NB_APP
,
"[SS-VTP] Received unhandled message %d:%s
\n
"
,
ITTI_MSG_ID
(
received_msg
),
ITTI_MSG_NAME
(
received_msg
));
}
result
=
itti_free
(
ITTI_MSG_ORIGIN_ID
(
received_msg
),
received_msg
);
...
...
@@ -410,13 +391,12 @@ void *ss_gNB_vtp_process_itti_msg(void *notUsed)
received_msg
=
NULL
;
}
ss_eNB_read_from_vtp_socket
(
ctx_vtp_g
);
return
NULL
;
return
ss_gNB_read_from_vtp_socket
(
ctx_vtp_g
);
}
//------------------------------------------------------------------------------
int
ss_
e
NB_vtp_init
(
void
)
int
ss_
g
NB_vtp_init
(
void
)
{
IpAddress_t
ipaddr
;
...
...
@@ -427,7 +407,7 @@ int ss_eNB_vtp_init(void)
// Port number
int
port
=
RC
.
ss
.
Vtpport
?
RC
.
ss
.
Vtpport
:
7780
;
LOG_A
(
E
NB_APP
,
"[SS-VTP] Initializing VTP Port %s:%d
\n
"
,
hostIp
,
port
);
LOG_A
(
G
NB_APP
,
"[SS-VTP] Initializing VTP Port %s:%d
\n
"
,
hostIp
,
port
);
// acpInit(malloc, free, 1000);
const
struct
acpMsgTable
msgTable
[]
=
{
{
"SysVTEnquireTimingAck"
,
MSG_SysVTEnquireTimingAck_userId
},
...
...
@@ -444,19 +424,19 @@ int ss_eNB_vtp_init(void)
int
ret
=
acpServerInitWithCtx
(
ipaddr
,
port
,
msgTable
,
aSize
,
&
ctx_vtp_g
);
if
(
ret
<
0
)
{
LOG_E
(
E
NB_APP
,
"[SS-VTP] Connection failure err=%d
\n
"
,
ret
);
LOG_E
(
G
NB_APP
,
"[SS-VTP] Connection failure err=%d
\n
"
,
ret
);
return
-
1
;
}
#ifdef ACP_DEBUG_DUMP_MSGS
/** TODO: Need to verify */
adbgSetPrintLogFormat
(
ctx
,
true
);
#endif
int
fd1
=
acpGetSocketFd
(
ctx_vtp_g
);
LOG_A
(
E
NB_APP
,
"[SS-VTP] Connected: %d
\n
"
,
fd1
);
LOG_A
(
G
NB_APP
,
"[SS-VTP] Connected: %d
\n
"
,
fd1
);
itti_mark_task_ready
(
TASK_VTP
);
return
0
;
}
static
void
ss_
e
NB_wait_first_msg
(
void
)
static
void
ss_
g
NB_wait_first_msg
(
void
)
{
const
size_t
size
=
16
*
1024
;
unsigned
char
*
buffer
=
(
unsigned
char
*
)
acpMalloc
(
size
);
...
...
@@ -467,10 +447,10 @@ static void ss_eNB_wait_first_msg(void)
int
ret
=
acpRecvMsg
(
ctx_vtp_g
,
&
msg_sz
,
buffer
);
if
(
ret
==
MSG_SysVTEnquireTimingAck_userId
||
ret
==
-
ACP_PEER_CONNECTED
)
{
LOG_A
(
E
NB_APP
,
"[SS_VTP] First VT-ACK From Client Received (on-start)
\n
"
);
LOG_A
(
G
NB_APP
,
"[SS_VTP] First VT-ACK From Client Received (on-start)
\n
"
);
break
;
}
LOG_A
(
E
NB_APP
,
"[SS_VTP] Waiting for First VT-ACK From Client(on-start)
\n
"
);
LOG_A
(
G
NB_APP
,
"[SS_VTP] Waiting for First VT-ACK From Client(on-start)
\n
"
);
}
}
//------------------------------------------------------------------------------
...
...
@@ -480,22 +460,24 @@ void* ss_gNB_vtp_task(void *arg) {
req
.
port
=
vtp_proxy_recv_port
;
vtp_send_init_udp
(
&
req
);
sleep
(
5
);
int
retVal
=
ss_
e
NB_vtp_init
();
int
retVal
=
ss_
g
NB_vtp_init
();
if
(
retVal
!=
-
1
)
{
LOG_A
(
E
NB_APP
,
"[SS-VTP] Enabled VTP starting the itti_msg_handler
\n
"
);
LOG_A
(
G
NB_APP
,
"[SS-VTP] Enabled VTP starting the itti_msg_handler
\n
"
);
ss_
e
NB_wait_first_msg
();
ss_
g
NB_wait_first_msg
();
//
SS_context.vtp_enabled = 1;
SS_context
.
vtp_enabled
=
1
;
RC
.
ss
.
vtp_ready
=
1
;
ss_enable_vtp
();
sleep
(
1
);
while
(
1
)
{
(
void
)
ss_gNB_vtp_process_itti_msg
(
NULL
);
if
(
ss_gNB_vtp_process_itti_msg
())
{
break
;
}
}
}
else
{
LOG_A
(
E
NB_APP
,
"[SS-VTP] VTP port disabled at eNB
\n
"
);
LOG_A
(
G
NB_APP
,
"[SS-VTP] VTP port disabled at eNB
\n
"
);
sleep
(
10
);
}
...
...
openair3/SS/ss_gNB_vtp_task.h
View file @
d91dd9ad
...
...
@@ -25,7 +25,7 @@
#ifndef SS_GNB_VTP_TASK_H_
#define SS_GNB_VTP_TASK_H_
void
*
ss_gNB_vtp_process_itti_msg
(
void
*
);
uint8_t
ss_gNB_vtp_process_itti_msg
(
void
);
void
*
ss_gNB_vtp_task
(
void
*
arg
);
typedef
enum
VtpProxyCmd
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment