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: <9C6FCA38E28D6768+20250707063955.GA162739@nic-Precision-5820-Tower>
Date: Mon, 7 Jul 2025 14:39:55 +0800
From: Yibo Dong <dong100@...se.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
	pabeni@...hat.com, horms@...nel.org, corbet@....net,
	andrew+netdev@...n.ch, 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, netdev@...r.kernel.org,
	linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 03/15] net: rnpgbe: Add basic mbx ops support

On Fri, Jul 04, 2025 at 08:13:19PM +0200, Andrew Lunn wrote:
> >  #define MBX_FEATURE_WRITE_DELAY BIT(1)
> >  	u32 mbx_feature;
> >  	/* cm3 <-> pf mbx */
> > -	u32 cpu_pf_shm_base;
> > -	u32 pf2cpu_mbox_ctrl;
> > -	u32 pf2cpu_mbox_mask;
> > -	u32 cpu_pf_mbox_mask;
> > -	u32 cpu2pf_mbox_vec;
> > +	u32 fw_pf_shm_base;
> > +	u32 pf2fw_mbox_ctrl;
> > +	u32 pf2fw_mbox_mask;
> > +	u32 fw_pf_mbox_mask;
> > +	u32 fw2pf_mbox_vec;
> 
> Why is a patch adding a new feature deleting code?
> 
Not delete code, 'cpu' here means controller in the chip, not host.
So, I just rename 'cpu' to 'fw' to avoid confusion.
> > +/**
> > + * mucse_read_mbx - Reads a message from the mailbox
> > + * @hw: Pointer to the HW structure
> > + * @msg: The message buffer
> > + * @size: Length of buffer
> > + * @mbx_id: Id of vf/fw to read
> > + *
> > + * returns 0 if it successfully read message or else
> > + * MUCSE_ERR_MBX.
> > + **/
> > +s32 mucse_read_mbx(struct mucse_hw *hw, u32 *msg, u16 size,
> 
> s32 is an unusual type for linux. Can the mbox actually return
> negative amounts of data?
> 
No, it cann't return negative amounts of data, but this function
returns negative when it failed. Maybe I should use 'int'?
> > +/**
> > + * mucse_write_mbx - Write a message to the mailbox
> > + * @hw: Pointer to the HW structure
> > + * @msg: The message buffer
> > + * @size: Length of buffer
> > + * @mbx_id: Id of vf/fw to write
> > + *
> > + * returns 0 if it successfully write message or else
> > + * MUCSE_ERR_MBX.
> 
> Don't invent new error codes. EINVAL would do.
> 
Got it, I will fix this.
> > + **/
> > +s32 mucse_write_mbx(struct mucse_hw *hw, u32 *msg, u16 size,
> > +		    enum MBX_ID mbx_id)
> > +{
> > +	struct mucse_mbx_info *mbx = &hw->mbx;
> > +	s32 ret_val = 0;
> > +
> > +	if (size > mbx->size)
> > +		ret_val = MUCSE_ERR_MBX;
> > +	else if (mbx->ops.write)
> > +		ret_val = mbx->ops.write(hw, msg, size, mbx_id);
> > +
> > +	return ret_val;
> > +}
> > +static inline void mucse_mbx_inc_pf_ack(struct mucse_hw *hw,
> > +					enum MBX_ID mbx_id)
> 
> No inline functions in C files. Let the compiler decide.
> 
Got it, I will move it to the h file.
> > +static s32 mucse_poll_for_msg(struct mucse_hw *hw, enum MBX_ID mbx_id)
> > +{
> > +	struct mucse_mbx_info *mbx = &hw->mbx;
> > +	int countdown = mbx->timeout;
> > +
> > +	if (!countdown || !mbx->ops.check_for_msg)
> > +		goto out;
> > +
> > +	while (countdown && mbx->ops.check_for_msg(hw, mbx_id)) {
> > +		countdown--;
> > +		if (!countdown)
> > +			break;
> > +		udelay(mbx->usec_delay);
> > +	}
> > +out:
> > +	return countdown ? 0 : -ETIME;
> 
> ETIMEDOUT, not ETIME. Please use iopoll.h, not roll your own.
> 
>     Andrew
> 
> ---
> pw-bot: cr
> 
Got it, I will fix it.
Thanks for your feedback.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