From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-cys01nam02on0118.outbound.protection.outlook.com ([104.47.37.118]:44776 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754210AbeDIAUU (ORCPT ); Sun, 8 Apr 2018 20:20:20 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Don Hiatt , Sean Hefty , Dennis Dalessandro , Jason Gunthorpe , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 134/189] IB/core: Map iWarp AH type to undefined in rdma_ah_find_type Date: Mon, 9 Apr 2018 00:18:34 +0000 Message-ID: <20180409001637.162453-134-alexander.levin@microsoft.com> References: <20180409001637.162453-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001637.162453-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Don Hiatt [ Upstream commit 87daac68f77a3e21a1113f816e6a7be0b38bdde8 ] iWarp devices do not support the creation of address handles so return AH_ATTR_TYPE_UNDEFINED for all iWarp devices. While we are here reduce the size of port_num to u8 and add a comment. Fixes: 44c58487d51a ("IB/core: Define 'ib' and 'roce' rdma_ah_attr types") Reported-by: Parav Pandit CC: Sean Hefty Reviewed-by: Ira Weiny Reviewed-by: Shiraz Saleem Signed-off-by: Don Hiatt Signed-off-by: Dennis Dalessandro Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- include/rdma/ib_verbs.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 20ebf9061962..411776de40e7 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -878,6 +878,7 @@ struct ib_mr_status { __attribute_const__ enum ib_rate mult_to_ib_rate(int mult); =20 enum rdma_ah_attr_type { + RDMA_AH_ATTR_TYPE_UNDEFINED, RDMA_AH_ATTR_TYPE_IB, RDMA_AH_ATTR_TYPE_ROCE, RDMA_AH_ATTR_TYPE_OPA, @@ -3789,17 +3790,24 @@ static inline void rdma_ah_set_grh(struct rdma_ah_a= ttr *attr, grh->traffic_class =3D traffic_class; } =20 -/*Get AH type */ +/** + * rdma_ah_find_type - Return address handle type. + * + * @dev: Device to be checked + * @port_num: Port number + */ static inline enum rdma_ah_attr_type rdma_ah_find_type(struct ib_device *d= ev, - u32 port_num) + u8 port_num) { if (rdma_protocol_roce(dev, port_num)) return RDMA_AH_ATTR_TYPE_ROCE; - else if ((rdma_protocol_ib(dev, port_num)) && - (rdma_cap_opa_ah(dev, port_num))) - return RDMA_AH_ATTR_TYPE_OPA; - else + if (rdma_protocol_ib(dev, port_num)) { + if (rdma_cap_opa_ah(dev, port_num)) + return RDMA_AH_ATTR_TYPE_OPA; return RDMA_AH_ATTR_TYPE_IB; + } + + return RDMA_AH_ATTR_TYPE_UNDEFINED; } =20 /** --=20 2.15.1