diff options
author | Shlomo Pongratz <shlomop@mellanox.com> | 2013-02-19 10:40:22 -0500 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2013-02-19 11:21:35 -0500 |
commit | 9d1ad66e3eae0faf3f19a618da74b4c377474845 (patch) | |
tree | de98249a872d731bb382d6e51575dfa77fd89694 /drivers/infiniband/ulp | |
parent | 836dc9e3fbbab0c30aa6e664417225f5c1fb1c39 (diff) |
IPoIB: Fix ipoib_neigh hashing to use the correct daddr octets
The hash function introduced in commit b63b70d877 ("IPoIB: Use a
private hash table for path lookup in xmit path") was designd to use
the 3 octets of the IPoIB HW address that holds the remote QPN.
However, this currently isn't the case on little-endian machines,
because the the code there uses the flags part (octet[0]) and not the
last octet of the QPN (octet[3]). Fix this.
The fix caused a checkpatch warning on line over 80 characters, to
solve that changed the name of the temp variable that holds the daddr.
Signed-off-by: Shlomo Pongratz <shlomop@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/ulp')
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib.h | 2 | ||||
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_main.c | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index 07ca6fd5546b..a7ac0977cb5e 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h | |||
@@ -117,6 +117,8 @@ enum { | |||
117 | #define IPOIB_OP_CM (0) | 117 | #define IPOIB_OP_CM (0) |
118 | #endif | 118 | #endif |
119 | 119 | ||
120 | #define IPOIB_QPN_MASK ((__force u32) cpu_to_be32(0xFFFFFF)) | ||
121 | |||
120 | /* structs */ | 122 | /* structs */ |
121 | 123 | ||
122 | struct ipoib_header { | 124 | struct ipoib_header { |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 6fdc9e78da0d..a68628e4197a 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -844,10 +844,10 @@ static u32 ipoib_addr_hash(struct ipoib_neigh_hash *htbl, u8 *daddr) | |||
844 | * different subnets. | 844 | * different subnets. |
845 | */ | 845 | */ |
846 | /* qpn octets[1:4) & port GUID octets[12:20) */ | 846 | /* qpn octets[1:4) & port GUID octets[12:20) */ |
847 | u32 *daddr_32 = (u32 *) daddr; | 847 | u32 *d32 = (u32 *) daddr; |
848 | u32 hv; | 848 | u32 hv; |
849 | 849 | ||
850 | hv = jhash_3words(daddr_32[3], daddr_32[4], 0xFFFFFF & daddr_32[0], 0); | 850 | hv = jhash_3words(d32[3], d32[4], IPOIB_QPN_MASK & d32[0], 0); |
851 | return hv & htbl->mask; | 851 | return hv & htbl->mask; |
852 | } | 852 | } |
853 | 853 | ||