Thread (6 messages) 6 messages, 3 authors, 2014-04-01

RE: [PATCH 4/5] bonding: Added bond_tlb_xmit() for tlb mode.

From: David Laight <hidden>
Date: 2014-03-31 16:02:04

From: Eric Dumazet
...
quoted
+	if (!is_multicast_ether_addr(eth_data->h_dest)) {
+		switch (ntohs(skb->protocol)) {
Nit :

You can avoid the ntohs(skb->protocol)
quoted
+		case ETH_P_IP:
by using "   case htons(ETH_P_IP)

quoted
+		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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help