From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Yibo Dong <dong100@mucse.com>
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
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, joerg@jo-so.de,
netdev@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH net-next v12 4/5] net: rnpgbe: Add basic mbx_fw support
Date: Wed, 17 Sep 2025 15:02:13 +0100 [thread overview]
Message-ID: <fb8f876a-c2e5-49b0-bc64-bdf18ecd1ce4@linux.dev> (raw)
In-Reply-To: <D7EC5E8B6F6E685E+20250917110540.GA91482@nic-Precision-5820-Tower>
On 17/09/2025 12:05, Yibo Dong wrote:
> On Wed, Sep 17, 2025 at 11:45:31AM +0100, Vadim Fedorenko wrote:
>> On 16/09/2025 12:29, 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>
>>
>> Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
>>
>> small nits below
>>
>>
>>> +static void build_get_hw_info_req(struct mbx_fw_cmd_req *req)
>>> +{
>>> + req->flags = 0;
>>> + req->opcode = cpu_to_le16(GET_HW_INFO);
>>> + req->datalen = cpu_to_le16(MUCSE_MBX_REQ_HDR_LEN);
>>> + req->reply_lo = 0;
>>> + req->reply_hi = 0;
>>> +}
>>
>> All these build*() functions re-init flags and reply to 0, but all
>> mbx_fw_cmd_req are zero-inited on the stack. Might be better clean
>> things assignments, but no strong opinion because the code is explicit
>>
>> If you will think of refactoring this part, it might be a good idea to
>> avoid build*() functions at all and do proper initialization of
>> mbx_fw_cmd_req in callers?
>>
>>> +
>>> +/**
>>> + * mucse_mbx_get_info - Get hw info from fw
>>> + * @hw: pointer to the HW structure
>>> + *
>>> + * mucse_mbx_get_info tries to get hw info from hw.
>>> + *
>>> + * Return: 0 on success, negative errno on failure
>>> + **/
>>> +static int mucse_mbx_get_info(struct mucse_hw *hw)
>>> +{
>>> + struct mbx_fw_cmd_reply reply = {};
>>> + struct mbx_fw_cmd_req req = {};
>>
>> something like:
>>
>> struct mbx_fw_cmd_req req =
>> {
>> .opcode = cpu_to_le16(GET_HW_INFO),
>> .datalen = cpu_to_le16(MUCSE_MBX_REQ_HDR_LEN),
>> }
>>
>>
>>
>
> That's a good idea! That makes the code more compact.
> I think I should update this as your suggestion.
>
> Regarding adding your "Reviewed-by" tag in the next version:
> Would it be acceptable to include it when I submit the updated patch (with
> the initialization logic adjusted), or should I wait for your further
> review of the modified code first?
If you will submit another version with this refactoring, I'll better do
another review.
next prev parent reply other threads:[~2025-09-17 14:02 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-16 11:29 [PATCH net-next v12 0/5] Add driver for 1Gbe network chips from MUCSE Dong Yibo
2025-09-16 11:29 ` [PATCH net-next v12 1/5] net: rnpgbe: Add build support for rnpgbe Dong Yibo
2025-09-16 19:00 ` Jörg Sommer
2025-09-17 1:37 ` Yibo Dong
2025-09-17 7:01 ` MD Danish Anwar
2025-09-16 11:29 ` [PATCH net-next v12 2/5] net: rnpgbe: Add n500/n210 chip support with BAR2 mapping Dong Yibo
2025-09-16 19:20 ` Jörg Sommer
2025-09-17 7:02 ` MD Danish Anwar
2025-09-16 11:29 ` [PATCH net-next v12 3/5] net: rnpgbe: Add basic mbx ops support Dong Yibo
2025-09-16 18:42 ` Jörg Sommer
2025-09-16 19:33 ` Andrew Lunn
2025-09-17 2:55 ` Yibo Dong
2025-09-16 11:29 ` [PATCH net-next v12 4/5] net: rnpgbe: Add basic mbx_fw support Dong Yibo
2025-09-17 10:45 ` Vadim Fedorenko
2025-09-17 11:05 ` Yibo Dong
2025-09-17 14:02 ` Vadim Fedorenko [this message]
2025-09-19 1:17 ` Yibo Dong
2025-09-16 11:29 ` [PATCH net-next v12 5/5] net: rnpgbe: Add register_netdev Dong Yibo
2025-09-16 15:19 ` Vadim Fedorenko
2025-09-17 7:09 ` MD Danish Anwar
2025-09-17 8:33 ` 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=fb8f876a-c2e5-49b0-bc64-bdf18ecd1ce4@linux.dev \
--to=vadim.fedorenko@linux.dev \
--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=horms@kernel.org \
--cc=joerg@jo-so.de \
--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 \
/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;
as well as URLs for NNTP newsgroup(s).