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
a274ffb6
Commit
a274ffb6
authored
Jan 27, 2025
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
d9294d7c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
32 deletions
+10
-32
trx_ecpri.c
trx_ecpri.c
+10
-32
No files found.
trx_ecpri.c
View file @
a274ffb6
...
...
@@ -55,6 +55,8 @@
#define PACKET_HEADER (ETHERNET_HEADER + ECPRI_IQ_HEADER + ORAN_HEADER)
#define IQ_PAYLOAD 8832
#define PACKET_SIZE (PACKET_HEADER + IQ_PAYLOAD)
#define MAX_RX_BURST 1024
#define MAX_TX_BURST 1024
/* eCPRI frame structure
...
...
@@ -218,19 +220,11 @@ static void print_debug(FILE * f, int print_header) {
"%"
STAT_INT_LEN
""
PRIi64
" "
"%"
STAT_INT_LEN
""
PRIi64
" "
"%"
STAT_INT_LEN
""
PRIi64
" "
"%"
STAT_INT_LEN
""
PRIi64
" "
"%"
STAT_INT_LEN
""
PRIi64
" "
"%"
STAT_INT_LEN
""
PRIi64
" "
"%"
STAT_INT_LEN
""
PRIi64
" "
"
\n
"
,
rbuf_read_amount
(
&
rx_rbuf
)
/
rx_rbuf
.
block_len
,
rbuf_read_amount
(
&
trxr_rbuf
[
0
])
/
trxr_rbuf
[
0
].
block_len
,
rbuf_read_amount
(
&
trxw_rbuf
[
0
])
/
trxw_rbuf
[
0
].
block_len
,
rbuf_read_amount
(
&
tx_rbuf
)
/
tx_rbuf
.
block_len
,
rbuf_write_amount
(
&
rx_rbuf
)
/
rx_rbuf
.
block_len
,
rbuf_write_amount
(
&
trxr_rbuf
[
0
])
/
trxr_rbuf
[
0
].
block_len
,
rbuf_write_amount
(
&
trxw_rbuf
[
0
])
/
trxw_rbuf
[
0
].
block_len
,
rbuf_write_amount
(
&
tx_rbuf
)
/
tx_rbuf
.
block_len
,
trxw_rbuf
[
0
].
read_index
/
trxw_rbuf
[
0
].
block_len
,
trxw_rbuf
[
0
].
write_index
/
trxw_rbuf
[
0
].
block_len
,
trxr_rbuf
[
0
].
read_index
/
trxw_rbuf
[
0
].
block_len
,
...
...
@@ -250,10 +244,6 @@ static void print_stats(FILE * f, int print_header) {
"%"
STAT_INT_LEN
"s "
"%"
STAT_INT_LEN
"s "
"%"
STAT_INT_LEN
"s "
"%"
STAT_INT_LEN
"s "
"%"
STAT_INT_LEN
"s "
"%"
STAT_INT_LEN
"s "
"%"
STAT_INT_LEN
"s "
"%"
STAT_INT_LEN
"s "
"%"
STAT_INT_LEN
"s "
"%"
STAT_INT_LEN
"s "
...
...
@@ -312,12 +302,6 @@ static void log_exit(const char * section, const char * msg, ...) {
// Dump useful information
print_stats
(
stderr
,
1
);
print_debug
(
stderr
,
1
);
fprintf
(
stderr
,
"TX RBUF: ri %d wi %d ra %d wa %d
\n
"
,
tx_rbuf
.
read_index
,
tx_rbuf
.
write_index
,
rbuf_read_amount
(
&
tx_rbuf
),
rbuf_write_amount
(
&
tx_rbuf
));
fprintf
(
stderr
,
"RX RBUF: ri %d wi %d ra %d wa %d
\n
"
,
rx_rbuf
.
read_index
,
rx_rbuf
.
write_index
,
rbuf_read_amount
(
&
rx_rbuf
),
rbuf_write_amount
(
&
rx_rbuf
));
fprintf
(
stderr
,
"TRXW RBUF: ri %d wi %d ra %d wa %d
\n
"
,
trxw_rbuf
[
0
].
read_index
,
trxw_rbuf
[
0
].
write_index
,
rbuf_read_amount
(
&
trxw_rbuf
[
0
]),
rbuf_write_amount
(
&
trxw_rbuf
[
0
]));
...
...
@@ -379,7 +363,6 @@ void print_packet(uint8_t * data, int length) {
}
#define MAX_RX_BURST 1024
static
void
*
recv_thread
(
void
*
p
)
{
#ifdef DISABLE_RECV
pthread_exit
(
EXIT_SUCCESS
);
...
...
@@ -412,7 +395,7 @@ static void *recv_thread(void *p) {
msgh
[
j
].
msg_hdr
.
msg_iov
=
&
msgv
[
j
];
msgh
[
j
].
msg_hdr
.
msg_iovlen
=
1
;
}
int
ret
=
recvmmsg
(
recv_sockfd
,
msgh
+
j
,
s
->
rx_burst
-
j
,
0
,
NULL
);
int
ret
=
recvmmsg
(
recv_sockfd
,
msgh
,
s
->
rx_burst
,
0
,
NULL
);
if
(
ret
<=
-
1
)
error
(
EXIT_FAILURE
,
errno
,
"recvmmsg error"
);
for
(
int
j
=
0
;
j
<
ret
;
j
++
)
{
...
...
@@ -420,7 +403,7 @@ static void *recv_thread(void *p) {
if
(
((
uint16_t
*
)
data
)[
6
]
!=
0xaefe
)
continue
;
else
if
((
msgh
+
j
+
l
)
->
msg_len
!=
PACKET_SIZE
)
else
if
((
msgh
+
j
)
->
msg_len
!=
PACKET_SIZE
)
continue
;
int
offset
=
ETHERNET_HEADER
+
ECPRI_COMMON_HEADER
;
uint16_t
antenna_id
=
ntohs
(
*
((
uint16_t
*
)
(
data
+
offset
+
0
)));
...
...
@@ -448,7 +431,7 @@ static void *recv_thread(void *p) {
if
(
stop
)
{
for
(
int
j
=
0
;
j
<
ret
;
j
++
)
{
data
=
rx_buf
+
j
*
PACKET_SIZE
;
print_packet
(
data
,
(
msgh
+
j
+
l
)
->
msg_len
);
print_packet
(
data
,
(
msgh
+
j
)
->
msg_len
);
}
log_exit
(
"DECODE_THREAD"
,
"Exiting"
);
}
...
...
@@ -456,7 +439,6 @@ static void *recv_thread(void *p) {
pthread_exit
(
EXIT_SUCCESS
);
}
#define MAX_TX_BURST 1024
// Send as soon as packets are encoded
static
void
*
send_thread
(
void
*
p
)
{
#ifdef DISABLE_SEND
...
...
@@ -495,7 +477,7 @@ static void *send_thread(void *p) {
// If we have frames to encode (is there space in TX buffer)
// And if there are frames from trx_write callback to encode
to_send
=
s
->
tx_burst
/
s
->
tx_n_channel
;
int
to_send
=
s
->
tx_burst
/
s
->
tx_n_channel
;
for
(
int
k
=
0
;
k
<
s
->
tx_n_channel
;
k
++
)
{
int
to_read
=
rbuf_read_amount
(
&
trxw_rbuf
[
k
]);
if
(
to_read
<
to_send
)
...
...
@@ -506,7 +488,7 @@ static void *send_thread(void *p) {
for
(
uint16_t
antenna_id
=
0
;
antenna_id
<
s
->
tx_n_channel
;
antenna_id
++
)
{
data
=
tx_buf
+
encoded
*
PACKET_SIZE
;
j
=
ETHERNET_HEADER
+
ECPRI_COMMON_HEADER
;
int
j
=
ETHERNET_HEADER
+
ECPRI_COMMON_HEADER
;
// PC_ID
*
((
uint16_t
*
)
(
data
+
j
+
0
))
=
htons
(
antenna_id
);
// SEQ_ID
...
...
@@ -514,7 +496,7 @@ static void *send_thread(void *p) {
j
=
ETHERNET_HEADER
+
ECPRI_IQ_HEADER
;
// ORAN counters
data
[
j
+
1
]
=
frame_id
;
word
=
(
uint16_t
*
)
(
data
+
j
+
2
);
uint16_t
*
word
=
(
uint16_t
*
)
(
data
+
j
+
2
);
*
word
=
sub_frame_id
<<
8
;
*
word
|=
slot_id
<<
4
;
*
word
|=
symbol_id
;
...
...
@@ -676,10 +658,6 @@ int start(TRXEcpriState * s) {
init_counter
(
&
write_counter
);
init_counter
(
&
sent_counter
);
init_rbuf
(
&
rx_rbuf
,
"RX ring buffer"
,
s
->
txrx_buf_size
,
PACKET_SIZE
*
s
->
rx_n_channel
);
init_rbuf
(
&
tx_rbuf
,
"TX ring buffer"
,
s
->
txrx_buf_size
,
PACKET_SIZE
*
s
->
tx_n_channel
);
log_debug
(
"DEBUG"
,
"rbuf_read_amount(tx_rbuf) = %d"
,
rbuf_read_amount
(
&
tx_rbuf
));
for
(
int
i
=
0
;
i
<
s
->
tx_n_channel
;
i
++
)
{
char
name
[
256
];
sprintf
(
name
,
"TRXWrite Ring Buffer %d"
,
i
);
...
...
@@ -774,8 +752,8 @@ int start(TRXEcpriState * s) {
ecpri_iq_header
,
ECPRI_IQ_HEADER
+
ORAN_HEADER
);
for
(
int
i
=
0
;
i
<
tx_rbuf
.
buf_len
;
i
+=
PACKET_SIZE
)
memcpy
(
((
uint8_t
*
)
tx_rbuf
.
buffer
)
+
i
,
packet_header
,
PACKET_HEADER
);
for
(
int
i
=
0
;
i
<
MAX_TX_BURST
;
i
+=
PACKET_SIZE
)
memcpy
(
tx_buf
+
i
*
PACKET_SIZE
,
packet_header
,
PACKET_HEADER
);
start_threads
(
s
);
return
0
;
...
...
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