* [PATCH] enic: fix adaptive irq coalescing on 32-bit
@ 2014-05-23 7:51 Arnd Bergmann
2014-05-23 8:29 ` David Laight
0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2014-05-23 7:51 UTC (permalink / raw)
To: netdev
Cc: Sujith Sankar, Neel Patel, Govindarajulu Varadarajan,
David S. Miller, Christian Benvenuti
7c2ce6e60f703 "enic: Add support for adaptive interrupt coalescing"
introduced a 64-bit division that causes a link error on all 32-bit
machines:
drivers/built-in.o: In function `enic_poll_msix':
:(.text+0x54ff00): undefined reference to `__aeabi_uldivmod'
Since we are dividing another 32-bit value and are only interested
in the approximate range here, it should always be safe to limit
the delta to an u32 value.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
----
I haven't seen another report of this bug, just ignore this
mail if it was already fixed.
Also, there may be better ways to solve this.
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index 0d8995c..ad2fac2 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -1217,7 +1217,7 @@ static void enic_calc_int_moderation(struct enic *enic, struct vnic_rq *rq)
*/
traffic <<= 3;
- traffic /= delta;
+ traffic /= min_t(u32, delta, UINT_MAX);
for (index = 0; index < ENIC_MAX_COALESCE_TIMERS; index++)
if (traffic < mod_table[index].rx_rate)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH] enic: fix adaptive irq coalescing on 32-bit
2014-05-23 7:51 [PATCH] enic: fix adaptive irq coalescing on 32-bit Arnd Bergmann
@ 2014-05-23 8:29 ` David Laight
2014-05-23 9:29 ` Arnd Bergmann
0 siblings, 1 reply; 3+ messages in thread
From: David Laight @ 2014-05-23 8:29 UTC (permalink / raw)
To: 'Arnd Bergmann', netdev@vger.kernel.org
Cc: Sujith Sankar, Neel Patel, Govindarajulu Varadarajan,
David S. Miller, Christian Benvenuti
From: Arnd Bergmann
> 7c2ce6e60f703 "enic: Add support for adaptive interrupt coalescing"
> introduced a 64-bit division that causes a link error on all 32-bit
> machines:
>
> drivers/built-in.o: In function `enic_poll_msix':
> :(.text+0x54ff00): undefined reference to `__aeabi_uldivmod'
>
> Since we are dividing another 32-bit value and are only interested
> in the approximate range here, it should always be safe to limit
> the delta to an u32 value.
...
> traffic <<= 3;
> - traffic /= delta;
> + traffic /= min_t(u32, delta, UINT_MAX);
I suspect that doesn't have the desired effect.
I think it is the same as:
traffic /= (u32)delta;
If you was the correct value for large 'delta' then maybe:
traffic = delta > UINT_MAX ? 0 : traffic / (u32)delta;
David
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] enic: fix adaptive irq coalescing on 32-bit
2014-05-23 8:29 ` David Laight
@ 2014-05-23 9:29 ` Arnd Bergmann
0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2014-05-23 9:29 UTC (permalink / raw)
To: David Laight
Cc: netdev@vger.kernel.org, Sujith Sankar, Neel Patel,
Govindarajulu Varadarajan, David S. Miller, Christian Benvenuti
On Friday 23 May 2014 08:29:52 David Laight wrote:
> From: Arnd Bergmann
> > 7c2ce6e60f703 "enic: Add support for adaptive interrupt coalescing"
> > introduced a 64-bit division that causes a link error on all 32-bit
> > machines:
> >
> > drivers/built-in.o: In function `enic_poll_msix':
> > :(.text+0x54ff00): undefined reference to `__aeabi_uldivmod'
> >
> > Since we are dividing another 32-bit value and are only interested
> > in the approximate range here, it should always be safe to limit
> > the delta to an u32 value.
> ...
> > traffic <<= 3;
> > - traffic /= delta;
> > + traffic /= min_t(u32, delta, UINT_MAX);
>
> I suspect that doesn't have the desired effect.
> I think it is the same as:
> traffic /= (u32)delta;
Ah, you are right, sorry for that.
> If you was the correct value for large 'delta' then maybe:
> traffic = delta > UINT_MAX ? 0 : traffic / (u32)delta;
That looks better, yes.
Arnd
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-05-23 9:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-23 7:51 [PATCH] enic: fix adaptive irq coalescing on 32-bit Arnd Bergmann
2014-05-23 8:29 ` David Laight
2014-05-23 9:29 ` Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox