All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@dev.mellanox.co.il>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Matan Barak <matanb@mellanox.com>,
	Leon Romanovsky <leonro@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>,
	"David S. Miller" <davem@davemloft.net>,
	Achiad Shochat <achiad@mellanox.com>,
	Tariq Toukan <tariqt@mellanox.com>,
	Gal Pressman <galp@mellanox.com>,
	Maor Gottlieb <maorg@mellanox.com>,
	Huy Nguyen <huyn@mellanox.com>,
	Linux Netdev List <netdev@vger.kernel.org>,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] mlx5: fix 64-bit division on times
Date: Fri, 17 Jun 2016 18:09:00 +0300	[thread overview]
Message-ID: <CALzJLG9S_Q37ErepBm-7rm7vVdEZH-1gXbay+zpveHSYhpPi5A@mail.gmail.com> (raw)
In-Reply-To: <20160615152816.2800830-2-arnd@arndb.de>

On Wed, Jun 15, 2016 at 6:27 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> The mlx5 driver fails to build on 32-bit architectures after some
> references to 64-bit divisions got added:
>
> drivers/net/built-in.o: In function `mlx5e_rx_am':
> :(.text+0xf88ac): undefined reference to `__aeabi_ldivmod'
>
> The driver even performs three division here, and it uses the
> obsolete 'struct timespec' that we want to get rid of.
>
> Using ktime_t and ktime_us_delta() replaces one of the divisions
> and is mildly more efficient, aside from working across 'settimeofday'
> calls and being the right type for the y2038 conversion.
>
> Using a u32 instead of s64 to store the number of microseconds
> limits the maximum time to about 71 minutes, but if we exceed that
> time, we probably don't care about the result any more for the
> purpose of rx coalescing.
>
> For the number of packets, we are taking the difference between
> two 'unsigned int', so the result won't ever be greater than that
> either.
>
> After those changes, the other two divisions are done as 32-bit
> arithmetic operations, which are much faster.

Nice catch Arnd,  we originally fixed this with div_u64, but your
solution looks wiser.
does ktime_t gives time in a resolution same as timespec ?

As discussed before this patch can't be applied on net-next as
the original patch which it meant to fix is yet to be submitted,
I will CC you once we submit the fixed patch.

  reply	other threads:[~2016-06-17 15:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-15 15:27 [PATCH 1/2] mlx5: only register devlink when ethernet is available Arnd Bergmann
2016-06-15 15:27 ` Arnd Bergmann
2016-06-15 15:27 ` [PATCH 2/2] mlx5: fix 64-bit division on times Arnd Bergmann
2016-06-17 15:09   ` Saeed Mahameed [this message]
2016-06-17 15:24     ` Arnd Bergmann
2016-06-15 16:04 ` [PATCH 1/2] mlx5: only register devlink when ethernet is available Saeed Mahameed
     [not found]   ` <CALzJLG_CkvbrCehMjMht5KfMK6r-FbvPzzYUEhpA40YHymsh+Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-06-15 20:50     ` Arnd Bergmann
2016-06-15 20:50       ` Arnd Bergmann
2016-06-17 14:50       ` Saeed Mahameed
2016-06-17 15:02         ` Arnd Bergmann
2016-06-17 15:40           ` Leon Romanovsky
2016-06-17 15:40             ` Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALzJLG9S_Q37ErepBm-7rm7vVdEZH-1gXbay+zpveHSYhpPi5A@mail.gmail.com \
    --to=saeedm@dev.mellanox.co.il \
    --cc=achiad@mellanox.com \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=galp@mellanox.com \
    --cc=huyn@mellanox.com \
    --cc=leonro@mellanox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=maorg@mellanox.com \
    --cc=matanb@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@mellanox.com \
    --cc=tariqt@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.