lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <424D721323023327+20250824041052.GB2000422@nic-Precision-5820-Tower>
Date: Sun, 24 Aug 2025 12:10:52 +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, netdev@...r.kernel.org,
	linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-hardening@...r.kernel.org
Subject: Re: [PATCH net-next v7 4/5] net: rnpgbe: Add basic mbx_fw support

On Sat, Aug 23, 2025 at 05:17:45PM +0200, Andrew Lunn wrote:
> On Sat, Aug 23, 2025 at 09:58:24AM +0800, Yibo Dong wrote:
> > On Fri, Aug 22, 2025 at 04:43:16PM +0200, Andrew Lunn wrote:
> > > > +/**
> > > > + * mucse_mbx_get_capability - Get hw abilities from fw
> > > > + * @hw: pointer to the HW structure
> > > > + *
> > > > + * mucse_mbx_get_capability tries to get capabities from
> > > > + * hw. Many retrys will do if it is failed.
> > > > + *
> > > > + * @return: 0 on success, negative on failure
> > > > + **/
> > > > +int mucse_mbx_get_capability(struct mucse_hw *hw)
> > > > +{
> > > > +	struct hw_abilities ability = {};
> > > > +	int try_cnt = 3;
> > > > +	int err = -EIO;
> > > > +
> > > > +	while (try_cnt--) {
> > > > +		err = mucse_fw_get_capability(hw, &ability);
> > > > +		if (err)
> > > > +			continue;
> > > > +		hw->pfvfnum = le16_to_cpu(ability.pfnum) & GENMASK_U16(7, 0);
> > > > +		return 0;
> > > > +	}
> > > > +	return err;
> > > > +}
> > > 
> > > Please could you add an explanation why it would fail? Is this to do
> > > with getting the driver and firmware in sync? Maybe you should make
> > > this explicit, add a function mucse_mbx_sync() with a comment that
> > > this is used once during probe to synchronise communication with the
> > > firmware. You can then remove this loop here.
> > 
> > It is just get some fw capability(or info such as fw version).
> > It is failed maybe:
> > 1. -EIO: return by mucse_obtain_mbx_lock_pf. The function tries to get
> > pf-fw lock(in chip register, not driver), failed when fw hold the lock.
> 
> If it cannot get the lock, isn't that fatal? You cannot do anything
> without the lock.
> 
> > 2. -ETIMEDOUT: return by mucse_poll_for_xx. Failed when timeout.
> > 3. -ETIMEDOUT: return by mucse_fw_send_cmd_wait. Failed when wait
> > response timeout.
> 
> If its dead, its dead. Why would it suddenly start responding?
> 
> > 4. -EIO: return by mucse_fw_send_cmd_wait. Failed when error_code in
> > response.
> 
> Which should be fatal. No retries necessary.
> 
> > 5. err return by mutex_lock_interruptible.
> 
> So you want the user to have to ^C three times?
> 
> And is mucse_mbx_get_capability() special, or will all interactions
> with the firmware have three retries?

It is the first 'cmd with response' from fw when probe. If it failed,
return err and nothing else todo (no registe netdev ...). So, we design
to give retry for it.
fatal with no retry, maybe like this? 

int mucse_mbx_get_capability(struct mucse_hw *hw)
{
        struct hw_abilities ability = {};
        int try_cnt = 3;
        int err;

        do {
                err = mucse_fw_get_capability(hw, &ability);
                if (err == -ETIMEDOUT)
                        continue;

		break;
        } while(try_cnt--);

	if (!err)
		hw->pfvfnum = le16_to_cpu(ability.pfnum) & GENMASK_U16(7, 0);
        return err;
}

> 
> 	Andrew
> 

Thanks for your feedback.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