diff options
author | Parav Pandit <parav@mellanox.com> | 2018-03-13 10:06:14 -0400 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-03-15 16:40:37 -0400 |
commit | 563c4ba3bd2b8b0b21c65669ec2226b1cfa1138b (patch) | |
tree | 5ecde412e1951d707c8f09db5d214587dc3784d8 /drivers/infiniband/core/multicast.c | |
parent | 6d337179f28cc50ddd7e224f677b4cda70b275fc (diff) |
IB/core: Honor port_num while resolving GID for IB link layer
ah_attr contains the port number to which cm_id is bound. However, while
searching for GID table for matching GID entry, the port number is
ignored.
This could cause the wrong GID to be used when the ah_attr is converted to
an AH.
Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core/multicast.c')
-rw-r--r-- | drivers/infiniband/core/multicast.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/infiniband/core/multicast.c b/drivers/infiniband/core/multicast.c index 45f2f095f793..4eb72ff539fc 100644 --- a/drivers/infiniband/core/multicast.c +++ b/drivers/infiniband/core/multicast.c | |||
@@ -724,21 +724,19 @@ int ib_init_ah_from_mcmember(struct ib_device *device, u8 port_num, | |||
724 | { | 724 | { |
725 | int ret; | 725 | int ret; |
726 | u16 gid_index; | 726 | u16 gid_index; |
727 | u8 p; | ||
728 | |||
729 | if (rdma_protocol_roce(device, port_num)) { | ||
730 | ret = ib_find_cached_gid_by_port(device, &rec->port_gid, | ||
731 | gid_type, port_num, | ||
732 | ndev, | ||
733 | &gid_index); | ||
734 | } else if (rdma_protocol_ib(device, port_num)) { | ||
735 | ret = ib_find_cached_gid(device, &rec->port_gid, | ||
736 | IB_GID_TYPE_IB, NULL, &p, | ||
737 | &gid_index); | ||
738 | } else { | ||
739 | ret = -EINVAL; | ||
740 | } | ||
741 | 727 | ||
728 | /* GID table is not based on the netdevice for IB link layer, | ||
729 | * so ignore ndev during search. | ||
730 | */ | ||
731 | if (rdma_protocol_ib(device, port_num)) | ||
732 | ndev = NULL; | ||
733 | else if (!rdma_protocol_roce(device, port_num)) | ||
734 | return -EINVAL; | ||
735 | |||
736 | ret = ib_find_cached_gid_by_port(device, &rec->port_gid, | ||
737 | gid_type, port_num, | ||
738 | ndev, | ||
739 | &gid_index); | ||
742 | if (ret) | 740 | if (ret) |
743 | return ret; | 741 | return ret; |
744 | 742 | ||