Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1459504imm; Fri, 8 Jun 2018 17:10:20 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJg+Na3orT7Z/k1L/ou8+M3/Cra0AGIxOZQMppZT3Gl5D25yrMhYHNhKx+3Gb1in5QWqEwn X-Received: by 2002:a63:7b1e:: with SMTP id w30-v6mr6944169pgc.249.1528503020111; Fri, 08 Jun 2018 17:10:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528503020; cv=none; d=google.com; s=arc-20160816; b=FHOiJgGSQk2Ha1tes8vBW27hY8mjIC1lT+5rUru1dI+hY0MQedDa+WuA6ou+24vzmF gK12muN8rSHJO4x4VhkK84VCcNLvCq2rtlwtLzRKQe8ntsOp9FbBtN9oXEHZ2hCVM0Kb AZs4LoryLTLISOxuK81Mhdc4bhXkDjwnE3RumI7JeMcn4zqIGhYmkzmYqY6DwcEJ/LAv iQ62tBM7QrbeHYyKMPaOmYv6wwdh2nFzWiQpLC69uEbHzhDeNUcD6nL0I1GCJd3SXVkp te1cDnnd+slDMhcU1NVZVg3CJjhc98yQWgYf6Cuy5ZZEPqQcF5c4tKF8WJXAn8nu+QaK iafw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:references:in-reply-to:message-id :date:cc:to:from:arc-authentication-results; bh=dW4L8XJKvx/R+H0QcmLN7k4FaQyQGpEAlOPusR36AgA=; b=TqKGiV1SRtN9hy7Bf0XjCWAYy4wOpFincHhwI6lKtaEBamCJThyG23a1dIY/1aK5FP bdNJS7lCpsBRZsrIW464KBXw4z9fn6WoK2ZD3dbh+DqUBOTowK/lvCcdZ/YhfGini2uD QUXm7rRf3tYa85QSIJpJYa3Fn1ho9ELVDC43BjOopozGf1YjtGwt0LnHfNzLIVmsRCVw fgD1xgT0evcNJE4haW4NAd80GLXETRAzY+H+tmTuAW0CK0b20TO7X6W9No707L5zyx/X PDidWSHl+nBnfPH2M2unPXlBGoXAQqjQryguA051XmJIUKoM5nqIsLUiJXA+aVUtcwko OwSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l3-v6si56715489pld.96.2018.06.08.17.10.05; Fri, 08 Jun 2018 17:10:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932183AbeFIAJJ (ORCPT + 99 others); Fri, 8 Jun 2018 20:09:09 -0400 Received: from ale.deltatee.com ([207.54.116.67]:60600 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753180AbeFIAI2 (ORCPT ); Fri, 8 Jun 2018 20:08:28 -0400 Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1fRRQd-00043p-2R; Fri, 08 Jun 2018 18:08:27 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1fRRQb-0003ct-QM; Fri, 08 Jun 2018 18:08:21 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-ntb@googlegroups.com Cc: Jon Mason , Dave Jiang , Allen Hubbe , Serge Semin , Shyam Sundar S K , Shuah Khan , Logan Gunthorpe Date: Fri, 8 Jun 2018 18:08:13 -0600 Message-Id: <20180609000819.13883-4-logang@deltatee.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180609000819.13883-1-logang@deltatee.com> References: <20180609000819.13883-1-logang@deltatee.com> X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-kernel@vger.kernel.org, linux-ntb@googlegroups.com, jdmason@kudzu.us, dave.jiang@intel.com, allenbh@gmail.com, fancer.lancer@gmail.com, Shyam-sundar.S-k@amd.com, shuah@kernel.org, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-8.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, GREYLIST_ISWHITE,MYRULES_NO_TEXT autolearn=ham autolearn_force=no version=3.4.1 Subject: [PATCH 3/8] NTB: Fix the default port and peer numbers for legacy drivers X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/ntb/ntb.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/ntb/ntb.c b/drivers/ntb/ntb.c index 93f24440d11d..d955a92a095a 100644 --- a/drivers/ntb/ntb.c +++ b/drivers/ntb/ntb.c @@ -225,10 +225,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); @@ -251,10 +249,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); @@ -326,4 +322,3 @@ static void __exit ntb_driver_exit(void) bus_unregister(&ntb_bus); } module_exit(ntb_driver_exit); - -- 2.11.0