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
4ae8c18c
Commit
4ae8c18c
authored
May 20, 2020
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add function to compute txtime in udp send packet function
parent
36134017
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
packet-exchange/src/send_packet.c
packet-exchange/src/send_packet.c
+13
-1
No files found.
packet-exchange/src/send_packet.c
View file @
4ae8c18c
...
...
@@ -39,6 +39,7 @@
#define SERVER_PORT_INT 50000
#define CLOCK_ID CLOCK_TAI
#define MESSAGE ((uint32_t)0x00FACADE)
#define NSEC_PER_SEC 1000000000
int
send_udp_packet
(
const
char
*
server_ip
)
{
int
status
;
...
...
@@ -143,6 +144,17 @@ void init_udp_etf(int use_etf, int packet_priority, char *network_if) {
}
}
uint64_t
get_txtime
()
{
struct
timespec
txtime_ts
;
uint64_t
txtime
;
clock_gettime
(
CLOCK_TAI
,
&
txtime_ts
);
txtime
=
txtime_ts
.
tv_sec
*
NSEC_PER_SEC
+
txtime_ts
.
tv_nsec
;
txtime
+=
NSEC_PER_SEC
;
return
txtime
;
}
/*
* Sends udp packets using the ETF qdisc
*/
...
...
@@ -177,7 +189,7 @@ void send_udp_packet_etf(int use_etf, uint64_t txtime, const char *server_ip) {
cmsg
->
cmsg_level
=
SOL_SOCKET
;
cmsg
->
cmsg_type
=
SCM_TXTIME
;
cmsg
->
cmsg_len
=
CMSG_LEN
(
sizeof
(
uint64_t
));
*
((
uint64_t
*
)
CMSG_DATA
(
cmsg
))
=
txtime
;
*
((
uint64_t
*
)
CMSG_DATA
(
cmsg
))
=
get_txtime
()
;
msg
.
msg_controllen
=
cmsg
->
cmsg_len
;
}
...
...
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