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
36134017
Commit
36134017
authored
May 20, 2020
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add an option to set packet priority
parent
ba1c0eea
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
4 deletions
+11
-4
packet-exchange/src/client.c
packet-exchange/src/client.c
+7
-2
packet-exchange/src/send_packet.c
packet-exchange/src/send_packet.c
+3
-1
packet-exchange/src/send_packet.h
packet-exchange/src/send_packet.h
+1
-1
No files found.
packet-exchange/src/client.c
View file @
36134017
...
...
@@ -50,6 +50,7 @@ typedef struct thread_param {
typedef
struct
main_param
{
int
refresh_rate
;
int
packet_priority
;
}
main_param_t
;
static
inline
void
add_ns
(
struct
timespec
*
t
,
uint64_t
ns
);
...
...
@@ -116,11 +117,12 @@ int main(int argc, char *argv[]) {
param
.
enable_etf
=
0
;
main_param
.
refresh_rate
=
50000
;
main_param
.
packet_priority
=
3
;
// Process bash options
process_options
(
argc
,
argv
,
&
param
,
&
main_param
);
init_udp_etf
(
param
.
enable_etf
,
param
.
network_if
);
init_udp_etf
(
param
.
enable_etf
,
main_param
.
packet_priority
,
param
.
network_if
);
usleep
(
10000
);
...
...
@@ -144,7 +146,7 @@ int main(int argc, char *argv[]) {
static
void
process_options
(
int
argc
,
char
*
argv
[],
thread_param_t
*
param
,
main_param_t
*
main_param
)
{
for
(;;)
{
int
c
=
getopt
(
argc
,
argv
,
"aef:i:l:p:r:"
);
int
c
=
getopt
(
argc
,
argv
,
"aef:i:l:p:
q:
r:"
);
if
(
c
==
-
1
)
break
;
...
...
@@ -167,6 +169,9 @@ static void process_options(int argc, char *argv[], thread_param_t *param,
case
'p'
:
param
->
priority
=
atoi
(
optarg
);
break
;
case
'q'
:
main_param
->
packet_priority
=
atoi
(
optarg
);
break
;
case
'r'
:
main_param
->
refresh_rate
=
atoi
(
optarg
);
break
;
...
...
packet-exchange/src/send_packet.c
View file @
36134017
...
...
@@ -114,9 +114,11 @@ static int set_if(char *network_if) {
/*
* Init UDP socket
*/
void
init_udp_etf
(
int
use_etf
,
char
*
network_if
)
{
void
init_udp_etf
(
int
use_etf
,
int
packet_priority
,
char
*
network_if
)
{
int
index
;
so_priority
=
packet_priority
;
fd
=
socket
(
PF_INET
,
SOCK_DGRAM
,
IPPROTO_UDP
);
if
(
fd
<
0
)
error
(
EXIT_FAILURE
,
errno
,
"Socket creation failed
\n
"
);
...
...
packet-exchange/src/send_packet.h
View file @
36134017
...
...
@@ -4,7 +4,7 @@
#include <stdint.h>
int
send_udp_packet
(
const
char
*
ip4
);
void
init_udp_etf
(
int
use_etf
,
char
*
network_if
);
void
init_udp_etf
(
int
use_etf
,
int
so_priority
,
char
*
network_if
);
void
send_udp_packet_etf
(
int
use_etf
,
uint64_t
txtime
,
const
char
*
server_ip
);
#endif
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