Re: [PATCH net-next] net: Eliminate txhash in sock and reflect RX hash on transmit
flat view
From: Eric Dumazet <hidden>
Date: 2015-02-21 01:36:03
On Fri, 2015-02-20 at 16:24 -0800, Tom Herbert wrote:
Instead of having a separate hash value in sock structure for transmit and receive, we can use the rxhash value for both and eliminate the txhash value. This simplifies the code and reflects the receive hash a device provides to the stack for packets transmitted on the associated connection. The hash value returned by a device could have meaning when used in transmit to identify a flow, for instance the hash may be a flow key for a flow created in a (virtual) device. With the flow key provided on transmit this can obviate the need to create the hash and do the lookup on the fly in transmit.
quoted hunk ↗ jump to hunk
+static inline void sock_init_rxhash(struct sock *sk) +{ + get_random_bytes(&sk->sk_rxhash, sizeof(u32)); }
Wow. You just depleted entropy pool completely. prandom_bytes() or prandom_u32() will just be fine. Quite frankly, all these changes seem pointless, as you have no guarantee same hash will be used for packets of a given flow. Obviously the outgoing SYN packet has no easy way to know what will be the rxhash in opposite direction. I think I already mentioned this problem. So whats the point ?