From: David Laight <David.Laight@ACULAB.COM>
To: 'Guenter Roeck' <linux@roeck-us.net>,
Eddie James <eajames@linux.ibm.com>
Cc: "linux-fsi@lists.ozlabs.org" <linux-fsi@lists.ozlabs.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>,
"jdelvare@suse.com" <jdelvare@suse.com>,
"joel@jms.id.au" <joel@jms.id.au>,
"jk@ozlabs.org" <jk@ozlabs.org>,
"alistair@popple.id.au" <alistair@popple.id.au>
Subject: RE: [PATCH 2/2] hwmon (occ): Retry for checksum failure
Date: Mon, 25 Apr 2022 09:10:22 +0000 [thread overview]
Message-ID: <44d4f10249064a28b6cc461e7cbdd402@AcuMS.aculab.com> (raw)
In-Reply-To: <20220424171816.GA749761@roeck-us.net>
From: Guenter Roeck
> Sent: 24 April 2022 18:18
>
> On Mon, Mar 21, 2022 at 10:31:12AM -0500, Eddie James wrote:
> > Due to the OCC communication design with a shared SRAM area,
> > checkum errors are expected due to corrupted buffer from OCC
> > communications with other system components. Therefore, retry
> > the command twice in the event of a checksum failure.
> >
> > Signed-off-by: Eddie James <eajames@linux.ibm.com>
>
> I assume this will be applied together with patch 1 of the series.
>
> Acked-by: Guenter Roeck <linux@roeck-us.net>
>
> Guenter
>
> > ---
> > drivers/hwmon/occ/p9_sbe.c | 28 ++++++++++++++++++----------
> > 1 file changed, 18 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/hwmon/occ/p9_sbe.c b/drivers/hwmon/occ/p9_sbe.c
> > index 49b13cc01073..7f4c3f979c54 100644
> > --- a/drivers/hwmon/occ/p9_sbe.c
> > +++ b/drivers/hwmon/occ/p9_sbe.c
> > @@ -84,17 +84,25 @@ static int p9_sbe_occ_send_cmd(struct occ *occ, u8 *cmd, size_t len)
> > struct p9_sbe_occ *ctx = to_p9_sbe_occ(occ);
> > size_t resp_len = sizeof(*resp);
> > int rc;
> > -
> > - rc = fsi_occ_submit(ctx->sbe, cmd, len, resp, &resp_len);
> > - if (rc < 0) {
> > - if (resp_len) {
> > - if (p9_sbe_occ_save_ffdc(ctx, resp, resp_len))
> > - sysfs_notify(&occ->bus_dev->kobj, NULL,
> > - bin_attr_ffdc.attr.name);
> > + int tries = 0;
> > +
> > + do {
Why not use a for() loop?
> > + rc = fsi_occ_submit(ctx->sbe, cmd, len, resp, &resp_len);
> > + if (rc < 0) {
> > + if (resp_len) {
> > + if (p9_sbe_occ_save_ffdc(ctx, resp, resp_len))
> > + sysfs_notify(&occ->bus_dev->kobj, NULL,
> > + bin_attr_ffdc.attr.name);
> > +
> > + return rc;
> > + } else if (rc != -EBADE) {
> > + return rc;
> > + }
No need for else after return.
> > + /* retry twice for checksum failures */
> > + } else {
> > + break;
I'd break on the success path after testing (rc >= 0).
Saves a level of indent.
> > }
> > -
> > - return rc;
> > - }
> > + } while (++tries < 3);
> >
> > switch (resp->return_status) {
> > case OCC_RESP_CMD_IN_PRG:
Probably end up with something like:
for (tries = 0; tries < 3; tries++) {
rc = ...;
if (rc >= 0)
break;
if (resp_len) {
...
return rc;
}
if (rc != -EBADE)
return rc;
}
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2022-04-25 9:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-21 15:31 [PATCH 0/2] fsi and hwmon (occ): Prevent occasional checksum failures Eddie James
2022-03-21 15:31 ` [PATCH 1/2] fsi: occ: Fix checksum failure mode Eddie James
2022-03-21 15:31 ` [PATCH 2/2] hwmon (occ): Retry for checksum failure Eddie James
2022-04-24 17:18 ` Guenter Roeck
2022-04-25 9:10 ` David Laight [this message]
2022-04-26 15:46 ` Eddie James
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=44d4f10249064a28b6cc461e7cbdd402@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=alistair@popple.id.au \
--cc=eajames@linux.ibm.com \
--cc=jdelvare@suse.com \
--cc=jk@ozlabs.org \
--cc=joel@jms.id.au \
--cc=linux-fsi@lists.ozlabs.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
/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;
as well as URLs for NNTP newsgroup(s).