summaryrefslogtreecommitdiff
path: root/lib/librte_pipeline/rte_pipeline.h
diff options
context:
space:
mode:
authorJasvinder Singh <jasvinder.singh@intel.com>2016-03-08 18:07:48 +0000
committerThomas Monjalon <thomas.monjalon@6wind.com>2016-03-10 01:28:29 +0100
commit88ac2fd99fa06419c5b95ad662dc1e618bd8ac49 (patch)
treec27e3d9db612af5f5265b127a7e4c1568f542f42 /lib/librte_pipeline/rte_pipeline.h
parentac5e1d838dc163ab130477f992413af178b6bb88 (diff)
downloaddpdk-next-eventdev-88ac2fd99fa06419c5b95ad662dc1e618bd8ac49.zip
dpdk-next-eventdev-88ac2fd99fa06419c5b95ad662dc1e618bd8ac49.tar.gz
dpdk-next-eventdev-88ac2fd99fa06419c5b95ad662dc1e618bd8ac49.tar.xz
pipeline: support packet redirection at action handlers
Currently, there is no mechanism that allows the pipeline ports (in/out) and table action handlers to override the default forwarding decision (as previously configured per input port or in the table entry). The port (in/out) and table action handler prototypes have been changed to allow pipeline action handlers (port in/out, table) to remove the selected packets from the further pipeline processing and to take full ownership for these packets. This feature will be helpful to implement functions such as exception handling (e.g. TTL =0), load balancing etc. Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Diffstat (limited to 'lib/librte_pipeline/rte_pipeline.h')
-rw-r--r--lib/librte_pipeline/rte_pipeline.h67
1 files changed, 24 insertions, 43 deletions
diff --git a/lib/librte_pipeline/rte_pipeline.h b/lib/librte_pipeline/rte_pipeline.h
index 7302a62..0b02969 100644
--- a/lib/librte_pipeline/rte_pipeline.h
+++ b/lib/librte_pipeline/rte_pipeline.h
@@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
- * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -142,12 +142,12 @@ struct rte_pipeline_table_stats {
/** Number of packets dropped by lookup miss action handler. */
uint64_t n_pkts_dropped_by_lkp_miss_ah;
- /** Number of packets dropped by pipeline in behalf of this table based on
- * on action specified in table entry. */
+ /** Number of packets dropped by pipeline in behalf of this
+ * table based on action specified in table entry. */
uint64_t n_pkts_dropped_lkp_hit;
- /** Number of packets dropped by pipeline in behalf of this table based on
- * on action specified in table entry. */
+ /** Number of packets dropped by pipeline in behalf of this
+ * table based on action specified in table entry. */
uint64_t n_pkts_dropped_lkp_miss;
};
@@ -187,7 +187,7 @@ int rte_pipeline_check(struct rte_pipeline *p);
* @param p
* Handle to pipeline instance
* @return
- * 0 on success, error code otherwise
+ * Number of packets read and processed
*/
int rte_pipeline_run(struct rte_pipeline *p);
@@ -263,6 +263,8 @@ struct rte_pipeline_table_entry {
* required not to free the packet buffer, which will be freed eventually by
* the pipeline.
*
+ * @param p
+ * Handle to pipeline instance
* @param pkts
* Burst of input packets specified as array of up to 64 pointers to struct
* rte_mbuf
@@ -283,8 +285,9 @@ struct rte_pipeline_table_entry {
* 0 on success, error code otherwise
*/
typedef int (*rte_pipeline_table_action_handler_hit)(
+ struct rte_pipeline *p,
struct rte_mbuf **pkts,
- uint64_t *pkts_mask,
+ uint64_t pkts_mask,
struct rte_pipeline_table_entry **entries,
void *arg);
@@ -296,6 +299,8 @@ typedef int (*rte_pipeline_table_action_handler_hit)(
* required not to free the packet buffer, which will be freed eventually by
* the pipeline.
*
+ * @param p
+ * Handle to pipeline instance
* @param pkts
* Burst of input packets specified as array of up to 64 pointers to struct
* rte_mbuf
@@ -316,8 +321,9 @@ typedef int (*rte_pipeline_table_action_handler_hit)(
* 0 on success, error code otherwise
*/
typedef int (*rte_pipeline_table_action_handler_miss)(
+ struct rte_pipeline *p,
struct rte_mbuf **pkts,
- uint64_t *pkts_mask,
+ uint64_t pkts_mask,
struct rte_pipeline_table_entry *entry,
void *arg);
@@ -565,16 +571,14 @@ int rte_pipeline_table_stats_read(struct rte_pipeline *p, uint32_t table_id,
* required not to free the packet buffer, which will be freed eventually by
* the pipeline.
*
+ * @param p
+ * Handle to pipeline instance
* @param pkts
* Burst of input packets specified as array of up to 64 pointers to struct
* rte_mbuf
* @param n
* Number of packets in the input burst. This parameter specifies that
* elements 0 to (n-1) of pkts array are valid.
- * @param pkts_mask
- * 64-bit bitmask specifying which packets in the input burst are still valid
- * after the action handler is executed. When pkts_mask bit n is set, then
- * element n of pkts array is pointing to a valid packet.
* @param arg
* Opaque parameter registered by the user at the pipeline table creation
* time
@@ -582,9 +586,9 @@ int rte_pipeline_table_stats_read(struct rte_pipeline *p, uint32_t table_id,
* 0 on success, error code otherwise
*/
typedef int (*rte_pipeline_port_in_action_handler)(
+ struct rte_pipeline *p,
struct rte_mbuf **pkts,
uint32_t n,
- uint64_t *pkts_mask,
void *arg);
/** Parameters for pipeline input port creation */
@@ -692,36 +696,15 @@ int rte_pipeline_port_in_stats_read(struct rte_pipeline *p, uint32_t port_id,
#define RTE_PIPELINE_PORT_OUT_MAX 64
/**
- * Pipeline output port action handler for single packet
- *
- * The action handler can decide to drop packets by resetting the pkt_mask
- * argument. In this case, the action handler is required not to free the
- * packet buffer, which will be freed eventually by the pipeline.
- *
- * @param pkt
- * Input packet
- * @param pkt_mask
- * Output argument set to 0 when the action handler decides to drop the input
- * packet and to 1LLU otherwise
- * @param arg
- * Opaque parameter registered by the user at the pipeline table creation
- * time
- * @return
- * 0 on success, error code otherwise
- */
-typedef int (*rte_pipeline_port_out_action_handler)(
- struct rte_mbuf *pkt,
- uint64_t *pkt_mask,
- void *arg);
-
-/**
- * Pipeline output port action handler bulk
+ * Pipeline output port action handler
*
* The action handler can decide to drop packets by resetting the associated
* packet bit in the pkts_mask parameter. In this case, the action handler is
* required not to free the packet buffer, which will be freed eventually by
* the pipeline.
*
+ * @param p
+ * Handle to pipeline instance
* @param pkts
* Burst of input packets specified as array of up to 64 pointers to struct
* rte_mbuf
@@ -735,9 +718,10 @@ typedef int (*rte_pipeline_port_out_action_handler)(
* @return
* 0 on success, error code otherwise
*/
-typedef int (*rte_pipeline_port_out_action_handler_bulk)(
+typedef int (*rte_pipeline_port_out_action_handler)(
+ struct rte_pipeline *p,
struct rte_mbuf **pkts,
- uint64_t *pkts_mask,
+ uint64_t pkts_mask,
void *arg);
/** Parameters for pipeline output port creation. The action handlers have to
@@ -750,12 +734,9 @@ struct rte_pipeline_port_out_params {
/** Opaque parameter to be passed to create operation when invoked */
void *arg_create;
- /** Callback function executing the user actions on single input
- packet */
- rte_pipeline_port_out_action_handler f_action;
/** Callback function executing the user actions on bust of input
packets */
- rte_pipeline_port_out_action_handler_bulk f_action_bulk;
+ rte_pipeline_port_out_action_handler f_action;
/** Opaque parameter to be passed to the action handler when invoked */
void *arg_ah;
};