[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191220102330.GG24174@lunn.ch>
Date: Fri, 20 Dec 2019 11:23:30 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Cris Forno <cforno12@...ux.vnet.ibm.com>
Cc: netdev@...r.kernel.org, mst@...hat.com, jasowang@...hat.com,
haiyangz@...rosoft.com, sthemmin@...rosoft.com, sashal@...nel.org,
tlfalcon@...ux.ibm.com
Subject: Re: [PATCH, net-next, v3, 1/2] ethtool: Factored out similar ethtool
link settings for virtual devices to core
On Fri, Dec 20, 2019 at 11:18:31AM +0100, Andrew Lunn wrote:
> On Thu, Dec 19, 2019 at 02:54:09PM -0600, Cris Forno wrote:
> > @@ -579,6 +579,32 @@ static int load_link_ksettings_from_user(struct ethtool_link_ksettings *to,
> > return 0;
> > }
> >
> > +/* Check if the user is trying to change anything besides speed/duplex */
> > +static bool
> > +ethtool_virtdev_validate_cmd(const struct ethtool_link_ksettings *cmd)
> > +{
> > + struct ethtool_link_ksettings diff1 = *cmd;
> > + struct ethtool_link_ksettings diff2 = {};
>
> Hi Cris
>
> These are not the best of names. How about request and valid?
>
> > +
> > + /* cmd is always set so we need to clear it, validate the port type
> > + * and also without autonegotiation we can ignore advertising
> > + */
> > + diff1.base.speed = 0;
> > + diff2.base.port = PORT_OTHER;
> > + ethtool_link_ksettings_zero_link_mode(&diff1, advertising);
> > + diff1.base.duplex = 0;
> > + diff1.base.cmd = 0;
> > + diff1.base.link_mode_masks_nwords = 0;
> > +
> > + return !memcmp(&diff1.base, &diff2.base, sizeof(diff1.base)) &&
>
> linkmode_equal()
Opps. That is wrong. base is not a link mode! Sorry for the noise.
Andrew
Powered by blists - more mailing lists