From patchwork Sat Nov 5 19:57:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 9413801 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 48F226048F for ; Sat, 5 Nov 2016 19:57:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37735292F4 for ; Sat, 5 Nov 2016 19:57:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C5272957E; Sat, 5 Nov 2016 19:57:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAFA4292F4 for ; Sat, 5 Nov 2016 19:57:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756864AbcKET5r (ORCPT ); Sat, 5 Nov 2016 15:57:47 -0400 Received: from mail.kernel.org ([198.145.29.136]:46422 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756104AbcKET5q (ORCPT ); Sat, 5 Nov 2016 15:57:46 -0400 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 37AFA20379; Sat, 5 Nov 2016 19:57:45 +0000 (UTC) Received: from localhost (unknown [100.44.38.221]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ECFEC2034E; Sat, 5 Nov 2016 19:57:43 +0000 (UTC) From: Leon Romanovsky To: dledford@redhat.com Cc: linux-rdma@vger.kernel.org, Jack Morgenstein , Daniel Jurgens , Leon Romanovsky Subject: [PATCH rdma-rc 5/9] IB/mlx4: Handle well-known-gid in mad_demux processing Date: Sat, 5 Nov 2016 21:57:18 +0200 Message-Id: <1478375842-21513-6-git-send-email-leonro@mellanox.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478375842-21513-1-git-send-email-leonro@mellanox.com> References: <1478375842-21513-1-git-send-email-leonro@mellanox.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jack Morgenstein If OpenSM runs over ConnectX-3, and there are ConnectIB VFs active on the network, the OpenSM will receive QP1 packets containing a GRH where the destination GID is the "Well-Known GID" -- which is not a GID in the HCA Port's GID Table. This GID must be tested-for separately -- and packets which contain this destination GID should be routed to slave 0 (the PF). Fixes: 37bfc7c1e83f ('IB/mlx4: SR-IOV multiplex and demultiplex MADs') Signed-off-by: Jack Morgenstein Signed-off-by: Daniel Jurgens Signed-off-by: Leon Romanovsky Signed-off-by: Leon Romanovsky --- drivers/infiniband/hw/mlx4/mad.c | 16 ++++++++++++---- include/rdma/ib_verbs.h | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index b8e9013..f0b8272 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c @@ -729,10 +729,18 @@ static int mlx4_ib_demux_mad(struct ib_device *ibdev, u8 port, /* If a grh is present, we demux according to it */ if (wc->wc_flags & IB_WC_GRH) { - slave = mlx4_ib_find_real_gid(ibdev, port, grh->dgid.global.interface_id); - if (slave < 0) { - mlx4_ib_warn(ibdev, "failed matching grh\n"); - return -ENOENT; + if (grh->dgid.global.interface_id == + cpu_to_be64(IB_SA_WELL_KNOWN_GUID) && + grh->dgid.global.subnet_prefix == + cpu_to_be64(IB_SA_WELL_KNOWN_GID_PREFIX)) { + slave = 0; + } else { + slave = mlx4_ib_find_real_gid(ibdev, port, + grh->dgid.global.interface_id); + if (slave < 0) { + mlx4_ib_warn(ibdev, "failed matching grh\n"); + return -ENOENT; + } } } /* Class-specific handling */ diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 467a4b4..da5949f 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -100,6 +100,7 @@ enum rdma_node_type { enum { /* set the local administered indication */ + IB_SA_WELL_KNOWN_GID_PREFIX = 0xfe80000000000000ull, IB_SA_WELL_KNOWN_GUID = BIT_ULL(57) | 2, };