From: Simon Horman <horms@kernel.org>
To: Dong Yibo <dong100@mucse.com>
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, 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, netdev@vger.kernel.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH net-next v10 3/5] net: rnpgbe: Add basic mbx ops support
Date: Wed, 3 Sep 2025 17:44:31 +0100 [thread overview]
Message-ID: <20250903164431.GD361157@horms.kernel.org> (raw)
In-Reply-To: <20250903025430.864836-4-dong100@mucse.com>
On Wed, Sep 03, 2025 at 10:54:28AM +0800, Dong Yibo wrote:
> Initialize basic mbx function.
>
> Signed-off-by: Dong Yibo <dong100@mucse.com>
...
> +/**
> + * mucse_mbx_inc_pf_req - Increase req
> + * @hw: pointer to the HW structure
> + *
> + * mucse_mbx_inc_pf_req read pf_req from hw, then write
> + * new value back after increase
> + **/
> +static void mucse_mbx_inc_pf_req(struct mucse_hw *hw)
> +{
> + struct mucse_mbx_info *mbx = &hw->mbx;
> + u16 req;
> + u32 v;
> +
> + v = mbx_data_rd32(mbx, MBX_PF2FW_COUNTER);
> + req = (v & GENMASK_U32(15, 0));
nit1: Unnecessary parentheses
nit2: I would have used FIELD_GET here in conjunction with something like.
#define MBX_PF2FW_COUNTER_MASK GENMASK_U32(15, 0)
> + req++;
> + v &= GENMASK_U32(31, 16);
> + v |= req;
And using FIELD_PREP is probably more succinct here.
Likewise in the following function
> + mbx_data_wr32(mbx, MBX_PF2FW_COUNTER, v);
> + hw->mbx.stats.msgs_tx++;
> +}
> +
> +/**
> + * mucse_mbx_inc_pf_ack - Increase ack
> + * @hw: pointer to the HW structure
> + *
> + * mucse_mbx_inc_pf_ack read pf_ack from hw, then write
> + * new value back after increase
> + **/
> +static void mucse_mbx_inc_pf_ack(struct mucse_hw *hw)
> +{
> + struct mucse_mbx_info *mbx = &hw->mbx;
> + u16 ack;
> + u32 v;
> +
> + v = mbx_data_rd32(mbx, MBX_PF2FW_COUNTER);
> + ack = (v >> 16) & GENMASK_U32(15, 0);
> + ack++;
> + v &= GENMASK_U32(15, 0);
> + v |= (ack << 16);
> + mbx_data_wr32(mbx, MBX_PF2FW_COUNTER, v);
> + hw->mbx.stats.msgs_rx++;
> +}
...
> +/**
> + * mucse_mbx_reset - Reset mbx info, sync info from regs
> + * @hw: pointer to the HW structure
> + *
> + * This function reset all mbx variables to default.
> + **/
> +static void mucse_mbx_reset(struct mucse_hw *hw)
> +{
> + struct mucse_mbx_info *mbx = &hw->mbx;
> + u32 v;
> +
> + v = mbx_data_rd32(mbx, MBX_FW2PF_COUNTER);
> + hw->mbx.fw_req = v & GENMASK_U32(15, 0);
> + hw->mbx.fw_ack = (v >> 16) & GENMASK_U32(15, 0);
I'd use FIELD_GET here too.
> + mbx_ctrl_wr32(mbx, PF2FW_MBOX_CTRL(mbx), 0);
> + mbx_ctrl_wr32(mbx, FW_PF_MBOX_MASK(mbx), GENMASK_U32(31, 16));
> +}
...
next prev parent reply other threads:[~2025-09-03 16:44 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-03 2:54 [PATCH net-next v10 0/5] Add driver for 1Gbe network chips from MUCSE Dong Yibo
2025-09-03 2:54 ` [PATCH net-next v10 1/5] net: rnpgbe: Add build support for rnpgbe Dong Yibo
2025-09-03 2:54 ` [PATCH net-next v10 2/5] net: rnpgbe: Add n500/n210 chip support Dong Yibo
2025-09-03 2:54 ` [PATCH net-next v10 3/5] net: rnpgbe: Add basic mbx ops support Dong Yibo
2025-09-03 10:53 ` Vadim Fedorenko
2025-09-03 11:12 ` Yibo Dong
2025-09-03 12:43 ` Vadim Fedorenko
2025-09-04 2:08 ` Yibo Dong
2025-09-03 16:44 ` Simon Horman [this message]
2025-09-04 2:38 ` Yibo Dong
2025-09-03 22:24 ` Andrew Lunn
2025-09-04 3:19 ` Yibo Dong
2025-09-04 12:05 ` Andrew Lunn
2025-09-05 1:16 ` Yibo Dong
2025-09-03 2:54 ` [PATCH net-next v10 4/5] net: rnpgbe: Add basic mbx_fw support Dong Yibo
2025-09-03 22:45 ` Andrew Lunn
2025-09-04 2:57 ` Yibo Dong
2025-09-03 2:54 ` [PATCH net-next v10 5/5] net: rnpgbe: Add register_netdev Dong Yibo
2025-09-03 22:53 ` Andrew Lunn
2025-09-04 3:06 ` Yibo Dong
2025-09-04 12:35 ` Andrew Lunn
2025-09-05 1:27 ` 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=20250903164431.GD361157@horms.kernel.org \
--to=horms@kernel.org \
--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=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®