]> git.baikalelectronics.ru Git - kernel.git/commit
opa_vnic: Just use skb_get_hash instead of skb_tx_hash
authorAlexander Duyck <alexander.h.duyck@intel.com>
Fri, 27 Apr 2018 18:06:35 +0000 (14:06 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 30 Apr 2018 02:01:32 +0000 (22:01 -0400)
commit7d80150a19edb17f959014576478105c00bf0c43
tree789b026390595a7e8d0bdd5629812e65ab6be5ed
parent025aed11fc7bc66e66eaf5df8ef9fd8c5dc88845
opa_vnic: Just use skb_get_hash instead of skb_tx_hash

This patch is meant to clean up how the opa_vnic is obtaining entropy from
Tx packets.

The code as it was written was claiming to get 16 bits of hash, but from
what I can tell it was only ever actually getting 14 bits as it was limited
to 0 - (2^15 - 1). It then was folding the result to get a 8 bit value for
entropy.

Instead of throwing away all that input I am cutting out the middle man and
instead having the code call skb_get_hash directly and then folding the 32
bit value into a 8 bit value using a pair of shifts and XOR operations.

Execution wise this new approach should provide more entropy and be faster
since we are bypassing the reciprocal multiplication to reduce the 32b
value to 16b and instead just using a shift/XOR combination.

In addition we can drop the unneeded adapter value from the call to get the
entropy since the netdev itself isn't even needed.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/infiniband/ulp/opa_vnic/opa_vnic_encap.c
drivers/infiniband/ulp/opa_vnic/opa_vnic_internal.h
drivers/infiniband/ulp/opa_vnic/opa_vnic_netdev.c