From: Jakub Kicinski <kuba@kernel.org>
To: Danielle Ratson <danieller@mellanox.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, jiri@nvidia.com,
andrew@lunn.ch, f.fainelli@gmail.com, mkubecek@suse.cz,
mlxsw@nvidia.com, idosch@nvidia.com,
Danielle Ratson <danieller@nvidia.com>
Subject: Re: [PATCH net-next repost v2 1/7] ethtool: Extend link modes settings uAPI with lanes
Date: Thu, 7 Jan 2021 16:35:04 -0800 [thread overview]
Message-ID: <20210107163504.55018c73@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <20210106130622.2110387-2-danieller@mellanox.com>
On Wed, 6 Jan 2021 15:06:16 +0200 Danielle Ratson wrote:
> From: Danielle Ratson <danieller@nvidia.com>
>
> Currently, when auto negotiation is on, the user can advertise all the
> linkmodes which correspond to a specific speed, but does not have a
> similar selector for the number of lanes. This is significant when a
> specific speed can be achieved using different number of lanes. For
> example, 2x50 or 4x25.
>
> Add 'ETHTOOL_A_LINKMODES_LANES' attribute and expand 'struct
> ethtool_link_settings' with lanes field in order to implement a new
> lanes-selector that will enable the user to advertise a specific number
> of lanes as well.
>
> When auto negotiation is off, lanes parameter can be forced only if the
> driver supports it. Add a capability bit in 'struct ethtool_ops' that
> allows ethtool know if the driver can handle the lanes parameter when
> auto negotiation is off, so if it does not, an error message will be
> returned when trying to set lanes.
> @@ -420,6 +423,7 @@ struct ethtool_pause_stats {
> * of the generic netdev features interface.
> */
> struct ethtool_ops {
> + u32 capabilities;
An appropriately named bitfield seems better. Alternatively maybe let
the driver specify which lane counts it can accept?
And please remember to add the kdoc.
> u32 supported_coalesce_params;
> void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);
> int (*get_regs_len)(struct net_device *);
> @@ -274,16 +277,17 @@ const struct nla_policy ethnl_linkmodes_set_policy[] = {
> [ETHTOOL_A_LINKMODES_SPEED] = { .type = NLA_U32 },
> [ETHTOOL_A_LINKMODES_DUPLEX] = { .type = NLA_U8 },
> [ETHTOOL_A_LINKMODES_MASTER_SLAVE_CFG] = { .type = NLA_U8 },
> + [ETHTOOL_A_LINKMODES_LANES] = { .type = NLA_U32 },
Please set the min and max for the policy, so userspace can at least
see that part.
> +static bool ethnl_validate_lanes_cfg(u32 cfg)
> +{
> + switch (cfg) {
> + case 1:
> + case 2:
> + case 4:
> + case 8:
> + return true;
And with the policy checking min and max this can be turned into
a simple is_power_of_2() call.
> + }
> +
> + return false;
> +}
next prev parent reply other threads:[~2021-01-08 0:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-06 13:06 [PATCH net-next repost v2 0/7] Support setting lanes via ethtool Danielle Ratson
2021-01-06 13:06 ` [PATCH net-next repost v2 1/7] ethtool: Extend link modes settings uAPI with lanes Danielle Ratson
2021-01-08 0:35 ` Jakub Kicinski [this message]
2021-01-11 14:00 ` Danielle Ratson
2021-01-11 17:57 ` Jakub Kicinski
2021-01-06 13:06 ` [PATCH net-next repost v2 2/7] ethtool: Get link mode in use instead of speed and duplex parameters Danielle Ratson
2021-01-08 0:42 ` Jakub Kicinski
2021-01-08 1:11 ` Andrew Lunn
2021-01-06 13:06 ` [PATCH net-next repost v2 3/7] ethtool: Expose the number of lanes in use Danielle Ratson
2021-01-06 13:06 ` [PATCH net-next repost v2 4/7] mlxsw: ethtool: Remove max lanes filtering Danielle Ratson
2021-01-06 13:06 ` [PATCH net-next repost v2 5/7] mlxsw: ethtool: Add support for setting lanes when autoneg is off Danielle Ratson
2021-01-06 13:06 ` [PATCH net-next repost v2 6/7] mlxsw: ethtool: Pass link mode in use to ethtool Danielle Ratson
2021-01-06 13:06 ` [PATCH net-next repost v2 7/7] net: selftests: Add lanes setting test Danielle Ratson
2021-01-08 0:45 ` Jakub Kicinski
2021-01-10 12:35 ` Danielle Ratson
2021-01-07 17:36 ` [PATCH net-next repost v2 0/7] Support setting lanes via ethtool Edwin Peer
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=20210107163504.55018c73@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
--to=kuba@kernel.org \
--cc=andrew@lunn.ch \
--cc=danieller@mellanox.com \
--cc=danieller@nvidia.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=idosch@nvidia.com \
--cc=jiri@nvidia.com \
--cc=mkubecek@suse.cz \
--cc=mlxsw@nvidia.com \
--cc=netdev@vger.kernel.org \
/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).