Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1090248imu; Wed, 9 Jan 2019 11:26:09 -0800 (PST) X-Google-Smtp-Source: ALg8bN4+/pWSo1Fdr4v+gXCqIu09bW7FikBFch3o6Q4ATyZl4WaHcWRNwIqe8D6MNLC9aXs5oPI8 X-Received: by 2002:a63:6cc8:: with SMTP id h191mr6320308pgc.366.1547061969314; Wed, 09 Jan 2019 11:26:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547061969; cv=none; d=google.com; s=arc-20160816; b=ZBEEiQzCm8zRci2vczGwTwz/5il9bSVIAkbVkf0Ue60tCJvN5Lz4M+AKrcqYVQFUX4 7OppCUjNcT5fFrv7/CSE0sfz1c/kadREVZrMgfe/s4BR8UMOc6M1l5T2S1oREEiLCOyj LKK9I/GahJswWevYrbX5cMUgZMVl8fq1v0TjruCM/0aE/YUttLcgUapNu/k/D4vJtTg3 QC1vedzHSvHMINFv9ladDQX0ja2kIbtGVhCmC23XiVporHw/kWbDQfkA+NVYmxqHLinX cor5P0HScI7IVyXPMCg80gYqgf0pUgjJnunDmK2QHQ4EM/0saPUiR1mEMmHE1zv2L03z fpbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:cc:to:from; bh=F8pMjvGZFuGXV7btFu5h/I7dk48JS4aX61a4gQLO+n0=; b=GhvqDCef7lGsPreJ06Mm17Ylja78+zmWAlsMsIW84yDNcS7d5qtAdlD9yTIKnlnPJZ Q4Re9e9BvnD7Ux7P8mOOCZSoRIzNwkQ35K4aFetYCxJW4okHFbcic2rKF2odGV5Z/CfB z4Rn52DNq1iUrUWBsCbakQCd/VU/XbRslwCQt3dM1Dnr8qTyFK/axfi1MAIc4zvVUMjM QzJyTg1GUQfFtHP8tSfT8AmvRofswPXyTZCQzNNhGgzG4MKRInOH8ymxMQ+GktgEuQbY dxgbtcRhWdeA1a+BBTvwL9OCICcA5O2RTX2zUGsJ4mNELRbCrII84YhWYPluob2q8q03 lj5w== 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 p127si4686926pfp.119.2019.01.09.11.25.54; Wed, 09 Jan 2019 11:26:09 -0800 (PST) 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 S1728337AbfAITWq (ORCPT + 99 others); Wed, 9 Jan 2019 14:22:46 -0500 Received: from ale.deltatee.com ([207.54.116.67]:59686 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728176AbfAITWp (ORCPT ); Wed, 9 Jan 2019 14:22:45 -0500 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 1ghJR2-00053r-GG; Wed, 09 Jan 2019 12:22:45 -0700 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1ghJR1-0001Vk-CP; Wed, 09 Jan 2019 12:22:39 -0700 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-ntb@googlegroups.com, Jon Mason Cc: Allen Hubbe , Dave Jiang , Serge Semin , Logan Gunthorpe Date: Wed, 9 Jan 2019 12:22:28 -0700 Message-Id: <20190109192233.5752-4-logang@deltatee.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20190109192233.5752-1-logang@deltatee.com> References: <20190109192233.5752-1-logang@deltatee.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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.2 Subject: [PATCH v3 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 Acked-by: Allen Hubbe Tested-by: Alexander Fomichev --- 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 dc82be2dcf47..f8f75a504a58 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); -- 2.19.0