On Mon, 11 Jan 2021 14:00:20 +0000 Danielle Ratson wrote:
> > > @@ -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?
>
> Not sure what did you mean, can you please explain?
- u32 capabilities;
+ u32 cap_link_lanes_supported:1;
or
- u32 capabilities;
+ u8 max_link_lanes;
if (!lsettings->autoneg &&
- !(dev->ethtool_ops->capabilities &
ETHTOOL_CAP_LINK_LANES_SUPPORTED)) {
+ dev->ethtool_ops->max_link_lanes < req_lanes) {
NL_SET_ERR_MSG_ATTR(info->extack,
tb[ETHTOOL_A_LINKMODES_LANES],
+ dev->ethtool_ops->max_link_lanes ?
+ "device does not support this many
lanes" :
"lanes configuration not supported
by device");
return -EOPNOTSUPP;