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
ZhouShuya
OpenXG-RAN
Commits
753c2f44
Commit
753c2f44
authored
Mar 10, 2019
by
frtabu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apply astyle, fix compilation warnings in raw aeth transport and kernel modules
parent
49f4bdc2
Changes
23
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
1612 additions
and
1738 deletions
+1612
-1738
openair1/PHY/INIT/lte_param_init.c
openair1/PHY/INIT/lte_param_init.c
+22
-44
openair1/PHY/LTE_TRANSPORT/dci.c
openair1/PHY/LTE_TRANSPORT/dci.c
+85
-151
openair1/PHY/LTE_TRANSPORT/pss.c
openair1/PHY/LTE_TRANSPORT/pss.c
+20
-27
openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c
openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c
+0
-1
openair1/SIMULATION/LTE_PHY/dlsim.c
openair1/SIMULATION/LTE_PHY/dlsim.c
+9
-7
openair1/SIMULATION/LTE_PHY/ulsim.c
openair1/SIMULATION/LTE_PHY/ulsim.c
+0
-2
openair2/LAYER2/PDCP_v10.1.0/pdcp.c
openair2/LAYER2/PDCP_v10.1.0/pdcp.c
+136
-135
openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
+9
-12
openair2/LAYER2/RLC/rlc.c
openair2/LAYER2/RLC/rlc.c
+0
-2
openair2/NETWORK_DRIVER/MESH/constant.h
openair2/NETWORK_DRIVER/MESH/constant.h
+2
-1
openair2/NETWORK_DRIVER/MESH/ioctl.h
openair2/NETWORK_DRIVER/MESH/ioctl.h
+2
-1
openair2/RRC/LTE/rrc_UE.c
openair2/RRC/LTE/rrc_UE.c
+27
-29
openair2/RRC/LTE/rrc_eNB.c
openair2/RRC/LTE/rrc_eNB.c
+2
-0
openair2/RRC/NAS/nas_config.c
openair2/RRC/NAS/nas_config.c
+65
-88
openair2/RRC/NAS/nas_config.h
openair2/RRC/NAS/nas_config.h
+13
-6
targets/ARCH/COMMON/common_lib.c
targets/ARCH/COMMON/common_lib.c
+78
-70
targets/ARCH/COMMON/common_lib.h
targets/ARCH/COMMON/common_lib.h
+53
-53
targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c
targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c
+13
-25
targets/RT/USER/lte-ru.c
targets/RT/USER/lte-ru.c
+5
-6
targets/RT/USER/lte-softmodem-common.c
targets/RT/USER/lte-softmodem-common.c
+3
-1
targets/RT/USER/lte-softmodem.c
targets/RT/USER/lte-softmodem.c
+3
-1
targets/RT/USER/lte-ue.c
targets/RT/USER/lte-ue.c
+1063
-1074
targets/RT/USER/lte-uesoftmodem.c
targets/RT/USER/lte-uesoftmodem.c
+2
-2
No files found.
openair1/PHY/INIT/lte_param_init.c
View file @
753c2f44
...
...
@@ -37,27 +37,25 @@
extern
PHY_VARS_eNB
*
eNB
;
extern
PHY_VARS_UE
*
UE
;
extern
RU_t
*
ru
;
extern
void
phy_init_RU
(
RU_t
*
);
extern
void
phy_init_RU
(
RU_t
*
);
void
lte_param_init
(
PHY_VARS_eNB
**
eNBp
,
PHY_VARS_UE
**
UEp
,
RU_t
**
rup
,
unsigned
char
N_tx_port_eNB
,
PHY_VARS_UE
**
UEp
,
RU_t
**
rup
,
unsigned
char
N_tx_port_eNB
,
unsigned
char
N_tx_phy
,
unsigned
char
N_rx_ru
,
unsigned
char
N_rx_ru
,
unsigned
char
N_rx_ue
,
unsigned
char
transmission_mode
,
uint8_t
extended_prefix_flag
,
frame_t
frame_type
,
uint16_t
Nid_cell
,
uint8_t
tdd_config
,
uint8_t
N_RB_DL
,
uint8_t
pa
,
uint8_t
threequarter_fs
,
unsigned
char
transmission_mode
,
uint8_t
extended_prefix_flag
,
frame_t
frame_type
,
uint16_t
Nid_cell
,
uint8_t
tdd_config
,
uint8_t
N_RB_DL
,
uint8_t
pa
,
uint8_t
threequarter_fs
,
uint8_t
osf
,
uint32_t
perfect_ce
)
{
uint32_t
perfect_ce
)
{
LTE_DL_FRAME_PARMS
*
frame_parms
;
int
i
;
PHY_VARS_eNB
*
eNB
;
...
...
@@ -71,23 +69,16 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
UE
=
*
UEp
;
ru
=
*
rup
;
printf
(
"eNB %p, UE %p, ru %p
\n
"
,
eNB
,
UE
,
ru
);
memset
((
void
*
)
eNB
,
0
,
sizeof
(
PHY_VARS_eNB
));
memset
((
void
*
)
UE
,
0
,
sizeof
(
PHY_VARS_UE
));
memset
((
void
*
)
ru
,
0
,
sizeof
(
RU_t
));
memset
((
void
*
)
eNB
,
0
,
sizeof
(
PHY_VARS_eNB
));
memset
((
void
*
)
UE
,
0
,
sizeof
(
PHY_VARS_UE
));
memset
((
void
*
)
ru
,
0
,
sizeof
(
RU_t
));
ru
->
eNB_list
[
0
]
=
eNB
;
eNB
->
RU_list
[
0
]
=
ru
;
ru
->
num_eNB
=
1
;
srand
(
0
);
randominit
(
0
);
set_taus_seed
(
0
);
frame_parms
=
&
(
eNB
->
frame_parms
);
frame_parms
->
N_RB_DL
=
N_RB_DL
;
//50 for 10MHz and 25 for 5 MHz
frame_parms
->
N_RB_UL
=
N_RB_DL
;
frame_parms
->
threequarter_fs
=
threequarter_fs
;
...
...
@@ -106,13 +97,9 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
// frame_parms->Bsrs = 0;
// frame_parms->kTC = 0;44
// frame_parms->n_RRC = 0;
init_frame_parms
(
frame_parms
,
osf
);
//copy_lte_parms_to_phy_framing(frame_parms, &(PHY_config->PHY_framing));
// phy_init_top(frame_parms); //allocation
UE
->
is_secondary_ue
=
0
;
UE
->
frame_parms
=
*
frame_parms
;
UE
->
frame_parms
.
nb_antennas_rx
=
N_rx_ue
;
...
...
@@ -121,14 +108,10 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
ru
->
nb_tx
=
N_tx_phy
;
ru
->
nb_rx
=
N_rx_ru
;
ru
->
if_south
=
LOCAL_RF
;
eNB
->
configured
=
1
;
eNB
->
transmission_mode
[
0
]
=
transmission_mode
;
UE
->
transmission_mode
[
0
]
=
transmission_mode
;
dump_frame_parms
(
frame_parms
);
UE
->
measurements
.
n_adj_cells
=
0
;
UE
->
measurements
.
adj_cell_id
[
0
]
=
Nid_cell
+
1
;
UE
->
measurements
.
adj_cell_id
[
1
]
=
Nid_cell
+
2
;
...
...
@@ -144,7 +127,6 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
phy_init_RU
(
ru
);
generate_pcfich_reg_mapping
(
&
UE
->
frame_parms
);
generate_phich_reg_mapping
(
&
UE
->
frame_parms
);
// DL power control init
//if (transmission_mode == 1) {
UE
->
pdsch_config_dedicated
->
p_a
=
pa
;
...
...
@@ -166,17 +148,13 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
if
(
eNB
->
frame_parms
.
N_RB_DL
==
100
)
ru
->
N_TA_offset
=
624
;
else
if
(
eNB
->
frame_parms
.
N_RB_DL
==
50
)
ru
->
N_TA_offset
=
624
/
2
;
else
if
(
eNB
->
frame_parms
.
N_RB_DL
==
25
)
ru
->
N_TA_offset
=
624
/
4
;
}
else
ru
->
N_TA_offset
=
0
;
}
else
ru
->
N_TA_offset
=
0
;
if
(
IS_SOFTMODEM_BASICSIM
)
/* this is required for the basic simulator in TDD mode
* TODO: find a proper cleaner solution
*/
if
(
IS_SOFTMODEM_BASICSIM
)
/* this is required for the basic simulator in TDD mode
* TODO: find a proper cleaner solution
*/
UE
->
N_TA_offset
=
0
;
printf
(
"Done lte_param_init
\n
"
);
}
openair1/PHY/LTE_TRANSPORT/dci.c
View file @
753c2f44
This diff is collapsed.
Click to expand it.
openair1/PHY/LTE_TRANSPORT/pss.c
View file @
753c2f44
...
...
@@ -44,66 +44,59 @@ int generate_pss(int32_t **txdataF,
short
amp
,
LTE_DL_FRAME_PARMS
*
frame_parms
,
unsigned
short
symbol
,
unsigned
short
slot_offset
)
{
unsigned
short
slot_offset
)
{
unsigned
int
Nsymb
;
unsigned
short
k
,
m
,
aa
,
a
;
uint8_t
Nid2
;
short
*
primary_sync
;
Nid2
=
frame_parms
->
Nid_cell
%
3
;
switch
(
Nid2
)
{
case
0
:
primary_sync
=
primary_synch0
;
break
;
case
0
:
primary_sync
=
primary_synch0
;
break
;
case
1
:
primary_sync
=
primary_synch1
;
break
;
case
1
:
primary_sync
=
primary_synch1
;
break
;
case
2
:
primary_sync
=
primary_synch2
;
break
;
case
2
:
primary_sync
=
primary_synch2
;
break
;
default:
LOG_E
(
PHY
,
"[PSS] eNb_id has to be 0,1,2
\n
"
);
return
(
-
1
);
default:
LOG_E
(
PHY
,
"[PSS] eNb_id has to be 0,1,2
\n
"
);
return
(
-
1
);
}
a
=
(
frame_parms
->
nb_antenna_ports_eNB
==
1
)
?
amp
:
(
amp
*
ONE_OVER_SQRT2_Q15
)
>>
15
;
//printf("[PSS] amp=%d, a=%d\n",amp,a);
if
(
IS_SOFTMODEM_BASICSIM
)
/* a hack to remove at some point (the UE doesn't synch with 100 RBs) */
/* a hack to remove at some point (the UE doesn't synch with 100 RBs) */
a
=
(
frame_parms
->
nb_antenna_ports_eNB
==
1
)
?
4
*
amp
:
(
amp
*
ONE_OVER_SQRT2_Q15
)
>>
15
;
Nsymb
=
(
frame_parms
->
Ncp
==
NORMAL
)
?
14
:
12
;
for
(
aa
=
0
;
aa
<
frame_parms
->
nb_antenna_ports_eNB
;
aa
++
)
{
// aa = 0;
// The PSS occupies the inner 6 RBs, which start at
k
=
frame_parms
->
ofdm_symbol_size
-
3
*
12
+
5
;
//printf("[PSS] k = %d\n",k);
for
(
m
=
5
;
m
<
67
;
m
++
)
{
((
short
*
)
txdataF
[
aa
])[
2
*
(
slot_offset
*
Nsymb
/
2
*
frame_parms
->
ofdm_symbol_size
+
symbol
*
frame_parms
->
ofdm_symbol_size
+
k
)]
=
(
a
*
primary_sync
[
2
*
m
])
>>
15
;
((
short
*
)
txdataF
[
aa
])[
2
*
(
slot_offset
*
Nsymb
/
2
*
frame_parms
->
ofdm_symbol_size
+
symbol
*
frame_parms
->
ofdm_symbol_size
+
k
)
+
1
]
=
(
a
*
primary_sync
[
2
*
m
+
1
])
>>
15
;
((
short
*
)
txdataF
[
aa
])[
2
*
(
slot_offset
*
Nsymb
/
2
*
frame_parms
->
ofdm_symbol_size
+
symbol
*
frame_parms
->
ofdm_symbol_size
+
k
)]
=
(
a
*
primary_sync
[
2
*
m
])
>>
15
;
((
short
*
)
txdataF
[
aa
])[
2
*
(
slot_offset
*
Nsymb
/
2
*
frame_parms
->
ofdm_symbol_size
+
symbol
*
frame_parms
->
ofdm_symbol_size
+
k
)
+
1
]
=
(
a
*
primary_sync
[
2
*
m
+
1
])
>>
15
;
k
+=
1
;
if
(
k
>=
frame_parms
->
ofdm_symbol_size
)
{
k
++
;
//skip DC
k
-=
frame_parms
->
ofdm_symbol_size
;
}
}
}
...
...
openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c
View file @
753c2f44
...
...
@@ -63,7 +63,6 @@ struct msghdr nas_msg_rx;
#define GRAAL_NETLINK_ID 31
static
int
tun_alloc
(
char
*
dev
)
{
struct
ifreq
ifr
;
int
fd
,
err
;
...
...
openair1/SIMULATION/LTE_PHY/dlsim.c
View file @
753c2f44
...
...
@@ -782,13 +782,15 @@ int main(int argc, char **argv) {
break
;
case
'u'
:
dual_stream_UE
=
1
;
if
(
UE
!=
NULL
)
UE
->
use_ia_receiver
=
1
;
dual_stream_UE
=
1
;
if
(
UE
!=
NULL
)
UE
->
use_ia_receiver
=
1
;
else
{
printf
(
"UE is NULL
\n
"
);
exit
(
-
1
);
}
exit
(
-
1
);
}
if
((
n_tx_port
!=
2
)
||
(
transmission_mode
!=
5
))
{
printf
(
"IA receiver only supported for TM5!"
);
exit
(
-
1
);
...
...
@@ -951,8 +953,8 @@ int main(int argc, char **argv) {
fl_set_object_label
(
form_ue
->
button_0
,
"IA Receiver ON"
);
fl_set_object_color
(
form_ue
->
button_0
,
FL_GREEN
,
FL_GREEN
);
}
else
{
printf
(
"UE is NULL
\n
"
);
exit
(
-
1
);
printf
(
"UE is NULL
\n
"
);
exit
(
-
1
);
}
}
}
...
...
openair1/SIMULATION/LTE_PHY/ulsim.c
View file @
753c2f44
...
...
@@ -1211,9 +1211,7 @@ int main(int argc, char **argv) {
}
dump_ulsch
(
eNB
,
eNB
->
proc
.
frame_rx
,
subframe
,
0
,
round
);
round
=
5
;
}
if
(
n_frames
==
1
)
printf
(
"round %d errors %u/%u
\n
"
,
round
,
errs
[
round
],
trials
);
...
...
openair2/LAYER2/PDCP_v10.1.0/pdcp.c
View file @
753c2f44
This diff is collapsed.
Click to expand it.
openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
View file @
753c2f44
...
...
@@ -145,7 +145,6 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) {
//-----------------------------------------------------------------------------
int
pdcp_fifo_read_input_sdus
(
const
protocol_ctxt_t
*
const
ctxt_pP
)
{
pdcp_data_req_header_t
pdcp_read_header_g
;
if
(
UE_NAS_USE_TUN
||
ENB_NAS_USE_TUN
)
{
protocol_ctxt_t
ctxt
=
*
ctxt_pP
;
...
...
@@ -163,21 +162,19 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t *const ctxt_pP) {
if
(
len
<=
0
)
continue
;
if
(
UE_NAS_USE_TUN
)
{
key
=
PDCP_COLL_KEY_DEFAULT_DRB_VALUE
(
ctxt
.
module_id
,
ctxt
.
rnti
,
ctxt
.
enb_flag
);
h_rc
=
hashtable_get
(
pdcp_coll_p
,
key
,
(
void
**
)
&
pdcp_p
);
key
=
PDCP_COLL_KEY_DEFAULT_DRB_VALUE
(
ctxt
.
module_id
,
ctxt
.
rnti
,
ctxt
.
enb_flag
);
h_rc
=
hashtable_get
(
pdcp_coll_p
,
key
,
(
void
**
)
&
pdcp_p
);
}
else
{
ctxt
.
rnti
=
pdcp_eNB_UE_instance_to_rnti
[
0
];
ctxt
.
enb_flag
=
ENB_FLAG_YES
;
ctxt
.
module_id
=
0
;
key
=
PDCP_COLL_KEY_VALUE
(
ctxt
.
module_id
,
ctxt
.
rnti
,
ctxt
.
enb_flag
,
rab_id
,
SRB_FLAG_YES
);
h_rc
=
hashtable_get
(
pdcp_coll_p
,
key
,
(
void
**
)
&
pdcp_p
);
ctxt
.
rnti
=
pdcp_eNB_UE_instance_to_rnti
[
0
];
ctxt
.
enb_flag
=
ENB_FLAG_YES
;
ctxt
.
module_id
=
0
;
key
=
PDCP_COLL_KEY_VALUE
(
ctxt
.
module_id
,
ctxt
.
rnti
,
ctxt
.
enb_flag
,
rab_id
,
SRB_FLAG_YES
);
h_rc
=
hashtable_get
(
pdcp_coll_p
,
key
,
(
void
**
)
&
pdcp_p
);
}
LOG_D
(
PDCP
,
"PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%x, enb_flag=%d)
\n
"
,
ctxt
.
module_id
,
ctxt
.
rnti
,
ctxt
.
enb_flag
);
LOG_D
(
PDCP
,
"PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%x, enb_flag=%d)
\n
"
,
ctxt
.
module_id
,
ctxt
.
rnti
,
ctxt
.
enb_flag
);
if
(
h_rc
==
HASH_TABLE_OK
)
{
LOG_D
(
PDCP
,
"[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d on Rab %d
\n
"
,
...
...
openair2/LAYER2/RLC/rlc.c
View file @
753c2f44
...
...
@@ -584,14 +584,12 @@ void rlc_data_ind (
const
sdu_size_t
sdu_sizeP
,
mem_block_t
*
sdu_pP
)
{
//-----------------------------------------------------------------------------
LOG_D
(
RLC
,
PROTOCOL_CTXT_FMT
"[%s %u] Display of rlc_data_ind: size %u
\n
"
,
PROTOCOL_CTXT_ARGS
(
ctxt_pP
),
(
srb_flagP
)
?
"SRB"
:
"DRB"
,
rb_idP
,
sdu_sizeP
);
rlc_util_print_hex_octets
(
RLC
,
(
unsigned
char
*
)
sdu_pP
->
data
,
sdu_sizeP
);
#if T_TRACER
if
(
ctxt_pP
->
enb_flag
)
...
...
openair2/NETWORK_DRIVER/MESH/constant.h
View file @
753c2f44
...
...
@@ -47,7 +47,8 @@
#define NAS_INET6_ADDRSTRLEN 46
#define NAS_INET_ADDRSTRLEN 16
#define NAS_CX_MAX 128 // 32 //Identical to RRC constant
#define NAS_CX_MAX 32 //128 //Identical to RRC constant: no you cannot
/* increase to 128 without risking stack problems: KEEP ATTENTION TO COMPILATION WARNINGS */
//#define NAS_CX_MULTICAST_ALLNODE 2
#define NAS_RETRY_LIMIT_DEFAULT 5
...
...
openair2/NETWORK_DRIVER/MESH/ioctl.h
View file @
753c2f44
...
...
@@ -64,7 +64,8 @@
// Max number of entry of a message list
#define NAS_LIST_CX_MAX 32
#define NAS_LIST_RB_MAX 32
#define NAS_LIST_CLASS_MAX 32
#define NAS_LIST_CLASS_MAX 16 // 32 is too high!!:
/* risk of stack problems: KEEP ATTENTION TO COMPILATION WARNINGS */
typedef
unsigned
short
nasMsgType_t
;
...
...
openair2/RRC/LTE/rrc_UE.c
View file @
753c2f44
...
...
@@ -801,7 +801,6 @@ rrc_ue_establish_drb(
(
void
)
ip_addr_offset4
;
LOG_I
(
RRC
,
"[UE %d] Frame %d: processing RRCConnectionReconfiguration: reconfiguring DRB %ld/LCID %d
\n
"
,
ue_mod_idP
,
frameP
,
DRB_config
->
drb_Identity
,
(
int
)
*
DRB_config
->
logicalChannelIdentity
);
/*
rrc_pdcp_config_req (ue_mod_idP+NB_eNB_INST, frameP, 0, CONFIG_ACTION_ADD,
(eNB_index * NB_RB_MAX) + *DRB_config->logicalChannelIdentity, UNDEF_SECURITY_MODE);
...
...
@@ -810,35 +809,34 @@ rrc_ue_establish_drb(
(eNB_index * NB_RB_MAX) + *DRB_config->logicalChannelIdentity,
RADIO_ACCESS_BEARER,Rlc_info_um);
*/
// if(!EPC_MODE_ENABLED) {
//# if !defined(OAI_NW_DRIVER_TYPE_ETHERNET) && !defined(EXMIMO) && !defined(OAI_USRP) && !defined(OAI_BLADERF) && !defined(ETHERNET) && !defined(LINK_ENB_PDCP_TO_GTPV1U)
ip_addr_offset3
=
0
;
ip_addr_offset4
=
1
;
LOG_I
(
OIP
,
"[UE %d] trying to bring up the OAI interface oip%d, IP 10.0.%d.%d
\n
"
,
ue_mod_idP
,
ip_addr_offset3
+
ue_mod_idP
,
ip_addr_offset3
+
ue_mod_idP
+
1
,
ip_addr_offset4
+
ue_mod_idP
+
1
);
oip_ifup
=
nas_config
(
ip_addr_offset3
+
ue_mod_idP
+
1
,
// interface_id
ip_addr_offset3
+
ue_mod_idP
+
1
,
// third_octet
ip_addr_offset4
+
ue_mod_idP
+
1
,
// fourth_octet
"oip"
);
// interface suffix
if
(
oip_ifup
==
0
&&
(
!
UE_NAS_USE_TUN
))
{
// interface is up --> send a config the DRB
LOG_I
(
OIP
,
"[UE %d] Config the ue net interface %d to send/receive pkt on DRB %ld to/from the protocol stack
\n
"
,
ue_mod_idP
,
ip_addr_offset3
+
ue_mod_idP
,
(
long
int
)((
eNB_index
*
LTE_maxDRB
)
+
DRB_config
->
drb_Identity
));
rb_conf_ipv4
(
0
,
//add
ue_mod_idP
,
//cx align with the UE index
ip_addr_offset3
+
ue_mod_idP
,
//inst num_enb+ue_index
(
eNB_index
*
LTE_maxDRB
)
+
DRB_config
->
drb_Identity
,
//rb
0
,
//dscp
ipv4_address
(
ip_addr_offset3
+
ue_mod_idP
+
1
,
ip_addr_offset4
+
ue_mod_idP
+
1
),
//saddr
ipv4_address
(
ip_addr_offset3
+
ue_mod_idP
+
1
,
eNB_index
+
1
));
//daddr
LOG_D
(
RRC
,
"[UE %d] State = Attached (eNB %d)
\n
"
,
ue_mod_idP
,
eNB_index
);
}
//# endif
// }
// if(!EPC_MODE_ENABLED) {
//# if !defined(OAI_NW_DRIVER_TYPE_ETHERNET) && !defined(EXMIMO) && !defined(OAI_USRP) && !defined(OAI_BLADERF) && !defined(ETHERNET) && !defined(LINK_ENB_PDCP_TO_GTPV1U)
ip_addr_offset3
=
0
;
ip_addr_offset4
=
1
;
LOG_I
(
OIP
,
"[UE %d] trying to bring up the OAI interface oip%d, IP 10.0.%d.%d
\n
"
,
ue_mod_idP
,
ip_addr_offset3
+
ue_mod_idP
,
ip_addr_offset3
+
ue_mod_idP
+
1
,
ip_addr_offset4
+
ue_mod_idP
+
1
);
oip_ifup
=
nas_config
(
ip_addr_offset3
+
ue_mod_idP
+
1
,
// interface_id
ip_addr_offset3
+
ue_mod_idP
+
1
,
// third_octet
ip_addr_offset4
+
ue_mod_idP
+
1
,
// fourth_octet
"oip"
);
// interface suffix
if
(
oip_ifup
==
0
&&
(
!
UE_NAS_USE_TUN
))
{
// interface is up --> send a config the DRB
LOG_I
(
OIP
,
"[UE %d] Config the ue net interface %d to send/receive pkt on DRB %ld to/from the protocol stack
\n
"
,
ue_mod_idP
,
ip_addr_offset3
+
ue_mod_idP
,
(
long
int
)((
eNB_index
*
LTE_maxDRB
)
+
DRB_config
->
drb_Identity
));
rb_conf_ipv4
(
0
,
//add
ue_mod_idP
,
//cx align with the UE index
ip_addr_offset3
+
ue_mod_idP
,
//inst num_enb+ue_index
(
eNB_index
*
LTE_maxDRB
)
+
DRB_config
->
drb_Identity
,
//rb
0
,
//dscp
ipv4_address
(
ip_addr_offset3
+
ue_mod_idP
+
1
,
ip_addr_offset4
+
ue_mod_idP
+
1
),
//saddr
ipv4_address
(
ip_addr_offset3
+
ue_mod_idP
+
1
,
eNB_index
+
1
));
//daddr
LOG_D
(
RRC
,
"[UE %d] State = Attached (eNB %d)
\n
"
,
ue_mod_idP
,
eNB_index
);
}
//# endif
// }
return
(
0
);
}
...
...
openair2/RRC/LTE/rrc_eNB.c
View file @
753c2f44
...
...
@@ -6269,6 +6269,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
LOG_D
(
RRC
,
"[eNB %d] Frame %d: Establish RLC UM Bidirectional, DRB %d Active
\n
"
,
ctxt_pP
->
module_id
,
ctxt_pP
->
frame
,
(
int
)
DRB_configList
->
list
.
array
[
i
]
->
drb_Identity
);
if
(
!
EPC_MODE_ENABLED
&&
!
ENB_NAS_USE_TUN
)
{
LOG_I
(
OIP
,
"[eNB %d] trying to bring up the OAI interface oai%d
\n
"
,
ctxt_pP
->
module_id
,
...
...
@@ -6278,6 +6279,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
ctxt_pP
->
module_id
+
1
,
// thrid octet
ctxt_pP
->
module_id
+
1
,
// fourth octet
"oai"
);
if
(
oip_ifup
==
0
)
{
// interface is up --> send a config the DRB
module_id_t
ue_module_id
;
dest_ip_offset
=
8
;
...
...
openair2/RRC/NAS/nas_config.c
View file @
753c2f44
...
...
@@ -45,47 +45,55 @@
#include "nas_config.h"
#include "common/utils/LOG/log.h"
#include "targets/RT/USER/lte-softmodem.h"
#include "common/config/config_userapi.h"
//default values according to the examples,
char
*
baseNetAddress
=
"10.0"
;
char
*
netMask
=
"255.255.255.0"
;
char
*
broadcastAddr
=
"10.0.255.255"
;
char
*
baseNetAddress
;
char
*
netMask
;
char
*
broadcastAddr
;
#define NASHLP_NETPREFIX "<NAS network prefix, two first bytes of network addresses>\n"
#define NASHLP_NETMASK "<NAS network mask>\n"
#define NASHLP_BROADCASTADDR "<NAS network broadcast address>\n"
void
nas_getparams
(
void
)
{
paramdef_t
nasoptions
[]
=
{
/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* configuration parameters for netlink, includes network parameters when running in noS1 mode */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
{
"NetworkPrefix"
,
NASHLP_NETPREFIX
,
0
,
strptr
:&
baseNetAddress
,
defstrval
:
"10.0"
,
TYPE_STRING
,
0
},
{
"NetworkMask"
,
NASHLP_NETMASK
,
0
,
strptr
:&
netMask
,
defstrval
:
"255.255.255.0"
,
TYPE_STRING
,
0
},
{
"BroadcastAddr"
,
NASHLP_BROADCASTADDR
,
0
,
strptr
:&
broadcastAddr
,
defstrval
:
"10.0.255.255"
,
TYPE_STRING
,
0
},
};
config_get
(
nasoptions
,
sizeof
(
nasoptions
)
/
sizeof
(
paramdef_t
),
"nas.noS1"
);
}
void
setBaseNetAddress
(
char
*
baseAddr
)
{
void
setBaseNetAddress
(
char
*
baseAddr
)
{
strcpy
(
baseNetAddress
,
baseAddr
);
}
char
*
getBaseNetAddress
(
void
)
{
char
*
getBaseNetAddress
(
void
)
{
return
baseNetAddress
;
}
void
setNetMask
(
char
*
baseAddr
)
{
void
setNetMask
(
char
*
baseAddr
)
{
strcpy
(
netMask
,
baseAddr
);
}
char
*
getNetMask
(
void
)
{
char
*
getNetMask
(
void
)
{
return
netMask
;
}
void
setBroadcastAddress
(
char
*
baseAddr
)
{
void
setBroadcastAddress
(
char
*
baseAddr
)
{
strcpy
(
broadcastAddr
,
baseAddr
);
}
char
*
getBroadcastAddress
(
void
)
{
char
*
getBroadcastAddress
(
void
)
{
return
broadcastAddr
;
}
//Add Gateway to the interface
int
set_gateway
(
char
*
interfaceName
,
char
*
gateway
)
{
int
set_gateway
(
char
*
interfaceName
,
char
*
gateway
)
{
int
sock_fd
;
struct
rtentry
rt
;
struct
sockaddr_in
addr
;
...
...
@@ -96,20 +104,16 @@ int set_gateway(char *interfaceName, char *gateway)
}
memset
(
&
rt
,
0
,
sizeof
(
rt
));
addr
.
sin_family
=
AF_INET
;
/*set Destination addr*/
inet_aton
(
"0.0.0.0"
,
&
addr
.
sin_addr
);
memcpy
(
&
rt
.
rt_dst
,
&
addr
,
sizeof
(
struct
sockaddr_in
));
/*set gateway addr*/
inet_aton
(
gateway
,
&
addr
.
sin_addr
);
memcpy
(
&
rt
.
rt_gateway
,
&
addr
,
sizeof
(
struct
sockaddr_in
));
/*set genmask addr*/
inet_aton
(
"0.0.0.0"
,
&
addr
.
sin_addr
);
memcpy
(
&
rt
.
rt_genmask
,
&
addr
,
sizeof
(
struct
sockaddr_in
));
rt
.
rt_dev
=
interfaceName
;
//rt.rt_flags = RTF_UP|RTF_GATEWAY|RTF_DEFAULT;
/* SR: rt_flags on 16 bits but RTF_DEFAULT = 0x00010000
...
...
@@ -129,19 +133,16 @@ int set_gateway(char *interfaceName, char *gateway)
LOG_I
(
OIP
,
"set_gateway OK!
\n
"
);
return
0
;
}
}
close
(
sock_fd
);
LOG_D
(
OIP
,
"Set Gateway OK!
\n
"
);
return
0
;
}
// sets a genneric interface parameter
// (SIOCSIFADDR, SIOCSIFNETMASK, SIOCSIFBRDADDR, SIOCSIFFLAGS)
int
setInterfaceParameter
(
char
*
interfaceName
,
char
*
settingAddress
,
int
operation
)
{
int
setInterfaceParameter
(
char
*
interfaceName
,
char
*
settingAddress
,
int
operation
)
{
int
sock_fd
;
struct
ifreq
ifr
;
struct
sockaddr_in
addr
;
...
...
@@ -154,10 +155,8 @@ int setInterfaceParameter(char *interfaceName, char *settingAddress, int operati
memset
(
&
ifr
,
0
,
sizeof
(
ifr
));
strncpy
(
ifr
.
ifr_name
,
interfaceName
,
sizeof
(
ifr
.
ifr_name
)
-
1
);
memset
(
&
addr
,
0
,
sizeof
(
struct
sockaddr_in
));
addr
.
sin_family
=
AF_INET
;
inet_aton
(
settingAddress
,
&
addr
.
sin_addr
);
memcpy
(
&
ifr
.
ifr_ifru
.
ifru_addr
,
&
addr
,
sizeof
(
struct
sockaddr_in
));
...
...
@@ -169,15 +168,13 @@ int setInterfaceParameter(char *interfaceName, char *settingAddress, int operati
}
close
(
sock_fd
);
// printf("Set OK!\n");
return
0
;
}
// sets a genneric interface parameter
// (SIOCSIFADDR, SIOCSIFNETMASK, SIOCSIFBRDADDR, SIOCSIFFLAGS)
int
bringInterfaceUp
(
char
*
interfaceName
,
int
up
)
{
int
bringInterfaceUp
(
char
*
interfaceName
,
int
up
)
{
int
sock_fd
;
struct
ifreq
ifr
;
...
...
@@ -213,8 +210,7 @@ int bringInterfaceUp(char *interfaceName, int up)
return
0
;
}
// non blocking full configuration of the interface (address, net mask, and broadcast mask)
int
NAS_config
(
char
*
interfaceName
,
char
*
ipAddress
,
char
*
networkMask
,
char
*
broadcastAddress
)
{
int
NAS_config
(
char
*
interfaceName
,
char
*
ipAddress
,
char
*
networkMask
,
char
*
broadcastAddress
)
{
bringInterfaceUp
(
interfaceName
,
0
);
// sets the machine address
int
returnValue
=
setInterfaceParameter
(
interfaceName
,
ipAddress
,
SIOCSIFADDR
);
...
...
@@ -229,28 +225,21 @@ int NAS_config(char *interfaceName, char *ipAddress, char *networkMask, char *br
// if(!returnValue)
// returnValue=set_gateway(interfaceName, broadcastAddress);
bringInterfaceUp
(
interfaceName
,
1
);
return
returnValue
;
}
// non blocking full configuration of the interface (address, and the two lest octets of the address)
int
nas_config
(
int
interface_id
,
int
thirdOctet
,
int
fourthOctet
,
char
*
ifname
)
{
int
nas_config
(
int
interface_id
,
int
thirdOctet
,
int
fourthOctet
,
char
*
ifname
)
{
//char buf[5];
char
ipAddress
[
20
];
char
broadcastAddress
[
20
];
char
interfaceName
[
20
];
int
returnValue
;
sprintf
(
ipAddress
,
"10.0.%d.%d"
,
thirdOctet
,
fourthOctet
);
sprintf
(
broadcastAddress
,
"10.0.%d.255"
,
thirdOctet
);
sprintf
(
interfaceName
,
"%s%s%d"
,
(
UE_NAS_USE_TUN
||
ENB_NAS_USE_TUN
)
?
"oaitun_"
:
ifname
,
UE_NAS_USE_TUN
?
"ue"
:
(
ENB_NAS_USE_TUN
?
"enb"
:
""
),
interface_id
);
bringInterfaceUp
(
interfaceName
,
0
);
// sets the machine address
returnValue
=
setInterfaceParameter
(
interfaceName
,
ipAddress
,
SIOCSIFADDR
);
...
...
@@ -264,18 +253,13 @@ int nas_config(int interface_id, int thirdOctet, int fourthOctet, char *ifname)
returnValue
=
setInterfaceParameter
(
interfaceName
,
broadcastAddress
,
SIOCSIFBRDADDR
);
bringInterfaceUp
(
interfaceName
,
1
);
return
returnValue
;
}
// Blocking full configuration of the interface (address, net mask, and broadcast mask)
int
blocking_NAS_config
(
char
*
interfaceName
,
char
*
ipAddress
,
char
*
networkMask
,
char
*
broadcastAddress
)
{
int
blocking_NAS_config
(
char
*
interfaceName
,
char
*
ipAddress
,
char
*
networkMask
,
char
*
broadcastAddress
)
{
char
command
[
200
];
command
[
0
]
=
'\0'
;
strcat
(
command
,
"ifconfig "
);
strncat
(
command
,
interfaceName
,
sizeof
(
command
)
-
strlen
(
command
)
-
1
);
strncat
(
command
,
" "
,
sizeof
(
command
)
-
strlen
(
command
)
-
1
);
...
...
@@ -284,16 +268,13 @@ int blocking_NAS_config(char *interfaceName, char *ipAddress, char *networkMask,
strncat
(
command
,
networkMask
,
sizeof
(
command
)
-
strlen
(
command
)
-
1
);
strncat
(
command
,
" broadcast "
,
sizeof
(
command
)
-
strlen
(
command
)
-
1
);
strncat
(
command
,
broadcastAddress
,
sizeof
(
command
)
-
strlen
(
command
)
-
1
);
// ifconfig nasmesh0 10.0.1.1 networkMask 255.255.255.0 broadcast 10.0.1.255
int
i
=
system
(
command
);
return
i
;
}
// program help
void
helpOptions
(
char
**
argv
)
{
void
helpOptions
(
char
**
argv
)
{
printf
(
"Help for %s
\n
"
,
argv
[
0
]);
printf
(
" -i <interfaceName>
\n
"
);
printf
(
" -a <IP address>
\n
"
);
...
...
@@ -305,13 +286,11 @@ void helpOptions(char **argv)
printf
(
" IP Address: 10.0.1.1
\n
"
);
printf
(
" Net mask: 255.255.255.0
\n
"
);
printf
(
" Broadcast address: [Beginning of the IP address].255
\n
"
);
exit
(
1
);
}
// creates the broadcast address if it wasn't set before
void
createBroadcast
(
char
*
broadcastAddress
)
{
void
createBroadcast
(
char
*
broadcastAddress
)
{
int
pos
=
strlen
(
broadcastAddress
)
-
1
;
while
(
broadcastAddress
[
pos
]
!=
'.'
)
...
...
@@ -333,7 +312,6 @@ int main(int argc,char **argv)
char
ipAddress
[
100
];
char
networkMask
[
100
];
char
broadcastAddress
[
100
];
strcpy
(
interfaceName
,
"oai0"
);
strcpy
(
ipAddress
,
"10.0.1.1"
);
strcpy
(
networkMask
,
"255.255.255.0"
);
...
...
@@ -341,38 +319,38 @@ int main(int argc,char **argv)
while
((
c
=
getopt
(
argc
,
argv
,
"i:a:n:b:h"
))
!=
-
1
)
switch
(
c
)
{
case
'h'
:
helpOptions
(
argv
);
break
;
case
'i'
:
strcpy
(
interfaceName
,
optarg
);
break
;
case
'a'
:
strcpy
(
ipAddress
,
optarg
);
break
;
case
'n'
:
strcpy
(
networkMask
,
optarg
);
break
;
case
'b'
:
strcpy
(
broadcastAddress
,
optarg
);
break
;
case
'?'
:
if
(
isprint
(
optopt
))
fprintf
(
stderr
,
"Unknown option `-%c'.
\n
"
,
optopt
);
else
fprintf
(
stderr
,
"Unknown option character `
\\
x%x'.
\n
"
,
optopt
);
return
1
;
default:
abort
();
case
'h'
:
helpOptions
(
argv
);
break
;
case
'i'
:
strcpy
(
interfaceName
,
optarg
);
break
;
case
'a'
:
strcpy
(
ipAddress
,
optarg
);
break
;
case
'n'
:
strcpy
(
networkMask
,
optarg
);
break
;
case
'b'
:
strcpy
(
broadcastAddress
,
optarg
);
break
;
case
'?'
:
if
(
isprint
(
optopt
))
fprintf
(
stderr
,
"Unknown option `-%c'.
\n
"
,
optopt
);
else
fprintf
(
stderr
,
"Unknown option character `
\\
x%x'.
\n
"
,
optopt
);
return
1
;
default:
abort
();
}
if
(
strlen
(
broadcastAddress
)
==
0
)
{
...
...
@@ -385,7 +363,6 @@ int main(int argc,char **argv)
//test
// setBaseNetAddress("11.11");
// nas_config(interfaceName, 33, 44);
}
#endif
openair2/RRC/NAS/nas_config.h
View file @
753c2f44
...
...
@@ -31,6 +31,13 @@
#include <netinet/in.h>
/*! \fn void void nas_getparams(void)(void)
* \brief This function get parameters used to configure network interface when running in noS1 mode
* \note
* @ingroup ?????
*/
void
nas_getparams
(
void
);
/*! \fn int NAS_config(char*, char*, char*, char*)
* \brief This function initializes the nasmesh interface
* \param[in] interfaceName, the name of the interface, e.g. nasmesh0 or nasmesh1
...
...
@@ -98,7 +105,7 @@ int set_gateway(char *interfaceName, char *gateway);
* \note
* @ingroup ?????
*/
void
setBaseNetAddress
(
char
*
baseAddr
);
void
setBaseNetAddress
(
char
*
baseAddr
);
/*! \fn char* getBaseNetAddress()
* \brief This function returns the basic network address used
...
...
@@ -106,7 +113,7 @@ void setBaseNetAddress(char* baseAddr);
* \note
* @ingroup ?????
*/
char
*
getBaseNetAddress
(
void
);
char
*
getBaseNetAddress
(
void
);
/*! \fn void setNetMask(char*)
* \brief This function sets the new default network mask used
...
...
@@ -114,7 +121,7 @@ char* getBaseNetAddress(void);
* \note
* @ingroup ?????
*/
void
setNetMask
(
char
*
baseAddr
);
void
setNetMask
(
char
*
baseAddr
);
/*! \fn char* getNetMask()
* \brief This function returns the network mask address in use
...
...
@@ -122,7 +129,7 @@ void setNetMask(char* baseAddr);
* \note
* @ingroup ?????
*/
char
*
getNetMask
(
void
);
char
*
getNetMask
(
void
);
/*! \fn coid setBroadcastAddress(char*)
* \brief This function sets the new broadcast address used
...
...
@@ -130,7 +137,7 @@ char* getNetMask(void);
* \note
* @ingroup ?????
*/
void
setBroadcastAddress
(
char
*
baseAddr
);
void
setBroadcastAddress
(
char
*
baseAddr
);
/*! \fn char* getBroadcastAddress()
* \brief This function returns the broadcast address in use
...
...
@@ -138,7 +145,7 @@ void setBroadcastAddress(char* baseAddr);
* \note
* @ingroup ?????
*/
char
*
getBroadcastAddress
(
void
);
char
*
getBroadcastAddress
(
void
);
int
bringInterfaceUp
(
char
*
interfaceName
,
int
up
);
...
...
targets/ARCH/COMMON/common_lib.c
View file @
753c2f44
...
...
@@ -19,8 +19,8 @@
* contact@openairinterface.org
*/
/*! \file common_lib.c
* \brief common APIs for different RF frontend device
/*! \file common_lib.c
* \brief common APIs for different RF frontend device
* \author HongliangXU, Navid Nikaein
* \date 2015
* \version 0.2
...
...
@@ -40,113 +40,121 @@
#include "targets/RT/USER/lte-softmodem.h"
int
set_device
(
openair0_device
*
device
)
{
switch
(
device
->
type
)
{
case
EXMIMO_DEV
:
printf
(
"[%s] has loaded EXPRESS MIMO device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
break
;
case
USRP_B200_DEV
:
printf
(
"[%s] has loaded USRP B200 device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
break
;
case
USRP_X300_DEV
:
printf
(
"[%s] has loaded USRP X300 device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
break
;
case
BLADERF_DEV
:
printf
(
"[%s] has loaded BLADERF device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
break
;
case
LMSSDR_DEV
:
printf
(
"[%s] has loaded LMSSDR device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
break
;
case
IRIS_DEV
:
printf
(
"[%s] has loaded Iris device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
break
;
case
NONE_DEV
:
printf
(
"[%s] has not loaded a HW device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
break
;
default:
printf
(
"[%s] invalid HW device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
return
-
1
;
case
EXMIMO_DEV
:
printf
(
"[%s] has loaded EXPRESS MIMO device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
break
;
case
USRP_B200_DEV
:
printf
(
"[%s] has loaded USRP B200 device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
break
;
case
USRP_X300_DEV
:
printf
(
"[%s] has loaded USRP X300 device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
break
;
case
BLADERF_DEV
:
printf
(
"[%s] has loaded BLADERF device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
break
;
case
LMSSDR_DEV
:
printf
(
"[%s] has loaded LMSSDR device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
break
;
case
IRIS_DEV
:
printf
(
"[%s] has loaded Iris device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
break
;
case
NONE_DEV
:
printf
(
"[%s] has not loaded a HW device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
break
;
default:
printf
(
"[%s] invalid HW device.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
return
-
1
;
}
return
0
;
}
int
set_transport
(
openair0_device
*
device
)
{
switch
(
device
->
transp_type
)
{
case
ETHERNET_TP
:
printf
(
"[%s] has loaded ETHERNET trasport protocol.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
return
0
;
break
;
case
NONE_TP
:
printf
(
"[%s] has not loaded a transport protocol.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
return
0
;
break
;
default:
printf
(
"[%s] invalid transport protocol.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
return
-
1
;
break
;
case
ETHERNET_TP
:
printf
(
"[%s] has loaded ETHERNET trasport protocol.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
return
0
;
break
;
case
NONE_TP
:
printf
(
"[%s] has not loaded a transport protocol.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
return
0
;
break
;
default:
printf
(
"[%s] invalid transport protocol.
\n
"
,((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
));
return
-
1
;
break
;
}
}
typedef
int
(
*
devfunc_t
)(
openair0_device
*
,
openair0_config_t
*
,
eth_params_t
*
);
/* look for the interface library and load it */
int
load_lib
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
eth_params_t
*
cfg
,
uint8_t
flag
)
{
int
load_lib
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
eth_params_t
*
cfg
,
uint8_t
flag
)
{
loader_shlibfunc_t
shlib_fdesc
[
1
];
int
ret
=
0
;
char
*
libname
;
if
(
IS_SOFTMODEM_BASICSIM
)
{
libname
=
OAI_BASICSIM_LIBNAME
;
shlib_fdesc
[
0
].
fname
=
"device_init"
;
}
else
if
(
IS_SOFTMODEM_RFSIM
)
{
libname
=
OAI_RFSIM_LIBNAME
;
shlib_fdesc
[
0
].
fname
=
"device_init"
;
libname
=
OAI_BASICSIM_LIBNAME
;
shlib_fdesc
[
0
].
fname
=
"device_init"
;
}
else
if
(
IS_SOFTMODEM_RFSIM
)
{
libname
=
OAI_RFSIM_LIBNAME
;
shlib_fdesc
[
0
].
fname
=
"device_init"
;
}
else
if
(
flag
==
RAU_LOCAL_RADIO_HEAD
)
{
libname
=
OAI_RF_LIBNAME
;
shlib_fdesc
[
0
].
fname
=
"device_init"
;
libname
=
OAI_RF_LIBNAME
;
shlib_fdesc
[
0
].
fname
=
"device_init"
;
}
else
{
libname
=
OAI_TP_LIBNAME
;
shlib_fdesc
[
0
].
fname
=
"transport_init"
;
}
libname
=
OAI_TP_LIBNAME
;
shlib_fdesc
[
0
].
fname
=
"transport_init"
;
}
ret
=
load_module_shlib
(
libname
,
shlib_fdesc
,
1
,
NULL
);
if
(
ret
<
0
)
{
fprintf
(
stderr
,
"Library %s couldn't be loaded
\n
"
,
libname
);
fprintf
(
stderr
,
"Library %s couldn't be loaded
\n
"
,
libname
);
}
else
{
ret
=
((
devfunc_t
)
shlib_fdesc
[
0
].
fptr
)(
device
,
openair0_cfg
,
cfg
);
}
return
ret
;
ret
=
((
devfunc_t
)
shlib_fdesc
[
0
].
fptr
)(
device
,
openair0_cfg
,
cfg
);
}
return
ret
;
}
int
openair0_device_load
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
)
{
int
rc
=
0
;
rc
=
load_lib
(
device
,
openair0_cfg
,
NULL
,
RAU_LOCAL_RADIO_HEAD
);
if
(
rc
>=
0
)
{
if
(
set_device
(
device
)
<
0
)
{
if
(
rc
>=
0
)
{
if
(
set_device
(
device
)
<
0
)
{
fprintf
(
stderr
,
"%s %d:Unsupported radio head
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
return
-
1
;
}
}
return
rc
;
}
int
openair0_transport_load
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
eth_params_t
*
eth_params
)
{
int
openair0_transport_load
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
eth_params_t
*
eth_params
)
{
int
rc
;
rc
=
load_lib
(
device
,
openair0_cfg
,
eth_params
,
RAU_REMOTE_RADIO_HEAD
);
if
(
rc
>=
0
)
{
if
(
rc
>=
0
)
{
if
(
set_transport
(
device
)
<
0
)
{
fprintf
(
stderr
,
"%s %d:Unsupported transport protocol
\n
"
,
__FILE__
,
__LINE__
);
return
-
1
;
}
return
-
1
;
}
}
return
rc
;
return
rc
;
}
...
...
targets/ARCH/COMMON/common_lib.h
View file @
753c2f44
...
...
@@ -19,8 +19,8 @@
* contact@openairinterface.org
*/
/*! \file common_lib.h
* \brief common APIs for different RF frontend device
/*! \file common_lib.h
* \brief common APIs for different RF frontend device
* \author HongliangXU, Navid Nikaein
* \date 2015
* \version 0.2
...
...
@@ -48,13 +48,13 @@
#define RAU_REMOTE_RADIO_HEAD 1
#ifndef MAX_CARDS
#define MAX_CARDS 8
#define MAX_CARDS 8
#endif
typedef
int64_t
openair0_timestamp
;
typedef
volatile
int64_t
openair0_vtimestamp
;
/*!\brief structrue holds the parameters to configure USRP devices*/
typedef
struct
openair0_device_t
openair0_device
;
...
...
@@ -123,16 +123,16 @@ typedef enum {
/*!\brief openair0 device host type */
typedef
enum
{
MIN_HOST_TYPE
=
0
,
/*!\brief device functions within a RAU */
/*!\brief device functions within a RAU */
RAU_HOST
,
/*!\brief device functions within a RRU */
/*!\brief device functions within a RRU */
RRU_HOST
,
MAX_HOST_TYPE
}
host_type_t
;
}
host_type_t
;
/*! \brief RF Gain clibration */
/*! \brief RF Gain clibration */
typedef
struct
{
//! Frequency for which RX chain was calibrated
double
freq
;
...
...
@@ -160,7 +160,7 @@ typedef struct {
duplex_mode_t
duplex_mode
;
//! number of downlink resource blocks
int
num_rb_dl
;
//! number of samples per frame
//! number of samples per frame
unsigned
int
samples_per_frame
;
//! the sample rate for both transmit and receive.
double
sample_rate
;
...
...
@@ -175,9 +175,9 @@ typedef struct {
//! number of TX channels (=TX antennas)
int
tx_num_channels
;
//! \brief RX base addresses for mmapped_dma
int32_t
*
rxbase
[
4
];
int32_t
*
rxbase
[
4
];
//! \brief TX base addresses for mmapped_dma
int32_t
*
txbase
[
4
];
int32_t
*
txbase
[
4
];
//! \brief Center frequency in Hz for RX.
//! index: [0..rx_num_channels[
double
rx_freq
[
4
];
...
...
@@ -188,7 +188,7 @@ typedef struct {
//! \brief Pointer to Calibration table for RX gains
rx_gain_calib_table_t
*
rx_gain_calib_table
;
//! mode for rxgain (ExpressMIMO2)
//! mode for rxgain (ExpressMIMO2)
rx_gain_t
rxg_mode
[
4
];
//! \brief Gain for RX in dB.
//! index: [0..rx_num_channels]
...
...
@@ -202,14 +202,14 @@ typedef struct {
double
rx_bw
;
//! TX bandwidth in Hz
double
tx_bw
;
//! clock source
//! clock source
clock_source_t
clock_source
;
//! Manual SDR IP address
char
*
sdr_addrs
;
//! Auto calibration flag
int
autocal
[
4
];
//! rf devices work with x bits iqs when oai have its own iq format
//! the two following parameters are used to convert iqs
//! the two following parameters are used to convert iqs
int
iq_txshift
;
int
iq_rxrescale
;
//! Configuration file for LMS7002M
...
...
@@ -222,10 +222,10 @@ typedef struct {
unsigned
int
sf_read_delay
;
// read delay in replay mode
unsigned
int
sf_write_delay
;
// write delay in replay mode
unsigned
int
eth_mtu
;
// ethernet MTU
#endif
#endif
}
openair0_config_t
;
/*! \brief RF mapping */
/*! \brief RF mapping */
typedef
struct
{
//! card id
int
card
;
...
...
@@ -272,14 +272,14 @@ struct openair0_device_t {
/*!brief Component Carrier ID of this device */
int
CC_id
;
/*!brief Type of this device */
dev_type_t
type
;
/*!brief Transport protocol type that the device suppports (in case I/Q samples need to be transported) */
transport_type_t
transp_type
;
/*!brief Type of the device's host (RAU/RRU) */
/*!brief Type of the device's host (RAU/RRU) */
host_type_t
host_type
;
/* !brief RF frontend parameters set by application */
...
...
@@ -301,25 +301,25 @@ struct openair0_device_t {
/*! \brief Called to send a request message between RAU-RRU on control port
@param device pointer to the device structure specific to the RF hardware target
@param msg pointer to the message structure passed between RAU-RRU
@param msg_len length of the message
*/
@param msg_len length of the message
*/
int
(
*
trx_ctlsend_func
)(
openair0_device
*
device
,
void
*
msg
,
ssize_t
msg_len
);
/*! \brief Called to receive a reply message between RAU-RRU on control port
@param device pointer to the device structure specific to the RF hardware target
@param msg pointer to the message structure passed between RAU-RRU
@param msg_len length of the message
*/
@param msg_len length of the message
*/
int
(
*
trx_ctlrecv_func
)(
openair0_device
*
device
,
void
*
msg
,
ssize_t
msg_len
);
/*! \brief Called to send samples to the RF target
@param device pointer to the device structure specific to the RF hardware target
@param timestamp The timestamp at whicch the first sample MUST be sent
@param timestamp The timestamp at whicch the first sample MUST be sent
@param buff Buffer which holds the samples
@param nsamps number of samples to be sent
@param antenna_id index of the antenna if the device has multiple anteannas
@param flags flags must be set to TRUE if timestamp parameter needs to be applied
*/
*/
int
(
*
trx_write_func
)(
openair0_device
*
device
,
openair0_timestamp
timestamp
,
void
**
buff
,
int
nsamps
,
int
antenna_id
,
int
flags
);
/*! \brief Receive samples from hardware.
...
...
@@ -335,55 +335,55 @@ struct openair0_device_t {
*/
int
(
*
trx_read_func
)(
openair0_device
*
device
,
openair0_timestamp
*
ptimestamp
,
void
**
buff
,
int
nsamps
,
int
antenna_id
);
/*! \brief print the device statistics
/*! \brief print the device statistics
* \param device the hardware to use
* \returns 0 on success
*/
int
(
*
trx_get_stats_func
)(
openair0_device
*
device
);
/*! \brief Reset device statistics
/*! \brief Reset device statistics
* \param device the hardware to use
* \returns 0 in success
* \returns 0 in success
*/
int
(
*
trx_reset_stats_func
)(
openair0_device
*
device
);
/*! \brief Terminate operation of the transceiver -- free all associated resources
/*! \brief Terminate operation of the transceiver -- free all associated resources
* \param device the hardware to use
*/
void
(
*
trx_end_func
)(
openair0_device
*
device
);
/*! \brief Stop operation of the transceiver
/*! \brief Stop operation of the transceiver
*/
int
(
*
trx_stop_func
)(
openair0_device
*
device
);
/* Functions API related to UE*/
/*! \brief Set RX feaquencies
/*! \brief Set RX feaquencies
* \param device the hardware to use
* \param openair0_cfg RF frontend parameters set by application
* \param exmimo_dump_config dump EXMIMO configuration
* \returns 0 in success
* \param exmimo_dump_config dump EXMIMO configuration
* \returns 0 in success
*/
int
(
*
trx_set_freq_func
)(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
int
exmimo_dump_config
);
int
(
*
trx_set_freq_func
)(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
int
exmimo_dump_config
);
/*! \brief Set gains
* \param device the hardware to use
* \param openair0_cfg RF frontend parameters set by application
* \returns 0 in success
* \returns 0 in success
*/
int
(
*
trx_set_gains_func
)(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
);
int
(
*
trx_set_gains_func
)(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
);
/*! \brief RRU Configuration callback
* \param idx RU index
* \param arg pointer to capabilities or configuration
*/
void
(
*
configure_rru
)(
int
idx
,
void
*
arg
);
void
(
*
configure_rru
)(
int
idx
,
void
*
arg
);
};
/* type of device init function, implemented in shared lib */
typedef
int
(
*
oai_device_initfunc_t
)(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
);
/* type of transport init function, implemented in shared lib */
typedef
int
(
*
oai_transport_initfunc_t
)(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
eth_params_t
*
eth_params
);
typedef
int
(
*
oai_transport_initfunc_t
)(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
eth_params_t
*
eth_params
);
#ifdef __cplusplus
extern
"C"
...
...
@@ -391,23 +391,23 @@ extern "C"
#endif
/*! \brief Initialize openair RF target. It returns 0 if OK */
int
openair0_device_load
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
);
/*! \brief Initialize transport protocol . It returns 0 if OK */
int
openair0_transport_load
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
eth_params_t
*
eth_params
);
/*! \brief Initialize openair RF target. It returns 0 if OK */
int
openair0_device_load
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
);
/*! \brief Initialize transport protocol . It returns 0 if OK */
int
openair0_transport_load
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
,
eth_params_t
*
eth_params
);
/*! \brief Get current timestamp of USRP
* \param device the hardware to use
*/
openair0_timestamp
get_usrp_time
(
openair0_device
*
device
);
/*! \brief Set RX frequencies
* \param device the hardware to use
* \param openair0_cfg RF frontend parameters set by application
* \returns 0 in success
*/
int
openair0_set_rx_frequencies
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
);
/*! \brief Get current timestamp of USRP
* \param device the hardware to use
*/
openair0_timestamp
get_usrp_time
(
openair0_device
*
device
);
/*! \brief Set RX frequencies
* \param device the hardware to use
* \param openair0_cfg RF frontend parameters set by application
* \returns 0 in success
*/
int
openair0_set_rx_frequencies
(
openair0_device
*
device
,
openair0_config_t
*
openair0_cfg
);
/*@}*/
...
...
targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c
View file @
753c2f44
...
...
@@ -138,7 +138,7 @@ int eth_socket_init_raw(openair0_device *device) {
return
0
;
}
/* 09/03/2019: fix obvious inconsistencies, but this code hasn't be tested for sure */
int
trx_eth_write_raw
(
openair0_device
*
device
,
openair0_timestamp
timestamp
,
void
**
buff
,
int
nsamps
,
int
cc
,
int
flags
)
{
int
bytes_sent
=
0
;
...
...
@@ -148,7 +148,12 @@ int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, voi
//sendto_flag|=flags;
eth
->
tx_nsamps
=
nsamps
;
int
pktsize
;
if
(
eth
->
compression
==
ALAW_COMPRESS
)
{
pktsize
=
RAW_PACKET_SIZE_BYTES_ALAW
(
nsamps
);
}
else
{
pktsize
=
RAW_PACKET_SIZE_BYTES
(
nsamps
);
}
for
(
i
=
0
;
i
<
cc
;
i
++
)
{
/* buff[i] points to the position in tx buffer where the payload to be sent is
buff2 points to the position in tx buffer where the packet header will be placed */
...
...
@@ -162,44 +167,27 @@ int trx_eth_write_raw(openair0_device *device, openair0_timestamp timestamp, voi
bytes_sent
=
0
;
memcpy
(
buff2
,(
void
*
)
&
eth
->
ehd
,
MAC_HEADER_SIZE_BYTES
);
*
(
int16_t
*
)(
buff2
+
MAC_HEADER_SIZE_BYTES
+
sizeof
(
int16_t
))
=
1
+
(
i
<<
1
);
*
(
openair0_timestamp
*
)(
buff2
+
MAC_HEADER_SIZE_BYTES
+
sizeof
(
int32_t
))
=
timestamp
;
int
sent_byte
;
*
(
openair0_timestamp
*
)(
buff2
+
MAC_HEADER_SIZE_BYTES
+
sizeof
(
int32_t
))
=
timestamp
;
/*printf("[RRU]write mod_%d %d , len %d, buff %p \n",
Mod_id,eth->sockfd[Mod_id],RAW_PACKET_SIZE_BYTES(nsamps), buff2);*/
while
(
bytes_sent
<
sent_byte
)
{
#if DEBUG
printf
(
"------- TX ------: buff2 current position=%d remaining_bytes=%d bytes_sent=%d
\n
"
,
(
void
*
)(
buff2
+
bytes_sent
),
sent_byte
-
bytes_sent
,
bytes_sent
);
#endif
while
(
bytes_sent
<
pktsize
)
{
/* Send packet */
bytes_sent
+=
send
(
eth
->
sockfdd
,
buff2
,
sent_byt
e
,
pktsiz
e
,
sendto_flag
);
if
(
bytes_sent
==
-
1
)
{
eth
->
num_tx_errors
++
;
perror
(
"ETHERNET WRITE: "
);
exit
(
-
1
);
}
else
{
#if DEBUG
printf
(
"------- TX ------: nu=%x an_id=%d ts%d bytes_sent=%d
\n
"
,
*
(
uint8_t
*
)(
buff2
+
ETH_ALEN
),
*
(
int16_t
*
)(
buff2
+
MAC_HEADER_SIZE_BYTES
+
sizeof
(
int16_t
)),
*
(
openair0_timestamp
*
)(
buff2
+
MAC_HEADER_SIZE_BYTES
+
sizeof
(
int32_t
)),
bytes_sent
);
dump_packet
((
device
->
host_type
==
RAU_HOST
)
?
"RAU"
:
"RRU"
,
buff2
,
sent_byte
,
TX_FLAG
);
#endif
eth
->
tx_actual_nsamps
=
bytes_sent
>>
2
;
eth
->
tx_count
++
;
eth
->
tx_actual_nsamps
=
bytes_sent
>>
2
;
eth
->
tx_count
++
;
}
}
...
...
targets/RT/USER/lte-ru.c
View file @
753c2f44
...
...
@@ -1381,12 +1381,11 @@ int setup_RU_buffers(RU_t *ru) {
else
if
(
frame_parms
->
N_RB_DL
==
50
)
ru
->
N_TA_offset
=
624
/
2
;
else
if
(
frame_parms
->
N_RB_DL
==
25
)
ru
->
N_TA_offset
=
624
/
4
;
if
(
IS_SOFTMODEM_BASICSIM
)
/* this is required for the basic simulator in TDD mode
* TODO: find a proper cleaner solution
*/
ru
->
N_TA_offset
=
0
;
if
(
IS_SOFTMODEM_BASICSIM
)
/* this is required for the basic simulator in TDD mode
* TODO: find a proper cleaner solution
*/
ru
->
N_TA_offset
=
0
;
}
if
(
ru
->
openair0_cfg
.
mmapped_dma
==
1
)
{
...
...
targets/RT/USER/lte-softmodem-common.c
View file @
753c2f44
...
...
@@ -99,9 +99,11 @@ void get_common_options(void) {
if
(
basicsim
)
{
set_softmodem_optmask
(
SOFTMODEM_BASICSIM_BIT
);
}
#if BASIC_SIMULATOR
set_softmodem_optmask
(
SOFTMODEM_BASICSIM_BIT
);
set_softmodem_optmask
(
SOFTMODEM_BASICSIM_BIT
);
#endif
if
(
parallel_config
!=
NULL
)
set_parallel_conf
(
parallel_config
);
if
(
worker_config
!=
NULL
)
set_worker_conf
(
worker_config
);
...
...
targets/RT/USER/lte-softmodem.c
View file @
753c2f44
...
...
@@ -655,10 +655,12 @@ int main( int argc, char **argv ) {
fill_modeled_runtime_table
(
runtime_phy_rx
,
runtime_phy_tx
);
uint32_t
pdcp_initmask
=
(
IS_SOFTMODEM_NOS1
)
?
(
PDCP_USE_NETLINK_BIT
|
LINK_ENB_PDCP_TO_IP_DRIVER_BIT
)
:
LINK_ENB_PDCP_TO_GTPV1U_BIT
;
#
if
(
IS_SOFTMODEM_NOS1
)
pdcp_initmask
=
pdcp_initmask
|
ENB_NAS_USE_TUN_BIT
|
SOFTMODEM_NOKRNMOD_BIT
;
pdcp_module_init
(
pdcp_initmask
);
if
(
RC
.
nb_inst
>
0
)
{
// don't create if node doesn't connect to RRC/S1/GTP
if
(
create_tasks
(
1
)
<
0
)
{
...
...
targets/RT/USER/lte-ue.c
View file @
753c2f44
This diff is collapsed.
Click to expand it.
targets/RT/USER/lte-uesoftmodem.c
View file @
753c2f44
...
...
@@ -760,22 +760,22 @@ int main( int argc, char **argv ) {
}
MSC_INIT
(
MSC_E_UTRAN
,
THREAD_MAX
+
TASK_MAX
);
init_opt
();
uint32_t
pdcp_initmask
=
(
!
IS_SOFTMODEM_NOS1
)
?
LINK_ENB_PDCP_TO_GTPV1U_BIT
:
(
LINK_ENB_PDCP_TO_GTPV1U_BIT
|
PDCP_USE_NETLINK_BIT
|
LINK_ENB_PDCP_TO_IP_DRIVER_BIT
);
if
(
IS_SOFTMODEM_BASICSIM
||
IS_SOFTMODEM_RFSIM
||
(
nfapi_mode
==
3
)
)
{
pdcp_initmask
=
pdcp_initmask
|
UE_NAS_USE_TUN_BIT
;
}
if
(
IS_SOFTMODEM_NOKRNMOD
)
pdcp_initmask
=
pdcp_initmask
|
UE_NAS_USE_TUN_BIT
;
pdcp_module_init
(
pdcp_initmask
);
//TTN for D2D
printf
(
"RRC control socket
\n
"
);
rrc_control_socket_init
();
printf
(
"PDCP PC5S socket
\n
"
);
pdcp_pc5_socket_init
();
// to make a graceful exit when ctrl-c is pressed
signal
(
SIGSEGV
,
signal_handler
);
signal
(
SIGINT
,
signal_handler
);
...
...
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