dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
From: Leyi Rong <leyi.rong@intel.com>
To: qi.z.zhang@intel.com
Cc: dev@dpdk.org, Leyi Rong <leyi.rong@intel.com>,
	Dan Nowlin <dan.nowlin@intel.com>,
	Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Subject: [dpdk-dev] [PATCH v2 2/3] net/ice/base: add support for ethertype switch filters
Date: Mon,  1 Jul 2019 13:04:49 +0800	[thread overview]
Message-ID: <20190701050450.43330-3-leyi.rong@intel.com> (raw)
In-Reply-To: <20190701050450.43330-1-leyi.rong@intel.com>

Add protocol definitions for ethertype.
Add ice_ethtype_hdr structure definition into the ice_prot_hdr union.
Add ethtype offsets into the training packet maps.

Signed-off-by: Dan Nowlin <dan.nowlin@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Tested-by: Wei Zhao <wei.zhao1@intel.com>
---
 drivers/net/ice/base/ice_protocol_type.h |  6 +++++
 drivers/net/ice/base/ice_switch.c        | 34 ++++++++++++++++++------
 2 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h
index 368ab0d16..cfbe3fbfa 100644
--- a/drivers/net/ice/base/ice_protocol_type.h
+++ b/drivers/net/ice/base/ice_protocol_type.h
@@ -30,6 +30,7 @@
 enum ice_protocol_type {
 	ICE_MAC_OFOS = 0,
 	ICE_MAC_IL,
+	ICE_ETYPE_OL,
 	ICE_IPV4_OFOS,
 	ICE_IPV4_IL,
 	ICE_IPV6_OFOS,
@@ -108,6 +109,7 @@ enum ice_prot_id {
 
 #define ICE_MAC_OFOS_HW		1
 #define ICE_MAC_IL_HW		4
+#define ICE_ETYPE_OL_HW		9
 #define ICE_IPV4_OFOS_HW	32
 #define ICE_IPV4_IL_HW		33
 #define ICE_IPV6_OFOS_HW	40
@@ -140,6 +142,9 @@ struct ice_protocol_entry {
 struct ice_ether_hdr {
 	u8 dst_addr[ETH_ALEN];
 	u8 src_addr[ETH_ALEN];
+};
+
+struct ice_ethtype_hdr {
 	u16 ethtype_id;
 };
 
@@ -201,6 +206,7 @@ struct ice_nvgre {
 
 union ice_prot_hdr {
 	struct ice_ether_hdr eth_hdr;
+	struct ice_ethtype_hdr ethertype;
 	struct ice_ipv4_hdr ipv4_hdr;
 	struct ice_ipv6_hdr ipv6_hdr;
 	struct ice_l4_hdr l4_hdr;
diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index feacfa483..538829771 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -61,6 +61,7 @@ struct ice_dummy_pkt_offsets {
 static const
 struct ice_dummy_pkt_offsets dummy_gre_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
+	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV4_OFOS,	14 },
 	{ ICE_NVGRE,		34 },
 	{ ICE_MAC_IL,		42 },
@@ -72,7 +73,7 @@ static const
 u8 dummy_gre_packet[] = { 0, 0, 0, 0,		/* ICE_MAC_OFOS 0 */
 			  0, 0, 0, 0,
 			  0, 0, 0, 0,
-			  0x08, 0,
+			  0x08, 0,		/* ICE_ETYPE_OL 12 */
 			  0x45, 0, 0, 0x3E,	/* ICE_IPV4_OFOS 14 */
 			  0, 0, 0, 0,
 			  0, 0x2F, 0, 0,
@@ -94,6 +95,7 @@ u8 dummy_gre_packet[] = { 0, 0, 0, 0,		/* ICE_MAC_OFOS 0 */
 static const
 struct ice_dummy_pkt_offsets dummy_udp_tun_tcp_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
+	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV4_OFOS,	14 },
 	{ ICE_UDP_OF,		34 },
 	{ ICE_VXLAN,		42 },
@@ -108,7 +110,8 @@ u8 dummy_udp_tun_tcp_packet[] = {
 	0x00, 0x00, 0x00, 0x00,  /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
-	0x08, 0x00,
+
+	0x08, 0x00,		/* ICE_ETYPE_OL 12 */
 
 	0x45, 0x00, 0x00, 0x5a, /* ICE_IPV4_OFOS 14 */
 	0x00, 0x01, 0x00, 0x00,
@@ -143,6 +146,7 @@ u8 dummy_udp_tun_tcp_packet[] = {
 static const
 struct ice_dummy_pkt_offsets dummy_udp_tun_udp_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
+	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV4_OFOS,	14 },
 	{ ICE_UDP_OF,		34 },
 	{ ICE_VXLAN,		42 },
@@ -157,7 +161,8 @@ u8 dummy_udp_tun_udp_packet[] = {
 	0x00, 0x00, 0x00, 0x00,  /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
-	0x08, 0x00,
+
+	0x08, 0x00,		/* ICE_ETYPE_OL 12 */
 
 	0x45, 0x00, 0x00, 0x4e, /* ICE_IPV4_OFOS 14 */
 	0x00, 0x01, 0x00, 0x00,
@@ -189,6 +194,7 @@ u8 dummy_udp_tun_udp_packet[] = {
 static const
 struct ice_dummy_pkt_offsets dummy_udp_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
+	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV4_OFOS,	14 },
 	{ ICE_UDP_ILOS,		34 },
 	{ ICE_PROTOCOL_LAST,	0 },
@@ -199,7 +205,8 @@ dummy_udp_packet[] = {
 	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
-	0x08, 0x00,
+
+	0x08, 0x00,		/* ICE_ETYPE_OL 12 */
 
 	0x45, 0x00, 0x00, 0x1c, /* ICE_IPV4_OFOS 14 */
 	0x00, 0x01, 0x00, 0x00,
@@ -216,6 +223,7 @@ dummy_udp_packet[] = {
 static const
 struct ice_dummy_pkt_offsets dummy_tcp_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
+	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV4_OFOS,	14 },
 	{ ICE_TCP_IL,		34 },
 	{ ICE_PROTOCOL_LAST,	0 },
@@ -226,7 +234,8 @@ dummy_tcp_packet[] = {
 	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
-	0x08, 0x00,
+
+	0x08, 0x00,		/* ICE_ETYPE_OL 12 */
 
 	0x45, 0x00, 0x00, 0x28, /* ICE_IPV4_OFOS 14 */
 	0x00, 0x01, 0x00, 0x00,
@@ -246,6 +255,7 @@ dummy_tcp_packet[] = {
 static const
 struct ice_dummy_pkt_offsets dummy_tcp_ipv6_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
+	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV6_OFOS,	14 },
 	{ ICE_TCP_IL,		54 },
 	{ ICE_PROTOCOL_LAST,	0 },
@@ -256,7 +266,8 @@ dummy_tcp_ipv6_packet[] = {
 	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
-	0x86, 0xDD,
+
+	0x86, 0xDD,		/* ICE_ETYPE_OL 12 */
 
 	0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 40 */
 	0x00, 0x14, 0x06, 0x00, /* Next header is TCP */
@@ -281,6 +292,7 @@ dummy_tcp_ipv6_packet[] = {
 static const
 struct ice_dummy_pkt_offsets dummy_udp_ipv6_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
+	{ ICE_ETYPE_OL,		12 },
 	{ ICE_IPV6_OFOS,	14 },
 	{ ICE_UDP_ILOS,		54 },
 	{ ICE_PROTOCOL_LAST,	0 },
@@ -291,7 +303,8 @@ dummy_udp_ipv6_packet[] = {
 	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00,
-	0x86, 0xDD,
+
+	0x86, 0xDD,		/* ICE_ETYPE_OL 12 */
 
 	0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 40 */
 	0x00, 0x08, 0x11, 0x00, /* Next header UDP*/
@@ -4455,6 +4468,7 @@ ice_add_mac_with_counter(struct ice_hw *hw, struct ice_fltr_info *f_info)
 static const struct ice_prot_ext_tbl_entry ice_prot_ext[] = {
 	{ ICE_MAC_OFOS,		{ 0, 2, 4, 6, 8, 10, 12 } },
 	{ ICE_MAC_IL,		{ 0, 2, 4, 6, 8, 10, 12 } },
+	{ ICE_ETYPE_OL,		{ 0 } },
 	{ ICE_IPV4_OFOS,	{ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18 } },
 	{ ICE_IPV4_IL,		{ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18 } },
 	{ ICE_IPV6_IL,		{ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24,
@@ -4492,6 +4506,7 @@ static const struct ice_pref_recipe_group ice_recipe_pack[] = {
 static const struct ice_protocol_entry ice_prot_id_tbl[] = {
 	{ ICE_MAC_OFOS,		ICE_MAC_OFOS_HW },
 	{ ICE_MAC_IL,		ICE_MAC_IL_HW },
+	{ ICE_ETYPE_OL,		ICE_ETYPE_OL_HW },
 	{ ICE_IPV4_OFOS,	ICE_IPV4_OFOS_HW },
 	{ ICE_IPV4_IL,		ICE_IPV4_IL_HW },
 	{ ICE_IPV6_OFOS,	ICE_IPV6_OFOS_HW },
@@ -4618,7 +4633,7 @@ ice_fill_valid_words(struct ice_adv_lkup_elem *rule,
 
 	for (j = 0; j < sizeof(rule->m_u) / sizeof(u16); j++)
 		if (((u16 *)&rule->m_u)[j] &&
-		    rule->type < ARRAY_SIZE(ice_prot_ext)) {
+		    (unsigned long)rule->type < ARRAY_SIZE(ice_prot_ext)) {
 			/* No more space to accommodate */
 			if (word >= ICE_MAX_CHAIN_WORDS)
 				return 0;
@@ -5450,6 +5465,9 @@ ice_fill_adv_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
 		case ICE_MAC_IL:
 			len = sizeof(struct ice_ether_hdr);
 			break;
+		case ICE_ETYPE_OL:
+			len = sizeof(struct ice_ethtype_hdr);
+			break;
 		case ICE_IPV4_OFOS:
 		case ICE_IPV4_IL:
 			len = sizeof(struct ice_ipv4_hdr);
-- 
2.17.1


  parent reply	other threads:[~2019-07-01  5:06 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 ` [dpdk-dev] [PATCH 1/3] net/ice/base: add support for IPv6 based switch filters Leyi Rong
2019-06-26  2:30 ` [dpdk-dev] [PATCH 2/3] net/ice/base: add support for ethertype " 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   ` Leyi Rong [this message]
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=20190701050450.43330-3-leyi.rong@intel.com \
    --to=leyi.rong@intel.com \
    --cc=dan.nowlin@intel.com \
    --cc=dev@dpdk.org \
    --cc=paul.m.stillwell.jr@intel.com \
    --cc=qi.z.zhang@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).