From patchwork Wed Aug 10 06:42:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil Kovvuri X-Patchwork-Id: 9272737 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 C364F600CA for ; Wed, 10 Aug 2016 06:53:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4B6E27FBC for ; Wed, 10 Aug 2016 06:53:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9952C2832B; Wed, 10 Aug 2016 06:53:58 +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=-2.7 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_BL_SPAMCOP_NET,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 1C26127FBC for ; Wed, 10 Aug 2016 06:53:58 +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 1bXNNG-0004TS-CZ; Wed, 10 Aug 2016 06:52:22 +0000 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bXNGY-0004w1-VV for linux-arm-kernel@lists.infradead.org; Wed, 10 Aug 2016 06:45:31 +0000 Received: by mail-pf0-x243.google.com with SMTP id y134so2276978pfg.3 for ; Tue, 09 Aug 2016 23:45:06 -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=4EwcyI+iDJ6O7sT0oLXg1vam8E7CvA0biLWZUcMlTwU=; b=GvtTnZLm96MjrNnIg9+PwFD7B6TaP6GPKdEOHOXUiz76EFziWkdjEfCI6+NcvaUoHt On03X7dSJo2D4rI5kcrCquZV3HT4e8OVSgc+lVfOZ6bILqeoxUInv1NasEC2rDX2/BVZ 7rjOWbb+m72l3WQUp8YO9YweDF4bu8L5H6VsNI7CH2kGS4x0Q/nxddCCC/keECdAhivq f6x6wQzE8KiES/iDUI0uZJRiHQYd0TO+Pxybc9mm6k94vtf8MopzoqJdpAE58w+CFe0f WkMgesWDW3rTZzRRLMqgb+ziimXQ5WMAh1gerbqf0LtEmyGm43R5njel+LJqtXmTQqsL JaIg== 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=4EwcyI+iDJ6O7sT0oLXg1vam8E7CvA0biLWZUcMlTwU=; b=MmoBtAeHnyaAiUIQNRSpe5OQdefv6uO/RA0pwuxEa+s2xsZudnBEP0DR6ZM856ue3j JzJNLf34KuoHIXbbba9WMqEWMHRBTOaI0C6dnQL88Qjfi9y2wnX1RMYpm+pvB+dWDLum SVvEHnOl3hR8oNBhhxrAjituwivwEPBbf3XvAXsLm+n75UDVS0C5Nrajvx7hbqllw08q s8whT9MMoXl8+YKhAFOFYecA9Uei6q3O3ilJGV9uwa0OofcyoEHHHdc7t9mQeg3WMCfm YfxoAejc956tvdUGa4steamgcF2ZKiH9gL7mMYLeX7965zAZ7CYjn45VgUmWmzqaqWsC EhRg== X-Gm-Message-State: AEkoouso8OsMp2hBzbGZYVaYN3vrlI9IqS9QbxPvyn/skFEo3jktFnwwPnh//+nNz2iVDQ== X-Received: by 10.98.71.91 with SMTP id u88mr4251119pfa.145.1470811505964; Tue, 09 Aug 2016 23:45:05 -0700 (PDT) Received: from machine421.in.caveonetworks.com ([14.140.2.178]) by smtp.googlemail.com with ESMTPSA id lf11sm60825780pab.17.2016.08.09.23.45.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Aug 2016 23:45:05 -0700 (PDT) From: sunil.kovvuri@gmail.com To: netdev@vger.kernel.org Subject: [PATCH 19/21] net: thunderx: Configure tunnelling protocol parsing Date: Wed, 10 Aug 2016 12:12:51 +0530 Message-Id: <1470811373-28277-20-git-send-email-sunil.kovvuri@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1470811373-28277-1-git-send-email-sunil.kovvuri@gmail.com> References: <1470811373-28277-1-git-send-email-sunil.kovvuri@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160809_234527_318478_60725900 X-CRM114-Status: GOOD ( 10.39 ) 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 , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Zyta Szpak 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: Zyta Szpak This patch enables parsing of inner layers for tunnelled packets. Signed-off-by: Zyta Szpak Signed-off-by: Sunil Goutham --- drivers/net/ethernet/cavium/thunder/nic_main.c | 21 +++++++++++++++++++++ drivers/net/ethernet/cavium/thunder/nic_reg.h | 13 +++++++++++++ 2 files changed, 34 insertions(+) diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c index 167291b..25618d2 100644 --- a/drivers/net/ethernet/cavium/thunder/nic_main.c +++ b/drivers/net/ethernet/cavium/thunder/nic_main.c @@ -835,6 +835,25 @@ static int nic_reset_stat_counters(struct nicpf *nic, return 0; } +static void nic_enable_tunnel_parsing(struct nicpf *nic, int vf) +{ + u64 prot_def = (IPV6_PROT << 32) | (IPV4_PROT << 16) | ET_PROT; + u64 vxlan_prot_def = (IPV6_PROT_DEF << 32) | + (IPV4_PROT_DEF) << 16 | ET_PROT_DEF; + + /* Configure tunnel parsing parameters */ + nic_reg_write(nic, NIC_PF_RX_GENEVE_DEF, + (1ULL << 63 | UDP_GENEVE_PORT_NUM)); + nic_reg_write(nic, NIC_PF_RX_GENEVE_PROT_DEF, + ((7ULL << 61) | prot_def)); + nic_reg_write(nic, NIC_PF_RX_NVGRE_PROT_DEF, + ((7ULL << 61) | prot_def)); + nic_reg_write(nic, NIC_PF_RX_VXLAN_DEF_0_1, + ((1ULL << 63) | UDP_VXLAN_PORT_NUM)); + nic_reg_write(nic, NIC_PF_RX_VXLAN_PROT_DEF, + ((0xfULL << 60) | vxlan_prot_def)); +} + static void nic_enable_vf(struct nicpf *nic, int vf, bool enable) { int bgx, lmac; @@ -908,6 +927,8 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf) */ if (pass2_silicon(nic->pdev)) nic_reg_write(nic, NIC_PF_RX_CFG, 0x01); + if (!pass1_silicon(nic->pdev)) + nic_enable_tunnel_parsing(nic, vf); break; case NIC_MBOX_MSG_RQ_BP_CFG: reg_addr = NIC_PF_QSET_0_127_RQ_0_7_BP_CFG | diff --git a/drivers/net/ethernet/cavium/thunder/nic_reg.h b/drivers/net/ethernet/cavium/thunder/nic_reg.h index b4a7953..db9c632 100644 --- a/drivers/net/ethernet/cavium/thunder/nic_reg.h +++ b/drivers/net/ethernet/cavium/thunder/nic_reg.h @@ -36,6 +36,19 @@ #define NIC_PF_MAILBOX_ENA_W1C (0x0450) #define NIC_PF_MAILBOX_ENA_W1S (0x0470) #define NIC_PF_RX_ETYPE_0_7 (0x0500) +#define NIC_PF_RX_GENEVE_DEF (0x0580) +#define UDP_GENEVE_PORT_NUM 0x17C1ULL +#define NIC_PF_RX_GENEVE_PROT_DEF (0x0588) +#define IPV6_PROT 0x86DDULL +#define IPV4_PROT 0x800ULL +#define ET_PROT 0x6558ULL +#define NIC_PF_RX_NVGRE_PROT_DEF (0x0598) +#define NIC_PF_RX_VXLAN_DEF_0_1 (0x05A0) +#define UDP_VXLAN_PORT_NUM 0x12B5 +#define NIC_PF_RX_VXLAN_PROT_DEF (0x05B0) +#define IPV6_PROT_DEF 0x2ULL +#define IPV4_PROT_DEF 0x1ULL +#define ET_PROT_DEF 0x3ULL #define NIC_PF_RX_CFG (0x05D0) #define NIC_PF_PKIND_0_15_CFG (0x0600) #define NIC_PF_ECC0_FLIP0 (0x1000)