Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Emil Tantilov <emil.s.tantilov@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH 4/9] ixgbevf: setup queue counts
Date: Tue, 30 Jan 2018 16:51:27 -0800	[thread overview]
Message-ID: <20180131005127.19264.83738.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <20180131005015.19264.44085.stgit@localhost6.localdomain6>

Add calls for netif_set_real_num_t/rx_queues() in ixgbevf_open().
Make sure that calls to ixgbevf_open() are rtnl protected and improve
the error handling when setting up multiple queues.

Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
---
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |   44 ++++++++++++++-------
 1 file changed, 29 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index f8e1b1c..cb9d00a 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -3119,9 +3119,14 @@ static int ixgbevf_setup_all_tx_resources(struct ixgbevf_adapter *adapter)
 		if (!err)
 			continue;
 		hw_dbg(&adapter->hw, "Allocation for Tx Queue %u failed\n", i);
-		break;
+		goto err_setup_tx;
 	}
 
+	return 0;
+err_setup_tx:
+	/* rewind the index freeing the rings as we go */
+	while (i--)
+		ixgbevf_free_tx_resources(adapter->tx_ring[i]);
 	return err;
 }
 
@@ -3179,8 +3184,14 @@ static int ixgbevf_setup_all_rx_resources(struct ixgbevf_adapter *adapter)
 		if (!err)
 			continue;
 		hw_dbg(&adapter->hw, "Allocation for Rx Queue %u failed\n", i);
-		break;
+		goto err_setup_rx;
 	}
+
+	return 0;
+err_setup_rx:
+	/* rewind the index freeing the rings as we go */
+	while (i--)
+		ixgbevf_free_rx_resources(adapter->rx_ring[i]);
 	return err;
 }
 
@@ -3285,18 +3296,27 @@ int ixgbevf_open(struct net_device *netdev)
 	if (err)
 		goto err_req_irq;
 
+	/* Notify the stack of the actual queue counts. */
+	err = netif_set_real_num_tx_queues(netdev, adapter->num_tx_queues);
+	if (err)
+		goto err_set_queues;
+
+	err = netif_set_real_num_rx_queues(netdev, adapter->num_rx_queues);
+	if (err)
+		goto err_set_queues;
+
 	ixgbevf_up_complete(adapter);
 
 	return 0;
 
+err_set_queues:
+	ixgbevf_free_irq(adapter);
 err_req_irq:
-	ixgbevf_down(adapter);
-err_setup_rx:
 	ixgbevf_free_all_rx_resources(adapter);
-err_setup_tx:
+err_setup_rx:
 	ixgbevf_free_all_tx_resources(adapter);
+err_setup_tx:
 	ixgbevf_reset(adapter);
-
 err_setup_reset:
 
 	return err;
@@ -3948,17 +3968,11 @@ static int ixgbevf_resume(struct pci_dev *pdev)
 
 	rtnl_lock();
 	err = ixgbevf_init_interrupt_scheme(adapter);
+	if (!err && netif_running(netdev))
+		err = ixgbevf_open(netdev);
 	rtnl_unlock();
-	if (err) {
-		dev_err(&pdev->dev, "Cannot initialize interrupts\n");
+	if (err)
 		return err;
-	}
-
-	if (netif_running(netdev)) {
-		err = ixgbevf_open(netdev);
-		if (err)
-			return err;
-	}
 
 	netif_device_attach(netdev);
 


  parent reply	other threads:[~2018-01-31  0:51 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-31  0:51 [Intel-wired-lan] [PATCH 0/9] ixgbevf: build_skb support and related changes Emil Tantilov
2018-01-31  0:51 ` [Intel-wired-lan] [PATCH 1/9] ixgbevf: use page_address offset from page Emil Tantilov
2018-02-26 15:55   ` Singh, Krishneil K
2018-01-31  0:51 ` [Intel-wired-lan] [PATCH 2/9] ixgbevf: add ethtool private flag for legacy Rx Emil Tantilov
2018-02-26 16:02   ` Singh, Krishneil K
2018-01-31  0:51 ` [Intel-wired-lan] [PATCH 3/9] ixgbevf: add support for using order 1 pages to receive large frames Emil Tantilov
2018-02-26 16:03   ` Singh, Krishneil K
2018-01-31  0:51 ` Emil Tantilov [this message]
2018-02-26 16:03   ` [Intel-wired-lan] [PATCH 4/9] ixgbevf: setup queue counts Singh, Krishneil K
2018-01-31  0:51 ` [Intel-wired-lan] [PATCH 5/9] ixgbevf: add support for padding packet Emil Tantilov
2018-02-26 16:04   ` Singh, Krishneil K
2018-01-31  0:51 ` [Intel-wired-lan] [PATCH 6/9] ixgbevf: make sure all frames fit minimum size requirements Emil Tantilov
2018-02-26 16:04   ` Singh, Krishneil K
2018-01-31  0:51 ` [Intel-wired-lan] [PATCH 7/9] ixgbevf: allocate the rings as part of q_vector Emil Tantilov
2018-02-26 16:05   ` Singh, Krishneil K
2018-01-31  0:51 ` [Intel-wired-lan] [PATCH 8/9] ixgbevf: break out Rx buffer page management Emil Tantilov
2018-02-26 16:05   ` Singh, Krishneil K
2018-01-31  0:51 ` [Intel-wired-lan] [PATCH 9/9] ixgbevf: add build_skb support Emil Tantilov
2018-02-26 16:05   ` Singh, Krishneil K

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=20180131005127.19264.83738.stgit@localhost6.localdomain6 \
    --to=emil.s.tantilov@intel.com \
    --cc=intel-wired-lan@osuosl.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