From patchwork Tue Jun 23 19:56:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 223437 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97C93C433DF for ; Tue, 23 Jun 2020 20:36:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6DF5920836 for ; Tue, 23 Jun 2020 20:36:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592944571; bh=pSK5FpcLEcRKKc3x2W3a0NH7hs0Hc6QeX3SbUCYefUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=djslFcKWkX2rZLXnAjIigw92txTF1wHDMwHNWcDmHS6INpQrYtooftuk9yeu5WzP8 5IARpInmUhvfaS9jPxH0CA5p5kN2sVksEBjElSMKiQ3juMy766Gng7cBNeCdwAiq8B WNXj4v4BDce1+PPdAXKir2ytEUg8bGKu16VGuGLU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391768AbgFWUgI (ORCPT ); Tue, 23 Jun 2020 16:36:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:58958 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391339AbgFWUgE (ORCPT ); Tue, 23 Jun 2020 16:36:04 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 1010821473; Tue, 23 Jun 2020 20:36:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592944564; bh=pSK5FpcLEcRKKc3x2W3a0NH7hs0Hc6QeX3SbUCYefUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IcvzcRyBEPW0GS91yQ8mjTbOiWtNxfezQT4c8gNXUlWrvdhFbYD0Y9l+AHenk6GZH Bs3Z1HJUPIxh57A/7m/yPra9uPRMWa0FJNr6XWUtP+bS6Kc6i8Gdt3ZJZn/B50EiAm G2sqnM7qPVZcZV5/t0BQ3KZ+O/NOvj5VSZaFVZBI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Logan Gunthorpe , Allen Hubbe , Alexander Fomichev , Jon Mason , Sasha Levin Subject: [PATCH 4.19 039/206] NTB: Fix the default port and peer numbers for legacy drivers Date: Tue, 23 Jun 2020 21:56:07 +0200 Message-Id: <20200623195318.904979895@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195316.864547658@linuxfoundation.org> References: <20200623195316.864547658@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Logan Gunthorpe [ Upstream commit fc8b086d9dbd57458d136c4fa70ee26f832c3a2e ] When the commit adding ntb_default_port_number() and ntb_default_peer_port_number() entered the kernel there was no users of it so it was impossible to tell what the API needed. When a user finally landed a year later (ntb_pingpong) there were more NTB topologies were created and no consideration was considered to how other drivers had changed. Now that there is a user it can be fixed to provide a sensible default for the legacy drivers that do not implement ntb_{peer_}port_number(). Seeing ntb_pingpong doesn't check error codes returning EINVAL was also not sensible. Patches for ntb_pingpong and ntb_perf follow (which are broken otherwise) to support hardware that doesn't have port numbers. This is important not only to not break support with existing drivers but for the cross link topology which, due to its perfect symmetry, cannot assign unique port numbers to each side. Fixes: 1e5301196a88 ("NTB: Add indexed ports NTB API") Signed-off-by: Logan Gunthorpe Acked-by: Allen Hubbe Tested-by: Alexander Fomichev Signed-off-by: Jon Mason Signed-off-by: Sasha Levin --- drivers/ntb/ntb.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/ntb/ntb.c b/drivers/ntb/ntb.c index 2581ab724c347..c9a0912b175fa 100644 --- a/drivers/ntb/ntb.c +++ b/drivers/ntb/ntb.c @@ -214,10 +214,8 @@ int ntb_default_port_number(struct ntb_dev *ntb) case NTB_TOPO_B2B_DSD: return NTB_PORT_SEC_DSD; default: - break; + return 0; } - - return -EINVAL; } EXPORT_SYMBOL(ntb_default_port_number); @@ -240,10 +238,8 @@ int ntb_default_peer_port_number(struct ntb_dev *ntb, int pidx) case NTB_TOPO_B2B_DSD: return NTB_PORT_PRI_USD; default: - break; + return 0; } - - return -EINVAL; } EXPORT_SYMBOL(ntb_default_peer_port_number);