netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: sunil.kovvuri@gmail.com
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Zyta Szpak <zr@semihalf.com>, Sunil Goutham <sgoutham@cavium.com>
Subject: [PATCH v2 19/21] net: thunderx: Configure tunnelling protocol parsing
Date: Fri, 12 Aug 2016 16:51:42 +0530	[thread overview]
Message-ID: <1471000904-21715-20-git-send-email-sunil.kovvuri@gmail.com> (raw)
In-Reply-To: <1471000904-21715-1-git-send-email-sunil.kovvuri@gmail.com>

From: Zyta Szpak <zr@semihalf.com>

This patch enables parsing of inner layers for tunnelled packets.

Signed-off-by: Zyta Szpak <zr@semihalf.com>
Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
---
 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)
-- 
2.7.4

  parent reply	other threads:[~2016-08-12 11:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-12 11:21 [PATCH v2 00/21] net: thunderx: Support for newer chips and miscellaneous patches sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 01/21] net: thunderx: Moved HW capability info from macros to structure sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 02/21] net: thunderx: Add VNIC's PCI devid on future chips sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 03/21] net: thunderx: Add support for 81xx and 83xx chips sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 04/21] net: thunderx: Set queue count based on number of CPUs sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 05/21] net: thunderx: Enable CQE_RX desc's extension fields sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 06/21] net: thunderx: Enable mailbox interrupts on 81xx/83xx sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 07/21] net: thunderx: Support for different LMAC types within BGX sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 08/21] net: thunderx: Add 81xx support to BGX driver sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 09/21] net: thunderx: Add QSGMII interface type support sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 10/21] net: thunderx: Add RGMII " sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 11/21] net: thunderx: Add support for 16 LMACs of 83xx sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 12/21] net: thunderx: Support for 83xx mixed QLM/DLM config sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 13/21] net: thunderx: Use netdev's name for naming VF's interrupts sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 14/21] net: thunderx: Use skb_add_rx_frag() for split buffer Rx pkts sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 15/21] net: thunderx: Improvement for MBX interface debug messages sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 16/21] net: thunderx: Reset RXQ HW stats when interface is brought down sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 17/21] net: thunderx: Don't set mac address for secondary Qset VFs sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 18/21] net: thunderx: Use napi_consume_skb for bulk free sunil.kovvuri
2016-08-12 11:21 ` sunil.kovvuri [this message]
2016-08-12 11:21 ` [PATCH v2 20/21] net: thunderx: Use netdev_rss_key_fill() helper sunil.kovvuri
2016-08-12 11:21 ` [PATCH v2 21/21] net: thunderx: Don't set RX_PACKET_DIS while initializing sunil.kovvuri
2016-08-13 19:01 ` [PATCH v2 00/21] net: thunderx: Support for newer chips and miscellaneous patches David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1471000904-21715-20-git-send-email-sunil.kovvuri@gmail.com \
    --to=sunil.kovvuri@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sgoutham@cavium.com \
    --cc=zr@semihalf.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).