DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nemanja Marjanovic <nemanja.marjanovic@intel.com>
To: dev@dpdk.org
Cc: jasvinder.singh@intel.com, cristian.dumitrescu@intel.com,
	"Nemanja Marjanovic" <nemanja.marjanovic@intel.com>
Subject: [dpdk-dev] [PATCH v6 3/4] net/softnic: support QinQ PPPoE encap
Date: Mon, 21 Jan 2019 11:11:23 +0000	[thread overview]
Message-ID: <20190121111124.16362-3-nemanja.marjanovic@intel.com> (raw)
In-Reply-To: <20190121111124.16362-1-nemanja.marjanovic@intel.com>

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

  parent reply	other threads:[~2019-01-21 11:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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               ` Nemanja Marjanovic [this message]
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

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20190121111124.16362-3-nemanja.marjanovic@intel.com \
    --to=nemanja.marjanovic@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=jasvinder.singh@intel.com \
    /path/to/YOUR_REPLY

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

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