All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
To: Gregory Etelson <getelson@nvidia.com>, dev@dpdk.org
Cc: matan@nvidia.com, rasland@nvidia.com, Ori Kam <orika@nvidia.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	Ferruh Yigit <ferruh.yigit@amd.com>
Subject: Re: [PATCH v9 1/2] ethdev: add query and update sync and async function calls
Date: Thu, 2 Feb 2023 15:13:50 +0300	[thread overview]
Message-ID: <89749f8b-6e23-6c7f-edcb-5661ef86a3d6@oktetlabs.ru> (raw)
In-Reply-To: <20230202115401.358-1-getelson@nvidia.com>

On 2/2/23 14:54, Gregory Etelson wrote:
> diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
> index 7d0c24366c..4554c8f021 100644
> --- a/lib/ethdev/rte_flow.c
> +++ b/lib/ethdev/rte_flow.c
> @@ -1883,3 +1883,85 @@ rte_flow_async_action_handle_query(uint16_t port_id,
>   					  action_handle, data, user_data, error);
>   	return flow_err(port_id, ret, error);
>   }
> +
> +int
> +rte_flow_action_handle_query_update(uint16_t port_id,
> +				    struct rte_flow_action_handle *handle,
> +				    const void *update, void *query,
> +				    enum rte_flow_query_update_mode mode,
> +				    struct rte_flow_error *error)
> +{
> +	int ret;
> +	struct rte_eth_dev *dev;
> +	const struct rte_flow_ops *ops;
> +
> +	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> +	if (!handle)
> +		return -EINVAL;
> +	dev = &rte_eth_devices[port_id];
> +	ops = rte_flow_ops_get(port_id, error);
> +	if (!ops)
> +		return -ENOTSUP;
> +	if (update && query) {
> +		if (!ops->action_handle_query_update)
> +			return -ENOTSUP;
> +		if (mode != RTE_FLOW_QU_QUERY_FIRST &&
> +		    mode != RTE_FLOW_QU_UPDATE_FIRST)
> +			return -EINVAL;

Shouldn't it be checked in any case?
Also I'd initialize RTE_FLOW_QU_QUERY_FIRST to 1 on enum
definition to ensure that just 0 is not used as a mode value.
Also "Required if both *update* and *query* are not NULL." does
not make sense in the description since you have no way to skip
it.

> +		ret = ops->action_handle_query_update(dev, handle, update,
> +						      query, mode, error);
> +	} else if (!update && query) {
> +		ret = rte_flow_action_handle_query(port_id, handle, query,
> +						   error);
> +	} else if (update && !query) {
> +		ret = rte_flow_action_handle_update(port_id, handle, update,
> +						    error);
> +	} else {
> +		return -EINVAL;
> +	}

IMHO logic is wrong above since it should be sufficient to
implement just one action_handle_query_update callback instead
of all three.

I.e. if action_handle_query_update is available, it should be
used in any case.

> +	return flow_err(port_id, ret, error);
> +}
>   };
>   
>   INTERNAL {

same for async API


  parent reply	other threads:[~2023-02-02 12:13 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-21  7:35 [PATCH 1/2] ethdev: add query_update sync and async function calls Gregory Etelson
2022-12-21  7:35 ` [PATCH 2/2] ethdev: add quota flow action and item Gregory Etelson
2023-01-08 13:47   ` Ori Kam
2023-01-04  9:56 ` [PATCH 1/2] ethdev: add query_update sync and async function calls Ori Kam
2023-01-11  9:28   ` Gregory Etelson
2023-01-11  9:22 ` [PATCH v2 " Gregory Etelson
2023-01-11  9:22   ` [PATCH v2 2/2] ethdev: add quota flow action and item Gregory Etelson
2023-01-11 12:20 ` [PATCH v3 1/2] ethdev: add query_update sync and async function calls Gregory Etelson
2023-01-11 12:20   ` [PATCH v3 2/2] ethdev: add quota flow action and item Gregory Etelson
2023-01-18 10:31 ` [PATCH v4 1/2] ethdev: add query_update sync and async function calls Gregory Etelson
2023-01-18 10:31   ` [PATCH v4 2/2] ethdev: add quota flow action and item Gregory Etelson
2023-01-18 14:03     ` Thomas Monjalon
2023-01-19  9:13       ` Gregory Etelson
2023-01-19  9:31         ` Thomas Monjalon
2023-01-19  9:39           ` Gregory Etelson
2023-01-18 13:56   ` [PATCH v4 1/2] ethdev: add query_update sync and async function calls Thomas Monjalon
2023-01-18 17:34     ` Gregory Etelson
2023-01-19  8:44       ` Thomas Monjalon
2023-01-19 13:25 ` [PATCH v5 " Gregory Etelson
2023-01-19 13:25   ` [PATCH v5 2/2] ethdev: add quota flow action and item Gregory Etelson
2023-01-19 16:47 ` [PATCH v6 1/2] ethdev: add query_update sync and async function calls Gregory Etelson
2023-01-19 16:47   ` [PATCH v6 2/2] ethdev: add quota flow action and item Gregory Etelson
2023-01-20  8:52     ` Andrew Rybchenko
2023-01-24  9:26       ` Gregory Etelson
2023-01-20  8:35   ` [PATCH v6 1/2] ethdev: add query_update sync and async function calls Andrew Rybchenko
2023-01-20 10:46     ` Gregory Etelson
2023-01-20 11:22       ` Andrew Rybchenko
2023-01-20 16:50         ` Gregory Etelson
2023-02-01 11:00           ` Andrew Rybchenko
2023-02-01 14:03             ` Gregory Etelson
2023-01-24  9:37 ` [PATCH v7 " Gregory Etelson
2023-01-24  9:37   ` [PATCH v7 2/2] ethdev: add quota flow action and item Gregory Etelson
2023-02-01 11:22     ` Andrew Rybchenko
2023-02-01 15:09       ` Gregory Etelson
2023-02-01 11:16   ` [PATCH v7 1/2] ethdev: add query_update sync and async function calls Andrew Rybchenko
2023-02-01 14:52     ` Gregory Etelson
2023-02-01 15:16 ` [PATCH v8 " Gregory Etelson
2023-02-01 15:16   ` [PATCH v8 2/2] ethdev: add quota flow action and item Gregory Etelson
2023-02-02  9:17     ` Andrew Rybchenko
2023-02-01 17:30   ` [PATCH v8 1/2] ethdev: add query_update sync and async function calls Ori Kam
2023-02-02  9:15   ` Andrew Rybchenko
2023-02-02 10:24     ` Gregory Etelson
2023-02-02 10:30       ` Andrew Rybchenko
2023-02-02 10:44         ` Gregory Etelson
2023-02-02 10:47           ` Andrew Rybchenko
2023-02-02 11:54 ` [PATCH v9 1/2] ethdev: add query and update " Gregory Etelson
2023-02-02 11:54   ` [PATCH v9 2/2] ethdev: add quota flow action and item Gregory Etelson
2023-02-02 12:13   ` Andrew Rybchenko [this message]
2023-02-09 19:16     ` [PATCH v9 1/2] ethdev: add query and update sync and async function calls Gregory Etelson
2023-02-02 13:47 ` [PATCH v10 " Gregory Etelson
2023-02-02 13:47   ` [PATCH v10 2/2] ethdev: add quota flow action and item Gregory Etelson
2023-02-19 17:04     ` Thomas Monjalon
2023-02-07 16:03   ` [PATCH v10 1/2] ethdev: add query and update sync and async function calls Gregory Etelson
2023-02-09 15:13   ` Ferruh Yigit
2023-02-09 16:10     ` Gregory Etelson
2023-02-12 11:13     ` Gregory Etelson
2023-02-13 12:30       ` Gregory Etelson
2023-02-16 15:43   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=89749f8b-6e23-6c7f-edcb-5661ef86a3d6@oktetlabs.ru \
    --to=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=getelson@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.