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
31359d72
Commit
31359d72
authored
Jan 24, 2025
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tx send fix
parent
9ba1f111
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
7 deletions
+29
-7
trx_ecpri.c
trx_ecpri.c
+14
-7
utils.c
utils.c
+15
-0
No files found.
trx_ecpri.c
View file @
31359d72
...
@@ -129,6 +129,7 @@ typedef struct {
...
@@ -129,6 +129,7 @@ typedef struct {
int
trx_buf_size
;
int
trx_buf_size
;
int
txrx_buf_size
;
int
txrx_buf_size
;
int
rx_burst
;
int
rx_burst
;
int
tx_burst
;
int
monitor_pps
;
int
monitor_pps
;
int
monitor_trigger_duration
;
int
monitor_trigger_duration
;
...
@@ -427,7 +428,7 @@ static void *recv_thread(void *p) {
...
@@ -427,7 +428,7 @@ static void *recv_thread(void *p) {
pthread_exit
(
EXIT_SUCCESS
);
pthread_exit
(
EXIT_SUCCESS
);
}
}
#define
TX_BURST_SIZE 4000
#define
MAX_TX_BURST 32768
// Send as soon as packets are encoded
// Send as soon as packets are encoded
static
void
*
send_thread
(
void
*
p
)
{
static
void
*
send_thread
(
void
*
p
)
{
#ifdef DISABLE_SEND
#ifdef DISABLE_SEND
...
@@ -436,8 +437,8 @@ static void *send_thread(void *p) {
...
@@ -436,8 +437,8 @@ static void *send_thread(void *p) {
cpu_set_t
mask
;
cpu_set_t
mask
;
struct
timespec
initial
;
struct
timespec
initial
;
struct
mmsghdr
msgh
[
TX_BURST_SIZE
];
struct
mmsghdr
msgh
[
MAX_TX_BURST
];
struct
iovec
msgv
[
TX_BURST_SIZE
];
struct
iovec
msgv
[
MAX_TX_BURST
];
TRXEcpriState
*
s
=
(
TRXEcpriState
*
)
p
;
TRXEcpriState
*
s
=
(
TRXEcpriState
*
)
p
;
log_info
(
"SEND_THREAD"
,
"Thread init"
);
log_info
(
"SEND_THREAD"
,
"Thread init"
);
...
@@ -450,7 +451,7 @@ static void *send_thread(void *p) {
...
@@ -450,7 +451,7 @@ static void *send_thread(void *p) {
memset
(
msgv
,
0
,
sizeof
(
msgv
));
memset
(
msgv
,
0
,
sizeof
(
msgv
));
memset
(
msgh
,
0
,
sizeof
(
msgh
));
memset
(
msgh
,
0
,
sizeof
(
msgh
));
for
(
int
j
=
0
;
j
<
TX_BURST_SIZE
;
j
++
)
{
for
(
int
j
=
0
;
j
<
s
->
tx_burst
;
j
++
)
{
msgh
[
j
].
msg_hdr
.
msg_name
=
&
connect_sk_addr
;
msgh
[
j
].
msg_hdr
.
msg_name
=
&
connect_sk_addr
;
msgh
[
j
].
msg_hdr
.
msg_namelen
=
sizeof
(
connect_sk_addr
);
msgh
[
j
].
msg_hdr
.
msg_namelen
=
sizeof
(
connect_sk_addr
);
msgh
[
j
].
msg_hdr
.
msg_iov
=
&
msgv
[
j
];
msgh
[
j
].
msg_hdr
.
msg_iov
=
&
msgv
[
j
];
...
@@ -462,13 +463,17 @@ static void *send_thread(void *p) {
...
@@ -462,13 +463,17 @@ static void *send_thread(void *p) {
for
(
int64_t
i
=
1
;;
i
++
)
{
for
(
int64_t
i
=
1
;;
i
++
)
{
int
to_send
=
rbuf_read_amount
(
&
tx_rbuf
)
/
PACKET_SIZE
;
int
to_send
=
rbuf_read_amount
(
&
tx_rbuf
)
/
PACKET_SIZE
;
if
(
to_send
>
TX_BURST_SIZE
)
while
(
to_send
<
s
->
tx_burst
)
{
to_send
=
TX_BURST_SIZE
;
usleep
(
1
);
to_send
=
rbuf_read_amount
(
&
tx_rbuf
)
/
PACKET_SIZE
;
}
if
(
to_send
>
s
->
tx_burst
)
to_send
=
s
->
tx_burst
;
for
(
int
j
=
0
;
j
<
to_send
;
j
++
)
{
for
(
int
j
=
0
;
j
<
to_send
;
j
++
)
{
msgv
[
j
].
iov_base
=
rbuf_read
(
&
tx_rbuf
)
+
j
;
msgv
[
j
].
iov_base
=
rbuf_read
(
&
tx_rbuf
)
+
j
;
msgv
[
j
].
iov_len
=
PACKET_SIZE
;
msgv
[
j
].
iov_len
=
PACKET_SIZE
;
if
(
j
>
TX_BURST_SIZE
)
if
(
j
>
s
->
tx_burst
)
log_exit
(
"SEND_THREAD"
,
"Too many burst packets"
);
log_exit
(
"SEND_THREAD"
,
"Too many burst packets"
);
}
}
for
(
int
j
=
0
;
j
<
to_send
;)
{
for
(
int
j
=
0
;
j
<
to_send
;)
{
...
@@ -1218,6 +1223,8 @@ int trx_driver_init(TRXState *s1)
...
@@ -1218,6 +1223,8 @@ int trx_driver_init(TRXState *s1)
s
->
txrx_buf_size
=
(
int
)
val
;
s
->
txrx_buf_size
=
(
int
)
val
;
trx_get_param_double
(
s1
,
&
val
,
"rx_burst"
);
trx_get_param_double
(
s1
,
&
val
,
"rx_burst"
);
s
->
rx_burst
=
(
int
)
val
;
s
->
rx_burst
=
(
int
)
val
;
trx_get_param_double
(
s1
,
&
val
,
"tx_burst"
);
s
->
tx_burst
=
(
int
)
val
;
trx_get_param_double
(
s1
,
&
val
,
"rx_n_channel"
);
trx_get_param_double
(
s1
,
&
val
,
"rx_n_channel"
);
s
->
rx_n_channel
=
(
int
)
val
;
s
->
rx_n_channel
=
(
int
)
val
;
trx_get_param_double
(
s1
,
&
val
,
"tx_n_channel"
);
trx_get_param_double
(
s1
,
&
val
,
"tx_n_channel"
);
...
...
utils.c
View file @
31359d72
...
@@ -145,3 +145,18 @@ static int64_t calcdiff_ns(struct timespec t1, struct timespec t2) {
...
@@ -145,3 +145,18 @@ static int64_t calcdiff_ns(struct timespec t1, struct timespec t2) {
diff
+=
((
int
)
t1
.
tv_nsec
-
(
int
)
t2
.
tv_nsec
);
diff
+=
((
int
)
t1
.
tv_nsec
-
(
int
)
t2
.
tv_nsec
);
return
diff
;
return
diff
;
}
}
static
struct
timespec
timestamp_list
[
50
];
static
int
timestamp_index
=
0
;
void
timer
(
const
char
*
title
)
{
clock_gettime
(
CLOCK_TAI
,
&
timestamp_list
[
timestamp_index
++
]);
if
(
timestamp_index
>
1
)
{
printf
(
"%20s (%3d) - %ld ns
\n
"
,
title
,
timestamp_index
-
1
,
calcdiff_ns
(
timestamp_list
[
timestamp_index
-
1
],
timestamp_list
[
timestamp_index
-
2
])
);
}
}
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