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
wangjie
OpenXG-RAN
Commits
53daef42
Commit
53daef42
authored
Sep 16, 2019
by
zhenghuangkun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix 2ho multi cells support and Abort/Assert modify
parent
7af84127
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
401 additions
and
114 deletions
+401
-114
openair2/RRC/LTE/rrc_eNB.c
openair2/RRC/LTE/rrc_eNB.c
+44
-15
openair2/X2AP/x2ap_eNB.c
openair2/X2AP/x2ap_eNB.c
+124
-33
openair2/X2AP/x2ap_eNB_decoder.c
openair2/X2AP/x2ap_eNB_decoder.c
+16
-6
openair2/X2AP/x2ap_eNB_encoder.c
openair2/X2AP/x2ap_eNB_encoder.c
+14
-3
openair2/X2AP/x2ap_eNB_generate_messages.c
openair2/X2AP/x2ap_eNB_generate_messages.c
+96
-26
openair2/X2AP/x2ap_eNB_handler.c
openair2/X2AP/x2ap_eNB_handler.c
+83
-28
openair2/X2AP/x2ap_eNB_management_procedures.c
openair2/X2AP/x2ap_eNB_management_procedures.c
+18
-1
openair2/X2AP/x2ap_eNB_management_procedures.h
openair2/X2AP/x2ap_eNB_management_procedures.h
+1
-0
openair2/X2AP/x2ap_timers.c
openair2/X2AP/x2ap_timers.c
+4
-1
openair3/SCTP/sctp_eNB_task.c
openair3/SCTP/sctp_eNB_task.c
+1
-1
No files found.
openair2/RRC/LTE/rrc_eNB.c
View file @
53daef42
...
...
@@ -4803,7 +4803,8 @@ void rrc_eNB_process_handoverPreparationInformation(int mod_id, x2ap_handover_re
ho
->
criticalExtensions
.
present
!=
LTE_HandoverPreparationInformation__criticalExtensions_PR_c1
||
ho
->
criticalExtensions
.
choice
.
c1
.
present
!=
LTE_HandoverPreparationInformation__criticalExtensions__c1_PR_handoverPreparationInformation_r8
)
{
LOG_E
(
RRC
,
"could not decode Handover Preparation
\n
"
);
abort
();
//abort();
return
;
}
ho_info
=
&
ho
->
criticalExtensions
.
choice
.
c1
.
choice
.
handoverPreparationInformation_r8
;
...
...
@@ -4878,15 +4879,18 @@ void rrc_eNB_process_handoverCommand(
ho
->
criticalExtensions
.
present
!=
LTE_HandoverCommand__criticalExtensions_PR_c1
||
ho
->
criticalExtensions
.
choice
.
c1
.
present
!=
LTE_HandoverCommand__criticalExtensions__c1_PR_handoverCommand_r8
)
{
LOG_E
(
RRC
,
"could not decode Handover Command
\n
"
);
abort
();
//abort();
return
;
}
unsigned
char
*
buf
=
ho
->
criticalExtensions
.
choice
.
c1
.
choice
.
handoverCommand_r8
.
handoverCommandMessage
.
buf
;
int
size
=
ho
->
criticalExtensions
.
choice
.
c1
.
choice
.
handoverCommand_r8
.
handoverCommandMessage
.
size
;
if
(
size
>
RRC_BUF_SIZE
)
{
printf
(
"%s:%d: fatal
\n
"
,
__FILE__
,
__LINE__
);
abort
();
//printf("%s:%d: fatal\n", __FILE__, __LINE__);
//abort();
LOG_E
(
RRC
,
"%s:%d: fatal size: %d
\n
"
,
__FILE__
,
__LINE__
,
size
);
return
;
}
memcpy
(
ue_context
->
ue_context
.
handover_info
->
buf
,
buf
,
size
);
...
...
@@ -5153,7 +5157,9 @@ check_handovers(
// Message buffer has been processed, free it now.
result
=
itti_free
(
ITTI_MSG_ORIGIN_ID
(
msg_p
),
GTPV1U_ENB_DATA_FORWARDING_IND
(
msg_p
).
sdu_p
);
AssertFatal
(
result
==
EXIT_SUCCESS
,
"Failed to free memory (%d)!
\n
"
,
result
);
if
(
result
!=
EXIT_SUCCESS
)
{
LOG_E
(
RRC
,
"Failed to free memory (%d)!
\n
"
,
result
);
}
break
;
default:
...
...
@@ -5162,7 +5168,9 @@ check_handovers(
}
result
=
itti_free
(
ITTI_MSG_ORIGIN_ID
(
msg_p
),
msg_p
);
AssertFatal
(
result
==
EXIT_SUCCESS
,
"Failed to free memory (%d)!
\n
"
,
result
);
if
(
result
!=
EXIT_SUCCESS
)
{
LOG_E
(
RRC
,
"Failed to free memory (%d)!
\n
"
,
result
);
}
}
}
while
(
msg_p
!=
NULL
);
ue_context_p
->
ue_context
.
handover_info
->
forwarding_state
=
FORWARDING_EMPTY
;
...
...
@@ -5224,7 +5232,9 @@ check_handovers(
// Message buffer has been processed, free it now.
result
=
itti_free
(
ITTI_MSG_ORIGIN_ID
(
msg_p
),
GTPV1U_ENB_END_MARKER_IND
(
msg_p
).
sdu_p
);
AssertFatal
(
result
==
EXIT_SUCCESS
,
"Failed to free memory (%d)!
\n
"
,
result
);
if
(
result
!=
EXIT_SUCCESS
)
{
LOG_E
(
RRC
,
"Failed to free memory (%d)!
\n
"
,
result
);
}
break
;
default:
...
...
@@ -5233,7 +5243,9 @@ check_handovers(
}
result
=
itti_free
(
ITTI_MSG_ORIGIN_ID
(
msg_p
),
msg_p
);
AssertFatal
(
result
==
EXIT_SUCCESS
,
"Failed to free memory (%d)!
\n
"
,
result
);
if
(
result
!=
EXIT_SUCCESS
)
{
LOG_E
(
RRC
,
"Failed to free memory (%d)!
\n
"
,
result
);
}
}
}
while
(
msg_p
!=
NULL
);
...
...
@@ -6293,8 +6305,10 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct
);
if
(
rrc_size
<=
0
)
{
printf
(
"%s:%d: fatal
\n
"
,
__FILE__
,
__LINE__
);
abort
();
//printf("%s:%d: fatal\n", __FILE__, __LINE__);
//abort();
LOG_E
(
RRC
,
"%s:%d: fatal size: %d
\n
"
,
__FILE__
,
__LINE__
,
size
);
return
;
}
char
*
ho_buf
=
(
char
*
)
buffer
;
...
...
@@ -8974,12 +8988,20 @@ void *rrc_enb_process_itti_msg(void *notUsed) {
/* is it possible? */
LOG_E
(
RRC
,
"could not find UE (rnti %x) while processing X2AP_HANDOVER_REQ_ACK
\n
"
,
X2AP_HANDOVER_REQ_ACK
(
msg_p
).
rnti
);
exit
(
1
);
//exit(1);
return
;
}
LOG_I
(
RRC
,
"[eNB %d] source eNB receives the X2 HO ACK %s
\n
"
,
instance
,
msg_name_p
);
DevAssert
(
ue_context_p
!=
NULL
);
if
(
ue_context_p
==
NULL
)
{
LOG_E
(
RRC
,
"%s %d: ue_context_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
if
(
ue_context_p
->
ue_context
.
handover_info
->
state
!=
HO_REQUEST
)
abort
();
if
(
ue_context_p
->
ue_context
.
handover_info
->
state
!=
HO_REQUEST
)
{
//abort();
LOG_E
(
RRC
,
"%s:%d: the handover state is not HO_REQUEST: %d
\n
"
,
__FILE__
,
__LINE__
,
ue_context_p
->
ue_context
.
handover_info
->
state
);
return
;
}
hash_rc
=
hashtable_get
(
RC
.
gtpv1u_data_g
->
ue_mapping
,
ue_context_p
->
ue_context
.
rnti
,
(
void
**
)
&
gtpv1u_ue_data_p
);
/* set target enb gtp teid */
...
...
@@ -9027,9 +9049,16 @@ void *rrc_enb_process_itti_msg(void *notUsed) {
struct
rrc_eNB_ue_context_s
*
ue_context_p
=
NULL
;
ue_context_p
=
rrc_eNB_get_ue_context
(
RC
.
rrc
[
instance
],
X2AP_UE_CONTEXT_RELEASE
(
msg_p
).
rnti
);
LOG_I
(
RRC
,
"[eNB %d] source eNB receives the X2 UE CONTEXT RELEASE %s
\n
"
,
instance
,
msg_name_p
);
DevAssert
(
ue_context_p
!=
NULL
);
if
(
ue_context_p
==
NULL
)
{
LOG_E
(
RRC
,
"%s %d: ue_context_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
if
(
ue_context_p
->
ue_context
.
handover_info
->
state
!=
HO_COMPLETE
)
abort
();
if
(
ue_context_p
->
ue_context
.
handover_info
->
state
!=
HO_COMPLETE
)
{
//abort();
LOG_E
(
RRC
,
"%s:%d: the handover state is not HO_COMPLETE: %d
\n
"
,
__FILE__
,
__LINE__
,
ue_context_p
->
ue_context
.
handover_info
->
state
);
return
;
}
ue_context_p
->
ue_context
.
handover_info
->
state
=
HO_RELEASE
;
break
;
...
...
openair2/X2AP/x2ap_eNB.c
View file @
53daef42
...
...
@@ -89,22 +89,33 @@ void x2ap_eNB_ue_context_release(instance_t instance,
static
void
x2ap_eNB_handle_sctp_data_ind
(
instance_t
instance
,
sctp_data_ind_t
*
sctp_data_ind
)
{
int
result
;
DevAssert
(
sctp_data_ind
!=
NULL
);
if
(
sctp_data_ind
==
NULL
)
{
X2AP_ERROR
(
"%s %d: sctp_data_ind is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
x2ap_eNB_handle_message
(
instance
,
sctp_data_ind
->
assoc_id
,
sctp_data_ind
->
stream
,
sctp_data_ind
->
buffer
,
sctp_data_ind
->
buffer_length
);
result
=
itti_free
(
TASK_UNKNOWN
,
sctp_data_ind
->
buffer
);
AssertFatal
(
result
==
EXIT_SUCCESS
,
"Failed to free memory (%d)!
\n
"
,
result
);
if
(
result
!=
EXIT_SUCCESS
)
{
X2AP_ERROR
(
"Failed to free memory (%d)!
\n
"
,
result
);
}
}
static
void
x2ap_eNB_handle_sctp_association_resp
(
instance_t
instance
,
sctp_new_association_resp_t
*
sctp_new_association_resp
)
{
x2ap_eNB_instance_t
*
instance_p
;
x2ap_eNB_data_t
*
x2ap_enb_data_p
;
DevAssert
(
sctp_new_association_resp
!=
NULL
);
if
(
sctp_new_association_resp
==
NULL
)
{
X2AP_ERROR
(
"%s %d: sctp_new_association_resp is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
printf
(
"x2ap_eNB_handle_sctp_association_resp at 1
\n
"
);
dump_trees
();
instance_p
=
x2ap_eNB_get_instance
(
instance
);
DevAssert
(
instance_p
!=
NULL
);
if
(
instance_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: instance_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
/* if the assoc_id is already known, it is certainly because an IND was received
* before. In this case, just update streams and return
...
...
@@ -116,8 +127,8 @@ void x2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
if
(
x2ap_enb_data_p
!=
NULL
)
{
/* some sanity check - to be refined at some point */
if
(
sctp_new_association_resp
->
sctp_state
!=
SCTP_STATE_ESTABLISHED
)
{
X2AP_ERROR
(
"x2ap_enb_data_p not NULL and sctp state not SCTP_STATE_ESTABLISHED,
what to do?
\n
"
);
abort
(
);
X2AP_ERROR
(
"x2ap_enb_data_p not NULL and sctp state not SCTP_STATE_ESTABLISHED,
remove x2ap instance
\n
"
);
x2ap_remove_eNB
(
instance_p
,
x2ap_enb_data_p
);
}
x2ap_enb_data_p
->
in_streams
=
sctp_new_association_resp
->
in_streams
;
...
...
@@ -128,7 +139,10 @@ void x2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa
x2ap_enb_data_p
=
x2ap_get_eNB
(
instance_p
,
-
1
,
sctp_new_association_resp
->
ulp_cnx_id
);
DevAssert
(
x2ap_enb_data_p
!=
NULL
);
if
(
x2ap_enb_data_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: x2ap_enb_data_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
printf
(
"x2ap_eNB_handle_sctp_association_resp at 2
\n
"
);
dump_trees
();
...
...
@@ -160,20 +174,35 @@ void x2ap_eNB_handle_sctp_association_ind(instance_t instance, sctp_new_associat
x2ap_eNB_data_t
*
x2ap_enb_data_p
;
printf
(
"x2ap_eNB_handle_sctp_association_ind at 1 (called for instance %d)
\n
"
,
instance
);
dump_trees
();
DevAssert
(
sctp_new_association_ind
!=
NULL
);
if
(
sctp_new_association_ind
==
NULL
)
{
X2AP_ERROR
(
"%s %d: sctp_new_association_ind is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
instance_p
=
x2ap_eNB_get_instance
(
instance
);
DevAssert
(
instance_p
!=
NULL
);
x2ap_enb_data_p
=
x2ap_get_eNB
(
instance_p
,
sctp_new_association_ind
->
assoc_id
,
-
1
);
if
(
instance_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: instance_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
if
(
x2ap_enb_data_p
!=
NULL
)
abort
();
x2ap_enb_data_p
=
x2ap_get_eNB
(
instance_p
,
sctp_new_association_ind
->
assoc_id
,
-
1
);
if
(
x2ap_enb_data_p
!=
NULL
)
{
X2AP_ERROR
(
"%s %d: x2ap_enb_data_p is not a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
// DevAssert(x2ap_enb_data_p != NULL);
if
(
x2ap_enb_data_p
==
NULL
)
{
/* Create new eNB descriptor */
x2ap_enb_data_p
=
calloc
(
1
,
sizeof
(
*
x2ap_enb_data_p
));
DevAssert
(
x2ap_enb_data_p
!=
NULL
);
if
(
x2ap_enb_data_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: x2ap_enb_data_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
x2ap_enb_data_p
->
cnx_id
=
x2ap_eNB_fetch_add_global_cnx_id
();
x2ap_enb_data_p
->
x2ap_eNB_instance
=
instance_p
;
x2ap_enb_data_p
->
assoc_id
=
sctp_new_association_ind
->
assoc_id
;
/* Insert the new descriptor in list of known eNB
* but not yet associated.
*/
...
...
@@ -191,7 +220,7 @@ void x2ap_eNB_handle_sctp_association_ind(instance_t instance, sctp_new_associat
printf
(
"x2ap_eNB_handle_sctp_association_ind at 2
\n
"
);
dump_trees
();
/* Update parameters */
x2ap_enb_data_p
->
assoc_id
=
sctp_new_association_ind
->
assoc_id
;
//
x2ap_enb_data_p->assoc_id = sctp_new_association_ind->assoc_id;
x2ap_enb_data_p
->
in_streams
=
sctp_new_association_ind
->
in_streams
;
x2ap_enb_data_p
->
out_streams
=
sctp_new_association_ind
->
out_streams
;
printf
(
"x2ap_eNB_handle_sctp_association_ind at 3
\n
"
);
...
...
@@ -204,8 +233,17 @@ int x2ap_eNB_init_sctp (x2ap_eNB_instance_t *instance_p,
// Create and alloc new message
MessageDef
*
message
;
sctp_init_t
*
sctp_init
=
NULL
;
DevAssert
(
instance_p
!=
NULL
);
DevAssert
(
local_ip_addr
!=
NULL
);
if
(
instance_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: instance_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
if
(
local_ip_addr
==
NULL
)
{
X2AP_ERROR
(
"%s %d: local_ip_addr is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
message
=
itti_alloc_new_message
(
TASK_X2AP
,
SCTP_INIT_MSG_MULTI_REQ
);
sctp_init
=
&
message
->
ittiMsg
.
sctp_init_multi
;
sctp_init
->
port
=
enb_port_for_X2C
;
...
...
@@ -238,8 +276,17 @@ static void x2ap_eNB_register_eNB(x2ap_eNB_instance_t *instance_p,
MessageDef
*
message
=
NULL
;
sctp_new_association_req_multi_t
*
sctp_new_association_req
=
NULL
;
x2ap_eNB_data_t
*
x2ap_enb_data
=
NULL
;
DevAssert
(
instance_p
!=
NULL
);
DevAssert
(
target_eNB_ip_address
!=
NULL
);
if
(
instance_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: instance_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
if
(
target_eNB_ip_address
==
NULL
)
{
X2AP_ERROR
(
"%s %d: target_eNB_ip_address is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
message
=
itti_alloc_new_message
(
TASK_X2AP
,
SCTP_NEW_ASSOCIATION_REQ_MULTI
);
sctp_new_association_req
=
&
message
->
ittiMsg
.
sctp_new_association_req_multi
;
sctp_new_association_req
->
port
=
enb_port_for_X2C
;
...
...
@@ -255,7 +302,11 @@ static void x2ap_eNB_register_eNB(x2ap_eNB_instance_t *instance_p,
sizeof
(
*
local_ip_addr
));
/* Create new eNB descriptor */
x2ap_enb_data
=
calloc
(
1
,
sizeof
(
*
x2ap_enb_data
));
DevAssert
(
x2ap_enb_data
!=
NULL
);
if
(
x2ap_enb_data
==
NULL
)
{
X2AP_ERROR
(
"%s %d: x2ap_enb_data is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
x2ap_enb_data
->
cnx_id
=
x2ap_eNB_fetch_add_global_cnx_id
();
sctp_new_association_req
->
ulp_cnx_id
=
x2ap_enb_data
->
cnx_id
;
x2ap_enb_data
->
assoc_id
=
-
1
;
...
...
@@ -274,7 +325,11 @@ static
void
x2ap_eNB_handle_register_eNB
(
instance_t
instance
,
x2ap_register_enb_req_t
*
x2ap_register_eNB
)
{
x2ap_eNB_instance_t
*
new_instance
;
DevAssert
(
x2ap_register_eNB
!=
NULL
);
if
(
x2ap_register_eNB
==
NULL
)
{
X2AP_ERROR
(
"%s %d: x2ap_register_eNB is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
/* Look if the provided instance already exists */
new_instance
=
x2ap_eNB_get_instance
(
instance
);
...
...
@@ -288,7 +343,11 @@ void x2ap_eNB_handle_register_eNB(instance_t instance,
X2AP_WARN
(
"eNB[%d] already registered
\n
"
,
instance
);
}
else
{
new_instance
=
calloc
(
1
,
sizeof
(
x2ap_eNB_instance_t
));
DevAssert
(
new_instance
!=
NULL
);
if
(
new_instance
==
NULL
)
{
X2AP_ERROR
(
"%s %d: new_instance is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
RB_INIT
(
&
new_instance
->
x2ap_enb_head
);
/* Copy usefull parameters */
new_instance
->
instance
=
instance
;
...
...
@@ -351,9 +410,18 @@ void x2ap_eNB_handle_sctp_init_msg_multi_cnf(
sctp_init_msg_multi_cnf_t
*
m
)
{
x2ap_eNB_instance_t
*
instance
;
int
index
;
DevAssert
(
m
!=
NULL
);
if
(
m
==
NULL
)
{
X2AP_ERROR
(
"%s %d: m is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
instance
=
x2ap_eNB_get_instance
(
instance_id
);
DevAssert
(
instance
!=
NULL
);
if
(
instance
==
NULL
)
{
X2AP_ERROR
(
"%s %d: instance is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
instance
->
multi_sd
=
m
->
multi_sd
;
/* Exit if CNF message reports failure.
...
...
@@ -361,7 +429,7 @@ void x2ap_eNB_handle_sctp_init_msg_multi_cnf(
*/
if
(
instance
->
multi_sd
<
0
)
{
X2AP_ERROR
(
"Error: be sure to properly configure X2 in your configuration file.
\n
"
);
DevAssert
(
instance
->
multi_sd
>=
0
)
;
return
;
}
/* Trying to connect to the provided list of eNB ip address */
...
...
@@ -391,10 +459,16 @@ void x2ap_eNB_handle_handover_req(instance_t instance,
int
target_pci
=
x2ap_handover_req
->
target_physCellId
;
instance_p
=
x2ap_eNB_get_instance
(
instance
);
DevAssert
(
instance_p
!=
NULL
);
if
(
instance_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: instance_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
target
=
x2ap_is_eNB_pci_in_list
(
target_pci
);
DevAssert
(
target
!=
NULL
);
if
(
target
==
NULL
)
{
X2AP_ERROR
(
"%s %d: target is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
/* allocate x2ap ID */
id_manager
=
&
instance_p
->
id_manager
;
...
...
@@ -402,7 +476,8 @@ void x2ap_eNB_handle_handover_req(instance_t instance,
if
(
ue_id
==
-
1
)
{
X2AP_ERROR
(
"could not allocate a new X2AP UE ID
\n
"
);
/* TODO: cancel handover: send (to be defined) message to RRC */
exit
(
1
);
//exit(1);
return
;
}
/* id_source is ue_id, id_target is unknown yet */
x2ap_set_ids
(
id_manager
,
ue_id
,
x2ap_handover_req
->
rnti
,
ue_id
,
-
1
);
...
...
@@ -433,10 +508,16 @@ void x2ap_eNB_handle_handover_req_ack(instance_t instance,
int
id_target
;
instance_p
=
x2ap_eNB_get_instance
(
instance
);
DevAssert
(
instance_p
!=
NULL
);
if
(
instance_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: instance_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
target
=
x2ap_get_eNB
(
NULL
,
source_assoc_id
,
0
);
DevAssert
(
target
!=
NULL
);
if
(
target
==
NULL
)
{
X2AP_ERROR
(
"%s %d: target is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
/* rnti is a new information, save it */
ue_id
=
x2ap_handover_req_ack
->
x2_id_target
;
...
...
@@ -456,10 +537,16 @@ void x2ap_eNB_ue_context_release(instance_t instance,
int
source_assoc_id
=
x2ap_ue_context_release
->
source_assoc_id
;
int
ue_id
;
instance_p
=
x2ap_eNB_get_instance
(
instance
);
DevAssert
(
instance_p
!=
NULL
);
if
(
instance_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: instance_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
target
=
x2ap_get_eNB
(
NULL
,
source_assoc_id
,
0
);
DevAssert
(
target
!=
NULL
);
if
(
target
==
NULL
)
{
X2AP_ERROR
(
"%s %d: target is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
x2ap_eNB_generate_x2_ue_context_release
(
instance_p
,
target
,
x2ap_ue_context_release
);
...
...
@@ -467,7 +554,8 @@ void x2ap_eNB_ue_context_release(instance_t instance,
ue_id
=
x2ap_find_id_from_rnti
(
&
instance_p
->
id_manager
,
x2ap_ue_context_release
->
rnti
);
if
(
ue_id
==
-
1
)
{
X2AP_ERROR
(
"could not find UE %x
\n
"
,
x2ap_ue_context_release
->
rnti
);
exit
(
1
);
//exit(1);
return
;
}
x2ap_release_id
(
&
instance_p
->
id_manager
,
ue_id
);
}
...
...
@@ -539,7 +627,10 @@ void *x2ap_task(void *arg) {
}
result
=
itti_free
(
ITTI_MSG_ORIGIN_ID
(
received_msg
),
received_msg
);
AssertFatal
(
result
==
EXIT_SUCCESS
,
"Failed to free memory (%d)!
\n
"
,
result
);
if
(
result
!=
EXIT_SUCCESS
)
{
X2AP_ERROR
(
"Failed to free memory (%d)!
\n
"
,
result
);
}
received_msg
=
NULL
;
}
...
...
openair2/X2AP/x2ap_eNB_decoder.c
View file @
53daef42
...
...
@@ -35,7 +35,10 @@
static
int
x2ap_eNB_decode_initiating_message
(
X2AP_X2AP_PDU_t
*
pdu
)
{
DevAssert
(
pdu
!=
NULL
);
if
(
pdu
==
NULL
)
{
X2AP_ERROR
(
"%s %d: pdu is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
switch
(
pdu
->
choice
.
initiatingMessage
.
procedureCode
)
{
...
...
@@ -62,8 +65,6 @@ static int x2ap_eNB_decode_initiating_message(X2AP_X2AP_PDU_t *pdu)
default:
X2AP_ERROR
(
"Unknown procedure ID (%d) for initiating message
\n
"
,
(
int
)
pdu
->
choice
.
initiatingMessage
.
procedureCode
);
AssertFatal
(
0
,
"Unknown procedure ID (%d) for initiating message
\n
"
,
(
int
)
pdu
->
choice
.
initiatingMessage
.
procedureCode
);
return
-
1
;
}
...
...
@@ -72,7 +73,10 @@ static int x2ap_eNB_decode_initiating_message(X2AP_X2AP_PDU_t *pdu)
static
int
x2ap_eNB_decode_successful_outcome
(
X2AP_X2AP_PDU_t
*
pdu
)
{
DevAssert
(
pdu
!=
NULL
);
if
(
pdu
==
NULL
)
{
X2AP_ERROR
(
"%s %d: pdu is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
switch
(
pdu
->
choice
.
successfulOutcome
.
procedureCode
)
{
case
X2AP_ProcedureCode_id_x2Setup
:
...
...
@@ -96,7 +100,10 @@ static int x2ap_eNB_decode_successful_outcome(X2AP_X2AP_PDU_t *pdu)
static
int
x2ap_eNB_decode_unsuccessful_outcome
(
X2AP_X2AP_PDU_t
*
pdu
)
{
DevAssert
(
pdu
!=
NULL
);
if
(
pdu
==
NULL
)
{
X2AP_ERROR
(
"%s %d: pdu is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
switch
(
pdu
->
choice
.
unsuccessfulOutcome
.
procedureCode
)
{
case
X2AP_ProcedureCode_id_x2Setup
:
...
...
@@ -117,7 +124,10 @@ int x2ap_eNB_decode_pdu(X2AP_X2AP_PDU_t *pdu, const uint8_t *const buffer, uint3
{
asn_dec_rval_t
dec_ret
;
DevAssert
(
buffer
!=
NULL
);
if
(
buffer
==
NULL
)
{
X2AP_ERROR
(
"%s %d: buffer is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
dec_ret
=
aper_decode
(
NULL
,
&
asn_DEF_X2AP_X2AP_PDU
,
...
...
openair2/X2AP/x2ap_eNB_encoder.c
View file @
53daef42
...
...
@@ -40,9 +40,20 @@ int x2ap_eNB_encode_pdu(X2AP_X2AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len)
{
ssize_t
encoded
;
DevAssert
(
pdu
!=
NULL
);
DevAssert
(
buffer
!=
NULL
);
DevAssert
(
len
!=
NULL
);
if
(
pdu
==
NULL
)
{
X2AP_ERROR
(
"%s %d: pdu is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
if
(
buffer
==
NULL
)
{
X2AP_ERROR
(
"%s %d: buffer is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
if
(
len
==
NULL
)
{
X2AP_ERROR
(
"%s %d: len is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
if
(
asn1_xer_print
)
{
xer_fprint
(
stdout
,
&
asn_DEF_X2AP_X2AP_PDU
,
(
void
*
)
pdu
);
...
...
openair2/X2AP/x2ap_eNB_generate_messages.c
View file @
53daef42
...
...
@@ -56,9 +56,17 @@ int x2ap_eNB_generate_x2_setup_request(
uint8_t
*
buffer
;
uint32_t
len
;
int
ret
=
0
;
int
flag
=
0
;
DevAssert
(
instance_p
!=
NULL
);
DevAssert
(
x2ap_eNB_data_p
!=
NULL
);
if
(
instance_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: instance_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
if
(
x2ap_eNB_data_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: x2ap_eNB_data_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
x2ap_eNB_data_p
->
state
=
X2AP_ENB_STATE_WAITING
;
...
...
@@ -139,7 +147,8 @@ int x2ap_eNB_generate_x2_setup_request(
servedCellMember
->
servedCellInfo
.
eUTRA_Mode_Info
.
choice
.
fDD
.
dL_Transmission_Bandwidth
=
X2AP_Transmission_Bandwidth_bw100
;
break
;
default:
AssertFatal
(
0
,
"Failed: Check value for N_RB_DL/N_RB_UL"
);
X2AP_ERROR
(
"Failed: Check value for N_RB_DL/N_RB_UL,N_RB_DL: %d
\n
"
,
instance_p
->
N_RB_DL
[
i
]);
flag
=
-
1
;
break
;
}
}
...
...
@@ -169,7 +178,8 @@ int x2ap_eNB_generate_x2_setup_request(
servedCellMember
->
servedCellInfo
.
eUTRA_Mode_Info
.
choice
.
tDD
.
subframeAssignment
=
X2AP_SubframeAssignment_sa6
;
break
;
default:
AssertFatal
(
0
,
"Failed: Check value for subframeAssignment"
);
X2AP_ERROR
(
"Failed: Check value for subframeAssignment,subframeAssignment: %d
\n
"
,
instance_p
->
subframeAssignment
[
i
]);
flag
=
-
1
;
break
;
}
switch
(
instance_p
->
specialSubframe
[
i
])
{
...
...
@@ -201,7 +211,8 @@ int x2ap_eNB_generate_x2_setup_request(
servedCellMember
->
servedCellInfo
.
eUTRA_Mode_Info
.
choice
.
tDD
.
specialSubframe_Info
.
specialSubframePatterns
=
X2AP_SpecialSubframePatterns_ssp8
;
break
;
default:
AssertFatal
(
0
,
"Failed: Check value for subframeAssignment"
);
X2AP_ERROR
(
"Failed: Check value for subframeAssignment,specialSubframe: %d
\n
"
,
instance_p
->
specialSubframe
[
i
]);
flag
=
-
1
;
break
;
}
servedCellMember
->
servedCellInfo
.
eUTRA_Mode_Info
.
choice
.
tDD
.
specialSubframe_Info
.
cyclicPrefixDL
=
X2AP_CyclicPrefixDL_normal
;
...
...
@@ -227,7 +238,8 @@ int x2ap_eNB_generate_x2_setup_request(
servedCellMember
->
servedCellInfo
.
eUTRA_Mode_Info
.
choice
.
tDD
.
transmission_Bandwidth
=
X2AP_Transmission_Bandwidth_bw100
;
break
;
default:
AssertFatal
(
0
,
"Failed: Check value for N_RB_DL/N_RB_UL"
);
X2AP_ERROR
(
"Failed: Check value for N_RB_DL/N_RB_UL,N_RB_DL: %d
\n
"
,
instance_p
->
N_RB_DL
[
i
]);
flag
=
-
1
;
break
;
}
}
...
...
@@ -254,8 +266,15 @@ int x2ap_eNB_generate_x2_setup_request(
}
ASN_SEQUENCE_ADD
(
&
out
->
protocolIEs
.
list
,
ie
);
if
(
flag
==
-
1
)
{
X2AP_ERROR
(
"Failed to create X2 setup request
\n
"
);
asn_sequence_empty
(
&
out
->
protocolIEs
.
list
);
return
-
1
;
}
if
(
x2ap_eNB_encode_pdu
(
&
pdu
,
&
buffer
,
&
len
)
<
0
)
{
X2AP_ERROR
(
"Failed to encode X2 setup request
\n
"
);
asn_sequence_empty
(
&
out
->
protocolIEs
.
list
);
return
-
1
;
}
...
...
@@ -278,9 +297,17 @@ int x2ap_eNB_generate_x2_setup_response(x2ap_eNB_instance_t *instance_p, x2ap_eN
uint8_t
*
buffer
;
uint32_t
len
;
int
ret
=
0
;
int
flag
=
0
;
if
(
instance_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: instance_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
DevAssert
(
instance_p
!=
NULL
);
DevAssert
(
x2ap_eNB_data_p
!=
NULL
);
if
(
x2ap_eNB_data_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: x2ap_eNB_data_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
/* Prepare the X2AP message to encode */
memset
(
&
pdu
,
0
,
sizeof
(
pdu
));
...
...
@@ -359,7 +386,8 @@ int x2ap_eNB_generate_x2_setup_response(x2ap_eNB_instance_t *instance_p, x2ap_eN
servedCellMember
->
servedCellInfo
.
eUTRA_Mode_Info
.
choice
.
fDD
.
dL_Transmission_Bandwidth
=
X2AP_Transmission_Bandwidth_bw100
;
break
;
default:
AssertFatal
(
0
,
"Failed: Check value for N_RB_DL/N_RB_UL"
);
X2AP_ERROR
(
"Failed: Check value for N_RB_DL/N_RB_UL,N_RB_DL: %d
\n
"
,
instance_p
->
N_RB_DL
[
i
]);
flag
=
-
1
;
break
;
}
}
...
...
@@ -389,7 +417,8 @@ int x2ap_eNB_generate_x2_setup_response(x2ap_eNB_instance_t *instance_p, x2ap_eN
servedCellMember
->
servedCellInfo
.
eUTRA_Mode_Info
.
choice
.
tDD
.
subframeAssignment
=
X2AP_SubframeAssignment_sa6
;
break
;
default:
AssertFatal
(
0
,
"Failed: Check value for subframeAssignment"
);
X2AP_ERROR
(
"Failed: Check value for subframeAssignment,subframeAssignment: %d
\n
"
,
instance_p
->
subframeAssignment
[
i
]);
flag
=
-
1
;
break
;
}
switch
(
instance_p
->
specialSubframe
[
i
])
{
...
...
@@ -421,7 +450,8 @@ int x2ap_eNB_generate_x2_setup_response(x2ap_eNB_instance_t *instance_p, x2ap_eN
servedCellMember
->
servedCellInfo
.
eUTRA_Mode_Info
.
choice
.
tDD
.
specialSubframe_Info
.
specialSubframePatterns
=
X2AP_SpecialSubframePatterns_ssp8
;
break
;
default:
AssertFatal
(
0
,
"Failed: Check value for subframeAssignment"
);
X2AP_ERROR
(
"Failed: Check value for specialSubframe,specialSubframe: %d
\n
"
,
instance_p
->
specialSubframe
[
i
]);
flag
=
-
1
;
break
;
}
servedCellMember
->
servedCellInfo
.
eUTRA_Mode_Info
.
choice
.
tDD
.
specialSubframe_Info
.
cyclicPrefixDL
=
X2AP_CyclicPrefixDL_normal
;
...
...
@@ -447,7 +477,8 @@ int x2ap_eNB_generate_x2_setup_response(x2ap_eNB_instance_t *instance_p, x2ap_eN
servedCellMember
->
servedCellInfo
.
eUTRA_Mode_Info
.
choice
.
tDD
.
transmission_Bandwidth
=
X2AP_Transmission_Bandwidth_bw100
;
break
;
default:
AssertFatal
(
0
,
"Failed: Check value for N_RB_DL/N_RB_UL"
);
X2AP_ERROR
(
"Failed: Check value for N_RB_DL/N_RB_UL,N_RB_DL: %d
\n
"
,
instance_p
->
N_RB_DL
[
i
]);
flag
=
-
1
;
break
;
}
}
...
...
@@ -474,8 +505,15 @@ int x2ap_eNB_generate_x2_setup_response(x2ap_eNB_instance_t *instance_p, x2ap_eN
}
ASN_SEQUENCE_ADD
(
&
out
->
protocolIEs
.
list
,
ie
);
if
(
flag
==
-
1
)
{
X2AP_ERROR
(
"Failed to create X2 setup response
\n
"
);
asn_sequence_empty
(
&
out
->
protocolIEs
.
list
);
return
-
1
;
}
if
(
x2ap_eNB_encode_pdu
(
&
pdu
,
&
buffer
,
&
len
)
<
0
)
{
X2AP_ERROR
(
"Failed to encode X2 setup response
\n
"
);
asn_sequence_empty
(
&
out
->
protocolIEs
.
list
);
return
-
1
;
}
...
...
@@ -552,7 +590,10 @@ int x2ap_eNB_set_cause (X2AP_Cause_t * cause_p,
long
cause_value
)
{
DevAssert
(
cause_p
!=
NULL
);
if
(
cause_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: cause_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
cause_p
->
present
=
cause_type
;
switch
(
cause_type
)
{
...
...
@@ -594,8 +635,15 @@ int x2ap_eNB_generate_x2_handover_request (x2ap_eNB_instance_t *instance_p, x2ap
uint32_t
len
;
int
ret
=
0
;
DevAssert
(
instance_p
!=
NULL
);
DevAssert
(
x2ap_eNB_data_p
!=
NULL
);
if
(
instance_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: instance_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
if
(
x2ap_eNB_data_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: x2ap_eNB_data_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
/* Prepare the X2AP handover message to encode */
memset
(
&
pdu
,
0
,
sizeof
(
pdu
));
...
...
@@ -723,7 +771,7 @@ int x2ap_eNB_generate_x2_handover_request (x2ap_eNB_instance_t *instance_p, x2ap
if
(
x2ap_eNB_encode_pdu
(
&
pdu
,
&
buffer
,
&
len
)
<
0
)
{
X2AP_ERROR
(
"Failed to encode X2 handover request
\n
"
);
a
bort
(
);
a
sn_sequence_empty
(
&
out
->
protocolIEs
.
list
);
return
-
1
;
}
...
...
@@ -751,8 +799,15 @@ int x2ap_eNB_generate_x2_handover_request_ack (x2ap_eNB_instance_t *instance_p,
uint32_t
len
;
int
ret
=
0
;
DevAssert
(
instance_p
!=
NULL
);
DevAssert
(
x2ap_eNB_data_p
!=
NULL
);
if
(
instance_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: instance_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
if
(
x2ap_eNB_data_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: x2ap_eNB_data_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
ue_id
=
x2ap_handover_req_ack
->
x2_id_target
;
id_source
=
x2ap_id_get_id_source
(
&
instance_p
->
id_manager
,
ue_id
);
...
...
@@ -837,7 +892,7 @@ int x2ap_eNB_generate_x2_handover_request_ack (x2ap_eNB_instance_t *instance_p,
if
(
x2ap_eNB_encode_pdu
(
&
pdu
,
&
buffer
,
&
len
)
<
0
)
{
X2AP_ERROR
(
"Failed to encode X2 handover response
\n
"
);
a
bort
(
);
a
sn_sequence_empty
(
&
out
->
protocolIEs
.
list
);
return
-
1
;
}
...
...
@@ -862,13 +917,21 @@ int x2ap_eNB_generate_x2_ue_context_release (x2ap_eNB_instance_t *instance_p, x2
uint32_t
len
;
int
ret
=
0
;
DevAssert
(
instance_p
!=
NULL
);
DevAssert
(
x2ap_eNB_data_p
!=
NULL
);
if
(
instance_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: instance_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
if
(
x2ap_eNB_data_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: x2ap_eNB_data_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
ue_id
=
x2ap_find_id_from_rnti
(
&
instance_p
->
id_manager
,
x2ap_ue_context_release
->
rnti
);
if
(
ue_id
==
-
1
)
{
X2AP_ERROR
(
"could not find UE %x
\n
"
,
x2ap_ue_context_release
->
rnti
);
exit
(
1
);
//exit(1);
return
-
1
;
}
id_source
=
x2ap_id_get_id_source
(
&
instance_p
->
id_manager
,
ue_id
);
id_target
=
ue_id
;
...
...
@@ -899,7 +962,7 @@ int x2ap_eNB_generate_x2_ue_context_release (x2ap_eNB_instance_t *instance_p, x2
if
(
x2ap_eNB_encode_pdu
(
&
pdu
,
&
buffer
,
&
len
)
<
0
)
{
X2AP_ERROR
(
"Failed to encode X2 UE Context Release
\n
"
);
a
bort
(
);
a
sn_sequence_empty
(
&
out
->
protocolIEs
.
list
);
return
-
1
;
}
...
...
@@ -925,8 +988,15 @@ int x2ap_eNB_generate_x2_handover_cancel (x2ap_eNB_instance_t *instance_p, x2ap_
uint32_t
len
;
int
ret
=
0
;
DevAssert
(
instance_p
!=
NULL
);
DevAssert
(
x2ap_eNB_data_p
!=
NULL
);
if
(
instance_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: instance_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
if
(
x2ap_eNB_data_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: x2ap_eNB_data_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
ue_id
=
x2_ue_id
;
id_source
=
ue_id
;
...
...
@@ -983,7 +1053,7 @@ int x2ap_eNB_generate_x2_handover_cancel (x2ap_eNB_instance_t *instance_p, x2ap_
if
(
x2ap_eNB_encode_pdu
(
&
pdu
,
&
buffer
,
&
len
)
<
0
)
{
X2AP_ERROR
(
"Failed to encode X2 Handover Cancel
\n
"
);
a
bort
(
);
a
sn_sequence_empty
(
&
out
->
protocolIEs
.
list
);
return
-
1
;
}
...
...
openair2/X2AP/x2ap_eNB_handler.c
View file @
53daef42
...
...
@@ -177,7 +177,10 @@ int x2ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stre
X2AP_X2AP_PDU_t
pdu
;
int
ret
=
0
;
DevAssert
(
data
!=
NULL
);
if
(
data
==
NULL
)
{
X2AP_ERROR
(
"%s %d: data is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
memset
(
&
pdu
,
0
,
sizeof
(
pdu
));
...
...
@@ -294,7 +297,11 @@ x2ap_eNB_handle_x2_setup_request(instance_t instance,
MessageDef
*
msg
;
uint32_t
eNB_id
=
0
;
DevAssert
(
pdu
!=
NULL
);
if
(
pdu
==
NULL
)
{
X2AP_ERROR
(
"%s %d: pdu is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
x2SetupRequest
=
&
pdu
->
choice
.
initiatingMessage
.
value
.
choice
.
X2SetupRequest
;
/*
...
...
@@ -407,7 +414,10 @@ x2ap_eNB_handle_x2_setup_request(instance_t instance,
}
instance_p
=
x2ap_eNB_get_instance
(
instance
);
DevAssert
(
instance_p
!=
NULL
);
if
(
instance_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: instance_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
itti_send_msg_to_task
(
TASK_RRC_ENB
,
instance_p
->
instance
,
msg
);
...
...
@@ -430,7 +440,11 @@ int x2ap_eNB_handle_x2_setup_response(instance_t instance,
MessageDef
*
msg
;
uint32_t
eNB_id
=
0
;
DevAssert
(
pdu
!=
NULL
);
if
(
pdu
==
NULL
)
{
X2AP_ERROR
(
"%s %d: pdu is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
x2SetupResponse
=
&
pdu
->
choice
.
successfulOutcome
.
value
.
choice
.
X2SetupResponse
;
/*
...
...
@@ -531,7 +545,10 @@ int x2ap_eNB_handle_x2_setup_response(instance_t instance,
x2ap_eNB_data
->
state
=
X2AP_ENB_STATE_READY
;
instance_p
=
x2ap_eNB_get_instance
(
instance
);
DevAssert
(
instance_p
!=
NULL
);
if
(
instance_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: instance_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
instance_p
->
x2_target_enb_associated_nb
++
;
x2ap_handle_x2_setup_message
(
instance_p
,
x2ap_eNB_data
,
0
);
...
...
@@ -554,7 +571,10 @@ int x2ap_eNB_handle_x2_setup_failure(instance_t instance,
x2ap_eNB_instance_t
*
instance_p
;
x2ap_eNB_data_t
*
x2ap_eNB_data
;
DevAssert
(
pdu
!=
NULL
);
if
(
pdu
==
NULL
)
{
X2AP_ERROR
(
"%s %d: pdu is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
x2SetupFailure
=
&
pdu
->
choice
.
unsuccessfulOutcome
.
value
.
choice
.
X2SetupFailure
;
...
...
@@ -594,7 +614,10 @@ int x2ap_eNB_handle_x2_setup_failure(instance_t instance,
x2ap_eNB_data
->
state
=
X2AP_ENB_STATE_WAITING
;
instance_p
=
x2ap_eNB_get_instance
(
instance
);
DevAssert
(
instance_p
!=
NULL
);
if
(
instance_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: instance_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
x2ap_handle_x2_setup_message
(
instance_p
,
x2ap_eNB_data
,
0
);
...
...
@@ -619,7 +642,11 @@ int x2ap_eNB_handle_handover_preparation (instance_t instance,
MessageDef
*
msg
;
int
ue_id
;
DevAssert
(
pdu
!=
NULL
);
if
(
pdu
==
NULL
)
{
X2AP_ERROR
(
"%s %d: pdu is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
x2HandoverRequest
=
&
pdu
->
choice
.
initiatingMessage
.
value
.
choice
.
HandoverRequest
;
if
(
stream
==
0
)
{
...
...
@@ -631,10 +658,16 @@ int x2ap_eNB_handle_handover_preparation (instance_t instance,
X2AP_DEBUG
(
"Received a new X2 handover request
\n
"
);
x2ap_eNB_data
=
x2ap_get_eNB
(
NULL
,
assoc_id
,
0
);
DevAssert
(
x2ap_eNB_data
!=
NULL
);
if
(
x2ap_eNB_data
==
NULL
)
{
X2AP_ERROR
(
"%s %d: x2ap_eNB_data is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
instance_p
=
x2ap_eNB_get_instance
(
instance
);
DevAssert
(
instance_p
!=
NULL
);
if
(
instance_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: instance_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
msg
=
itti_alloc_new_message
(
TASK_X2AP
,
X2AP_HANDOVER_REQ
);
...
...
@@ -650,7 +683,8 @@ int x2ap_eNB_handle_handover_preparation (instance_t instance,
if
(
ue_id
==
-
1
)
{
X2AP_ERROR
(
"could not allocate a new X2AP UE ID
\n
"
);
/* TODO: cancel handover: send HO preparation failure to source eNB */
exit
(
1
);
//exit(1);
return
-
1
;
}
/* rnti is unknown yet, must not be set to -1, 0 is fine */
x2ap_set_ids
(
&
instance_p
->
id_manager
,
ue_id
,
0
,
ie
->
value
.
choice
.
UE_X2AP_ID
,
ue_id
);
...
...
@@ -730,10 +764,6 @@ int x2ap_eNB_handle_handover_preparation (instance_t instance,
X2AP_RRC_Context_t
*
c
=
&
ie
->
value
.
choice
.
UE_ContextInformation
.
rRC_Context
;
if
(
c
->
size
>
8192
/* TODO: this is the size of rrc_buffer in struct x2ap_handover_req_s */
)
{
printf
(
"%s:%d: fatal: buffer too big
\n
"
,
__FILE__
,
__LINE__
);
abort
();
}
memcpy
(
X2AP_HANDOVER_REQ
(
msg
).
rrc_buffer
,
c
->
buf
,
c
->
size
);
X2AP_HANDOVER_REQ
(
msg
).
rrc_buffer_size
=
c
->
size
;
itti_send_msg_to_task
(
TASK_RRC_ENB
,
instance_p
->
instance
,
msg
);
...
...
@@ -760,7 +790,10 @@ int x2ap_eNB_handle_handover_response (instance_t instance,
int
id_target
;
int
rnti
;
DevAssert
(
pdu
!=
NULL
);
if
(
pdu
==
NULL
)
{
X2AP_ERROR
(
"%s %d: pdu is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
x2HandoverRequestAck
=
&
pdu
->
choice
.
successfulOutcome
.
value
.
choice
.
HandoverRequestAcknowledge
;
if
(
stream
==
0
)
{
...
...
@@ -772,10 +805,16 @@ int x2ap_eNB_handle_handover_response (instance_t instance,
X2AP_DEBUG
(
"Received a new X2 handover response
\n
"
);
x2ap_eNB_data
=
x2ap_get_eNB
(
NULL
,
assoc_id
,
0
);
DevAssert
(
x2ap_eNB_data
!=
NULL
);
if
(
x2ap_eNB_data
==
NULL
)
{
X2AP_ERROR
(
"%s %d: x2ap_eNB_data is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
instance_p
=
x2ap_eNB_get_instance
(
instance
);
DevAssert
(
instance_p
!=
NULL
);
if
(
instance_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: instance_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
msg
=
itti_alloc_new_message
(
TASK_X2AP
,
X2AP_HANDOVER_REQ_ACK
);
...
...
@@ -873,9 +912,6 @@ int x2ap_eNB_handle_handover_response (instance_t instance,
X2AP_TargeteNBtoSource_eNBTransparentContainer_t
*
c
=
&
ie
->
value
.
choice
.
TargeteNBtoSource_eNBTransparentContainer
;
if
(
c
->
size
>
1024
/* TODO: this is the size of rrc_buffer in struct x2ap_handover_req_ack_s */
)
{
printf
(
"%s:%d: fatal: buffer too big
\n
"
,
__FILE__
,
__LINE__
);
abort
();
}
memcpy
(
X2AP_HANDOVER_REQ_ACK
(
msg
).
rrc_buffer
,
c
->
buf
,
c
->
size
);
X2AP_HANDOVER_REQ_ACK
(
msg
).
rrc_buffer_size
=
c
->
size
;
...
...
@@ -900,7 +936,10 @@ int x2ap_eNB_handle_ue_context_release (instance_t instance,
int
id_source
;
int
id_target
;
DevAssert
(
pdu
!=
NULL
);
if
(
pdu
==
NULL
)
{
X2AP_ERROR
(
"%s %d: pdu is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
x2UEContextRelease
=
&
pdu
->
choice
.
initiatingMessage
.
value
.
choice
.
UEContextRelease
;
if
(
stream
==
0
)
{
...
...
@@ -912,10 +951,16 @@ int x2ap_eNB_handle_ue_context_release (instance_t instance,
X2AP_DEBUG
(
"Received a new X2 ue context release
\n
"
);
x2ap_eNB_data
=
x2ap_get_eNB
(
NULL
,
assoc_id
,
0
);
DevAssert
(
x2ap_eNB_data
!=
NULL
);
if
(
x2ap_eNB_data
==
NULL
)
{
X2AP_ERROR
(
"%s %d: x2ap_eNB_data is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
instance_p
=
x2ap_eNB_get_instance
(
instance
);
DevAssert
(
instance_p
!=
NULL
);
if
(
instance_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: instance_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
msg
=
itti_alloc_new_message
(
TASK_X2AP
,
X2AP_UE_CONTEXT_RELEASE
);
...
...
@@ -983,7 +1028,10 @@ int x2ap_eNB_handle_handover_cancel (instance_t instance,
int
id_target
;
x2ap_handover_cancel_cause_t
cause
;
DevAssert
(
pdu
!=
NULL
);
if
(
pdu
==
NULL
)
{
X2AP_ERROR
(
"%s %d: pdu is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
x2HandoverCancel
=
&
pdu
->
choice
.
initiatingMessage
.
value
.
choice
.
HandoverCancel
;
if
(
stream
==
0
)
{
...
...
@@ -994,10 +1042,16 @@ int x2ap_eNB_handle_handover_cancel (instance_t instance,
X2AP_DEBUG
(
"Received a new X2 handover cancel
\n
"
);
x2ap_eNB_data
=
x2ap_get_eNB
(
NULL
,
assoc_id
,
0
);
DevAssert
(
x2ap_eNB_data
!=
NULL
);
if
(
x2ap_eNB_data
==
NULL
)
{
X2AP_ERROR
(
"%s %d: x2ap_eNB_data is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
instance_p
=
x2ap_eNB_get_instance
(
instance
);
DevAssert
(
instance_p
!=
NULL
);
if
(
instance_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: instance_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
X2AP_FIND_PROTOCOLIE_BY_ID
(
X2AP_HandoverCancel_IEs_t
,
ie
,
x2HandoverCancel
,
X2AP_ProtocolIE_ID_id_Old_eNB_UE_X2AP_ID
,
true
);
...
...
@@ -1059,7 +1113,8 @@ int x2ap_eNB_handle_handover_cancel (instance_t instance,
id_source
,
x2ap_id_get_id_target
(
&
instance_p
->
id_manager
,
ue_id
),
id_target
);
exit
(
1
);
//exit(1);
return
-
1
;
}
msg
=
itti_alloc_new_message
(
TASK_X2AP
,
X2AP_HANDOVER_CANCEL
);
...
...
openair2/X2AP/x2ap_eNB_management_procedures.c
View file @
53daef42
...
...
@@ -92,7 +92,10 @@ void x2ap_eNB_prepare_internal_data(void)
void
x2ap_eNB_insert_new_instance
(
x2ap_eNB_instance_t
*
new_instance_p
)
{
DevAssert
(
new_instance_p
!=
NULL
);
if
(
new_instance_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: new_instance_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
STAILQ_INSERT_TAIL
(
&
x2ap_eNB_internal_data
.
x2ap_eNB_instances_head
,
new_instance_p
,
x2ap_eNB_entries
);
...
...
@@ -255,3 +258,17 @@ x2ap_eNB_data_t * x2ap_is_eNB_assoc_id_in_list (const uint32_t sctp_assoc_id)
}
return
NULL
;
}
void
x2ap_remove_eNB
(
x2ap_eNB_instance_t
*
instance_p
,
x2ap_eNB_data_t
*
x2ap_enb_data_p
)
{
printf
(
"x2ap_remove_eNB (removing)
\n
"
);
if
(
instance_p
==
NULL
)
{
STAILQ_FOREACH
(
instance_p
,
&
x2ap_eNB_internal_data
.
x2ap_eNB_instances_head
,
x2ap_eNB_entries
)
{
RB_REMOVE
(
x2ap_enb_map
,
&
instance_p
->
x2ap_enb_head
,
x2ap_enb_data_p
);
}
}
else
{
RB_REMOVE
(
x2ap_enb_map
,
&
instance_p
->
x2ap_enb_head
,
x2ap_enb_data_p
);
}
free
(
x2ap_enb_data_p
);
}
openair2/X2AP/x2ap_eNB_management_procedures.h
View file @
53daef42
...
...
@@ -51,4 +51,5 @@ struct x2ap_eNB_data_s *x2ap_get_eNB(x2ap_eNB_instance_t *instance_p,
int32_t
assoc_id
,
uint16_t
cnx_id
);
void
x2ap_remove_eNB
(
x2ap_eNB_instance_t
*
instance_p
,
x2ap_eNB_data_t
*
x2ap_enb_data_p
);
#endif
/* X2AP_ENB_MANAGEMENT_PROCEDURES_H_ */
openair2/X2AP/x2ap_timers.c
View file @
53daef42
...
...
@@ -47,7 +47,10 @@ void x2ap_check_timers(instance_t instance)
int
x2_ongoing
;
instance_p
=
x2ap_eNB_get_instance
(
instance
);
DevAssert
(
instance_p
!=
NULL
);
if
(
instance_p
==
NULL
)
{
X2AP_ERROR
(
"%s %d: instance_p is a NULL pointer
\n
"
,
__FILE__
,
__LINE__
);
return
;
}
t
=
&
instance_p
->
timers
;
m
=
&
instance_p
->
id_manager
;
...
...
openair3/SCTP/sctp_eNB_task.c
View file @
53daef42
...
...
@@ -805,7 +805,7 @@ static int sctp_create_new_listener(
return
-
1
;
}
if
(
listen
(
sd
,
5
)
<
0
)
{
if
(
listen
(
sd
,
6
)
<
0
)
{
SCTP_ERROR
(
"listen: %s:%d
\n
"
,
strerror
(
errno
),
errno
);
free
(
sctp_cnx
);
sctp_cnx
=
NULL
;
...
...
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