IB/core: Fix calculation of maximum RoCE MTU

The original code only took into consideration the largest header
possible after the IB_BTH_BYTES.  This was incorrect, as the largest
possible header size is the largest possible combination of headers we
might run into.  The new code accounts for all possible headers in the
largest possible combination and subtracts that from the MTU to make
sure that all packets will fit on the wire.

Link: https://www.spinics.net/lists/linux-rdma/msg54558.html
Fixes: 3c86aa70bf ("RDMA/cm: Add RDMA CM support for IBoE devices")
Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
Reported-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
Parav Pandit
2017-10-16 08:45:16 +03:00
committed by Doug Ledford
parent 39baf10310
commit 99260132fd
2 changed files with 15 additions and 11 deletions

View File

@@ -37,14 +37,17 @@
#include <uapi/linux/if_ether.h>
enum {
IB_LRH_BYTES = 8,
IB_ETH_BYTES = 14,
IB_VLAN_BYTES = 4,
IB_GRH_BYTES = 40,
IB_IP4_BYTES = 20,
IB_UDP_BYTES = 8,
IB_BTH_BYTES = 12,
IB_DETH_BYTES = 8
IB_LRH_BYTES = 8,
IB_ETH_BYTES = 14,
IB_VLAN_BYTES = 4,
IB_GRH_BYTES = 40,
IB_IP4_BYTES = 20,
IB_UDP_BYTES = 8,
IB_BTH_BYTES = 12,
IB_DETH_BYTES = 8,
IB_EXT_ATOMICETH_BYTES = 28,
IB_EXT_XRC_BYTES = 4,
IB_ICRC_BYTES = 4
};
struct ib_field {