From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A4A52A0547; Fri, 12 Mar 2021 08:09:56 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 58D3816089A; Fri, 12 Mar 2021 08:09:56 +0100 (CET) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id A52F84067E for ; Fri, 12 Mar 2021 08:09:55 +0100 (CET) Received: from [192.168.38.17] (aros.oktetlabs.ru [192.168.38.17]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id CC85E7F508; Fri, 12 Mar 2021 10:09:54 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru CC85E7F508 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1615532994; bh=TOAs/KqQjwbwD9uH02ry4hTsunlxyPf4i/vHO1qWzHI=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=HUiQf0STgzt8mqBjgeM4hkD83ySuAccAo6kYQbK7H+L5WVf5GjiI4ta4aI4xMHdPT hxhSvIyrKhUbsq1sSMi/9DiUMBhHBv/w3dp43r4KBcd+iBXGhl2Ro6MQEepY9wIfqb rtkiUt75vyTugvXsvYb4/NF9sLDIKLbTzpP9Pz7I= To: Thomas Monjalon , dev@dpdk.org Cc: Ori Kam , Ajit Khaparde , Somnath Kotur , Chas Williams , "Min Hu (Connor)" , Rahul Lakkireddy , Hemant Agrawal , Sachin Saxena , Jeff Guo , Haiyue Wang , John Daley , Hyong Youb Kim , Gaetan Rivet , Ziyang Xuan , Xiaoyun Wang , Guoyang Zhou , Yisen Zhuang , Lijun Ou , Beilei Xing , Jingjing Wu , Qiming Yang , Qi Zhang , Rosen Xu , Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko , Liron Himi , Jerin Jacob , Nithin Dabilpuram , Kiran Kumar K , Rasesh Mody , Shahed Shaikh , Jasvinder Singh , Cristian Dumitrescu , Keith Wiles , Jiawen Wu , Jian Wang , Ferruh Yigit References: <20210311221742.3750589-1-thomas@monjalon.net> <20210311221742.3750589-2-thomas@monjalon.net> From: Andrew Rybchenko Organization: OKTET Labs Message-ID: Date: Fri, 12 Mar 2021 10:09:54 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210311221742.3750589-2-thomas@monjalon.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 1/2] ethdev: replace callback getting filter operations X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 A couple of minor notes below. Other than that: Reviewed-by: Andrew Rybchenko [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]