From mboxrd@z Thu Jan 1 00:00:00 1970 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=unavailable 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 91387C433E0 for ; Tue, 23 Jun 2020 20:24:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 562AF2064B for ; Tue, 23 Jun 2020 20:24:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592943846; bh=Cp+rbRk77EwlK+FHOkTWRcXf/2JtelDx0wdAb4NwYu4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=NolrrFhaETgkbTu/d+sIhTOL4cIVUGGdgR/y1NeLMZHxaQBWZzSHz/IdjFseQI5FS zDIVfmHTcgT0fzxiCsmat8I2fQDx1X4ldlj5wEy4b4qXKorKZyuVTfdzhSQzrh9nF7 fNfJJGk73Al1OoGONnS6mGrFzraaTs8VSV6OKBQM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390376AbgFWUYE (ORCPT ); Tue, 23 Jun 2020 16:24:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:42328 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390355AbgFWUYA (ORCPT ); Tue, 23 Jun 2020 16:24:00 -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 74D052064B; Tue, 23 Jun 2020 20:23:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592943840; bh=Cp+rbRk77EwlK+FHOkTWRcXf/2JtelDx0wdAb4NwYu4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tm7h2ttEkNIrwj9CNL8/W8Fwry6onzS9DSMxTu7Hf+EuvNWWyAqcCV/T6cqdXCu5p rkUUN6TFF7qa+N/PERZ6MnDRvAOtX+34TVRIs1N0VQUjnxEmN7Onn+9HJ2pFPwB0eg RmcJFuT668KYovpGDC78OFF3d+uTOwDsYieW5HZ0= 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 5.4 072/314] NTB: Fix the default port and peer numbers for legacy drivers Date: Tue, 23 Jun 2020 21:54:27 +0200 Message-Id: <20200623195342.271706806@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195338.770401005@linuxfoundation.org> References: <20200623195338.770401005@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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/core.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/ntb/core.c b/drivers/ntb/core.c index 2581ab724c347..c9a0912b175fa 100644 --- a/drivers/ntb/core.c +++ b/drivers/ntb/core.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); -- 2.25.1