Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Network Interface Card
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Network Interface Card
Commits
d56fc319
Commit
d56fc319
authored
Jun 13, 2022
by
Benoit Rat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
using timespec64 to compile for kernel 5.15
parent
76dbb335
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
nic-core.c
sw/kernel/nic-core.c
+4
-3
timestamp.c
sw/kernel/timestamp.c
+4
-4
No files found.
sw/kernel/nic-core.c
View file @
d56fc319
...
...
@@ -18,6 +18,7 @@
#include <linux/spinlock.h>
#include <linux/net_tstamp.h>
#include <linux/version.h>
#include <linux/time.h>
#include <asm/unaligned.h>
#include "wr-nic.h"
...
...
@@ -367,7 +368,7 @@ static void __wrn_rx_descriptor(struct wrn_dev *wrn, int desc)
int
epnum
,
off
,
len
;
u32
ts_r
,
ts_f
;
struct
skb_shared_hwtstamps
*
hwts
;
struct
timespec
ts
;
struct
timespec
64
ts
;
u32
counter_ppsg
;
/* PPS generator nanosecond counter */
u32
utc
;
s32
cntr_diff
;
...
...
@@ -434,7 +435,7 @@ static void __wrn_rx_descriptor(struct wrn_dev *wrn, int desc)
ts
.
tv_sec
|=
0x80000000
;
ts
.
tv_nsec
=
ts_r
*
NSEC_PER_TICK
;
pr_debug
(
"Timestamp: %li:%li, ahead = %d
\n
"
,
pr_debug
(
"Timestamp: %l
l
i:%li, ahead = %d
\n
"
,
ts
.
tv_sec
&
0x7fffffff
,
ts
.
tv_nsec
&
0x7fffffff
,
ts
.
tv_sec
&
0x80000000
?
1
:
0
);
...
...
@@ -448,7 +449,7 @@ static void __wrn_rx_descriptor(struct wrn_dev *wrn, int desc)
/* If the timestamp was reported as incorrect, pass 0 instead */
if
(
!
(
r1
&
NIC_RX1_D1_TS_INCORRECT
))
{
hwts
=
skb_hwtstamps
(
skb
);
hwts
->
hwtstamp
=
timespec_to_ktime
(
ts
);
hwts
->
hwtstamp
=
timespec
64
_to_ktime
(
ts
);
}
skb
->
protocol
=
eth_type_trans
(
skb
,
dev
);
...
...
sw/kernel/timestamp.c
View file @
d56fc319
...
...
@@ -21,7 +21,7 @@ void wrn_tx_tstamp_skb(struct wrn_dev *wrn, int desc)
struct
skb_shared_hwtstamps
*
hwts
;
struct
wrn_desc_pending
*
d
=
wrn
->
skb_desc
+
desc
;
struct
sk_buff
*
skb
=
d
->
skb
;
struct
timespec
ts
;
struct
timespec
64
ts
;
u32
counter_ppsg
;
/* PPS generator nanosecond counter */
u32
utc
;
...
...
@@ -39,7 +39,7 @@ void wrn_tx_tstamp_skb(struct wrn_dev *wrn, int desc)
ts
.
tv_nsec
=
d
->
cycles
*
NSEC_PER_TICK
;
if
(
!
(
d
->
valid
&
TS_INVALID
))
{
hwts
=
skb_hwtstamps
(
skb
);
hwts
->
hwtstamp
=
timespec_to_ktime
(
ts
);
hwts
->
hwtstamp
=
timespec
64
_to_ktime
(
ts
);
skb_tstamp_tx
(
skb
,
hwts
);
}
dev_kfree_skb_irq
(
skb
);
...
...
@@ -55,7 +55,7 @@ static int record_tstamp(struct wrn_dev *wrn, u32 tsval, u32 idreg, u32 r2)
int
frame_id
=
TXTSU_TSF_R1_FID_R
(
idreg
);
int
ts_incorrect
=
r2
&
TXTSU_TSF_R2_INCORRECT
;
struct
skb_shared_hwtstamps
*
hwts
;
struct
timespec
ts
;
struct
timespec
64
ts
;
struct
sk_buff
*
skb
;
u32
utc
,
counter_ppsg
;
/* PPS generator nanosecond counter */
int
i
;
...
...
@@ -84,7 +84,7 @@ static int record_tstamp(struct wrn_dev *wrn, u32 tsval, u32 idreg, u32 r2)
/* Provide the timestamp only if 100% sure about its correctness */
if
(
!
ts_incorrect
)
{
hwts
=
skb_hwtstamps
(
skb
);
hwts
->
hwtstamp
=
timespec_to_ktime
(
ts
);
hwts
->
hwtstamp
=
timespec
64
_to_ktime
(
ts
);
skb_tstamp_tx
(
skb
,
hwts
);
}
dev_kfree_skb_irq
(
skb
);
...
...
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