Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3153879imm; Fri, 20 Jul 2018 11:03:46 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcGeAof3tk8o0ZE/agyXuWUSZusTd/0dAy5V7OwFIKqSGOKDwf086T7dYpVLQSQL/wd858e X-Received: by 2002:a62:df4e:: with SMTP id u75-v6mr3164054pfg.195.1532109826505; Fri, 20 Jul 2018 11:03:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532109826; cv=none; d=google.com; s=arc-20160816; b=SPXiRmHR0LNqsOW71+h+uIUhA8x/pHNQ8d740/SPkWBrNKDXshTVv3Yh78peoC0CvS GempPh52xNNUxM+KQQQlAU9hONhyCS7MsuMsZ2piTbST9phXXTgKdsrycUXVyXezQFCa YbEtK4Teq9qD7nj+nNotBtn15lI6pBPIX5N3YErY9OpT7ueAGYs4bkEoUbtd5t7KHGW1 jdDMGgNNDWw/RjZQiQmjiFVD6MGVYPrHiMLnD2eIYKLWaLCBG4m+NGmT/qGD6JcFbCnR 82j7bGnp9NYNQu1/c5souRbHzsNM3xf9kjB2JlTo2pe8zHs/wsZxJEuSbyutonsMKGZd BJDQ== 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=N5CkLq+eK1jjuN7xilh6KG6taOs20SgcMg/ahO8P+bIz7obUw8sCmClBPDj/rW/97z crdGOFstsVrO+DMvRbJtsx4WKykAAN/2cMTKMI+UmFBS1m8NDBuIm1wCn7g0vx1JC/sp FBOcT+u58S9JeNQq2DREYTwYBIQ/iarMTuVIhCr7aY4SQCvp2CRFHT90z6zJPpvbAvcU IMyWWp8ubuSkNpzE7TYFQGrx3S/Y67Qe2RmRywhKjYOdz7yjjoil7Lr9v5221+bOkxWW WBWIYvTJ9WSJ/iAJ4gN89Gb6nPcO206Oseoj/cQN7UQv8Jdr712rnsHILzJ+N3jMlI+t NlcA== 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 n20-v6si2121140plp.298.2018.07.20.11.03.30; Fri, 20 Jul 2018 11:03:46 -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 S2388213AbeGTSuD (ORCPT + 99 others); Fri, 20 Jul 2018 14:50:03 -0400 Received: from ale.deltatee.com ([207.54.116.67]:38338 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387950AbeGTSuC (ORCPT ); Fri, 20 Jul 2018 14:50:02 -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 1fgZhn-0008E3-0U; Fri, 20 Jul 2018 12:00:39 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1fgZhl-00012t-18; Fri, 20 Jul 2018 12:00:37 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-ntb@googlegroups.com, Jon Mason Cc: Allen Hubbe , Serge Semin , Shyam Sundar S K , Shuah Khan , Doug Meyer , Logan Gunthorpe Date: Fri, 20 Jul 2018 12:00:29 -0600 Message-Id: <20180720180034.3964-4-logang@deltatee.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180720180034.3964-1-logang@deltatee.com> References: <20180720180034.3964-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, allenbh@gmail.com, fancer.lancer@gmail.com, Shyam-sundar.S-k@amd.com, shuah@kernel.org, dmeyer@gigaio.com, 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 v2 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