From: Rasesh Mody <rmody@brocade.com>
To: <davem@davemloft.net>, <netdev@vger.kernel.org>
Cc: <adapter_linux_open_src_team@brocade.com>, <dradovan@brocade.com>,
Rasesh Mody <rmody@brocade.com>
Subject: [PATCH 32/45] bna: TxRx Coalesce Settings Fix and Reorg PCI Probe Failure
Date: Mon, 18 Jul 2011 01:22:52 -0700 [thread overview]
Message-ID: <1310977385-5268-22-git-send-email-rmody@brocade.com> (raw)
In-Reply-To: <1310977385-5268-1-git-send-email-rmody@brocade.com>
Change details:
- The TX and Rx coalesce settings are programmed in steps of 5 us. The value
that are not divisible by 5 are rounded to the next lower number. This was
causing the value os 1 to 4 to be rounded to 0, which is an invalid setting.
- When creating Rx and Tx object, we are currently assigning the default
values of Rx and Tx coalescing_timeo. If these values are changed in
the driver to a different value, the change is lost during such
operations as MTU change. In order to avoid that, pass the configured
value of coalescing_timeo before Rx and Tx object creation.
- Fix bnad_tx_coalescing_timeo_set() so it applies to all the Tx objects.
- Fix uninitialization path in case of pci_probe failure.
- Added/Removed flags.
Signed-off-by: Rasesh Mody <rmody@brocade.com>
---
drivers/net/bna/bnad.c | 46 ++++++++++++++++++++++++++++++----------------
drivers/net/bna/bnad.h | 9 +++++----
2 files changed, 35 insertions(+), 20 deletions(-)
diff --git a/drivers/net/bna/bnad.c b/drivers/net/bna/bnad.c
index 684ff91..6d1b82b 100644
--- a/drivers/net/bna/bnad.c
+++ b/drivers/net/bna/bnad.c
@@ -1797,6 +1797,7 @@ bnad_setup_tx(struct bnad *bnad, u32 tx_id)
tx_config->num_txq = bnad->num_txq_per_tx;
tx_config->txq_depth = bnad->txq_depth;
tx_config->tx_type = BNA_TX_T_REGULAR;
+ tx_config->coalescing_timeo = bnad->tx_coalescing_timeo;
/* Initialize the tx event handlers */
tx_cbfn.tcb_setup_cbfn = bnad_cb_tcb_setup;
@@ -1857,6 +1858,7 @@ bnad_init_rx_config(struct bnad *bnad, struct bna_rx_config *rx_config)
{
rx_config->rx_type = BNA_RX_T_REGULAR;
rx_config->num_paths = bnad->num_rxp_per_rx;
+ rx_config->coalescing_timeo = bnad->rx_coalescing_timeo;
if (bnad->num_rxp_per_rx > 1) {
rx_config->rss_status = BNA_STATUS_T_ENABLED;
@@ -2017,12 +2019,15 @@ void
bnad_tx_coalescing_timeo_set(struct bnad *bnad)
{
struct bnad_tx_info *tx_info;
+ int i;
- tx_info = &bnad->tx_info[0];
- if (!tx_info->tx)
- return;
-
- bna_tx_coalescing_timeo_set(tx_info->tx, bnad->tx_coalescing_timeo);
+ for (i = 0; i < bnad->num_tx; i++) {
+ tx_info = &bnad->tx_info[i];
+ if (!tx_info->tx)
+ continue;
+ bna_tx_coalescing_timeo_set(tx_info->tx,
+ bnad->tx_coalescing_timeo);
+ }
}
/* Called with conf_lock & bnad->bna_lock held */
@@ -2726,7 +2731,7 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev)
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i];
- u32 size = frag->size;
+ u16 size = frag->size;
if (++vect_id == BFI_TX_MAX_VECTORS_PER_WI) {
vect_id = 0;
@@ -3248,7 +3253,7 @@ bnad_pci_probe(struct pci_dev *pdev,
/* Allocate resources from bna */
err = bnad_res_alloc(bnad, &bnad->res_info[0], BNA_RES_T_MAX);
if (err)
- goto free_netdev;
+ goto drv_uninit;
bna = &bnad->bna;
@@ -3284,8 +3289,11 @@ bnad_pci_probe(struct pci_dev *pdev,
* This is a catastrophic error.
*/
err = bnad_ioceth_enable(bnad);
- if (err)
- goto disable_device;
+ if (err) {
+ pr_err("BNA: Initialization failed err=%d\n",
+ err);
+ goto probe_success;
+ }
spin_lock_irqsave(&bnad->bna_lock, flags);
if (bna_num_txq_set(bna, BNAD_NUM_TXQ + 1) ||
@@ -3301,7 +3309,7 @@ bnad_pci_probe(struct pci_dev *pdev,
err = bnad_res_alloc(bnad, &bnad->mod_res_info[0], BNA_MOD_RES_T_MAX);
if (err)
- goto disable_device;
+ goto disable_ioceth;
spin_lock_irqsave(&bnad->bna_lock, flags);
bna_mod_init(&bnad->bna, &bnad->mod_res_info[0]);
@@ -3317,13 +3325,17 @@ bnad_pci_probe(struct pci_dev *pdev,
err = register_netdev(netdev);
if (err) {
pr_err("BNA : Registering with netdev failed\n");
- goto disable_device;
+ goto probe_uninit;
}
- mutex_unlock(&bnad->conf_mutex);
+ set_bit(BNAD_RF_NETDEV_REGISTERED, &bnad->run_flags);
+probe_success:
+ mutex_unlock(&bnad->conf_mutex);
return 0;
-disable_device:
+probe_uninit:
+ bnad_res_free(bnad, &bnad->mod_res_info[0], BNA_MOD_RES_T_MAX);
+disable_ioceth:
bnad_ioceth_disable(bnad);
del_timer_sync(&bnad->bna.ioceth.ioc.ioc_timer);
del_timer_sync(&bnad->bna.ioceth.ioc.sem_timer);
@@ -3331,13 +3343,14 @@ disable_device:
spin_lock_irqsave(&bnad->bna_lock, flags);
bna_uninit(bna);
spin_unlock_irqrestore(&bnad->bna_lock, flags);
- bnad_res_free(bnad, &bnad->mod_res_info[0], BNA_MOD_RES_T_MAX);
bnad_res_free(bnad, &bnad->res_info[0], BNA_RES_T_MAX);
+drv_uninit:
bnad_disable_msix(bnad);
+ bnad_uninit(bnad);
pci_uninit:
bnad_pci_uninit(pdev);
+ mutex_unlock(&bnad->conf_mutex);
bnad_lock_uninit(bnad);
- bnad_uninit(bnad);
free_netdev:
free_netdev(netdev);
return err;
@@ -3358,7 +3371,8 @@ bnad_pci_remove(struct pci_dev *pdev)
bnad = netdev_priv(netdev);
bna = &bnad->bna;
- unregister_netdev(netdev);
+ if (test_and_clear_bit(BNAD_RF_NETDEV_REGISTERED, &bnad->run_flags))
+ unregister_netdev(netdev);
mutex_lock(&bnad->conf_mutex);
bnad_ioceth_disable(bnad);
diff --git a/drivers/net/bna/bnad.h b/drivers/net/bna/bnad.h
index 41ade02..c25e6e2 100644
--- a/drivers/net/bna/bnad.h
+++ b/drivers/net/bna/bnad.h
@@ -218,13 +218,14 @@ struct bnad_unmap_q {
/* Defines for run_flags bit-mask */
/* Set, tested & cleared using xxx_bit() functions */
/* Values indicated bit positions */
-#define BNAD_RF_CEE_RUNNING 1
+#define BNAD_RF_CEE_RUNNING 0
+#define BNAD_RF_MTU_SET 1
#define BNAD_RF_MBOX_IRQ_DISABLED 2
-#define BNAD_RF_RX_STARTED 3
+#define BNAD_RF_NETDEV_REGISTERED 3
#define BNAD_RF_DIM_TIMER_RUNNING 4
#define BNAD_RF_STATS_TIMER_RUNNING 5
-#define BNAD_RF_TX_SHUTDOWN_DELAYED 6
-#define BNAD_RF_RX_SHUTDOWN_DELAYED 7
+#define BNAD_RF_TX_PRIO_SET 6
+
/* Define for Fast Path flags */
/* Defined as bit positions */
--
1.7.1
next prev parent reply other threads:[~2011-07-18 8:24 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-18 8:22 [PATCH 11/45] bna: Brocade-1860 Fabric Adapter Enablement Rasesh Mody
2011-07-18 8:22 ` [PATCH 12/45] bna: Hardware Clock Setup Rasesh Mody
2011-07-18 8:22 ` [PATCH 13/45] bna: IOC PLL changes and init cleanup Rasesh Mody
2011-07-18 8:22 ` [PATCH 14/45] bna: Brocade 1860 Register and ASIC Mode Changes Rasesh Mody
2011-07-18 8:22 ` [PATCH 15/45] bna: Set MBOX MSIX Index to Zero Rasesh Mody
2011-07-18 8:22 ` [PATCH 16/45] bna: IOC PCI Init & Enable Changes Rasesh Mody
2011-07-18 8:22 ` [PATCH 17/45] bna: Mailbox Interface Changes and FW MBOX fix Rasesh Mody
2011-07-18 8:22 ` [PATCH 18/45] bna: Implement Polling Mechanism for FW Ready Rasesh Mody
2011-07-18 8:22 ` [PATCH 19/45] bna: HW Type Check Fix Rasesh Mody
2011-07-18 8:22 ` [PATCH 20/45] bna: MBOX IRQ Sync Vector Num Fix Rasesh Mody
2011-07-18 8:22 ` [PATCH 21/45] bna: Remove Reset Call Back Rasesh Mody
2011-07-18 8:22 ` [PATCH 22/45] bna: Capability Map and MFG Block Changes for New HW Rasesh Mody
2011-07-18 8:22 ` [PATCH 23/45] bna: Added Defines for Multi TXQ Support Rasesh Mody
2011-07-18 8:22 ` [PATCH 24/45] bna: Mboxq Flush When Ioc Disabled Rasesh Mody
2011-07-18 8:22 ` [PATCH 25/45] bna: Move FW Init to HW Init and Disable Hang Unmapped Fix Rasesh Mody
2011-07-18 8:22 ` [PATCH 26/45] bna: Ethfn LPU DMA Read Fix Rasesh Mody
2011-07-18 8:22 ` [PATCH 27/45] bna: IOC Event Name Change Rasesh Mody
2011-07-18 8:22 ` [PATCH 28/45] bna: Add New IOC event Rasesh Mody
2011-07-18 8:22 ` [PATCH 29/45] bna: Add Sub-System Device ID Info Rasesh Mody
2011-07-18 8:22 ` [PATCH 30/45] bna: Add HW Semaphore Unlock Logic Rasesh Mody
2011-07-18 8:22 ` [PATCH 31/45] bna: Configuration changes Rasesh Mody
2011-07-18 8:22 ` Rasesh Mody [this message]
2011-07-18 8:22 ` [PATCH 33/45] bna: Device Init Fix Rasesh Mody
2011-07-18 8:22 ` [PATCH 34/45] bna: Add Multiple Tx Queue Support Rasesh Mody
2011-07-18 8:22 ` [PATCH 35/45] bna: Change TxQ Select Logic and Interrupt Handling Rasesh Mody
2011-07-18 8:22 ` [PATCH 36/45] bna: Data Path and API Changes Rasesh Mody
2011-07-18 8:22 ` [PATCH 37/45] bna: Adpater and Port Mode Settings Rasesh Mody
2011-07-18 8:22 ` [PATCH 38/45] bna: HW Error Counter Fix Rasesh Mody
2011-07-18 8:22 ` [PATCH 39/45] bna: RX Path Changes Rasesh Mody
2011-07-18 8:23 ` [PATCH 40/45] bna: Add IOC MBOX Call Back to Client Rasesh Mody
2011-07-18 8:23 ` [PATCH 41/45] bna: Ethtool Ring Param Set changes and Add Stats Attr Rasesh Mody
2011-07-18 8:23 ` [PATCH 42/45] bna: PLL Init Fix and Add Stats Attributes Rasesh Mody
2011-07-18 8:23 ` [PATCH 43/45] bna: Dropped BUG_ONs and Rx id init fix Rasesh Mody
2011-07-18 8:23 ` [PATCH 44/45] bna: Header File and Unused Code Cleanup Rasesh Mody
2011-07-18 8:23 ` [PATCH 45/45] bna: Driver Version changed to 3.0.2.0 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=1310977385-5268-22-git-send-email-rmody@brocade.com \
--to=rmody@brocade.com \
--cc=adapter_linux_open_src_team@brocade.com \
--cc=davem@davemloft.net \
--cc=dradovan@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).