From patchwork Wed Aug 30 23:34:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adit Ranadive X-Patchwork-Id: 9930963 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 ACAAB60380 for ; Wed, 30 Aug 2017 23:34:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90401286FF for ; Wed, 30 Aug 2017 23:34:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81C1F2875F; Wed, 30 Aug 2017 23:34:22 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 DF080286FF for ; Wed, 30 Aug 2017 23:34:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750998AbdH3XeU (ORCPT ); Wed, 30 Aug 2017 19:34:20 -0400 Received: from mail-bn3nam01on0079.outbound.protection.outlook.com ([104.47.33.79]:38292 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750972AbdH3XeT (ORCPT ); Wed, 30 Aug 2017 19:34:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=onevmw.onmicrosoft.com; s=selector1-vmware-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=yWQxWxH782+lzYh3OCnKQua+yoW31Ofa97DTVKO682w=; b=bpjpOen3GWbol+33iP25nxopWt/2MbvF1ikkH1BR/lgbZ3J58VbNdBUshKvUqpebuUctFuo+JdUOcMwjtP1El4AnMuS4Rze5PCB0nHBMXsnlUkQJNcfEqK5JDG37GJqo8bsrcYRkpOCM2EAM8cUTyOU/Q9i31tYaKnEv16L5CHA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=aditr@vmware.com; Received: from promb-2s-dhcp95-136.eng.vmware.com (208.91.1.34) by DM5PR05MB3514.namprd05.prod.outlook.com (10.174.242.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.2; Wed, 30 Aug 2017 23:34:17 +0000 From: Adit Ranadive To: dledford@redhat.com, linux-rdma@vger.kernel.org Cc: Adit Ranadive , pv-drivers@vmware.com Subject: [PATCH rdma-core] vmw_pvrdma: Explicitly check for IP_BASED_GIDS port flag Date: Wed, 30 Aug 2017 16:34:01 -0700 Message-Id: <1504136041-3070-1-git-send-email-aditr@vmware.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [208.91.1.34] X-ClientProxiedBy: MWHPR12CA0040.namprd12.prod.outlook.com (10.172.49.26) To DM5PR05MB3514.namprd05.prod.outlook.com (10.174.242.143) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 81a3af64-31a6-4a43-4b81-08d4efffa1de X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DM5PR05MB3514; X-Microsoft-Exchange-Diagnostics: 1; DM5PR05MB3514; 3:BZFn7vDLINWFaQdoE0qTJX8Fyn5TIfGK0ZlTVviCztW89/p9q5n8XG4SjeIaCs2o7O3A5499u8nKI93AQCsDoX1p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qa3cPHFI1jCFzk4cGGvO9o1vIi8clx7AuSs1jJZ9158WS75z4steTgvjdmh5nFvff50b9vLthVWkvWicPZr2H4CGj15fi+nExliOp57dBBlQVho1A7Qe+oi7VLLhgpJmr+ub9XobnntNbM6XyilV8sbz3SJusSl1TOxqubaKepgab5YxmK4AkNQc6fa4Xxkvu0dSHPUeehdwaDXaiK3TcWzRDNBe7FnuVLKqwatj36PulZg84i2NjAXj4PHa; 4:2s89lNdQPBUL7ywGR/HU0FXguKwcc3wqco7SVPn6YRhPT7v889+VpH/atddtnHzN9DTomPcBkrjotWVBlipcmGc4ddjs95/cPsKb8gUIACYwnOExWvd3V98xD3OmoR/2s7zryBtkNaEjPX5etJEbZzJ3+4t20yE6VM7lFTTzDFk3+EnO1I8579Z8yelzBtVu/pr78yeSRw+/6QWms5zkxIHdY+Pq05/6CcXMpwtupz3ZuSs1NGTISjaSSpHMMgkY+uoRVyg+qekyOusuiM+dkV5bDdOAJyenImy3DVaOuP6S8asJ884ez2AQPDrRstVBeHtXJXppMylhTaEi2ih4VA== X-Exchange-Antispam-Report-Test: UriScan:(61668805478150)(166708455590820); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(100000703101)(100105400095)(3002001)(93006095)(93001095)(6041248)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(20161123558100)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR05MB3514; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR05MB3514; X-Forefront-PRVS: 041517DFAB X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(979002)(6009001)(39860400002)(199003)(189002)(47776003)(305945005)(5660300001)(48376002)(7736002)(50466002)(110136004)(68736007)(6306002)(36756003)(107886003)(66066001)(50986999)(53936002)(8676002)(478600001)(25786009)(8936002)(101416001)(81166006)(3846002)(33646002)(86362001)(81156014)(6666003)(5003940100001)(2906002)(97736004)(6486002)(189998001)(4326008)(106356001)(966005)(42186005)(50226002)(105586002)(6116002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR05MB3514; H:promb-2s-dhcp95-136.eng.vmware.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: vmware.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR05MB3514; 23:bIQqS5oPRQV8sQDtYJ9vOg3yq0eoYh79HmOL+8Xo+?= =?us-ascii?Q?UJV3YJGOmn7p9lx4soiM/8lNFtax/jbZtC7JoVxsYc1ilIatFX6Ir9kHn+B/?= =?us-ascii?Q?kMAXPXFthklAP8LKOLeE47v2wQQj97u+7RkIZlZacxUdvH3pXcXYYQI8t5p1?= =?us-ascii?Q?idd5ev+e0dfVImCDBm6/EtQEsEpxzWV50J1/PbkpVGoPBJqxEFK62UDwYJks?= =?us-ascii?Q?YABzYr3Qsdkt8LUPCKvzHA/RWdcMRiez6AzeVe78y0DsLDOZ04EIvm/ow0Jo?= =?us-ascii?Q?WfR+B5PayO+234sSNV0r191Vl311oEsz4+hVYgx2izWccvMojBOMDa5o7z3l?= =?us-ascii?Q?9/EVWakh1HwttHPs7bjNDpHNkobAkBfzd4F+Tc7WLgSdppRzcOdSPn6INoYX?= =?us-ascii?Q?UtWwpW7y6QI2rki6irsOkJfUg79kwEGrHlJYlVidhV3DW2sZo+RFQmd/ueWi?= =?us-ascii?Q?3zWaOn2MJd2SHPda2ZJbRx1dBMbgt+vjAfX/rns7QmfeILkD0Zw5T7Ex4h7z?= =?us-ascii?Q?m6ohY4c//RH2PQ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BhJw==; 5:PB3tVS5Knml4t0/EmJaLu+cEm6bbLm8n1uJ+/eQqdRVQiOrKdYjfXnR2DXbko4r++rGQM5yPLISa1ERiOrLxsHVUf8HbLVEoFQGFBei5nIFWy5TURbrNgZ3YE+auKmS8qHdGPJ1UWIDDcvyHLnC+Xg==; 24:nNfj9Fcb3HaZZzjxUqhXElBEBCgooUpq2T0Dg04rKiL6HJ8/nxEghstcGxh+cbLUUQ51tJK6Atjf0sIlprI2FFAOWTOg5nFGyYEKuNj9fSg=; 7:WJd3EOmULmnHYufa78pOv25E9HFK1zV5l/CFEuKAGRaJGxO/W697pTfrqrhfj/qTi66ADn1H3D4ILc5qX2xbhpwC9h2u9hF/9vni9F54eUHJvTeh6SkX37mfeREl1jw2QyzMNUrRV4xv5fJGbhx27xOMLssPG6NatnKHLLuxt/AM9uGBV2F+VcjCDQMQBzgviRA2uZyMWwTR/Jnj2CWoUIL7oM9MUSe2tD+gY2YfBw4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR05MB3514; 20:R36mb7my4MmI9HojhHRJtJx6i1RetD3GcnBIrZ+kXrhti6L7tR6/X0lYVnXTQnGbGfc7X8m6mmzM/GyiLz4NZFVu/+TCu9JjJDcXXJru6ZP+pOcI5pmmz7b0ZNHgenUlw/+L/pN1BbPtm1Z0n6kTg/9MOwJKLGLaYfaIEl3Ddow= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2017 23:34:17.0138 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR05MB3514 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 Rely on the IP_BASED_GIDS flag to use the ibv_resolve_eth_l2_from_gid function when creating the AH. Otherwise, fallback to the set_mac_from_gid function to set the DMAC. Reviewed-by: Aditya Sarwade Signed-off-by: Adit Ranadive --- Pull request: https://github.com/linux-rdma/rdma-core/pull/205 providers/vmw_pvrdma/verbs.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/providers/vmw_pvrdma/verbs.c b/providers/vmw_pvrdma/verbs.c index 852aced..a32046b 100644 --- a/providers/vmw_pvrdma/verbs.c +++ b/providers/vmw_pvrdma/verbs.c @@ -166,7 +166,7 @@ static int is_ipv6_addr_v4mapped(const struct in6_addr *a) (a->s6_addr32[2] ^ htobe32(0x0000ffff))) == 0UL)); } -static void set_mac_from_gid(const union ibv_gid *gid, +static int set_mac_from_gid(const union ibv_gid *gid, __u8 mac[6]) { if (is_link_local_gid(gid)) { @@ -177,7 +177,11 @@ static void set_mac_from_gid(const union ibv_gid *gid, memcpy(mac, gid->raw + 8, 3); memcpy(mac + 3, gid->raw + 13, 3); mac[0] ^= 2; + + return 0; } + + return 1; } struct ibv_ah *pvrdma_create_ah(struct ibv_pd *pd, @@ -218,15 +222,17 @@ struct ibv_ah *pvrdma_create_ah(struct ibv_pd *pd, attr->grh.flow_label; memcpy(av->dgid, attr->grh.dgid.raw, 16); - if (ibv_resolve_eth_l2_from_gid(pd->context, attr, - av->dmac, &vlan_id)) { - free(ah); - return NULL; + if (port_attr.port_cap_flags & IBV_PORT_IP_BASED_GIDS) { + if (!ibv_resolve_eth_l2_from_gid(pd->context, attr, + av->dmac, &vlan_id)) + return &ah->ibv_ah; } else { - set_mac_from_gid(&attr->grh.dgid, av->dmac); + if (!set_mac_from_gid(&attr->grh.dgid, av->dmac)) + return &ah->ibv_ah; } - return &ah->ibv_ah; + free(ah); + return NULL; } int pvrdma_destroy_ah(struct ibv_ah *ah)