All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [net] igb/igc: use ktime accessors for skb->tstamp
@ 2019-11-06 17:18 Jacob Keller
  2019-11-07 19:10 ` Vinicius Costa Gomes
  0 siblings, 1 reply; 2+ messages in thread
From: Jacob Keller @ 2019-11-06 17:18 UTC (permalink / raw)
  To: intel-wired-lan

When implementing launch time support in the igb and igc drivers, the
skb->tstamp value is assumed to be a s64, but it's declared as a ktime_t
value.

Although ktime_t is typedef'd to s64 it wasn't always, and the kernel
provides accessors for ktime_t values.

Use the ktime_to_timespec64 and ktime_set accessors instead of directly
assuming that the variable is always an s64.

This improves portability if the code is ever moved to another kernel
version, or if the definition of ktime_t ever changes again in the
future.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
 drivers/net/ethernet/intel/igb/igb_main.c | 4 ++--
 drivers/net/ethernet/intel/igc/igc_main.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 9148c62d9ac5..ed7e667d7eb2 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -5675,8 +5675,8 @@ static void igb_tx_ctxtdesc(struct igb_ring *tx_ring,
 	 * should have been handled by the upper layers.
 	 */
 	if (tx_ring->launchtime_enable) {
-		ts = ns_to_timespec64(first->skb->tstamp);
-		first->skb->tstamp = 0;
+		ts = ktime_to_timespec64(first->skb->tstamp);
+		first->skb->tstamp = ktime_set(0, 0);
 		context_desc->seqnum_seed = cpu_to_le32(ts.tv_nsec / 32);
 	} else {
 		context_desc->seqnum_seed = 0;
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
index 8e424dfab12e..24888676f69b 100644
--- a/drivers/net/ethernet/intel/igc/igc_main.c
+++ b/drivers/net/ethernet/intel/igc/igc_main.c
@@ -824,8 +824,8 @@ static void igc_tx_ctxtdesc(struct igc_ring *tx_ring,
 	 * should have been handled by the upper layers.
 	 */
 	if (tx_ring->launchtime_enable) {
-		ts = ns_to_timespec64(first->skb->tstamp);
-		first->skb->tstamp = 0;
+		ts = ktime_to_timespec64(first->skb->tstamp);
+		first->skb->tstamp = ktime_set(0, 0);
 		context_desc->launch_time = cpu_to_le32(ts.tv_nsec / 32);
 	} else {
 		context_desc->launch_time = 0;
-- 
2.23.0.245.gf157bbb9169d


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Intel-wired-lan] [net] igb/igc: use ktime accessors for skb->tstamp
  2019-11-06 17:18 [Intel-wired-lan] [net] igb/igc: use ktime accessors for skb->tstamp Jacob Keller
@ 2019-11-07 19:10 ` Vinicius Costa Gomes
  0 siblings, 0 replies; 2+ messages in thread
From: Vinicius Costa Gomes @ 2019-11-07 19:10 UTC (permalink / raw)
  To: intel-wired-lan

Jacob Keller <jacob.e.keller@intel.com> writes:

> When implementing launch time support in the igb and igc drivers, the
> skb->tstamp value is assumed to be a s64, but it's declared as a ktime_t
> value.
>
> Although ktime_t is typedef'd to s64 it wasn't always, and the kernel
> provides accessors for ktime_t values.
>
> Use the ktime_to_timespec64 and ktime_set accessors instead of directly
> assuming that the variable is always an s64.
>
> This improves portability if the code is ever moved to another kernel
> version, or if the definition of ktime_t ever changes again in the
> future.
>
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---

Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-07 19:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-06 17:18 [Intel-wired-lan] [net] igb/igc: use ktime accessors for skb->tstamp Jacob Keller
2019-11-07 19:10 ` Vinicius Costa Gomes

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.