From patchwork Fri Aug 12 11:21:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil Kovvuri X-Patchwork-Id: 9276807 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 8AB02600CB for ; Fri, 12 Aug 2016 11:32:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A34D28996 for ; Fri, 12 Aug 2016 11:32:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6EF0A2899A; Fri, 12 Aug 2016 11:32:06 +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=unavailable 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 F22C028996 for ; Fri, 12 Aug 2016 11:32:05 +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 1bYAfW-0003so-8c; Fri, 12 Aug 2016 11:30:30 +0000 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bYAYq-0004TR-TM for linux-arm-kernel@lists.infradead.org; Fri, 12 Aug 2016 11:23:41 +0000 Received: by mail-pf0-x242.google.com with SMTP id y134so1415717pfg.3 for ; Fri, 12 Aug 2016 04:23:16 -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=k+BAd090vKs2dyQCXWV/HV53Y/MqkdPJbaUi1S382gSLxtKgF/gf7Mq75yvAIkjtZy 3gsMTzqNfkzyYL0nrZHvRUg+prxzpRZLGe4ItFxEUWlCGszJEcCQHNZ5lyqzygyM2Cwb r8EVUW/NOoJJ85m4mWr/bIZYSYTw5w9Khbekzgy4MP7aslmP4ORbEls79dJFS7BNWTpm z3nWXwf6EETsp2LRx5wZGoYJzzxrNc07+957Cjhw5HyB7VWz6R0a8Rvj0a+fuQh/l1+m /gARl37c7Z3CIKWXqhehZPSh6sFal13etAd257nVV40KOo377twAr3h1pC+xNw3f0TAy RGKw== 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=T14G69T9WqkXLc+ZepH9Ux26pWfzZl+Bf4Xw12IfnHv570kWt9/V2rE4w412R/myXr /ZrXmZhwnjzQs+2sCTN9568RE+wr/3j64r0TOfODnHPC9Ayszs8hJiwk5WYg3XoBzDk8 BSygJ+s/rGWN7SZyw+ua+l/OVy9lWYgtuenVZsYx4+Q6UH3+c1J86iU3yZ9N8NrlRyOw LHADUqLLx7FuwjjJ3EEwiyt2ggzfpcwbHpfMl5ly9jgtnjx5gOsSOe/YTR8WCpx0cbYA pifzr9avCG9RPV6UTs1YtVs8YY5KMqTYlpvmfDpCdhrbDcQwJ0vE7GVCtoNHYHDdQ0pQ Appg== X-Gm-Message-State: AEkoouv5Df7c/8xJ3pIeZfjZZMQ//mlZyS8VEvP+qJbRIg/A2aSpE1bmzfFtp+BcDbBwfg== X-Received: by 10.98.108.3 with SMTP id h3mr26173417pfc.162.1471000996035; Fri, 12 Aug 2016 04:23:16 -0700 (PDT) Received: from machine421.in.caveonetworks.com ([14.140.2.178]) by smtp.googlemail.com with ESMTPSA id ww14sm12306817pac.34.2016.08.12.04.23.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Aug 2016 04:23:15 -0700 (PDT) From: sunil.kovvuri@gmail.com To: netdev@vger.kernel.org Subject: [PATCH v2 19/21] net: thunderx: Configure tunnelling protocol parsing Date: Fri, 12 Aug 2016 16:51:42 +0530 Message-Id: <1471000904-21715-20-git-send-email-sunil.kovvuri@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1471000904-21715-1-git-send-email-sunil.kovvuri@gmail.com> References: <1471000904-21715-1-git-send-email-sunil.kovvuri@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160812_042337_243875_32B0ADB1 X-CRM114-Status: GOOD ( 10.26 ) 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)