DPDK patches and discussions
 help / color / mirror / Atom feed
From: Leyi Rong <leyi.rong@intel.com>
To: xiaolong.ye@intel.com, qiming.yang@intel.com
Cc: dev@dpdk.org, Leyi Rong <leyi.rong@intel.com>,
	Kevin Scott <kevin.c.scott@intel.com>,
	Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Subject: [dpdk-dev] [PATCH 1/3] net/ice/base: add support for IPv6 based switch filters
Date: Wed, 26 Jun 2019 10:30:23 +0800	[thread overview]
Message-ID: <20190626023025.7039-2-leyi.rong@intel.com> (raw)
In-Reply-To: <20190626023025.7039-1-leyi.rong@intel.com>

- Add IPv6 switch rule support.
- Add IPv6 training packet.
- Correct name of IPv6 header variable.
- Fix enum values so that they point to the proper
  ice_prot_ext_tbl_entry field.

Signed-off-by: Kevin Scott <kevin.c.scott@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
---
 drivers/net/ice/base/ice_protocol_type.h | 16 ++---
 drivers/net/ice/base/ice_switch.c        | 87 +++++++++++++++++++++++-
 2 files changed, 93 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h
index 033efdb5a..368ab0d16 100644
--- a/drivers/net/ice/base/ice_protocol_type.h
+++ b/drivers/net/ice/base/ice_protocol_type.h
@@ -32,8 +32,8 @@ enum ice_protocol_type {
 	ICE_MAC_IL,
 	ICE_IPV4_OFOS,
 	ICE_IPV4_IL,
-	ICE_IPV6_IL,
 	ICE_IPV6_OFOS,
+	ICE_IPV6_IL,
 	ICE_TCP_IL,
 	ICE_UDP_OF,
 	ICE_UDP_ILOS,
@@ -200,13 +200,13 @@ struct ice_nvgre {
 };
 
 union ice_prot_hdr {
-		struct ice_ether_hdr eth_hdr;
-		struct ice_ipv4_hdr ipv4_hdr;
-		struct ice_ipv6_hdr ice_ipv6_ofos_hdr;
-		struct ice_l4_hdr l4_hdr;
-		struct ice_sctp_hdr sctp_hdr;
-		struct ice_udp_tnl_hdr tnl_hdr;
-		struct ice_nvgre nvgre_hdr;
+	struct ice_ether_hdr eth_hdr;
+	struct ice_ipv4_hdr ipv4_hdr;
+	struct ice_ipv6_hdr ipv6_hdr;
+	struct ice_l4_hdr l4_hdr;
+	struct ice_sctp_hdr sctp_hdr;
+	struct ice_udp_tnl_hdr tnl_hdr;
+	struct ice_nvgre nvgre_hdr;
 };
 
 /* This is mapping table entry that maps every word within a given protocol
diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index dbf4c5fb0..feacfa483 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -243,6 +243,73 @@ dummy_tcp_packet[] = {
 	0x00, 0x00,	/* 2 bytes for 4 byte alignment */
 };
 
+static const
+struct ice_dummy_pkt_offsets dummy_tcp_ipv6_packet_offsets[] = {
+	{ ICE_MAC_OFOS,		0 },
+	{ ICE_IPV6_OFOS,	14 },
+	{ ICE_TCP_IL,		54 },
+	{ ICE_PROTOCOL_LAST,	0 },
+};
+
+static const u8
+dummy_tcp_ipv6_packet[] = {
+	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x86, 0xDD,
+
+	0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 40 */
+	0x00, 0x14, 0x06, 0x00, /* Next header is TCP */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x00, 0x00, 0x00, 0x00, /* ICE_TCP_IL 54 */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x50, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x00, 0x00, /* 2 bytes for 4 byte alignment */
+};
+
+static const
+struct ice_dummy_pkt_offsets dummy_udp_ipv6_packet_offsets[] = {
+	{ ICE_MAC_OFOS,		0 },
+	{ ICE_IPV6_OFOS,	14 },
+	{ ICE_UDP_ILOS,		54 },
+	{ ICE_PROTOCOL_LAST,	0 },
+};
+
+static const u8
+dummy_udp_ipv6_packet[] = {
+	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x86, 0xDD,
+
+	0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 40 */
+	0x00, 0x08, 0x11, 0x00, /* Next header UDP*/
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x00, 0x00, 0x00, 0x00, /* ICE_UDP_ILOS 54 */
+	0x00, 0x08, 0x00, 0x00,
+
+	0x00, 0x00, /* 2 bytes for 4 byte alignment */
+};
+
 /* this is a recipe to profile bitmap association */
 static ice_declare_bitmap(recipe_to_profile[ICE_MAX_NUM_RECIPES],
 			  ICE_MAX_NUM_PROFILES);
