From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
To: "Michael S. Tsirkin" <mst@redhat.com>,
Nikolay Aleksandrov <razor@blackwall.org>
Cc: netdev@vger.kernel.org, roopa@cumulusnetworks.com, davem@davemloft.net
Subject: Re: [PATCH net-next v5 2/2] virtio_net: add ethtool support for set and get of settings
Date: Thu, 4 Feb 2016 13:26:28 +0100 [thread overview]
Message-ID: <56B34374.90709@cumulusnetworks.com> (raw)
In-Reply-To: <20160204141947-mutt-send-email-mst@redhat.com>
On 02/04/2016 01:21 PM, Michael S. Tsirkin wrote:
> On Wed, Feb 03, 2016 at 04:04:37AM +0100, Nikolay Aleksandrov wrote:
>> From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
[snip]
>> struct padded_vnet_hdr {
>> @@ -1376,6 +1380,58 @@ static void virtnet_get_channels(struct net_device *dev,
>> channels->other_count = 0;
>> }
>>
>> +/* Check if the user is trying to change anything besides speed/duplex */
>> +static bool virtnet_validate_ethtool_cmd(const struct ethtool_cmd *cmd)
>> +{
>> + struct ethtool_cmd diff1 = *cmd;
>> + struct ethtool_cmd diff2 = {};
>> +
>> + /* advertising and cmd are usually set, ignore port because we set it */
>
> We set it where?
If you're asking about advertising - ethtool sets it automatically when the
user tries to set both speed and duplex together.
> Instead of this, should not we set diff2.port to PORT_OTHER?
>
Yes, that will validate it too.
>> + ethtool_cmd_speed_set(&diff1, 0);
>> + diff1.advertising = 0;
>> + diff1.duplex = 0;
>> + diff1.port = 0;
>> + diff1.cmd = 0;
>> +
>> + return !memcmp(&diff1, &diff2, sizeof(diff1));
>> +}
>> +
[snip]
next prev parent reply other threads:[~2016-02-04 12:26 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-03 3:04 [PATCH net-next v5 0/2] virtio_net: add ethtool get/set settings support Nikolay Aleksandrov
2016-02-03 3:04 ` [PATCH net-next v5 1/2] ethtool: add speed/duplex validation functions Nikolay Aleksandrov
2016-02-03 23:32 ` Stephen Hemminger
2016-02-03 23:49 ` Rick Jones
2016-02-04 12:47 ` Michael S. Tsirkin
2016-02-04 17:30 ` Rick Jones
2016-02-04 11:02 ` Nikolay Aleksandrov
2016-02-04 12:18 ` Michael S. Tsirkin
2016-02-03 3:04 ` [PATCH net-next v5 2/2] virtio_net: add ethtool support for set and get of settings Nikolay Aleksandrov
2016-02-03 9:19 ` Nikolay Aleksandrov
2016-02-04 12:23 ` Michael S. Tsirkin
2016-02-04 12:21 ` Michael S. Tsirkin
2016-02-04 12:26 ` Nikolay Aleksandrov [this message]
2016-02-07 19:31 ` [PATCH net-next v5 0/2] virtio_net: add ethtool get/set settings support David Miller
2016-02-07 19:35 ` Nikolay Aleksandrov
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=56B34374.90709@cumulusnetworks.com \
--to=nikolay@cumulusnetworks.com \
--cc=davem@davemloft.net \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=razor@blackwall.org \
--cc=roopa@cumulusnetworks.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).