Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp10905ybt; Tue, 23 Jun 2020 13:57:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+IM/uAF1VcEG2coC5QkaCf3How3wmObxkm14F5HfoHhfTjiaTSTqvQ0iNyfZlz0MIKHpO X-Received: by 2002:a17:906:3e13:: with SMTP id k19mr16526788eji.476.1592945838731; Tue, 23 Jun 2020 13:57:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592945838; cv=none; d=google.com; s=arc-20160816; b=lX3LgHK7b2l2+PE/zjfMKUpO3N+ogMM9KkLrWnaDp37Ow9OpLw8zvlpWtqW+S17xAM KeBnXQpzvCk41O+E7unODixKkdxrOCkSRD3e+mjwyOL7F+M4glTuFyWBq4L3CxE33F5r F9QNxQwCoMfL7TgGzCMu+BkFL9Ib1jnoQ5n0XQWINSORlG+nSAjIrmpMdmFExEyDUlGL eOfOxrmm3ReCPy1qe/N9aObQVAB73XszTUGieRXLmvVCZB7frHKJrTkRq/g4038HQ3Sp AZRVzn0IJ9DAgZLaRs3bCAEOlP6tf9YX1vCKfAWbtMruGjs9qbFNj5yCtjqlynPRzGoV evRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yBhld37YoQyX3qNnUVF1uKoDspkmSx8N12dEbFDzWqo=; b=CbSdaE97GcEP2o1V8YoGD2+lhUgdan/Oe+tBxacdW1EqhQAYbxr7J8C7s43uKVAQgK bfGQGPNezU76EG4aciZq5K+Sb8PpAnNz26/7FMdUdQlelPQdftAfemoPp2h1KZqNAUfC +XodN/gkFZmQzixL8u6L/Ne+l2DqFpXjBKVbsqbV4oBHFUn/L8JZqWqXry+2oYceYbFD 3I9kFb/qj/IAK9iWl7n6vEtx4qPkKmIpLXKhY82biN6yHXoeDXp8aIzmnB3MhIjfdgZY DyqTI7tlwdKLg2IaBNe+L++xomv8OHlse5gehoEFNMdAYpeXGgeU2DnAuJO11lC5iXpg u9iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=h0KcKio3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c5si12481198edt.498.2020.06.23.13.56.54; Tue, 23 Jun 2020 13:57:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=h0KcKio3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391279AbgFWUxm (ORCPT + 99 others); Tue, 23 Jun 2020 16:53:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:44300 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392841AbgFWUqZ (ORCPT ); Tue, 23 Jun 2020 16:46:25 -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 9BD842098B; Tue, 23 Jun 2020 20:46:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592945186; bh=msSZplCUBx1WweaibaP2xSwJxAtw/Tx1BtL/09+5HVo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h0KcKio3ZPHVCmWg5BQxsjQZnVIN5cskz6I53y7ClhmmczL2X1Bl+mqW7sYM/nZ89 fSrCHrkChhiAymbt2yQGsVObljnzW4MAgT0DZnyRIF9P7x0YFEaZiMtYBUHjfjhnJQ SYsptIUdw72+QM3R48KoVr6WrOHILCiuSdGb/eiY= 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.14 031/136] NTB: Fix the default port and peer numbers for legacy drivers Date: Tue, 23 Jun 2020 21:58:07 +0200 Message-Id: <20200623195305.217698881@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195303.601828702@linuxfoundation.org> References: <20200623195303.601828702@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/ntb.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/ntb/ntb.c b/drivers/ntb/ntb.c index 03b80d89b9800..b75ec229b39a5 100644 --- a/drivers/ntb/ntb.c +++ b/drivers/ntb/ntb.c @@ -216,10 +216,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); @@ -242,10 +240,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