netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Cris Forno <cforno12@linux.vnet.ibm.com>
Cc: netdev@vger.kernel.org, mst@redhat.com, jasowang@redhat.com,
	haiyangz@microsoft.com, sthemmin@microsoft.com,
	sashal@kernel.org, tlfalcon@linux.ibm.com
Subject: Re: [PATCH, net-next, v3, 1/2] ethtool: Factored out similar ethtool link settings for virtual devices to core
Date: Fri, 20 Dec 2019 11:18:31 +0100	[thread overview]
Message-ID: <20191220101831.GF24174@lunn.ch> (raw)
In-Reply-To: <20191219205410.5961-2-cforno12@linux.vnet.ibm.com>

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()

> +		bitmap_empty(diff1.link_modes.supported,
> +			     __ETHTOOL_LINK_MODE_MASK_NBITS) &&

linkmode_empty()

	Andrew

  reply	other threads:[~2019-12-20 10:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-19 20:54 [PATCH, net-next, v3, 0/2] net/ethtool: Introduce link_ksettings API for virtual network devices Cris Forno
2019-12-19 20:54 ` [PATCH, net-next, v3, 1/2] ethtool: Factored out similar ethtool link settings for virtual devices to core Cris Forno
2019-12-20 10:18   ` Andrew Lunn [this message]
2019-12-20 10:23     ` Andrew Lunn
2019-12-20 10:38     ` Michal Kubecek
2019-12-22 21:19   ` Willem de Bruijn
2020-01-07 17:45     ` Cristobal Forno
2020-01-07 19:09       ` Willem de Bruijn
2020-01-07 17:55     ` Cristobal Forno
2019-12-19 20:54 ` [PATCH, net-next, v3, 2/2] net: Enable virtual network devices to use ethtool's set/get link settings functions Cris Forno
2019-12-22 21:26   ` Willem de Bruijn

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=20191220101831.GF24174@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=cforno12@linux.vnet.ibm.com \
    --cc=haiyangz@microsoft.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=sashal@kernel.org \
    --cc=sthemmin@microsoft.com \
    --cc=tlfalcon@linux.ibm.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).