netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 43/45] bna: Dropped BUG_ONs and Rx id init fix
Date: Mon, 18 Jul 2011 01:23:03 -0700	[thread overview]
Message-ID: <1310977385-5268-33-git-send-email-rmody@brocade.com> (raw)
In-Reply-To: <1310977385-5268-1-git-send-email-rmody@brocade.com>

Change details:
 - Removed some BUG_ONs and comments addition/cleanup
 - Initializing rx_id to 0 for bnad_cleanup_rx
 - Releasing all the locks while doing free_netdev
 - Counting the Rx buffer allocation failures in bnad_alloc_n_post_rxbufs()

Signed-off-by: Rasesh Mody <rmody@brocade.com>
---
 drivers/net/bna/bna_hw.h |    1 +
 drivers/net/bna/bnad.c   |   32 ++++++++++++++++++++------------
 drivers/net/bna/bnad.h   |   15 ++++++++-------
 3 files changed, 29 insertions(+), 19 deletions(-)

diff --git a/drivers/net/bna/bna_hw.h b/drivers/net/bna/bna_hw.h
index 80b21ee..552e8b1 100644
--- a/drivers/net/bna/bna_hw.h
+++ b/drivers/net/bna/bna_hw.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/bna/bnad.c b/drivers/net/bna/bnad.c
index 6128045..68cd328 100644
--- a/drivers/net/bna/bnad.c
+++ b/drivers/net/bna/bnad.c
@@ -408,6 +408,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;
@@ -1913,6 +1914,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);
 }
@@ -1968,8 +1970,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;
 
 	/*
@@ -2102,8 +2106,6 @@ bnad_restore_vlans(struct bnad *bnad, u32 rx_id)
 	if (!bnad->vlan_grp)
 		return;
 
-	BUG_ON(!(VLAN_N_VID == (BFI_ENET_VLAN_ID_MAX + 1)));
-
 	for (vlan_id = 0; vlan_id < VLAN_N_VID; vlan_id++) {
 		if (!vlan_group_get_device(bnad->vlan_grp, vlan_id))
 			continue;
@@ -2214,9 +2216,6 @@ bnad_tso_prepare(struct bnad *bnad, struct sk_buff *skb)
 {
 	int err;
 
-	/* SKB_GSO_TCPV4 and SKB_GSO_TCPV6 is defined since 2.6.18. */
-	BUG_ON(!(skb_shinfo(skb)->gso_type == SKB_GSO_TCPV4 ||
-		   skb_shinfo(skb)->gso_type == SKB_GSO_TCPV6));
 	if (skb_header_cloned(skb)) {
 		err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
 		if (err) {
@@ -2243,7 +2242,6 @@ bnad_tso_prepare(struct bnad *bnad, struct sk_buff *skb)
 	} else {
 		struct ipv6hdr *ipv6h = ipv6_hdr(skb);
 
-		BUG_ON(!(skb->protocol == htons(ETH_P_IPV6)));
 		ipv6h->payload_len = 0;
 		tcp_hdr(skb)->check =
 			~csum_ipv6_magic(&ipv6h->saddr, &ipv6h->daddr, 0,
@@ -2583,7 +2581,7 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev)
 	unmap_q = tcb->unmap_q;
 	/*
 	 * Takes care of the Tx that is scheduled between clearing the flag
-	 * and the netif_stop_all_queue() call.
+	 * and the netif_tx_stop_all_queues() call.
 	 */
 	BNAD_DROP_AND_RETURN_IF(!test_bit(BNAD_TXQ_TX_STARTED, &tcb->flags),
 				tx_skb_stopping);
@@ -2631,7 +2629,6 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev)
 
 	txq_prod = tcb->producer_index;
 	BNA_TXQ_QPGE_PTR_GET(txq_prod, tcb->sw_qpt, txqent, wi_range);
-	BUG_ON(!(wi_range <= tcb->q_depth));
 	txqent->hdr.wi.reserved = 0;
 	txqent->hdr.wi.num_vectors = vectors;
 
@@ -2947,7 +2944,7 @@ unlock:
  * conf_lock cannot be used since this call may be made
  * in a non-blocking context.
  */
-static int
+int
 bnad_set_mac_address(struct net_device *netdev, void *mac_addr)
 {
 	int err;
@@ -3069,6 +3066,12 @@ bnad_netpoll(struct net_device *netdev)
 		bnad_isr(bnad->pcidev->irq, netdev);
 		bna_intx_enable(&bnad->bna, curr_mask);
 	} else {
+		/*
+		 * Tx processing may happen in sending context, so no need
+		 * to explicitly process completions here
+		 */
+
+		/* Rx processing */
 		for (i = 0; i < bnad->num_rx; i++) {
 			rx_info = &bnad->rx_info[i];
 			if (!rx_info->rx)
@@ -3262,7 +3265,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;
@@ -3385,6 +3388,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);
 
@@ -3436,9 +3444,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;
 }
diff --git a/drivers/net/bna/bnad.h b/drivers/net/bna/bnad.h
index 1f9bb56..6e14257 100644
--- a/drivers/net/bna/bnad.h
+++ b/drivers/net/bna/bnad.h
@@ -153,7 +153,6 @@ struct bnad_drv_stats {
 	u64		tcpcsum_offload;
 	u64		udpcsum_offload;
 	u64		csum_help;
-	u64		csum_help_err;
 	u64		tx_skb_too_short;
 	u64		tx_skb_stopping;
 	u64		tx_skb_max_vectors;
@@ -170,13 +169,10 @@ struct bnad_drv_stats {
 	u64		tx_skb_len_mismatch;
 
 	u64		hw_stats_updates;
-	u64		netif_rx_schedule;
-	u64		netif_rx_complete;
 	u64		netif_rx_dropped;
 
 	u64		link_toggle;
 	u64		cee_toggle;
-	u64		cee_up;
 
 	u64		rxp_info_alloc_failed;
 	u64		mbox_intr_disabled;
@@ -323,6 +319,8 @@ struct bnad {
 
 	struct tasklet_struct	tx_free_tasklet;
 
+	u8			ref_count;
+
 	/* Statistics */
 	struct bnad_stats stats;
 
@@ -388,9 +386,12 @@ extern void bnad_netdev_hwstats_fill(struct bnad *bnad,
 	}							\
 }
 
-#define bnad_dim_timer_running(_bnad)				\
-	(((_bnad)->cfg_flags & BNAD_CF_DIM_ENABLED) &&		\
-	(test_bit(BNAD_RF_DIM_TIMER_RUNNING, &((_bnad)->run_flags))))
+/*
+ * Stops the DIM timer
+ * Called with bnad->bna_lock held
+ * Implemented as macro, since we want to use
+ * the correct flags(on stack) while unlocking.
+ */
 #define bnad_dim_timer_stop(_bnad, _flags)		\
 do {							\
 	int to_del = 0;					\
-- 
1.7.1


  parent reply	other threads:[~2011-07-18  8:25 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 ` [PATCH 32/45] bna: TxRx Coalesce Settings Fix and Reorg PCI Probe Failure Rasesh Mody
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 ` Rasesh Mody [this message]
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-33-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).