All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: "Rose, Gregory V" <gregory.v.rose@intel.com>
Cc: "Kirsher, Jeffrey T" <jeffrey.t.kirsher@intel.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"gospo@redhat.com" <gospo@redhat.com>,
	"Waskiewicz Jr, Peter P" <peter.p.waskiewicz.jr@intel.com>
Subject: Re: [RFC PATCH 05/12] ixgbe: Add SR-IOV features to main module
Date: Thu, 10 Dec 2009 12:04:17 +1100	[thread overview]
Message-ID: <20091210010416.GJ4163@verge.net.au> (raw)
In-Reply-To: <43F901BD926A4E43B106BF17856F07558C3DED4A@orsmsx508.amr.corp.intel.com>

On Wed, Dec 09, 2009 at 04:49:26PM -0800, Rose, Gregory V wrote:
> >-----Original Message-----
> >From: Simon Horman [mailto:horms@verge.net.au]
> >Sent: Wednesday, December 09, 2009 4:46 PM
> >To: Kirsher, Jeffrey T
> >Cc: netdev@vger.kernel.org; gospo@redhat.com; Rose, Gregory V;
> >Waskiewicz Jr, Peter P
> >Subject: Re: [RFC PATCH 05/12] ixgbe: Add SR-IOV features to main module
> >
> >> @@ -5767,6 +5954,52 @@ static int __devinit ixgbe_probe(struct pci_dev
> >*pdev,
> >>  		goto err_sw_init;
> >>  	}
> >>
> >> +#ifdef CONFIG_PCI_IOV
> >> +	if (hw->mac.type == ixgbe_mac_82599EB) {
> >> +		/* The 82599 supports up to 64 VFs per physical function
> >> +		 * but this implementation limits allocation to 63 so that
> >> +		 * basic networking resources are still available to the
> >> +		 * physical function
> >> +		 */
> >> +		adapter->num_vfs = (max_vfs > 63) ? 63 : max_vfs;
> >> +		if (adapter->num_vfs) {
> >> +			adapter->flags |= IXGBE_FLAG_SRIOV_ENABLED;
> >> +			err = pci_enable_sriov(pdev, adapter->num_vfs);
> >> +			if (err) {
> >> +				DPRINTK(PROBE, ERR,
> >> +					"Failed to enable PCI sriov: %d\n",
> >> +					err);
> >> +				adapter->flags &= ~IXGBE_FLAG_SRIOV_ENABLED;
> >> +				adapter->num_vfs = 0;
> >> +			}
> >> +		}
> >> +		/* If call to enable VFs succeeded then allocate memory
> >> +		 * for per VF control structures.
> >> +		 */
> >> +		if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) {
> >> +			adapter->vfinfo =
> >> +				kcalloc(adapter->num_vfs,
> >> +					sizeof(struct vf_data_storage),
> >> +					GFP_KERNEL);
> >> +			if (!adapter->vfinfo) {
> >> +				/* Oh oh */
> >> +				DPRINTK(PROBE, ERR,
> >> +					"Unable to allocate memory for VF "
> >> +					"Data Storage - SRIOV disabled\n");
> >> +				adapter->flags &= ~IXGBE_FLAG_SRIOV_ENABLED;
> >> +				adapter->num_vfs = 0;
> >
> >A call to pci_disable_sriov(pdev) is needed here?
> [Rose, Gregory V] 
> 
> Good catch.

Thanks. Actually I only noticed while doing the error paths
for my suggestion below.

> >> +			} else {
> >> +				/* Now that we're sure SR-IOV is enabled
> >> +				 * set up the mailbox parameters
> >> +				 */
> >> +				ixgbe_init_mbx_params_pf(hw);
> >> +				memcpy(&hw->mbx.ops, ii->mbx_ops,
> >> +				       sizeof(hw->mbx.ops));
> >> +			}
> >> +		}
> >> +	}
> >> +
> >> +#endif /* CONFIG_PCI_IOV */
> >>  	netdev->features = NETIF_F_SG |
> >>  	                   NETIF_F_IP_CSUM |
> >>  	                   NETIF_F_HW_VLAN_TX |
> >
> >I wonder if it would be easier on the eyes to break the hunk above out
> >into
> >a ixgbe_probe_vf() function. Something like (compile tested only, I
> >don't
> >have an 82599):
> [Rose, Gregory V] 
> 
> I think that was done with the igb driver.  It's a good suggestion.

Yes, something like that is in igb.


  reply	other threads:[~2009-12-10  1:04 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-08 22:13 [RFC PATCH 01/12] ixgbe: Mailbox header and code module Jeff Kirsher
2009-12-08 22:13 ` [RFC PATCH 02/12] ixgbe: Add SR-IOV specific features Jeff Kirsher
2009-12-08 22:13 ` [RFC PATCH 03/12] ixgbe: Add SR-IOV register, structure and bit defines Jeff Kirsher
2009-12-10  0:06   ` Simon Horman
2009-12-08 22:14 ` [RFC PATCH 04/12] ixgbe: Add SR-IOV feature enablement code Jeff Kirsher
2009-12-08 22:14 ` [RFC PATCH 05/12] ixgbe: Add SR-IOV features to main module Jeff Kirsher
2009-12-10  0:45   ` Simon Horman
2009-12-10  0:49     ` Rose, Gregory V
2009-12-10  1:04       ` Simon Horman [this message]
2009-12-08 22:14 ` [RFC PATCH 06/12] ixgbe: Add SR-IOV specific modules to driver Makefile Jeff Kirsher
2009-12-10  0:17   ` Simon Horman
2009-12-08 22:15 ` [RFC PATCH 07/12] ixgbevf: Macros, data structures, useful defines and registers Jeff Kirsher
2009-12-08 22:15 ` [RFC PATCH 08/12] ixgbevf: 82599 Virtual Function core functions and header Jeff Kirsher
2009-12-08 22:15 ` [RFC PATCH 09/12] ixgbevf: Mailbox communication Jeff Kirsher
2009-12-08 22:16 ` [RFC PATCH 10/12] ixgbevf: Driver main and ethool interface module and main header Jeff Kirsher
2009-12-09 17:57   ` Ben Hutchings
2009-12-09 18:02     ` Rose, Gregory V
2009-12-08 22:16 ` [RFC PATCH 11/12] ixgbevf: Driver Makefile Jeff Kirsher
2009-12-08 22:16 ` [RFC PATCH 12/12] ixgbevf: Kconfig, Makefile and Documentation Jeff Kirsher
2009-12-08 22:41   ` Randy Dunlap
2009-12-08 22:49     ` Rose, Gregory V
2009-12-10  0:59       ` Simon Horman
2009-12-10  1:04         ` Rose, Gregory V
2009-12-10  0:50 ` [RFC PATCH 01/12] ixgbe: Mailbox header and code module Simon Horman
2009-12-10  0:53   ` Rose, Gregory V
  -- strict thread matches above, loose matches on Subject: below --
2009-12-10  1:15 [RFC PATCH 05/12] ixgbe: Add SR-IOV features to main module chavey
2009-12-10  1:40 ` Rose, Gregory V
2009-12-10  1:44   ` Waskiewicz Jr, Peter P
2009-12-10  1:53     ` Rose, Gregory V
2009-12-10 19:57     ` Roland Dreier
2009-12-10 20:02       ` Rose, Gregory V

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=20091210010416.GJ4163@verge.net.au \
    --to=horms@verge.net.au \
    --cc=gospo@redhat.com \
    --cc=gregory.v.rose@intel.com \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=peter.p.waskiewicz.jr@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.