From: Rasesh Mody <rmody@brocade.com>
To: <davem@davemloft.net>, <netdev@vger.kernel.org>
Cc: <adapter_linux_open_src_team@brocade.com>,
Rasesh Mody <rmody@brocade.com>,
Gurunatha Karaje <gkaraje@brocade.com>
Subject: [net-next 06/12] bna: Initialization and Locking Fix
Date: Mon, 22 Aug 2011 15:41:03 -0700 [thread overview]
Message-ID: <1314052869-7407-7-git-send-email-rmody@brocade.com> (raw)
In-Reply-To: <1314052869-7407-1-git-send-email-rmody@brocade.com>
Change details:
- Initialize rx_id to 0 for bnad_cleanup_rx
- Return -ENOMEM in case if bna_rx_create fails
- Count the Rx buffer allocation failures in bnad_alloc_n_post_rxbufs()
- Remove unnecessary initialization of using_dac to false in bnad_pci_probe
- Release lock if error while doing bna_num_txq_set in bnad_pci_probe
- Release all the locks while doing free_netdev
Signed-off-by: Gurunatha Karaje <gkaraje@brocade.com>
Signed-off-by: Rasesh Mody <rmody@brocade.com>
---
drivers/net/ethernet/brocade/bna/bna_hw_defs.h | 1 +
drivers/net/ethernet/brocade/bna/bnad.c | 15 ++++++++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/brocade/bna/bna_hw_defs.h b/drivers/net/ethernet/brocade/bna/bna_hw_defs.h
index 07bb792..7ecdca5 100644
--- a/drivers/net/ethernet/brocade/bna/bna_hw_defs.h
+++ b/drivers/net/ethernet/brocade/bna/bna_hw_defs.h
@@ -99,6 +99,7 @@
(_bna)->bits.error_status_bits = (__HFN_INT_ERR_MASK); \
(_bna)->bits.error_mask_bits = (__HFN_INT_ERR_MASK); \
(_bna)->bits.halt_status_bits = __HFN_INT_LL_HALT; \
+ (_bna)->bits.halt_mask_bits = __HFN_INT_LL_HALT; \
}
#define ct2_reg_addr_init(_bna, _pcidev) \
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c
index b5fb265..4171c6f 100644
--- a/drivers/net/ethernet/brocade/bna/bnad.c
+++ b/drivers/net/ethernet/brocade/bna/bnad.c
@@ -389,6 +389,7 @@ bnad_alloc_n_post_rxbufs(struct bnad *bnad, struct bna_rcb *rcb)
rcb->rxq->buffer_size);
if (unlikely(!skb)) {
BNAD_UPDATE_CTR(bnad, rxbuf_alloc_failed);
+ rcb->rxq->rxbuf_alloc_failed++;
goto finishing;
}
unmap_array[unmap_prod].skb = skb;
@@ -1880,6 +1881,7 @@ bnad_cleanup_rx(struct bnad *bnad, u32 rx_id)
spin_unlock_irqrestore(&bnad->bna_lock, flags);
rx_info->rx = NULL;
+ rx_info->rx_id = 0;
bnad_rx_res_free(bnad, res_info);
}
@@ -1935,8 +1937,10 @@ bnad_setup_rx(struct bnad *bnad, u32 rx_id)
rx = bna_rx_create(&bnad->bna, bnad, rx_config, &rx_cbfn, res_info,
rx_info);
spin_unlock_irqrestore(&bnad->bna_lock, flags);
- if (!rx)
+ if (!rx) {
+ err = -ENOMEM;
goto err_return;
+ }
rx_info->rx = rx;
/*
@@ -3192,7 +3196,7 @@ static int __devinit
bnad_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *pcidev_id)
{
- bool using_dac = false;
+ bool using_dac;
int err;
struct bnad *bnad;
struct bna *bna;
@@ -3315,6 +3319,11 @@ bnad_pci_probe(struct pci_dev *pdev,
bna_num_rxp_set(bna, BNAD_NUM_RXP + 1))
err = -EIO;
}
+ spin_unlock_irqrestore(&bnad->bna_lock, flags);
+ if (err)
+ goto disable_ioceth;
+
+ spin_lock_irqsave(&bnad->bna_lock, flags);
bna_mod_res_req(&bnad->bna, &bnad->mod_res_info[0]);
spin_unlock_irqrestore(&bnad->bna_lock, flags);
@@ -3368,9 +3377,9 @@ drv_uninit:
bnad_uninit(bnad);
pci_uninit:
bnad_pci_uninit(pdev);
+free_netdev:
mutex_unlock(&bnad->conf_mutex);
bnad_lock_uninit(bnad);
-free_netdev:
free_netdev(netdev);
return err;
}
--
1.7.1
next prev parent reply other threads:[~2011-08-22 22:41 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-22 22:40 [net-next 00/12] bna: Update bna driver version to 3.0.2.1 Rasesh Mody
2011-08-22 22:40 ` [net-next 01/12] bna: Naming Change and Minor Macro Fix Rasesh Mody
2011-08-22 22:40 ` [net-next 02/12] bna: PCI Probe Fix Rasesh Mody
2011-08-22 22:41 ` [net-next 03/12] bna: Interrupt Polling and NAPI Init Changes Rasesh Mody
2011-08-22 22:41 ` [net-next 04/12] bna: TX Path and RX Path Changes Rasesh Mody
2011-08-22 23:45 ` David Miller
2011-08-23 18:06 ` Rasesh Mody
2011-08-22 22:41 ` [net-next 05/12] bna: Formatting and Code Cleanup Rasesh Mody
2011-08-22 22:41 ` Rasesh Mody [this message]
2011-08-22 22:41 ` [net-next 07/12] bna: Ethtool Enhancements and Fix Rasesh Mody
2011-08-22 22:41 ` [net-next 08/12] bna: Async Mode Tx Rx Init Fix Rasesh Mody
2011-08-22 22:41 ` [net-next 09/12] bna: MBOX IRQ Flag Check after Locking Rasesh Mody
2011-08-22 22:41 ` [net-next 10/12] bna: Queue Depth and SKB Unmap Array Fix Rasesh Mody
2011-08-22 22:41 ` [net-next 11/12] bna: SKB PCI UNMAP Fix Rasesh Mody
2011-08-22 22:41 ` [net-next 12/12] bna: Driver Version changed to 3.0.2.1 Rasesh Mody
-- strict thread matches above, loose matches on Subject: below --
2011-08-31 1:27 [net-next 00/12] bna: Update bna driver version " Rasesh Mody
2011-08-31 1:27 ` [net-next 06/12] bna: Initialization and Locking Fix Rasesh Mody
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=1314052869-7407-7-git-send-email-rmody@brocade.com \
--to=rmody@brocade.com \
--cc=adapter_linux_open_src_team@brocade.com \
--cc=davem@davemloft.net \
--cc=gkaraje@brocade.com \
--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).