public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Jack Morgenstein <jackm-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
To: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>
Cc: Yevgeny Petrilin
	<yevgenyp-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	liranl-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org
Subject: Re: [PATCH net-next V0 19/21] mlx4_core: Modify driver initialization flow to accommodate SRIOV for Ethernet
Date: Sun, 4 Dec 2011 16:29:41 +0200	[thread overview]
Message-ID: <201112041629.41466.jackm@dev.mellanox.co.il> (raw)
In-Reply-To: <CAL1RGDV8LzSOei=aQW7VXUP=G+9qdO+Y4eKZu8mBuHJuUp8UuQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Friday 02 December 2011 19:51, Roland Dreier wrote:
> >  #else /* CONFIG_PCI_IOV */
> > +static int sr_iov;
> > +#define probe_vf 0
> >  int mlx4_log_num_mgm_entry_size = 9;
> >  #endif /* CONFIG_PCI_IOV */
> 
> I don't think it's a good idea to put module parameters inside an
> #ifdef.  Then depending on the
> kernel config someone compiles with, their modprobe.conf may or may not break.
> 
I agree.  I will change this so that the module parameters are always there.

If the kernel is not configured to support IOV, pci_enable_sriov will fail.
Currently, we abort the device startup.  I can change this to simply continue
without sriov enabled:
======================================================

mlx4_core: fix sriov module parameters

Always have the sr_iov module parameters (even if the kernel
is not compiled with sriov support).  Change device startup logic
so that if pci_enable_sriov() fails, the PF-driver continues to bring up
the device, but in non-sriov mode.

Signed-off-by: Jack Morgenstein <jackm-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>

---
Roland,
I will roll this change into the original patch set, so that V1 will contain
this code.


Index: net-next/drivers/net/ethernet/mellanox/mlx4/main.c
===================================================================
--- net-next.orig/drivers/net/ethernet/mellanox/mlx4/main.c	2011-12-04 10:38:52.000000000 +0200
+++ net-next/drivers/net/ethernet/mellanox/mlx4/main.c	2011-12-04 16:23:33.000000000 +0200
@@ -76,8 +76,6 @@ MODULE_PARM_DESC(msi_x, "attempt to use 
 
 #endif /* CONFIG_PCI_MSI */
 
-#ifdef CONFIG_PCI_IOV
-
 static int sr_iov;
 module_param(sr_iov, int, 0444);
 MODULE_PARM_DESC(sr_iov, "enable #sr_iov functions if sr_iov > 0");
@@ -94,12 +92,6 @@ MODULE_PARM_DESC(log_num_mgm_entry_size,
 					 " 10 gives 248.range: 9<="
 					 " log_num_mgm_entry_size <= 12");
 
-#else /* CONFIG_PCI_IOV */
-static int sr_iov;
-#define probe_vf 0
-int mlx4_log_num_mgm_entry_size = 9;
-#endif /* CONFIG_PCI_IOV */
-
 #define MLX4_VF					(1 << 0)
 
 #define HCA_GLOBAL_CAP_MASK	0
@@ -1732,13 +1724,19 @@ static int __mlx4_init_one(struct pci_de
 
 		if (sr_iov) {
 			mlx4_warn(dev, "Enabling sriov with:%d vfs\n", sr_iov);
-			if (pci_enable_sriov(pdev, sr_iov)) {
-				mlx4_err(dev, "Failed to enable sriov, aborting.\n");
-				goto err_rel_own;
+			err = pci_enable_sriov(pdev, sr_iov);
+			if (err) {
+				mlx4_err(dev, "Failed to enable sriov,"
+					 "continuing without sriov enabled"
+					 " (err = %d).\n", err);
+				sr_iov = 0;
+				err = 0;
+			} else {
+				mlx4_warn(dev, "Running in master mode\n");
+				dev->flags |= MLX4_FLAG_SRIOV |
+					MLX4_FLAG_MASTER;
+				dev->sr_iov = sr_iov;
 			}
-			mlx4_warn(dev, "Running in master mode\n");
-			dev->flags |= MLX4_FLAG_SRIOV | MLX4_FLAG_MASTER;
-			dev->sr_iov = sr_iov;
 		}
 
 		/*


- Jack
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2011-12-04 14:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-02 10:19 [PATCH net-next V0 19/21] mlx4_core: Modify driver initialization flow to accommodate SRIOV for Ethernet Yevgeny Petrilin
     [not found] ` <4ED8A636.40901-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>
2011-12-02 17:51   ` Roland Dreier
     [not found]     ` <CAL1RGDV8LzSOei=aQW7VXUP=G+9qdO+Y4eKZu8mBuHJuUp8UuQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-12-04 14:29       ` Jack Morgenstein [this message]
     [not found]         ` <201112041629.41466.jackm-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2011-12-04 15:39           ` Or Gerlitz
     [not found]             ` <4EDB942F.1020101-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2011-12-05  7:19               ` Jack Morgenstein
     [not found]                 ` <201112050919.39280.jackm-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2011-12-05  7:40                   ` Or Gerlitz
2011-12-05 19:01           ` Roland Dreier
2011-12-05 21:26   ` Ben Hutchings
2011-12-06  8:09     ` Yevgeny Petrilin
2011-12-06  8:35     ` Jack Morgenstein
     [not found]       ` <201112061035.54093.jackm-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2011-12-06 17:41         ` Ben Hutchings

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=201112041629.41466.jackm@dev.mellanox.co.il \
    --to=jackm-ldsdmyg8hgv8yrgs2mwiifqbs+8scbdb@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=liranl-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org \
    --cc=yevgenyp-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org \
    /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