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
097b23c2
Commit
097b23c2
authored
Jan 21, 2025
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
aa18ab2d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
8 deletions
+26
-8
trx_ecpri.c
trx_ecpri.c
+26
-8
No files found.
trx_ecpri.c
View file @
097b23c2
...
...
@@ -33,6 +33,8 @@
#include "private/trx_driver.h"
#define DEBUG
//#define DISABLE_SEND
#define DISABLE_RECV
#include "utils.c"
#include "ring_buffer.c"
...
...
@@ -295,6 +297,9 @@ static void update_counter(counter_stat_t * c, int64_t v) {
#define RX_BURST_SIZE 4000
static
void
*
recv_thread
(
void
*
p
)
{
#ifdef DISABLE_RECV
pthread_exit
(
EXIT_SUCCESS
);
#endif
cpu_set_t
mask
;
TRXEcpriState
*
s
=
(
TRXEcpriState
*
)
p
;
...
...
@@ -338,6 +343,9 @@ static void *recv_thread(void *p) {
#define TX_BURST_SIZE 4000
// Send as soon as packets are encoded
static
void
*
send_thread
(
void
*
p
)
{
#ifdef DISABLE_SEND
pthread_exit
(
EXIT_SUCCESS
);
#endif
cpu_set_t
mask
;
struct
timespec
initial
;
...
...
@@ -362,26 +370,28 @@ static void *send_thread(void *p) {
msgh
[
j
].
msg_hdr
.
msg_iovlen
=
1
;
}
clock_gettime
(
CLOCK_TAI
,
&
initial
);
log_info
(
"SEND_THREAD"
,
"Starting loop"
);
for
(
int64_t
i
=
1
;;
i
++
)
{
int
burst_size
;
int
to_send
=
rbuf_read_amount
(
&
tx_rbuf
);
if
(
to_send
>
TX_BURST_SIZE
)
to_send
=
TX_BURST_SIZE
;
for
(
burst_size
=
0
;
to_send
;
burst_size
++
)
{
msgv
[
burst_size
].
iov_base
=
rbuf_read
(
&
tx_rbuf
);
msgv
[
burst_size
].
iov_len
=
tx_rbuf
.
block_len
;
for
(
int
j
=
0
;
j
<
to_send
;
j
++
)
{
msgv
[
j
].
iov_base
=
rbuf_read
(
&
tx_rbuf
);
msgv
[
j
].
iov_len
=
tx_rbuf
.
block_len
;
rbuf_increment_read
(
&
tx_rbuf
,
tx_rbuf
.
block_len
);
if
(
burst_size
>
TX_BURST_SIZE
)
if
(
j
>
TX_BURST_SIZE
)
log_exit
(
"SEND_THREAD"
,
"Too many burst packets"
);
to_send
=
rbuf_read_amount
(
&
tx_rbuf
);
}
for
(
int
msg_sent
=
0
;
msg_sent
<
burst_size
;)
{
int
ret
=
sendmmsg
(
send_sockfd
,
msgh
+
msg_sent
,
(
burst_size
-
msg_sent
),
0
);
for
(
int
j
=
0
;
j
<
to_send
;)
{
int
ret
=
sendmmsg
(
send_sockfd
,
msgh
+
j
,
(
burst_size
-
j
),
0
);
if
(
ret
<=
0
)
error
(
EXIT_FAILURE
,
errno
,
"sendmmsg error (returned %d)"
,
ret
);
msg_sent
+=
ret
;
j
+=
ret
;
update_counter
(
&
sent_counter
,
ret
);
}
}
...
...
@@ -389,11 +399,16 @@ static void *send_thread(void *p) {
}
static
void
*
encode_thread
(
void
*
p
)
{
#ifdef DISABLE_SEND
pthread_exit
(
EXIT_SUCCESS
);
#endif
cpu_set_t
mask
;
TRXEcpriState
*
s
=
(
TRXEcpriState
*
)
p
;
uint8_t
*
data
;
log_info
(
"ENCODE_THREAD"
,
"Thread init"
);
// Set thread CPU affinity
CPU_ZERO
(
&
mask
);
CPU_SET
(
s
->
encode_affinity
,
&
mask
);
...
...
@@ -464,6 +479,9 @@ static void *encode_thread(void *p) {
}
static
void
*
decode_thread
(
void
*
p
)
{
#ifdef DISABLE_RECV
pthread_exit
(
EXIT_SUCCESS
);
#endif
cpu_set_t
mask
;
uint8_t
*
data
;
...
...
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