From patchwork Wed Feb 24 11:10:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil Kovvuri X-Patchwork-Id: 8405151 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9C5419F1D4 for ; Wed, 24 Feb 2016 11:09:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A8E1A202E6 for ; Wed, 24 Feb 2016 11:09:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A211C202D1 for ; Wed, 24 Feb 2016 11:09:32 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aYXIb-0003op-M3; Wed, 24 Feb 2016 11:08:05 +0000 Received: from mail-pf0-x229.google.com ([2607:f8b0:400e:c00::229]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aYXIY-0003mm-E1 for linux-arm-kernel@lists.infradead.org; Wed, 24 Feb 2016 11:08:03 +0000 Received: by mail-pf0-x229.google.com with SMTP id c10so11767194pfc.2 for ; Wed, 24 Feb 2016 03:07:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=ZImwEtzCU9aPBCqlpKuzGUPQD9MoAz/2sbbKYBkmESk=; b=XfzLmi6uAnLdtnOGv2cWh45hhhYv98YprSO1SLAwWBBiIjEKtlTNP+3rVzx7aU9RZT mQECYKC+Zjl90zNLootKpY17c88ZXMDhK0vYpfiZRtaS41gK9msVVU++mq5PB264VPYF XL2IzKzhsxxDuHSIFl3UemLxfg8+mC3KxaTGPM0G2ei/Fv0j6WNAT7J1PoaBbsDEjYrl pOJwuiPyFUMSiSn3adAQWrnBWFbCGXwvYEYihwH6Y4QsbgPCCGB4N1xjkr4IU+M8U5zJ JSs44CVi/fOPq0XwcZQ1T73ivPgOiAtdo2mNhVsTy/DwBfoF1Y6Y/llvf+xeLDweZ5BG mNhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ZImwEtzCU9aPBCqlpKuzGUPQD9MoAz/2sbbKYBkmESk=; b=lvs+Nkinzx9Tyo2zAcMA8QDGE4k+uBm3n2SPg3Yuyn0qO8j4Dbpn+7JLiBQOu5Mep8 fo8N8Zq174kTNJFG7KvIYghKxEPr8IhatheQtsa0lgk54ez5YpkgfOMJNIqVhxJN+wJ3 zqidcfvKDnS4wWZTbiDQVQr3n1ivS7ieGCaE1R/m4AcGbx8YAmXnjYMk0epZa4T5dshA UiCNun9x76iDvo/GB1BeoQF7e7IHSJwxH61BgnjWq8iUR88/nhRzZTClSW99+8kwjpR9 7OU7M3EvNXDyVJvog/VpMy88L/OrFvOn7SW4rxGPltpnWjyKTEpLnVrrLBeZdxVDzxf6 EzDA== X-Gm-Message-State: AG10YOR7PRJ/fLWb86uJkj9uQKrvz5YdwhX/w09BfxEQK8WOO6HOwOB7AkIxRn85OR1fmA== X-Received: by 10.98.68.212 with SMTP id m81mr53536410pfi.135.1456312061358; Wed, 24 Feb 2016 03:07:41 -0800 (PST) Received: from localhost.localdomain ([14.140.2.178]) by smtp.googlemail.com with ESMTPSA id w9sm4250021pfa.21.2016.02.24.03.07.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Feb 2016 03:07:40 -0800 (PST) From: sunil.kovvuri@gmail.com To: netdev@vger.kernel.org Subject: [PATCH] net: thunderx: Fix for Qset error due to CQ full Date: Wed, 24 Feb 2016 16:40:50 +0530 Message-Id: <1456312250-25694-1-git-send-email-sunil.kovvuri@gmail.com> X-Mailer: git-send-email 1.7.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160224_030802_564181_30B31B95 X-CRM114-Status: GOOD ( 15.12 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jerin.jacob@caviumnetworks.com, sgoutham@cavium.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, robert.richter@caviumnetworks.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sunil Goutham On Thunderx pass 1.x and pass2 due to a HW errata default CQ DROP_LEVEL of 0x80 is not sufficient to avoid CQ_WR_FULL Qset error when packets are being received at >20Mpps resulting in complete stall of packet reception. This patch will configure it to 0x100 which is what is expected by HW on Thunderx. On future passes of thunderx and other chips HW default/reset value will be 0x100 or higher hence not overwritten. Signed-off-by: Jerin Jacob Signed-off-by: Sunil Goutham --- drivers/net/ethernet/cavium/thunder/nic.h | 9 +++++++++ drivers/net/ethernet/cavium/thunder/nic_main.c | 6 ++++++ drivers/net/ethernet/cavium/thunder/nic_reg.h | 2 +- 3 files changed, 16 insertions(+), 1 deletions(-) diff --git a/drivers/net/ethernet/cavium/thunder/nic.h b/drivers/net/ethernet/cavium/thunder/nic.h index 6888288..34e9ace 100644 --- a/drivers/net/ethernet/cavium/thunder/nic.h +++ b/drivers/net/ethernet/cavium/thunder/nic.h @@ -116,6 +116,15 @@ #define NIC_PF_INTR_ID_MBOX0 8 #define NIC_PF_INTR_ID_MBOX1 9 +/* Minimum FIFO level before all packets for the CQ are dropped + * + * This value ensures that once a packet has been "accepted" + * for reception it will not get dropped due to non-availability + * of CQ descriptor. An errata in HW mandates this value to be + * atleast 0x100. + */ +#define NICPF_CQM_MIN_DROP_LEVEL 0x100 + /* Global timer for CQ timer thresh interrupts * Calculated for SCLK of 700Mhz * value written should be a 1/16th of what is expected diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c index 4dded90..95f17f8 100644 --- a/drivers/net/ethernet/cavium/thunder/nic_main.c +++ b/drivers/net/ethernet/cavium/thunder/nic_main.c @@ -304,6 +304,7 @@ static void nic_set_lmac_vf_mapping(struct nicpf *nic) static void nic_init_hw(struct nicpf *nic) { int i; + u64 cqm_cfg; /* Enable NIC HW block */ nic_reg_write(nic, NIC_PF_CFG, 0x3); @@ -340,6 +341,11 @@ static void nic_init_hw(struct nicpf *nic) /* Enable VLAN ethertype matching and stripping */ nic_reg_write(nic, NIC_PF_RX_ETYPE_0_7, (2 << 19) | (ETYPE_ALG_VLAN_STRIP << 16) | ETH_P_8021Q); + + /* Check if HW expected value is higher (could be in future chips) */ + cqm_cfg = nic_reg_read(nic, NIC_PF_CQM_CFG); + if (cqm_cfg < NICPF_CQM_MIN_DROP_LEVEL) + nic_reg_write(nic, NIC_PF_CQM_CFG, NICPF_CQM_MIN_DROP_LEVEL); } /* Channel parse index configuration */ diff --git a/drivers/net/ethernet/cavium/thunder/nic_reg.h b/drivers/net/ethernet/cavium/thunder/nic_reg.h index dd536be..afb10e3 100644 --- a/drivers/net/ethernet/cavium/thunder/nic_reg.h +++ b/drivers/net/ethernet/cavium/thunder/nic_reg.h @@ -21,7 +21,7 @@ #define NIC_PF_TCP_TIMER (0x0060) #define NIC_PF_BP_CFG (0x0080) #define NIC_PF_RRM_CFG (0x0088) -#define NIC_PF_CQM_CF (0x00A0) +#define NIC_PF_CQM_CFG (0x00A0) #define NIC_PF_CNM_CF (0x00A8) #define NIC_PF_CNM_STATUS (0x00B0) #define NIC_PF_CQ_AVG_CFG (0x00C0)