netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Duyck <alexander.duyck@gmail.com>
To: Vlad Zolotarov <vladz@cloudius-systems.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 2/7] ixgbe: Add a new netdev op to allow/prevent a VF from querying an RSS info
Date: Sun, 29 Mar 2015 15:32:50 -0700	[thread overview]
Message-ID: <55187D92.7070704@gmail.com> (raw)
In-Reply-To: <1427645497-8339-3-git-send-email-vladz@cloudius-systems.com>

On 03/29/2015 09:11 AM, Vlad Zolotarov wrote:
> Implements the new netdev op to allow user to enable/disable the ability
> of a specific VF to query its RSS Indirection Table and an RSS Hash Key.
>
> This patch limits the new feature support to 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:
>    - Reduce the support to 82599 and x540 devices only.
> ---
>  drivers/net/ethernet/intel/ixgbe/ixgbe.h       |  1 +
>  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c  |  7 ++++++
>  drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 30 ++++++++++++++++++++++++++
>  drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h |  2 ++
>  4 files changed, 40 insertions(+)
>
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
> index 42ed4b4..639aa1b 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
> @@ -151,6 +151,7 @@ struct vf_data_storage {
>  	u16 tx_rate;
>  	u16 vlan_count;
>  	u8 spoofchk_enabled;
> +	bool rss_query_enabled;
>  	unsigned int vf_api;
>  };
>  
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index a99bc5d..1b04cb1 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -3656,6 +3656,12 @@ static void ixgbe_configure_virtualization(struct ixgbe_adapter *adapter)
>  		if (hw->mac.ops.set_ethertype_anti_spoofing)
>  			hw->mac.ops.set_ethertype_anti_spoofing(hw, true, i);
>  	}
> +
> +	/* Enable/Disable RSS query feature  */
> +	for (i = 0; i < adapter->num_vfs; i++)
> +		ixgbe_ndo_set_vf_rss_query_en(adapter->netdev, i,
> +					      adapter->vfinfo[i].rss_query_enabled);
> +
>  }
>  
>  static void ixgbe_set_rx_buffer_len(struct ixgbe_adapter *adapter)

Instead of looking through the VFs twice you could probably look at
combining  this with the loop directly above it.
> @@ -8096,6 +8102,7 @@ static const struct net_device_ops ixgbe_netdev_ops = {
>  	.ndo_set_vf_vlan	= ixgbe_ndo_set_vf_vlan,
>  	.ndo_set_vf_rate	= ixgbe_ndo_set_vf_bw,
>  	.ndo_set_vf_spoofchk	= ixgbe_ndo_set_vf_spoofchk,
> +	.ndo_set_vf_rss_query_en = ixgbe_ndo_set_vf_rss_query_en,
>  	.ndo_get_vf_config	= ixgbe_ndo_get_vf_config,
>  	.ndo_get_stats64	= ixgbe_get_stats64,
>  #ifdef CONFIG_IXGBE_DCB
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
> index 09a291b..f08672a 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
> @@ -108,6 +108,15 @@ static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter)
>  		/* enable spoof checking for all VFs */
>  		for (i = 0; i < adapter->num_vfs; i++)
>  			adapter->vfinfo[i].spoofchk_enabled = true;
> +
> +		/* We support VF RSS querying only for 82599 and x540 devices at
> +		 * the moment. These devices share RSS indirection table and
> +		 * RSS hash key with PF therefore we want to disable the
> +		 * querying by default.
> +		 */
> +		for (i = 0; i < adapter->num_vfs; i++)
> +			adapter->vfinfo[i].rss_query_enabled = 0;
> +
>  		return 0;
>  	}
>  

Same here, no point in looping through all the VFs twice, just take care
of sppofchk_enabled, and rss_query_enabled in one loop.

> @@ -1330,6 +1339,26 @@ int ixgbe_ndo_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting)
>  	return 0;
>  }
>  
> +int ixgbe_ndo_set_vf_rss_query_en(struct net_device *netdev, int vf,
> +				  bool setting)
> +{
> +	struct ixgbe_adapter *adapter = netdev_priv(netdev);
> +
> +	/* This operation is currently supported only for 82599 and x540
> +	 * devices.
> +	 */
> +	if (adapter->hw.mac.type < ixgbe_mac_82599EB ||
> +	    adapter->hw.mac.type >= ixgbe_mac_X550)
> +		return -EPERM;
> +

This should be not supported, not EPERM.

> +	if (vf >= adapter->num_vfs)
> +		return -EINVAL;
> +
> +	adapter->vfinfo[vf].rss_query_enabled = setting;
> +
> +	return 0;
> +}
> +
>  int ixgbe_ndo_get_vf_config(struct net_device *netdev,
>  			    int vf, struct ifla_vf_info *ivi)
>  {
> @@ -1343,5 +1372,6 @@ int ixgbe_ndo_get_vf_config(struct net_device *netdev,
>  	ivi->vlan = adapter->vfinfo[vf].pf_vlan;
>  	ivi->qos = adapter->vfinfo[vf].pf_qos;
>  	ivi->spoofchk = adapter->vfinfo[vf].spoofchk_enabled;
> +	ivi->rss_query_en = adapter->vfinfo[vf].rss_query_enabled;
>  	return 0;
>  }
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h
> index 32c26d5..2c197e6 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.h
> @@ -47,6 +47,8 @@ int ixgbe_ndo_set_vf_vlan(struct net_device *netdev, int queue, u16 vlan,
>  int ixgbe_ndo_set_vf_bw(struct net_device *netdev, int vf, int min_tx_rate,
>  			int max_tx_rate);
>  int ixgbe_ndo_set_vf_spoofchk(struct net_device *netdev, int vf, bool setting);
> +int ixgbe_ndo_set_vf_rss_query_en(struct net_device *netdev, int vf,
> +				  bool setting);
>  int ixgbe_ndo_get_vf_config(struct net_device *netdev,
>  			    int vf, struct ifla_vf_info *ivi);
>  void ixgbe_check_vf_rate_limit(struct ixgbe_adapter *adapter);

  reply	other threads:[~2015-03-29 22:32 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 [this message]
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

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=55187D92.7070704@gmail.com \
    --to=alexander.duyck@gmail.com \
    --cc=avi@cloudius-systems.com \
    --cc=gleb@cloudius-systems.com \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=vladz@cloudius-systems.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).