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
8a7aac41
Commit
8a7aac41
authored
Nov 18, 2022
by
Swetank Srivastava
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
indentation fixes
parent
54cae243
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1089 additions
and
1089 deletions
+1089
-1089
executables/nr-softmodem.c
executables/nr-softmodem.c
+20
-20
openair2/GNB_APP/gnb_app.c
openair2/GNB_APP/gnb_app.c
+188
-188
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
+60
-60
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c
+116
-116
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
+21
-21
openair2/RRC/NR/MESSAGES/asn1_msg.c
openair2/RRC/NR/MESSAGES/asn1_msg.c
+84
-84
openair3/SS/ss_gNB_port_man_task.c
openair3/SS/ss_gNB_port_man_task.c
+104
-104
openair3/SS/ss_gNB_srb_task.c
openair3/SS/ss_gNB_srb_task.c
+43
-43
openair3/SS/ss_gNB_sys_task.c
openair3/SS/ss_gNB_sys_task.c
+363
-363
openair3/UDP/udp_eNB_task.c
openair3/UDP/udp_eNB_task.c
+90
-90
No files found.
executables/nr-softmodem.c
View file @
8a7aac41
...
...
@@ -302,7 +302,7 @@ int create_gNB_tasks(uint32_t gnb_nb) {
/*if (itti_create_task (TASK_GNB_APP, gNB_app_task, NULL) < 0) {
LOG_E(GNB_APP, "Create task for gNB APP failed\n");
return -1;
}*/
}*/
if
(
itti_create_task
(
TASK_SCTP
,
sctp_eNB_task
,
NULL
)
<
0
)
{
LOG_E
(
SCTP
,
"Create task for SCTP failed
\n
"
);
return
-
1
;
...
...
@@ -319,21 +319,21 @@ int create_gNB_tasks(uint32_t gnb_nb) {
if
(
AMF_MODE_ENABLED
)
{
char
*
gnb_ipv4_address_for_NGU
=
NULL
;
uint32_t
gnb_port_for_NGU
=
0
;
char
*
gnb_ipv4_address_for_S1U
=
NULL
;
uint32_t
gnb_port_for_S1U
=
0
;
char
*
gnb_ipv4_address_for_NGU
=
NULL
;
uint32_t
gnb_port_for_NGU
=
0
;
char
*
gnb_ipv4_address_for_S1U
=
NULL
;
uint32_t
gnb_port_for_S1U
=
0
;
paramdef_t
NETParams
[]
=
GNBNETPARAMS_DESC
;
char
aprefix
[
MAX_OPTNAME_SIZE
*
2
+
8
];
sprintf
(
aprefix
,
"%s.[%i].%s"
,
GNB_CONFIG_STRING_GNB_LIST
,
0
,
GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG
);
config_get
(
NETParams
,
sizeof
(
NETParams
)
/
sizeof
(
paramdef_t
),
aprefix
);
for
(
int
i
=
GNB_INTERFACE_NAME_FOR_NG_AMF_IDX
;
i
<=
GNB_IPV4_ADDRESS_FOR_NG_AMF_IDX
;
i
++
)
{
if
(
NETParams
[
i
].
strptr
==
NULL
)
{
LOG_E
(
NGAP
,
"No configuration in the file.
\n
"
);
NGAP_CONF_MODE
=
0
;
LOG_E
(
NGAP
,
"No configuration in the file.
\n
"
);
NGAP_CONF_MODE
=
0
;
}
else
{
LOG_D
(
NGAP
,
"Configuration in the file: %s.
\n
"
,
*
NETParams
[
i
].
strptr
);
LOG_D
(
NGAP
,
"Configuration in the file: %s.
\n
"
,
*
NETParams
[
i
].
strptr
);
}
}
...
...
@@ -351,7 +351,7 @@ int create_gNB_tasks(uint32_t gnb_nb) {
}
if
(
gnb_nb
>
0
)
{
RCconfig_nr_ssparam
();
RCconfig_nr_ssparam
();
if
(
itti_create_task
(
TASK_GNB_APP
,
gNB_app_task
,
NULL
)
<
0
)
{
LOG_E
(
GNB_APP
,
"Create task for gNB APP failed
\n
"
);
return
-
1
;
...
...
@@ -372,11 +372,11 @@ 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
;
}
LOG_I
(
NR_RRC
,
"Creating NR RRC gNB Task
\n
"
);
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
;
}
LOG_I
(
NR_RRC
,
"Creating NR RRC gNB Task
\n
"
);
if
(
itti_create_task
(
TASK_RRC_GNB
,
rrc_gnb_task
,
NULL
)
<
0
)
{
LOG_E
(
NR_RRC
,
"Create task for NR RRC gNB failed
\n
"
);
...
...
@@ -391,11 +391,11 @@ int create_gNB_tasks(uint32_t gnb_nb) {
}
}
if
(
itti_create_task
(
TASK_UDP
,
udp_eNB_task
,
NULL
)
<
0
)
{
LOG_E
(
GTPU
,
"Create task for UDP failed
\n
"
);
return
-
1
;
}
if
(
itti_create_task
(
TASK_UDP
,
udp_eNB_task
,
NULL
)
<
0
)
{
LOG_E
(
GTPU
,
"Create task for UDP failed
\n
"
);
return
-
1
;
}
}
...
...
openair2/GNB_APP/gnb_app.c
View file @
8a7aac41
This diff is collapsed.
Click to expand it.
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
View file @
8a7aac41
This diff is collapsed.
Click to expand it.
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c
View file @
8a7aac41
This diff is collapsed.
Click to expand it.
openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
View file @
8a7aac41
...
...
@@ -405,17 +405,17 @@ int find_pdcch_candidate(gNB_MAC_INST *mac,
const
int
C
=
R
>
0
?
N_regs
/
(
L
*
R
)
:
0
;
const
int
B_rb
=
L
/
N_symb
;
// nb of RBs occupied by each REG bundle
LOG_D
(
NR_MAC
,
"swetank: cc_id:%d aggregation:%d nr_of_candidates:%d N_rb:%d N_symb:%d N_regs:%d N_cces%d R:%d L:%d C:%d B_rb:%d :
\n
"
,
cc_id
,
aggregation
,
nr_of_candidates
,
N_rb
,
N_symb
,
N_regs
,
N_cces
,
R
,
L
,
C
,
B_rb
);
cc_id
,
aggregation
,
nr_of_candidates
,
N_rb
,
N_symb
,
N_regs
,
N_cces
,
R
,
L
,
C
,
B_rb
);
// loop over all the available candidates
// this implements TS 38.211 Sec. 7.3.2.2
...
...
@@ -425,10 +425,10 @@ int find_pdcch_candidate(gNB_MAC_INST *mac,
for
(
int
j
=
first_cce
;
(
j
<
first_cce
+
aggregation
)
&&
!
taken
;
j
++
)
{
// loop over CCEs
for
(
int
k
=
6
*
j
/
L
;
(
k
<
(
6
*
j
/
L
+
6
/
L
))
&&
!
taken
;
k
++
)
{
// loop over REG bundles
int
f
=
cce_to_reg_interleaving
(
R
,
k
,
pdcch
->
ShiftIndex
,
C
,
L
,
N_regs
);
LOG_D
(
NR_MAC
,
"swetank: pdcch->ShiftIndex:%d
\n
"
,
pdcch
->
ShiftIndex
);
LOG_D
(
NR_MAC
,
"swetank: pdcch->ShiftIndex:%d
\n
"
,
pdcch
->
ShiftIndex
);
for
(
int
rb
=
0
;
rb
<
B_rb
;
rb
++
)
{
// loop over the RBs of the bundle
if
(
vrb_map
[
pdcch
->
BWPStart
+
f
*
B_rb
+
rb
]
&
SL_to_bitmap
(
pdcch
->
StartSymbolIndex
,
N_symb
))
{
LOG_D
(
NR_MAC
,
"swetank: pdcch->BWPStart:%d pdcch->StartSymbolIndex:%d
\n
"
,
pdcch
->
BWPStart
,
pdcch
->
StartSymbolIndex
);
LOG_D
(
NR_MAC
,
"swetank: pdcch->BWPStart:%d pdcch->StartSymbolIndex:%d
\n
"
,
pdcch
->
BWPStart
,
pdcch
->
StartSymbolIndex
);
taken
=
true
;
break
;
}
...
...
@@ -436,16 +436,16 @@ int find_pdcch_candidate(gNB_MAC_INST *mac,
}
}
if
(
RC
.
ss
.
mode
==
SS_SOFTMODEM
)
{
taken
=
0
;
m
=
0
;
first_cce
=
0
;
}
LOG_D
(
NR_MAC
,
"swetank: taken:%d m:%d
\n
"
,
taken
,
m
);
if
(
RC
.
ss
.
mode
==
SS_SOFTMODEM
)
{
taken
=
0
;
m
=
0
;
first_cce
=
0
;
}
LOG_D
(
NR_MAC
,
"swetank: taken:%d m:%d
\n
"
,
taken
,
m
);
if
(
!
taken
){
mac
->
pdcch_cand
[
coreset
->
controlResourceSetId
]
=
m
++
;
// using candidate m, next available is m+1
LOG_D
(
NR_MAC
,
"swetank: coreset->controlResourceSetId:%d mac->pdcch_cand[coreset->controlResourceSetId]:%d
\n
"
,
coreset
->
controlResourceSetId
,
mac
->
pdcch_cand
[
coreset
->
controlResourceSetId
]);
LOG_D
(
NR_MAC
,
"swetank: coreset->controlResourceSetId:%d mac->pdcch_cand[coreset->controlResourceSetId]:%d
\n
"
,
coreset
->
controlResourceSetId
,
mac
->
pdcch_cand
[
coreset
->
controlResourceSetId
]);
return
first_cce
;
}
}
...
...
openair2/RRC/NR/MESSAGES/asn1_msg.c
View file @
8a7aac41
This diff is collapsed.
Click to expand it.
openair3/SS/ss_gNB_port_man_task.c
View file @
8a7aac41
...
...
@@ -233,124 +233,124 @@ void ss_gNB_port_man_init(void)
//------------------------------------------------------------------------------
static
inline
void
ss_gNB_read_from_socket
(
acpCtx_t
ctx
)
{
struct
NR_SYSTEM_CTRL_REQ
*
req
=
NULL
;
const
size_t
size
=
16
*
1024
;
size_t
msgSize
=
size
;
//2
unsigned
char
*
buffer
=
(
unsigned
char
*
)
acpMalloc
(
size
);
assert
(
buffer
);
int
userId
=
acpRecvMsg
(
ctx
,
&
msgSize
,
buffer
);
// Error handling
if
(
userId
<
0
)
struct
NR_SYSTEM_CTRL_REQ
*
req
=
NULL
;
const
size_t
size
=
16
*
1024
;
size_t
msgSize
=
size
;
//2
unsigned
char
*
buffer
=
(
unsigned
char
*
)
acpMalloc
(
size
);
assert
(
buffer
);
int
userId
=
acpRecvMsg
(
ctx
,
&
msgSize
,
buffer
);
// Error handling
if
(
userId
<
0
)
{
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] fxn:%s userId:%d
\n
"
,
__FUNCTION__
,
userId
);
if
(
userId
==
-
ACP_ERR_SERVICE_NOT_MAPPED
)
{
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] fxn:%s userId:%d
\n
"
,
__FUNCTION__
,
userId
);
if
(
userId
==
-
ACP_ERR_SERVICE_NOT_MAPPED
)
{
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] fxn:%s userId:-ACP_ERR_SERVICE_NOT_MAPPED
\n
"
,
__FUNCTION__
);
// Message not mapped to user id,
// this error should not appear on server side for the messages
// received from clients
}
else
if
(
userId
==
-
ACP_ERR_SIDL_FAILURE
)
{
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] fxn:%s userId:-ACP_ERR_SIDL_FAILURE
\n
"
,
__FUNCTION__
);
// Server returned service error,
// this error should not appear on server side for the messages
// received from clients
SidlStatus
sidlStatus
=
-
1
;
acpGetMsgSidlStatus
(
msgSize
,
buffer
,
&
sidlStatus
);
}
else
{
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] fxn:%s line:%d
\n
"
,
__FUNCTION__
,
__LINE__
);
return
;
}
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] fxn:%s userId:-ACP_ERR_SERVICE_NOT_MAPPED
\n
"
,
__FUNCTION__
);
// Message not mapped to user id,
// this error should not appear on server side for the messages
// received from clients
}
else
if
(
userId
==
0
)
else
if
(
userId
==
-
ACP_ERR_SIDL_FAILURE
)
{
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] fxn:%s userId:0
\n
"
,
__FUNCTION__
);
// No message (timeout on socket)
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] fxn:%s userId:-ACP_ERR_SIDL_FAILURE
\n
"
,
__FUNCTION__
);
// Server returned service error,
// this error should not appear on server side for the messages
// received from clients
SidlStatus
sidlStatus
=
-
1
;
acpGetMsgSidlStatus
(
msgSize
,
buffer
,
&
sidlStatus
);
}
else
{
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] received msg %d from the client.
\n
"
,
userId
);
if
(
acpNrSysProcessDecSrv
(
ctx
,
buffer
,
msgSize
,
&
req
)
!=
0
)
{
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] fxn:%s line:%d
\n
"
,
__FUNCTION__
,
__LINE__
);
return
;
}
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] fxn:%s line:%d
\n
"
,
__FUNCTION__
,
__LINE__
);
return
;
}
}
else
if
(
userId
==
0
)
{
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] fxn:%s userId:0
\n
"
,
__FUNCTION__
);
// No message (timeout on socket)
}
else
{
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] received msg %d from the client.
\n
"
,
userId
);
if
(
acpNrSysProcessDecSrv
(
ctx
,
buffer
,
msgSize
,
&
req
)
!=
0
)
{
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] fxn:%s line:%d
\n
"
,
__FUNCTION__
,
__LINE__
);
return
;
}
ss_dumpReqMsg
(
req
);
ss_dumpReqMsg
(
req
);
if
(
userId
==
MSG_NrSysProcess_userId
)
{
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] fxn:%s userId: MSG_NrSysProcess_userId
\n
"
,
__FUNCTION__
);
MessageDef
*
message_p
=
itti_alloc_new_message
(
TASK_SS_PORTMAN_GNB
,
INSTANCE_DEFAULT
,
SS_NR_SYS_PORT_MSG_IND
);
if
(
message_p
)
{
SS_NR_SYS_PORT_MSG_IND
(
message_p
).
req
=
req
;
SS_NR_SYS_PORT_MSG_IND
(
message_p
).
userId
=
userId
;
itti_send_msg_to_task
(
TASK_SYS_GNB
,
INSTANCE_DEFAULT
,
message_p
);
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] fxn:%s line:%d Msg sent to TASK_SYS_GNB
\n
"
,
__FUNCTION__
,
__LINE__
);
}
}
if
(
userId
==
MSG_NrSysProcess_userId
)
{
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] fxn:%s userId: MSG_NrSysProcess_userId
\n
"
,
__FUNCTION__
);
MessageDef
*
message_p
=
itti_alloc_new_message
(
TASK_SS_PORTMAN_GNB
,
INSTANCE_DEFAULT
,
SS_NR_SYS_PORT_MSG_IND
);
if
(
message_p
)
{
SS_NR_SYS_PORT_MSG_IND
(
message_p
).
req
=
req
;
SS_NR_SYS_PORT_MSG_IND
(
message_p
).
userId
=
userId
;
itti_send_msg_to_task
(
TASK_SYS_GNB
,
INSTANCE_DEFAULT
,
message_p
);
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] fxn:%s line:%d Msg sent to TASK_SYS_GNB
\n
"
,
__FUNCTION__
,
__LINE__
);
}
}
acpNrSysProcessFreeSrv
(
req
);
return
;
}
acpNrSysProcessFreeSrv
(
req
);
return
;
}
//------------------------------------------------------------------------------
void
*
ss_port_man_5G_NR_process_itti_msg
(
void
*
notUsed
)
{
MessageDef
*
received_msg
=
NULL
;
int
result
;
itti_poll_msg
(
TASK_SS_PORTMAN_GNB
,
&
received_msg
);
/* Check if there is a packet to handle */
if
(
received_msg
!=
NULL
)
{
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] Received a message id : %d
\n
"
,
ITTI_MSG_ID
(
received_msg
));
switch
(
ITTI_MSG_ID
(
received_msg
))
{
case
SS_NRSET_TIM_INFO
:
{
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] Received NR timing info
\n
"
);
ss_nr_port_man_send_data
(
0
,
0
,
&
received_msg
->
ittiMsg
.
ss_nrset_timinfo
);
result
=
itti_free
(
ITTI_MSG_ORIGIN_ID
(
received_msg
),
received_msg
);
}
break
;
case
SS_NR_SYS_PORT_MSG_CNF
:
{
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] Received SS_NR_SYS_PORT_MSG_CNF
\n
"
);
ss_nr_port_man_send_cnf
(
*
(
SS_NR_SYS_PORT_MSG_CNF
(
received_msg
).
cnf
));
result
=
itti_free
(
ITTI_MSG_ORIGIN_ID
(
received_msg
),
received_msg
);
}
break
;
case
TERMINATE_MESSAGE
:
{
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] Received TERMINATE_MESSAGE
\n
"
);
itti_exit_task
();
}
break
;
default:
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] Received unhandled message %d:%s
\n
"
,
ITTI_MSG_ID
(
received_msg
),
ITTI_MSG_NAME
(
received_msg
));
break
;
}
AssertFatal
(
result
==
EXIT_SUCCESS
,
"Failed to free memory (%d)!
\n
"
,
result
);
received_msg
=
NULL
;
}
ss_gNB_read_from_socket
(
nrctx_g
);
return
NULL
;
MessageDef
*
received_msg
=
NULL
;
int
result
;
itti_poll_msg
(
TASK_SS_PORTMAN_GNB
,
&
received_msg
);
/* Check if there is a packet to handle */
if
(
received_msg
!=
NULL
)
{
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] Received a message id : %d
\n
"
,
ITTI_MSG_ID
(
received_msg
));
switch
(
ITTI_MSG_ID
(
received_msg
))
{
case
SS_NRSET_TIM_INFO
:
{
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] Received NR timing info
\n
"
);
ss_nr_port_man_send_data
(
0
,
0
,
&
received_msg
->
ittiMsg
.
ss_nrset_timinfo
);
result
=
itti_free
(
ITTI_MSG_ORIGIN_ID
(
received_msg
),
received_msg
);
}
break
;
case
SS_NR_SYS_PORT_MSG_CNF
:
{
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] Received SS_NR_SYS_PORT_MSG_CNF
\n
"
);
ss_nr_port_man_send_cnf
(
*
(
SS_NR_SYS_PORT_MSG_CNF
(
received_msg
).
cnf
));
result
=
itti_free
(
ITTI_MSG_ORIGIN_ID
(
received_msg
),
received_msg
);
}
break
;
case
TERMINATE_MESSAGE
:
{
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] Received TERMINATE_MESSAGE
\n
"
);
itti_exit_task
();
}
break
;
default:
LOG_A
(
GNB_APP
,
"[SS-PORTMAN-GNB] Received unhandled message %d:%s
\n
"
,
ITTI_MSG_ID
(
received_msg
),
ITTI_MSG_NAME
(
received_msg
));
break
;
}
AssertFatal
(
result
==
EXIT_SUCCESS
,
"Failed to free memory (%d)!
\n
"
,
result
);
received_msg
=
NULL
;
}
ss_gNB_read_from_socket
(
nrctx_g
);
return
NULL
;
}
//------------------------------------------------------------------------------
...
...
openair3/SS/ss_gNB_srb_task.c
View file @
8a7aac41
...
...
@@ -324,49 +324,49 @@ ss_gNB_read_from_srb_socket(acpCtx_t ctx)
//------------------------------------------------------------------------------
void
ss_gNB_srb_init
(
void
)
{
IpAddress_t
ipaddr
;
LOG_A
(
GNB_APP
,
"[SS_SRB] Starting System Simulator SRB Thread
\n
"
);
const
char
*
hostIp
;
hostIp
=
RC
.
ss
.
hostIp
;
acpConvertIp
(
hostIp
,
&
ipaddr
);
// Port number
int
port
=
RC
.
ss
.
Srbport
;
acpInit
(
malloc
,
free
,
1000
);
// Register user services/notifications in message table
const
struct
acpMsgTable
msgTable
[]
=
{
{
"NrSysSrbProcessFromSS"
,
MSG_NrSysSrbProcessFromSS_userId
},
{
"NrSysSrbProcessToSS"
,
MSG_NrSysSrbProcessToSS_userId
},
/* { "SysProcess", MSG_SysProcess_userId }, */
// The last element should be NULL
{
NULL
,
0
}
};
// Arena size to decode received message
const
size_t
aSize
=
32
*
1024
;
// Start listening server and get ACP context,
// after the connection is performed, we can use all services
int
ret
=
acpServerInitWithCtx
(
ipaddr
,
port
,
msgTable
,
aSize
,
&
ctx_srb_g
);
if
(
ret
<
0
)
{
LOG_A
(
GNB_APP
,
"[SS_SRB] Connection failure err=%d
\n
"
,
ret
);
return
;
}
int
fd1
=
acpGetSocketFd
(
ctx_srb_g
);
LOG_A
(
GNB_APP
,
"[SS_SRB] Connection performed : %d
\n
"
,
fd1
);
buffer
=
(
unsigned
char
*
)
acpMalloc
(
size
);
assert
(
buffer
);
if
(
RC
.
ss
.
mode
==
SS_SOFTMODEM_SRB
)
{
RC
.
ss
.
State
=
SS_STATE_CELL_ACTIVE
;
}
itti_subscribe_event_fd
(
TASK_SS_SRB
,
fd1
);
itti_mark_task_ready
(
TASK_SS_SRB
);
IpAddress_t
ipaddr
;
LOG_A
(
GNB_APP
,
"[SS_SRB] Starting System Simulator SRB Thread
\n
"
);
const
char
*
hostIp
;
hostIp
=
RC
.
ss
.
hostIp
;
acpConvertIp
(
hostIp
,
&
ipaddr
);
// Port number
int
port
=
RC
.
ss
.
Srbport
;
acpInit
(
malloc
,
free
,
1000
);
// Register user services/notifications in message table
const
struct
acpMsgTable
msgTable
[]
=
{
{
"NrSysSrbProcessFromSS"
,
MSG_NrSysSrbProcessFromSS_userId
},
{
"NrSysSrbProcessToSS"
,
MSG_NrSysSrbProcessToSS_userId
},
/* { "SysProcess", MSG_SysProcess_userId }, */
// The last element should be NULL
{
NULL
,
0
}
};
// Arena size to decode received message
const
size_t
aSize
=
32
*
1024
;
// Start listening server and get ACP context,
// after the connection is performed, we can use all services
int
ret
=
acpServerInitWithCtx
(
ipaddr
,
port
,
msgTable
,
aSize
,
&
ctx_srb_g
);
if
(
ret
<
0
)
{
LOG_A
(
GNB_APP
,
"[SS_SRB] Connection failure err=%d
\n
"
,
ret
);
return
;
}
int
fd1
=
acpGetSocketFd
(
ctx_srb_g
);
LOG_A
(
GNB_APP
,
"[SS_SRB] Connection performed : %d
\n
"
,
fd1
);
buffer
=
(
unsigned
char
*
)
acpMalloc
(
size
);
assert
(
buffer
);
if
(
RC
.
ss
.
mode
==
SS_SOFTMODEM_SRB
)
{
RC
.
ss
.
State
=
SS_STATE_CELL_ACTIVE
;
}
itti_subscribe_event_fd
(
TASK_SS_SRB
,
fd1
);
itti_mark_task_ready
(
TASK_SS_SRB
);
}
//------------------------------------------------------------------------------
...
...
openair3/SS/ss_gNB_sys_task.c
View file @
8a7aac41
This diff is collapsed.
Click to expand it.
openair3/UDP/udp_eNB_task.c
View file @
8a7aac41
...
...
@@ -311,7 +311,7 @@ void *udp_eNB_task(void *args_p)
LOG_I
(
UDP_
,
" Entry in %s
\n
"
,
__FUNCTION__
);
while
(
1
)
{
LOG_I
(
UDP_
,
" Fxn:%s line:%d
\n
"
,
__FUNCTION__
,
__LINE__
);
LOG_I
(
UDP_
,
" Fxn:%s line:%d
\n
"
,
__FUNCTION__
,
__LINE__
);
itti_receive_msg
(
TASK_UDP
,
&
received_message_p
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_UDP_ENB_TASK
,
VCD_FUNCTION_IN
);
#if defined(LOG_UDP) && LOG_UDP > 0
...
...
@@ -324,97 +324,97 @@ void *udp_eNB_task(void *args_p)
//instance = ITTI_MSG_INSTANCE (received_message_p);
switch
(
ITTI_MSG_ID
(
received_message_p
))
{
case
UDP_INIT
:
{
LOG_D
(
UDP_
,
"Received UDP_INIT
\n
"
);
udp_init_t
*
udp_init_p
;
udp_init_p
=
&
received_message_p
->
ittiMsg
.
udp_init
;
udp_eNB_create_socket
(
udp_init_p
->
port
,
udp_init_p
->
address
,
ITTI_MSG_ORIGIN_ID
(
received_message_p
));
}
break
;
case
UDP_DATA_REQ
:
{
case
UDP_INIT
:
{
LOG_D
(
UDP_
,
"Received UDP_INIT
\n
"
);
udp_init_t
*
udp_init_p
;
udp_init_p
=
&
received_message_p
->
ittiMsg
.
udp_init
;
udp_eNB_create_socket
(
udp_init_p
->
port
,
udp_init_p
->
address
,
ITTI_MSG_ORIGIN_ID
(
received_message_p
));
}
break
;
case
UDP_DATA_REQ
:
{
#if defined(LOG_UDP) && LOG_UDP > 0
LOG_D
(
UDP_
,
"Received UDP_DATA_REQ
\n
"
);
LOG_D
(
UDP_
,
"Received UDP_DATA_REQ
\n
"
);
#endif
int
udp_sd
=
-
1
;
ssize_t
bytes_written
;
struct
udp_socket_desc_s
*
udp_sock_p
=
NULL
;
udp_data_req_t
*
udp_data_req_p
;
struct
sockaddr_in
peer_addr
;
char
buffer
[
INET_ADDRSTRLEN
];
udp_data_req_p
=
&
received_message_p
->
ittiMsg
.
udp_data_req
;
memset
(
&
peer_addr
,
0
,
sizeof
(
struct
sockaddr_in
));
peer_addr
.
sin_family
=
AF_INET
;
peer_addr
.
sin_port
=
htons
(
udp_data_req_p
->
peer_port
);
peer_addr
.
sin_addr
.
s_addr
=
udp_data_req_p
->
peer_address
;
inet_ntop
(
AF_INET
,
&
peer_addr
.
sin_addr
,
buffer
,
sizeof
(
buffer
));
pthread_mutex_lock
(
&
udp_socket_list_mutex
);
udp_sock_p
=
udp_eNB_get_socket_desc
(
ITTI_MSG_ORIGIN_ID
(
received_message_p
));
if
(
udp_sock_p
==
NULL
)
{
LOG_E
(
UDP_
,
"Failed to retrieve the udp socket descriptor "
"associated with task %d
\n
"
,
ITTI_MSG_ORIGIN_ID
(
received_message_p
));
pthread_mutex_unlock
(
&
udp_socket_list_mutex
);
if
(
udp_data_req_p
->
buffer
)
{
itti_free
(
ITTI_MSG_ORIGIN_ID
(
received_message_p
),
udp_data_req_p
->
buffer
);
}
goto
on_error
;
}
udp_sd
=
udp_sock_p
->
sd
;
pthread_mutex_unlock
(
&
udp_socket_list_mutex
);
//#if defined(LOG_UDP) && LOG_UDP > 0
LOG_D
(
UDP_
,
"[%d] Sending message of size %u to "
IPV4_ADDR
" and port %u
\n
"
,
udp_sd
,
udp_data_req_p
->
buffer_length
,
IPV4_ADDR_FORMAT
(
udp_data_req_p
->
peer_address
),
udp_data_req_p
->
peer_port
);
//#endif
bytes_written
=
sendto
(
udp_sd
,
&
udp_data_req_p
->
buffer
[
udp_data_req_p
->
buffer_offset
],
udp_data_req_p
->
buffer_length
,
0
,
(
struct
sockaddr
*
)
&
peer_addr
,
sizeof
(
struct
sockaddr_in
));
if
(
bytes_written
!=
udp_data_req_p
->
buffer_length
)
{
LOG_E
(
UDP_
,
"There was an error while writing to socket %d rc %zd"
"(%d:%s) May be normal if GTPU kernel module loaded on same host (may NF_DROP IP packet)
\n
"
,
udp_sd
,
bytes_written
,
errno
,
strerror
(
errno
));
}
itti_free
(
ITTI_MSG_ORIGIN_ID
(
received_message_p
),
udp_data_req_p
->
buffer
);
}
break
;
case
TERMINATE_MESSAGE
:
{
LOG_W
(
UDP_
,
" *** Exiting UDP thread
\n
"
);
itti_exit_task
();
}
break
;
case
MESSAGE_TEST
:
{
}
break
;
default:
{
LOG_W
(
UDP_
,
"Unkwnon message ID %d:%s
\n
"
,
ITTI_MSG_ID
(
received_message_p
),
ITTI_MSG_NAME
(
received_message_p
));
}
break
;
int
udp_sd
=
-
1
;
ssize_t
bytes_written
;
struct
udp_socket_desc_s
*
udp_sock_p
=
NULL
;
udp_data_req_t
*
udp_data_req_p
;
struct
sockaddr_in
peer_addr
;
char
buffer
[
INET_ADDRSTRLEN
];
udp_data_req_p
=
&
received_message_p
->
ittiMsg
.
udp_data_req
;
memset
(
&
peer_addr
,
0
,
sizeof
(
struct
sockaddr_in
));
peer_addr
.
sin_family
=
AF_INET
;
peer_addr
.
sin_port
=
htons
(
udp_data_req_p
->
peer_port
);
peer_addr
.
sin_addr
.
s_addr
=
udp_data_req_p
->
peer_address
;
inet_ntop
(
AF_INET
,
&
peer_addr
.
sin_addr
,
buffer
,
sizeof
(
buffer
));
pthread_mutex_lock
(
&
udp_socket_list_mutex
);
udp_sock_p
=
udp_eNB_get_socket_desc
(
ITTI_MSG_ORIGIN_ID
(
received_message_p
));
if
(
udp_sock_p
==
NULL
)
{
LOG_E
(
UDP_
,
"Failed to retrieve the udp socket descriptor "
"associated with task %d
\n
"
,
ITTI_MSG_ORIGIN_ID
(
received_message_p
));
pthread_mutex_unlock
(
&
udp_socket_list_mutex
);
if
(
udp_data_req_p
->
buffer
)
{
itti_free
(
ITTI_MSG_ORIGIN_ID
(
received_message_p
),
udp_data_req_p
->
buffer
);
}
goto
on_error
;
}
udp_sd
=
udp_sock_p
->
sd
;
pthread_mutex_unlock
(
&
udp_socket_list_mutex
);
//#if defined(LOG_UDP) && LOG_UDP > 0
LOG_D
(
UDP_
,
"[%d] Sending message of size %u to "
IPV4_ADDR
" and port %u
\n
"
,
udp_sd
,
udp_data_req_p
->
buffer_length
,
IPV4_ADDR_FORMAT
(
udp_data_req_p
->
peer_address
),
udp_data_req_p
->
peer_port
);
//#endif
bytes_written
=
sendto
(
udp_sd
,
&
udp_data_req_p
->
buffer
[
udp_data_req_p
->
buffer_offset
],
udp_data_req_p
->
buffer_length
,
0
,
(
struct
sockaddr
*
)
&
peer_addr
,
sizeof
(
struct
sockaddr_in
));
if
(
bytes_written
!=
udp_data_req_p
->
buffer_length
)
{
LOG_E
(
UDP_
,
"There was an error while writing to socket %d rc %zd"
"(%d:%s) May be normal if GTPU kernel module loaded on same host (may NF_DROP IP packet)
\n
"
,
udp_sd
,
bytes_written
,
errno
,
strerror
(
errno
));
}
itti_free
(
ITTI_MSG_ORIGIN_ID
(
received_message_p
),
udp_data_req_p
->
buffer
);
}
break
;
case
TERMINATE_MESSAGE
:
{
LOG_W
(
UDP_
,
" *** Exiting UDP thread
\n
"
);
itti_exit_task
();
}
break
;
case
MESSAGE_TEST
:
{
}
break
;
default:
{
LOG_W
(
UDP_
,
"Unkwnon message ID %d:%s
\n
"
,
ITTI_MSG_ID
(
received_message_p
),
ITTI_MSG_NAME
(
received_message_p
));
}
break
;
}
on_error:
...
...
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