Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1675071

[PATCH] ntb: use correct mw_count function in ntb_tool and ntb_transport

Path csiph.com!weretis.net!feeder4.news.weretis.net!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Logan Gunthorpe <logang@deltatee.com>
Newsgroups linux.kernel
Subject [PATCH] ntb: use correct mw_count function in ntb_tool and ntb_transport
Date Mon, 26 Jun 2017 22:00:02 +0200
Message-ID <tWIkW-6A0-9@gated-at.bofh.it> (permalink)
X-Original-To linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org
X-Mailer git-send-email 2.11.0
X-Sa-Exim-Connect-IP 172.16.1.31
X-Sa-Exim-Rcpt-To linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org, logang@deltatee.com, jdmason@kudzu.us, dave.jiang@intel.com, Allen.Hubbe@emc.com, fancer.lancer@gmail.com
X-Sa-Exim-Mail-From gunthorp@deltatee.com
X-Sa-Exim-Version 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000)
X-Sa-Exim-Scanned Yes (on ale.deltatee.com)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 60
Organization linux.* mail to news gateway
X-Original-Cc Logan Gunthorpe <logang@deltatee.com>, Jon Mason <jdmason@kudzu.us>, Dave Jiang <dave.jiang@intel.com>, Allen Hubbe <Allen.Hubbe@emc.com>, Serge Semin <fancer.lancer@gmail.com>
X-Original-Date Mon, 26 Jun 2017 13:50:41 -0600
X-Original-Message-ID <20170626195041.6190-1-logang@deltatee.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1675071

Show key headers only | View raw


After converting to the new API, both ntb_tool and ntb_transport are
using ntb_mw_count to iterate through ntb_peer_get_addr when they
should be using ntb_peer_mw_count.

This probably isn't an issue with the Intel and AMD drivers but
this will matter for any future driver with asymetric memory window
counts.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Cc: Jon Mason <jdmason@kudzu.us>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Allen Hubbe <Allen.Hubbe@emc.com>
Cc: Serge Semin <fancer.lancer@gmail.com>
---

Hi Guys,

I caught this issue while finishing up the switchtec rebase. (Which is
now working again and I'll send the updated series after doing a bit more
testing.)

However, seeing this is a bug in the new api patches I feel it should
be applied to ntb-next tree before it's merged upstream.

Thanks,

Logan

 drivers/ntb/ntb_transport.c | 2 +-
 drivers/ntb/test/ntb_tool.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
index 9a03c5871efe..b29558ddfe95 100644
--- a/drivers/ntb/ntb_transport.c
+++ b/drivers/ntb/ntb_transport.c
@@ -1059,7 +1059,7 @@ static int ntb_transport_probe(struct ntb_client *self, struct ntb_dev *ndev)
 	int node;
 	int rc, i;

-	mw_count = ntb_mw_count(ndev, PIDX);
+	mw_count = ntb_peer_mw_count(ndev);

 	if (!ndev->ops->mw_set_trans) {
 		dev_err(&ndev->dev, "Inbound MW based NTB API is required\n");
diff --git a/drivers/ntb/test/ntb_tool.c b/drivers/ntb/test/ntb_tool.c
index f002bf48a08d..a69815c45ce6 100644
--- a/drivers/ntb/test/ntb_tool.c
+++ b/drivers/ntb/test/ntb_tool.c
@@ -959,7 +959,7 @@ static int tool_probe(struct ntb_client *self, struct ntb_dev *ntb)
 	tc->ntb = ntb;
 	init_waitqueue_head(&tc->link_wq);

-	tc->mw_count = min(ntb_mw_count(tc->ntb, PIDX), MAX_MWS);
+	tc->mw_count = min(ntb_peer_mw_count(tc->ntb), MAX_MWS);
 	for (i = 0; i < tc->mw_count; i++) {
 		rc = tool_init_mw(tc, i);
 		if (rc)
--
2.11.0

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH] ntb: use correct mw_count function in ntb_tool and ntb_transport Logan Gunthorpe <logang@deltatee.com> - 2017-06-26 22:00 +0200
  RE: [PATCH] ntb: use correct mw_count function in ntb_tool and ntb_transport "Allen Hubbe" <Allen.Hubbe@dell.com> - 2017-06-27 18:10 +0200

csiph-web