From: Jon Mason <jdmason@kudzu.us>
To: Logan Gunthorpe <logang@deltatee.com>
Cc: Dave Jiang <dave.jiang@intel.com>,
Allen Hubbe <Allen.Hubbe@emc.com>,
John Kading <john.kading@gd-ms.com>,
Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
Arnd Bergmann <arnd@arndb.de>,
linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] ntb_transport: Check the number of spads the hardware supports
Date: Sat, 4 Jun 2016 11:40:36 -0400 [thread overview]
Message-ID: <20160604154035.GA11597@kudzu.us> (raw)
In-Reply-To: <efa91cd782ad223cc30eeeda8d2341cc11a8646d.1464986161.git.logang@deltatee.com>
On Fri, Jun 03, 2016 at 02:50:32PM -0600, Logan Gunthorpe wrote:
> I'm working on hardware that currently has a limited number of
> scratchpad registers and ntb_ndev fails with no clue as to why. I
> feel it is better to fail early and provide a reasonable error message
> then to fail later on..
>
> The same is done to ntb_perf, but it doesn't currently require enough
> spads to actually fail.
>
> Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
> ---
> drivers/ntb/ntb_transport.c | 9 +++++++--
> drivers/ntb/test/ntb_perf.c | 8 ++++++--
> 2 files changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
> index 2ef9d913..34e7a7a 100644
> --- a/drivers/ntb/ntb_transport.c
> +++ b/drivers/ntb/ntb_transport.c
> @@ -1037,6 +1037,13 @@ static int ntb_transport_probe(struct ntb_client *self, struct ntb_dev *ndev)
> int node;
> int rc, i;
>
> + mw_count = ntb_mw_count(ndev);
> + if (ntb_spad_count(ndev) < (NUM_MWS + 1 + mw_count*2)) {
Nit, please add spaces around '*' (per checkpatch)
> + dev_err(&ndev->dev, "Not enough scratch pad registers for %s",
> + NTB_TRANSPORT_NAME);
> + return -EIO;
> + }
> +
> if (ntb_db_is_unsafe(ndev))
> dev_dbg(&ndev->dev,
> "doorbell is unsafe, proceed anyway...\n");
> @@ -1052,8 +1059,6 @@ static int ntb_transport_probe(struct ntb_client *self, struct ntb_dev *ndev)
>
> nt->ndev = ndev;
>
> - mw_count = ntb_mw_count(ndev);
> -
> nt->mw_count = mw_count;
>
> nt->mw_vec = kzalloc_node(mw_count * sizeof(*nt->mw_vec),
> diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c
> index 30635c8..1815592 100644
> --- a/drivers/ntb/test/ntb_perf.c
> +++ b/drivers/ntb/test/ntb_perf.c
> @@ -143,8 +143,6 @@ enum {
> VERSION = 0,
> MW_SZ_HIGH,
> MW_SZ_LOW,
> - SPAD_MSG,
> - SPAD_ACK,
Please explicitly point out that this is being modified in the commit
message. I don't see them being used, so probably not a big deal
(unless Dave Jiang has something queued that will use it).
> MAX_SPAD
> };
>
> @@ -698,6 +696,12 @@ static int perf_probe(struct ntb_client *client, struct ntb_dev *ntb)
>
> node = dev_to_node(&pdev->dev);
>
> + if (ntb_spad_count(ntb) < MAX_SPAD) {
> + dev_err(&ntb->dev, "Not enough scratch pad registers for %s",
> + DRIVER_NAME);
> + return -EIO;
> + }
Move this check above the dev_to_node assignment above.
Thanks,
Jon
> +
> perf = kzalloc_node(sizeof(*perf), GFP_KERNEL, node);
> if (!perf) {
> rc = -ENOMEM;
> --
> 2.1.4
>
next prev parent reply other threads:[~2016-06-04 15:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1464986161.git.logang@deltatee.com>
[not found] ` <9e9ca38bef468fc1dd3d135f5f3d3cfb6b61246d.1464986161.git.logang@deltatee.com>
2016-06-03 21:03 ` [PATCH 1/3] ntb_perf: Allow limiting the size of the memory windows Jiang, Dave
2016-06-04 15:25 ` Jon Mason
[not found] ` <a573b7044c8f38d28bdad9eb0ea7d2aaaedc7e19.1464986161.git.logang@deltatee.com>
2016-06-03 21:20 ` [PATCH 3/3] ntb_tool: Add memory window debug support Allen Hubbe
2016-06-04 15:25 ` Jon Mason
[not found] ` <efa91cd782ad223cc30eeeda8d2341cc11a8646d.1464986161.git.logang@deltatee.com>
2016-06-04 15:40 ` Jon Mason [this message]
2016-06-07 17:15 ` [PATCH 2/3] ntb_transport: Check the number of spads the hardware supports Logan Gunthorpe
[not found] ` <1465320022-4385-1-git-send-email-logang@deltatee.com>
2016-06-07 17:24 ` [PATCH v2 " Jiang, Dave
2016-06-09 14:51 ` Jon Mason
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160604154035.GA11597@kudzu.us \
--to=jdmason@kudzu.us \
--cc=Allen.Hubbe@emc.com \
--cc=arnd@arndb.de \
--cc=dave.jiang@intel.com \
--cc=john.kading@gd-ms.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-ntb@googlegroups.com \
--cc=logang@deltatee.com \
--cc=sudipm.mukherjee@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox