netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Jiawen Wu <jiawenwu@trustnetic.com>
Cc: <andrew+netdev@lunn.ch>, <davem@davemloft.net>,
	<edumazet@google.com>, <pabeni@redhat.com>, <horms@kernel.org>,
	<rmk+kernel@armlinux.org.uk>, <netdev@vger.kernel.org>,
	<mengyuanlou@net-swift.com>
Subject: Re: [PATCH net] net: libwx: fix firmware mailbox abnormal return
Date: Thu, 2 Jan 2025 16:37:49 -0800	[thread overview]
Message-ID: <20250102163749.66d047c9@kernel.org> (raw)
In-Reply-To: <028a01db5ce1$7f555f60$7e001e20$@trustnetic.com>

On Thu, 2 Jan 2025 14:42:30 +0800 Jiawen Wu wrote:
> > >  	/* Check command completion */
> > >  	if (status) {
> > >  		wx_dbg(wx, "Command has failed with no status valid.\n");
> > > -
> > > -		buf[0] = rd32(wx, WX_MNG_MBOX);
> > > -		if ((buffer[0] & 0xff) != (~buf[0] >> 24)) {
> > > -			status = -EINVAL;
> > > -			goto rel_out;
> > > -		}
> > > -		if ((buf[0] & 0xff0000) >> 16 == 0x80) {
> > > -			wx_dbg(wx, "It's unknown cmd.\n");
> > > -			status = -EINVAL;
> > > -			goto rel_out;
> > > -		}
> > >
> > > +		wx_dbg(wx, "check: %x %x\n", buffer[0] & 0xff, ~buf[0] >> 24);
> > > +		if ((buffer[0] & 0xff) != (~buf[0] >> 24))
> > > +			goto rel_out;  
> > 
> > Inverse question here, I guess. Why is it only an error for FW not
> > to be ready if cmd doesn't match?  
> 
> It is to check if the cmd has been processed by FW. If it matches, it means
> that FW has already processed the cmd, but FWRDY timeout for some
> unknown reason.

Feels a little risky. AFAICT the value we're comparing is just 
a checksum (potentially always set to 0xff?) It doesn't seem to
identify the command very well. If the command timed out let's
always return an error.

The other explanations make sense, please include them in the commit
msg.

      reply	other threads:[~2025-01-03  0:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-26  3:18 [PATCH net] net: libwx: fix firmware mailbox abnormal return Jiawen Wu
2024-12-31  2:11 ` Jakub Kicinski
2025-01-02  6:42   ` Jiawen Wu
2025-01-03  0:37     ` Jakub Kicinski [this message]

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=20250102163749.66d047c9@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jiawenwu@trustnetic.com \
    --cc=mengyuanlou@net-swift.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rmk+kernel@armlinux.org.uk \
    /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).