netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Elizabeth Kappler <elizabeth.m.kappler@intel.com>,
	netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com,
	Akeem G Abodunrin <akeem.g.abodunrin@intel.com>,
	Catherine Sullivan <catherine.sullivan@intel.com>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next v2 05/15] i40e: Refactor and cleanup i40e_open(), adding i40e_vsi_open()
Date: Tue, 18 Mar 2014 20:42:03 -0700	[thread overview]
Message-ID: <1395200533-16908-6-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1395200533-16908-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Elizabeth Kappler <elizabeth.m.kappler@intel.com>

This patch cleans up and moves a portion of i40e_open to i40e_vsi_open,
in order to have a shorter vsi_open function that does only that.

Change-ID: I1c418dda94dcfc0eb7d4386a70c330692ef5ecc9
Signed-off-by: Elizabeth Kappler <elizabeth.m.kappler@intel.com>
Signed-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e.h      |  3 ++-
 drivers/net/ethernet/intel/i40e/i40e_main.c | 40 +++++++++++++++++++++++------
 2 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
index ac04112..33cd8b6 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -208,7 +208,7 @@ struct i40e_pf {
 	bool fc_autoneg_status;
 
 	u16 eeprom_version;
-	u16 num_vmdq_vsis;         /* num vmdq pools this pf has set up */
+	u16 num_vmdq_vsis;         /* num vmdq vsis this pf has set up */
 	u16 num_vmdq_qps;          /* num queue pairs per vmdq pool */
 	u16 num_vmdq_msix;         /* num queue vectors per vmdq pool */
 	u16 num_req_vfs;           /* num vfs requested for this vf */
@@ -597,6 +597,7 @@ void i40e_irq_dynamic_enable(struct i40e_vsi *vsi, int vector);
 void i40e_irq_dynamic_disable_icr0(struct i40e_pf *pf);
 void i40e_irq_dynamic_enable_icr0(struct i40e_pf *pf);
 int i40e_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd);
+int i40e_vsi_open(struct i40e_vsi *vsi);
 void i40e_vlan_stripping_disable(struct i40e_vsi *vsi);
 int i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid);
 int i40e_vsi_kill_vlan(struct i40e_vsi *vsi, s16 vid);
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 5015dad..661cd42 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -4235,7 +4235,6 @@ static int i40e_open(struct net_device *netdev)
 	struct i40e_netdev_priv *np = netdev_priv(netdev);
 	struct i40e_vsi *vsi = np->vsi;
 	struct i40e_pf *pf = vsi->back;
-	char int_name[IFNAMSIZ];
 	int err;
 
 	/* disallow open during test */
@@ -4244,6 +4243,31 @@ static int i40e_open(struct net_device *netdev)
 
 	netif_carrier_off(netdev);
 
+	err = i40e_vsi_open(vsi);
+	if (err)
+		return err;
+
+#ifdef CONFIG_I40E_VXLAN
+	vxlan_get_rx_port(netdev);
+#endif
+
+	return 0;
+}
+
+/**
+ * i40e_vsi_open -
+ * @vsi: the VSI to open
+ *
+ * Finish initialization of the VSI.
+ *
+ * Returns 0 on success, negative value on failure
+ **/
+int i40e_vsi_open(struct i40e_vsi *vsi)
+{
+	struct i40e_pf *pf = vsi->back;
+	char int_name[IFNAMSIZ];
+	int err;
+
 	/* allocate descriptors */
 	err = i40e_vsi_setup_tx_resources(vsi);
 	if (err)
@@ -4256,18 +4280,22 @@ static int i40e_open(struct net_device *netdev)
 	if (err)
 		goto err_setup_rx;
 
+	if (!vsi->netdev) {
+		err = EINVAL;
+		goto err_setup_rx;
+	}
 	snprintf(int_name, sizeof(int_name) - 1, "%s-%s",
-		 dev_driver_string(&pf->pdev->dev), netdev->name);
+		 dev_driver_string(&pf->pdev->dev), vsi->netdev->name);
 	err = i40e_vsi_request_irq(vsi, int_name);
 	if (err)
 		goto err_setup_rx;
 
 	/* Notify the stack of the actual queue counts. */
-	err = netif_set_real_num_tx_queues(netdev, vsi->num_queue_pairs);
+	err = netif_set_real_num_tx_queues(vsi->netdev, vsi->num_queue_pairs);
 	if (err)
 		goto err_set_queues;
 
-	err = netif_set_real_num_rx_queues(netdev, vsi->num_queue_pairs);
+	err = netif_set_real_num_rx_queues(vsi->netdev, vsi->num_queue_pairs);
 	if (err)
 		goto err_set_queues;
 
@@ -4275,10 +4303,6 @@ static int i40e_open(struct net_device *netdev)
 	if (err)
 		goto err_up_complete;
 
-#ifdef CONFIG_I40E_VXLAN
-	vxlan_get_rx_port(netdev);
-#endif
-
 	return 0;
 
 err_up_complete:
-- 
1.8.3.1

  parent reply	other threads:[~2014-03-19  3:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-19  3:41 [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2014-03-19  3:41 ` [net-next v2 01/15] i40e: support VF link state ndo Jeff Kirsher
2014-03-19 18:06   ` David Miller
2014-03-19  3:42 ` [net-next v2 02/15] i40evf: correctly program RSS HLUT table Jeff Kirsher
2014-03-19 18:07   ` David Miller
2014-03-19  3:42 ` [net-next v2 03/15] i40evf: use min_t Jeff Kirsher
2014-03-19  3:42 ` [net-next v2 04/15] i40e: Patch to enable Ethtool/netdev feature flag for NTUPLE control Jeff Kirsher
2014-03-19  3:42 ` Jeff Kirsher [this message]
2014-03-19  3:42 ` [net-next v2 06/15] i40e/i40evf: enable hardware feature head write back Jeff Kirsher
2014-03-19 18:09   ` David Miller
2014-03-19  3:42 ` [net-next v2 07/15] i40e/i40evf: reduce context descriptors Jeff Kirsher
2014-03-19  3:42 ` [net-next v2 08/15] i40e: potential array underflow in i40e_vc_process_vf_msg() Jeff Kirsher
2014-03-19  3:42 ` [net-next v2 09/15] i40e/i40evf: Bump build versions Jeff Kirsher
2014-03-19  3:42 ` [net-next v2 10/15] e1000e: Fix Hardware Unit Hang Jeff Kirsher
2014-03-19  3:42 ` [net-next v2 11/15] e1000e: Fix Explicitly set Transmit Control Register Jeff Kirsher
2014-03-19  3:42 ` [net-next v2 12/15] igb: Add register defines needed for time sync functions Jeff Kirsher
2014-03-19  3:42 ` [net-next v2 13/15] ixgbe: add ixgbe_write_pci_cfg_word with ixgbe_removed check Jeff Kirsher
2014-03-19  3:42 ` [net-next v2 14/15] ixgbevf: Indicate removal state explicitly Jeff Kirsher
2014-03-19  3:42 ` [net-next v2 15/15] ixgbevf: Protect ixgbevf_down with __IXGBEVF_DOWN bit Jeff Kirsher
2014-03-19  8:17 ` [net-next v2 00/15][pull request] Intel Wired LAN Driver Updates Jeff Kirsher

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=1395200533-16908-6-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=akeem.g.abodunrin@intel.com \
    --cc=catherine.sullivan@intel.com \
    --cc=davem@davemloft.net \
    --cc=elizabeth.m.kappler@intel.com \
    --cc=gospo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=sassmann@redhat.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).