All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
To: Thomas Monjalon <thomas@monjalon.net>, dev@dpdk.org
Cc: Ori Kam <orika@nvidia.com>,
	Ajit Khaparde <ajit.khaparde@broadcom.com>,
	Somnath Kotur <somnath.kotur@broadcom.com>,
	Chas Williams <chas3@att.com>,
	"Min Hu (Connor)" <humin29@huawei.com>,
	Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>,
	Hemant Agrawal <hemant.agrawal@nxp.com>,
	Sachin Saxena <sachin.saxena@oss.nxp.com>,
	Jeff Guo <jia.guo@intel.com>, Haiyue Wang <haiyue.wang@intel.com>,
	John Daley <johndale@cisco.com>,
	Hyong Youb Kim <hyonkim@cisco.com>, Gaetan Rivet <grive@u256.net>,
	Ziyang Xuan <xuanziyang2@huawei.com>,
	Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>,
	Guoyang Zhou <zhouguoyang@huawei.com>,
	Yisen Zhuang <yisen.zhuang@huawei.com>,
	Lijun Ou <oulijun@huawei.com>,
	Beilei Xing <beilei.xing@intel.com>,
	Jingjing Wu <jingjing.wu@intel.com>,
	Qiming Yang <qiming.yang@intel.com>,
	Qi Zhang <qi.z.zhang@intel.com>, Rosen Xu <rosen.xu@intel.com>,
	Matan Azrad <matan@nvidia.com>,
	Shahaf Shuler <shahafs@nvidia.com>,
	Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
	Liron Himi <lironh@marvell.com>, Jerin Jacob <jerinj@marvell.com>,
	Nithin Dabilpuram <ndabilpuram@marvell.com>,
	Kiran Kumar K <kirankumark@marvell.com>,
	Rasesh Mody <rmody@marvell.com>,
	Shahed Shaikh <shshaikh@marvell.com>,
	Jasvinder Singh <jasvinder.singh@intel.com>,
	Cristian Dumitrescu <cristian.dumitrescu@intel.com>,
	Keith Wiles <keith.wiles@intel.com>,
	Jiawen Wu <jiawenwu@trustnetic.com>,
	Jian Wang <jianwang@trustnetic.com>,
	Ferruh Yigit <ferruh.yigit@intel.com>
Subject: Re: [dpdk-dev] [PATCH 1/2] ethdev: replace callback getting filter operations
Date: Fri, 12 Mar 2021 10:09:54 +0300	[thread overview]
Message-ID: <d6a4bd1c-f51f-5f7e-bca9-87ad7d86579c@oktetlabs.ru> (raw)
In-Reply-To: <20210311221742.3750589-2-thomas@monjalon.net>

On 3/12/21 1:17 AM, 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@monjalon.net>

A couple of minor notes below. Other than that:

Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>

[snip]

> diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
> index 7405a9864f..1260539a21 100644
> --- a/doc/guides/rel_notes/release_20_11.rst
> +++ b/doc/guides/rel_notes/release_20_11.rst
> @@ -571,7 +571,7 @@ API Changes
>    a TC is greater than 256.
>  
>  * ethdev: Removed the legacy filter API, including
> -  ``rte_eth_dev_filter_supported()`` and ``rte_eth_dev_filter_ctrl()``.
> +  ``rte_eth_dev_filter_supported()`` and ``rte_eth_dev_flow_ops_get()``.

Mass substitution is dangerous. I guess this one is not
intended.

>  
>  * ethdev: Removed the legacy L2 tunnel configuration API, including
>    ``rte_eth_dev_l2_tunnel_eth_type_conf()`` and
> diff --git a/doc/guides/rel_notes/release_2_2.rst b/doc/guides/rel_notes/release_2_2.rst
> index cea5c8746d..f7deeac34b 100644
> --- a/doc/guides/rel_notes/release_2_2.rst
> +++ b/doc/guides/rel_notes/release_2_2.rst
> @@ -501,7 +501,7 @@ API Changes
>  -----------
>  
>  * The deprecated flow director API is removed.
> -  It was replaced by ``rte_eth_dev_filter_ctrl()``.
> +  It was replaced by ``rte_eth_dev_flow_ops_get()``.

As well as this one.

>  
>  * The ``dcb_queue`` is renamed to ``dcb_tc`` in following dcb configuration
>    structures: ``rte_eth_dcb_rx_conf``, ``rte_eth_dcb_tx_conf``,

[snip]

