From: "Anwar, Md Danish" <a0501179@ti.com>
To: Dong Yibo <dong100@mucse.com>, <andrew+netdev@lunn.ch>,
<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <horms@kernel.org>, <corbet@lwn.net>,
<gur.stavi@huawei.com>, <maddy@linux.ibm.com>,
<mpe@ellerman.id.au>, <danishanwar@ti.com>, <lee@trager.us>,
<gongfan1@huawei.com>, <lorenzo@kernel.org>,
<geert+renesas@glider.be>, <Parthiban.Veerasooran@microchip.com>,
<lukas.bulwahn@redhat.com>, <alexanderduyck@fb.com>,
<richardcochran@gmail.com>, <kees@kernel.org>,
<gustavoars@kernel.org>, <rdunlap@infradead.org>,
<vadim.fedorenko@linux.dev>
Cc: <netdev@vger.kernel.org>, <linux-doc@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-hardening@vger.kernel.org>
Subject: Re: [PATCH net-next v11 4/5] net: rnpgbe: Add basic mbx_fw support
Date: Tue, 9 Sep 2025 19:59:11 +0530 [thread overview]
Message-ID: <68fc2f5c-2cbd-41f6-a814-5134ba06b4b5@ti.com> (raw)
In-Reply-To: <20250909120906.1781444-5-dong100@mucse.com>
On 9/9/2025 5:39 PM, Dong Yibo wrote:
> Add fundamental firmware (FW) communication operations via PF-FW mailbox,
> including:
> - FW sync (via HW info query with retries)
> - HW reset (post FW command to reset hardware)
> - MAC address retrieval (request FW for port-specific MAC)
> - Power management (powerup/powerdown notification to FW)
>
> Signed-off-by: Dong Yibo <dong100@mucse.com>
> ---
> +/**
> + * mucse_mbx_sync_fw - Try to sync with fw
> + * @hw: pointer to the HW structure
> + *
> + * mucse_mbx_sync_fw tries to sync with fw. It is only called in
> + * probe. Nothing (register network) todo if failed.
> + * Try more times to do sync.
> + *
> + * Return: 0 on success, negative errno on failure
> + **/
> +int mucse_mbx_sync_fw(struct mucse_hw *hw)
> +{
> + int try_cnt = 3;
> + int err;
> +
> + do {
> + err = mucse_mbx_get_info(hw);
> + if (err == -ETIMEDOUT)
> + continue;
> + break;
> + } while (try_cnt--);
> +
> + return err;
> +}
There's a logical issue in the code. The loop structure attempts to
retry on ETIMEDOUT errors, but the unconditional break statement after
the if-check will always exit the loop after the first attempt,
regardless of the error. The do-while loop will never actually retry
because the break statement is placed outside of the if condition that
checks for timeout errors.
--
Thanks and Regards,
Md Danish Anwar
next prev parent reply other threads:[~2025-09-09 14:35 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-09 12:09 [PATCH net-next v11 0/5] Add driver for 1Gbe network chips from MUCSE Dong Yibo
2025-09-09 12:09 ` [PATCH net-next v11 1/5] net: rnpgbe: Add build support for rnpgbe Dong Yibo
2025-09-09 12:37 ` Vadim Fedorenko
2025-09-09 12:09 ` [PATCH net-next v11 2/5] net: rnpgbe: Add n500/n210 chip support with BAR2 mapping Dong Yibo
2025-09-09 12:41 ` Vadim Fedorenko
2025-09-09 12:09 ` [PATCH net-next v11 3/5] net: rnpgbe: Add basic mbx ops support Dong Yibo
2025-09-09 14:22 ` Anwar, Md Danish
2025-09-09 20:55 ` Jakub Kicinski
2025-09-10 5:56 ` Yibo Dong
2025-09-11 1:02 ` Jakub Kicinski
2025-09-11 1:38 ` Yibo Dong
2025-09-10 5:52 ` Yibo Dong
2025-09-09 12:09 ` [PATCH net-next v11 4/5] net: rnpgbe: Add basic mbx_fw support Dong Yibo
2025-09-09 14:29 ` Anwar, Md Danish [this message]
2025-09-09 20:58 ` Jakub Kicinski
2025-09-10 6:08 ` Yibo Dong
2025-09-10 8:21 ` Jörg Sommer
2025-09-11 1:46 ` Yibo Dong
2025-09-11 1:03 ` Jakub Kicinski
2025-09-11 1:41 ` Yibo Dong
2025-09-09 12:09 ` [PATCH net-next v11 5/5] net: rnpgbe: Add register_netdev Dong Yibo
2025-09-09 14:31 ` Anwar, Md Danish
2025-09-10 6:10 ` Yibo Dong
2025-09-09 14:37 ` Vadim Fedorenko
2025-09-10 6:22 ` Yibo Dong
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=68fc2f5c-2cbd-41f6-a814-5134ba06b4b5@ti.com \
--to=a0501179@ti.com \
--cc=Parthiban.Veerasooran@microchip.com \
--cc=alexanderduyck@fb.com \
--cc=andrew+netdev@lunn.ch \
--cc=corbet@lwn.net \
--cc=danishanwar@ti.com \
--cc=davem@davemloft.net \
--cc=dong100@mucse.com \
--cc=edumazet@google.com \
--cc=geert+renesas@glider.be \
--cc=gongfan1@huawei.com \
--cc=gur.stavi@huawei.com \
--cc=gustavoars@kernel.org \
--cc=horms@kernel.org \
--cc=kees@kernel.org \
--cc=kuba@kernel.org \
--cc=lee@trager.us \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=lukas.bulwahn@redhat.com \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rdunlap@infradead.org \
--cc=richardcochran@gmail.com \
--cc=vadim.fedorenko@linux.dev \
/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
all inboxes | Powered by JetHome®