[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <80644ec1-a313-403a-82dd-62eb551442d3@lunn.ch>
Date: Fri, 4 Jul 2025 20:13:19 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Dong Yibo <dong100@...se.com>
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
> #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?
> +/**
> + * 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?
> +/**
> + * 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.
> + **/
> +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.
> +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
Powered by blists - more mailing lists