[dpdk-dev] [PATCH v2 1/2] ethdev: replace callback getting filter operations
Andrew Rybchenko
andrew.rybchenko at oktetlabs.ru
Mon Mar 15 08:18:15 CET 2021
On 3/12/21 8:46 PM, Thomas Monjalon wrote:
> Since rte_flow is the only API for filtering operations,
> the legacy driver interface filter_ctrl was too much complicated
> for the simple task of getting the struct rte_flow_ops.
>
> The filter type RTE_ETH_FILTER_GENERIC and
> the filter operarion RTE_ETH_FILTER_GET are removed.
> The new driver callback flow_ops_get replaces filter_ctrl.
>
> Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
[snip]
> diff --git a/lib/librte_ethdev/rte_eth_ctrl.h b/lib/librte_ethdev/rte_eth_ctrl.h
> index 8a50dbfef9..42652f9cce 100644
> --- a/lib/librte_ethdev/rte_eth_ctrl.h
> +++ b/lib/librte_ethdev/rte_eth_ctrl.h
> @@ -339,7 +339,7 @@ struct rte_eth_fdir_action {
> };
>
> /**
> - * A structure used to define the flow director filter entry by filter_ctrl API.
> + * A structure used to define the flow director filter entry.
> */
> struct rte_eth_fdir_filter {
> uint32_t soft_id;
> diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
> index 241af6c4ca..1a896e3e64 100644
> --- a/lib/librte_ethdev/rte_flow.c
> +++ b/lib/librte_ethdev/rte_flow.c
> @@ -255,18 +255,19 @@ rte_flow_ops_get(uint16_t port_id, struct rte_flow_error *error)
>
> if (unlikely(!rte_eth_dev_is_valid_port(port_id)))
> code = ENODEV;
> - else if (unlikely(!dev->dev_ops->filter_ctrl ||
> - dev->dev_ops->filter_ctrl(dev,
> - RTE_ETH_FILTER_GENERIC,
> - RTE_ETH_FILTER_GET,
> - &ops) ||
> - !ops))
> - code = ENOSYS;
> + else if (unlikely(dev->dev_ops->flow_ops_get == NULL))
> + code = ENOTSUP;
> else
> - return ops;
> - rte_flow_error_set(error, code, RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> - NULL, rte_strerror(code));
> - return NULL;
> + code = dev->dev_ops->flow_ops_get(dev, &ops);
> + if (code == 0 && ops == NULL)
> + code = EACCES;
It looks something new. I think it should be mentioned in flow_ops_get
type documentation (similar to eth_promiscuous_enable_t) and
rte_flow_validate() etc functions
return values description.
> +
> + if (code != 0) {
> + rte_flow_error_set(error, code, RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
> + NULL, rte_strerror(code));
> + return NULL;
> + }
> + return ops;
> }
>
> /* Check whether a flow rule can be created on a given port. */
[snip]
More information about the dev
mailing list