DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Jyoti, Anand B" <anand.b.jyoti@intel.com>
To: "dev@dpdk.org" <dev@dpdk.org>
Cc: "Dumitrescu, Cristian" <cristian.dumitrescu@intel.com>
Subject: [dpdk-dev] [PATCH] examples/ip_pipeline: check vlan and mpls params
Date: Fri, 6 Jan 2017 16:00:41 +0000	[thread overview]
Message-ID: <A1F25702B3CE3F4F8D3936A55AD1FF37925DB521@BGSMSX108.gar.corp.intel.com> (raw)

diff --git a/examples/ip_pipeline/pipeline/pipeline_routing.c b/examples/ip_pipeline/pipeline/pipeline_routing.c
index 3aadbf9..b7faf5b 100644
--- a/examples/ip_pipeline/pipeline/pipeline_routing.c
+++ b/examples/ip_pipeline/pipeline/pipeline_routing.c
@@ -494,6 +494,26 @@ app_pipeline_routing_add_route(struct app_params *app,
 		/* data */
 		if (data->port_id >= p->n_ports_out)
 			return -1;
+
+		/* Valid range of VLAN tags 12 bits */
+		if(data->flags & PIPELINE_ROUTING_ROUTE_QINQ)
+			if((data->l2.qinq.svlan & 0xF000) ||
+					(data->l2.qinq.cvlan & 0xF000))
+				return -1;
+
+		/* Max number of MPLS labels supported */
+		if(data->flags & PIPELINE_ROUTING_ROUTE_MPLS){
+			uint32_t i;
+
+			if(data->l2.mpls.n_labels >
+					PIPELINE_ROUTING_MPLS_LABELS_MAX)
+				return -1;
+
+			/* Max MPLS label value 20 bits */
+			for(i = 0; i < data->l2.mpls.n_labels; i++)
+				if(data->l2.mpls.labels[i] & 0xFFF00000)
+					return -1;
+		}
 	}
 	break;

             reply	other threads:[~2017-01-06 16:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-06 16:00 Jyoti, Anand B [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-01-06 17:21 Jyoti, Anand B
2017-01-08 23:20 ` Stephen Hemminger
2017-01-06 12:05 Jyoti, Anand B

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=A1F25702B3CE3F4F8D3936A55AD1FF37925DB521@BGSMSX108.gar.corp.intel.com \
    --to=anand.b.jyoti@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    /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).