> diff --git a/lib/librte_ethdev/ethdev_driver.h b/lib/librte_ethdev/ethdev_driver.h
> index 57fdedaa1a..1c6592ec23 100644
> --- a/lib/librte_ethdev/ethdev_driver.h
> +++ b/lib/librte_ethdev/ethdev_driver.h
> @@ -465,34 +465,10 @@ typedef int (*eth_get_module_eeprom_t)(struct rte_eth_dev *dev,
>  				       struct rte_dev_eeprom_info *info);
>  /**< @internal Retrieve plugin module eeprom data */
>  
> -/**
> - * Feature filter types
> - */
> -enum rte_filter_type {
> -	RTE_ETH_FILTER_NONE = 0,
> -	RTE_ETH_FILTER_ETHERTYPE,
> -	RTE_ETH_FILTER_FLEXIBLE,
> -	RTE_ETH_FILTER_SYN,
> -	RTE_ETH_FILTER_NTUPLE,
> -	RTE_ETH_FILTER_TUNNEL,
> -	RTE_ETH_FILTER_FDIR,
> -	RTE_ETH_FILTER_HASH,
> -	RTE_ETH_FILTER_L2_TUNNEL,
> -	RTE_ETH_FILTER_GENERIC,
> -};
> -
> -/**
> - * Generic operations on filters
> - */
> -enum rte_filter_op {
> -	RTE_ETH_FILTER_GET,      /**< get flow API ops */
> -};
> -
> -typedef int (*eth_filter_ctrl_t)(struct rte_eth_dev *dev,
> -				 enum rte_filter_type filter_type,
> -				 enum rte_filter_op filter_op,
> -				 void *arg);
> -/**< @internal Take operations to assigned filter type on an Ethernet device */
> +struct rte_flow_ops;
> +typedef int (*eth_flow_ops_get_t)(struct rte_eth_dev *dev,
> +				  const struct rte_flow_ops **ops);
> +/**< @internal Get flow operations */

I'm OK with the callback prototype. I think there is no point
to optimize it and make ops a return value. It is called in
just one place. Nothing to optimize.

>  
>  typedef int (*eth_tm_ops_get_t)(struct rte_eth_dev *dev, void *ops);
>  /**< @internal Get Traffic Management (TM) operations on an Ethernet device */
> @@ -880,7 +856,7 @@ struct eth_dev_ops {
>  	eth_get_module_eeprom_t    get_module_eeprom;
>  	/** Get plugin module eeprom data. */
>  
> -	eth_filter_ctrl_t          filter_ctrl; /**< common filter control. */
> +	eth_flow_ops_get_t         flow_ops_get; /**< Get flow operations. */
>  
>  	eth_get_dcb_info           get_dcb_info; /** Get DCB information. */
>  
> @@ -1377,6 +1353,18 @@ rte_eth_hairpin_queue_peer_unbind(uint16_t cur_port, uint16_t cur_queue,
>   * Legacy ethdev API used internally by drivers.
>   */
>  
> +enum rte_filter_type {
> +	RTE_ETH_FILTER_NONE = 0,
> +	RTE_ETH_FILTER_ETHERTYPE,
> +	RTE_ETH_FILTER_FLEXIBLE,
> +	RTE_ETH_FILTER_SYN,
> +	RTE_ETH_FILTER_NTUPLE,
> +	RTE_ETH_FILTER_TUNNEL,
> +	RTE_ETH_FILTER_FDIR,
> +	RTE_ETH_FILTER_HASH,
> +	RTE_ETH_FILTER_L2_TUNNEL,
> +};
> +
>  /**
>   * Define all structures for Ethertype Filter type.
>   */
> 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..ed9f826b85 100644
> --- a/lib/librte_ethdev/rte_flow.c
> +++ b/lib/librte_ethdev/rte_flow.c
> @@ -255,12 +255,9 @@ 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))
> +	else if (unlikely(!dev->dev_ops->flow_ops_get ||
> +			  dev->dev_ops->flow_ops_get(dev, &ops) ||

If the callback return error code, may be it should be used
and forwarded here?

> +			  ops == NULL))
>  		code = ENOSYS;
>  	else
>  		return ops;

