DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/2] Enable zero verdicts in ACLs
@ 2017-01-18 19:32 Michał Mirosław
  2017-01-18 19:32 ` [dpdk-dev] [PATCH 1/2] acl: remove invalid test Michał Mirosław
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Michał Mirosław @ 2017-01-18 19:32 UTC (permalink / raw)
  To: dev; +Cc: Ananyev, Konstantin, Thomas Monjalon

This set enables one to have ACL matches return 0 where the distinction
from no-match case is not needed.

This is a resubmission of the patches as a series, rebased on net-next tree,
no other changes vs v2.

v2: fixes to prog_guide and ACL tests

Michał Mirosław (2):
  acl: remove invalid test
  acl: allow zero verdict

 app/test/test_acl.c                                | 33 ----------------------
 .../prog_guide/packet_classif_access_ctrl.rst      |  3 +-
 lib/librte_acl/rte_acl.c                           |  3 +-
 lib/librte_acl/rte_acl.h                           |  2 --
 lib/librte_table/rte_table_acl.c                   |  2 +-
 5 files changed, 4 insertions(+), 39 deletions(-)

-- 
2.11.0

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

* [dpdk-dev] [PATCH 1/2] acl: remove invalid test
  2017-01-18 19:32 [dpdk-dev] [PATCH 0/2] Enable zero verdicts in ACLs Michał Mirosław
@ 2017-01-18 19:32 ` Michał Mirosław
  2017-01-18 19:32 ` [dpdk-dev] [PATCH 2/2] acl: allow zero verdict Michał Mirosław
  2017-01-19 11:57 ` [dpdk-dev] [PATCH 0/2] Enable zero verdicts in ACLs Ananyev, Konstantin
  2 siblings, 0 replies; 5+ messages in thread
From: Michał Mirosław @ 2017-01-18 19:32 UTC (permalink / raw)
  To: dev; +Cc: Ananyev, Konstantin, Thomas Monjalon

rte_acl_add_rules() has no way of checking rule size.

This was hidden because the test effectively checked that
adding a rule with userdata == 0 failed.

From: Michał Mirosław <michal.miroslaw@atendesoftware.pl>
Signed-off-by: Michał Mirosław <michal.miroslaw@atendesoftware.pl>
---
 app/test/test_acl.c | 20 --------------------
 1 file changed, 20 deletions(-)

diff --git a/app/test/test_acl.c b/app/test/test_acl.c
index 28955f08a..be744ec23 100644
--- a/app/test/test_acl.c
+++ b/app/test/test_acl.c
@@ -1515,26 +1515,6 @@ test_invalid_parameters(void)
 	/* free ACL context */
 	rte_acl_free(acx);
 
