Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
trx-ecpri
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
nexedi
trx-ecpri
Commits
cb30fa03
Commit
cb30fa03
authored
Jan 20, 2025
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix compile errors
parent
d4d210f2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
54 deletions
+33
-54
trx_ecpri.c
trx_ecpri.c
+33
-54
No files found.
trx_ecpri.c
View file @
cb30fa03
...
...
@@ -33,7 +33,6 @@
#include "private/trx_driver.h"
#define DEBUG
#define SSE4
/* define if CPU supports SSE4.1 */
#include "utils.c"
#include "ring_buffer.c"
...
...
@@ -109,9 +108,9 @@ typedef struct {
}
Complex
;
typedef
struct
{
const
uint8_t
*
rrh_mac
;
const
uint8_t
*
bbu_mac
;
const
uint8_t
*
bbu_if
;
const
char
*
rrh_mac
;
const
char
*
bbu_mac
;
const
char
*
bbu_if
;
const
char
*
log_directory
;
int
recv_affinity
;
int
send_affinity
;
...
...
@@ -126,10 +125,6 @@ typedef struct {
int
trx_buf_size
;
int
txrx_buf_size
;
int
trace_rx
;
int
trace_tx
;
int
trace_offset
;
int
monitor_pps
;
int
monitor_trigger_duration
;
...
...
@@ -148,13 +143,6 @@ typedef struct {
int64_t
pps
;
}
counter_stat_t
;
/* Proprietary code:
- compression / decompression of IQ samples
- fast conversion between int16_t and float
*/
//#include "private/bf1_avx2.c"
#include "private/bf1_sse4.c"
// Buffers
static
ring_buffer_t
rx_rbuf
;
// Received packets, ethernet frames
static
ring_buffer_t
trxr_rbuf
[
MAX_CHANNELS
];
// Decoded IQ samples
...
...
@@ -171,6 +159,9 @@ static counter_stat_t sent_counter; // frames sent to RRH
static
counter_stat_t
rx_drop_counter
;
// frames sent to RRH
static
counter_stat_t
tx_drop_counter
;
// frames sent to RRH
static
int
recv_pps_threshold_hit
=
0
;
static
int
recv_pps_threshold
;
// Network
static
uint8_t
seq_id
;
static
uint8_t
frame_id
;
...
...
@@ -546,8 +537,6 @@ static void *statistic_thread(void *p) {
next
=
initial
;
for
(
int64_t
i
=
0
;;
i
++
)
{
add_ns
(
&
next
,
s
->
statistics_refresh_rate_ns
);
if
(
s
->
trace_rx
||
s
->
trace_tx
)
trace_handler
(
initial
,
s
);
print_stats
(
stats_file_desc
,
(
i
%
50
)
==
0
);
#ifdef DEBUG
fprintf
(
stats_file_desc
,
...
...
@@ -585,7 +574,6 @@ static void *statistic_thread(void *p) {
if
(
s
->
monitor_pps
==
1
)
log_exit
(
"MONITOR"
,
"Stopped recieving packets, restarting..."
);
log_info
(
"MONITOR"
,
"Stopped recieving packets, sending again..."
);
sync_complete
=
0
;
recv_stop
=
0
;
}
if
(
!
recv_stop
)
...
...
@@ -725,39 +713,39 @@ int start(TRXEcpriState * s) {
for
(
int
i
=
0
;
i
<
s
->
tx_n_channel
;
i
++
)
{
char
name
[
256
];
sprintf
(
name
,
"TRXWrite Ring Buffer %d"
,
i
);
init_rbuf
(
trxw_rbuf
[
i
],
name
,
s
->
trx_buf_size
,
sizeof
(
Complex
)
*
32
);
init_rbuf
(
&
trxw_rbuf
[
i
],
name
,
s
->
trx_buf_size
,
sizeof
(
Complex
)
*
32
);
}
for
(
int
i
=
0
;
i
<
s
->
rx_n_channel
;
i
++
)
{
char
name
[
256
];
sprintf
(
name
,
"TRXRead Ring Buffer %d"
,
i
);
init_rbuf
(
trxr_rbuf
[
i
],
name
,
s
->
trx_buf_size
,
sizeof
(
Complex
)
*
32
);
init_rbuf
(
&
trxr_rbuf
[
i
],
name
,
s
->
trx_buf_size
,
sizeof
(
Complex
)
*
32
);
}
memset
((
uint8_t
*
)
packet_header
,
0
,
PACKET_HEADER
);
memset
((
uint8_t
*
)
ecpri_iq_header
,
0
,
ECPRI_IQ_HEADER
+
ORAN_HEADER
);
if
(
sscanf
((
char
*
)
s
->
rrh_mac
,
"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx%*c"
,
&
d_addr
.
addr_bytes
[
0
],
&
d_addr
.
addr_bytes
[
1
],
&
d_addr
.
addr_bytes
[
2
],
&
d_addr
.
addr_bytes
[
3
],
&
d_addr
.
addr_bytes
[
4
],
&
d_addr
.
addr_bytes
[
5
])
!=
6
)
fprintf
(
stderr
,
"Invalid RRH MAC address
\n
"
);
if
(
sscanf
((
char
*
)
s
->
bbu_mac
,
"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx%*c"
,
&
s_addr
.
addr_bytes
[
0
],
&
s_addr
.
addr_bytes
[
1
],
&
s_addr
.
addr_bytes
[
2
],
&
s_addr
.
addr_bytes
[
3
],
&
s_addr
.
addr_bytes
[
4
],
&
s_addr
.
addr_bytes
[
5
])
!=
6
)
fprintf
(
stderr
,
"Invalid BBU MAC address
\n
"
);
if
(
!
(
if_index
=
if_nametoindex
(
s
->
bbu_if
)))
{
perror
(
"if_nametoindex"
);
return
1
;
}
if
(
sscanf
(
s
->
rrh_mac
,
"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx%*c"
,
&
dst_mac
[
0
],
&
dst_mac
[
1
],
&
dst_mac
[
2
],
&
dst_mac
[
3
],
&
dst_mac
[
4
],
&
dst_mac
[
5
])
!=
6
)
fprintf
(
stderr
,
"Invalid RRH MAC address
\n
"
);
if
(
sscanf
(
s
->
bbu_mac
,
"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx%*c"
,
&
src_mac
[
0
],
&
src_mac
[
1
],
&
src_mac
[
2
],
&
src_mac
[
3
],
&
src_mac
[
4
],
&
src_mac
[
5
])
!=
6
)
fprintf
(
stderr
,
"Invalid BBU MAC address
\n
"
);
if
((
send_sockfd
=
socket
(
AF_PACKET
,
SOCK_RAW
,
htons
(
ETH_P_ALL
)))
==
-
1
)
{
perror
(
"Socket Error"
);
return
1
;
...
...
@@ -824,7 +812,7 @@ static int64_t prev_count = 0;
*/
static
void
trx_ecpri_write
(
TRXState
*
s1
,
trx_timestamp_t
timestamp
,
const
void
**
__samples
,
int
count
,
int
tx_port_index
,
TRXWriteMetadata
*
md
)
{
int64_t
count_left
,
ts
,
nc
,
offset
;
int64_t
count_left
,
nc
,
offset
;
float
**
_samples
=
(
float
**
)
__samples
;
TRXEcpriState
*
s
=
s1
->
opaque
;
...
...
@@ -860,8 +848,8 @@ static void trx_ecpri_write(TRXState *s1, trx_timestamp_t timestamp, const void
((
uint8_t
*
)
trxw_rbuf
[
i
].
buffer
)
+
trxw_rbuf
[
0
].
write_index
,
0
,
nc
);
rbuf_increment_write
(
&
trxw_rbuf
[
i
],
nc
);
}
rbuf_increment_write
(
&
trxw_rbuf
,
nc
,
0
);
count_left
-=
nc
/
sizeof
(
Complex
);
offset
+=
nc
;
}
...
...
@@ -889,8 +877,6 @@ static int trx_ecpri_read(TRXState *s1, trx_timestamp_t *ptimestamp, void **__sa
// Wait to have enough sampels in TRX read buffer
while
(
rbuf_read_amount
(
&
trxr_rbuf
[
0
])
<
(
count
*
sizeof
(
Complex
))
);
sync_complete
=
1
;
offset
=
0
;
count_left
=
count
;
while
((
nc
=
rbuf_contiguous_copy
(
&
trxr_rbuf
[
0
],
NULL
,
count_left
*
sizeof
(
Complex
))))
{
...
...
@@ -899,8 +885,8 @@ static int trx_ecpri_read(TRXState *s1, trx_timestamp_t *ptimestamp, void **__sa
((
uint8_t
*
)
_samples
[
i
])
+
offset
,
((
uint8_t
*
)
trxr_rbuf
[
i
].
buffer
)
+
trxr_rbuf
[
0
].
read_index
,
nc
);
rbuf_increment_read
(
&
trxr_rbuf
[
i
],
nc
);
}
rbuf_increment_read
(
&
trxr_rbuf
,
nc
);
count_left
-=
nc
/
sizeof
(
Complex
);
offset
+=
nc
;
}
...
...
@@ -927,7 +913,7 @@ static int trx_ecpri_start(TRXState *s1, const TRXDriverParams *params)
log_info
(
"TRX_ECPRI_START"
,
"trx_api_version: %d"
,
s1
->
trx_api_version
);
log_info
(
"TRX_ECPRI_START"
,
"config file: %s"
,
s1
->
path
);
log_info
(
"TEST-
DPDK-
ECPRI"
,
"bbu-mac: %s, rrh-mac: %s, bbu-if: %s"
,
s
->
bbu_mac
,
s
->
rrh_mac
,
s
->
bbu_if
);
log_info
(
"TEST-ECPRI"
,
"bbu-mac: %s, rrh-mac: %s, bbu-if: %s"
,
s
->
bbu_mac
,
s
->
rrh_mac
,
s
->
bbu_if
);
s
->
sample_rate
=
params
->
sample_rate
[
0
].
num
/
params
->
sample_rate
[
0
].
den
;
...
...
@@ -1153,12 +1139,6 @@ int trx_driver_init(TRXState *s1)
s
->
trx_buf_size
=
(
int
)
val
;
trx_get_param_double
(
s1
,
&
val
,
"txrx_buf_size"
);
s
->
txrx_buf_size
=
(
int
)
val
;
trx_get_param_double
(
s1
,
&
val
,
"trace_rx"
);
s
->
trace_rx
=
(
int
)
val
;
trx_get_param_double
(
s1
,
&
val
,
"trace_tx"
);
s
->
trace_tx
=
(
int
)
val
;
trx_get_param_double
(
s1
,
&
val
,
"trace_offset"
);
s
->
trace_offset
=
(
int
)
val
;
trx_get_param_double
(
s1
,
&
val
,
"monitor_pps"
);
s
->
monitor_pps
=
(
int
)
val
;
trx_get_param_double
(
s1
,
&
val
,
"monitor_trigger_duration"
);
...
...
@@ -1183,11 +1163,10 @@ int trx_driver_init(TRXState *s1)
if
(
s
->
tx_n_channel
==
0
)
log_exit
(
"TRX_ECPRI"
,
"tx_n_channel parameter can't be null
\n
"
);
s
->
rrh_mac
=
(
uint8_t
*
)
trx_get_param_string
(
s1
,
"rrh_mac"
);
s
->
bbu_mac
=
(
uint8_t
*
)
trx_get_param_string
(
s1
,
"bbu_mac"
);
s
->
bbu_if
=
(
uint8_t
*
)
trx_get_param_string
(
s1
,
"bbu_if"
);
s
->
dpdk_options
=
trx_get_param_string
(
s1
,
"dpdk_options"
);
s
->
log_directory
=
(
uint8_t
*
)
trx_get_param_string
(
s1
,
"log_directory"
);
s
->
rrh_mac
=
trx_get_param_string
(
s1
,
"rrh_mac"
);
s
->
bbu_mac
=
trx_get_param_string
(
s1
,
"bbu_mac"
);
s
->
bbu_if
=
trx_get_param_string
(
s1
,
"bbu_if"
);
s
->
log_directory
=
trx_get_param_string
(
s1
,
"log_directory"
);
recv_pps_threshold
=
(
s
->
frame_frequency
*
9
/
10
);
...
...
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