linux-wpan.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Alexander Aring <alex.aring@gmail.com>
Cc: Stefan Schmidt <stefan@datenfreihafen.org>,
	linux-wpan - ML <linux-wpan@vger.kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	"open list:NETWORKING [GENERAL]" <netdev@vger.kernel.org>,
	David Girault <david.girault@qorvo.com>,
	Romuald Despres <romuald.despres@qorvo.com>,
	Frederic Blain <frederic.blain@qorvo.com>,
	Nicolas Schodet <nico@ni.fr.eu.org>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH wpan-next v4 07/11] net: ieee802154: at86rf230: Provide meaningful error codes when possible
Date: Mon, 28 Mar 2022 18:28:35 +0200	[thread overview]
Message-ID: <20220328182835.3e3e1030@xps13> (raw)
In-Reply-To: <CAB_54W5A1xmHO-YrWS3+RD0N_66mzkDpPYjosHU3vHgn1zmONg@mail.gmail.com>

Hi Alexander,

alex.aring@gmail.com wrote on Sun, 27 Mar 2022 11:46:12 -0400:

> Hi,
> 
> On Fri, Mar 18, 2022 at 2:56 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> >
> > Either the spi operation failed, or the offloaded transmit operation
> > failed and returned a TRAC value. Use this value when available or use
> > the default "SYSTEM_ERROR" otherwise, in order to propagate one step
> > above the error.
> >
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > ---
> >  drivers/net/ieee802154/at86rf230.c | 25 +++++++++++++++++++++++--
> >  1 file changed, 23 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c
> > index d3cf6d23b57e..34d199f597c9 100644
> > --- a/drivers/net/ieee802154/at86rf230.c
> > +++ b/drivers/net/ieee802154/at86rf230.c
> > @@ -358,7 +358,23 @@ static inline void
> >  at86rf230_async_error(struct at86rf230_local *lp,
> >                       struct at86rf230_state_change *ctx, int rc)
> >  {
> > -       dev_err(&lp->spi->dev, "spi_async error %d\n", rc);
> > +       int reason;
> > +
> > +       switch (rc) {  
> 
> I think there was a miscommunication last time, this rc variable is
> not a trac register value, it is a linux errno. Also the error here
> has nothing to do with a trac error. A trac error is the result of the
> offloaded transmit functionality on the transceiver, here we dealing
> about bus communication errors produced by the spi subsystem. What we
> need is to report it to the softmac layer as "IEEE802154_SYSTEM_ERROR"
> (as we decided that this is a user specific error and can be returned
> by the transceiver for non 802.15.4 "error" return code.
> 
> > +       case TRAC_CHANNEL_ACCESS_FAILURE:
> > +               reason = IEEE802154_CHANNEL_ACCESS_FAILURE;
> > +               break;
> > +       case TRAC_NO_ACK:
> > +               reason = IEEE802154_NO_ACK;
> > +               break;
> > +       default:
> > +               reason = IEEE802154_SYSTEM_ERROR;

I went for the solution: if it is a bus error, I return SYSTEM ERROR,
otherwise I return a trac error.

> > +       }
> > +
> > +       if (rc < 0)
> > +               dev_err(&lp->spi->dev, "spi_async error %d\n", rc);
> > +       else
> > +               dev_err(&lp->spi->dev, "xceiver error %d\n", reason);
> >
> >         at86rf230_async_state_change(lp, ctx, STATE_FORCE_TRX_OFF,
> >                                      at86rf230_async_error_recover);
> > @@ -666,10 +682,15 @@ at86rf230_tx_trac_check(void *context)
> >         case TRAC_SUCCESS:
> >         case TRAC_SUCCESS_DATA_PENDING:
> >                 at86rf230_async_state_change(lp, ctx, STATE_TX_ON, at86rf230_tx_on);
> > +               return;
> > +       case TRAC_CHANNEL_ACCESS_FAILURE:
> > +       case TRAC_NO_ACK:
> >                 break;
> >         default:
> > -               at86rf230_async_error(lp, ctx, -EIO);
> > +               trac = TRAC_INVALID;
> >         }
> > +
> > +       at86rf230_async_error(lp, ctx, trac);  
> 
> That makes no sense, at86rf230_async_error() is not a trac error
> handling, it is a bus error handling. As noted above. With this change
> you mix bus errors and trac errors (which are not bus errors). If
> there are no bus errors then trac should be evaluated and should
> either deliver some 802.15.4 $SUCCESS_CODE or $ERROR_CODE to the
> softmac stack, which is xmit_complete() or xmit_error().

There is no specific path for bus errors, everything is supposedly
asynchronous and all the function return void. In both cases I need to
free the skb. So I am questioning myself about the right solution (need
to think further...)

Thanks,
Miquèl

  reply	other threads:[~2022-03-28 16:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-18 18:56 [PATCH wpan-next v4 00/11] ieee802154: Better Tx error handling Miquel Raynal
2022-03-18 18:56 ` [PATCH wpan-next v4 01/11] net: ieee802154: Enhance/fix the names of the MLME return codes Miquel Raynal
2022-03-18 18:56 ` [PATCH wpan-next v4 02/11] net: ieee802154: Fill the list of " Miquel Raynal
2022-03-18 18:56 ` [PATCH wpan-next v4 03/11] net: mac802154: Save a global error code on transmissions Miquel Raynal
2022-03-18 18:56 ` [PATCH wpan-next v4 04/11] net: mac802154: Create a transmit error helper Miquel Raynal
2022-03-18 18:56 ` [PATCH wpan-next v4 05/11] Revert "at86rf230: add debugfs support" Miquel Raynal
2022-03-27 15:36   ` Alexander Aring
2022-03-18 18:56 ` [PATCH wpan-next v4 06/11] net: ieee802154: at86rf230: Error out upon failed offloaded transmissions Miquel Raynal
2022-03-18 18:56 ` [PATCH wpan-next v4 07/11] net: ieee802154: at86rf230: Provide meaningful error codes when possible Miquel Raynal
2022-03-27 15:46   ` Alexander Aring
2022-03-28 16:28     ` Miquel Raynal [this message]
2022-03-29 16:35     ` Miquel Raynal
2022-04-04 12:40       ` Miquel Raynal
2022-04-06  0:05         ` Alexander Aring
2022-03-18 18:56 ` [PATCH wpan-next v4 08/11] net: ieee802154: at86rf230: Call _xmit_error() when a transmission fails Miquel Raynal
2022-03-18 18:56 ` [PATCH wpan-next v4 09/11] net: ieee802154: atusb: " Miquel Raynal
2022-03-18 18:56 ` [PATCH wpan-next v4 10/11] net: ieee802154: ca8210: Use core return codes instead of hardcoding them Miquel Raynal
2022-03-18 18:56 ` [PATCH wpan-next v4 11/11] net: ieee802154: ca8210: Call _xmit_error() when a transmission fails Miquel Raynal

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=20220328182835.3e3e1030@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=alex.aring@gmail.com \
    --cc=davem@davemloft.net \
    --cc=david.girault@qorvo.com \
    --cc=frederic.blain@qorvo.com \
    --cc=kuba@kernel.org \
    --cc=linux-wpan@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nico@ni.fr.eu.org \
    --cc=romuald.despres@qorvo.com \
    --cc=stefan@datenfreihafen.org \
    --cc=thomas.petazzoni@bootlin.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;
as well as URLs for NNTP newsgroup(s).