-	/* set wrong rule_size so that adding any rules would fail */
-	param.rule_size = RTE_ACL_IPV4VLAN_RULE_SZ + 4;
-	acx = rte_acl_create(&param);
-	if (acx == NULL) {
-		printf("Line %i: ACL context creation failed!\n", __LINE__);
-		return -1;
-	}
-
-	/* try adding a rule with size different from context rule_size */
-	result = rte_acl_ipv4vlan_add_rules(acx, &rule, 1);
-	if (result == 0) {
-		printf("Line %i: Adding an invalid sized rule "
-				"should have failed!\n", __LINE__);
-		rte_acl_free(acx);
-		return -1;
-	}
-
-	/* free ACL context */
-	rte_acl_free(acx);
-
 
 	/**
 	 * rte_acl_ipv4vlan_build
-- 
2.11.0

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

* [dpdk-dev] [PATCH 2/2] acl: allow zero verdict
  2017-01-18 19:32 [dpdk-dev] [PATCH 0/2] Enable zero verdicts in ACLs Michał Mirosław
  2017-01-18 19:32 ` [dpdk-dev] [PATCH 1/2] acl: remove invalid test Michał Mirosław
@ 2017-01-18 19:32 ` Michał Mirosław
  2017-01-19 11:57 ` [dpdk-dev] [PATCH 0/2] Enable zero verdicts in ACLs Ananyev, Konstantin
  2 siblings, 0 replies; 5+ messages in thread
From: Michał Mirosław @ 2017-01-18 19:32 UTC (permalink / raw)
  To: dev; +Cc: Ananyev, Konstantin, Thomas Monjalon

This enables ACL matches to return 0 where the distinction
from no-match case is not needed.

From: Michał Mirosław <michal.miroslaw@atendesoftware.pl>
Signed-off-by: Michał Mirosław <michal.miroslaw@atendesoftware.pl>
---
 app/test/test_acl.c                                  | 13 -------------
 doc/guides/prog_guide/packet_classif_access_ctrl.rst |  3 ++-
 lib/librte_acl/rte_acl.c                             |  3 +--
 lib/librte_acl/rte_acl.h                             |  2 --
 lib/librte_table/rte_table_acl.c                     |  2 +-
 5 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/app/test/test_acl.c b/app/test/test_acl.c
index be744ec23..c6b511fb1 100644
--- a/app/test/test_acl.c
+++ b/app/test/test_acl.c
@@ -1357,19 +1357,6 @@ test_invalid_rules(void)
 		goto err;
 	}
 
-	rule.dst_mask_len = 0;
-	rule.src_mask_len = 0;
-	rule.data.userdata = 0;
-
-	/* try adding this rule (it should fail because userdata is invalid) */
-	ret = rte_acl_ipv4vlan_add_rules(acx, &rule, 1);
-	if (ret == 0) {
-		printf("Line %i: Adding a rule with invalid user data "
-				"should have failed!\n", __LINE__);
-		rte_acl_free(acx);
-		return -1;
-	}
-
 	rte_acl_free(acx);
 
 	return 0;
diff --git a/doc/guides/prog_guide/packet_classif_access_ctrl.rst b/doc/guides/prog_guide/packet_classif_access_ctrl.rst
index 5fd3d348d..a6bee9ba2 100644
--- a/doc/guides/prog_guide/packet_classif_access_ctrl.rst
+++ b/doc/guides/prog_guide/packet_classif_access_ctrl.rst
@@ -329,8 +329,9 @@ When creating a set of rules, for each rule, additional information must be supp
     Each set could be assigned its own category and by combining them into a single database,
     one lookup returns a result for each of the four sets.
 
-*   **userdata**: A user-defined field that could be any value except zero.
+*   **userdata**: A user-defined value.
     For each category, a successful match returns the userdata field of the highest priority matched rule.
+    When no rules match, returned value is zero.
 
 .. note::
 
diff --git a/lib/librte_acl/rte_acl.c b/lib/librte_acl/rte_acl.c
index 8b7e92cec..d1f40bef0 100644
--- a/lib/librte_acl/rte_acl.c
+++ b/lib/librte_acl/rte_acl.c
@@ -313,8 +313,7 @@ acl_check_rule(const struct rte_acl_rule_data *rd)
 	if ((RTE_LEN2MASK(RTE_ACL_MAX_CATEGORIES, typeof(rd->category_mask)) &
 			rd->category_mask) == 0 ||
 			rd->priority > RTE_ACL_MAX_PRIORITY ||
-			rd->priority < RTE_ACL_MIN_PRIORITY ||
-			rd->userdata == RTE_ACL_INVALID_USERDATA)
+			rd->priority < RTE_ACL_MIN_PRIORITY)
 		return -EINVAL;
 	return 0;
 }
diff --git a/lib/librte_acl/rte_acl.h b/lib/librte_acl/rte_acl.h
index caa91f7ea..b53179a83 100644
--- a/lib/librte_acl/rte_acl.h
+++ b/lib/librte_acl/rte_acl.h
@@ -120,8 +120,6 @@ enum {
 	RTE_ACL_MIN_PRIORITY = 0,
 };
 
-#define	RTE_ACL_INVALID_USERDATA	0
-
 #define	RTE_ACL_MASKLEN_TO_BITMASK(v, s)	\
 ((v) == 0 ? (v) : (typeof(v))((uint64_t)-1 << ((s) * CHAR_BIT - (v))))
 
