[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4CDB2EBC.2090905@candelatech.com>
Date: Wed, 10 Nov 2010 15:46:04 -0800
From: Ben Greear <greearb@...delatech.com>
To: Eric Dumazet <eric.dumazet@...il.com>
CC: netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH] macvlan: lockless tx path
On 11/10/2010 03:36 PM, Eric Dumazet wrote:
> Le mercredi 10 novembre 2010 à 14:53 -0800, Ben Greear a écrit :
>
>> I did similar, and then wrote extra code to detect a 64-bit kernel and if
>> so assume that the counters wrap at 64 bits so I didn't have to poll so
>> often to make sure I didn't miss a wrap for a 10G NIC. If instead one wraps at 33
>> bits and the other at 36, there is no way for me to deal with the wrap
>> properly w/out explicitly knowing about that 33 and 36.
>>
>
> How do you define 'wrap around' ? Maybe your definition is wrong.
Maybe so. My algorithm looks like:
// uint64 accum;
// uint32 old;
// uint32 new;
if (old > new) {
// This assumes counters wrap at 32 bits (ie, 0xFFFFFFFF).
accum += ((uint32)(0xFFFFFFFF) - old) + new;
}
else if (old < new) {
accum += new - old;
}
old = new;
...
Is there some way I can do this w/out the (0xFFFFFFFF - old),
and thus the assumption of 32-bit counters?
Thanks,
Ben
--
Ben Greear <greearb@...delatech.com>
Candela Technologies Inc http://www.candelatech.com
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists