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,
netdev@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 04/15] net: rnpgbe: Add get_capability mbx_fw ops support
Date: Tue, 22 Jul 2025 14:19:11 +0100 [thread overview]
Message-ID: <20250722131911.GH2459@horms.kernel.org> (raw)
In-Reply-To: <20250721113238.18615-5-dong100@mucse.com>
On Mon, Jul 21, 2025 at 07:32:27PM +0800, Dong Yibo wrote:
> Initialize get hw capability from mbx_fw ops.
>
> Signed-off-by: Dong Yibo <dong100@mucse.com>
...
> diff --git a/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_mbx_fw.h b/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_mbx_fw.h
...
> +struct hw_abilities {
> + u8 link_stat;
> + u8 lane_mask;
> + __le32 speed;
> + __le16 phy_type;
> + __le16 nic_mode;
> + __le16 pfnum;
> + __le32 fw_version;
> + __le32 axi_mhz;
> + union {
> + u8 port_id[4];
> + __le32 port_ids;
> + };
> + __le32 bd_uid;
> + __le32 phy_id;
> + __le32 wol_status;
> + union {
> + __le32 ext_ability;
> + struct {
> + __le32 valid : 1; /* 0 */
> + __le32 wol_en : 1; /* 1 */
> + __le32 pci_preset_runtime_en : 1; /* 2 */
> + __le32 smbus_en : 1; /* 3 */
> + __le32 ncsi_en : 1; /* 4 */
> + __le32 rpu_en : 1; /* 5 */
> + __le32 v2 : 1; /* 6 */
> + __le32 pxe_en : 1; /* 7 */
> + __le32 mctp_en : 1; /* 8 */
> + __le32 yt8614 : 1; /* 9 */
> + __le32 pci_ext_reset : 1; /* 10 */
> + __le32 rpu_availble : 1; /* 11 */
> + __le32 fw_lldp_ability : 1; /* 12 */
> + __le32 lldp_enabled : 1; /* 13 */
> + __le32 only_1g : 1; /* 14 */
> + __le32 force_down_en: 1; /* 15 */
> + } e;
I am not sure how __le32 bitfields work on big endian hosts. Do they?
I would suggest using some combination of BIT/GENMASK,
FIELD_PREP/FIELT_GET, and le32_from_cpu/cpu_from_le32 instead.
Flagged by Sparse.
> + struct {
> + u32 valid : 1; /* 0 */
> + u32 wol_en : 1; /* 1 */
> + u32 pci_preset_runtime_en : 1; /* 2 */
> + u32 smbus_en : 1; /* 3 */
> + u32 ncsi_en : 1; /* 4 */
> + u32 rpu_en : 1; /* 5 */
> + u32 v2 : 1; /* 6 */
> + u32 pxe_en : 1; /* 7 */
> + u32 mctp_en : 1; /* 8 */
> + u32 yt8614 : 1; /* 9 */
> + u32 pci_ext_reset : 1; /* 10 */
> + u32 rpu_availble : 1; /* 11 */
> + u32 fw_lldp_ability : 1; /* 12 */
> + u32 lldp_enabled : 1; /* 13 */
> + u32 only_1g : 1; /* 14 */
> + u32 force_down_en: 1; /* 15 */
> + } e_host;
> + };
> +} __packed;
...
> +/* req is little endian. bigendian should be conserened */
> +struct mbx_fw_cmd_req {
...
> + struct {
> + __le32 lane;
> + __le32 op;
> + __le32 enable;
> + __le32 inteval;
interval
Flagged by checkpatch.pl --codespell
...
> +/* firmware -> driver */
> +struct mbx_fw_cmd_reply {
> + /* fw must set: DD, CMP, Error(if error), copy value */
> + __le16 flags;
> + /* from command: LB,RD,VFC,BUF,SI,EI,FE */
> + __le16 opcode; /* 2-3: copy from req */
> + __le16 error_code; /* 4-5: 0 if no error */
> + __le16 datalen; /* 6-7: */
> + union {
> + struct {
> + __le32 cookie_lo; /* 8-11: */
> + __le32 cookie_hi; /* 12-15: */
> + };
> + void *cookie;
> + };
> + /* ===== data ==== [16-64] */
> + union {
> + u8 data[40];
> +
> + struct version {
> + __le32 major;
> + __le32 sub;
> + __le32 modify;
> + } version;
> +
> + struct {
> + __le32 value[4];
> + } r_reg;
> +
> + struct {
> + __le32 new_value;
> + } modify_reg;
> +
> + struct get_temp {
> + __le32 temp;
> + __le32 volatage;
voltage
> + } get_temp;
> +
> + struct {
> +#define MBX_SFP_READ_MAX_CNT 32
> + u8 value[MBX_SFP_READ_MAX_CNT];
> + } sfp_read;
> +
> + struct mac_addr {
> + __le32 lanes;
> + struct _addr {
> + /*
> + * for macaddr:01:02:03:04:05:06
> + * mac-hi=0x01020304 mac-lo=0x05060000
> + */
> + u8 mac[8];
> + } addrs[4];
> + } mac_addr;
> +
> + struct get_dump_reply {
> + __le32 flags;
> + __le32 version;
> + __le32 bytes;
> + __le32 data[4];
> + } get_dump;
> +
> + struct get_lldp_reply {
> + __le32 value;
> + __le32 inteval;
interval
> + } get_lldp;
> +
> + struct rnpgbe_eee_cap phy_eee_abilities;
> + struct lane_stat_data lanestat;
> + struct hw_abilities hw_abilities;
> + struct phy_statistics phy_statistics;
> + };
> +} __packed;
...
next prev parent reply other threads:[~2025-07-22 13:19 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-21 11:32 [PATCH v2 00/15] Add driver for 1Gbe network chips from MUCSE Dong Yibo
2025-07-21 11:32 ` [PATCH v2 01/15] net: rnpgbe: Add build support for rnpgbe Dong Yibo
2025-07-21 13:30 ` Vadim Fedorenko
2025-07-21 14:57 ` Andrew Lunn
2025-07-22 3:02 ` Yibo Dong
2025-07-22 10:17 ` Vadim Fedorenko
2025-07-22 11:05 ` Yibo Dong
2025-07-21 14:55 ` Andrew Lunn
2025-07-22 3:38 ` Yibo Dong
2025-07-22 14:58 ` Andrew Lunn
2025-07-21 21:23 ` Brett Creeley
2025-07-22 4:59 ` Yibo Dong
2025-07-22 11:29 ` Simon Horman
2025-07-23 3:01 ` Yibo Dong
2025-07-23 20:09 ` Simon Horman
2025-07-24 6:10 ` Yibo Dong
2025-07-25 9:51 ` Simon Horman
2025-07-21 11:32 ` [PATCH v2 02/15] net: rnpgbe: Add n500/n210 chip support Dong Yibo
2025-07-21 14:21 ` Vadim Fedorenko
2025-07-22 9:51 ` Yibo Dong
2025-07-22 10:26 ` Vadim Fedorenko
2025-07-22 11:09 ` Yibo Dong
2025-07-21 15:25 ` Andrew Lunn
2025-07-22 6:21 ` Yibo Dong
2025-07-22 13:56 ` Andrew Lunn
2025-07-21 11:32 ` [PATCH v2 03/15] net: rnpgbe: Add basic mbx ops support Dong Yibo
2025-07-21 14:40 ` Vadim Fedorenko
2025-07-21 15:43 ` Andrew Lunn
2025-07-22 6:45 ` Yibo Dong
2025-07-22 13:50 ` Andrew Lunn
2025-07-23 10:27 ` Yibo Dong
2025-07-21 21:54 ` Brett Creeley
2025-07-22 7:39 ` Yibo Dong
2025-07-22 11:35 ` Simon Horman
2025-07-23 3:07 ` Yibo Dong
2025-07-23 14:38 ` Andrew Lunn
2025-07-25 10:11 ` Yibo Dong
2025-07-21 11:32 ` [PATCH v2 04/15] net: rnpgbe: Add get_capability mbx_fw " Dong Yibo
2025-07-21 22:08 ` Brett Creeley
2025-07-22 8:04 ` Yibo Dong
2025-07-22 13:19 ` Simon Horman [this message]
2025-07-23 3:15 ` Yibo Dong
2025-07-21 11:32 ` [PATCH v2 05/15] net: rnpgbe: Add download firmware for n210 chip Dong Yibo
2025-07-21 11:32 ` [PATCH v2 06/15] net: rnpgbe: Add some functions for hw->ops Dong Yibo
2025-07-21 11:32 ` [PATCH v2 07/15] net: rnpgbe: Add get mac from hw Dong Yibo
2025-07-21 11:32 ` [PATCH v2 08/15] net: rnpgbe: Add irq support Dong Yibo
2025-07-22 13:25 ` Simon Horman
2025-07-23 3:21 ` Yibo Dong
2025-07-21 11:32 ` [PATCH v2 09/15] net: rnpgbe: Add netdev register and init tx/rx memory Dong Yibo
2025-07-21 11:32 ` [PATCH v2 10/15] net: rnpgbe: Add netdev irq in open Dong Yibo
2025-07-22 14:03 ` Simon Horman
2025-07-23 6:13 ` Yibo Dong
2025-07-21 11:32 ` [PATCH v2 11/15] net: rnpgbe: Add setup hw ring-vector, true up/down hw Dong Yibo
2025-07-21 11:32 ` [PATCH v2 12/15] net: rnpgbe: Add link up handler Dong Yibo
2025-07-21 15:47 ` Andrew Lunn
2025-07-22 6:48 ` Yibo Dong
2025-07-21 11:32 ` [PATCH v2 13/15] net: rnpgbe: Add base tx functions Dong Yibo
2025-07-21 11:32 ` [PATCH v2 14/15] net: rnpgbe: Add base rx function Dong Yibo
2025-07-22 14:14 ` Simon Horman
2025-07-23 6:49 ` Yibo Dong
2025-07-21 11:32 ` [PATCH v2 15/15] net: rnpgbe: Add ITR for rx Dong Yibo
2025-07-22 11:20 ` [PATCH v2 00/15] Add driver for 1Gbe network chips from MUCSE MD Danish Anwar
2025-07-22 11:35 ` Yibo Dong
2025-07-22 15:07 ` Andrew Lunn
2025-07-23 10:42 ` 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=20250722131911.GH2459@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=kuba@kernel.org \
--cc=lee@trager.us \
--cc=linux-doc@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=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).