linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] [RESEND] liquidio: use ktime_get_real_ts64() instead of getnstimeofday64()
@ 2018-07-11 12:29 Arnd Bergmann
  2018-07-11 12:29 ` [PATCH 2/2] [RESEND] nfp: avoid using getnstimeofday64() Arnd Bergmann
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Arnd Bergmann @ 2018-07-11 12:29 UTC (permalink / raw)
  To: Derek Chickles, Satanand Burla, Felix Manlunas, Raghu Vatsavayi,
	David S. Miller
  Cc: Arnd Bergmann, Intiyaz Basha, Rick Farrington,
	Veerasenareddy Burru, Vijaya Mohan Guvva, Weilin Chang, netdev,
	linux-kernel

The two do the same thing, but we want to have a consistent
naming in the kernel.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/ethernet/cavium/liquidio/lio_main.c       | 2 +-
 drivers/net/ethernet/cavium/liquidio/octeon_console.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c
index 19d03fc24305..30884ad0a509 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
@@ -687,7 +687,7 @@ static void lio_sync_octeon_time(struct work_struct *work)
 	lt = (struct lio_time *)sc->virtdptr;
 
 	/* Get time of the day */
-	getnstimeofday64(&ts);
+	ktime_get_real_ts64(&ts);
 	lt->sec = ts.tv_sec;
 	lt->nsec = ts.tv_nsec;
 	octeon_swap_8B_data((u64 *)lt, (sizeof(struct lio_time)) / 8);
diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_console.c b/drivers/net/ethernet/cavium/liquidio/octeon_console.c
index 7f97ae48efed..0cc2338d8d2a 100644
--- a/drivers/net/ethernet/cavium/liquidio/octeon_console.c
+++ b/drivers/net/ethernet/cavium/liquidio/octeon_console.c
@@ -902,7 +902,7 @@ int octeon_download_firmware(struct octeon_device *oct, const u8 *data,
 	 *
 	 * Octeon always uses UTC time. so timezone information is not sent.
 	 */
-	getnstimeofday64(&ts);
+	ktime_get_real_ts64(&ts);
 	ret = snprintf(boottime, MAX_BOOTTIME_SIZE,
 		       " time_sec=%lld time_nsec=%ld",
 		       (s64)ts.tv_sec, ts.tv_nsec);
-- 
2.9.0


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

* [PATCH 2/2] [RESEND] nfp: avoid using getnstimeofday64()
  2018-07-11 12:29 [PATCH 1/2] [RESEND] liquidio: use ktime_get_real_ts64() instead of getnstimeofday64() Arnd Bergmann
@ 2018-07-11 12:29 ` Arnd Bergmann
  2018-07-12 21:56   ` David Miller
  2018-07-12 21:03 ` [PATCH 1/2] [RESEND] liquidio: use ktime_get_real_ts64() instead of getnstimeofday64() Felix Manlunas
  2018-07-12 21:56 ` David Miller
  2 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2018-07-11 12:29 UTC (permalink / raw)
  To: Jakub Kicinski, David S. Miller
  Cc: Arnd Bergmann, John Hurley, Simon Horman,
	Pieter Jansen van Vuuren, Jiri Pirko, oss-drivers, netdev,
	linux-kernel

getnstimeofday64 is deprecated in favor of the ktime_get() family of
functions. The direct replacement would be ktime_get_real_ts64(),
but I'm picking the basic ktime_get() instead:

- using a ktime_t simplifies the code compared to timespec64
- using monotonic time instead of real time avoids issues caused
  by a concurrent settimeofday() or during a leap second adjustment.

Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/ethernet/netronome/nfp/flower/main.h     |  2 +-
 drivers/net/ethernet/netronome/nfp/flower/metadata.c | 12 +++++-------
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.h b/drivers/net/ethernet/netronome/nfp/flower/main.h
index bbe5764d26cb..ef2114d13387 100644
--- a/drivers/net/ethernet/netronome/nfp/flower/main.h
+++ b/drivers/net/ethernet/netronome/nfp/flower/main.h
@@ -73,7 +73,7 @@ struct nfp_app;
 
 struct nfp_fl_mask_id {
 	struct circ_buf mask_id_free_list;
-	struct timespec64 *last_used;
+	ktime_t *last_used;
 	u8 init_unallocated;
 };
 
diff --git a/drivers/net/ethernet/netronome/nfp/flower/metadata.c b/drivers/net/ethernet/netronome/nfp/flower/metadata.c
index 93fb809f50d1..c098730544b7 100644
--- a/drivers/net/ethernet/netronome/nfp/flower/metadata.c
+++ b/drivers/net/ethernet/netronome/nfp/flower/metadata.c
@@ -158,7 +158,6 @@ static int nfp_release_mask_id(struct nfp_app *app, u8 mask_id)
 {
 	struct nfp_flower_priv *priv = app->priv;
 	struct circ_buf *ring;
-	struct timespec64 now;
 
 	ring = &priv->mask_ids.mask_id_free_list;
 	/* Checking if buffer is full. */
@@ -169,8 +168,7 @@ static int nfp_release_mask_id(struct nfp_app *app, u8 mask_id)
 	ring->head = (ring->head + NFP_FLOWER_MASK_ELEMENT_RS) %
 		     (NFP_FLOWER_MASK_ENTRY_RS * NFP_FLOWER_MASK_ELEMENT_RS);
 
-	getnstimeofday64(&now);
-	priv->mask_ids.last_used[mask_id] = now;
+	priv->mask_ids.last_used[mask_id] = ktime_get();
 
 	return 0;
 }
@@ -178,7 +176,7 @@ static int nfp_release_mask_id(struct nfp_app *app, u8 mask_id)
 static int nfp_mask_alloc(struct nfp_app *app, u8 *mask_id)
 {
 	struct nfp_flower_priv *priv = app->priv;
-	struct timespec64 delta, now;
+	ktime_t reuse_timeout;
 	struct circ_buf *ring;
 	u8 temp_id, freed_id;
 
@@ -198,10 +196,10 @@ static int nfp_mask_alloc(struct nfp_app *app, u8 *mask_id)
 	memcpy(&temp_id, &ring->buf[ring->tail], NFP_FLOWER_MASK_ELEMENT_RS);
 	*mask_id = temp_id;
 
-	getnstimeofday64(&now);
-	delta = timespec64_sub(now, priv->mask_ids.last_used[*mask_id]);
+	reuse_timeout = ktime_add_ns(priv->mask_ids.last_used[*mask_id],
+				     NFP_FL_MASK_REUSE_TIME_NS);
 
-	if (timespec64_to_ns(&delta) < NFP_FL_MASK_REUSE_TIME_NS)
+	if (ktime_before(ktime_get(), reuse_timeout))
 		goto err_not_found;
 
 	memcpy(&ring->buf[ring->tail], &freed_id, NFP_FLOWER_MASK_ELEMENT_RS);
-- 
2.9.0


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

* Re: [PATCH 1/2] [RESEND] liquidio: use ktime_get_real_ts64() instead of getnstimeofday64()
  2018-07-11 12:29 [PATCH 1/2] [RESEND] liquidio: use ktime_get_real_ts64() instead of getnstimeofday64() Arnd Bergmann
  2018-07-11 12:29 ` [PATCH 2/2] [RESEND] nfp: avoid using getnstimeofday64() Arnd Bergmann
