[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1D189F224F826D6C+20250901072734.GA43225@nic-Precision-5820-Tower>
Date: Mon, 1 Sep 2025 15:27:34 +0800
From: Yibo Dong <dong100@...se.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: andrew+netdev@...n.ch, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, horms@...nel.org,
corbet@....net, gur.stavi@...wei.com, maddy@...ux.ibm.com,
mpe@...erman.id.au, danishanwar@...com, lee@...ger.us,
gongfan1@...wei.com, lorenzo@...nel.org, geert+renesas@...der.be,
Parthiban.Veerasooran@...rochip.com, lukas.bulwahn@...hat.com,
alexanderduyck@...com, richardcochran@...il.com, kees@...nel.org,
gustavoars@...nel.org, rdunlap@...radead.org,
vadim.fedorenko@...ux.dev, netdev@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH net-next v9 4/5] net: rnpgbe: Add basic mbx_fw support
On Fri, Aug 29, 2025 at 09:48:12PM +0200, Andrew Lunn wrote:
> > Maybe I should rename it like this?
> >
> > /**
> > * mucse_mbx_sync_fw_by_get_capability - Try to sync driver and fw
> > * @hw: pointer to the HW structure
> > *
> > * mucse_mbx_sync_fw_by_get_capability tries to sync driver and fw
> > * by get capabitiy mbx cmd. Many retrys will do if it is failed.
> > *
> > * Return: 0 on success, negative errno on failure
> > **/
> > int mucse_mbx_sync_fw_by_get_capability(struct mucse_hw *hw)
> > {
> > struct hw_abilities ability = {};
> > int try_cnt = 3;
> > int err;
> > /* It is called once in probe, if failed nothing
> > * (register network) todo. Try more times to get driver
> > * and firmware in sync.
> > */
> > do {
> > err = mucse_fw_get_capability(hw, &ability);
> > if (err)
> > continue;
> > break;
> > } while (try_cnt--);
> >
> > if (!err)
> > hw->pfvfnum = le16_to_cpu(ability.pfnum) & GENMASK_U16(7, 0);
> > return err;
> > }
>
> Why so much resistance to a NOP or firmware version, something which
> is not that important? Why do you want to combine getting sync and
> getting the capabilities?
>
Maybe like this?
mucse_mbx_sync_fw is called in probe with try_cnt.
mucse_mbx_get_info is the same as old mucse_mbx_get_capability.
One function one purpose, not combine two.
static int mucse_mbx_get_info(struct mucse_hw *hw)
{
struct mbx_fw_cmd_reply reply = {};
struct mbx_fw_cmd_req req = {};
struct hw_info info = {};
int err;
build_get_fw_info_req(&req);
err = mucse_fw_send_cmd_wait(hw, &req, &reply);
if (!err) {
memcpy(&info, &reply.hw_info, sizeof(struct hw_info));
hw->pfvfnum = le16_to_cpu(info.pfnum) & GENMASK_U16(7, 0);
}
return err;
}
/**
* mucse_mbx_sync_fw - Try to sync with fw
* @hw: pointer to the HW structure
*
* mucse_mbx_sync_fw tries get sync to fw hw.
* It is only called in probe
*
* 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;
}
Powered by blists - more mailing lists