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
f09aa981
Commit
f09aa981
authored
Jun 24, 2020
by
Joanne Hugé
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix timestamp buffer segmentation fault in recv_packet
parent
1593fe37
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
5 deletions
+7
-5
packet-exchange/src/common.h
packet-exchange/src/common.h
+2
-0
packet-exchange/src/recv_packet.c
packet-exchange/src/recv_packet.c
+5
-3
packet-exchange/src/send_packet.c
packet-exchange/src/send_packet.c
+0
-2
No files found.
packet-exchange/src/common.h
View file @
f09aa981
...
...
@@ -18,6 +18,8 @@
#define MAX_BUFFER_SIZE 1024
#define TIMESTAMP_BUFFER_SIZE 64
uint64_t
ts_to_uint
(
struct
timespec
t
);
void
add_ns
(
struct
timespec
*
t
,
uint64_t
ns
);
uint64_t
calcdiff_ns
(
struct
timespec
t1
,
struct
timespec
t2
);
...
...
packet-exchange/src/recv_packet.c
View file @
f09aa981
...
...
@@ -39,7 +39,7 @@ static ingress_stat_t *stats;
static
uint64_t
*
kernel_latency_hist
;
static
int
use_histogram
;
static
uint64_t
timestamps_buffer
[
64
];
static
uint64_t
timestamps_buffer
[
TIMESTAMP_BUFFER_SIZE
];
static
int
ts_buf_read_index
=
0
;
static
int
ts_buf_write_index
=
0
;
...
...
@@ -132,7 +132,8 @@ void recv_udp_packet() {
if
(
params
->
use_timestamps
)
{
clock_gettime
(
CLOCK_REALTIME
,
&
ts
);
timestamps_buffer
[
ts_buf_write_index
++
]
=
ts_to_uint
(
ts
);
timestamps_buffer
[
ts_buf_write_index
]
=
ts_to_uint
(
ts
);
ts_buf_write_index
=
(
ts_buf_write_index
+
1
)
%
TIMESTAMP_BUFFER_SIZE
;
}
iov
.
iov_base
=
&
rx_buffer
;
...
...
@@ -156,7 +157,8 @@ void recv_udp_packet() {
struct
timespec
*
stamp
=
(
struct
timespec
*
)
CMSG_DATA
(
cmsg
);
uint64_t
kernel_latency
=
timestamps_buffer
[
ts_buf_read_index
++
]
-
ts_to_uint
(
*
stamp
);
uint64_t
kernel_latency
=
timestamps_buffer
[
ts_buf_read_index
]
-
ts_to_uint
(
*
stamp
);
ts_buf_read_index
=
(
ts_buf_read_index
+
1
)
%
TIMESTAMP_BUFFER_SIZE
;
kernel_latency
/=
1000u
;
stats
->
min_kernel_latency
=
min
(
kernel_latency
,
stats
->
min_kernel_latency
);
...
...
packet-exchange/src/send_packet.c
View file @
f09aa981
...
...
@@ -37,8 +37,6 @@
#include "common.h"
#include "send_packet.h"
#define TIMESTAMP_BUFFER_SIZE 64
static
void
*
poll_thread
(
void
*
p
);
static
void
process_error_queue
();
...
...
Joanne Hugé
@jhuge
mentioned in commit
2aa17b73
·
Jul 31, 2020
mentioned in commit
2aa17b73
mentioned in commit 2aa17b73fd8c7c5a0c0e35ba717a55e84582700d
Toggle commit list
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