Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
tsn-measures
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
tsn-measures
Commits
4ca02206
Commit
4ca02206
authored
Jun 09, 2020
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send increasing numbers as packet data
parent
b94ded12
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
13 deletions
+13
-13
packet-exchange/src/client.c
packet-exchange/src/client.c
+8
-5
packet-exchange/src/send_packet.c
packet-exchange/src/send_packet.c
+3
-6
packet-exchange/src/send_packet.h
packet-exchange/src/send_packet.h
+1
-1
packet-exchange/src/server.c
packet-exchange/src/server.c
+1
-1
No files found.
packet-exchange/src/client.c
View file @
4ca02206
...
@@ -54,7 +54,7 @@ typedef struct network_config {
...
@@ -54,7 +54,7 @@ typedef struct network_config {
// Static functions
// Static functions
static
void
process_options
(
int
argc
,
char
*
argv
[]);
static
void
process_options
(
int
argc
,
char
*
argv
[]);
static
void
do_tsn_task
(
struct
thread_param
*
param
,
uint64_t
next_txtime
);
static
void
do_tsn_task
(
struct
thread_param
*
param
,
char
*
data
,
uint64_t
next_txtime
);
static
void
print_histograms
();
static
void
print_histograms
();
static
void
sigint_handler
(
int
sig_num
);
static
void
sigint_handler
(
int
sig_num
);
...
@@ -78,6 +78,8 @@ static enum TSNTask tsn_task;
...
@@ -78,6 +78,8 @@ static enum TSNTask tsn_task;
struct
timespec
measures_start
;
struct
timespec
measures_start
;
struct
timespec
measures_end
;
struct
timespec
measures_end
;
char
send_data
[
MAX_BUFFER_SIZE
];
static
void
help
(
char
*
argv
[])
{
static
void
help
(
char
*
argv
[])
{
printf
(
"Usage: %s -f IF [-abthgv] [-e ETF_OFFSET] [-d BUF_LEN] [-i USEC] [-l N] [-p PRIO] [-q PACKET_PRIO] [-r USEC]
\n\n
"
,
argv
[
0
]);
printf
(
"Usage: %s -f IF [-abthgv] [-e ETF_OFFSET] [-d BUF_LEN] [-i USEC] [-l N] [-p PRIO] [-q PACKET_PRIO] [-r USEC]
\n\n
"
,
argv
[
0
]);
printf
(
" -a Run the real time thread on CPU1
\n
"
);
printf
(
" -a Run the real time thread on CPU1
\n
"
);
...
@@ -138,7 +140,8 @@ static void *packet_sending_thread(void *p) {
...
@@ -138,7 +140,8 @@ static void *packet_sending_thread(void *p) {
if
(
stats
->
nb_cycles
>=
param
->
max_cycles
)
if
(
stats
->
nb_cycles
>=
param
->
max_cycles
)
break
;
break
;
do_tsn_task
(
param
,
next_txtime
);
sprintf
(
send_data
,
"%d"
,
stats
->
nb_cycles
%
1000
);
do_tsn_task
(
param
,
send_data
,
next_txtime
);
add_ns
(
&
next
,
param
->
interval
);
add_ns
(
&
next
,
param
->
interval
);
...
@@ -237,7 +240,7 @@ int main(int argc, char *argv[]) {
...
@@ -237,7 +240,7 @@ int main(int argc, char *argv[]) {
}
}
// Critical TSN task
// Critical TSN task
static
void
do_tsn_task
(
struct
thread_param
*
param
,
uint64_t
next_txtime
)
{
static
void
do_tsn_task
(
struct
thread_param
*
param
,
char
*
data
,
uint64_t
next_txtime
)
{
struct
timespec
t1
,
t2
;
struct
timespec
t1
,
t2
;
int
rtt_us
;
int
rtt_us
;
...
@@ -245,14 +248,14 @@ static void do_tsn_task(struct thread_param *param, uint64_t next_txtime) {
...
@@ -245,14 +248,14 @@ static void do_tsn_task(struct thread_param *param, uint64_t next_txtime) {
if
(
tsn_task
==
SEND_PACKET_TASK
)
{
if
(
tsn_task
==
SEND_PACKET_TASK
)
{
param
->
stats
.
packet_info
=
send_udp_packet
(
param
->
stats
.
packet_info
=
send_udp_packet
(
enable_etf
,
enable_timestamps
,
next_txtime
,
enable_etf
,
enable_timestamps
,
data
,
next_txtime
,
network_config
.
ip_address
,
histograms
);
network_config
.
ip_address
,
histograms
);
// Round Trip Time measurement
// Round Trip Time measurement
}
else
if
(
tsn_task
==
RTT_TASK
)
{
}
else
if
(
tsn_task
==
RTT_TASK
)
{
clock_gettime
(
CLOCK_MONOTONIC
,
&
t1
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
t1
);
send_udp_packet
(
0
,
0
,
next_txtime
,
send_udp_packet
(
0
,
0
,
data
,
next_txtime
,
network_config
.
ip_address
,
NULL
);
network_config
.
ip_address
,
NULL
);
recv_udp_packet
(
0
,
0
,
NULL
);
recv_udp_packet
(
0
,
0
,
NULL
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
t2
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
t2
);
...
...
packet-exchange/src/send_packet.c
View file @
4ca02206
...
@@ -74,12 +74,6 @@ static void init_tx_buffer(size_t _tx_buffer_len) {
...
@@ -74,12 +74,6 @@ static void init_tx_buffer(size_t _tx_buffer_len) {
tx_buffer_len
=
_tx_buffer_len
;
tx_buffer_len
=
_tx_buffer_len
;
tx_buffer
=
malloc
(
tx_buffer_len
);
tx_buffer
=
malloc
(
tx_buffer_len
);
for
(
int
i
=
0
;
i
<
(((
int
)
tx_buffer_len
)
-
1
);
i
++
)
{
tx_buffer
[
i
]
=
(
unsigned
char
)
i
;
}
tx_buffer
[
tx_buffer_len
-
1
]
=
'\0'
;
}
}
/*
/*
...
@@ -147,6 +141,7 @@ uint64_t get_txtime() {
...
@@ -147,6 +141,7 @@ uint64_t get_txtime() {
* Sends udp packets
* Sends udp packets
*/
*/
packet_info_t
send_udp_packet
(
int
use_etf
,
int
use_timestamps
,
packet_info_t
send_udp_packet
(
int
use_etf
,
int
use_timestamps
,
char
*
data
,
uint64_t
txtime
,
uint64_t
txtime
,
const
char
*
server_ip
,
const
char
*
server_ip
,
int64_t
histograms
[
NB_HISTOGRAMS
][
MAX_HIST_VAL
])
{
int64_t
histograms
[
NB_HISTOGRAMS
][
MAX_HIST_VAL
])
{
...
@@ -168,6 +163,8 @@ packet_info_t send_udp_packet(int use_etf, int use_timestamps,
...
@@ -168,6 +163,8 @@ packet_info_t send_udp_packet(int use_etf, int use_timestamps,
packet_info
.
userspace_enter_ts
=
ts_to_uint
(
ts
);
packet_info
.
userspace_enter_ts
=
ts_to_uint
(
ts
);
}
}
strcpy
(
tx_buffer
,
data
);
memset
(
&
sin
,
0
,
sizeof
(
sin
));
memset
(
&
sin
,
0
,
sizeof
(
sin
));
sin
.
sin_family
=
AF_INET
;
sin
.
sin_family
=
AF_INET
;
sin
.
sin_addr
.
s_addr
=
inet_addr
(
server_ip
);
sin
.
sin_addr
.
s_addr
=
inet_addr
(
server_ip
);
...
...
packet-exchange/src/send_packet.h
View file @
4ca02206
...
@@ -4,6 +4,6 @@
...
@@ -4,6 +4,6 @@
#include "utilities.h"
#include "utilities.h"
void
init_udp_send
(
int
use_etf
,
int
use_timestamps
,
int
so_priority
,
char
*
network_if
,
size_t
tx_buffer_len
);
void
init_udp_send
(
int
use_etf
,
int
use_timestamps
,
int
so_priority
,
char
*
network_if
,
size_t
tx_buffer_len
);
packet_info_t
send_udp_packet
(
int
use_etf
,
int
use_timestamps
,
uint64_t
txtime
,
const
char
*
server_ip
,
int64_t
histograms
[
NB_HISTOGRAMS
][
MAX_HIST_VAL
]);
packet_info_t
send_udp_packet
(
int
use_etf
,
int
use_timestamps
,
char
*
data
,
uint64_t
txtime
,
const
char
*
server_ip
,
int64_t
histograms
[
NB_HISTOGRAMS
][
MAX_HIST_VAL
]);
#endif
#endif
packet-exchange/src/server.c
View file @
4ca02206
...
@@ -130,7 +130,7 @@ static void *packet_receiving_thread(void *p) {
...
@@ -130,7 +130,7 @@ static void *packet_receiving_thread(void *p) {
if
(
tsn_task
==
RTT_TASK
)
{
if
(
tsn_task
==
RTT_TASK
)
{
recv_udp_packet
(
0
,
0
,
NULL
);
recv_udp_packet
(
0
,
0
,
NULL
);
send_udp_packet
(
0
,
0
,
0
,
network_config
.
ip_address
,
NULL
);
send_udp_packet
(
0
,
0
,
""
,
0
,
network_config
.
ip_address
,
NULL
);
}
else
if
(
tsn_task
==
RECV_PACKET_TASK
)
{
}
else
if
(
tsn_task
==
RECV_PACKET_TASK
)
{
...
...
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