DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] examples/ip_pipeline: check vlan and mpls params
@ 2017-01-06 17:21 Jyoti, Anand B
  2017-01-08 21:55 ` [dpdk-dev] [PATCH v2] examples/ip_pipeline: check VLAN and MPLS params Jyoti, Anand B
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Jyoti, Anand B @ 2017-01-06 17:21 UTC (permalink / raw)
  To: dev

>From e346e359ed9c5e8261f09f93629bff56d7c10a11 Mon Sep 17 00:00:00 2001
From: "Jyoti, Anand B" <anand.b.jyoti@intel.com>
Date: Fri, 6 Jan 2017 08:40:55 +0530
Subject: [PATCH] examples/ip_pipeline: check vlan and mpls params

This commit add to CLI command check for the following errors
1. svlan and cvlan IDs greater than 12 bits
2. mpls ID greater than 20 bits
3. max number of supported mpls labels to avoid array overflow

It prevents running CLI commands with invalid parameters.

Signed-off-by: Jyoti, Anand B <anand.b.jyoti@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 examples/ip_pipeline/pipeline/pipeline_routing.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/examples/ip_pipeline/pipeline/pipeline_routing.c b/examples/ip_pipeline/pipeline/pipeline_routing.c
index 3aadbf9..3deaff9 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;
 
-- 
2.7.4

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

* [dpdk-dev] [PATCH v2] examples/ip_pipeline: check VLAN and MPLS params
  2017-01-06 17:21 [dpdk-dev] [PATCH] examples/ip_pipeline: check vlan and mpls params Jyoti, Anand B
@ 2017-01-08 21:55 ` Jyoti, Anand B
  2017-01-17 17:27   ` Thomas Monjalon
  2017-01-08 23:20 ` [dpdk-dev] [PATCH] examples/ip_pipeline: check vlan and mpls params Stephen Hemminger
  2017-06-02  6:29 ` [dpdk-dev] [PATCH v1] ring: fix return value for sc and mc dequeue Anand B Jyoti
  2 siblings, 1 reply; 7+ messages in thread
From: Jyoti, Anand B @ 2017-01-08 21:55 UTC (permalink / raw)
  To: dev; +Cc: stephen, cristian.dumitrescu, Anand B Jyoti

This commit add to CLI command check for the following errors
1. SVLAN and CVLAN IDs greater than 12 bits
2. MPLS ID greater than 20 bits
3. max number of supported MPLS labels to avoid array overflow

It prevents running CLI commands with invalid parameters.

Signed-off-by: Anand B Jyoti <anand.b.jyoti@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 examples/ip_pipeline/pipeline/pipeline_routing.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/examples/ip_pipeline/pipeline/pipeline_routing.c b/examples/ip_pipeline/pipeline/pipeline_routing.c
index 3aadbf9..3deaff9 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;
 
-- 
2.7.4

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

* Re: [dpdk-dev] [PATCH] examples/ip_pipeline: check vlan and mpls params
  2017-01-06 17:21 [dpdk-dev] [PATCH] examples/ip_pipeline: check vlan and mpls params Jyoti, Anand B
  2017-01-08 21:55 ` [dpdk-dev] [PATCH v2] examples/ip_pipeline: check VLAN and MPLS params Jyoti, Anand B
@ 2017-01-08 23:20 ` Stephen Hemminger
  2017-06-02  6:29 ` [dpdk-dev] [PATCH v1] ring: fix return value for sc and mc dequeue Anand B Jyoti
  2 siblings, 0 replies; 7+ messages in thread
From: Stephen Hemminger @ 2017-01-08 23:20 UTC (permalink / raw)
  To: Jyoti, Anand B; +Cc: dev

On Fri, 6 Jan 2017 17:21:46 +0000
"Jyoti, Anand B" <anand.b.jyoti@intel.com> wrote:

> +
> +			/* Max MPLS label value 20 bits */
> +			for (i = 0; i < data->l2.mpls.n_labels; i++)


What ever editor or mail system you are using is putting a unicode space in that statement,
not visible to normal mail client, but causes checkpatch failure.

> +
> +			/* Max MPLS label value 20 bits */
> +			for (i =3D 0; i < data->l2.mpls.n_labels; i++)

Please fix the patch and resubmit

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

* Re: [dpdk-dev] [PATCH v2] examples/ip_pipeline: check VLAN and MPLS params
  2017-01-08 21:55 ` [dpdk-dev] [PATCH v2] examples/ip_pipeline: check VLAN and MPLS params Jyoti, Anand B
@ 2017-01-17 17:27   ` Thomas Monjalon
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2017-01-17 17:27 UTC (permalink / raw)
  To: Jyoti, Anand B; +Cc: dev, stephen, cristian.dumitrescu

2017-01-09 03:25, Jyoti, Anand B:
> This commit add to CLI command check for the following errors
> 1. SVLAN and CVLAN IDs greater than 12 bits
> 2. MPLS ID greater than 20 bits
> 3. max number of supported MPLS labels to avoid array overflow
> 
> It prevents running CLI commands with invalid parameters.
> 
> Signed-off-by: Anand B Jyoti <anand.b.jyoti@intel.com>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>

Applied, thanks

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

