diff options
author | Eran Ben Elisha <eranbe@mellanox.com> | 2016-11-10 04:31:01 -0500 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2016-12-13 13:32:51 -0500 |
commit | bf08e884bfd5be068fd2ccf2bc450f085d8dd853 (patch) | |
tree | b7b2121841ad8ef990b5b30e3bb955312a7033ac /drivers/infiniband/hw/mlx4 | |
parent | 1f22e454df2eb99ba6b7ace3f594f6805cdf5cbc (diff) |
IB/mlx4: Check if GRH is available before using it
Before reading GRH attributes, need to make sure AH contains GRH,
and in addition, initialize GID type.
Fixes: dbf727de7440 ('IB/core: Use GID table in AH creation and dmac resolution')
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Daniel Jurgens <danielj@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/hw/mlx4')
-rw-r--r-- | drivers/infiniband/hw/mlx4/qp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index 570bc866b1d6..0914731c9aac 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c | |||
@@ -1764,14 +1764,14 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp, | |||
1764 | u8 port_num = mlx4_is_bonded(to_mdev(ibqp->device)->dev) ? 1 : | 1764 | u8 port_num = mlx4_is_bonded(to_mdev(ibqp->device)->dev) ? 1 : |
1765 | attr_mask & IB_QP_PORT ? attr->port_num : qp->port; | 1765 | attr_mask & IB_QP_PORT ? attr->port_num : qp->port; |
1766 | union ib_gid gid; | 1766 | union ib_gid gid; |
1767 | struct ib_gid_attr gid_attr; | 1767 | struct ib_gid_attr gid_attr = {.gid_type = IB_GID_TYPE_IB}; |
1768 | u16 vlan = 0xffff; | 1768 | u16 vlan = 0xffff; |
1769 | u8 smac[ETH_ALEN]; | 1769 | u8 smac[ETH_ALEN]; |
1770 | int status = 0; | 1770 | int status = 0; |
1771 | int is_eth = rdma_cap_eth_ah(&dev->ib_dev, port_num) && | 1771 | int is_eth = rdma_cap_eth_ah(&dev->ib_dev, port_num) && |
1772 | attr->ah_attr.ah_flags & IB_AH_GRH; | 1772 | attr->ah_attr.ah_flags & IB_AH_GRH; |
1773 | 1773 | ||
1774 | if (is_eth) { | 1774 | if (is_eth && attr->ah_attr.ah_flags & IB_AH_GRH) { |
1775 | int index = attr->ah_attr.grh.sgid_index; | 1775 | int index = attr->ah_attr.grh.sgid_index; |
1776 | 1776 | ||
1777 | status = ib_get_cached_gid(ibqp->device, port_num, | 1777 | status = ib_get_cached_gid(ibqp->device, port_num, |