Re: [PATCH repost net-next] dsa: mv88e6xxx: Optimise atu_get

2017-01-04 Thread Andrew Lunn
> Maybe I over-reacted. I'm happy somebody other than me is thinking about this. > I just ran some test programs in userspace on both little and big > endian and they checked out. Great, thanks for testing. Andrew

Re: [PATCH repost net-next] dsa: mv88e6xxx: Optimise atu_get

2017-01-04 Thread David Miller
From: Andrew Lunn Date: Wed, 4 Jan 2017 22:19:57 +0100 > On Wed, Jan 04, 2017 at 04:11:03PM -0500, David Miller wrote: >> From: Andrew Lunn >> Date: Wed, 4 Jan 2017 19:56:24 +0100 >> >> > +static inline u64 ether_addr_to_u64(const u8 *addr) >> > +{ >> > + u64 u = 0; >> > + int i; >> > + >> >

Re: [PATCH repost net-next] dsa: mv88e6xxx: Optimise atu_get

2017-01-04 Thread Florian Fainelli
On 01/04/2017 01:19 PM, Andrew Lunn wrote: > On Wed, Jan 04, 2017 at 04:11:03PM -0500, David Miller wrote: >> From: Andrew Lunn >> Date: Wed, 4 Jan 2017 19:56:24 +0100 >> >>> +static inline u64 ether_addr_to_u64(const u8 *addr) >>> +{ >>> + u64 u = 0; >>> + int i; >>> + >>> + for (i = 0; i

Re: [PATCH repost net-next] dsa: mv88e6xxx: Optimise atu_get

2017-01-04 Thread Andrew Lunn
On Wed, Jan 04, 2017 at 04:11:03PM -0500, David Miller wrote: > From: Andrew Lunn > Date: Wed, 4 Jan 2017 19:56:24 +0100 > > > +static inline u64 ether_addr_to_u64(const u8 *addr) > > +{ > > + u64 u = 0; > > + int i; > > + > > + for (i = 0; i < ETH_ALEN; i++) > > + u = u << 8 | a

Re: [PATCH repost net-next] dsa: mv88e6xxx: Optimise atu_get

2017-01-04 Thread David Miller
From: Andrew Lunn Date: Wed, 4 Jan 2017 19:56:24 +0100 > +static inline u64 ether_addr_to_u64(const u8 *addr) > +{ > + u64 u = 0; > + int i; > + > + for (i = 0; i < ETH_ALEN; i++) > + u = u << 8 | addr[i]; > + > + return u; > +} ... > +static inline void u64_to_ether

[PATCH repost net-next] dsa: mv88e6xxx: Optimise atu_get

2017-01-04 Thread Andrew Lunn
Lookup in the ATU can be performed starting from a given MAC address. This is faster than starting with the first possible MAC address and iterating all entries. Entries are returned in numeric order. So if the MAC address returned is bigger than what we are searching for, we know it is not in the