[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D0F6ECFA7@AcuExch.aculab.com>
Date: Mon, 31 Mar 2014 16:00:52 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Eric Dumazet' <eric.dumazet@...il.com>,
Mahesh Bandewar <maheshb@...gle.com>
CC: Jay Vosburgh <fubar@...ibm.com>,
Veaceslav Falico <vfalico@...hat.com>,
Andy Gospodarek <andy@...yhouse.net>,
David Miller <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Eric Dumazet <edumazet@...gle.com>,
"Maciej Zenczykowski" <maze@...gle.com>
Subject: RE: [PATCH 4/5] bonding: Added bond_tlb_xmit() for tlb mode.
From: Eric Dumazet
...
> > + if (!is_multicast_ether_addr(eth_data->h_dest)) {
> > + switch (ntohs(skb->protocol)) {
>
> Nit :
>
> You can avoid the ntohs(skb->protocol)
>
> > + case ETH_P_IP:
>
> by using " case htons(ETH_P_IP)
>
>
> > + case ETH_P_IPX: /* In case of IPX, it will falback to L2 hash */
> > + case ETH_P_IPV6:
> > + hash_index = bond_xmit_hash(bond, skb);
> > + tx_slave = tlb_choose_channel(bond, hash_index & 0xFF, skb->len);
> > + break;
> > + }
> > + }
Which may or not be faster...
As coded the case labels may be dense enough to generate a jump table.
If byte reversed the generated code will be a branch tree.
A deep branch tree will be worse, a match on the first item of a branch
tree will almost certainly be better.
I'm not going to guess where the breakeven point is for any modern cpus.
David
Powered by blists - more mailing lists