From patchwork Thu Aug 10 06:04:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adit Ranadive X-Patchwork-Id: 9892779 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 661B160384 for ; Thu, 10 Aug 2017 06:05:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 527C428AB2 for ; Thu, 10 Aug 2017 06:05:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 46B0128ACE; Thu, 10 Aug 2017 06:05:41 +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 CA2AA28AB2 for ; Thu, 10 Aug 2017 06:05:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750837AbdHJGF0 (ORCPT ); Thu, 10 Aug 2017 02:05:26 -0400 Received: from mail-sn1nam01on0082.outbound.protection.outlook.com ([104.47.32.82]:1377 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750735AbdHJGFZ (ORCPT ); Thu, 10 Aug 2017 02:05:25 -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=ze8EklFX5AMAfpRTZZVTCXw6EL185A/9Zpd+XKwk6g8=; b=KwZLNJHIbda9QeHi7pnBCvk+DiXVX6RVbr5tX03HONzmcNup8DGqFCiM2aZWJdcHVn48VKEA0JHp1hUQ3/mXk5dy5cusj470Ss48kc9db23cMDyF36QtUVzenUB+XWMxrXFGiVOq1gQZOA1Ny7pbbErUpR0wOkUNUKpxwIvgTto= Received: from promb-2s-dhcp95-136.eng.vmware.com (208.91.1.34) by CY4PR05MB3509.namprd05.prod.outlook.com (10.171.247.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1341.9; Thu, 10 Aug 2017 06:05:20 +0000 From: Adit Ranadive To: dledford@redhat.com, linux-rdma@vger.kernel.org, pv-drivers@vmware.com Cc: Bryan Tan , jhansen@vmware.com, asarwade@vmware.com, Adit Ranadive Subject: [PATCH rdma-core] vmw_pvrdma: Add L2 MAC resolution for UD QPs Date: Wed, 9 Aug 2017 23:04:59 -0700 Message-Id: <1502345099-6534-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: CY4PR2201CA0004.namprd22.prod.outlook.com (10.171.208.142) To CY4PR05MB3509.namprd05.prod.outlook.com (10.171.247.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b36b00cf-ef87-42ea-8a8f-08d4dfb5c988 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:CY4PR05MB3509; X-Microsoft-Exchange-Diagnostics: 1; CY4PR05MB3509; 3:2+mDcq5KRBsAIPCb9BIllyPtYFMS09HaP6SJilmMtmKVLicjUl10pz33HKQl4bu8lI/XdWhOPnzGJQJ3jHmWwW7ISwwHL11S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C66cJZWcdXy03mHVT8CtYS9t5XpXIoQE6Ujo1YEYeofiz1+v6e/XGI0C/m/o8WtuhIY9Utq3nZ5MdUYKULP0KBxMUyBtziUW0+AIf+dWmrb+6ZJJ5Qdp5SDVsTQVf1xjtkYSiXIYnkoGMtYai0YwB5L1OYYqCfhHnu3B1hwDXqwc63vkn3aEHt0iTFZI6MjgRSf5dC59dJJfNBiPXPOOWq0N6oEpsRBOaGd/OtfE+KXIkD5z6tjF+SbCP5BFuAwjnKxv9kluO6; 4:nQVenh5bsgzcGzKJI1fp7FdKo4u+d4pYxacTl/9yXw6ns7V/GGQ5cXtUYAnKjVhf+xENDYWmHVeKM6YhjqGnxY5SUIJP9Q/l7XfE/AKDB06L5ykgrxzs4vlO8Poy5EK25Ztm9paexnLi+yMIqbieGJX0/EZ/hrZ6mnOwZ0Jyxz5rz4SaTvlkdB+j8FIXnCHaFhC8X9qJQmLMlXoAbyxomodW63mjbq87wFX9ahDZoryeCeENy7rNQ3MGpNx2JtalmTYHNKT6p+yfTmRH79uN0fVBjfpk/5vZhbY8TvFdijU= X-Exchange-Antispam-Report-Test: UriScan:(61668805478150); 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)(93006095)(93001095)(100000703101)(100105400095)(3002001)(10201501046)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123555025)(20161123562025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR05MB3509; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR05MB3509; X-Forefront-PRVS: 03950F25EC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39850400002)(39840400002)(39450400003)(39410400002)(39860400002)(39400400002)(199003)(189002)(81156014)(53936002)(3846002)(54906002)(7350300001)(47776003)(81166006)(8676002)(50226002)(6116002)(48376002)(7736002)(38730400002)(305945005)(50466002)(106356001)(110136004)(42186005)(33646002)(107886003)(66066001)(101416001)(105586002)(5660300001)(4326008)(36756003)(6486002)(189998001)(478600001)(5003940100001)(97736004)(6666003)(50986999)(68736007)(6636002)(86362001)(2906002)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR05MB3509; 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) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=aditr@vmware.com; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR05MB3509; 23:HjIIRcGMA/lCjbtLTd6uNufqvft2zCUJmfPmvTiDn?= =?us-ascii?Q?kpe5TRoiirl6nx8QNMy+Irv/dlyFUfyKHbc+zD+hAOC3rNNggzHUtTOWqJMW?= =?us-ascii?Q?hDqiZ7xbjkm5TivxD1ss42EQfFc3DXrmYWsCoJ2R/3YDaU9Zwz39n97b3lSR?= =?us-ascii?Q?dlbps8vIgiZyIBoFhMQnUxSvmDHECnLh3sPbyn12ByDkqHW0cmLTuhQDSNL2?= =?us-ascii?Q?UAhe1aeRwepStnzWnTdGNiWbmRvabnZvF3UIsmki+sTPSLs77CLC1ebg6uyO?= =?us-ascii?Q?nxEKBLYHDDbIBSK1bT4ozsR3Jhw3LP8jVLH2QvOSyJLGvGnmawfN5C/ahQUV?= =?us-ascii?Q?6czmczpANaXoWxUFbeYiop+iT7ziTWBftggl/820pfodeUV0iFTJ5pQ1pWwU?= =?us-ascii?Q?ROWCMwmlvZsVHYTXHS9cqxFfbd76wFRthyqRj2z0yKDGMnTF53Uzi8QXRtnT?= =?us-ascii?Q?ft24kmvU1urM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cQGgmYVLcePvtZnCSl11GpY211cNBvNEajc8zCFiUbGebZexcehDMGaVQQ9iOszNStTIoORGl5SJOdju4AWB97FVsmX8y5gdgxxqHSTY7Ab45l1Ydtj/HEUCEFarpc6a02iOcgMMOyRN5oUKX2V2ow3KKphmQcAfrQJX88Q+xyl5fcdg5PUh30MWfd7tGZmrhqwm1eLDw86rVDc5wZgWPCA9vJvBheVxrgBOM0Rs/1u5XkD2AZqyglOkng8F9j3rByPjAw==; 5:EEAXsihCTlcmJVl+ht6mQtmpWXZLvWZTvaH5IV24VI4d+eC1v7xemRHtyjDLEzpt+g8ndX59AfUBisuhNkanlZU6yfAXW6+HquBVb91JNXnjmH/ad5zCNvp224DgCHoiWGK/3A/TIhrVCAsrQlHJ6w==; 24:mk++hSsaHXaZnrZ0loZsjLbWutGS1njpccIvTQonb7IWUEvb5+6w5GMHf19wvcmBt0KAz8WKtbE2bsTcuyUZaPbt236UFPPcLPpGMrcoKPQ=; 7:lJExPm769pp3t6LTAnLL2KRDcOTH5rFJ3A23p1Tf8pH7GC6sZj1NukFza/0n7n+95mgC7kbrEKh1gFMtPCydQ4xT0Arh/3UXV/S9jYzD2NsQdqVk8dk5FCOP22zPbMAe2VIOZXNIQjGYzliKTObQRaQ5/7J2gKCZaE39CWl5JE/hfkiTkVqdr1cwHpaoM4HX5tTVjNYwAxFljg0S0782BYVtvbi8MLATn2K7J69xGMI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR05MB3509; 20:1vFSc6cuwVXnyQN2BchMall7hOjqCYZWXrYEEiDZyxLbEY2cfkzwOnvWuGf/qiCtKh9pXYL38Hg7iKKEIjWio2Ol8977VrGy+xULCcvbh7w4IlucOpkJOfV8Av0Xe5P4nnhWJAijYk2qyR+aRsKhhletouw75AMpP4DOEeQP2cI= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2017 06:05:20.8388 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR05MB3509 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: Bryan Tan From: Bryan Tan Use a libibverbs function to resolve the destination MAC address for a non-default GID in UD QPs. Signed-off-by: Bryan Tan Signed-off-by: Adit Ranadive --- providers/vmw_pvrdma/verbs.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/providers/vmw_pvrdma/verbs.c b/providers/vmw_pvrdma/verbs.c index 1bb1634..852aced 100644 --- a/providers/vmw_pvrdma/verbs.c +++ b/providers/vmw_pvrdma/verbs.c @@ -186,6 +186,7 @@ struct ibv_ah *pvrdma_create_ah(struct ibv_pd *pd, struct pvrdma_ah *ah; struct pvrdma_av *av; struct ibv_port_attr port_attr; + uint16_t vlan_id; if (!attr->is_global) return NULL; @@ -216,7 +217,14 @@ struct ibv_ah *pvrdma_create_ah(struct ibv_pd *pd, av->sl_tclass_flowlabel = (attr->grh.traffic_class << 20) | attr->grh.flow_label; memcpy(av->dgid, attr->grh.dgid.raw, 16); - set_mac_from_gid(&attr->grh.dgid, av->dmac); + + if (ibv_resolve_eth_l2_from_gid(pd->context, attr, + av->dmac, &vlan_id)) { + free(ah); + return NULL; + } else { + set_mac_from_gid(&attr->grh.dgid, av->dmac); + } return &ah->ibv_ah; }