public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Vlad Zolotarov <vladz@cloudius-systems•com>
To: Alexander Duyck <alexander.duyck@gmail•com>, netdev@vger•kernel.org
Cc: jeffrey.t.kirsher@intel•com, avi@cloudius-systems•com,
	gleb@cloudius-systems•com
Subject: Re: [PATCH net-next v9 7/7] ixgbevf: Add the appropriate ethtool ops to query RSS indirection table and key
Date: Mon, 30 Mar 2015 17:00:04 +0300	[thread overview]
Message-ID: <551956E4.6070005@cloudius-systems.com> (raw)
In-Reply-To: <55187A8C.5060607@gmail.com>



On 03/30/15 01:19, Alexander Duyck wrote:
> On 03/29/2015 09:11 AM, Vlad Zolotarov wrote:
>> Added get_rxfh_indir_size, get_rxfh_key_size and get_rxfh ethtool_ops callbacks
>> implementations.
>>
>> This enables the ethtool's "-x" and "--show-rxfh[-indir]" options for VF devices.
>>
>> This patch adds the support for 82599 and x540 devices only. Support for other
>> devices will be added later.
>>
>> Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems•com>
>> ---
>> New in v9:
>>     - Use IXGBEVF_RSS_HASH_KEY_SIZE macro.
>>
>> New in v6:
>>     - Added a required get_rxnfc callback to ixgbevf_ethtool_ops.
>>
>> New in v4:
>>     - Removed not needed braces in if-statement in ixgbevf_get_rxfh_indir_size().
>>
>> New in v3:
>>     - Added a proper support for x550 devices: return the correct redirection table size.
>>
>> New in v2:
>>     - Added a detailed description to the patch.
>> ---
>>   drivers/net/ethernet/intel/ixgbevf/ethtool.c | 58 ++++++++++++++++++++++++++++
>>   1 file changed, 58 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/intel/ixgbevf/ethtool.c b/drivers/net/ethernet/intel/ixgbevf/ethtool.c
>> index e83c85b..4d2f59f 100644
>> --- a/drivers/net/ethernet/intel/ixgbevf/ethtool.c
>> +++ b/drivers/net/ethernet/intel/ixgbevf/ethtool.c
>> @@ -794,6 +794,60 @@ static int ixgbevf_set_coalesce(struct net_device *netdev,
>>   	return 0;
>>   }
>>   
>> +static int ixgbevf_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
>> +			     u32 *rules __always_unused)
>> +{
>> +	struct ixgbevf_adapter *adapter = netdev_priv(dev);
>> +
>> +	switch (info->cmd) {
>> +	case ETHTOOL_GRXRINGS:
>> +		info->data = adapter->num_rx_queues;
>> +		return 0;
>> +	default:
>> +		hw_dbg(&adapter->hw, "Command parameters not supported\n");
>> +		return -EOPNOTSUPP;
>> +	}
>> +}
>> +
>> +static u32 ixgbevf_get_rxfh_indir_size(struct net_device *netdev)
>> +{
>> +	struct ixgbevf_adapter *adapter = netdev_priv(netdev);
>> +
>> +	if (adapter->hw.mac.type >= ixgbe_mac_X550_vf)
>> +		return 64;
>> +	else
>> +		return 128;
>> +}
>> +
> You should return 0 for x550, not 64 since it isn't supported.
>
> My suggestion would be to alter the code so that you return 128 for
> everything <= x540_vf, and place a return 0 as the default return
> without a need for the if statement.
ok
>
>> +static u32 ixgbevf_get_rxfh_key_size(struct net_device *netdev)
>> +{
>> +	return IXGBEVF_RSS_HASH_KEY_SIZE;
>> +}
>> +
> Same thing here.  If you don't support this on x550 you should probably
> return 0 instead of returning a value.
ok
>
>> +static int ixgbevf_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
>> +			    u8 *hfunc)
>> +{
>> +	struct ixgbevf_adapter *adapter = netdev_priv(netdev);
>> +	int err;
>> +
>> +	if (hfunc)
>> +		*hfunc = ETH_RSS_HASH_TOP;
>> +
>> +	if (indir) {
>> +		err = ixgbevf_get_reta(adapter, indir);
>> +		if (err)
>> +			return err;
>> +	}
>> +
>> +	if (key) {
>> +		err = ixgbevf_get_rss_key(adapter, key);
>> +		if (err)
>> +			return err;
>> +	}
>> +
>> +	return 0;
>> +}
>> +
> My advice here would be to just wrap these two functions in one mailbox
> lock and update the second check so that it is if (!err && key) so that
> you can simplify the path and just return err at the end.

