DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] ip_pipeline: add QinQ PPPoE encapsulation action
@ 2019-01-14 10:02 Marjanovic,Nemanja
  2019-01-14 10:23 ` [dpdk-dev] [PATCH v2] " Marjanovic,Nemanja
  0 siblings, 1 reply; 20+ messages in thread
From: Marjanovic,Nemanja @ 2019-01-14 10:02 UTC (permalink / raw)
  To: dev; +Cc: jasvinder.singh, cristian.dumitrescu, Marjanovic,Nemanja

Add implementation of QinQ PPPoE packet encapsulation action.

Signed-off-by: Nemanja Marjanovic <nemanja.marjanovic@intel.com>
---
 examples/ip_pipeline/cli.c             | 43 +++++++++++++++++-
 lib/librte_net/rte_ether.h             |  1 +
 lib/librte_pipeline/rte_table_action.c | 61 ++++++++++++++++++++++++++
 lib/librte_pipeline/rte_table_action.h | 16 +++++++
 4 files changed, 119 insertions(+), 2 deletions(-)

diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
index 910386282..dcc98ee65 100644
--- a/examples/ip_pipeline/cli.c
+++ b/examples/ip_pipeline/cli.c
@@ -1290,11 +1290,13 @@ cmd_table_action_profile(char **tokens,
 
 			p.encap.encap_mask = 1LLU << RTE_TABLE_ACTION_ENCAP_VXLAN;
 			n_extra_tokens = 5;
-		} else {
+		} else if (strcmp(tokens[t0 + 1], "qinq_pppoe") == 0)
+			p.encap.encap_mask =
+				1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE;
+		else {
 			snprintf(out, out_size, MSG_ARG_MISMATCH, "encap");
 			return;
 		}
-
 		p.action_mask |= 1LLU << RTE_TABLE_ACTION_ENCAP;
 		t0 += 2 + n_extra_tokens;
 	} /* encap */
@@ -3391,6 +3393,43 @@ parse_table_action_encap(char **tokens,
 		return 1 + 9;
 	}
 
+	/* qinq_pppoe */
+		if (n_tokens && (strcmp(tokens[0], "qinq_pppoe") == 0)) {
+			uint32_t svlan_pcp, svlan_dei, svlan_vid;
+			uint32_t cvlan_pcp, cvlan_dei, cvlan_vid;
+
+		if ((n_tokens < 10) ||
+			parse_mac_addr(tokens[1],
+				&a->encap.qinq_pppoe.ether.da) ||
+			parse_mac_addr(tokens[2],
+				&a->encap.qinq_pppoe.ether.sa) ||
+			parser_read_uint32(&svlan_pcp, tokens[3]) ||
+			(svlan_pcp > 0x7) ||
+			parser_read_uint32(&svlan_dei, tokens[4]) ||
+			(svlan_dei > 0x1) ||
+			parser_read_uint32(&svlan_vid, tokens[5]) ||
+			(svlan_vid > 0xFFF) ||
+			parser_read_uint32(&cvlan_pcp, tokens[6]) ||
+			(cvlan_pcp > 0x7) ||
+			parser_read_uint32(&cvlan_dei, tokens[7]) ||
+			(cvlan_dei > 0x1) ||
+			parser_read_uint32(&cvlan_vid, tokens[8]) ||
+			(cvlan_vid > 0xFFF) ||
+			parser_read_uint16(&a->encap.qinq_pppoe.pppoe.session_id,
+				tokens[9]))
+			return 0;
+
+		a->encap.qinq_pppoe.svlan.pcp = svlan_pcp & 0x7;
+		a->encap.qinq_pppoe.svlan.dei = svlan_dei & 0x1;
+		a->encap.qinq_pppoe.svlan.vid = svlan_vid & 0xFFF;
+		a->encap.qinq_pppoe.cvlan.pcp = cvlan_pcp & 0x7;
+		a->encap.qinq_pppoe.cvlan.dei = cvlan_dei & 0x1;
+		a->encap.qinq_pppoe.cvlan.vid = cvlan_vid & 0xFFF;
+		a->encap.type = RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE;
+		a->action_mask |= 1 << RTE_TABLE_ACTION_ENCAP;
+		return 1 + 10;
+		}
+
 	/* mpls */
 	if (n_tokens && (strcmp(tokens[0], "mpls") == 0)) {
 		uint32_t label, tc, ttl;
diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
index c2c5e249f..212ead64a 100644
--- a/lib/librte_net/rte_ether.h
+++ b/lib/librte_net/rte_ether.h
@@ -300,6 +300,7 @@ struct vxlan_hdr {
 #define ETHER_TYPE_ARP  0x0806 /**< Arp Protocol. */
 #define ETHER_TYPE_RARP 0x8035 /**< Reverse Arp Protocol. */
 #define ETHER_TYPE_VLAN 0x8100 /**< IEEE 802.1Q VLAN tagging. */
+#define ETHER_TYPE_PPPoE 0x8864 /**< PPPoE Session Stage */
 #define ETHER_TYPE_QINQ 0x88A8 /**< IEEE 802.1ad QinQ tagging. */
 #define ETHER_TYPE_ETAG 0x893F /**< IEEE 802.1BR E-Tag. */
 #define ETHER_TYPE_1588 0x88F7 /**< IEEE 802.1AS 1588 Precise Time Protocol. */
diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c
index 7c7c8dd82..78cc7a7a2 100644
--- a/lib/librte_pipeline/rte_table_action.c
+++ b/lib/librte_pipeline/rte_table_action.c
@@ -432,6 +432,7 @@ encap_valid(enum rte_table_action_encap_type encap)
 	case RTE_TABLE_ACTION_ENCAP_MPLS:
 	case RTE_TABLE_ACTION_ENCAP_PPPOE:
 	case RTE_TABLE_ACTION_ENCAP_VXLAN:
+	case RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
 		return 1;
 	default:
 		return 0;
@@ -532,6 +533,13 @@ struct encap_vxlan_ipv6_vlan_data {
 	struct vxlan_hdr vxlan;
 } __attribute__((__packed__));
 
+struct encap_qinq_pppoe_data {
+	struct ether_hdr ether;
+	struct vlan_hdr svlan;
+	struct vlan_hdr cvlan;
+	struct pppoe_ppp_hdr pppoe_ppp;
+} __attribute__((__packed__));
+
 static size_t
 encap_data_size(struct rte_table_action_encap_config *encap)
 {
@@ -563,6 +571,9 @@ encap_data_size(struct rte_table_action_encap_config *encap)
 			else
 				return sizeof(struct encap_vxlan_ipv6_data);
 
+	case 1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
+			return sizeof(struct encap_qinq_pppoe_data);
+
 	default:
 		return 0;
 	}
@@ -599,6 +610,9 @@ encap_apply_check(struct rte_table_action_encap_params *p,
 	case RTE_TABLE_ACTION_ENCAP_VXLAN:
 		return 0;
 
+	case RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
+		return 0;
+
 	default:
 		return -EINVAL;
 	}
@@ -676,6 +690,38 @@ encap_qinq_apply(void *data,
 	return 0;
 }
 
+static int
+encap_qinq_pppoe_apply(void *data,
+	struct rte_table_action_encap_params *p)
+{
+	struct encap_qinq_pppoe_data *d = data;
+
+	/* Ethernet */
+	ether_addr_copy(&p->qinq.ether.da, &d->ether.d_addr);
+	ether_addr_copy(&p->qinq.ether.sa, &d->ether.s_addr);
+	d->ether.ether_type = rte_htons(ETHER_TYPE_VLAN);
+
+	/* SVLAN */
+	d->svlan.vlan_tci = rte_htons(VLAN(p->qinq.svlan.pcp,
+		p->qinq.svlan.dei,
+		p->qinq.svlan.vid));
+	d->svlan.eth_proto = rte_htons(ETHER_TYPE_VLAN);
+
+	/* CVLAN */
+	d->cvlan.vlan_tci = rte_htons(VLAN(p->qinq.cvlan.pcp,
+		p->qinq.cvlan.dei,
+		p->qinq.cvlan.vid));
+	d->cvlan.eth_proto = rte_htons(ETHER_TYPE_PPPoE);
+
+	/* PPPoE and PPP*/
+	d->pppoe_ppp.ver_type_code = rte_htons(0x1100);
+	d->pppoe_ppp.session_id = rte_htons(p->qinq_pppoe.pppoe.session_id);
+	d->pppoe_ppp.length = 0; /* not pre-computed */
+	d->pppoe_ppp.protocol = rte_htons(PPP_PROTOCOL_IP);
+
+	return 0;
+}
+
 static int
 encap_mpls_apply(void *data,
 	struct rte_table_action_encap_params *p)
@@ -921,6 +967,9 @@ encap_apply(void *data,
 	case RTE_TABLE_ACTION_ENCAP_VXLAN:
 		return encap_vxlan_apply(data, p, cfg);
 
+	case RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
+		return encap_qinq_pppoe_apply(data, p);
+
 	default:
 		return -EINVAL;
 	}
@@ -1119,6 +1168,18 @@ pkt_work_encap(struct rte_mbuf *mbuf,
 		break;
 	}
 
+	case 1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
+	{
+		struct encap_qinq_pppoe_data *qinq_pppoe =
+			encap(ip, data, sizeof(struct encap_qinq_pppoe_data));
+		qinq_pppoe->pppoe_ppp.length = rte_htons(total_length + 2);
+		mbuf->data_off = ip_offset - (sizeof(struct rte_mbuf) +
+			sizeof(struct encap_qinq_pppoe_data));
+		mbuf->pkt_len = mbuf->data_len = total_length +
+			sizeof(struct encap_qinq_pppoe_data);
+		break;
+	}
+
 	case 1LLU << RTE_TABLE_ACTION_ENCAP_VXLAN:
 	{
 		if (cfg->vxlan.ip_version)
diff --git a/lib/librte_pipeline/rte_table_action.h b/lib/librte_pipeline/rte_table_action.h
index c96061291..d3d623b36 100644
--- a/lib/librte_pipeline/rte_table_action.h
+++ b/lib/librte_pipeline/rte_table_action.h
@@ -380,6 +380,9 @@ enum rte_table_action_encap_type {
 	 * Ether -> { Ether | VLAN | IP | UDP | VXLAN | Ether }
 	 */
 	RTE_TABLE_ACTION_ENCAP_VXLAN,
+
+	/** IP -> { Ether | S-VLAN | C-VLAN | PPPoE | PPP | IP } */
+	RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE,
 };
 
 /** Pre-computed Ethernet header fields for encapsulation action. */
@@ -529,6 +532,16 @@ struct rte_table_action_encap_config {
 	};
 };
 
+/** QinQ_PPPoE encap paramaeters. */
+struct rte_table_encap_ether_qinq_pppoe {
+
+	/** Only valid when *type* is set to QinQ. */
+	 struct rte_table_action_ether_hdr ether;
+	 struct rte_table_action_vlan_hdr svlan; /**< Service VLAN header. */
+	 struct rte_table_action_vlan_hdr cvlan; /**< Customer VLAN header. */
+	 struct rte_table_action_pppoe_hdr pppoe; /**< PPPoE/PPP headers. */
+};
+
 /** Encap action parameters (per table rule). */
 struct rte_table_action_encap_params {
 	/** Encapsulation type. */
@@ -553,6 +566,9 @@ struct rte_table_action_encap_params {
 
 		/** Only valid when *type* is set to VXLAN. */
 		struct rte_table_action_encap_vxlan_params vxlan;
+
+		/** Only valid when *type* is set to QinQ_PPPoE. */
+		struct rte_table_encap_ether_qinq_pppoe qinq_pppoe;
 	};
 };
 
-- 
2.17.1

--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.

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

* [dpdk-dev] [PATCH v2] ip_pipeline: add QinQ PPPoE encapsulation action
  2019-01-14 10:02 [dpdk-dev] [PATCH] ip_pipeline: add QinQ PPPoE encapsulation action Marjanovic,Nemanja
@ 2019-01-14 10:23 ` Marjanovic,Nemanja
  2019-01-14 10:46   ` Dumitrescu, Cristian
  2019-01-15 10:55   ` [dpdk-dev] [PATCH v3] " Marjanovic,Nemanja
  0 siblings, 2 replies; 20+ messages in thread
From: Marjanovic,Nemanja @ 2019-01-14 10:23 UTC (permalink / raw)
  To: dev; +Cc: jasvinder.singh, cristian.dumitrescu, Marjanovic,Nemanja

Add implementation of QinQ PPPoE packet encapsulation action.

Signed-off-by: Nemanja Marjanovic <nemanja.marjanovic@intel.com>
---
v2:Fix changes from check patch
---
 examples/ip_pipeline/cli.c             | 43 +++++++++++++++++-
 lib/librte_net/rte_ether.h             |  1 +
 lib/librte_pipeline/rte_table_action.c | 61 ++++++++++++++++++++++++++
 lib/librte_pipeline/rte_table_action.h | 16 +++++++
 4 files changed, 119 insertions(+), 2 deletions(-)

diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
index 910386282..dcc98ee65 100644
--- a/examples/ip_pipeline/cli.c
+++ b/examples/ip_pipeline/cli.c
@@ -1290,11 +1290,13 @@ cmd_table_action_profile(char **tokens,
 
 			p.encap.encap_mask = 1LLU << RTE_TABLE_ACTION_ENCAP_VXLAN;
 			n_extra_tokens = 5;
-		} else {
+		} else if (strcmp(tokens[t0 + 1], "qinq_pppoe") == 0)
+			p.encap.encap_mask =
+				1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE;
+		else {
 			snprintf(out, out_size, MSG_ARG_MISMATCH, "encap");
 			return;
 		}
-
 		p.action_mask |= 1LLU << RTE_TABLE_ACTION_ENCAP;
 		t0 += 2 + n_extra_tokens;
 	} /* encap */
@@ -3391,6 +3393,43 @@ parse_table_action_encap(char **tokens,
 		return 1 + 9;
 	}
 
