From: "Jiang, Dave" <dave.jiang@intel.com>
To: "logang@deltatee.com" <logang@deltatee.com>,
"jdmason@kudzu.us" <jdmason@kudzu.us>
Cc: "Allen.Hubbe@emc.com" <Allen.Hubbe@emc.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"sudipm.mukherjee@gmail.com" <sudipm.mukherjee@gmail.com>,
"arnd@arndb.de" <arnd@arndb.de>,
"john.kading@gd-ms.com" <john.kading@gd-ms.com>,
"linux-ntb@googlegroups.com" <linux-ntb@googlegroups.com>
Subject: Re: [PATCH v2 2/3] ntb_transport: Check the number of spads the hardware supports
Date: Tue, 7 Jun 2016 17:24:29 +0000 [thread overview]
Message-ID: <1465320253.16234.176.camel@intel.com> (raw)
In-Reply-To: <1465320022-4385-1-git-send-email-logang@deltatee.com>
On Tue, 2016-06-07 at 11:20 -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. I've also removed the unused SPAD_MSG and
> SPAD_ACK enums so that MAX_SPAD accurately reflects the number of
> spads used.
>
> Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Acked-by: Dave Jiang <dave.jiang@intel.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..6d9940a 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)) {
> + 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..4368519 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,
> MAX_SPAD
> };
>
> @@ -696,6 +694,12 @@ static int perf_probe(struct ntb_client *client,
> struct ntb_dev *ntb)
> int node;
> int rc = 0;
>
> + if (ntb_spad_count(ntb) < MAX_SPAD) {
> + dev_err(&ntb->dev, "Not enough scratch pad registers
> for %s",
> + DRIVER_NAME);
> + return -EIO;
> + }
> +
> node = dev_to_node(&pdev->dev);
>
> perf = kzalloc_node(sizeof(*perf), GFP_KERNEL, node);
> --
> 2.1.4
>
next prev parent reply other threads:[~2016-06-07 17:24 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 ` [PATCH 2/3] ntb_transport: Check the number of spads the hardware supports Jon Mason
2016-06-07 17:15 ` Logan Gunthorpe
[not found] ` <1465320022-4385-1-git-send-email-logang@deltatee.com>
2016-06-07 17:24 ` Jiang, Dave [this message]
2016-06-09 14:51 ` [PATCH v2 " 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=1465320253.16234.176.camel@intel.com \
--to=dave.jiang@intel.com \
--cc=Allen.Hubbe@emc.com \
--cc=arnd@arndb.de \
--cc=jdmason@kudzu.us \
--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