@@ -5275,7 +5342,7 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 		      u16 *pkt_len,
 		      const struct ice_dummy_pkt_offsets **offsets)
 {
-	bool tcp = false, udp = false;
+	bool tcp = false, udp = false, ipv6 = false;
 	u16 i;
 
 	for (i = 0; i < lkups_cnt; i++) {
@@ -5283,6 +5350,8 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 			udp = true;
 		else if (lkups[i].type == ICE_TCP_IL)
 			tcp = true;
+		else if (lkups[i].type == ICE_IPV6_OFOS)
+			ipv6 = true;
 	}
 
 	if (tun_type == ICE_SW_TUN_NVGRE || tun_type == ICE_ALL_TUNNELS) {
@@ -5307,11 +5376,21 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 		return;
 	}
 
-	if (udp) {
+	if (udp && !ipv6) {
 		*pkt = dummy_udp_packet;
 		*pkt_len = sizeof(dummy_udp_packet);
 		*offsets = dummy_udp_packet_offsets;
 		return;
+	} else if (udp && ipv6) {
+		*pkt = dummy_udp_ipv6_packet;
+		*pkt_len = sizeof(dummy_udp_ipv6_packet);
+		*offsets = dummy_udp_ipv6_packet_offsets;
+		return;
+	} else if ((tcp && ipv6) || ipv6) {
+		*pkt = dummy_tcp_ipv6_packet;
+		*pkt_len = sizeof(dummy_tcp_ipv6_packet);
+		*offsets = dummy_tcp_ipv6_packet_offsets;
+		return;
 	}
 
 	*pkt = dummy_tcp_packet;
@@ -5375,6 +5454,10 @@ ice_fill_adv_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 		case ICE_IPV4_IL:
 			len = sizeof(struct ice_ipv4_hdr);
 			break;
+		case ICE_IPV6_OFOS:
+		case ICE_IPV6_IL:
+			len = sizeof(struct ice_ipv6_hdr);
+			break;
 		case ICE_TCP_IL:
 		case ICE_UDP_OF:
 		case ICE_UDP_ILOS:
-- 
2.17.1


  reply	other threads:[~2019-06-26  2:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-26  2:30 [dpdk-dev] [PATCH 0/3] some update on CVL shared code Leyi Rong
2019-06-26  2:30 ` Leyi Rong [this message]
2019-06-26  2:30 ` [dpdk-dev] [PATCH 2/3] net/ice/base: add support for ethertype switch filters Leyi Rong
2019-06-26  3:00   ` Zhao1, Wei
2019-06-26  2:30 ` [dpdk-dev] [PATCH 3/3] net/ice/base: fix inner L2 offset in GRE dummy packet Leyi Rong
2019-06-26  5:29 ` [dpdk-dev] [PATCH 0/3] some update on CVL shared code Yang, Qiming
2019-06-26  9:36   ` Zhao1, Wei
2019-06-27  2:05     ` Yang, Qiming
2019-07-01  5:04 ` [dpdk-dev] [PATCH v2 0/3] update ice code that were not working correctly Leyi Rong
2019-07-01  5:04   ` [dpdk-dev] [PATCH v2 1/3] net/ice/base: add support for IPv6 based switch filters Leyi Rong
2019-07-01  5:04   ` [dpdk-dev] [PATCH v2 2/3] net/ice/base: add support for ethertype " Leyi Rong
2019-07-01  5:04   ` [dpdk-dev] [PATCH v2 3/3] net/ice/base: fix inner L2 offset in GRE dummy packet Leyi Rong
2019-07-01  5:46   ` [dpdk-dev] [PATCH v2 0/3] update ice code that were not working correctly Zhang, Qi Z

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=20190626023025.7039-2-leyi.rong@intel.com \
    --to=leyi.rong@intel.com \
    --cc=dev@dpdk.org \
    --cc=kevin.c.scott@intel.com \
    --cc=paul.m.stillwell.jr@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=xiaolong.ye@intel.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).