[dpdk-dev] [PATCH v5 2/2] librte_pipeline: add new API functions for pipeline action handlers

2016-03-10 Thread Thomas Monjalon
2016-03-08 18:07, Jasvinder Singh:
> Two new pipeline API functions have been added to the library. The packet
> hijack API function can be called by any input/output port or table action
> handler to remove selected packets from the burst of packets read from one
> of the pipeline input ports and then either send these packets out through
> any pipeline output port or drop them.
> 
> Another packet drop API function can be used by the pipeline action
> handlers (port in/out, table) to drop the packets selected using packet
> mask. This function updates the drop statistics counters correctly.
> 
> Signed-off-by: Jasvinder Singh 
> Acked-by: Cristian Dumitrescu 

Series applied, thanks


[dpdk-dev] [PATCH v5 2/2] librte_pipeline: add new API functions for pipeline action handlers

2016-03-08 Thread Jasvinder Singh
Two new pipeline API functions have been added to the library. The packet
hijack API function can be called by any input/output port or table action
handler to remove selected packets from the burst of packets read from one
of the pipeline input ports and then either send these packets out through
any pipeline output port or drop them.

Another packet drop API function can be used by the pipeline action
handlers (port in/out, table) to drop the packets selected using packet
mask. This function updates the drop statistics counters correctly.

Signed-off-by: Jasvinder Singh 
Acked-by: Cristian Dumitrescu 
---
 app/test/test_table_pipeline.c |  53 +-
 .../ip_pipeline/pipeline/pipeline_actions_common.h |   8 +-
 lib/librte_pipeline/rte_pipeline.c |  20 
 lib/librte_pipeline/rte_pipeline.h | 107 +
 lib/librte_pipeline/rte_pipeline_version.map   |   8 ++
 5 files changed, 149 insertions(+), 47 deletions(-)

diff --git a/app/test/test_table_pipeline.c b/app/test/test_table_pipeline.c
index 4bcce2b..36bfeda 100644
--- a/app/test/test_table_pipeline.c
+++ b/app/test/test_table_pipeline.c
@@ -91,53 +91,59 @@ rte_pipeline_port_out_action_handler 
port_action_stub(struct rte_mbuf **pkts,
 #endif

 rte_pipeline_table_action_handler_hit
-table_action_0x00(struct rte_mbuf **pkts, uint64_t *pkts_mask,
-   struct rte_pipeline_table_entry **actions, uint32_t action_mask);
+table_action_0x00(struct rte_pipeline *p, struct rte_mbuf **pkts,
+   uint64_t pkts_mask, struct rte_pipeline_table_entry **entry, void *arg);

 rte_pipeline_table_action_handler_hit
-table_action_stub_hit(struct rte_mbuf **pkts, uint64_t *pkts_mask,
-   struct rte_pipeline_table_entry **actions, uint32_t action_mask);
+table_action_stub_hit(struct rte_pipeline *p, struct rte_mbuf **pkts,
+   uint64_t pkts_mask, struct rte_pipeline_table_entry **entry, void *arg);

 rte_pipeline_table_action_handler_miss
-table_action_stub_miss(struct rte_mbuf **pkts, uint64_t *pkts_mask,
-   struct rte_pipeline_table_entry *action, uint32_t action_mask);
+table_action_stub_miss(struct rte_pipeline *p, struct rte_mbuf **pkts,
+   uint64_t pkts_mask, struct rte_pipeline_table_entry **entry, void *arg);

 rte_pipeline_table_action_handler_hit
-table_action_0x00(__attribute__((unused)) struct rte_mbuf **pkts,
-   uint64_t *pkts_mask,
-   __attribute__((unused)) struct rte_pipeline_table_entry **actions,
-   __attribute__((unused)) uint32_t action_mask)
+table_action_0x00(__attribute__((unused)) struct rte_pipeline *p,
+   __attribute__((unused)) struct rte_mbuf **pkts,
+   uint64_t pkts_mask,
+   __attribute__((unused)) struct rte_pipeline_table_entry **entry,
+   __attribute__((unused)) void *arg)
 {
printf("Table Action, setting pkts_mask to 0x00\n");
-   *pkts_mask = 0x00;
+   pkts_mask = ~0x00;
+   rte_pipeline_ah_packet_drop(p, pkts_mask);
return 0;
 }

 rte_pipeline_table_action_handler_hit
-table_action_stub_hit(__attribute__((unused)) struct rte_mbuf **pkts,
-   uint64_t *pkts_mask,
-   __attribute__((unused)) struct rte_pipeline_table_entry **actions,
-   __attribute__((unused)) uint32_t action_mask)
+table_action_stub_hit(__attribute__((unused)) struct rte_pipeline *p,
+   __attribute__((unused)) struct rte_mbuf **pkts,
+   uint64_t pkts_mask,
+   __attribute__((unused)) struct rte_pipeline_table_entry **entry,
+   __attribute__((unused)) void *arg)
 {
printf("STUB Table Action Hit - doing nothing\n");
printf("STUB Table Action Hit - setting mask to 0x%"PRIx64"\n",
override_hit_mask);
-   *pkts_mask = override_hit_mask;
+   pkts_mask = (~override_hit_mask) & 0x3;
+   rte_pipeline_ah_packet_drop(p, pkts_mask);
return 0;
 }
+
 rte_pipeline_table_action_handler_miss
-table_action_stub_miss(__attribute__((unused)) struct rte_mbuf **pkts,
-   uint64_t *pkts_mask,
-   __attribute__((unused)) struct rte_pipeline_table_entry *action,
-   __attribute__((unused)) uint32_t action_mask)
+table_action_stub_miss(struct rte_pipeline *p,
+   __attribute__((unused)) struct rte_mbuf **pkts,
+   uint64_t pkts_mask,
+   __attribute__((unused)) struct rte_pipeline_table_entry **entry,
+   __attribute__((unused)) void *arg)
 {
printf("STUB Table Action Miss - setting mask to 0x%"PRIx64"\n",
override_miss_mask);
-   *pkts_mask = override_miss_mask;
+   pkts_mask = (~override_miss_mask) & 0x3;
+   rte_pipeline_ah_packet_drop(p, pkts_mask);
return 0;
 }

-
 enum e_test_type {
e_TEST_STUB = 0,
e_TEST_LPM,
@@ -537,7 +543,6 @@ test_table_pipeline(void)
setup_pipeline(e_TEST_STUB);
if (test_pipeline_single_filter(e_TEST_STUB, 4) < 0)
return -1;
-#if 0

/* TEST - one packet per port */
action_handler_hit = NULL;
@@