From patchwork Thu Jan 11 05:04:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10156949 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 C2787605BA for ; Thu, 11 Jan 2018 05:04:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A93C228681 for ; Thu, 11 Jan 2018 05:04:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99024286B1; Thu, 11 Jan 2018 05:04:57 +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 F076328681 for ; Thu, 11 Jan 2018 05:04:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750735AbeAKFE4 (ORCPT ); Thu, 11 Jan 2018 00:04:56 -0500 Received: from mail-it0-f68.google.com ([209.85.214.68]:44703 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750733AbeAKFEz (ORCPT ); Thu, 11 Jan 2018 00:04:55 -0500 Received: by mail-it0-f68.google.com with SMTP id b5so2053296itc.3 for ; Wed, 10 Jan 2018 21:04:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=wKVROGtgL1RZzEA+muq/ofRlDCbPdBDk88Y/YeYkz6Q=; b=P3yvrqvtHErVRp9qv6OjCAS5YS++LV3pgwYnt7Lo2pguQye726g90yd5xQprWK4bXK XmAohvKpDrF1IdyEfHEUn0zBoEyNN3AVgPeh/7yyUF8lkfamQ2SCixlj4oq5IhuoZmQE 4kTrTIScusu6cF4h1uDujT7904jLUxRztnJo+WIOrFpgsZtl+X/LUvsJh1gCNSprFpvM CMel7IF3uHS2lrk/c9TtRyurm1hot5jIOptC8lfDRtAVj/wIqsNhSeXVSg0lL+5jEIVd jaycCcFAniR5VWg2/pC7CI+NBeKklIXABcnlMgUPgXX2De4WlFXphIcb0buEhgYcV/nJ PUXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=wKVROGtgL1RZzEA+muq/ofRlDCbPdBDk88Y/YeYkz6Q=; b=RflQ3uArdwIJI+cSzVmucaVAzXMkzW8gs+uL/Zff4IreXfNwjdGopgj/rEK5j9tbyR FFuoL4n8Yk8SCJwuJ4M1isxiZxGf1+g4Sk4tIzGgDXah4s0g2IObAhcbKPUBu4x6l7bs dFOrErz+INvDSOURwMhIL3pzL0iWKkcOlm3di4v9ai/OzMHD26M9YWZVBFL+eDP/9a4B tc0Xs72VCxpiiCeIhY04fXeToxZ0KXh7WX8Zwyj3BjjaosrFRc1+L2Am9MmnOpVPTnzf 2HSRr5zQWVaUlQddHYyUpnwHFA+FV2PkdpsusEWn+VaGGZuftDM6WN8s5dyl5qvQJip3 0QGw== X-Gm-Message-State: AKwxytdkKmp7TPojQeKKDpBqFI10fsg2pUN4y6RTXA1cxV/0AddcAE6c qpdCYZA2eF8VxeQN4xYnBqgs+A== X-Google-Smtp-Source: ACJfBos6wwicYnRPDslBoU0HJk8ydyQfoE5fYDnW7qX8uey361HTN5igX+7Bz0oMPTO84c0NSevc2w== X-Received: by 10.36.74.200 with SMTP id k191mr38615itb.69.1515647094667; Wed, 10 Jan 2018 21:04:54 -0800 (PST) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [70.74.179.152]) by smtp.gmail.com with ESMTPSA id o6sm1809448iof.26.2018.01.10.21.04.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jan 2018 21:04:54 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.86_2) (envelope-from ) id 1eZV2r-0006WE-7V; Wed, 10 Jan 2018 22:04:53 -0700 Date: Wed, 10 Jan 2018 22:04:53 -0700 From: Jason Gunthorpe To: Leon Romanovsky Cc: Doug Ledford , RDMA mailing list , Mark Bloch , Parav Pandit Subject: Re: [PATCH rdma-next 5/6] RDMA/cma: Fix setting RoCE specific path record fields Message-ID: <20180111050453.GB16668@ziepe.ca> References: <20180108150448.29069-1-leon@kernel.org> <20180108150448.29069-6-leon@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180108150448.29069-6-leon@kernel.org> User-Agent: Mutt/1.5.24 (2015-08-30) 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 On Mon, Jan 08, 2018 at 05:04:47PM +0200, Leon Romanovsky wrote: > From: Parav Pandit > > rdma_set_ib_path() missed setting path record fields for RoCE > transport when RoCE transport support was added. > > This results into setting incorrect ndev, destination mac address, > incorrect GID type etc errors. This patch uses recently introduced > helper function to setup such RoCE specific path record fields. > > Fixes: 3c86aa70bf67 ("RDMA/cm: Add RDMA CM support for IBoE devices") > Signed-off-by: Parav Pandit > Reviewed-by: Mark Bloch > Signed-off-by: Leon Romanovsky > drivers/infiniband/core/cma.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c > index 68223bd56b53..f4c6c2cbc585 100644 > +++ b/drivers/infiniband/core/cma.c > @@ -2523,6 +2523,7 @@ int rdma_set_ib_path(struct rdma_cm_id *id, > { > struct rdma_id_private *id_priv; > struct sa_path_rec *in_path_rec; > + struct net_device *ndev; > struct sa_path_rec opa; > int ret; > > @@ -2545,6 +2546,18 @@ int rdma_set_ib_path(struct rdma_cm_id *id, > goto err; > } > > + if (rdma_protocol_roce(id->device, id->port_num)) { > + ndev = cma_iboe_set_path_rec_l2_fields(id_priv); > + if (!ndev) { > + ret = -ENODEV; > + kfree(id->route.path_rec); > + id->route.path_rec = NULL; > + goto err; > + } else { > + dev_put(ndev); > + } > + } I revised this slightly, I didn't like mixing goto error unwind and in-lined error unwind in the same function, not the pointless else block. Please check my work: Author: Parav Pandit Date: Mon Jan 8 17:04:47 2018 +0200 RDMA/cma: Fix rdma_cm raw IB path setting for RoCE rdma_set_ib_path() missed setting path record fields for RoCE transport when RoCE support was added. This results in setting incorrect ndev, destination mac address, incorrect GID type etc errors when user space attempts to set a raw IB path using the roce IB path compatibility mapping from userspace. Fixes: 3c86aa70bf67 ("RDMA/cm: Add RDMA CM support for IBoE devices") Signed-off-by: Parav Pandit Reviewed-by: Mark Bloch Signed-off-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe --- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 5c158cda08e31d..30d1c32a816f91 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -2521,6 +2521,7 @@ int rdma_set_ib_path(struct rdma_cm_id *id, struct sa_path_rec *path_rec) { struct rdma_id_private *id_priv; + struct net_device *ndev; int ret; id_priv = container_of(id, struct rdma_id_private, id); @@ -2535,8 +2536,21 @@ int rdma_set_ib_path(struct rdma_cm_id *id, goto err; } + if (rdma_protocol_roce(id->device, id->port_num)) { + ndev = cma_iboe_set_path_rec_l2_fields(id_priv); + if (!ndev) { + ret = -ENODEV; + goto err_free; + } + dev_put(ndev); + } + id->route.num_paths = 1; return 0; + +err_free: + kfree(id->route.path_rec); + id->route.path_rec = NULL; err: cma_comp_exch(id_priv, RDMA_CM_ROUTE_RESOLVED, RDMA_CM_ADDR_RESOLVED); return ret;