* [dpdk-dev] [PATCH v1] ring: fix return value for sc and mc dequeue
  2017-01-06 17:21 [dpdk-dev] [PATCH] examples/ip_pipeline: check vlan and mpls params Jyoti, Anand B
  2017-01-08 21:55 ` [dpdk-dev] [PATCH v2] examples/ip_pipeline: check VLAN and MPLS params Jyoti, Anand B
  2017-01-08 23:20 ` [dpdk-dev] [PATCH] examples/ip_pipeline: check vlan and mpls params Stephen Hemminger
@ 2017-06-02  6:29 ` Anand B Jyoti
  2017-06-23  8:43   ` Olivier Matz
  2 siblings, 1 reply; 7+ messages in thread
From: Anand B Jyoti @ 2017-06-02  6:29 UTC (permalink / raw)
  To: dev; +Cc: kannan.babu.ramia

The error return code for rte_ring_sc_dequeue_bulk() and
rte_ring_mc_dequeue_bulk() function should be -ENOENT rather
than -ENOBUFS as described in the function description.

Signed-off-by: Anand B Jyoti <anand.b.jyoti@intel.com>
---
 lib/librte_ring/rte_ring.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h
index 97f025a..3400ed8 100644
--- a/lib/librte_ring/rte_ring.h
+++ b/lib/librte_ring/rte_ring.h
@@ -801,7 +801,7 @@ rte_ring_dequeue_bulk(struct rte_ring *r, void **obj_table, unsigned int n,
 static inline int __attribute__((always_inline))
 rte_ring_mc_dequeue(struct rte_ring *r, void **obj_p)
 {
-	return rte_ring_mc_dequeue_bulk(r, obj_p, 1, NULL)  ? 0 : -ENOBUFS;
+	return rte_ring_mc_dequeue_bulk(r, obj_p, 1, NULL)  ? 0 : -ENOENT;
 }
 
 /**
@@ -819,7 +819,7 @@ rte_ring_mc_dequeue(struct rte_ring *r, void **obj_p)
 static inline int __attribute__((always_inline))
 rte_ring_sc_dequeue(struct rte_ring *r, void **obj_p)
 {
-	return rte_ring_sc_dequeue_bulk(r, obj_p, 1, NULL) ? 0 : -ENOBUFS;
+	return rte_ring_sc_dequeue_bulk(r, obj_p, 1, NULL) ? 0 : -ENOENT;
 }
 
 /**
-- 
2.7.4

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

* Re: [dpdk-dev] [PATCH v1] ring: fix return value for sc and mc dequeue
  2017-06-02  6:29 ` [dpdk-dev] [PATCH v1] ring: fix return value for sc and mc dequeue Anand B Jyoti
@ 2017-06-23  8:43   ` Olivier Matz
  2017-06-23 12:43     ` Thomas Monjalon
  0 siblings, 1 reply; 7+ messages in thread
From: Olivier Matz @ 2017-06-23  8:43 UTC (permalink / raw)
  To: Anand B Jyoti; +Cc: dev, kannan.babu.ramia

Hi Anand,

On Fri,  2 Jun 2017 11:59:51 +0530, Anand B Jyoti <anand.b.jyoti@intel.com> wrote:
> The error return code for rte_ring_sc_dequeue_bulk() and
> rte_ring_mc_dequeue_bulk() function should be -ENOENT rather
> than -ENOBUFS as described in the function description.

Fixes: cfa7c9e6fc1f ("ring: make bulk and burst return values consistent")


> Signed-off-by: Anand B Jyoti <anand.b.jyoti@intel.com>

Acked-by: Olivier Matz <olivier.matz@6wind.com>

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

* Re: [dpdk-dev] [PATCH v1] ring: fix return value for sc and mc dequeue
  2017-06-23  8:43   ` Olivier Matz
@ 2017-06-23 12:43     ` Thomas Monjalon
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2017-06-23 12:43 UTC (permalink / raw)
  To: Anand B Jyoti; +Cc: dev, Olivier Matz, kannan.babu.ramia, stable

23/06/2017 10:43, Olivier Matz:
> Hi Anand,
> 
> On Fri,  2 Jun 2017 11:59:51 +0530, Anand B Jyoti <anand.b.jyoti@intel.com> wrote:
> > The error return code for rte_ring_sc_dequeue_bulk() and
> > rte_ring_mc_dequeue_bulk() function should be -ENOENT rather
> > than -ENOBUFS as described in the function description.
> 
> Fixes: cfa7c9e6fc1f ("ring: make bulk and burst return values consistent")

Cc: stable@dpdk.org

> > Signed-off-by: Anand B Jyoti <anand.b.jyoti@intel.com>
> 
> Acked-by: Olivier Matz <olivier.matz@6wind.com>

Applied, thanks

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

end of thread, other threads:[~2017-06-23 12:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-06 17:21 [dpdk-dev] [PATCH] examples/ip_pipeline: check vlan and mpls params Jyoti, Anand B
2017-01-08 21:55 ` [dpdk-dev] [PATCH v2] examples/ip_pipeline: check VLAN and MPLS params Jyoti, Anand B
2017-01-17 17:27   ` Thomas Monjalon
2017-01-08 23:20 ` [dpdk-dev] [PATCH] examples/ip_pipeline: check vlan and mpls params Stephen Hemminger
2017-06-02  6:29 ` [dpdk-dev] [PATCH v1] ring: fix return value for sc and mc dequeue Anand B Jyoti
2017-06-23  8:43   ` Olivier Matz
2017-06-23 12:43     ` Thomas Monjalon

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