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
0a572326
Commit
0a572326
authored
May 29, 2020
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update wrapper scripts and improve bash options on client and server
parent
67fbbe68
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
12 deletions
+56
-12
packet-exchange/src/client.c
packet-exchange/src/client.c
+24
-4
packet-exchange/src/server.c
packet-exchange/src/server.c
+30
-7
scripts/run_server
scripts/run_server
+2
-1
No files found.
packet-exchange/src/client.c
View file @
0a572326
...
...
@@ -5,7 +5,7 @@
*
* -a Run the real time thread on CPU1
* -b Measure RTT
* -d
TX_BUFFER
_LEN Set the length of tx buffer
* -d
BUF
_LEN Set the length of tx buffer
* -e Set a txtime (to be used in an ETF qdisc)
* -f IF Set the network interface to be used
* -i USEC Wake up the real time thread every USEC microseconds (Default: 10ms)
...
...
@@ -184,10 +184,25 @@ static void do_tsn_task(struct thread_param * param, uint64_t next_txtime) {
}
}
static
void
help
(
char
*
argv
[])
{
printf
(
"Usage: %s [-abet] [-d BUF_LEN] [-f IF] [-i USEC] [-l N] [-p PRIO] [-r USEC]
\n\n
"
,
argv
[
0
]);
printf
(
" -a Run the real time thread on CPU1
\n
"
);
printf
(
" -b Measure RTT
\n
"
);
printf
(
" -d BUF_LEN Set the length of tx buffer
\n
"
);
printf
(
" -e Set a txtime (to be used in an ETF qdisc)
\n
"
);
printf
(
" -f IF Set the network interface to be used
\n
"
);
printf
(
" -i USEC Wake up the real time thread every USEC microseconds (Default: 10ms)
\n
"
);
printf
(
" -l N Wake up the real time thread N times (Default: 0)
\n
"
);
printf
(
" -p PRIO Run the real time thread at priority PRIO
\n
"
);
printf
(
" -r USEC Refresh the non real time main thread every USEC microseconds (Default: 50ms)
\n
"
);
printf
(
" -t Enable timestamps
\n
"
);
printf
(
"
\n
"
);
}
static
void
process_options
(
int
argc
,
char
*
argv
[],
thread_param_t
*
param
,
main_param_t
*
main_param
)
{
for
(;;)
{
int
c
=
getopt
(
argc
,
argv
,
"abd:ef:i:l:p:q:r:t"
);
int
c
=
getopt
(
argc
,
argv
,
"abd:ef
h
:i:l:p:q:r:t"
);
if
(
c
==
-
1
)
break
;
...
...
@@ -201,7 +216,7 @@ static void process_options(int argc, char *argv[], thread_param_t *param,
case
'd'
:
main_param
->
tx_buffer_len
=
atoi
(
optarg
);
if
(
main_param
->
tx_buffer_len
<
1
)
{
fprintf
(
stderr
,
"
TX_BUFFER
_LEN should be greater than 1
\n
"
);
fprintf
(
stderr
,
"
BUF
_LEN should be greater than 1
\n
"
);
exit
(
EXIT_FAILURE
);
}
break
;
...
...
@@ -211,6 +226,10 @@ static void process_options(int argc, char *argv[], thread_param_t *param,
case
'f'
:
strcpy
(
param
->
network_if
,
optarg
);
break
;
case
'h'
:
help
(
argv
);
exit
(
EXIT_SUCCESS
);
break
;
case
'i'
:
param
->
interval
=
atoi
(
optarg
)
*
1000
;
break
;
...
...
@@ -230,13 +249,14 @@ static void process_options(int argc, char *argv[], thread_param_t *param,
param
->
enable_timestamps
=
1
;
break
;
default:
help
(
argv
);
exit
(
EXIT_FAILURE
);
break
;
}
}
if
(
argc
!=
optind
+
1
)
{
printf
(
"Usage: %s server_ip
\n
"
,
argv
[
0
]
);
help
(
argv
);
exit
(
EXIT_FAILURE
);
}
param
->
ip_address
=
argv
[
optind
];
...
...
packet-exchange/src/server.c
View file @
0a572326
...
...
@@ -4,7 +4,7 @@
* Bash options:
*
* -a Run the real time thread on CPU1
* -b
Server side RTT
* -b
CLIENT_IP
Server side RTT
* -d TX_BUFFER_LEN Set the length of tx buffer
* -f IF Set the network interface to be used
* -p PRIO Run the real time thread at priority PRIO
...
...
@@ -54,7 +54,7 @@ typedef struct thread_param {
enum
TSNTask
tsn_task
;
int
sockfd
;
c
onst
c
har
*
ip_address
;
char
*
ip_address
;
char
network_if
[
256
];
thread_stat_t
stats
;
...
...
@@ -160,10 +160,28 @@ int main(int argc, char *argv[]) {
exit
(
EXIT_SUCCESS
);
}
static
void
help
(
char
*
argv
[])
{
printf
(
"Usage: %s [-a] [-b CLIENT_IP] [-d BUF_LEN] [-f IF] [-p PRIO] [-r "
"USEC]
\n\n
"
,
argv
[
0
]);
printf
(
" -a Run the real time thread on CPU1
\n
"
);
printf
(
" -b CLIENT_IP Server side RTT
\n
"
);
printf
(
" -d BUF_LEN Set the length of tx buffer
\n
"
);
printf
(
" -f IF Set the network interface to be used
\n
"
);
printf
(
" -p PRIO Run the real time thread at priority "
"PRIO
\n
"
);
printf
(
" -r USEC Refresh the non real time main thread "
"every USEC microseconds
\n
"
);
printf
(
"
\n
"
);
}
static
void
process_options
(
int
argc
,
char
*
argv
[],
thread_param_t
*
param
,
main_param_t
*
main_param
)
{
for
(;;)
{
int
c
=
getopt
(
argc
,
argv
,
"ab
d:f:
p:r:"
);
int
c
=
getopt
(
argc
,
argv
,
"ab
:d:f:h
p:r:"
);
if
(
c
==
-
1
)
break
;
...
...
@@ -173,17 +191,22 @@ static void process_options(int argc, char *argv[], thread_param_t *param,
break
;
case
'b'
:
param
->
tsn_task
=
RTT_TASK
;
strcpy
(
param
->
ip_address
,
optarg
);
break
;
case
'd'
:
main_param
->
tx_buffer_len
=
atoi
(
optarg
);
if
(
main_param
->
tx_buffer_len
<
1
)
{
fprintf
(
stderr
,
"
TX_BUFFER
_LEN should be greater than 1
\n
"
);
fprintf
(
stderr
,
"
BUF
_LEN should be greater than 1
\n
"
);
exit
(
EXIT_FAILURE
);
}
break
;
case
'f'
:
strcpy
(
param
->
network_if
,
optarg
);
break
;
case
'h'
:
help
(
argv
);
exit
(
EXIT_SUCCESS
);
break
;
case
'p'
:
param
->
priority
=
atoi
(
optarg
);
break
;
...
...
@@ -191,15 +214,15 @@ static void process_options(int argc, char *argv[], thread_param_t *param,
main_param
->
refresh_rate
=
atoi
(
optarg
);
break
;
default:
help
(
argv
);
exit
(
EXIT_FAILURE
);
break
;
}
}
if
(
argc
!=
optind
+
1
)
{
printf
(
"Usage: %s client_ip
\n
"
,
argv
[
0
]
);
if
(
argc
!=
optind
)
{
help
(
argv
);
exit
(
EXIT_FAILURE
);
}
param
->
ip_address
=
argv
[
optind
];
}
scripts/run_server
View file @
0a572326
...
...
@@ -7,12 +7,13 @@ usage() {
exit
1
;
}
server_options
=
"-a -p 99"
server_options
=
"-a -p 99"
while
getopts
"bt:"
opt
;
do
case
"
${
opt
}
"
in
b
)
server_options+
=
" -b"
server_options+
=
" -b
192.168.99.26
"
;;
t
)
use_tcpdump
=
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