From patchwork Tue Feb 10 00:57:11 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Feldman X-Patchwork-Id: 22843 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 2E33DDDDB9 for ; Tue, 10 Feb 2009 11:57:23 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752326AbZBJA5P (ORCPT ); Mon, 9 Feb 2009 19:57:15 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751922AbZBJA5P (ORCPT ); Mon, 9 Feb 2009 19:57:15 -0500 Received: from sj-iport-3.cisco.com ([171.71.176.72]:51689 "EHLO sj-iport-3.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751480AbZBJA5M (ORCPT ); Mon, 9 Feb 2009 19:57:12 -0500 X-IronPort-AV: E=Sophos;i="4.38,182,1233532800"; d="scan'208";a="134091056" Received: from sj-dkim-2.cisco.com ([171.71.179.186]) by sj-iport-3.cisco.com with ESMTP; 10 Feb 2009 00:57:12 +0000 Received: from sj-core-5.cisco.com (sj-core-5.cisco.com [171.71.177.238]) by sj-dkim-2.cisco.com (8.12.11/8.12.11) with ESMTP id n1A0vBwt012767 for ; Mon, 9 Feb 2009 16:57:11 -0800 Received: from palito_client100.nuovasystems.com (savbu-palito-client100.cisco.com [10.193.70.13]) by sj-core-5.cisco.com (8.13.8/8.13.8) with ESMTP id n1A0vBMk024739 for ; Tue, 10 Feb 2009 00:57:11 GMT From: Scott Feldman Subject: [PATCH net-next 1/4] enic: bug fix: return notify intr credits To: netdev@vger.kernel.org Date: Mon, 09 Feb 2009 16:57:11 -0800 Message-ID: <20090210005711.24315.325.stgit@palito_client100.nuovasystems.com> In-Reply-To: <20090210005505.24315.66810.stgit@palito_client100.nuovasystems.com> References: <20090210005505.24315.66810.stgit@palito_client100.nuovasystems.com> User-Agent: StGIT/0.12.1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; l=4108; t=1234227431; x=1235091431; c=relaxed/simple; s=sjdkim2002; h=Content-Type:From:Subject:Content-Transfer-Encoding:MIME-Version; d=cisco.com; i=scofeldm@cisco.com; z=From:=20Scott=20Feldman=20 |Subject:=20[PATCH=20net-next=201/4]=20enic=3A=20bug=20fix= 3A=20return=20notify=20intr=20credits |Sender:=20; bh=vXVxkD+jBlos8KT2mOuKOg6OZr7iPcHWQnBaBvP7Ro4=; b=dGhOmWbiuIz5Tf6CNBpKPRNj3vbnlRiRrXyjSTXR2h8L3fWQxDNt0vzdLV qXYKWtKl893ejAxSBupzLwlv6GdkjSEdcnFJLUZHFGDp1j1bZ6jRzdc6MTGn J8IpHwWT8o; Authentication-Results: sj-dkim-2; header.From=scofeldm@cisco.com; dkim=pass ( sig from cisco.com/sjdkim2002 verified; ); Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org enic: bug fix: return notify intr credits Return notify intr credits after notify intr from firmware. This is especially important for legacy PCI intr mode, where not returning credits would cause PBA to remain asserted which would get us right back into the ISR. Signed-off-by: Scott Feldman --- drivers/net/enic/enic.h | 2 +- drivers/net/enic/enic_main.c | 17 +++++++++++------ drivers/net/enic/vnic_intr.h | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 7 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h index a832cc5..86b8c15 100644 --- a/drivers/net/enic/enic.h +++ b/drivers/net/enic/enic.h @@ -33,7 +33,7 @@ #define DRV_NAME "enic" #define DRV_DESCRIPTION "Cisco 10G Ethernet Driver" -#define DRV_VERSION "1.0.0.648" +#define DRV_VERSION "1.0.0.933" #define DRV_COPYRIGHT "Copyright 2008 Cisco Systems, Inc" #define PFX DRV_NAME ": " diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index 7d60551..35fc9ea 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -400,10 +400,13 @@ static irqreturn_t enic_isr_legacy(int irq, void *data) return IRQ_NONE; /* not our interrupt */ } - if (ENIC_TEST_INTR(pba, ENIC_INTX_NOTIFY)) + if (ENIC_TEST_INTR(pba, ENIC_INTX_NOTIFY)) { + vnic_intr_return_all_credits(&enic->intr[ENIC_INTX_NOTIFY]); enic_notify_check(enic); + } if (ENIC_TEST_INTR(pba, ENIC_INTX_ERR)) { + vnic_intr_return_all_credits(&enic->intr[ENIC_INTX_ERR]); enic_log_q_error(enic); /* schedule recovery from WQ/RQ error */ schedule_work(&enic->reset); @@ -476,6 +479,8 @@ static irqreturn_t enic_isr_msix_err(int irq, void *data) { struct enic *enic = data; + vnic_intr_return_all_credits(&enic->intr[ENIC_MSIX_ERR]); + enic_log_q_error(enic); /* schedule recovery from WQ/RQ error */ @@ -488,8 +493,8 @@ static irqreturn_t enic_isr_msix_notify(int irq, void *data) { struct enic *enic = data; + vnic_intr_return_all_credits(&enic->intr[ENIC_MSIX_NOTIFY]); enic_notify_check(enic); - vnic_intr_unmask(&enic->intr[ENIC_MSIX_NOTIFY]); return IRQ_HANDLED; } @@ -616,7 +621,7 @@ static inline void enic_queue_wq_skb(struct enic *enic, vlan_tag_insert, vlan_tag); } -/* netif_tx_lock held, process context with BHs disabled */ +/* netif_tx_lock held, process context with BHs disabled, or BH */ static int enic_hard_start_xmit(struct sk_buff *skb, struct net_device *netdev) { struct enic *enic = netdev_priv(netdev); @@ -1069,7 +1074,7 @@ static int enic_poll(struct napi_struct *napi, int budget) lro_flush_all(&enic->lro_mgr); netif_rx_complete(napi); - vnic_intr_unmask(&enic->intr[ENIC_MSIX_RQ]); + vnic_intr_unmask(&enic->intr[ENIC_INTX_WQ_RQ]); } return rq_work_done; @@ -1095,9 +1100,9 @@ static int enic_poll_msix(struct napi_struct *napi, int budget) vnic_rq_fill(&enic->rq[0], enic_rq_alloc_buf); - /* Accumulate intr event credits for this polling + /* Return intr event credits for this polling * cycle. An intr event is the completion of a - * a WQ or RQ packet. + * RQ packet. */ vnic_intr_return_credits(&enic->intr[ENIC_MSIX_RQ], diff --git a/drivers/net/enic/vnic_intr.h b/drivers/net/enic/vnic_intr.h index ce633a5..9a53604 100644 --- a/drivers/net/enic/vnic_intr.h +++ b/drivers/net/enic/vnic_intr.h @@ -76,6 +76,20 @@ static inline void vnic_intr_return_credits(struct vnic_intr *intr, iowrite32(int_credit_return, &intr->ctrl->int_credit_return); } +static inline unsigned int vnic_intr_credits(struct vnic_intr *intr) +{ + return ioread32(&intr->ctrl->int_credits); +} + +static inline void vnic_intr_return_all_credits(struct vnic_intr *intr) +{ + unsigned int credits = vnic_intr_credits(intr); + int unmask = 1; + int reset_timer = 1; + + vnic_intr_return_credits(intr, credits, unmask, reset_timer); +} + static inline u32 vnic_intr_legacy_pba(u32 __iomem *legacy_pba) { /* read PBA without clearing */