@ 2018-07-12 21:03 ` Felix Manlunas
  2018-07-12 21:56 ` David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: Felix Manlunas @ 2018-07-12 21:03 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Derek Chickles, Satanand Burla, Felix Manlunas, Raghu Vatsavayi,
	David S. Miller, Intiyaz Basha, Rick Farrington,
	Veerasenareddy Burru, Vijaya Mohan Guvva, Weilin Chang, netdev,
	linux-kernel

On Wed, Jul 11, 2018 at 02:29:52PM +0200, Arnd Bergmann wrote:
> The two do the same thing, but we want to have a consistent
> naming in the kernel.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/net/ethernet/cavium/liquidio/lio_main.c       | 2 +-
>  drivers/net/ethernet/cavium/liquidio/octeon_console.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c
> index 19d03fc24305..30884ad0a509 100644
> --- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
> +++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
> @@ -687,7 +687,7 @@ static void lio_sync_octeon_time(struct work_struct *work)
>         lt = (struct lio_time *)sc->virtdptr;
> 
>         /* Get time of the day */
> -       getnstimeofday64(&ts);
> +       ktime_get_real_ts64(&ts);
>         lt->sec = ts.tv_sec;
>         lt->nsec = ts.tv_nsec;
>         octeon_swap_8B_data((u64 *)lt, (sizeof(struct lio_time)) / 8);
> diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_console.c b/drivers/net/ethernet/cavium/liquidio/octeon_console.c
> index 7f97ae48efed..0cc2338d8d2a 100644
> --- a/drivers/net/ethernet/cavium/liquidio/octeon_console.c
> +++ b/drivers/net/ethernet/cavium/liquidio/octeon_console.c
> @@ -902,7 +902,7 @@ int octeon_download_firmware(struct octeon_device *oct, const u8 *data,
>          *
>          * Octeon always uses UTC time. so timezone information is not sent.
>          */
> -       getnstimeofday64(&ts);
> +       ktime_get_real_ts64(&ts);
>         ret = snprintf(boottime, MAX_BOOTTIME_SIZE,
>                        " time_sec=%lld time_nsec=%ld",
>                        (s64)ts.tv_sec, ts.tv_nsec);
> --
> 2.9.0
> 

Acked-by: Felix Manlunas <felix.manlunas@cavium.com>

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

* Re: [PATCH 1/2] [RESEND] liquidio: use ktime_get_real_ts64() instead of getnstimeofday64()
  2018-07-11 12:29 [PATCH 1/2] [RESEND] liquidio: use ktime_get_real_ts64() instead of getnstimeofday64() Arnd Bergmann
  2018-07-11 12:29 ` [PATCH 2/2] [RESEND] nfp: avoid using getnstimeofday64() Arnd Bergmann
  2018-07-12 21:03 ` [PATCH 1/2] [RESEND] liquidio: use ktime_get_real_ts64() instead of getnstimeofday64() Felix Manlunas
@ 2018-07-12 21:56 ` David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2018-07-12 21:56 UTC (permalink / raw)
  To: arnd
  Cc: derek.chickles, satananda.burla, felix.manlunas, raghu.vatsavayi,
	intiyaz.basha, ricardo.farrington, veerasenareddy.burru,
	vijaya.guvva, weilin.chang, netdev, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>
Date: Wed, 11 Jul 2018 14:29:52 +0200

> The two do the same thing, but we want to have a consistent
> naming in the kernel.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied to net-next.

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

* Re: [PATCH 2/2] [RESEND] nfp: avoid using getnstimeofday64()
  2018-07-11 12:29 ` [PATCH 2/2] [RESEND] nfp: avoid using getnstimeofday64() Arnd Bergmann
@ 2018-07-12 21:56   ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2018-07-12 21:56 UTC (permalink / raw)
  To: arnd
  Cc: jakub.kicinski, john.hurley, simon.horman,
	pieter.jansenvanvuuren, jiri, oss-drivers, netdev, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>
Date: Wed, 11 Jul 2018 14:29:53 +0200

> getnstimeofday64 is deprecated in favor of the ktime_get() family of
> functions. The direct replacement would be ktime_get_real_ts64(),
> but I'm picking the basic ktime_get() instead:
> 
> - using a ktime_t simplifies the code compared to timespec64
> - using monotonic time instead of real time avoids issues caused
>   by a concurrent settimeofday() or during a leap second adjustment.
> 
> Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied to net-next.

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

end of thread, other threads:[~2018-07-12 21:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-11 12:29 [PATCH 1/2] [RESEND] liquidio: use ktime_get_real_ts64() instead of getnstimeofday64() Arnd Bergmann
2018-07-11 12:29 ` [PATCH 2/2] [RESEND] nfp: avoid using getnstimeofday64() Arnd Bergmann
2018-07-12 21:56   ` David Miller
2018-07-12 21:03 ` [PATCH 1/2] [RESEND] liquidio: use ktime_get_real_ts64() instead of getnstimeofday64() Felix Manlunas
2018-07-12 21:56 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).