diff --git a/lib/librte_table/rte_table_acl.c b/lib/librte_table/rte_table_acl.c
index 8f1f8cebc..94b69a983 100644
--- a/lib/librte_table/rte_table_acl.c
+++ b/lib/librte_table/rte_table_acl.c
@@ -792,7 +792,7 @@ rte_table_acl_lookup(
 
 		pkts_mask &= ~pkt_mask;
 
-		if (action_table_pos != RTE_ACL_INVALID_USERDATA) {
+		if (action_table_pos != 0) {
 			pkts_out_mask |= pkt_mask;
 			entries[pkt_pos] = (void *)
 				&acl->memory[action_table_pos *
-- 
2.11.0

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

* Re: [dpdk-dev] [PATCH 0/2] Enable zero verdicts in ACLs
  2017-01-18 19:32 [dpdk-dev] [PATCH 0/2] Enable zero verdicts in ACLs Michał Mirosław
  2017-01-18 19:32 ` [dpdk-dev] [PATCH 1/2] acl: remove invalid test Michał Mirosław
  2017-01-18 19:32 ` [dpdk-dev] [PATCH 2/2] acl: allow zero verdict Michał Mirosław
@ 2017-01-19 11:57 ` Ananyev, Konstantin
  2017-01-30 10:10   ` Thomas Monjalon
  2 siblings, 1 reply; 5+ messages in thread
From: Ananyev, Konstantin @ 2017-01-19 11:57 UTC (permalink / raw)
  To: Michal Miroslaw, dev; +Cc: Thomas Monjalon



> -----Original Message-----
> From: Michał Mirosław [mailto:mirq-linux@rere.qmqm.pl]
> Sent: Wednesday, January 18, 2017 7:33 PM
> To: dev@dpdk.org
> Cc: Ananyev, Konstantin <konstantin.ananyev@intel.com>; Thomas Monjalon <thomas.monjalon@6wind.com>
> Subject: [PATCH 0/2] Enable zero verdicts in ACLs
> 
> This set enables one to have ACL matches return 0 where the distinction
> from no-match case is not needed.
> 
> This is a resubmission of the patches as a series, rebased on net-next tree,
> no other changes vs v2.
> 
> v2: fixes to prog_guide and ACL tests
> 
> Michał Mirosław (2):
>   acl: remove invalid test
>   acl: allow zero verdict
> 
>  app/test/test_acl.c                                | 33 ----------------------
>  .../prog_guide/packet_classif_access_ctrl.rst      |  3 +-
>  lib/librte_acl/rte_acl.c                           |  3 +-
>  lib/librte_acl/rte_acl.h                           |  2 --
>  lib/librte_table/rte_table_acl.c                   |  2 +-
>  5 files changed, 4 insertions(+), 39 deletions(-)
> 
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 2.11.0


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

* Re: [dpdk-dev] [PATCH 0/2] Enable zero verdicts in ACLs
  2017-01-19 11:57 ` [dpdk-dev] [PATCH 0/2] Enable zero verdicts in ACLs Ananyev, Konstantin
@ 2017-01-30 10:10   ` Thomas Monjalon
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2017-01-30 10:10 UTC (permalink / raw)
  To: Michal Miroslaw; +Cc: Ananyev, Konstantin, dev

> > This set enables one to have ACL matches return 0 where the distinction
> > from no-match case is not needed.
> > 
> > This is a resubmission of the patches as a series, rebased on net-next tree,
> > no other changes vs v2.
> > 
> > v2: fixes to prog_guide and ACL tests
> > 
> > Michał Mirosław (2):
> >   acl: remove invalid test
> >   acl: allow zero verdict
> 
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

Applied, thanks

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

end of thread, other threads:[~2017-01-30 10:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-18 19:32 [dpdk-dev] [PATCH 0/2] Enable zero verdicts in ACLs Michał Mirosław
2017-01-18 19:32 ` [dpdk-dev] [PATCH 1/2] acl: remove invalid test Michał Mirosław
2017-01-18 19:32 ` [dpdk-dev] [PATCH 2/2] acl: allow zero verdict Michał Mirosław
2017-01-19 11:57 ` [dpdk-dev] [PATCH 0/2] Enable zero verdicts in ACLs Ananyev, Konstantin
2017-01-30 10:10   ` 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).