+	/* qinq_pppoe */
+		if (n_tokens && (strcmp(tokens[0], "qinq_pppoe") == 0)) {
+			uint32_t svlan_pcp, svlan_dei, svlan_vid;
+			uint32_t cvlan_pcp, cvlan_dei, cvlan_vid;
+
+		if ((n_tokens < 10) ||
+			parse_mac_addr(tokens[1],
+				&a->encap.qinq_pppoe.ether.da) ||
+			parse_mac_addr(tokens[2],
+				&a->encap.qinq_pppoe.ether.sa) ||
+			parser_read_uint32(&svlan_pcp, tokens[3]) ||
+			(svlan_pcp > 0x7) ||
+			parser_read_uint32(&svlan_dei, tokens[4]) ||
+			(svlan_dei > 0x1) ||
+			parser_read_uint32(&svlan_vid, tokens[5]) ||
+			(svlan_vid > 0xFFF) ||
+			parser_read_uint32(&cvlan_pcp, tokens[6]) ||
+			(cvlan_pcp > 0x7) ||
+			parser_read_uint32(&cvlan_dei, tokens[7]) ||
+			(cvlan_dei > 0x1) ||
+			parser_read_uint32(&cvlan_vid, tokens[8]) ||
+			(cvlan_vid > 0xFFF) ||
+			parser_read_uint16(&a->encap.qinq_pppoe.pppoe.session_id,
+				tokens[9]))
+			return 0;
+
+		a->encap.qinq_pppoe.svlan.pcp = svlan_pcp & 0x7;
+		a->encap.qinq_pppoe.svlan.dei = svlan_dei & 0x1;
+		a->encap.qinq_pppoe.svlan.vid = svlan_vid & 0xFFF;
+		a->encap.qinq_pppoe.cvlan.pcp = cvlan_pcp & 0x7;
+		a->encap.qinq_pppoe.cvlan.dei = cvlan_dei & 0x1;
+		a->encap.qinq_pppoe.cvlan.vid = cvlan_vid & 0xFFF;
+		a->encap.type = RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE;
+		a->action_mask |= 1 << RTE_TABLE_ACTION_ENCAP;
+		return 1 + 10;
+		}
+
 	/* mpls */
 	if (n_tokens && (strcmp(tokens[0], "mpls") == 0)) {
 		uint32_t label, tc, ttl;
diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
index c2c5e249f..212ead64a 100644
--- a/lib/librte_net/rte_ether.h
+++ b/lib/librte_net/rte_ether.h
@@ -300,6 +300,7 @@ struct vxlan_hdr {
 #define ETHER_TYPE_ARP  0x0806 /**< Arp Protocol. */
 #define ETHER_TYPE_RARP 0x8035 /**< Reverse Arp Protocol. */
 #define ETHER_TYPE_VLAN 0x8100 /**< IEEE 802.1Q VLAN tagging. */
+#define ETHER_TYPE_PPPoE 0x8864 /**< PPPoE Session Stage */
 #define ETHER_TYPE_QINQ 0x88A8 /**< IEEE 802.1ad QinQ tagging. */
 #define ETHER_TYPE_ETAG 0x893F /**< IEEE 802.1BR E-Tag. */
 #define ETHER_TYPE_1588 0x88F7 /**< IEEE 802.1AS 1588 Precise Time Protocol. */
diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c
index 7c7c8dd82..78cc7a7a2 100644
--- a/lib/librte_pipeline/rte_table_action.c
+++ b/lib/librte_pipeline/rte_table_action.c
@@ -432,6 +432,7 @@ encap_valid(enum rte_table_action_encap_type encap)
 	case RTE_TABLE_ACTION_ENCAP_MPLS:
 	case RTE_TABLE_ACTION_ENCAP_PPPOE:
 	case RTE_TABLE_ACTION_ENCAP_VXLAN:
+	case RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
 		return 1;
 	default:
 		return 0;
@@ -532,6 +533,13 @@ struct encap_vxlan_ipv6_vlan_data {
 	struct vxlan_hdr vxlan;
 } __attribute__((__packed__));
 
+struct encap_qinq_pppoe_data {
+	struct ether_hdr ether;
+	struct vlan_hdr svlan;
+	struct vlan_hdr cvlan;
+	struct pppoe_ppp_hdr pppoe_ppp;
+} __attribute__((__packed__));
+
 static size_t
 encap_data_size(struct rte_table_action_encap_config *encap)
 {
@@ -563,6 +571,9 @@ encap_data_size(struct rte_table_action_encap_config *encap)
 			else
 				return sizeof(struct encap_vxlan_ipv6_data);
 
+	case 1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
+			return sizeof(struct encap_qinq_pppoe_data);
+
 	default:
 		return 0;
 	}
@@ -599,6 +610,9 @@ encap_apply_check(struct rte_table_action_encap_params *p,
 	case RTE_TABLE_ACTION_ENCAP_VXLAN:
 		return 0;
 
+	case RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
+		return 0;
+
 	default:
 		return -EINVAL;
 	}
@@ -676,6 +690,38 @@ encap_qinq_apply(void *data,
 	return 0;
 }
 
+static int
+encap_qinq_pppoe_apply(void *data,
+	struct rte_table_action_encap_params *p)
+{
+	struct encap_qinq_pppoe_data *d = data;
+
+	/* Ethernet */
+	ether_addr_copy(&p->qinq.ether.da, &d->ether.d_addr);
+	ether_addr_copy(&p->qinq.ether.sa, &d->ether.s_addr);
+	d->ether.ether_type = rte_htons(ETHER_TYPE_VLAN);
+
+	/* SVLAN */
+	d->svlan.vlan_tci = rte_htons(VLAN(p->qinq.svlan.pcp,
+		p->qinq.svlan.dei,
+		p->qinq.svlan.vid));
+	d->svlan.eth_proto = rte_htons(ETHER_TYPE_VLAN);
+
+	/* CVLAN */
+	d->cvlan.vlan_tci = rte_htons(VLAN(p->qinq.cvlan.pcp,
+		p->qinq.cvlan.dei,
+		p->qinq.cvlan.vid));
+	d->cvlan.eth_proto = rte_htons(ETHER_TYPE_PPPoE);
+
+	/* PPPoE and PPP*/
+	d->pppoe_ppp.ver_type_code = rte_htons(0x1100);
+	d->pppoe_ppp.session_id = rte_htons(p->qinq_pppoe.pppoe.session_id);
+	d->pppoe_ppp.length = 0; /* not pre-computed */
+	d->pppoe_ppp.protocol = rte_htons(PPP_PROTOCOL_IP);
+
+	return 0;
+}
+
 static int
 encap_mpls_apply(void *data,
 	struct rte_table_action_encap_params *p)
@@ -921,6 +967,9 @@ encap_apply(void *data,
 	case RTE_TABLE_ACTION_ENCAP_VXLAN:
 		return encap_vxlan_apply(data, p, cfg);
 
+	case RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
+		return encap_qinq_pppoe_apply(data, p);
+
 	default:
 		return -EINVAL;
 	}
@@ -1119,6 +1168,18 @@ pkt_work_encap(struct rte_mbuf *mbuf,
 		break;
 	}
 
+	case 1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
+	{
+		struct encap_qinq_pppoe_data *qinq_pppoe =
+			encap(ip, data, sizeof(struct encap_qinq_pppoe_data));
+		qinq_pppoe->pppoe_ppp.length = rte_htons(total_length + 2);
+		mbuf->data_off = ip_offset - (sizeof(struct rte_mbuf) +
+			sizeof(struct encap_qinq_pppoe_data));
+		mbuf->pkt_len = mbuf->data_len = total_length +
+			sizeof(struct encap_qinq_pppoe_data);
+		break;
+	}
+
 	case 1LLU << RTE_TABLE_ACTION_ENCAP_VXLAN:
 	{
 		if (cfg->vxlan.ip_version)
diff --git a/lib/librte_pipeline/rte_table_action.h b/lib/librte_pipeline/rte_table_action.h
index c96061291..53d16af8a 100644
--- a/lib/librte_pipeline/rte_table_action.h
+++ b/lib/librte_pipeline/rte_table_action.h
@@ -380,6 +380,9 @@ enum rte_table_action_encap_type {
 	 * Ether -> { Ether | VLAN | IP | UDP | VXLAN | Ether }
 	 */
 	RTE_TABLE_ACTION_ENCAP_VXLAN,
+
+	/** IP -> { Ether | S-VLAN | C-VLAN | PPPoE | PPP | IP } */
+	RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE,
 };
 
 /** Pre-computed Ethernet header fields for encapsulation action. */
@@ -529,6 +532,16 @@ struct rte_table_action_encap_config {
 	};
 };
 
+/** QinQ_PPPoE encap paramaeters. */
+struct rte_table_encap_ether_qinq_pppoe {
+
+	/** Only valid when *type* is set to QinQ. */
+	struct rte_table_action_ether_hdr ether;
+	struct rte_table_action_vlan_hdr svlan; /**< Service VLAN header. */
+	struct rte_table_action_vlan_hdr cvlan; /**< Customer VLAN header. */
+	struct rte_table_action_pppoe_hdr pppoe; /**< PPPoE/PPP headers. */
+};
+
 /** Encap action parameters (per table rule). */
 struct rte_table_action_encap_params {
 	/** Encapsulation type. */
@@ -553,6 +566,9 @@ struct rte_table_action_encap_params {
 
 		/** Only valid when *type* is set to VXLAN. */
 		struct rte_table_action_encap_vxlan_params vxlan;
+
+		/** Only valid when *type* is set to QinQ_PPPoE. */
+		struct rte_table_encap_ether_qinq_pppoe qinq_pppoe;
 	};
 };
 
-- 
2.17.1

--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.

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

* Re: [dpdk-dev] [PATCH v2] ip_pipeline: add QinQ PPPoE encapsulation action
  2019-01-14 10:23 ` [dpdk-dev] [PATCH v2] " Marjanovic,Nemanja
@ 2019-01-14 10:46   ` Dumitrescu, Cristian
  2019-01-15 10:55   ` [dpdk-dev] [PATCH v3] " Marjanovic,Nemanja
  1 sibling, 0 replies; 20+ messages in thread
From: Dumitrescu, Cristian @ 2019-01-14 10:46 UTC (permalink / raw)
  To: Marjanovic, Nemanja, dev; +Cc: Singh, Jasvinder

Hi Nemanja,

> -----Original Message-----
> From: Marjanovic, Nemanja
> Sent: Monday, January 14, 2019 10:23 AM
> To: dev@dpdk.org
> Cc: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>; Marjanovic, Nemanja
> <nemanja.marjanovic@intel.com>
> Subject: [PATCH v2] ip_pipeline: add QinQ PPPoE encapsulation action
> 
> Add implementation of QinQ PPPoE packet encapsulation action.
> 
> Signed-off-by: Nemanja Marjanovic <nemanja.marjanovic@intel.com>
> ---
> v2:Fix changes from check patch
> ---
>  examples/ip_pipeline/cli.c             | 43 +++++++++++++++++-
>  lib/librte_net/rte_ether.h             |  1 +
>  lib/librte_pipeline/rte_table_action.c | 61 ++++++++++++++++++++++++++
>  lib/librte_pipeline/rte_table_action.h | 16 +++++++
>  4 files changed, 119 insertions(+), 2 deletions(-)
> 
> diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
> index 910386282..dcc98ee65 100644
> --- a/examples/ip_pipeline/cli.c
> +++ b/examples/ip_pipeline/cli.c

We need to add support for this new packet encapsulation in the Soft NIC CLI, we don't want it to get out of sync with IP pipeline.
Basically, add essentially the same CLI code in drivers/net/softnic/rte_eth_softnic_cli.c, can you please do this?

> @@ -1290,11 +1290,13 @@ cmd_table_action_profile(char **tokens,
> 
>  			p.encap.encap_mask = 1LLU <<
> RTE_TABLE_ACTION_ENCAP_VXLAN;
>  			n_extra_tokens = 5;
> -		} else {
> +		} else if (strcmp(tokens[t0 + 1], "qinq_pppoe") == 0)
> +			p.encap.encap_mask =
> +				1LLU <<
> RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE;
> +		else {
>  			snprintf(out, out_size, MSG_ARG_MISMATCH,
> "encap");
>  			return;
>  		}
> -

Please put back this blank line.

>  		p.action_mask |= 1LLU << RTE_TABLE_ACTION_ENCAP;
>  		t0 += 2 + n_extra_tokens;
>  	} /* encap */
> @@ -3391,6 +3393,43 @@ parse_table_action_encap(char **tokens,
>  		return 1 + 9;
>  	}
> 
> +	/* qinq_pppoe */
> +		if (n_tokens && (strcmp(tokens[0], "qinq_pppoe") == 0)) {
> +			uint32_t svlan_pcp, svlan_dei, svlan_vid;
> +			uint32_t cvlan_pcp, cvlan_dei, cvlan_vid;
> +
> +		if ((n_tokens < 10) ||
> +			parse_mac_addr(tokens[1],
> +				&a->encap.qinq_pppoe.ether.da) ||
> +			parse_mac_addr(tokens[2],
> +				&a->encap.qinq_pppoe.ether.sa) ||
> +			parser_read_uint32(&svlan_pcp, tokens[3]) ||
> +			(svlan_pcp > 0x7) ||
> +			parser_read_uint32(&svlan_dei, tokens[4]) ||
> +			(svlan_dei > 0x1) ||
> +			parser_read_uint32(&svlan_vid, tokens[5]) ||
> +			(svlan_vid > 0xFFF) ||
> +			parser_read_uint32(&cvlan_pcp, tokens[6]) ||
> +			(cvlan_pcp > 0x7) ||
> +			parser_read_uint32(&cvlan_dei, tokens[7]) ||
> +			(cvlan_dei > 0x1) ||
> +			parser_read_uint32(&cvlan_vid, tokens[8]) ||
> +			(cvlan_vid > 0xFFF) ||
> +			parser_read_uint16(&a-
> >encap.qinq_pppoe.pppoe.session_id,
> +				tokens[9]))
> +			return 0;
> +
> +		a->encap.qinq_pppoe.svlan.pcp = svlan_pcp & 0x7;
> +		a->encap.qinq_pppoe.svlan.dei = svlan_dei & 0x1;
> +		a->encap.qinq_pppoe.svlan.vid = svlan_vid & 0xFFF;
> +		a->encap.qinq_pppoe.cvlan.pcp = cvlan_pcp & 0x7;
> +		a->encap.qinq_pppoe.cvlan.dei = cvlan_dei & 0x1;
> +		a->encap.qinq_pppoe.cvlan.vid = cvlan_vid & 0xFFF;
> +		a->encap.type = RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE;
> +		a->action_mask |= 1 << RTE_TABLE_ACTION_ENCAP;
> +		return 1 + 10;
> +		}
> +

Please add this new encap in the cmd_table_action_profile_help string, as well in the comment describing the table action options (search for "table_action ::= ") in this file.

>  	/* mpls */
>  	if (n_tokens && (strcmp(tokens[0], "mpls") == 0)) {
>  		uint32_t label, tc, ttl;
> diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
> index c2c5e249f..212ead64a 100644
> --- a/lib/librte_net/rte_ether.h
> +++ b/lib/librte_net/rte_ether.h
> @@ -300,6 +300,7 @@ struct vxlan_hdr {
>  #define ETHER_TYPE_ARP  0x0806 /**< Arp Protocol. */
>  #define ETHER_TYPE_RARP 0x8035 /**< Reverse Arp Protocol. */
>  #define ETHER_TYPE_VLAN 0x8100 /**< IEEE 802.1Q VLAN tagging. */
> +#define ETHER_TYPE_PPPoE 0x8864 /**< PPPoE Session Stage */

Please add both PPPoE session and PPPoE discovery ethertypes, and call them accordingly. Please keep the existing naming convention, i.e. keep names all upper case for the purpose of these macros: PPPOE_DISCOVERY and PPPOE_SESSION (as opposed to lover case "o" in PPPoE).

>  #define ETHER_TYPE_QINQ 0x88A8 /**< IEEE 802.1ad QinQ tagging. */
>  #define ETHER_TYPE_ETAG 0x893F /**< IEEE 802.1BR E-Tag. */
>  #define ETHER_TYPE_1588 0x88F7 /**< IEEE 802.1AS 1588 Precise Time
> Protocol. */
> diff --git a/lib/librte_pipeline/rte_table_action.c
> b/lib/librte_pipeline/rte_table_action.c
> index 7c7c8dd82..78cc7a7a2 100644
> --- a/lib/librte_pipeline/rte_table_action.c
> +++ b/lib/librte_pipeline/rte_table_action.c
> @@ -432,6 +432,7 @@ encap_valid(enum rte_table_action_encap_type
> encap)
>  	case RTE_TABLE_ACTION_ENCAP_MPLS:
>  	case RTE_TABLE_ACTION_ENCAP_PPPOE:
>  	case RTE_TABLE_ACTION_ENCAP_VXLAN:
> +	case RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
>  		return 1;
>  	default:
>  		return 0;
> @@ -532,6 +533,13 @@ struct encap_vxlan_ipv6_vlan_data {
>  	struct vxlan_hdr vxlan;
>  } __attribute__((__packed__));
> 
> +struct encap_qinq_pppoe_data {
> +	struct ether_hdr ether;
> +	struct vlan_hdr svlan;
> +	struct vlan_hdr cvlan;
> +	struct pppoe_ppp_hdr pppoe_ppp;
> +} __attribute__((__packed__));
> +
>  static size_t
>  encap_data_size(struct rte_table_action_encap_config *encap)
>  {
> @@ -563,6 +571,9 @@ encap_data_size(struct
> rte_table_action_encap_config *encap)
>  			else
>  				return sizeof(struct encap_vxlan_ipv6_data);
> 
> +	case 1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
> +			return sizeof(struct encap_qinq_pppoe_data);
> +
>  	default:
>  		return 0;
>  	}
> @@ -599,6 +610,9 @@ encap_apply_check(struct
> rte_table_action_encap_params *p,
>  	case RTE_TABLE_ACTION_ENCAP_VXLAN:
>  		return 0;
> 
> +	case RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
> +		return 0;
> +
>  	default:
>  		return -EINVAL;
>  	}
> @@ -676,6 +690,38 @@ encap_qinq_apply(void *data,
>  	return 0;
>  }
> 
> +static int
> +encap_qinq_pppoe_apply(void *data,
> +	struct rte_table_action_encap_params *p)
> +{
> +	struct encap_qinq_pppoe_data *d = data;
> +
> +	/* Ethernet */
> +	ether_addr_copy(&p->qinq.ether.da, &d->ether.d_addr);
> +	ether_addr_copy(&p->qinq.ether.sa, &d->ether.s_addr);
> +	d->ether.ether_type = rte_htons(ETHER_TYPE_VLAN);
> +
> +	/* SVLAN */
> +	d->svlan.vlan_tci = rte_htons(VLAN(p->qinq.svlan.pcp,
> +		p->qinq.svlan.dei,
> +		p->qinq.svlan.vid));
> +	d->svlan.eth_proto = rte_htons(ETHER_TYPE_VLAN);
> +
> +	/* CVLAN */
> +	d->cvlan.vlan_tci = rte_htons(VLAN(p->qinq.cvlan.pcp,
> +		p->qinq.cvlan.dei,
> +		p->qinq.cvlan.vid));
> +	d->cvlan.eth_proto = rte_htons(ETHER_TYPE_PPPoE);
> +
> +	/* PPPoE and PPP*/
> +	d->pppoe_ppp.ver_type_code = rte_htons(0x1100);
> +	d->pppoe_ppp.session_id = rte_htons(p-
> >qinq_pppoe.pppoe.session_id);
> +	d->pppoe_ppp.length = 0; /* not pre-computed */
> +	d->pppoe_ppp.protocol = rte_htons(PPP_PROTOCOL_IP);
> +
> +	return 0;
> +}
> +
>  static int
>  encap_mpls_apply(void *data,
>  	struct rte_table_action_encap_params *p)
> @@ -921,6 +967,9 @@ encap_apply(void *data,
>  	case RTE_TABLE_ACTION_ENCAP_VXLAN:
>  		return encap_vxlan_apply(data, p, cfg);
> 
> +	case RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
> +		return encap_qinq_pppoe_apply(data, p);
> +
>  	default:
>  		return -EINVAL;
>  	}
> @@ -1119,6 +1168,18 @@ pkt_work_encap(struct rte_mbuf *mbuf,
>  		break;
>  	}
> 
> +	case 1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
> +	{
> +		struct encap_qinq_pppoe_data *qinq_pppoe =
> +			encap(ip, data, sizeof(struct
> encap_qinq_pppoe_data));
> +		qinq_pppoe->pppoe_ppp.length = rte_htons(total_length +
> 2);
> +		mbuf->data_off = ip_offset - (sizeof(struct rte_mbuf) +
> +			sizeof(struct encap_qinq_pppoe_data));
> +		mbuf->pkt_len = mbuf->data_len = total_length +
> +			sizeof(struct encap_qinq_pppoe_data);
> +		break;
> +	}
> +
>  	case 1LLU << RTE_TABLE_ACTION_ENCAP_VXLAN:
>  	{
>  		if (cfg->vxlan.ip_version)
> diff --git a/lib/librte_pipeline/rte_table_action.h
> b/lib/librte_pipeline/rte_table_action.h
> index c96061291..53d16af8a 100644
> --- a/lib/librte_pipeline/rte_table_action.h
> +++ b/lib/librte_pipeline/rte_table_action.h
> @@ -380,6 +380,9 @@ enum rte_table_action_encap_type {
>  	 * Ether -> { Ether | VLAN | IP | UDP | VXLAN | Ether }
>  	 */
>  	RTE_TABLE_ACTION_ENCAP_VXLAN,
> +
> +	/** IP -> { Ether | S-VLAN | C-VLAN | PPPoE | PPP | IP } */
> +	RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE,
>  };
> 
>  /** Pre-computed Ethernet header fields for encapsulation action. */
> @@ -529,6 +532,16 @@ struct rte_table_action_encap_config {
>  	};
>  };
> 
> +/** QinQ_PPPoE encap paramaeters. */
> +struct rte_table_encap_ether_qinq_pppoe {
> +
> +	/** Only valid when *type* is set to QinQ. */
> +	struct rte_table_action_ether_hdr ether;
> +	struct rte_table_action_vlan_hdr svlan; /**< Service VLAN header.
> */
> +	struct rte_table_action_vlan_hdr cvlan; /**< Customer VLAN
> header. */
> +	struct rte_table_action_pppoe_hdr pppoe; /**< PPPoE/PPP
> headers. */
> +};
> +
>  /** Encap action parameters (per table rule). */
>  struct rte_table_action_encap_params {
>  	/** Encapsulation type. */
> @@ -553,6 +566,9 @@ struct rte_table_action_encap_params {
> 
>  		/** Only valid when *type* is set to VXLAN. */
>  		struct rte_table_action_encap_vxlan_params vxlan;
> +
> +		/** Only valid when *type* is set to QinQ_PPPoE. */
> +		struct rte_table_encap_ether_qinq_pppoe qinq_pppoe;
>  	};
>  };
> 
> --
> 2.17.1

Thanks,
Cristian

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

* [dpdk-dev] [PATCH v3] ip_pipeline: add QinQ PPPoE encapsulation action
  2019-01-14 10:23 ` [dpdk-dev] [PATCH v2] " Marjanovic,Nemanja
  2019-01-14 10:46   ` Dumitrescu, Cristian
@ 2019-01-15 10:55   ` Marjanovic,Nemanja
  2019-01-18  9:12     ` [dpdk-dev] [PATCH v4 1/4] pipeline: support QinQ PPPoE encap Nemanja Marjanovic
  1 sibling, 1 reply; 20+ messages in thread
From: Marjanovic,Nemanja @ 2019-01-15 10:55 UTC (permalink / raw)
  To: dev; +Cc: jasvinder.singh, cristian.dumitrescu, Marjanovic,Nemanja

Add implementation of QinQ PPPoE packet encapsulation action.

Signed-off-by: Nemanja Marjanovic <nemanja.marjanovic@intel.com>
---
v2:Fix changes from check patch
v3:Changed to use internally defined ETHER_TYPE_PPPOE_SESSION macro
---
 examples/ip_pipeline/cli.c             | 46 ++++++++++++++++++-
 lib/librte_pipeline/rte_table_action.c | 61 ++++++++++++++++++++++++++
 lib/librte_pipeline/rte_table_action.h | 16 +++++++
 3 files changed, 121 insertions(+), 2 deletions(-)

diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
index 910386282..dd05393ef 100644
--- a/examples/ip_pipeline/cli.c
+++ b/examples/ip_pipeline/cli.c
@@ -1022,7 +1022,7 @@ static const char cmd_table_action_profile_help[] =
 "       tc <n_tc>\n"
 "       stats none | pkts | bytes | both]\n"
 "   [tm spp <n_subports_per_port> pps <n_pipes_per_subport>]\n"
-"   [encap ether | vlan | qinq | mpls | pppoe |\n"
+"   [encap ether | vlan | qinq | mpls | pppoe | qinq_pppoe \n"
 "       vxlan offset <ether_offset> ipv4 | ipv6 vlan on | off]\n"
 "   [nat src | dst\n"
 "       proto udp | tcp]\n"
@@ -1290,7 +1290,10 @@ cmd_table_action_profile(char **tokens,
 
 			p.encap.encap_mask = 1LLU << RTE_TABLE_ACTION_ENCAP_VXLAN;
 			n_extra_tokens = 5;
-		} else {
+		} else if (strcmp(tokens[t0 + 1], "qinq_pppoe") == 0)
+			p.encap.encap_mask =
+				1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE;
+		else {
 			snprintf(out, out_size, MSG_ARG_MISMATCH, "encap");
 			return;
 		}
@@ -3090,6 +3093,7 @@ parse_match(char **tokens,
  *       ether <da> <sa>
  *       | vlan <da> <sa> <pcp> <dei> <vid>
  *       | qinq <da> <sa> <pcp> <dei> <vid> <pcp> <dei> <vid>
+ *       | qinq_pppoe <da> <sa> <pcp> <dei> <vid> <pcp> <dei> <vid> <session_id>
  *       | mpls unicast | multicast
  *          <da> <sa>
  *          label0 <label> <tc> <ttl>
@@ -3391,6 +3395,44 @@ parse_table_action_encap(char **tokens,
 		return 1 + 9;
 	}
 
+	/* qinq_pppoe */
+	if (n_tokens && (strcmp(tokens[0], "qinq_pppoe") == 0)) {
+		uint32_t svlan_pcp, svlan_dei, svlan_vid;
+		uint32_t cvlan_pcp, cvlan_dei, cvlan_vid;
+
+		if ((n_tokens < 10) ||
+			parse_mac_addr(tokens[1],
+				&a->encap.qinq_pppoe.ether.da) ||
+			parse_mac_addr(tokens[2],
+				&a->encap.qinq_pppoe.ether.sa) ||
+			parser_read_uint32(&svlan_pcp, tokens[3]) ||
+			(svlan_pcp > 0x7) ||
+			parser_read_uint32(&svlan_dei, tokens[4]) ||
+			(svlan_dei > 0x1) ||
+			parser_read_uint32(&svlan_vid, tokens[5]) ||
+			(svlan_vid > 0xFFF) ||
+			parser_read_uint32(&cvlan_pcp, tokens[6]) ||
+			(cvlan_pcp > 0x7) ||
+			parser_read_uint32(&cvlan_dei, tokens[7]) ||
+			(cvlan_dei > 0x1) ||
+			parser_read_uint32(&cvlan_vid, tokens[8]) ||
+			(cvlan_vid > 0xFFF) ||
+			parser_read_uint16(&a->encap.qinq_pppoe.pppoe.session_id,
+				tokens[9]))
+			return 0;
+
+		a->encap.qinq_pppoe.svlan.pcp = svlan_pcp & 0x7;
+		a->encap.qinq_pppoe.svlan.dei = svlan_dei & 0x1;
+		a->encap.qinq_pppoe.svlan.vid = svlan_vid & 0xFFF;
+		a->encap.qinq_pppoe.cvlan.pcp = cvlan_pcp & 0x7;
+		a->encap.qinq_pppoe.cvlan.dei = cvlan_dei & 0x1;
+		a->encap.qinq_pppoe.cvlan.vid = cvlan_vid & 0xFFF;
+		a->encap.type = RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE;
+		a->action_mask |= 1 << RTE_TABLE_ACTION_ENCAP;
+		return 1 + 10;
+
+	}
+
 	/* mpls */
 	if (n_tokens && (strcmp(tokens[0], "mpls") == 0)) {
 		uint32_t label, tc, ttl;
diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c
index 7c7c8dd82..466019934 100644
--- a/lib/librte_pipeline/rte_table_action.c
+++ b/lib/librte_pipeline/rte_table_action.c
@@ -432,6 +432,7 @@ encap_valid(enum rte_table_action_encap_type encap)
 	case RTE_TABLE_ACTION_ENCAP_MPLS:
 	case RTE_TABLE_ACTION_ENCAP_PPPOE:
 	case RTE_TABLE_ACTION_ENCAP_VXLAN:
+	case RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
 		return 1;
 	default:
 		return 0;
@@ -532,6 +533,13 @@ struct encap_vxlan_ipv6_vlan_data {
 	struct vxlan_hdr vxlan;
 } __attribute__((__packed__));
 
+struct encap_qinq_pppoe_data {
+	struct ether_hdr ether;
+	struct vlan_hdr svlan;
+	struct vlan_hdr cvlan;
+	struct pppoe_ppp_hdr pppoe_ppp;
+} __attribute__((__packed__));
+
 static size_t
 encap_data_size(struct rte_table_action_encap_config *encap)
 {
@@ -563,6 +571,9 @@ encap_data_size(struct rte_table_action_encap_config *encap)
 			else
 				return sizeof(struct encap_vxlan_ipv6_data);
 
+	case 1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
+			return sizeof(struct encap_qinq_pppoe_data);
+
 	default:
 		return 0;
 	}
@@ -599,6 +610,9 @@ encap_apply_check(struct rte_table_action_encap_params *p,
 	case RTE_TABLE_ACTION_ENCAP_VXLAN:
 		return 0;
 
+	case RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
+		return 0;
+
 	default:
 		return -EINVAL;
 	}
@@ -676,6 +690,38 @@ encap_qinq_apply(void *data,
 	return 0;
 }
 
+static int
+encap_qinq_pppoe_apply(void *data,
+	struct rte_table_action_encap_params *p)
+{
+	struct encap_qinq_pppoe_data *d = data;
+
+	/* Ethernet */
+	ether_addr_copy(&p->qinq.ether.da, &d->ether.d_addr);
+	ether_addr_copy(&p->qinq.ether.sa, &d->ether.s_addr);
+	d->ether.ether_type = rte_htons(ETHER_TYPE_VLAN);
+
+	/* SVLAN */
+	d->svlan.vlan_tci = rte_htons(VLAN(p->qinq.svlan.pcp,
+		p->qinq.svlan.dei,
+		p->qinq.svlan.vid));
+	d->svlan.eth_proto = rte_htons(ETHER_TYPE_VLAN);
+
+	/* CVLAN */
+	d->cvlan.vlan_tci = rte_htons(VLAN(p->qinq.cvlan.pcp,
+		p->qinq.cvlan.dei,
+		p->qinq.cvlan.vid));
+	d->cvlan.eth_proto = rte_htons(ETHER_TYPE_PPPOE_SESSION);
+
+	/* PPPoE and PPP*/
+	d->pppoe_ppp.ver_type_code = rte_htons(0x1100);
+	d->pppoe_ppp.session_id = rte_htons(p->qinq_pppoe.pppoe.session_id);
+	d->pppoe_ppp.length = 0; /* not pre-computed */
+	d->pppoe_ppp.protocol = rte_htons(PPP_PROTOCOL_IP);
+
+	return 0;
+}
+
 static int
 encap_mpls_apply(void *data,
 	struct rte_table_action_encap_params *p)
@@ -921,6 +967,9 @@ encap_apply(void *data,
 	case RTE_TABLE_ACTION_ENCAP_VXLAN:
 		return encap_vxlan_apply(data, p, cfg);
 
+	case RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
+		return encap_qinq_pppoe_apply(data, p);
+
 	default:
 		return -EINVAL;
 	}
@@ -1119,6 +1168,18 @@ pkt_work_encap(struct rte_mbuf *mbuf,
 		break;
 	}
 
+	case 1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
+	{
+		struct encap_qinq_pppoe_data *qinq_pppoe =
+			encap(ip, data, sizeof(struct encap_qinq_pppoe_data));
+		qinq_pppoe->pppoe_ppp.length = rte_htons(total_length + 2);
+		mbuf->data_off = ip_offset - (sizeof(struct rte_mbuf) +
+			sizeof(struct encap_qinq_pppoe_data));
+		mbuf->pkt_len = mbuf->data_len = total_length +
+			sizeof(struct encap_qinq_pppoe_data);
+		break;
+	}
+
 	case 1LLU << RTE_TABLE_ACTION_ENCAP_VXLAN:
 	{
 		if (cfg->vxlan.ip_version)
diff --git a/lib/librte_pipeline/rte_table_action.h b/lib/librte_pipeline/rte_table_action.h
index c96061291..53d16af8a 100644
--- a/lib/librte_pipeline/rte_table_action.h
+++ b/lib/librte_pipeline/rte_table_action.h
@@ -380,6 +380,9 @@ enum rte_table_action_encap_type {
 	 * Ether -> { Ether | VLAN | IP | UDP | VXLAN | Ether }
 	 */
 	RTE_TABLE_ACTION_ENCAP_VXLAN,
+
+	/** IP -> { Ether | S-VLAN | C-VLAN | PPPoE | PPP | IP } */
+	RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE,
 };
 
 /** Pre-computed Ethernet header fields for encapsulation action. */
@@ -529,6 +532,16 @@ struct rte_table_action_encap_config {
 	};
 };
 
+/** QinQ_PPPoE encap paramaeters. */
+struct rte_table_encap_ether_qinq_pppoe {
+
+	/** Only valid when *type* is set to QinQ. */
+	struct rte_table_action_ether_hdr ether;
+	struct rte_table_action_vlan_hdr svlan; /**< Service VLAN header. */
+	struct rte_table_action_vlan_hdr cvlan; /**< Customer VLAN header. */
+	struct rte_table_action_pppoe_hdr pppoe; /**< PPPoE/PPP headers. */
+};
+
 /** Encap action parameters (per table rule). */
 struct rte_table_action_encap_params {
 	/** Encapsulation type. */
@@ -553,6 +566,9 @@ struct rte_table_action_encap_params {
 
 		/** Only valid when *type* is set to VXLAN. */
 		struct rte_table_action_encap_vxlan_params vxlan;
+
+		/** Only valid when *type* is set to QinQ_PPPoE. */
+		struct rte_table_encap_ether_qinq_pppoe qinq_pppoe;
 	};
 };
 
-- 
2.17.1

--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.

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

* [dpdk-dev] [PATCH v4 1/4] pipeline: support QinQ PPPoE encap
  2019-01-15 10:55   ` [dpdk-dev] [PATCH v3] " Marjanovic,Nemanja
@ 2019-01-18  9:12     ` Nemanja Marjanovic
  2019-01-18  9:12       ` [dpdk-dev] [PATCH v4 2/4] examples/ip_pipeline: " Nemanja Marjanovic
                         ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: Nemanja Marjanovic @ 2019-01-18  9:12 UTC (permalink / raw)
  To: dev; +Cc: jasvinder.singh, cristian.dumitrescu, Nemanja Marjanovic

From: "Nemanja Marjanovic" <nemanja.marjanovic@intel.com>

Add support of QinQ PPPoE packet encapsulation action.

Signed-off-by: Nemanja Marjanovic <nemanja.marjanovic@intel.com>
---
v4:Splitting of patches for easier review
---
 lib/librte_pipeline/rte_table_action.c | 61 ++++++++++++++++++++++++++
 lib/librte_pipeline/rte_table_action.h | 16 +++++++
 2 files changed, 77 insertions(+)

diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c
index 7c7c8dd82..466019934 100644
--- a/lib/librte_pipeline/rte_table_action.c
+++ b/lib/librte_pipeline/rte_table_action.c
@@ -432,6 +432,7 @@ encap_valid(enum rte_table_action_encap_type encap)
 	case RTE_TABLE_ACTION_ENCAP_MPLS:
 	case RTE_TABLE_ACTION_ENCAP_PPPOE:
 	case RTE_TABLE_ACTION_ENCAP_VXLAN:
+	case RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
 		return 1;
 	default:
 		return 0;
@@ -532,6 +533,13 @@ struct encap_vxlan_ipv6_vlan_data {
 	struct vxlan_hdr vxlan;
 } __attribute__((__packed__));
 
+struct encap_qinq_pppoe_data {
+	struct ether_hdr ether;
+	struct vlan_hdr svlan;
+	struct vlan_hdr cvlan;
+	struct pppoe_ppp_hdr pppoe_ppp;
+} __attribute__((__packed__));
+
 static size_t
 encap_data_size(struct rte_table_action_encap_config *encap)
 {
@@ -563,6 +571,9 @@ encap_data_size(struct rte_table_action_encap_config *encap)
 			else
 				return sizeof(struct encap_vxlan_ipv6_data);
 
+	case 1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
+			return sizeof(struct encap_qinq_pppoe_data);
+
 	default:
 		return 0;
 	}
@@ -599,6 +610,9 @@ encap_apply_check(struct rte_table_action_encap_params *p,
 	case RTE_TABLE_ACTION_ENCAP_VXLAN:
 		return 0;
 
+	case RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
+		return 0;
+
 	default:
 		return -EINVAL;
 	}
@@ -676,6 +690,38 @@ encap_qinq_apply(void *data,
 	return 0;
 }
 
+static int
+encap_qinq_pppoe_apply(void *data,
+	struct rte_table_action_encap_params *p)
+{
+	struct encap_qinq_pppoe_data *d = data;
+
+	/* Ethernet */
+	ether_addr_copy(&p->qinq.ether.da, &d->ether.d_addr);
+	ether_addr_copy(&p->qinq.ether.sa, &d->ether.s_addr);
+	d->ether.ether_type = rte_htons(ETHER_TYPE_VLAN);
+
+	/* SVLAN */
+	d->svlan.vlan_tci = rte_htons(VLAN(p->qinq.svlan.pcp,
+		p->qinq.svlan.dei,
+		p->qinq.svlan.vid));
+	d->svlan.eth_proto = rte_htons(ETHER_TYPE_VLAN);
+
+	/* CVLAN */
+	d->cvlan.vlan_tci = rte_htons(VLAN(p->qinq.cvlan.pcp,
+		p->qinq.cvlan.dei,
+		p->qinq.cvlan.vid));
+	d->cvlan.eth_proto = rte_htons(ETHER_TYPE_PPPOE_SESSION);
+
+	/* PPPoE and PPP*/
+	d->pppoe_ppp.ver_type_code = rte_htons(0x1100);
+	d->pppoe_ppp.session_id = rte_htons(p->qinq_pppoe.pppoe.session_id);
+	d->pppoe_ppp.length = 0; /* not pre-computed */
+	d->pppoe_ppp.protocol = rte_htons(PPP_PROTOCOL_IP);
+
+	return 0;
+}
+
 static int
 encap_mpls_apply(void *data,
 	struct rte_table_action_encap_params *p)
@@ -921,6 +967,9 @@ encap_apply(void *data,
 	case RTE_TABLE_ACTION_ENCAP_VXLAN:
 		return encap_vxlan_apply(data, p, cfg);
 
+	case RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
+		return encap_qinq_pppoe_apply(data, p);
+
 	default:
 		return -EINVAL;
 	}
@@ -1119,6 +1168,18 @@ pkt_work_encap(struct rte_mbuf *mbuf,
 		break;
 	}
 
+	case 1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
+	{
+		struct encap_qinq_pppoe_data *qinq_pppoe =
+			encap(ip, data, sizeof(struct encap_qinq_pppoe_data));
+		qinq_pppoe->pppoe_ppp.length = rte_htons(total_length + 2);
+		mbuf->data_off = ip_offset - (sizeof(struct rte_mbuf) +
+			sizeof(struct encap_qinq_pppoe_data));
+		mbuf->pkt_len = mbuf->data_len = total_length +
+			sizeof(struct encap_qinq_pppoe_data);
+		break;
+	}
+
 	case 1LLU << RTE_TABLE_ACTION_ENCAP_VXLAN:
 	{
 		if (cfg->vxlan.ip_version)
diff --git a/lib/librte_pipeline/rte_table_action.h b/lib/librte_pipeline/rte_table_action.h
index c96061291..53d16af8a 100644
--- a/lib/librte_pipeline/rte_table_action.h
+++ b/lib/librte_pipeline/rte_table_action.h
@@ -380,6 +380,9 @@ enum rte_table_action_encap_type {
 	 * Ether -> { Ether | VLAN | IP | UDP | VXLAN | Ether }
 	 */
 	RTE_TABLE_ACTION_ENCAP_VXLAN,
+
+	/** IP -> { Ether | S-VLAN | C-VLAN | PPPoE | PPP | IP } */
+	RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE,
 };
 
 /** Pre-computed Ethernet header fields for encapsulation action. */
@@ -529,6 +532,16 @@ struct rte_table_action_encap_config {
 	};
 };
 
+/** QinQ_PPPoE encap paramaeters. */
+struct rte_table_encap_ether_qinq_pppoe {
+
+	/** Only valid when *type* is set to QinQ. */
+	struct rte_table_action_ether_hdr ether;
+	struct rte_table_action_vlan_hdr svlan; /**< Service VLAN header. */
+	struct rte_table_action_vlan_hdr cvlan; /**< Customer VLAN header. */
+	struct rte_table_action_pppoe_hdr pppoe; /**< PPPoE/PPP headers. */
+};
+
 /** Encap action parameters (per table rule). */
 struct rte_table_action_encap_params {
 	/** Encapsulation type. */
@@ -553,6 +566,9 @@ struct rte_table_action_encap_params {
 
 		/** Only valid when *type* is set to VXLAN. */
 		struct rte_table_action_encap_vxlan_params vxlan;
+
+		/** Only valid when *type* is set to QinQ_PPPoE. */
+		struct rte_table_encap_ether_qinq_pppoe qinq_pppoe;
 	};
 };
 
-- 
2.17.1

--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.

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

* [dpdk-dev] [PATCH v4 2/4] examples/ip_pipeline: support QinQ PPPoE encap
  2019-01-18  9:12     ` [dpdk-dev] [PATCH v4 1/4] pipeline: support QinQ PPPoE encap Nemanja Marjanovic
@ 2019-01-18  9:12       ` Nemanja Marjanovic
  2019-01-18  9:12       ` [dpdk-dev] [PATCH v4 3/4] net/softnic: " Nemanja Marjanovic
                         ` (2 subsequent siblings)
  3 siblings, 0 replies; 20+ messages in thread
From: Nemanja Marjanovic @ 2019-01-18  9:12 UTC (permalink / raw)
  To: dev; +Cc: jasvinder.singh, cristian.dumitrescu, Nemanja Marjanovic

From: "Nemanja Marjanovic" <nemanja.marjanovic@intel.com>

Add implementation of QinQ PPPoE packet encapsulation action.

Signed-off-by: Nemanja Marjanovic <nemanja.marjanovic@intel.com>
---
v4:Splitting of patches for easier review
---
 examples/ip_pipeline/cli.c | 46 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 44 insertions(+), 2 deletions(-)

diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
index 910386282..dd05393ef 100644
--- a/examples/ip_pipeline/cli.c
+++ b/examples/ip_pipeline/cli.c
@@ -1022,7 +1022,7 @@ static const char cmd_table_action_profile_help[] =
 "       tc <n_tc>\n"
 "       stats none | pkts | bytes | both]\n"
 "   [tm spp <n_subports_per_port> pps <n_pipes_per_subport>]\n"
-"   [encap ether | vlan | qinq | mpls | pppoe |\n"
+"   [encap ether | vlan | qinq | mpls | pppoe | qinq_pppoe \n"
 "       vxlan offset <ether_offset> ipv4 | ipv6 vlan on | off]\n"
 "   [nat src | dst\n"
 "       proto udp | tcp]\n"
@@ -1290,7 +1290,10 @@ cmd_table_action_profile(char **tokens,
 
 			p.encap.encap_mask = 1LLU << RTE_TABLE_ACTION_ENCAP_VXLAN;
 			n_extra_tokens = 5;
-		} else {
+		} else if (strcmp(tokens[t0 + 1], "qinq_pppoe") == 0)
+			p.encap.encap_mask =
+				1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE;
+		else {
 			snprintf(out, out_size, MSG_ARG_MISMATCH, "encap");
 			return;
 		}
@@ -3090,6 +3093,7 @@ parse_match(char **tokens,
  *       ether <da> <sa>
  *       | vlan <da> <sa> <pcp> <dei> <vid>
  *       | qinq <da> <sa> <pcp> <dei> <vid> <pcp> <dei> <vid>
+ *       | qinq_pppoe <da> <sa> <pcp> <dei> <vid> <pcp> <dei> <vid> <session_id>
  *       | mpls unicast | multicast
  *          <da> <sa>
  *          label0 <label> <tc> <ttl>
@@ -3391,6 +3395,44 @@ parse_table_action_encap(char **tokens,
 		return 1 + 9;
 	}
 
+	/* qinq_pppoe */
+	if (n_tokens && (strcmp(tokens[0], "qinq_pppoe") == 0)) {
+		uint32_t svlan_pcp, svlan_dei, svlan_vid;
+		uint32_t cvlan_pcp, cvlan_dei, cvlan_vid;
+
+		if ((n_tokens < 10) ||
+			parse_mac_addr(tokens[1],
+				&a->encap.qinq_pppoe.ether.da) ||
+			parse_mac_addr(tokens[2],
+				&a->encap.qinq_pppoe.ether.sa) ||
+			parser_read_uint32(&svlan_pcp, tokens[3]) ||
+			(svlan_pcp > 0x7) ||
+			parser_read_uint32(&svlan_dei, tokens[4]) ||
+			(svlan_dei > 0x1) ||
+			parser_read_uint32(&svlan_vid, tokens[5]) ||
+			(svlan_vid > 0xFFF) ||
+			parser_read_uint32(&cvlan_pcp, tokens[6]) ||
+			(cvlan_pcp > 0x7) ||
+			parser_read_uint32(&cvlan_dei, tokens[7]) ||
+			(cvlan_dei > 0x1) ||
+			parser_read_uint32(&cvlan_vid, tokens[8]) ||
+			(cvlan_vid > 0xFFF) ||
+			parser_read_uint16(&a->encap.qinq_pppoe.pppoe.session_id,
+				tokens[9]))
+			return 0;
+
+		a->encap.qinq_pppoe.svlan.pcp = svlan_pcp & 0x7;
+		a->encap.qinq_pppoe.svlan.dei = svlan_dei & 0x1;
+		a->encap.qinq_pppoe.svlan.vid = svlan_vid & 0xFFF;
+		a->encap.qinq_pppoe.cvlan.pcp = cvlan_pcp & 0x7;
+		a->encap.qinq_pppoe.cvlan.dei = cvlan_dei & 0x1;
+		a->encap.qinq_pppoe.cvlan.vid = cvlan_vid & 0xFFF;
+		a->encap.type = RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE;
+		a->action_mask |= 1 << RTE_TABLE_ACTION_ENCAP;
+		return 1 + 10;
+
+	}
+
 	/* mpls */
 	if (n_tokens && (strcmp(tokens[0], "mpls") == 0)) {
 		uint32_t label, tc, ttl;
-- 
2.17.1

--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.

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

* [dpdk-dev] [PATCH v4 3/4] net/softnic: support QinQ PPPoE encap
  2019-01-18  9:12     ` [dpdk-dev] [PATCH v4 1/4] pipeline: support QinQ PPPoE encap Nemanja Marjanovic
  2019-01-18  9:12       ` [dpdk-dev] [PATCH v4 2/4] examples/ip_pipeline: " Nemanja Marjanovic
@ 2019-01-18  9:12       ` Nemanja Marjanovic
  2019-01-18  9:12       ` [dpdk-dev] [PATCH v4 4/4] net: add PPPoE ethertypes Nemanja Marjanovic
  2019-01-18  9:52       ` [dpdk-dev] [PATCH v4 " Dumitrescu, Cristian
  3 siblings, 0 replies; 20+ messages in thread
From: Nemanja Marjanovic @ 2019-01-18  9:12 UTC (permalink / raw)
  To: dev; +Cc: jasvinder.singh, cristian.dumitrescu, Nemanja Marjanovic

From: "Nemanja Marjanovic" <nemanja.marjanovic@intel.com>

Add implementation of QinQ PPPoE packet encapsulation action.

Signed-off-by: Nemanja Marjanovic <nemanja.marjanovic@intel.com>
---
v4:Added implementation of QinQ PPPoE packet encapsulation action.
---
 drivers/net/softnic/rte_eth_softnic_cli.c | 44 ++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c
index 57b623377..c15b57b5b 100644
--- a/drivers/net/softnic/rte_eth_softnic_cli.c
+++ b/drivers/net/softnic/rte_eth_softnic_cli.c
@@ -1335,7 +1335,7 @@ cmd_port_in_action_profile(struct pmd_internals *softnic,
  *      tc <n_tc>
  *      stats none | pkts | bytes | both]
  *  [tm spp <n_subports_per_port> pps <n_pipes_per_subport>]
- *  [encap ether | vlan | qinq | mpls | pppoe |
+ *  [encap ether | vlan | qinq | mpls | pppoe | qinq_pppoe |
  *      vxlan offset <ether_offset> ipv4 | ipv6 vlan on | off]
  *  [nat src | dst
  *      proto udp | tcp]
@@ -1612,10 +1612,14 @@ cmd_table_action_profile(struct pmd_internals *softnic,
 			p.encap.encap_mask = 1LLU << RTE_TABLE_ACTION_ENCAP_VXLAN;
 			n_extra_tokens = 5;
 
+		} else if (strcmp(tokens[t0 + 1], "qinq_pppoe") == 0) {
+			p.encap.encap_mask =
+				1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE;
 		} else {
 			snprintf(out, out_size, MSG_ARG_MISMATCH, "encap");
 			return;
 		}
+
 		p.action_mask |= 1LLU << RTE_TABLE_ACTION_ENCAP;
 		t0 += 2 + n_extra_tokens;
 	} /* encap */
@@ -3353,6 +3357,7 @@ parse_match(char **tokens,
  *       ether <da> <sa>
  *       | vlan <da> <sa> <pcp> <dei> <vid>
  *       | qinq <da> <sa> <pcp> <dei> <vid> <pcp> <dei> <vid>
+ *       | qinq_pppoe <da> <sa> <pcp> <dei> <vid> <pcp> <dei> <vid> <session_id>
  *       | mpls unicast | multicast
  *          <da> <sa>
  *          label0 <label> <tc> <ttl>
@@ -3658,6 +3663,43 @@ parse_table_action_encap(char **tokens,
 		return 1 + 9;
 	}
 
+	/* qinq_pppoe */
+	if (n_tokens && (strcmp(tokens[0], "qinq_pppoe") == 0)) {
+		uint32_t svlan_pcp, svlan_dei, svlan_vid;
+		uint32_t cvlan_pcp, cvlan_dei, cvlan_vid;
+
+		if (n_tokens < 10 ||
+			softnic_parse_mac_addr(tokens[1],
+				&a->encap.qinq_pppoe.ether.da) ||
+			softnic_parse_mac_addr(tokens[2],
+				&a->encap.qinq_pppoe.ether.sa) ||
+			softnic_parser_read_uint32(&svlan_pcp, tokens[3]) ||
+			svlan_pcp > 0x7 ||
+			softnic_parser_read_uint32(&svlan_dei, tokens[4]) ||
+			svlan_dei > 0x1 ||
+			softnic_parser_read_uint32(&svlan_vid, tokens[5]) ||
+			svlan_vid > 0xFFF ||
+			softnic_parser_read_uint32(&cvlan_pcp, tokens[6]) ||
+			cvlan_pcp > 0x7 ||
+			softnic_parser_read_uint32(&cvlan_dei, tokens[7]) ||
+			cvlan_dei > 0x1 ||
+			softnic_parser_read_uint32(&cvlan_vid, tokens[8]) ||
+			cvlan_vid > 0xFFF ||
+			softnic_parser_read_uint16(&a->encap.qinq_pppoe.pppoe.session_id,
+				tokens[9]))
+			return 0;
+
+		a->encap.qinq_pppoe.svlan.pcp = svlan_pcp & 0x7;
+		a->encap.qinq_pppoe.svlan.dei = svlan_dei & 0x1;
+		a->encap.qinq_pppoe.svlan.vid = svlan_vid & 0xFFF;
+		a->encap.qinq_pppoe.cvlan.pcp = cvlan_pcp & 0x7;
+		a->encap.qinq_pppoe.cvlan.dei = cvlan_dei & 0x1;
+		a->encap.qinq_pppoe.cvlan.vid = cvlan_vid & 0xFFF;
+		a->encap.type = RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE;
+		a->action_mask |= 1 << RTE_TABLE_ACTION_ENCAP;
+		return 1 + 10;
+	}
+
 	/* mpls */
 	if (n_tokens && (strcmp(tokens[0], "mpls") == 0)) {
 		uint32_t label, tc, ttl;
-- 
2.17.1

--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.

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

* [dpdk-dev] [PATCH v4 4/4] net: add PPPoE ethertypes
  2019-01-18  9:12     ` [dpdk-dev] [PATCH v4 1/4] pipeline: support QinQ PPPoE encap Nemanja Marjanovic
  2019-01-18  9:12       ` [dpdk-dev] [PATCH v4 2/4] examples/ip_pipeline: " Nemanja Marjanovic
  2019-01-18  9:12       ` [dpdk-dev] [PATCH v4 3/4] net/softnic: " Nemanja Marjanovic
@ 2019-01-18  9:12       ` Nemanja Marjanovic
  2019-01-18 11:01         ` Thomas Monjalon
  2019-01-21  9:02         ` [dpdk-dev] [PATCH v5 1/4] pipeline: support QinQ PPPoE encap Nemanja Marjanovic
  2019-01-18  9:52       ` [dpdk-dev] [PATCH v4 " Dumitrescu, Cristian
  3 siblings, 2 replies; 20+ messages in thread
From: Nemanja Marjanovic @ 2019-01-18  9:12 UTC (permalink / raw)
  To: dev; +Cc: jasvinder.singh, cristian.dumitrescu, Nemanja Marjanovic

From: "Nemanja Marjanovic" <nemanja.marjanovic@intel.com>

Add PPPoE ethertypes in to rte_ether.h.

Signed-off-by: Nemanja Marjanovic <nemanja.marjanovic@intel.com>
---
v4:Added PPPoE ethertypes in to rte_ether.h.
---
 lib/librte_net/rte_ether.h             | 2 ++
 lib/librte_pipeline/rte_table_action.c | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
index c2c5e249f..54822df75 100644
--- a/lib/librte_net/rte_ether.h
+++ b/lib/librte_net/rte_ether.h
@@ -301,6 +301,8 @@ struct vxlan_hdr {
 #define ETHER_TYPE_RARP 0x8035 /**< Reverse Arp Protocol. */
 #define ETHER_TYPE_VLAN 0x8100 /**< IEEE 802.1Q VLAN tagging. */
 #define ETHER_TYPE_QINQ 0x88A8 /**< IEEE 802.1ad QinQ tagging. */
+#define ETHER_TYPE_PPPOE_DISCOVERY 0x8863 /**< PPPoE Discovery Stage. */
+#define ETHER_TYPE_PPPOE_SESSION 0x8864 /**< PPPoE Session Stage. */
 #define ETHER_TYPE_ETAG 0x893F /**< IEEE 802.1BR E-Tag. */
 #define ETHER_TYPE_1588 0x88F7 /**< IEEE 802.1AS 1588 Precise Time Protocol. */
 #define ETHER_TYPE_SLOW 0x8809 /**< Slow protocols (LACP and Marker). */
diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c
index 466019934..ac8109f00 100644
--- a/lib/librte_pipeline/rte_table_action.c
+++ b/lib/librte_pipeline/rte_table_action.c
@@ -485,8 +485,6 @@ struct encap_mpls_data {
 	uint32_t mpls_count;
 } __attribute__((__packed__));
 
-#define ETHER_TYPE_PPPOE_SESSION                           0x8864
-
 #define PPP_PROTOCOL_IP                                    0x0021
 
 struct pppoe_ppp_hdr {
-- 
2.17.1

--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.

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

* Re: [dpdk-dev] [PATCH v4 1/4] pipeline: support QinQ PPPoE encap
  2019-01-18  9:12     ` [dpdk-dev] [PATCH v4 1/4] pipeline: support QinQ PPPoE encap Nemanja Marjanovic
                         ` (2 preceding siblings ...)
  2019-01-18  9:12       ` [dpdk-dev] [PATCH v4 4/4] net: add PPPoE ethertypes Nemanja Marjanovic
@ 2019-01-18  9:52       ` Dumitrescu, Cristian
  3 siblings, 0 replies; 20+ messages in thread
From: Dumitrescu, Cristian @ 2019-01-18  9:52 UTC (permalink / raw)
  To: Marjanovic, Nemanja, dev; +Cc: Singh, Jasvinder



> -----Original Message-----
> From: Marjanovic, Nemanja
> Sent: Friday, January 18, 2019 9:12 AM
> To: dev@dpdk.org
> Cc: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>; Marjanovic, Nemanja
> <nemanja.marjanovic@intel.com>
> Subject: [PATCH v4 1/4] pipeline: support QinQ PPPoE encap
> 
> From: "Nemanja Marjanovic" <nemanja.marjanovic@intel.com>
> 
> Add support of QinQ PPPoE packet encapsulation action.
> 
> Signed-off-by: Nemanja Marjanovic <nemanja.marjanovic@intel.com>
> ---
> v4:Splitting of patches for easier review
> ---
>  lib/librte_pipeline/rte_table_action.c | 61 ++++++++++++++++++++++++++
>  lib/librte_pipeline/rte_table_action.h | 16 +++++++
>  2 files changed, 77 insertions(+)
> 

Series-acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>

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

* Re: [dpdk-dev] [PATCH v4 4/4] net: add PPPoE ethertypes
  2019-01-18  9:12       ` [dpdk-dev] [PATCH v4 4/4] net: add PPPoE ethertypes Nemanja Marjanovic
@ 2019-01-18 11:01         ` Thomas Monjalon
  2019-01-21  9:02         ` [dpdk-dev] [PATCH v5 1/4] pipeline: support QinQ PPPoE encap Nemanja Marjanovic
  1 sibling, 0 replies; 20+ messages in thread
From: Thomas Monjalon @ 2019-01-18 11:01 UTC (permalink / raw)
  To: Nemanja Marjanovic
  Cc: dev, jasvinder.singh, cristian.dumitrescu, olivier.matz

+Cc Olivier, maintainer

18/01/2019 10:12, Nemanja Marjanovic:
> From: "Nemanja Marjanovic" <nemanja.marjanovic@intel.com>
> 
> Add PPPoE ethertypes in to rte_ether.h.
> 
> Signed-off-by: Nemanja Marjanovic <nemanja.marjanovic@intel.com>
> ---
> v4:Added PPPoE ethertypes in to rte_ether.h.
> ---
>  lib/librte_net/rte_ether.h             | 2 ++
>  lib/librte_pipeline/rte_table_action.c | 2 --
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
> index c2c5e249f..54822df75 100644
> --- a/lib/librte_net/rte_ether.h
> +++ b/lib/librte_net/rte_ether.h
> @@ -301,6 +301,8 @@ struct vxlan_hdr {
>  #define ETHER_TYPE_RARP 0x8035 /**< Reverse Arp Protocol. */
>  #define ETHER_TYPE_VLAN 0x8100 /**< IEEE 802.1Q VLAN tagging. */
>  #define ETHER_TYPE_QINQ 0x88A8 /**< IEEE 802.1ad QinQ tagging. */
> +#define ETHER_TYPE_PPPOE_DISCOVERY 0x8863 /**< PPPoE Discovery Stage. */
> +#define ETHER_TYPE_PPPOE_SESSION 0x8864 /**< PPPoE Session Stage. */
>  #define ETHER_TYPE_ETAG 0x893F /**< IEEE 802.1BR E-Tag. */
>  #define ETHER_TYPE_1588 0x88F7 /**< IEEE 802.1AS 1588 Precise Time Protocol. */
>  #define ETHER_TYPE_SLOW 0x8809 /**< Slow protocols (LACP and Marker). */
> diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c
> index 466019934..ac8109f00 100644
> --- a/lib/librte_pipeline/rte_table_action.c
> +++ b/lib/librte_pipeline/rte_table_action.c
> @@ -485,8 +485,6 @@ struct encap_mpls_data {
>  	uint32_t mpls_count;
>  } __attribute__((__packed__));
>  
> -#define ETHER_TYPE_PPPOE_SESSION                           0x8864
> -
>  #define PPP_PROTOCOL_IP                                    0x0021
>  
>  struct pppoe_ppp_hdr {
> 

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

* [dpdk-dev] [PATCH v5 1/4] pipeline: support QinQ PPPoE encap
  2019-01-18  9:12       ` [dpdk-dev] [PATCH v4 4/4] net: add PPPoE ethertypes Nemanja Marjanovic
  2019-01-18 11:01         ` Thomas Monjalon
@ 2019-01-21  9:02         ` Nemanja Marjanovic
  2019-01-21  9:02           ` [dpdk-dev] [PATCH v5 2/4] examples/ip_pipeline: " Nemanja Marjanovic
                             ` (2 more replies)
  1 sibling, 3 replies; 20+ messages in thread
From: Nemanja Marjanovic @ 2019-01-21  9:02 UTC (permalink / raw)
  To: dev; +Cc: jasvinder.singh, cristian.dumitrescu, Marjanovic,Nemanja

From: "Marjanovic,Nemanja" <nemanja.marjanovic@intel.com>

Add support of QinQ PPPoE packet encapsulation action.

Signed-off-by: Nemanja Marjanovic <nemanja.marjanovic@intel.com>
---
v5:Removing footer from patch.
---
 lib/librte_pipeline/rte_table_action.c | 61 ++++++++++++++++++++++++++
 lib/librte_pipeline/rte_table_action.h | 16 +++++++
 2 files changed, 77 insertions(+)

diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c
index 7c7c8dd82..466019934 100644
--- a/lib/librte_pipeline/rte_table_action.c
+++ b/lib/librte_pipeline/rte_table_action.c
@@ -432,6 +432,7 @@ encap_valid(enum rte_table_action_encap_type encap)
 	case RTE_TABLE_ACTION_ENCAP_MPLS:
 	case RTE_TABLE_ACTION_ENCAP_PPPOE:
 	case RTE_TABLE_ACTION_ENCAP_VXLAN:
+	case RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
 		return 1;
 	default:
 		return 0;
@@ -532,6 +533,13 @@ struct encap_vxlan_ipv6_vlan_data {
 	struct vxlan_hdr vxlan;
 } __attribute__((__packed__));
 
+struct encap_qinq_pppoe_data {
+	struct ether_hdr ether;
+	struct vlan_hdr svlan;
+	struct vlan_hdr cvlan;
+	struct pppoe_ppp_hdr pppoe_ppp;
+} __attribute__((__packed__));
+
 static size_t
 encap_data_size(struct rte_table_action_encap_config *encap)
 {
@@ -563,6 +571,9 @@ encap_data_size(struct rte_table_action_encap_config *encap)
 			else
 				return sizeof(struct encap_vxlan_ipv6_data);
 
+	case 1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
+			return sizeof(struct encap_qinq_pppoe_data);
+
 	default:
 		return 0;
 	}
@@ -599,6 +610,9 @@ encap_apply_check(struct rte_table_action_encap_params *p,
 	case RTE_TABLE_ACTION_ENCAP_VXLAN:
 		return 0;
 
+	case RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
+		return 0;
+
 	default:
 		return -EINVAL;
 	}
@@ -676,6 +690,38 @@ encap_qinq_apply(void *data,
 	return 0;
 }
 
+static int
+encap_qinq_pppoe_apply(void *data,
+	struct rte_table_action_encap_params *p)
+{
+	struct encap_qinq_pppoe_data *d = data;
+
+	/* Ethernet */
+	ether_addr_copy(&p->qinq.ether.da, &d->ether.d_addr);
+	ether_addr_copy(&p->qinq.ether.sa, &d->ether.s_addr);
+	d->ether.ether_type = rte_htons(ETHER_TYPE_VLAN);
+
+	/* SVLAN */
+	d->svlan.vlan_tci = rte_htons(VLAN(p->qinq.svlan.pcp,
+		p->qinq.svlan.dei,
+		p->qinq.svlan.vid));
+	d->svlan.eth_proto = rte_htons(ETHER_TYPE_VLAN);
+
+	/* CVLAN */
+	d->cvlan.vlan_tci = rte_htons(VLAN(p->qinq.cvlan.pcp,
+		p->qinq.cvlan.dei,
+		p->qinq.cvlan.vid));
+	d->cvlan.eth_proto = rte_htons(ETHER_TYPE_PPPOE_SESSION);
+
+	/* PPPoE and PPP*/
+	d->pppoe_ppp.ver_type_code = rte_htons(0x1100);
+	d->pppoe_ppp.session_id = rte_htons(p->qinq_pppoe.pppoe.session_id);
+	d->pppoe_ppp.length = 0; /* not pre-computed */
+	d->pppoe_ppp.protocol = rte_htons(PPP_PROTOCOL_IP);
+
+	return 0;
+}
+
 static int
 encap_mpls_apply(void *data,
 	struct rte_table_action_encap_params *p)
@@ -921,6 +967,9 @@ encap_apply(void *data,
 	case RTE_TABLE_ACTION_ENCAP_VXLAN:
 		return encap_vxlan_apply(data, p, cfg);
 
+	case RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
+		return encap_qinq_pppoe_apply(data, p);
+
 	default:
 		return -EINVAL;
 	}
@@ -1119,6 +1168,18 @@ pkt_work_encap(struct rte_mbuf *mbuf,
 		break;
 	}
 
+	case 1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
+	{
+		struct encap_qinq_pppoe_data *qinq_pppoe =
+			encap(ip, data, sizeof(struct encap_qinq_pppoe_data));
+		qinq_pppoe->pppoe_ppp.length = rte_htons(total_length + 2);
+		mbuf->data_off = ip_offset - (sizeof(struct rte_mbuf) +
+			sizeof(struct encap_qinq_pppoe_data));
+		mbuf->pkt_len = mbuf->data_len = total_length +
+			sizeof(struct encap_qinq_pppoe_data);
+		break;
+	}
+
 	case 1LLU << RTE_TABLE_ACTION_ENCAP_VXLAN:
 	{
 		if (cfg->vxlan.ip_version)
diff --git a/lib/librte_pipeline/rte_table_action.h b/lib/librte_pipeline/rte_table_action.h
index c96061291..53d16af8a 100644
--- a/lib/librte_pipeline/rte_table_action.h
+++ b/lib/librte_pipeline/rte_table_action.h
@@ -380,6 +380,9 @@ enum rte_table_action_encap_type {
 	 * Ether -> { Ether | VLAN | IP | UDP | VXLAN | Ether }
 	 */
 	RTE_TABLE_ACTION_ENCAP_VXLAN,
+
+	/** IP -> { Ether | S-VLAN | C-VLAN | PPPoE | PPP | IP } */
+	RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE,
 };
 
 /** Pre-computed Ethernet header fields for encapsulation action. */
@@ -529,6 +532,16 @@ struct rte_table_action_encap_config {
 	};
 };
 
+/** QinQ_PPPoE encap paramaeters. */
+struct rte_table_encap_ether_qinq_pppoe {
+
+	/** Only valid when *type* is set to QinQ. */
+	struct rte_table_action_ether_hdr ether;
+	struct rte_table_action_vlan_hdr svlan; /**< Service VLAN header. */
+	struct rte_table_action_vlan_hdr cvlan; /**< Customer VLAN header. */
+	struct rte_table_action_pppoe_hdr pppoe; /**< PPPoE/PPP headers. */
+};
+
 /** Encap action parameters (per table rule). */
 struct rte_table_action_encap_params {
 	/** Encapsulation type. */
@@ -553,6 +566,9 @@ struct rte_table_action_encap_params {
 
 		/** Only valid when *type* is set to VXLAN. */
 		struct rte_table_action_encap_vxlan_params vxlan;
+
+		/** Only valid when *type* is set to QinQ_PPPoE. */
+		struct rte_table_encap_ether_qinq_pppoe qinq_pppoe;
 	};
 };
 
-- 
2.17.1

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

* [dpdk-dev] [PATCH v5 2/4] examples/ip_pipeline: support QinQ PPPoE encap
  2019-01-21  9:02         ` [dpdk-dev] [PATCH v5 1/4] pipeline: support QinQ PPPoE encap Nemanja Marjanovic
@ 2019-01-21  9:02           ` Nemanja Marjanovic
  2019-01-21  9:02           ` [dpdk-dev] [PATCH v5 3/4] net/softnic: " Nemanja Marjanovic
  2019-01-21  9:02           ` [dpdk-dev] [PATCH v5 4/4] net: add PPPoE ethertypes Nemanja Marjanovic
  2 siblings, 0 replies; 20+ messages in thread
From: Nemanja Marjanovic @ 2019-01-21  9:02 UTC (permalink / raw)
  To: dev; +Cc: jasvinder.singh, cristian.dumitrescu, Marjanovic,Nemanja

From: "Marjanovic,Nemanja" <nemanja.marjanovic@intel.com>

Add implementation of QinQ PPPoE packet encapsulation action.

Signed-off-by: Nemanja Marjanovic <nemanja.marjanovic@intel.com>
---
v5:Removing footer from patch
---
 examples/ip_pipeline/cli.c | 46 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 44 insertions(+), 2 deletions(-)

diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
index 910386282..dd05393ef 100644
--- a/examples/ip_pipeline/cli.c
+++ b/examples/ip_pipeline/cli.c
@@ -1022,7 +1022,7 @@ static const char cmd_table_action_profile_help[] =
 "       tc <n_tc>\n"
 "       stats none | pkts | bytes | both]\n"
 "   [tm spp <n_subports_per_port> pps <n_pipes_per_subport>]\n"
-"   [encap ether | vlan | qinq | mpls | pppoe |\n"
+"   [encap ether | vlan | qinq | mpls | pppoe | qinq_pppoe \n"
 "       vxlan offset <ether_offset> ipv4 | ipv6 vlan on | off]\n"
 "   [nat src | dst\n"
 "       proto udp | tcp]\n"
@@ -1290,7 +1290,10 @@ cmd_table_action_profile(char **tokens,
 
 			p.encap.encap_mask = 1LLU << RTE_TABLE_ACTION_ENCAP_VXLAN;
 			n_extra_tokens = 5;
-		} else {
+		} else if (strcmp(tokens[t0 + 1], "qinq_pppoe") == 0)
+			p.encap.encap_mask =
+				1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE;
+		else {
 			snprintf(out, out_size, MSG_ARG_MISMATCH, "encap");
 			return;
 		}
@@ -3090,6 +3093,7 @@ parse_match(char **tokens,
  *       ether <da> <sa>
  *       | vlan <da> <sa> <pcp> <dei> <vid>
  *       | qinq <da> <sa> <pcp> <dei> <vid> <pcp> <dei> <vid>
+ *       | qinq_pppoe <da> <sa> <pcp> <dei> <vid> <pcp> <dei> <vid> <session_id>
  *       | mpls unicast | multicast
  *          <da> <sa>
  *          label0 <label> <tc> <ttl>
@@ -3391,6 +3395,44 @@ parse_table_action_encap(char **tokens,
 		return 1 + 9;
 	}
 
+	/* qinq_pppoe */
+	if (n_tokens && (strcmp(tokens[0], "qinq_pppoe") == 0)) {
+		uint32_t svlan_pcp, svlan_dei, svlan_vid;
+		uint32_t cvlan_pcp, cvlan_dei, cvlan_vid;
+
+		if ((n_tokens < 10) ||
+			parse_mac_addr(tokens[1],
+				&a->encap.qinq_pppoe.ether.da) ||
+			parse_mac_addr(tokens[2],
+				&a->encap.qinq_pppoe.ether.sa) ||
+			parser_read_uint32(&svlan_pcp, tokens[3]) ||
+			(svlan_pcp > 0x7) ||
+			parser_read_uint32(&svlan_dei, tokens[4]) ||
+			(svlan_dei > 0x1) ||
+			parser_read_uint32(&svlan_vid, tokens[5]) ||
+			(svlan_vid > 0xFFF) ||
+			parser_read_uint32(&cvlan_pcp, tokens[6]) ||
+			(cvlan_pcp > 0x7) ||
+			parser_read_uint32(&cvlan_dei, tokens[7]) ||
+			(cvlan_dei > 0x1) ||
+			parser_read_uint32(&cvlan_vid, tokens[8]) ||
+			(cvlan_vid > 0xFFF) ||
+			parser_read_uint16(&a->encap.qinq_pppoe.pppoe.session_id,
+				tokens[9]))
+			return 0;
+
+		a->encap.qinq_pppoe.svlan.pcp = svlan_pcp & 0x7;
+		a->encap.qinq_pppoe.svlan.dei = svlan_dei & 0x1;
+		a->encap.qinq_pppoe.svlan.vid = svlan_vid & 0xFFF;
+		a->encap.qinq_pppoe.cvlan.pcp = cvlan_pcp & 0x7;
+		a->encap.qinq_pppoe.cvlan.dei = cvlan_dei & 0x1;
+		a->encap.qinq_pppoe.cvlan.vid = cvlan_vid & 0xFFF;
+		a->encap.type = RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE;
+		a->action_mask |= 1 << RTE_TABLE_ACTION_ENCAP;
+		return 1 + 10;
+
+	}
+
 	/* mpls */
 	if (n_tokens && (strcmp(tokens[0], "mpls") == 0)) {
 		uint32_t label, tc, ttl;
-- 
2.17.1

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

* [dpdk-dev] [PATCH v5 3/4] net/softnic: support QinQ PPPoE encap
  2019-01-21  9:02         ` [dpdk-dev] [PATCH v5 1/4] pipeline: support QinQ PPPoE encap Nemanja Marjanovic
  2019-01-21  9:02           ` [dpdk-dev] [PATCH v5 2/4] examples/ip_pipeline: " Nemanja Marjanovic
@ 2019-01-21  9:02           ` Nemanja Marjanovic
  2019-01-21  9:02           ` [dpdk-dev] [PATCH v5 4/4] net: add PPPoE ethertypes Nemanja Marjanovic
  2 siblings, 0 replies; 20+ messages in thread
From: Nemanja Marjanovic @ 2019-01-21  9:02 UTC (permalink / raw)
  To: dev; +Cc: jasvinder.singh, cristian.dumitrescu, Marjanovic,Nemanja

From: "Marjanovic,Nemanja" <nemanja.marjanovic@intel.com>

Add implementation of QinQ PPPoE packet encapsulation action.

Signed-off-by: Nemanja Marjanovic <nemanja.marjanovic@intel.com>
---
v5:Removing footer from patch.
---
 drivers/net/softnic/rte_eth_softnic_cli.c | 44 ++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c
index 57b623377..c15b57b5b 100644
--- a/drivers/net/softnic/rte_eth_softnic_cli.c
+++ b/drivers/net/softnic/rte_eth_softnic_cli.c
@@ -1335,7 +1335,7 @@ cmd_port_in_action_profile(struct pmd_internals *softnic,
  *      tc <n_tc>
  *      stats none | pkts | bytes | both]
  *  [tm spp <n_subports_per_port> pps <n_pipes_per_subport>]
- *  [encap ether | vlan | qinq | mpls | pppoe |
+ *  [encap ether | vlan | qinq | mpls | pppoe | qinq_pppoe |
  *      vxlan offset <ether_offset> ipv4 | ipv6 vlan on | off]
  *  [nat src | dst
  *      proto udp | tcp]
@@ -1612,10 +1612,14 @@ cmd_table_action_profile(struct pmd_internals *softnic,
 			p.encap.encap_mask = 1LLU << RTE_TABLE_ACTION_ENCAP_VXLAN;
 			n_extra_tokens = 5;
 
+		} else if (strcmp(tokens[t0 + 1], "qinq_pppoe") == 0) {
+			p.encap.encap_mask =
+				1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE;
 		} else {
 			snprintf(out, out_size, MSG_ARG_MISMATCH, "encap");
 			return;
 		}
+
 		p.action_mask |= 1LLU << RTE_TABLE_ACTION_ENCAP;
 		t0 += 2 + n_extra_tokens;
 	} /* encap */
@@ -3353,6 +3357,7 @@ parse_match(char **tokens,
  *       ether <da> <sa>
  *       | vlan <da> <sa> <pcp> <dei> <vid>
  *       | qinq <da> <sa> <pcp> <dei> <vid> <pcp> <dei> <vid>
+ *       | qinq_pppoe <da> <sa> <pcp> <dei> <vid> <pcp> <dei> <vid> <session_id>
  *       | mpls unicast | multicast
  *          <da> <sa>
  *          label0 <label> <tc> <ttl>
@@ -3658,6 +3663,43 @@ parse_table_action_encap(char **tokens,
 		return 1 + 9;
 	}
 
+	/* qinq_pppoe */
+	if (n_tokens && (strcmp(tokens[0], "qinq_pppoe") == 0)) {
+		uint32_t svlan_pcp, svlan_dei, svlan_vid;
+		uint32_t cvlan_pcp, cvlan_dei, cvlan_vid;
+
+		if (n_tokens < 10 ||
+			softnic_parse_mac_addr(tokens[1],
+				&a->encap.qinq_pppoe.ether.da) ||
+			softnic_parse_mac_addr(tokens[2],
+				&a->encap.qinq_pppoe.ether.sa) ||
+			softnic_parser_read_uint32(&svlan_pcp, tokens[3]) ||
+			svlan_pcp > 0x7 ||
+			softnic_parser_read_uint32(&svlan_dei, tokens[4]) ||
+			svlan_dei > 0x1 ||
+			softnic_parser_read_uint32(&svlan_vid, tokens[5]) ||
+			svlan_vid > 0xFFF ||
+			softnic_parser_read_uint32(&cvlan_pcp, tokens[6]) ||
+			cvlan_pcp > 0x7 ||
+			softnic_parser_read_uint32(&cvlan_dei, tokens[7]) ||
+			cvlan_dei > 0x1 ||
+			softnic_parser_read_uint32(&cvlan_vid, tokens[8]) ||
+			cvlan_vid > 0xFFF ||
+			softnic_parser_read_uint16(&a->encap.qinq_pppoe.pppoe.session_id,
+				tokens[9]))
+			return 0;
+
+		a->encap.qinq_pppoe.svlan.pcp = svlan_pcp & 0x7;
+		a->encap.qinq_pppoe.svlan.dei = svlan_dei & 0x1;
+		a->encap.qinq_pppoe.svlan.vid = svlan_vid & 0xFFF;
+		a->encap.qinq_pppoe.cvlan.pcp = cvlan_pcp & 0x7;
+		a->encap.qinq_pppoe.cvlan.dei = cvlan_dei & 0x1;
+		a->encap.qinq_pppoe.cvlan.vid = cvlan_vid & 0xFFF;
+		a->encap.type = RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE;
+		a->action_mask |= 1 << RTE_TABLE_ACTION_ENCAP;
+		return 1 + 10;
+	}
+
 	/* mpls */
 	if (n_tokens && (strcmp(tokens[0], "mpls") == 0)) {
 		uint32_t label, tc, ttl;
-- 
2.17.1

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

* [dpdk-dev] [PATCH v5 4/4] net: add PPPoE ethertypes
  2019-01-21  9:02         ` [dpdk-dev] [PATCH v5 1/4] pipeline: support QinQ PPPoE encap Nemanja Marjanovic
  2019-01-21  9:02           ` [dpdk-dev] [PATCH v5 2/4] examples/ip_pipeline: " Nemanja Marjanovic
  2019-01-21  9:02           ` [dpdk-dev] [PATCH v5 3/4] net/softnic: " Nemanja Marjanovic
@ 2019-01-21  9:02           ` Nemanja Marjanovic
  2019-01-21 11:11             ` [dpdk-dev] [PATCH v6 1/4] pipeline: support QinQ PPPoE encap Nemanja Marjanovic
  2 siblings, 1 reply; 20+ messages in thread
From: Nemanja Marjanovic @ 2019-01-21  9:02 UTC (permalink / raw)
  To: dev; +Cc: jasvinder.singh, cristian.dumitrescu, Marjanovic,Nemanja

From: "Marjanovic,Nemanja" <nemanja.marjanovic@intel.com>

Add PPPoE ethertypes in to rte_ether.h.

Signed-off-by: Nemanja Marjanovic <nemanja.marjanovic@intel.com>
---
v5:Removing footer from patch.
---
 lib/librte_net/rte_ether.h             | 2 ++
 lib/librte_pipeline/rte_table_action.c | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
index c2c5e249f..54822df75 100644
--- a/lib/librte_net/rte_ether.h
+++ b/lib/librte_net/rte_ether.h
@@ -301,6 +301,8 @@ struct vxlan_hdr {
 #define ETHER_TYPE_RARP 0x8035 /**< Reverse Arp Protocol. */
 #define ETHER_TYPE_VLAN 0x8100 /**< IEEE 802.1Q VLAN tagging. */
 #define ETHER_TYPE_QINQ 0x88A8 /**< IEEE 802.1ad QinQ tagging. */
+#define ETHER_TYPE_PPPOE_DISCOVERY 0x8863 /**< PPPoE Discovery Stage. */
+#define ETHER_TYPE_PPPOE_SESSION 0x8864 /**< PPPoE Session Stage. */
 #define ETHER_TYPE_ETAG 0x893F /**< IEEE 802.1BR E-Tag. */
 #define ETHER_TYPE_1588 0x88F7 /**< IEEE 802.1AS 1588 Precise Time Protocol. */
 #define ETHER_TYPE_SLOW 0x8809 /**< Slow protocols (LACP and Marker). */
diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c
index 466019934..ac8109f00 100644
--- a/lib/librte_pipeline/rte_table_action.c
+++ b/lib/librte_pipeline/rte_table_action.c
@@ -485,8 +485,6 @@ struct encap_mpls_data {
 	uint32_t mpls_count;
 } __attribute__((__packed__));
 
-#define ETHER_TYPE_PPPOE_SESSION                           0x8864
-
 #define PPP_PROTOCOL_IP                                    0x0021
 
 struct pppoe_ppp_hdr {
-- 
2.17.1

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

* [dpdk-dev] [PATCH v6 1/4] pipeline: support QinQ PPPoE encap
  2019-01-21  9:02           ` [dpdk-dev] [PATCH v5 4/4] net: add PPPoE ethertypes Nemanja Marjanovic
@ 2019-01-21 11:11             ` Nemanja Marjanovic
  2019-01-21 11:11               ` [dpdk-dev] [PATCH v6 2/4] examples/ip_pipeline: " Nemanja Marjanovic
                                 ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: Nemanja Marjanovic @ 2019-01-21 11:11 UTC (permalink / raw)
  To: dev; +Cc: jasvinder.singh, cristian.dumitrescu, Nemanja Marjanovic

From: "Nemanja Marjanovic" <nemanja.marjanovic@intel.com>

Add support of QinQ PPPoE packet encapsulation action.

Signed-off-by: Nemanja Marjanovic <nemanja.marjanovic@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
v5:Removing footer from patch.
v6:Added missing acks.
---
 lib/librte_pipeline/rte_table_action.c | 61 ++++++++++++++++++++++++++
 lib/librte_pipeline/rte_table_action.h | 16 +++++++
 2 files changed, 77 insertions(+)

diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c
index 7c7c8dd82..466019934 100644
--- a/lib/librte_pipeline/rte_table_action.c
+++ b/lib/librte_pipeline/rte_table_action.c
@@ -432,6 +432,7 @@ encap_valid(enum rte_table_action_encap_type encap)
 	case RTE_TABLE_ACTION_ENCAP_MPLS:
 	case RTE_TABLE_ACTION_ENCAP_PPPOE:
 	case RTE_TABLE_ACTION_ENCAP_VXLAN:
+	case RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
 		return 1;
 	default:
 		return 0;
@@ -532,6 +533,13 @@ struct encap_vxlan_ipv6_vlan_data {
 	struct vxlan_hdr vxlan;
 } __attribute__((__packed__));
 
+struct encap_qinq_pppoe_data {
+	struct ether_hdr ether;
+	struct vlan_hdr svlan;
+	struct vlan_hdr cvlan;
+	struct pppoe_ppp_hdr pppoe_ppp;
+} __attribute__((__packed__));
+
 static size_t
 encap_data_size(struct rte_table_action_encap_config *encap)
 {
@@ -563,6 +571,9 @@ encap_data_size(struct rte_table_action_encap_config *encap)
 			else
 				return sizeof(struct encap_vxlan_ipv6_data);
 
+	case 1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
+			return sizeof(struct encap_qinq_pppoe_data);
+
 	default:
 		return 0;
 	}
@@ -599,6 +610,9 @@ encap_apply_check(struct rte_table_action_encap_params *p,
 	case RTE_TABLE_ACTION_ENCAP_VXLAN:
 		return 0;
 
+	case RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
+		return 0;
+
 	default:
 		return -EINVAL;
 	}
@@ -676,6 +690,38 @@ encap_qinq_apply(void *data,
 	return 0;
 }
 
+static int
+encap_qinq_pppoe_apply(void *data,
+	struct rte_table_action_encap_params *p)
+{
+	struct encap_qinq_pppoe_data *d = data;
+
+	/* Ethernet */
+	ether_addr_copy(&p->qinq.ether.da, &d->ether.d_addr);
+	ether_addr_copy(&p->qinq.ether.sa, &d->ether.s_addr);
+	d->ether.ether_type = rte_htons(ETHER_TYPE_VLAN);
+
+	/* SVLAN */
+	d->svlan.vlan_tci = rte_htons(VLAN(p->qinq.svlan.pcp,
+		p->qinq.svlan.dei,
+		p->qinq.svlan.vid));
+	d->svlan.eth_proto = rte_htons(ETHER_TYPE_VLAN);
+
+	/* CVLAN */
+	d->cvlan.vlan_tci = rte_htons(VLAN(p->qinq.cvlan.pcp,
+		p->qinq.cvlan.dei,
+		p->qinq.cvlan.vid));
+	d->cvlan.eth_proto = rte_htons(ETHER_TYPE_PPPOE_SESSION);
+
+	/* PPPoE and PPP*/
+	d->pppoe_ppp.ver_type_code = rte_htons(0x1100);
+	d->pppoe_ppp.session_id = rte_htons(p->qinq_pppoe.pppoe.session_id);
+	d->pppoe_ppp.length = 0; /* not pre-computed */
+	d->pppoe_ppp.protocol = rte_htons(PPP_PROTOCOL_IP);
+
+	return 0;
+}
+
 static int
 encap_mpls_apply(void *data,
 	struct rte_table_action_encap_params *p)
@@ -921,6 +967,9 @@ encap_apply(void *data,
 	case RTE_TABLE_ACTION_ENCAP_VXLAN:
 		return encap_vxlan_apply(data, p, cfg);
 
+	case RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
+		return encap_qinq_pppoe_apply(data, p);
+
 	default:
 		return -EINVAL;
 	}
@@ -1119,6 +1168,18 @@ pkt_work_encap(struct rte_mbuf *mbuf,
 		break;
 	}
 
+	case 1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE:
+	{
+		struct encap_qinq_pppoe_data *qinq_pppoe =
+			encap(ip, data, sizeof(struct encap_qinq_pppoe_data));
+		qinq_pppoe->pppoe_ppp.length = rte_htons(total_length + 2);
+		mbuf->data_off = ip_offset - (sizeof(struct rte_mbuf) +
+			sizeof(struct encap_qinq_pppoe_data));
+		mbuf->pkt_len = mbuf->data_len = total_length +
+			sizeof(struct encap_qinq_pppoe_data);
+		break;
+	}
+
 	case 1LLU << RTE_TABLE_ACTION_ENCAP_VXLAN:
 	{
 		if (cfg->vxlan.ip_version)
diff --git a/lib/librte_pipeline/rte_table_action.h b/lib/librte_pipeline/rte_table_action.h
index c96061291..53d16af8a 100644
--- a/lib/librte_pipeline/rte_table_action.h
+++ b/lib/librte_pipeline/rte_table_action.h
@@ -380,6 +380,9 @@ enum rte_table_action_encap_type {
 	 * Ether -> { Ether | VLAN | IP | UDP | VXLAN | Ether }
 	 */
 	RTE_TABLE_ACTION_ENCAP_VXLAN,
+
+	/** IP -> { Ether | S-VLAN | C-VLAN | PPPoE | PPP | IP } */
+	RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE,
 };
 
 /** Pre-computed Ethernet header fields for encapsulation action. */
@@ -529,6 +532,16 @@ struct rte_table_action_encap_config {
 	};
 };
 
+/** QinQ_PPPoE encap paramaeters. */
+struct rte_table_encap_ether_qinq_pppoe {
+
+	/** Only valid when *type* is set to QinQ. */
+	struct rte_table_action_ether_hdr ether;
+	struct rte_table_action_vlan_hdr svlan; /**< Service VLAN header. */
+	struct rte_table_action_vlan_hdr cvlan; /**< Customer VLAN header. */
+	struct rte_table_action_pppoe_hdr pppoe; /**< PPPoE/PPP headers. */
+};
+
 /** Encap action parameters (per table rule). */
 struct rte_table_action_encap_params {
 	/** Encapsulation type. */
@@ -553,6 +566,9 @@ struct rte_table_action_encap_params {
 
 		/** Only valid when *type* is set to VXLAN. */
 		struct rte_table_action_encap_vxlan_params vxlan;
+
+		/** Only valid when *type* is set to QinQ_PPPoE. */
+		struct rte_table_encap_ether_qinq_pppoe qinq_pppoe;
 	};
 };
 
-- 
2.17.1

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

* [dpdk-dev] [PATCH v6 2/4] examples/ip_pipeline: support QinQ PPPoE encap
  2019-01-21 11:11             ` [dpdk-dev] [PATCH v6 1/4] pipeline: support QinQ PPPoE encap Nemanja Marjanovic
@ 2019-01-21 11:11               ` Nemanja Marjanovic
  2019-01-21 11:11               ` [dpdk-dev] [PATCH v6 3/4] net/softnic: " Nemanja Marjanovic
                                 ` (2 subsequent siblings)
  3 siblings, 0 replies; 20+ messages in thread
From: Nemanja Marjanovic @ 2019-01-21 11:11 UTC (permalink / raw)
  To: dev; +Cc: jasvinder.singh, cristian.dumitrescu, Nemanja Marjanovic

From: "Nemanja Marjanovic" <nemanja.marjanovic@intel.com>

Add implementation of QinQ PPPoE packet encapsulation action.

Signed-off-by: Nemanja Marjanovic <nemanja.marjanovic@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
v5:Removing footer from patch.
v6:Added missing acks.
---
 examples/ip_pipeline/cli.c | 46 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 44 insertions(+), 2 deletions(-)

diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
index 910386282..dd05393ef 100644
--- a/examples/ip_pipeline/cli.c
+++ b/examples/ip_pipeline/cli.c
@@ -1022,7 +1022,7 @@ static const char cmd_table_action_profile_help[] =
 "       tc <n_tc>\n"
 "       stats none | pkts | bytes | both]\n"
 "   [tm spp <n_subports_per_port> pps <n_pipes_per_subport>]\n"
-"   [encap ether | vlan | qinq | mpls | pppoe |\n"
+"   [encap ether | vlan | qinq | mpls | pppoe | qinq_pppoe \n"
 "       vxlan offset <ether_offset> ipv4 | ipv6 vlan on | off]\n"
 "   [nat src | dst\n"
 "       proto udp | tcp]\n"
@@ -1290,7 +1290,10 @@ cmd_table_action_profile(char **tokens,
 
 			p.encap.encap_mask = 1LLU << RTE_TABLE_ACTION_ENCAP_VXLAN;
 			n_extra_tokens = 5;
-		} else {
+		} else if (strcmp(tokens[t0 + 1], "qinq_pppoe") == 0)
+			p.encap.encap_mask =
+				1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE;
+		else {
 			snprintf(out, out_size, MSG_ARG_MISMATCH, "encap");
 			return;
 		}
@@ -3090,6 +3093,7 @@ parse_match(char **tokens,
  *       ether <da> <sa>
  *       | vlan <da> <sa> <pcp> <dei> <vid>
  *       | qinq <da> <sa> <pcp> <dei> <vid> <pcp> <dei> <vid>
+ *       | qinq_pppoe <da> <sa> <pcp> <dei> <vid> <pcp> <dei> <vid> <session_id>
  *       | mpls unicast | multicast
  *          <da> <sa>
  *          label0 <label> <tc> <ttl>
@@ -3391,6 +3395,44 @@ parse_table_action_encap(char **tokens,
 		return 1 + 9;
 	}
 
+	/* qinq_pppoe */
+	if (n_tokens && (strcmp(tokens[0], "qinq_pppoe") == 0)) {
+		uint32_t svlan_pcp, svlan_dei, svlan_vid;
+		uint32_t cvlan_pcp, cvlan_dei, cvlan_vid;
+
+		if ((n_tokens < 10) ||
+			parse_mac_addr(tokens[1],
+				&a->encap.qinq_pppoe.ether.da) ||
+			parse_mac_addr(tokens[2],
+				&a->encap.qinq_pppoe.ether.sa) ||
+			parser_read_uint32(&svlan_pcp, tokens[3]) ||
+			(svlan_pcp > 0x7) ||
+			parser_read_uint32(&svlan_dei, tokens[4]) ||
+			(svlan_dei > 0x1) ||
+			parser_read_uint32(&svlan_vid, tokens[5]) ||
+			(svlan_vid > 0xFFF) ||
+			parser_read_uint32(&cvlan_pcp, tokens[6]) ||
+			(cvlan_pcp > 0x7) ||
+			parser_read_uint32(&cvlan_dei, tokens[7]) ||
+			(cvlan_dei > 0x1) ||
+			parser_read_uint32(&cvlan_vid, tokens[8]) ||
+			(cvlan_vid > 0xFFF) ||
+			parser_read_uint16(&a->encap.qinq_pppoe.pppoe.session_id,
+				tokens[9]))
+			return 0;
+
+		a->encap.qinq_pppoe.svlan.pcp = svlan_pcp & 0x7;
+		a->encap.qinq_pppoe.svlan.dei = svlan_dei & 0x1;
+		a->encap.qinq_pppoe.svlan.vid = svlan_vid & 0xFFF;
+		a->encap.qinq_pppoe.cvlan.pcp = cvlan_pcp & 0x7;
+		a->encap.qinq_pppoe.cvlan.dei = cvlan_dei & 0x1;
+		a->encap.qinq_pppoe.cvlan.vid = cvlan_vid & 0xFFF;
+		a->encap.type = RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE;
+		a->action_mask |= 1 << RTE_TABLE_ACTION_ENCAP;
+		return 1 + 10;
+
+	}
+
 	/* mpls */
 	if (n_tokens && (strcmp(tokens[0], "mpls") == 0)) {
 		uint32_t label, tc, ttl;
-- 
2.17.1

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

* [dpdk-dev] [PATCH v6 3/4] net/softnic: support QinQ PPPoE encap
  2019-01-21 11:11             ` [dpdk-dev] [PATCH v6 1/4] pipeline: support QinQ PPPoE encap Nemanja Marjanovic
  2019-01-21 11:11               ` [dpdk-dev] [PATCH v6 2/4] examples/ip_pipeline: " Nemanja Marjanovic
@ 2019-01-21 11:11               ` Nemanja Marjanovic
  2019-01-21 11:11               ` [dpdk-dev] [PATCH v6 4/4] net: add PPPoE ethertypes Nemanja Marjanovic
  2019-03-29 20:08               ` [dpdk-dev] [PATCH v6 1/4] pipeline: support QinQ PPPoE encap Dumitrescu, Cristian
  3 siblings, 0 replies; 20+ messages in thread
From: Nemanja Marjanovic @ 2019-01-21 11:11 UTC (permalink / raw)
  To: dev; +Cc: jasvinder.singh, cristian.dumitrescu, Nemanja Marjanovic

From: "Nemanja Marjanovic" <nemanja.marjanovic@intel.com>

Add implementation of QinQ PPPoE packet encapsulation action.

Signed-off-by: Nemanja Marjanovic <nemanja.marjanovic@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
v5:Removing footer from patch.
v6:Added missing acks.
---
 drivers/net/softnic/rte_eth_softnic_cli.c | 44 ++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c
index 57b623377..c15b57b5b 100644
--- a/drivers/net/softnic/rte_eth_softnic_cli.c
+++ b/drivers/net/softnic/rte_eth_softnic_cli.c
@@ -1335,7 +1335,7 @@ cmd_port_in_action_profile(struct pmd_internals *softnic,
  *      tc <n_tc>
  *      stats none | pkts | bytes | both]
  *  [tm spp <n_subports_per_port> pps <n_pipes_per_subport>]
- *  [encap ether | vlan | qinq | mpls | pppoe |
+ *  [encap ether | vlan | qinq | mpls | pppoe | qinq_pppoe |
  *      vxlan offset <ether_offset> ipv4 | ipv6 vlan on | off]
  *  [nat src | dst
  *      proto udp | tcp]
@@ -1612,10 +1612,14 @@ cmd_table_action_profile(struct pmd_internals *softnic,
 			p.encap.encap_mask = 1LLU << RTE_TABLE_ACTION_ENCAP_VXLAN;
 			n_extra_tokens = 5;
 
+		} else if (strcmp(tokens[t0 + 1], "qinq_pppoe") == 0) {
+			p.encap.encap_mask =
+				1LLU << RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE;
 		} else {
 			snprintf(out, out_size, MSG_ARG_MISMATCH, "encap");
 			return;
 		}
+
 		p.action_mask |= 1LLU << RTE_TABLE_ACTION_ENCAP;
 		t0 += 2 + n_extra_tokens;
 	} /* encap */
@@ -3353,6 +3357,7 @@ parse_match(char **tokens,
  *       ether <da> <sa>
  *       | vlan <da> <sa> <pcp> <dei> <vid>
  *       | qinq <da> <sa> <pcp> <dei> <vid> <pcp> <dei> <vid>
+ *       | qinq_pppoe <da> <sa> <pcp> <dei> <vid> <pcp> <dei> <vid> <session_id>
  *       | mpls unicast | multicast
  *          <da> <sa>
  *          label0 <label> <tc> <ttl>
@@ -3658,6 +3663,43 @@ parse_table_action_encap(char **tokens,
 		return 1 + 9;
 	}
 
+	/* qinq_pppoe */
+	if (n_tokens && (strcmp(tokens[0], "qinq_pppoe") == 0)) {
+		uint32_t svlan_pcp, svlan_dei, svlan_vid;
+		uint32_t cvlan_pcp, cvlan_dei, cvlan_vid;
+
+		if (n_tokens < 10 ||
+			softnic_parse_mac_addr(tokens[1],
+				&a->encap.qinq_pppoe.ether.da) ||
+			softnic_parse_mac_addr(tokens[2],
+				&a->encap.qinq_pppoe.ether.sa) ||
+			softnic_parser_read_uint32(&svlan_pcp, tokens[3]) ||
+			svlan_pcp > 0x7 ||
+			softnic_parser_read_uint32(&svlan_dei, tokens[4]) ||
+			svlan_dei > 0x1 ||
+			softnic_parser_read_uint32(&svlan_vid, tokens[5]) ||
+			svlan_vid > 0xFFF ||
+			softnic_parser_read_uint32(&cvlan_pcp, tokens[6]) ||
+			cvlan_pcp > 0x7 ||
+			softnic_parser_read_uint32(&cvlan_dei, tokens[7]) ||
+			cvlan_dei > 0x1 ||
+			softnic_parser_read_uint32(&cvlan_vid, tokens[8]) ||
+			cvlan_vid > 0xFFF ||
+			softnic_parser_read_uint16(&a->encap.qinq_pppoe.pppoe.session_id,
+				tokens[9]))
+			return 0;
+
+		a->encap.qinq_pppoe.svlan.pcp = svlan_pcp & 0x7;
+		a->encap.qinq_pppoe.svlan.dei = svlan_dei & 0x1;
+		a->encap.qinq_pppoe.svlan.vid = svlan_vid & 0xFFF;
+		a->encap.qinq_pppoe.cvlan.pcp = cvlan_pcp & 0x7;
+		a->encap.qinq_pppoe.cvlan.dei = cvlan_dei & 0x1;
+		a->encap.qinq_pppoe.cvlan.vid = cvlan_vid & 0xFFF;
+		a->encap.type = RTE_TABLE_ACTION_ENCAP_QINQ_PPPOE;
+		a->action_mask |= 1 << RTE_TABLE_ACTION_ENCAP;
+		return 1 + 10;
+	}
+
 	/* mpls */
 	if (n_tokens && (strcmp(tokens[0], "mpls") == 0)) {
 		uint32_t label, tc, ttl;
-- 
2.17.1

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

* [dpdk-dev] [PATCH v6 4/4] net: add PPPoE ethertypes
  2019-01-21 11:11             ` [dpdk-dev] [PATCH v6 1/4] pipeline: support QinQ PPPoE encap Nemanja Marjanovic
  2019-01-21 11:11               ` [dpdk-dev] [PATCH v6 2/4] examples/ip_pipeline: " Nemanja Marjanovic
  2019-01-21 11:11               ` [dpdk-dev] [PATCH v6 3/4] net/softnic: " Nemanja Marjanovic
@ 2019-01-21 11:11               ` Nemanja Marjanovic
  2019-03-29 20:08               ` [dpdk-dev] [PATCH v6 1/4] pipeline: support QinQ PPPoE encap Dumitrescu, Cristian
  3 siblings, 0 replies; 20+ messages in thread
From: Nemanja Marjanovic @ 2019-01-21 11:11 UTC (permalink / raw)
  To: dev; +Cc: jasvinder.singh, cristian.dumitrescu, Nemanja Marjanovic

From: "Nemanja Marjanovic" <nemanja.marjanovic@intel.com>

Add PPPoE ethertypes in to rte_ether.h.

Signed-off-by: Nemanja Marjanovic <nemanja.marjanovic@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
v5:Removing footer from patch.
v6:Added missing acks.
---
 lib/librte_net/rte_ether.h             | 2 ++
 lib/librte_pipeline/rte_table_action.c | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
index c2c5e249f..54822df75 100644
--- a/lib/librte_net/rte_ether.h
+++ b/lib/librte_net/rte_ether.h
@@ -301,6 +301,8 @@ struct vxlan_hdr {
 #define ETHER_TYPE_RARP 0x8035 /**< Reverse Arp Protocol. */
 #define ETHER_TYPE_VLAN 0x8100 /**< IEEE 802.1Q VLAN tagging. */
 #define ETHER_TYPE_QINQ 0x88A8 /**< IEEE 802.1ad QinQ tagging. */
+#define ETHER_TYPE_PPPOE_DISCOVERY 0x8863 /**< PPPoE Discovery Stage. */
+#define ETHER_TYPE_PPPOE_SESSION 0x8864 /**< PPPoE Session Stage. */
 #define ETHER_TYPE_ETAG 0x893F /**< IEEE 802.1BR E-Tag. */
 #define ETHER_TYPE_1588 0x88F7 /**< IEEE 802.1AS 1588 Precise Time Protocol. */
 #define ETHER_TYPE_SLOW 0x8809 /**< Slow protocols (LACP and Marker). */
diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c
index 466019934..ac8109f00 100644
--- a/lib/librte_pipeline/rte_table_action.c
+++ b/lib/librte_pipeline/rte_table_action.c
@@ -485,8 +485,6 @@ struct encap_mpls_data {
 	uint32_t mpls_count;
 } __attribute__((__packed__));
 
-#define ETHER_TYPE_PPPOE_SESSION                           0x8864
-
 #define PPP_PROTOCOL_IP                                    0x0021
 
 struct pppoe_ppp_hdr {
-- 
2.17.1

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

* Re: [dpdk-dev] [PATCH v6 1/4] pipeline: support QinQ PPPoE encap
  2019-01-21 11:11             ` [dpdk-dev] [PATCH v6 1/4] pipeline: support QinQ PPPoE encap Nemanja Marjanovic
                                 ` (2 preceding siblings ...)
  2019-01-21 11:11               ` [dpdk-dev] [PATCH v6 4/4] net: add PPPoE ethertypes Nemanja Marjanovic
@ 2019-03-29 20:08               ` Dumitrescu, Cristian
  2019-03-29 20:08                 ` Dumitrescu, Cristian
  3 siblings, 1 reply; 20+ messages in thread
From: Dumitrescu, Cristian @ 2019-03-29 20:08 UTC (permalink / raw)
  To: Marjanovic, Nemanja, dev; +Cc: Singh, Jasvinder



> -----Original Message-----
> From: Marjanovic, Nemanja
> Sent: Monday, January 21, 2019 11:11 AM
> To: dev@dpdk.org
> Cc: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>; Marjanovic, Nemanja
> <nemanja.marjanovic@intel.com>
> Subject: [PATCH v6 1/4] pipeline: support QinQ PPPoE encap
> 
> From: "Nemanja Marjanovic" <nemanja.marjanovic@intel.com>
> 
> Add support of QinQ PPPoE packet encapsulation action.
> 
> Signed-off-by: Nemanja Marjanovic <nemanja.marjanovic@intel.com>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> ---
> v5:Removing footer from patch.
> v6:Added missing acks.
> ---

Series-acked-by: Cristian Dumitrescu <Cristian.dumitrescu@intel.com>

Applied to next-qos tree, thanks!

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

* Re: [dpdk-dev] [PATCH v6 1/4] pipeline: support QinQ PPPoE encap
  2019-03-29 20:08               ` [dpdk-dev] [PATCH v6 1/4] pipeline: support QinQ PPPoE encap Dumitrescu, Cristian
@ 2019-03-29 20:08                 ` Dumitrescu, Cristian
  0 siblings, 0 replies; 20+ messages in thread
From: Dumitrescu, Cristian @ 2019-03-29 20:08 UTC (permalink / raw)
  To: Marjanovic, Nemanja, dev; +Cc: Singh, Jasvinder



> -----Original Message-----
> From: Marjanovic, Nemanja
> Sent: Monday, January 21, 2019 11:11 AM
> To: dev@dpdk.org
> Cc: Singh, Jasvinder <jasvinder.singh@intel.com>; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>; Marjanovic, Nemanja
> <nemanja.marjanovic@intel.com>
> Subject: [PATCH v6 1/4] pipeline: support QinQ PPPoE encap
> 
> From: "Nemanja Marjanovic" <nemanja.marjanovic@intel.com>
> 
> Add support of QinQ PPPoE packet encapsulation action.
> 
> Signed-off-by: Nemanja Marjanovic <nemanja.marjanovic@intel.com>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> ---
> v5:Removing footer from patch.
> v6:Added missing acks.
> ---

Series-acked-by: Cristian Dumitrescu <Cristian.dumitrescu@intel.com>

Applied to next-qos tree, thanks!


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

end of thread, other threads:[~2019-03-29 20:08 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-14 10:02 [dpdk-dev] [PATCH] ip_pipeline: add QinQ PPPoE encapsulation action Marjanovic,Nemanja
2019-01-14 10:23 ` [dpdk-dev] [PATCH v2] " Marjanovic,Nemanja
2019-01-14 10:46   ` Dumitrescu, Cristian
2019-01-15 10:55   ` [dpdk-dev] [PATCH v3] " Marjanovic,Nemanja
2019-01-18  9:12     ` [dpdk-dev] [PATCH v4 1/4] pipeline: support QinQ PPPoE encap Nemanja Marjanovic
2019-01-18  9:12       ` [dpdk-dev] [PATCH v4 2/4] examples/ip_pipeline: " Nemanja Marjanovic
2019-01-18  9:12       ` [dpdk-dev] [PATCH v4 3/4] net/softnic: " Nemanja Marjanovic
2019-01-18  9:12       ` [dpdk-dev] [PATCH v4 4/4] net: add PPPoE ethertypes Nemanja Marjanovic
2019-01-18 11:01         ` Thomas Monjalon
2019-01-21  9:02         ` [dpdk-dev] [PATCH v5 1/4] pipeline: support QinQ PPPoE encap Nemanja Marjanovic
2019-01-21  9:02           ` [dpdk-dev] [PATCH v5 2/4] examples/ip_pipeline: " Nemanja Marjanovic
2019-01-21  9:02           ` [dpdk-dev] [PATCH v5 3/4] net/softnic: " Nemanja Marjanovic
2019-01-21  9:02           ` [dpdk-dev] [PATCH v5 4/4] net: add PPPoE ethertypes Nemanja Marjanovic
2019-01-21 11:11             ` [dpdk-dev] [PATCH v6 1/4] pipeline: support QinQ PPPoE encap Nemanja Marjanovic
2019-01-21 11:11               ` [dpdk-dev] [PATCH v6 2/4] examples/ip_pipeline: " Nemanja Marjanovic
2019-01-21 11:11               ` [dpdk-dev] [PATCH v6 3/4] net/softnic: " Nemanja Marjanovic
2019-01-21 11:11               ` [dpdk-dev] [PATCH v6 4/4] net: add PPPoE ethertypes Nemanja Marjanovic
2019-03-29 20:08               ` [dpdk-dev] [PATCH v6 1/4] pipeline: support QinQ PPPoE encap Dumitrescu, Cristian
2019-03-29 20:08                 ` Dumitrescu, Cristian
2019-01-18  9:52       ` [dpdk-dev] [PATCH v4 " Dumitrescu, Cristian

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