[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56B34374.90709@cumulusnetworks.com>
Date: Thu, 4 Feb 2016 13:26:28 +0100
From: Nikolay Aleksandrov <nikolay@...ulusnetworks.com>
To: "Michael S. Tsirkin" <mst@...hat.com>,
Nikolay Aleksandrov <razor@...ckwall.org>
Cc: netdev@...r.kernel.org, roopa@...ulusnetworks.com,
davem@...emloft.net
Subject: Re: [PATCH net-next v5 2/2] virtio_net: add ethtool support for set
and get of settings
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@...ulusnetworks.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]
Powered by blists - more mailing lists