[snip]

  parent reply	other threads:[~2021-03-12  7:09 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 22:17 [dpdk-dev] [PATCH 0/2] ethdev: remove some use of legacy filtering interface Thomas Monjalon
2021-03-11 22:17 ` [dpdk-dev] [PATCH 1/2] ethdev: replace callback getting filter operations Thomas Monjalon
2021-03-12  1:44   ` Wang, Haiyue
2021-03-12  8:22     ` Thomas Monjalon
2021-03-12  8:25       ` Andrew Rybchenko
2021-03-12  8:40         ` Wang, Haiyue
2021-03-12  7:09   ` Andrew Rybchenko [this message]
2021-03-12  8:26     ` Thomas Monjalon
2021-03-11 22:17 ` [dpdk-dev] [PATCH 2/2] drivers/net: remove explicit include of legacy filtering Thomas Monjalon
2021-03-12  1:21   ` Xu, Rosen
2021-03-12 17:46 ` [dpdk-dev] [PATCH v2 0/2] ethdev: remove some use of legacy filtering interface Thomas Monjalon
2021-03-12 17:46   ` [dpdk-dev] [PATCH v2 1/2] ethdev: replace callback getting filter operations Thomas Monjalon
2021-03-12 19:14     ` Ajit Khaparde
2021-03-13  4:16     ` Wang, Haiyue
2021-03-15  3:05     ` Xu, Rosen
2021-03-15  7:18     ` Andrew Rybchenko
2021-03-15  7:54       ` Thomas Monjalon
2021-03-15  8:43         ` Andrew Rybchenko
2021-03-15  8:55           ` Thomas Monjalon
2021-03-15  9:08             ` Andrew Rybchenko
2021-03-15  9:15               ` Thomas Monjalon
2021-03-19 18:12                 ` Thomas Monjalon
2021-03-20  7:54                   ` Andrew Rybchenko
2021-03-20 10:38                     ` Thomas Monjalon
2021-03-15  7:22     ` Hemant Agrawal
2021-03-12 17:46   ` [dpdk-dev] [PATCH v2 2/2] drivers/net: remove explicit include of legacy filtering Thomas Monjalon
2021-03-15  7:19     ` Hemant Agrawal
2021-03-21  8:59 ` [dpdk-dev] [PATCH v3 0/2] ethdev: remove some use " Thomas Monjalon
2021-03-21  9:00   ` [dpdk-dev] [PATCH v3 1/2] ethdev: replace callback getting filter operations Thomas Monjalon
2021-03-21  9:08     ` Andrew Rybchenko
2021-03-24 18:05     ` Ferruh Yigit
2021-03-26 17:41       ` Ferruh Yigit
2021-03-29 20:56     ` Matan Azrad
2021-03-21  9:00   ` [dpdk-dev] [PATCH v3 2/2] drivers/net: remove explicit include of legacy filtering Thomas Monjalon
2021-03-24 18:08     ` Ferruh Yigit
2021-03-24 20:00       ` Thomas Monjalon
2021-03-25  5:53         ` Andrew Rybchenko
2021-03-25 10:00           ` Ferruh Yigit
2021-03-25 10:20             ` Thomas Monjalon
2021-03-26 15:37               ` Ferruh Yigit
2021-03-26 21:45                 ` Thomas Monjalon

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=d6a4bd1c-f51f-5f7e-bca9-87ad7d86579c@oktetlabs.ru \
    --to=andrew.rybchenko@oktetlabs.ru \
    --cc=ajit.khaparde@broadcom.com \
    --cc=beilei.xing@intel.com \
    --cc=chas3@att.com \
    --cc=cloud.wangxiaoyun@huawei.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=grive@u256.net \
    --cc=haiyue.wang@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=humin29@huawei.com \
    --cc=hyonkim@cisco.com \
    --cc=jasvinder.singh@intel.com \
    --cc=jerinj@marvell.com \
    --cc=jia.guo@intel.com \
    --cc=jianwang@trustnetic.com \
    --cc=jiawenwu@trustnetic.com \
    --cc=jingjing.wu@intel.com \
    --cc=johndale@cisco.com \
    --cc=keith.wiles@intel.com \
    --cc=kirankumark@marvell.com \
    --cc=lironh@marvell.com \
    --cc=matan@nvidia.com \
    --cc=ndabilpuram@marvell.com \
    --cc=orika@nvidia.com \
    --cc=oulijun@huawei.com \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=rahul.lakkireddy@chelsio.com \
    --cc=rmody@marvell.com \
    --cc=rosen.xu@intel.com \
    --cc=sachin.saxena@oss.nxp.com \
    --cc=shahafs@nvidia.com \
    --cc=shshaikh@marvell.com \
    --cc=somnath.kotur@broadcom.com \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@nvidia.com \
    --cc=xuanziyang2@huawei.com \
    --cc=yisen.zhuang@huawei.com \
    --cc=zhouguoyang@huawei.com \
    /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.