Add configuration argument to shared action create interface. Currently there is only ingress & egress fields but more fields can be added later. Shared action configuration & implementation are PMD specific.
Signed-off-by: Andrey Vesnovaty <andr...@nvidia.com> --- lib/librte_ethdev/rte_flow.c | 4 +++- lib/librte_ethdev/rte_flow.h | 17 +++++++++++++++-- lib/librte_ethdev/rte_flow_driver.h | 5 +++-- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c index ba3f01f7c7..9afa8905df 100644 --- a/lib/librte_ethdev/rte_flow.c +++ b/lib/librte_ethdev/rte_flow.c @@ -1255,6 +1255,7 @@ rte_flow_get_aged_flows(uint16_t port_id, void **contexts, struct rte_flow_shared_action * rte_flow_shared_action_create(uint16_t port_id, + const struct rte_flow_shared_action_conf *conf, const struct rte_flow_action *action, struct rte_flow_error *error) { @@ -1265,7 +1266,8 @@ rte_flow_shared_action_create(uint16_t port_id, if (unlikely(!ops)) return NULL; if (likely(!!ops->shared_action_create)) { - shared_action = ops->shared_action_create(dev, action, error); + shared_action = ops->shared_action_create(dev, conf, action, + error); if (shared_action == NULL) flow_err(port_id, -rte_errno, error); return shared_action; diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 02391316cb..8a2db4f6da 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -3380,6 +3380,16 @@ int rte_flow_get_aged_flows(uint16_t port_id, void **contexts, uint32_t nb_contexts, struct rte_flow_error *error); +/** + * Specify shared action configuration + */ +struct rte_flow_shared_action_conf { + uint32_t ingress:1; + /**< Action valid for rules applied to ingress traffic. */ + uint32_t egress:1; + /**< Action valid for rules applied to egress traffic. */ +}; + /** * @warning * @b EXPERIMENTAL: this API may change without prior notice. @@ -3388,6 +3398,8 @@ rte_flow_get_aged_flows(uint16_t port_id, void **contexts, * * @param[in] port_id * The port identifier of the Ethernet device. + * @param[in] conf + * Shared action configuration. * @param[in] action * Action configuration for shared action creation. * @param[out] error @@ -3404,6 +3416,7 @@ rte_flow_get_aged_flows(uint16_t port_id, void **contexts, __rte_experimental struct rte_flow_shared_action * rte_flow_shared_action_create(uint16_t port_id, + const struct rte_flow_shared_action_conf *conf, const struct rte_flow_action *action, struct rte_flow_error *error); @@ -3432,8 +3445,8 @@ rte_flow_shared_action_create(uint16_t port_id, __rte_experimental int rte_flow_shared_action_destroy(uint16_t port_id, - struct rte_flow_shared_action *action, - struct rte_flow_error *error); + struct rte_flow_shared_action *action, + struct rte_flow_error *error); /** * @warning diff --git a/lib/librte_ethdev/rte_flow_driver.h b/lib/librte_ethdev/rte_flow_driver.h index 72bfc3b7a7..adaace47ea 100644 --- a/lib/librte_ethdev/rte_flow_driver.h +++ b/lib/librte_ethdev/rte_flow_driver.h @@ -111,8 +111,9 @@ struct rte_flow_ops { /** See rte_flow_shared_action_create() */ struct rte_flow_shared_action *(*shared_action_create) (struct rte_eth_dev *dev, - const struct rte_flow_action *action, - struct rte_flow_error *error); + const struct rte_flow_shared_action_conf *conf, + const struct rte_flow_action *action, + struct rte_flow_error *error); /** See rte_flow_shared_action_destroy() */ int (*shared_action_destroy) (struct rte_eth_dev *dev, -- 2.26.2