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
c4fba315
Commit
c4fba315
authored
Oct 08, 2021
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First eCPRI driver version
parent
ae54ba42
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
14 deletions
+28
-14
ecpri-tests/Makefile
ecpri-tests/Makefile
+0
-1
ecpri-tests/test-dpdk-ecpri.c
ecpri-tests/test-dpdk-ecpri.c
+4
-4
trx_ecpri_dpdk.c
trx_ecpri_dpdk.c
+24
-9
No files found.
ecpri-tests/Makefile
View file @
c4fba315
...
...
@@ -3,7 +3,6 @@
CC
=
gcc
-m64
-msse4
.1
CXX
=
g++
-m64
-msse4
.1
#CFLAGS=-O2 -Wall -pedantic -std=gnu17
CFLAGS
=
-O2
-fno-strict-aliasing
-Wall
-pedantic
-std
=
gnu17
CFLAGS
+=
-D_GNU_SOURCE
-D_FILE_OFFSET_BITS
=
64
-D_LARGEFILE_SOURCE
CFLAGS
+=
-DALLOW_EXPERIMENTAL_API
...
...
ecpri-tests/test-dpdk-ecpri.c
View file @
c4fba315
...
...
@@ -86,10 +86,10 @@ int main(int argc, char * argv[]) {
s
=
malloc
(
sizeof
(
TRXEcpriState
));
memset
(
s
,
0
,
sizeof
(
*
s
));
#if
0
s->rec_mac = "
80:fa:5b:92:39:c3
";
s->re_mac = "0
0:e0:4c:90:20:d3
";
s->rec_if = "en
p53s
0";
#if
1
s
->
rec_mac
=
"
b8:59:9f:07:7d:da
"
;
s
->
re_mac
=
"0
4:09:a5:0f:9f:4c
"
;
s
->
rec_if
=
"en
s9f0np
0"
;
#else
s
->
rec_mac
=
"b8:ce:f6:4b:00:22"
;
s
->
re_mac
=
"b8:ce:f6:4b:00:23"
;
...
...
trx_ecpri_dpdk.c
View file @
c4fba315
...
...
@@ -53,10 +53,10 @@
#define PACKET_SIZE 262
#define DATA_SIZE 244
#define FRAME_FREQ INT64_C(3840000)
#define SEND_LIMIT (1250 * 10)
//
#define SEND_LIMIT (1250 * 10)
#define TRX_WB_MAX_PARTS 1000
#define TRX_BUF_MAX_SIZE 1000
#define STATISTIC_REFRESH_RATE INT64_C(
1
00 * 1000 * 1000)
#define STATISTIC_REFRESH_RATE INT64_C(
5
00 * 1000 * 1000)
static
void
log_error
(
const
char
*
section
,
const
char
*
msg
,
...)
{
time_t
t
;
...
...
@@ -328,6 +328,7 @@ static void init_dpdk(int argc, char ** argv) {
static
void
send_packets
(
int
port
)
{
struct
rte_mbuf
*
pkt
[
BURST_SIZE
];
struct
rte_ether_hdr
*
eth_hdr
;
uint16_t
nb_tx
=
0
;
for
(
int
i
=
0
;
i
<
BURST_SIZE
;
i
++
)
{
int
pkt_size
;
...
...
@@ -340,22 +341,25 @@ static void send_packets(int port) {
eth_hdr
->
d_addr
=
d_addr
;
eth_hdr
->
s_addr
=
s_addr
;
}
eth_hdr
->
ether_type
=
0xaefe
;
eth_hdr
->
ether_type
=
htons
(
0xaefe
)
;
memcpy
(
rte_pktmbuf_mtod_offset
(
pkt
[
i
],
uint8_t
*
,
sizeof
(
struct
rte_ether_hdr
)),
data
[
i
],
DATA_SIZE
);
pkt_size
=
DATA_SIZE
+
sizeof
(
struct
rte_ether_hdr
);
pkt
[
i
]
->
data_len
=
pkt_size
;
pkt
[
i
]
->
pkt_len
=
pkt_size
;
}
const
uint16_t
nb_tx
=
rte_eth_tx_burst
(
port
,
0
,
pkt
,
BURST_SIZE
);
while
(
nb_tx
<
BURST_SIZE
)
{
nb_tx
=
rte_eth_tx_burst
(
port
,
0
,
pkt
+
nb_tx
,
BURST_SIZE
-
nb_tx
);
}
/* Free any unsent packets. */
if
(
unlikely
(
nb_tx
<
BURST_SIZE
)
)
{
if
(
nb_tx
<
BURST_SIZE
)
{
uint16_t
buf
;
for
(
buf
=
nb_tx
;
buf
<
BURST_SIZE
;
buf
++
)
rte_pktmbuf_free
(
pkt
[
buf
]);
fprintf
(
stderr
,
"Sent %d packets instead of %d
\n
"
,
nb_tx
,
BURST_SIZE
);
exit
(
EXIT_FAILURE
);
}
}
// TODO store received packets' data in buffer
static
int
recv_packets
(
int
port
)
{
...
...
@@ -421,7 +425,7 @@ static void *send_thread(void *p) {
clock_gettime
(
CLOCK_TAI
,
&
initial
);
for
(
int64_t
i
=
1
;;
i
++
)
{
#ifdef
DEBUG
#ifdef
SEND_LIMIT
if
(
i
>
SEND_LIMIT
)
{
int64_t
d
;
clock_gettime
(
CLOCK_TAI
,
&
next
);
...
...
@@ -580,8 +584,9 @@ static void *decompress_thread(void *p) {
pthread_exit
(
EXIT_SUCCESS
);
}
static
void
*
statistic_thread
(
void
*
p
)
{
struct
timespec
next
,
initial
;
struct
timespec
next
,
initial
,
current
;
cpu_set_t
mask
;
int64_t
duration_ns
;
TRXEcpriState
*
s
=
(
TRXEcpriState
*
)
p
;
log_info
(
"STATISTIC_THREAD"
,
"Thread init"
);
...
...
@@ -596,11 +601,14 @@ static void *statistic_thread(void *p) {
next
=
initial
;
for
(;;)
{
add_ns
(
&
next
,
STATISTIC_REFRESH_RATE
);
log_info
(
"STATS"
,
"%14"
PRIi64
" - %14"
PRIi64
" - %14"
PRIi64
" - %14"
PRIi64
,
clock_gettime
(
CLOCK_TAI
,
&
current
);
duration_ns
=
calcdiff_ns
(
current
,
initial
);
log_info
(
"STATS"
,
"%14"
PRIi64
" - %14"
PRIi64
" - %14"
PRIi64
" - %14"
PRIi64
" - %14"
PRIi64
"pps"
,
prepared_frame_count
,
read_frame_count
,
sent_frame_count
,
recv_frame_count
);
recv_frame_count
,
(
NSEC_PER_SEC
*
sent_frame_count
)
/
duration_ns
);
clock_nanosleep
(
CLOCK_TAI
,
TIMER_ABSTIME
,
&
next
,
NULL
);
}
pthread_exit
(
EXIT_SUCCESS
);
...
...
@@ -706,6 +714,7 @@ static int start_threads(TRXEcpriState * s) {
int
startdpdk
(
TRXEcpriState
*
s
)
{
uint8_t
ecpri_message
[
DATA_SIZE
];
#define USE10G
#define ARGC 11
#define ARGC_LEN 256
char
_argv
[
ARGC
][
ARGC_LEN
]
=
{
...
...
@@ -714,10 +723,16 @@ int startdpdk(TRXEcpriState * s) {
"28"
,
"-b"
,
"0000:04:00.0"
,
#ifdef USE10G
"-b"
,
"0000:3b:00.0"
,
#endif
"-b"
,
"0000:3b:00.1"
,
#ifndef USE10G
"-b"
,
"0000:5e:00.0"
,
#endif
"-b"
,
"0000:5e:00.1"
,
};
...
...
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