netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Jiawen Wu <jiawenwu@trustnetic.com>
Cc: netdev@vger.kernel.org, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, mengyuanlou@net-swift.com
Subject: Re: [PATCH net 2/2] net: libwx: Fix firmware interaction failure
Date: Mon, 12 May 2025 11:57:12 +0100	[thread overview]
Message-ID: <20250512105712.GW3339421@horms.kernel.org> (raw)
In-Reply-To: <F2122F5E9DA92C07+20250509100003.22361-3-jiawenwu@trustnetic.com>

On Fri, May 09, 2025 at 06:00:03PM +0800, Jiawen Wu wrote:
> There are two issues that need to be fixed on the new SW-FW interaction.
> 
> The timeout waiting for the firmware to return is too short. So that
> some mailbox commands cannot be completed. Use the 'timeout' parameter
> instead of fixed timeout value for flexible configuration.
> 
> Missing the error return if there is an unknown command. It causes the
> driver to mistakenly believe that the interaction is complete. This
> problem occurs when new driver is paired with old firmware, which does
> not support the new mailbox commands.

Hi Jiawen Wu,

Please split this patch so that each issue is fixed in a separate patch:
the rule of thumb is one patch per fix.

> 
> Fixes: 2e5af6b2ae85 ("net: txgbe: Add basic support for new AML devices")
> Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
> ---
>  drivers/net/ethernet/wangxun/libwx/wx_hw.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/wangxun/libwx/wx_hw.c b/drivers/net/ethernet/wangxun/libwx/wx_hw.c
> index 3c3aa5f4ebbf..de06467898de 100644
> --- a/drivers/net/ethernet/wangxun/libwx/wx_hw.c
> +++ b/drivers/net/ethernet/wangxun/libwx/wx_hw.c
> @@ -435,7 +435,7 @@ static int wx_host_interface_command_r(struct wx *wx, u32 *buffer,
>  	wr32m(wx, WX_SW2FW_MBOX_CMD, WX_SW2FW_MBOX_CMD_VLD, WX_SW2FW_MBOX_CMD_VLD);
>  
>  	/* polling reply from FW */
> -	err = read_poll_timeout(wx_poll_fw_reply, reply, reply, 1000, 50000,
> +	err = read_poll_timeout(wx_poll_fw_reply, reply, reply, 2000, timeout * 1000,
>  				true, wx, buffer, send_cmd);

nit: Please line-wrap so that lines remain no wider than 80 columns.

>  	if (err) {
>  		wx_err(wx, "Polling from FW messages timeout, cmd: 0x%x, index: %d\n",
> @@ -443,6 +443,12 @@ static int wx_host_interface_command_r(struct wx *wx, u32 *buffer,
>  		goto rel_out;
>  	}
>  
> +	if (hdr->cmd_or_resp.ret_status == 0x80) {
> +		wx_err(wx, "Unknown FW command: 0x%x\n", send_cmd);
> +		err = -EINVAL;
> +		goto rel_out;
> +	}
> +
>  	/* expect no reply from FW then return */
>  	if (!return_data)
>  		goto rel_out;

-- 
pw-bot: changes-requested

      reply	other threads:[~2025-05-12 10:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20250509100003.22361-1-jiawenwu@trustnetic.com>
2025-05-09 10:00 ` [PATCH net 1/2] net: txgbe: Fix to calculate EEPROM checksum for AML devices Jiawen Wu
2025-05-12 10:57   ` Simon Horman
2025-05-09 10:00 ` [PATCH net 2/2] net: libwx: Fix firmware interaction failure Jiawen Wu
2025-05-12 10:57   ` Simon Horman [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=20250512105712.GW3339421@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jiawenwu@trustnetic.com \
    --cc=kuba@kernel.org \
    --cc=mengyuanlou@net-swift.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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).