From patchwork Mon Jun 27 10:00:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil Kovvuri X-Patchwork-Id: 9200243 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D08AB60757 for ; Mon, 27 Jun 2016 10:02:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C051D2857D for ; Mon, 27 Jun 2016 10:02:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3B6828582; Mon, 27 Jun 2016 10:02:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id B46372857D for ; Mon, 27 Jun 2016 10:02:22 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bHTLs-0007Ik-2T; Mon, 27 Jun 2016 10:01:12 +0000 Received: from mail-pa0-x242.google.com ([2607:f8b0:400e:c03::242]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bHTLp-00077f-US for linux-arm-kernel@lists.infradead.org; Mon, 27 Jun 2016 10:01:10 +0000 Received: by mail-pa0-x242.google.com with SMTP id hf6so14967458pac.2 for ; Mon, 27 Jun 2016 03:00:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=S153XjNpmPhqiJYyK2LqwisG1XYGFR2nHSqP+t8zR+I=; b=cj8VKt6jV5qF6pk0VqQHg6CJLggNaP1qRFZUD4kLvFa7y1V1IbE/o/wFAbyVWK8TBK /MUxygOkDQlnDoR+pSgF92NLbmRhz6rM5f09YdCx8tJ7pRpj658ge+53epWqFWVrcnR+ 9Ix8rHOvKLZz/xHUHJ7m4zqmtj02Tvzn0evk2p3kDjwsPl6wAfC0m4bWzyVi3NJFn80M wNqRCLAMLHQKzVMP/vzYmL0rVWlUmpV3OOBYQGBxKU2cMdrCNlYAEU/7A2FKFQyFXvge 1aspgLY7ikrOFCNln+UY89KX4Ms19hRua7308YI9ZfXqx4KDDpDgs767+HGLKvr9/JC5 LNqg== 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:in-reply-to :references; bh=S153XjNpmPhqiJYyK2LqwisG1XYGFR2nHSqP+t8zR+I=; b=R57K7lLiP6KtETL8wgo8Mwu303Qlc9PxSb/wa7inHJC1c0IetQZEEm8MVb3BBGEOFU 5Qlsm/3UDferiXXb2T5rzY23aPk3fT/C+KS68dgl4duBwx5/wEzJ9/GXl+KmNFqffRli BcbdAdlyESNzF1ZYi1u+uDKz2RqOomrLh+cSx3kw5+Iht4wsZHXdgyowsTN1CXelm7mH Pva7W0+6QHz/7DentjjOsdF1vsPfZz2X7KhkLCFmVEnw0qC9545QuwBTMll3WF3og3hl UXDf0xB1mkxYSrCNo2HdlwutH4Io3yxDlSxcolelNLTCl+2gJkjnwPzSYtAa5Tm5TwqU oN0A== X-Gm-Message-State: ALyK8tI8YekbgYe+Ik+JhpKO2IwcnVloiwYMRJn0DJFDBcnfT5QH9odZ3RaJIRMzps+pgQ== X-Received: by 10.66.54.35 with SMTP id g3mr32988018pap.30.1467021648090; Mon, 27 Jun 2016 03:00:48 -0700 (PDT) Received: from machine421.in.caveonetworks.com ([14.140.2.178]) by smtp.googlemail.com with ESMTPSA id a188sm5323668pfa.70.2016.06.27.03.00.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Jun 2016 03:00:47 -0700 (PDT) From: sunil.kovvuri@gmail.com To: netdev@vger.kernel.org Subject: [PATCH v2 2/2] net: thunderx: Fix TL4 configuration for secondary Qsets Date: Mon, 27 Jun 2016 15:30:03 +0530 Message-Id: <1467021603-26226-3-git-send-email-sunil.kovvuri@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1467021603-26226-1-git-send-email-sunil.kovvuri@gmail.com> References: <1467021603-26226-1-git-send-email-sunil.kovvuri@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160627_030110_008857_6E96FD72 X-CRM114-Status: GOOD ( 13.62 ) 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: Sunil Goutham , Naveen.Reddy@cavium.com, robert.richter@caviumnetworks.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sunil Goutham TL4 calculation for a given SQ of secondary Qsets is incorrect and goes out of bounds and also for some SQ's TL4 chosen will transmit data via a different BGX interface and not same as primary Qset's interface. This patch fixes this issue. Signed-off-by: Sunil Goutham --- drivers/net/ethernet/cavium/thunder/nic_main.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c index 95f17f8..16ed203 100644 --- a/drivers/net/ethernet/cavium/thunder/nic_main.c +++ b/drivers/net/ethernet/cavium/thunder/nic_main.c @@ -499,6 +499,7 @@ static void nic_tx_channel_cfg(struct nicpf *nic, u8 vnic, u32 rr_quantum; u8 sq_idx = sq->sq_num; u8 pqs_vnic; + int svf; if (sq->sqs_mode) pqs_vnic = nic->pqs_vf[vnic]; @@ -511,10 +512,19 @@ static void nic_tx_channel_cfg(struct nicpf *nic, u8 vnic, /* 24 bytes for FCS, IPG and preamble */ rr_quantum = ((NIC_HW_MAX_FRS + 24) / 4); - tl4 = (lmac * NIC_TL4_PER_LMAC) + (bgx * NIC_TL4_PER_BGX); + if (!sq->sqs_mode) { + tl4 = (lmac * NIC_TL4_PER_LMAC) + (bgx * NIC_TL4_PER_BGX); + } else { + for (svf = 0; svf < MAX_SQS_PER_VF; svf++) { + if (nic->vf_sqs[pqs_vnic][svf] == vnic) + break; + } + tl4 = (MAX_LMAC_PER_BGX * NIC_TL4_PER_LMAC); + tl4 += (lmac * NIC_TL4_PER_LMAC * MAX_SQS_PER_VF); + tl4 += (svf * NIC_TL4_PER_LMAC); + tl4 += (bgx * NIC_TL4_PER_BGX); + } tl4 += sq_idx; - if (sq->sqs_mode) - tl4 += vnic * 8; tl3 = tl4 / (NIC_MAX_TL4 / NIC_MAX_TL3); nic_reg_write(nic, NIC_PF_QSET_0_127_SQ_0_7_CFG2 |