netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Volodymyr Mytnyk <volodymyr.mytnyk@plvision.eu>
Cc: kuba@kernel.org, mickeyr@marvell.com, serhiy.pshyk@plvision.eu,
	taras.chornyi@plvision.eu, Volodymyr Mytnyk <vmytnyk@marvell.com>,
	Vadym Kochan <vkochan@marvell.com>,
	Yevhen Orlov <yevhen.orlov@plvision.eu>,
	Taras Chornyi <tchornyi@marvell.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v3] net: marvell: prestera: add firmware v4.0 support
Date: Fri, 22 Oct 2021 14:27:37 +0200	[thread overview]
Message-ID: <YXKuOSDraUsaN75U@lunn.ch> (raw)
In-Reply-To: <1634722349-23693-1-git-send-email-volodymyr.mytnyk@plvision.eu>

On Wed, Oct 20, 2021 at 12:32:28PM +0300, Volodymyr Mytnyk wrote:
> From: Volodymyr Mytnyk <vmytnyk@marvell.com>
> 
> Add firmware (FW) version 4.0 support for Marvell Prestera
> driver.
> 
> Major changes have been made to new v4.0 FW ABI to add support
> of new features, introduce the stability of the FW ABI and ensure
> better forward compatibility for the future driver vesrions.
> 
> Current v4.0 FW feature set support does not expect any changes
> to ABI, as it was defined and tested through long period of time.
> The ABI may be extended in case of new features, but it will not
> break the backward compatibility.
> 
> ABI major changes done in v4.0:
> - L1 ABI, where MAC and PHY API configuration are split.
> - ACL has been split to low-level TCAM and Counters ABI
>   to provide more HW ACL capabilities for future driver
>   versions.
> 
> To support backward support, the addition compatibility layer is
> required in the driver which will have two different codebase under
> "if FW-VER elif FW-VER else" conditions that will be removed
> in the future anyway, So, the idea was to break backward support
> and focus on more stable FW instead of supporting old version
> with very minimal and limited set of features/capabilities.
 
> +/* TODO: add another parameters here: modes, etc... */
> +struct prestera_port_phy_config {
> +	bool admin;
> +	u32 mode;
> +	u8 mdix;
> +};

> @@ -242,10 +246,44 @@ union prestera_msg_port_param {
>  	u8  duplex;
>  	u8  fec;
>  	u8  fc;
> -	struct prestera_msg_port_mdix_param mdix;
> -	struct prestera_msg_port_autoneg_param autoneg;
> +
> +	union {
> +		struct {
> +			/* TODO: merge it with "mode" */

> +		struct {
> +			/* TODO: merge it with "mode" */
> +			u8 admin:1;
> +			u8 adv_enable;
> +			u64 modes;
> +			/* TODO: merge it with modes */
> +			u32 mode;
> +			u8 mdix;
> +		} phy;

You claim this is stable, yet there are four TODOs. Please could you
convince us you can actually do these TODO without breaking the
ABI. Can you add more members to the end of these structures, and the
firmware/driver can know they are there? Since these are often unions,
you might not be able to tell from the length of the message
exchanged.

As Jakub pointed out, your structures have horrible alignment. Have
you run this on both 32 and 64 bit systems? It would be good to add

BUILD_BUG_ON(sizeof(*foo) != 42)

for all the structures that get passed to/from the firmware.

    Andrew

  parent reply	other threads:[~2021-10-22 12:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-20  9:32 [PATCH net-next v3] net: marvell: prestera: add firmware v4.0 support Volodymyr Mytnyk
2021-10-20 12:47 ` Andrew Lunn
2021-10-21  7:40   ` Volodymyr Mytnyk [C]
2021-10-21 23:13 ` Jakub Kicinski
2021-10-22 22:07   ` Volodymyr Mytnyk [C]
2021-10-22 12:27 ` Andrew Lunn [this message]
2021-10-22 12:51   ` Andrew Lunn
2021-10-22 22:10     ` Volodymyr Mytnyk [C]
2021-10-22 22:27   ` Volodymyr Mytnyk [C]

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=YXKuOSDraUsaN75U@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mickeyr@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=serhiy.pshyk@plvision.eu \
    --cc=taras.chornyi@plvision.eu \
    --cc=tchornyi@marvell.com \
    --cc=vkochan@marvell.com \
    --cc=vmytnyk@marvell.com \
    --cc=volodymyr.mytnyk@plvision.eu \
    --cc=yevhen.orlov@plvision.eu \
    /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).