From patchwork Wed Oct 2 12:17:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 11170975 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 978171709 for ; Wed, 2 Oct 2019 12:17:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6C39921A4A for ; Wed, 2 Oct 2019 12:17:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570018677; bh=ZxPG6Y6jKlkkxU05aGHfi8eRgEsCEcatBMAbquYnjTU=; h=From:To:Cc:Subject:Date:List-ID:From; b=c9eLBEOzJebPxCo6XscEMv1X9KCBD6IPwd8qm1eyfNDwqOAc5wMhygNxyEtD+Vwi/ +ZLMGkYW4+TYNyHZIpyCFF/pnO7ajcF7ZgD2zWw+VVFiDjwSzEyKApgbh3swQFN4K5 ZYMZBZrSM6/FlvpweFyMs/JrwoQpLpoxDKbiuFHs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726157AbfJBMR4 (ORCPT ); Wed, 2 Oct 2019 08:17:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:58326 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726030AbfJBMR4 (ORCPT ); Wed, 2 Oct 2019 08:17:56 -0400 Received: from localhost (unknown [193.47.165.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7F2B021920; Wed, 2 Oct 2019 12:17:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570018676; bh=ZxPG6Y6jKlkkxU05aGHfi8eRgEsCEcatBMAbquYnjTU=; h=From:To:Cc:Subject:Date:From; b=cGAQ7xTUBrob+CGCGeZIqwkccGrE92vb2sueugzPhhGnfRhNYgrMCmFa3cs5o1aMb 3uMuZuQD5c5Za3SGk0ZVFdfPkhCL1cDCuCdpCMAtlJzKHc7ESNraH13SKykJNK/qJp uChxWaJ28ZldiDCBLy74kItMVZHW47FNYVNoIoxg= From: Leon Romanovsky To: Doug Ledford , Jason Gunthorpe Cc: Parav Pandit , RDMA mailing list , Matan Barak , Leon Romanovsky Subject: [PATCH rdma-rc] IB/core: Use rdma_read_gid_l2_fields to compare GID L2 fields Date: Wed, 2 Oct 2019 15:17:50 +0300 Message-Id: <20191002121750.17313-1-leon@kernel.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Parav Pandit Current code tries to derive VLAN ID and compares it with GID attribute for matching entry. This raw search fails on macvlan netdevice as its not a VLAN device, but its an upper device of a VLAN netdevice. Due to this limitation, incoming QP1 packets fail to match in the GID table. Such packets are dropped. Hence, to support it, use the existing rdma_read_gid_l2_fields() that takes care of diffferent device types. Fixes: dbf727de7440 ("IB/core: Use GID table in AH creation and dmac resolution") Signed-off-by: Parav Pandit Signed-off-by: Leon Romanovsky --- drivers/infiniband/core/verbs.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index f974b6854224..35c2841a569e 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -662,16 +662,17 @@ static bool find_gid_index(const union ib_gid *gid, void *context) { struct find_gid_index_context *ctx = context; + u16 vlan_id = 0xffff; + int ret; if (ctx->gid_type != gid_attr->gid_type) return false; - if ((!!(ctx->vlan_id != 0xffff) == !is_vlan_dev(gid_attr->ndev)) || - (is_vlan_dev(gid_attr->ndev) && - vlan_dev_vlan_id(gid_attr->ndev) != ctx->vlan_id)) + ret = rdma_read_gid_l2_fields(gid_attr, &vlan_id, NULL); + if (ret) return false; - return true; + return ctx->vlan_id == vlan_id; } static const struct ib_gid_attr *