DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/ice/base: support MPLS ethertype switch filter
@ 2021-03-29  5:49 Alvin Zhang
  2021-07-13  2:35 ` [dpdk-dev] [PATCH v2] " Alvin Zhang
  0 siblings, 1 reply; 3+ messages in thread
From: Alvin Zhang @ 2021-03-29  5:49 UTC (permalink / raw)
  To: qiming.yang, qi.z.zhang; +Cc: dev

Add MPLS training packet and offsets.
Add check if the type is MPLS for ethertype filters.

For example:
   flow create 0 ingress pattern eth dst is 00:11:22:33:44:55
   type is 0x8847 / end actions queue index 2 / end

This flow will result in all the matched ingress packets be
forwarded to queue 2.

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
---
 drivers/net/ice/base/ice_switch.c | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 3dc7642..5a64cb7 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -15,6 +15,7 @@
 #define ICE_IPV6_ETHER_ID		0x86DD
 #define ICE_TCP_PROTO_ID		0x06
 #define ICE_ETH_P_8021Q			0x8100
+#define ICE_MPLS_ETHER_ID		0x8847
 
 /* Dummy ethernet header needed in the ice_aqc_sw_rules_elem
  * struct to configure any switch filter rules.
@@ -319,6 +320,25 @@ struct ice_dummy_pkt_offsets {
 	0x00, 0x00,	/* 2 bytes for 4 byte alignment */
 };
 
+/* offset info for MAC + MPLS dummy packet */
+static const struct ice_dummy_pkt_offsets dummy_mpls_packet_offsets[] = {
+	{ ICE_MAC_OFOS,		0 },
+	{ ICE_ETYPE_OL,		12 },
+	{ ICE_PROTOCOL_LAST,	0 },
+};
+
+/* Dummy packet for MAC + MPLS */
+static const u8 dummy_mpls_packet[] = {
+	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x88, 0x47,		/* ICE_ETYPE_OL 12 */
+	0x00, 0x00, 0x01, 0x00,
+
+	0x00, 0x00,	/* 2 bytes for 4 byte alignment */
+};
+
 /* offset info for MAC + VLAN (C-tag, 802.1Q) + IPv4 + TCP dummy packet */
 static const struct ice_dummy_pkt_offsets dummy_vlan_tcp_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
@@ -7727,7 +7747,7 @@ bool ice_is_prof_rule(enum ice_sw_tunnel_type type)
 		      const struct ice_dummy_pkt_offsets **offsets)
 {
 	bool tcp = false, udp = false, ipv6 = false, vlan = false;
-	bool gre = false;
+	bool gre = false, mpls = false;
 	u16 i;
 
 	for (i = 0; i < lkups_cnt; i++) {
@@ -7763,6 +7783,11 @@ bool ice_is_prof_rule(enum ice_sw_tunnel_type type)
 			 lkups[i].m_u.ipv4_hdr.protocol ==
 				0xFF)
 			tcp = true;
+		else if (lkups[i].type == ICE_ETYPE_OL &&
+			 lkups[i].h_u.ethertype.ethtype_id ==
+				CPU_TO_BE16(ICE_MPLS_ETHER_ID) &&
+			 lkups[i].m_u.ethertype.ethtype_id == 0xFFFF)
+			mpls = true;
 	}
 
 	if ((tun_type == ICE_SW_TUN_AND_NON_TUN_QINQ ||
@@ -8058,6 +8083,10 @@ bool ice_is_prof_rule(enum ice_sw_tunnel_type type)
 		*pkt = dummy_vlan_tcp_packet;
 		*pkt_len = sizeof(dummy_vlan_tcp_packet);
 		*offsets = dummy_vlan_tcp_packet_offsets;
+	}  else if (mpls) {
+		*pkt = dummy_mpls_packet;
+		*pkt_len = sizeof(dummy_mpls_packet);
+		*offsets = dummy_mpls_packet_offsets;
 	} else {
 		*pkt = dummy_tcp_packet;
 		*pkt_len = sizeof(dummy_tcp_packet);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dpdk-dev] [PATCH v2] net/ice/base: support MPLS ethertype switch filter
  2021-03-29  5:49 [dpdk-dev] [PATCH] net/ice/base: support MPLS ethertype switch filter Alvin Zhang
@ 2021-07-13  2:35 ` Alvin Zhang
  2021-07-13  3:04   ` Zhang, Qi Z
  0 siblings, 1 reply; 3+ messages in thread
From: Alvin Zhang @ 2021-07-13  2:35 UTC (permalink / raw)
  To: qi.z.zhang; +Cc: dev, Alvin Zhang

Add MPLS training packet and offsets.
Add check to identify MPLS ethertype filters.

For example:
testpmd> flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 \
         type is 0x8847 / end actions queue index 2 / end

This flow will result in all the matched ingress packets be
forwarded to queue 2.

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
---
 drivers/net/ice/base/ice_switch.c | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 229b355..5926635 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -16,6 +16,7 @@
 #define ICE_TCP_PROTO_ID		0x06
 #define ICE_GTPU_PROFILE		24
 #define ICE_ETH_P_8021Q			0x8100
+#define ICE_MPLS_ETHER_ID		0x8847
 
 /* Dummy ethernet header needed in the ice_aqc_sw_rules_elem
  * struct to configure any switch filter rules.
@@ -320,6 +321,25 @@ struct ice_dummy_pkt_offsets {
 	0x00, 0x00,	/* 2 bytes for 4 byte alignment */
 };
 
+/* offset info for MAC + MPLS dummy packet */
+static const struct ice_dummy_pkt_offsets dummy_mpls_packet_offsets[] = {
+	{ ICE_MAC_OFOS,		0 },
+	{ ICE_ETYPE_OL,		12 },
+	{ ICE_PROTOCOL_LAST,	0 },
+};
+
+/* Dummy packet for MAC + MPLS */
+static const u8 dummy_mpls_packet[] = {
+	0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */
+	0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+
+	0x88, 0x47,		/* ICE_ETYPE_OL 12 */
+	0x00, 0x00, 0x01, 0x00,
+
+	0x00, 0x00,	/* 2 bytes for 4 byte alignment */
+};
+
 /* offset info for MAC + VLAN (C-tag, 802.1Q) + IPv4 + TCP dummy packet */
 static const struct ice_dummy_pkt_offsets dummy_vlan_tcp_packet_offsets[] = {
 	{ ICE_MAC_OFOS,		0 },
@@ -7857,7 +7877,7 @@ bool ice_is_prof_rule(enum ice_sw_tunnel_type type)
 		      const struct ice_dummy_pkt_offsets **offsets)
 {
 	bool tcp = false, udp = false, ipv6 = false, vlan = false;
-	bool gre = false;
+	bool gre = false, mpls = false;
 	u16 i;
 
 	for (i = 0; i < lkups_cnt; i++) {
@@ -7893,6 +7913,11 @@ bool ice_is_prof_rule(enum ice_sw_tunnel_type type)
 			 lkups[i].m_u.ipv4_hdr.protocol ==
 				0xFF)
 			tcp = true;
+		else if (lkups[i].type == ICE_ETYPE_OL &&
+			 lkups[i].h_u.ethertype.ethtype_id ==
+				CPU_TO_BE16(ICE_MPLS_ETHER_ID) &&
+			 lkups[i].m_u.ethertype.ethtype_id == 0xFFFF)
+			mpls = true;
 	}
 
 	if ((tun_type == ICE_SW_TUN_AND_NON_TUN_QINQ ||
@@ -8263,6 +8288,10 @@ bool ice_is_prof_rule(enum ice_sw_tunnel_type type)
 		*pkt = dummy_vlan_tcp_packet;
 		*pkt_len = sizeof(dummy_vlan_tcp_packet);
 		*offsets = dummy_vlan_tcp_packet_offsets;
+	}  else if (mpls) {
+		*pkt = dummy_mpls_packet;
+		*pkt_len = sizeof(dummy_mpls_packet);
+		*offsets = dummy_mpls_packet_offsets;
 	} else {
 		*pkt = dummy_tcp_packet;
 		*pkt_len = sizeof(dummy_tcp_packet);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/ice/base: support MPLS ethertype switch filter
  2021-07-13  2:35 ` [dpdk-dev] [PATCH v2] " Alvin Zhang
@ 2021-07-13  3:04   ` Zhang, Qi Z
  0 siblings, 0 replies; 3+ messages in thread
From: Zhang, Qi Z @ 2021-07-13  3:04 UTC (permalink / raw)
  To: Zhang, AlvinX; +Cc: dev



> -----Original Message-----
> From: Zhang, AlvinX <alvinx.zhang@intel.com>
> Sent: Tuesday, July 13, 2021 10:36 AM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>
> Subject: [PATCH v2] net/ice/base: support MPLS ethertype switch filter
> 
> Add MPLS training packet and offsets.
> Add check to identify MPLS ethertype filters.
> 
> For example:
> testpmd> flow create 0 ingress pattern eth dst is 00:11:22:33:44:55 \
>          type is 0x8847 / end actions queue index 2 / end
> 
> This flow will result in all the matched ingress packets be forwarded to queue 2.
> 
> Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-13  3:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29  5:49 [dpdk-dev] [PATCH] net/ice/base: support MPLS ethertype switch filter Alvin Zhang
2021-07-13  2:35 ` [dpdk-dev] [PATCH v2] " Alvin Zhang
2021-07-13  3:04   ` Zhang, Qi Z

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).