diff mbox

[next,S12,07/15] i40e: add more verbose error messages

Message ID 1440690163-128213-8-git-send-email-catherine.sullivan@intel.com
State Accepted
Delegated to: Jeff Kirsher
Headers show

Commit Message

Catherine Sullivan Aug. 27, 2015, 3:42 p.m. UTC
From: Mitch Williams <mitch.a.williams@intel.com>

Under certain circumstances, the device may not have enough resources to
enable all of the VFs that it advertises in config space. Although the
number of supported VFs is reported upon driver init, it is not obvious
when this is different from the number reported in config space. To
eliminate this confusion, add an error message explaining the problem.
Additionally, move the 'Allocating VFs' message down below the error
checks so as to prevent further confusion.

Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Change-ID: I45b7efca53a7aebf7777be33a8bc9d615ae48ea1
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Bowers, AndrewX Sept. 9, 2015, 6:51 p.m. UTC | #1
> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces@lists.osuosl.org] On
> Behalf Of Catherine Sullivan
> Sent: Thursday, August 27, 2015 8:43 AM
> To: intel-wired-lan@lists.osuosl.org
> Subject: [Intel-wired-lan] [next PATCH S12 07/15] i40e: add more verbose
> error messages
> 
> From: Mitch Williams <mitch.a.williams@intel.com>
> 
> Under certain circumstances, the device may not have enough resources to
> enable all of the VFs that it advertises in config space. Although the number
> of supported VFs is reported upon driver init, it is not obvious when this is
> different from the number reported in config space. To eliminate this
> confusion, add an error message explaining the problem.
> Additionally, move the 'Allocating VFs' message down below the error checks
> so as to prevent further confusion.
> 
> Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
> Change-ID: I45b7efca53a7aebf7777be33a8bc9d615ae48ea1
> ---
>  drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Code changes present in tree, behaves as expected per Mitch
diff mbox

Patch

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 63fd6b7..aa4e44c 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -998,17 +998,19 @@  static int i40e_pci_sriov_enable(struct pci_dev *pdev, int num_vfs)
 		goto err_out;
 	}
 
-	dev_info(&pdev->dev, "Allocating %d VFs.\n", num_vfs);
 	if (pre_existing_vfs && pre_existing_vfs != num_vfs)
 		i40e_free_vfs(pf);
 	else if (pre_existing_vfs && pre_existing_vfs == num_vfs)
 		goto out;
 
 	if (num_vfs > pf->num_req_vfs) {
+		dev_warn(&pdev->dev, "Unable to enable %d VFs. Limited to %d VFs due to device resource constraints.\n",
+			 num_vfs, pf->num_req_vfs);
 		err = -EPERM;
 		goto err_out;
 	}
 
+	dev_info(&pdev->dev, "Allocating %d VFs.\n", num_vfs);
 	err = i40e_alloc_vfs(pf, num_vfs);
 	if (err) {
 		dev_warn(&pdev->dev, "Failed to enable SR-IOV: %d\n", err);