Yeah, something like that. U see - no need to unite them... ;)

>
>>   static const struct ethtool_ops ixgbevf_ethtool_ops = {
>>   	.get_settings		= ixgbevf_get_settings,
>>   	.get_drvinfo		= ixgbevf_get_drvinfo,
>> @@ -811,6 +865,10 @@ static const struct ethtool_ops ixgbevf_ethtool_ops = {
>>   	.get_ethtool_stats	= ixgbevf_get_ethtool_stats,
>>   	.get_coalesce		= ixgbevf_get_coalesce,
>>   	.set_coalesce		= ixgbevf_set_coalesce,
>> +	.get_rxnfc		= ixgbevf_get_rxnfc,
>> +	.get_rxfh_indir_size	= ixgbevf_get_rxfh_indir_size,
>> +	.get_rxfh_key_size	= ixgbevf_get_rxfh_key_size,
>> +	.get_rxfh		= ixgbevf_get_rxfh,
>>   };
>>   
>>   void ixgbevf_set_ethtool_ops(struct net_device *netdev)
>>

      reply	other threads:[~2015-03-30 14:00 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-29 16:11 [PATCH net-next v9 0/7]: ixgbevf: Allow querying VFs RSS indirection table and key Vlad Zolotarov
2015-03-29 16:11 ` [PATCH net-next v9 1/7] if_link: Add an additional parameter to ifla_vf_info for RSS querying Vlad Zolotarov
2015-03-29 16:11 ` [PATCH net-next v9 2/7] ixgbe: Add a new netdev op to allow/prevent a VF from querying an RSS info Vlad Zolotarov
2015-03-29 22:32   ` Alexander Duyck
2015-03-30  8:10     ` Vlad Zolotarov
2015-03-29 16:11 ` [PATCH net-next v9 3/7] ixgbe: Add a RETA query command to VF-PF channel API Vlad Zolotarov
2015-03-29 22:45   ` Alexander Duyck
2015-03-30  8:24     ` Vlad Zolotarov
2015-03-29 16:11 ` [PATCH net-next v9 4/7] ixgbevf: Add a RETA query code Vlad Zolotarov
2015-03-29 22:51   ` Alexander Duyck
2015-03-30  8:43     ` Vlad Zolotarov
2015-03-30  9:12     ` Vlad Zolotarov
2015-03-30 14:58       ` Alexander Duyck
2015-03-30 15:13         ` Vlad Zolotarov
2015-03-29 16:11 ` [PATCH net-next v9 5/7] ixgbe: Add GET_RSS_KEY command to VF-PF channel commands set Vlad Zolotarov
2015-03-29 22:04   ` Alexander Duyck
2015-03-30  9:57     ` Vlad Zolotarov
2015-03-30 10:08     ` Vlad Zolotarov
2015-03-30 10:41     ` Vlad Zolotarov
2015-03-30 15:04       ` Alexander Duyck
2015-03-29 16:11 ` [PATCH net-next v9 6/7] ixgbevf: Add RSS Key query code Vlad Zolotarov
2015-03-29 22:04   ` Alexander Duyck
2015-03-30 12:38     ` Vlad Zolotarov
2015-03-30 15:07       ` Alexander Duyck
2015-03-30 15:25         ` Vlad Zolotarov
2015-03-30 15:31         ` Vlad Zolotarov
2015-03-30 13:53     ` Vlad Zolotarov
2015-03-30 15:10       ` Alexander Duyck
2015-03-30 15:17         ` Vlad Zolotarov
2015-03-30 16:54           ` Alexander Duyck
2015-03-30 17:18             ` Vlad Zolotarov
2015-03-29 16:11 ` [PATCH net-next v9 7/7] ixgbevf: Add the appropriate ethtool ops to query RSS indirection table and key Vlad Zolotarov
2015-03-29 22:19   ` Alexander Duyck
2015-03-30 14:00     ` Vlad Zolotarov [this message]

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=551956E4.6070005@cloudius-systems.com \
    --to=vladz@cloudius-systems$(echo .)com \
    --cc=alexander.duyck@gmail$(echo .)com \
    --cc=avi@cloudius-systems$(echo .)com \
    --cc=gleb@cloudius-systems$(echo .)com \
    --cc=jeffrey.t.kirsher@intel$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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