From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Dong Yibo <dong100@mucse.com>,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org, corbet@lwn.net,
andrew+netdev@lunn.ch, danishanwar@ti.com,
geert+renesas@glider.be, mpe@ellerman.id.au, lorenzo@kernel.org,
lukas.bulwahn@redhat.com
Cc: netdev@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v15 4/5] net: rnpgbe: Add basic mbx_fw support
Date: Wed, 22 Oct 2025 12:07:59 +0100 [thread overview]
Message-ID: <d46abe01-2f1d-42ec-ab93-a0be3d431c09@linux.dev> (raw)
In-Reply-To: <20251022081351.99446-5-dong100@mucse.com>
On 22/10/2025 09:13, Dong Yibo wrote:
> Add fundamental firmware (FW) communication operations via PF-FW
> mailbox, including:
> - FW sync (via HW info query with retries)
> - HW reset (post FW command to reset hardware)
> - MAC address retrieval (request FW for port-specific MAC)
> - Power management (powerup/powerdown notification to FW)
>
> Signed-off-by: Dong Yibo <dong100@mucse.com>
> ---
> drivers/net/ethernet/mucse/rnpgbe/Makefile | 3 +-
> drivers/net/ethernet/mucse/rnpgbe/rnpgbe.h | 4 +
> .../net/ethernet/mucse/rnpgbe/rnpgbe_mbx.c | 1 +
> .../net/ethernet/mucse/rnpgbe/rnpgbe_mbx_fw.c | 194 ++++++++++++++++++
> .../net/ethernet/mucse/rnpgbe/rnpgbe_mbx_fw.h | 88 ++++++++
> 5 files changed, 289 insertions(+), 1 deletion(-)
> create mode 100644 drivers/net/ethernet/mucse/rnpgbe/rnpgbe_mbx_fw.c
> create mode 100644 drivers/net/ethernet/mucse/rnpgbe/rnpgbe_mbx_fw.h
[...]
> +static int mucse_mbx_get_info(struct mucse_hw *hw)
> +{
> + struct mbx_fw_cmd_req req = {
> + .datalen = cpu_to_le16(MUCSE_MBX_REQ_HDR_LEN),
> + .opcode = cpu_to_le16(GET_HW_INFO),
> + };
> + struct mbx_fw_cmd_reply reply = {};
> + struct mucse_hw_info info = {};
> + int err;
> +
> + err = mucse_fw_send_cmd_wait_resp(hw, &req, &reply);
> + if (!err) {
> + memcpy(&info, &reply.hw_info, sizeof(struct mucse_hw_info));
> + hw->pfvfnum = FIELD_GET(GENMASK_U16(7, 0),
> + le16_to_cpu(info.pfnum));
why do you need local struct mucse_hw_info info? The reply is stack
allocated, nothing else will use it afterwards. You clear out
info on allocation (40 bytes memset), then you copy whole structure from
reply to info (another round of 40 bytes reads/writes) and then use only
2 bytes out of it - it does look like an overkill, you can access
reply.hwinfo.pfnum directly.
next prev parent reply other threads:[~2025-10-22 11:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-22 8:13 [PATCH net-next v15 0/5] Add driver for 1Gbe network chips from MUCSE Dong Yibo
2025-10-22 8:13 ` [PATCH net-next v15 1/5] net: rnpgbe: Add build support for rnpgbe Dong Yibo
2025-10-22 8:13 ` [PATCH net-next v15 2/5] net: rnpgbe: Add n500/n210 chip support with BAR2 mapping Dong Yibo
2025-10-22 8:13 ` [PATCH net-next v15 3/5] net: rnpgbe: Add basic mbx ops support Dong Yibo
2025-10-22 10:54 ` Vadim Fedorenko
2025-10-22 8:13 ` [PATCH net-next v15 4/5] net: rnpgbe: Add basic mbx_fw support Dong Yibo
2025-10-22 11:07 ` Vadim Fedorenko [this message]
2025-10-22 11:21 ` Yibo Dong
2025-10-22 8:13 ` [PATCH net-next v15 5/5] net: rnpgbe: Add register_netdev Dong Yibo
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=d46abe01-2f1d-42ec-ab93-a0be3d431c09@linux.dev \
--to=vadim.fedorenko@linux.dev \
--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=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=lukas.bulwahn@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.