[v3,02/10] ethdev: add conf arg to shared action icreate API

Message ID 20201003220619.19231-3-andreyv@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series RTE flow shared action |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Andrey Vesnovaty Oct. 3, 2020, 10:06 p.m. UTC
  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 <andreyv@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(-)
  

Comments

Ori Kam Oct. 4, 2020, 11:11 a.m. UTC | #1
Hi Andrey

Why is this patch not part of the previous one?

Best,
Ori
> -----Original Message-----
> From: Andrey Vesnovaty <andreyv@nvidia.com>
> Sent: Sunday, October 4, 2020 1:06 AM
> To: dev@dpdk.org
> Cc: jer@marvell.com; jerinjacobk@gmail.com; NBU-Contact-Thomas Monjalon
> <thomas@monjalon.net>; ferruh.yigit@intel.com;
> stephen@networkplumber.org; bruce.richardson@intel.com; Ori Kam
> <orika@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>;
> andrey.vesnovaty@gmail.com; mdr@ashroe.eu; nhorman@tuxdriver.com;
> ajit.khaparde@broadcom.com; samik.gupta@broadcom.com; Ori Kam
> <orika@mellanox.com>; Andrew Rybchenko <arybchenko@solarflare.com>
> Subject: [PATCH v3 02/10] ethdev: add conf arg to shared action icreate API
> 
> 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 <andreyv@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
  
Andrey Vesnovaty Oct. 6, 2020, 10:28 a.m. UTC | #2
PSB
> -----Original Message-----
> From: Ori Kam <orika@nvidia.com>
> Sent: Sunday, October 4, 2020 2:11 PM
> To: Andrey Vesnovaty <andreyv@nvidia.com>; dev@dpdk.org
> Cc: jer@marvell.com; jerinjacobk@gmail.com; NBU-Contact-Thomas Monjalon
> <thomas@monjalon.net>; ferruh.yigit@intel.com;
> stephen@networkplumber.org; bruce.richardson@intel.com; Slava Ovsiienko
> <viacheslavo@nvidia.com>; andrey.vesnovaty@gmail.com; mdr@ashroe.eu;
> nhorman@tuxdriver.com; ajit.khaparde@broadcom.com;
> samik.gupta@broadcom.com; Ori Kam <orika@mellanox.com>; Andrew
> Rybchenko <arybchenko@solarflare.com>
> Subject: RE: [PATCH v3 02/10] ethdev: add conf arg to shared action icreate API
> 
> Hi Andrey
> 
> Why is this patch not part of the previous one?

Got it. Will be squashed.

> 
> Best,
> Ori
> > -----Original Message-----
> > From: Andrey Vesnovaty <andreyv@nvidia.com>
> > Sent: Sunday, October 4, 2020 1:06 AM
> > To: dev@dpdk.org
> > Cc: jer@marvell.com; jerinjacobk@gmail.com; NBU-Contact-Thomas
> Monjalon
> > <thomas@monjalon.net>; ferruh.yigit@intel.com;
> > stephen@networkplumber.org; bruce.richardson@intel.com; Ori Kam
> > <orika@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>;
> > andrey.vesnovaty@gmail.com; mdr@ashroe.eu; nhorman@tuxdriver.com;
> > ajit.khaparde@broadcom.com; samik.gupta@broadcom.com; Ori Kam
> > <orika@mellanox.com>; Andrew Rybchenko <arybchenko@solarflare.com>
> > Subject: [PATCH v3 02/10] ethdev: add conf arg to shared action icreate API
> >
> > 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 <andreyv@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
  

Patch

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,