netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, Jakub Kicinski <jakub.kicinski@netronome.com>
Subject: [PATCHv3 net-next 01/14] nfp: move link state interrupt request/free calls
Date: Thu, 18 Feb 2016 20:38:16 +0000	[thread overview]
Message-ID: <1455827909-26443-2-git-send-email-jakub.kicinski@netronome.com> (raw)
In-Reply-To: <1455827909-26443-1-git-send-email-jakub.kicinski@netronome.com>

We need to be able to disable the link state interrupt when
the device is brought down.  We used to just free the IRQ
at the beginning of .ndo_stop().  As we now move towards
more ordered .ndo_open()/.ndo_stop() paths LSC allocation
should be placed in the "allocate resource" section.

Since the IRQ can't be freed early in .ndo_stop(), it is
disabled instead.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
 .../net/ethernet/netronome/nfp/nfp_net_common.c    | 23 +++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
index 070645f9bc21..bebdae80ccda 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
@@ -1727,10 +1727,16 @@ static int nfp_net_netdev_open(struct net_device *netdev)
 				      NFP_NET_IRQ_EXN_IDX, nn->exn_handler);
 	if (err)
 		return err;
+	err = nfp_net_aux_irq_request(nn, NFP_NET_CFG_LSC, "%s-lsc",
+				      nn->lsc_name, sizeof(nn->lsc_name),
+				      NFP_NET_IRQ_LSC_IDX, nn->lsc_handler);
+	if (err)
+		goto err_free_exn;
+	disable_irq(nn->irq_entries[NFP_NET_CFG_LSC].vector);
 
 	err = nfp_net_alloc_rings(nn);
 	if (err)
-		goto err_free_exn;
+		goto err_free_lsc;
 
 	err = netif_set_real_num_tx_queues(netdev, nn->num_tx_rings);
 	if (err)
@@ -1810,19 +1816,11 @@ static int nfp_net_netdev_open(struct net_device *netdev)
 
 	netif_tx_wake_all_queues(netdev);
 
-	err = nfp_net_aux_irq_request(nn, NFP_NET_CFG_LSC, "%s-lsc",
-				      nn->lsc_name, sizeof(nn->lsc_name),
-				      NFP_NET_IRQ_LSC_IDX, nn->lsc_handler);
-	if (err)
-		goto err_stop_tx;
+	enable_irq(nn->irq_entries[NFP_NET_CFG_LSC].vector);
 	nfp_net_read_link_status(nn);
 
 	return 0;
 
-err_stop_tx:
-	netif_tx_disable(netdev);
-	for (r = 0; r < nn->num_r_vecs; r++)
-		nfp_net_tx_flush(nn->r_vecs[r].tx_ring);
 err_disable_napi:
 	while (r--) {
 		napi_disable(&nn->r_vecs[r].napi);
@@ -1832,6 +1830,8 @@ err_clear_config:
 	nfp_net_clear_config_and_disable(nn);
 err_free_rings:
 	nfp_net_free_rings(nn);
+err_free_lsc:
+	nfp_net_aux_irq_free(nn, NFP_NET_CFG_LSC, NFP_NET_IRQ_LSC_IDX);
 err_free_exn:
 	nfp_net_aux_irq_free(nn, NFP_NET_CFG_EXN, NFP_NET_IRQ_EXN_IDX);
 	return err;
@@ -1853,7 +1853,7 @@ static int nfp_net_netdev_close(struct net_device *netdev)
 
 	/* Step 1: Disable RX and TX rings from the Linux kernel perspective
 	 */
-	nfp_net_aux_irq_free(nn, NFP_NET_CFG_LSC, NFP_NET_IRQ_LSC_IDX);
+	disable_irq(nn->irq_entries[NFP_NET_CFG_LSC].vector);
 	netif_carrier_off(netdev);
 	nn->link_up = false;
 
@@ -1874,6 +1874,7 @@ static int nfp_net_netdev_close(struct net_device *netdev)
 	}
 
 	nfp_net_free_rings(nn);
+	nfp_net_aux_irq_free(nn, NFP_NET_CFG_LSC, NFP_NET_IRQ_LSC_IDX);
 	nfp_net_aux_irq_free(nn, NFP_NET_CFG_EXN, NFP_NET_IRQ_EXN_IDX);
 
 	nn_dbg(nn, "%s down", netdev->name);
-- 
1.9.1

  reply	other threads:[~2016-02-18 20:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-18 20:38 [PATCHv3 net-next 00/14] nfp: MTU fixes for net Jakub Kicinski
2016-02-18 20:38 ` Jakub Kicinski [this message]
2016-02-18 20:38 ` [PATCHv3 net-next 02/14] nfp: break up nfp_net_{alloc|free}_rings Jakub Kicinski
2016-02-18 20:38 ` [PATCHv3 net-next 03/14] nfp: make *x_ring_init do all the init Jakub Kicinski
2016-02-18 20:38 ` [PATCHv3 net-next 04/14] nfp: allocate ring SW structs dynamically Jakub Kicinski
2016-02-18 20:38 ` [PATCHv3 net-next 05/14] nfp: cleanup tx ring flush and rename to reset Jakub Kicinski
2016-02-18 20:38 ` [PATCHv3 net-next 06/14] nfp: reorganize initial filling of RX rings Jakub Kicinski
2016-02-18 20:38 ` [PATCHv3 net-next 07/14] nfp: preallocate RX buffers early in .ndo_open Jakub Kicinski
2016-02-18 20:38 ` [PATCHv3 net-next 08/14] nfp: move filling ring information to FW config Jakub Kicinski
2016-02-18 20:38 ` [PATCHv3 net-next 09/14] nfp: slice .ndo_open() and .ndo_stop() up Jakub Kicinski
2016-02-18 20:38 ` [PATCHv3 net-next 10/14] nfp: sync ring state during FW reconfiguration Jakub Kicinski
2016-02-18 20:38 ` [PATCHv3 net-next 11/14] nfp: propagate list buffer size in struct rx_ring Jakub Kicinski
2016-02-18 20:38 ` [PATCHv3 net-next 12/14] nfp: convert .ndo_change_mtu() to prepare/commit paradigm Jakub Kicinski
2016-02-18 20:38 ` [PATCHv3 net-next 13/14] nfp: pass ring count as function parameter Jakub Kicinski
2016-02-18 20:38 ` [PATCHv3 net-next 14/14] nfp: allow ring size reconfiguration at runtime Jakub Kicinski

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=1455827909-26443-2-git-send-email-jakub.kicinski@netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).