From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 540CBA2EEB for ; Fri, 13 Sep 2019 12:18:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D5CDD1F098; Fri, 13 Sep 2019 12:18:42 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 3311B1F094 for ; Fri, 13 Sep 2019 12:18:39 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Sep 2019 03:18:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,500,1559545200"; d="scan'208";a="210308119" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by fmsmga004.fm.intel.com with ESMTP; 13 Sep 2019 03:18:37 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.26]) by IRSMSX101.ger.corp.intel.com ([169.254.1.129]) with mapi id 14.03.0439.000; Fri, 13 Sep 2019 11:18:36 +0100 From: "Iremonger, Bernard" To: Andrew Rybchenko , Neil Horman , "Mcnamara, John" , "Kovacevic, Marko" , Thomas Monjalon , "Yigit, Ferruh" CC: "dev@dpdk.org" , Ivan Ilchenko Thread-Topic: [dpdk-dev] [PATCH v4 02/54] ethdev: change rte_eth_dev_info_get() return value to int Thread-Index: AQHVaYmxtxGAljZFQkOTIxhYTl02j6cpZXzQ Date: Fri, 13 Sep 2019 10:18:36 +0000 Message-ID: <8CEF83825BEC744B83065625E567D7C260DF77A1@IRSMSX108.ger.corp.intel.com> References: <1566915962-5472-1-git-send-email-arybchenko@solarflare.com> <1568306586-27831-1-git-send-email-arybchenko@solarflare.com> <1568306586-27831-3-git-send-email-arybchenko@solarflare.com> In-Reply-To: <1568306586-27831-3-git-send-email-arybchenko@solarflare.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDI0MzE2YzAtNWE4OS00NGI3LWI1YjktMDA2MTk0YmE3Y2NiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiZ2c3aklkTE5sUDFtRE53TG82S2p0K29Db0kxUFdNeFExNmx6YmlGcGtBNG9pd2N5aDdtdHBDR2QrVTNKMzFqYyJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v4 02/54] ethdev: change rte_eth_dev_info_get() return value to int X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Hi Ivan, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Andrew Rybchenko > Sent: Thursday, September 12, 2019 5:42 PM > To: Neil Horman ; Mcnamara, John > ; Kovacevic, Marko > ; Thomas Monjalon ; > Yigit, Ferruh > Cc: dev@dpdk.org; Ivan Ilchenko > Subject: [dpdk-dev] [PATCH v4 02/54] ethdev: change > rte_eth_dev_info_get() return value to int >=20 > From: Ivan Ilchenko >=20 > Change rte_eth_dev_info_get() return value from void to int and return > negative errno values in case of error conditions. > Modify rte_eth_dev_info_get() usage across the ethdev according to new > return type. >=20 > Signed-off-by: Ivan Ilchenko > Signed-off-by: Andrew Rybchenko > Reviewed-by: Ferruh Yigit ./check-git-log.sh -1 Wrong headline format: ethdev: change rte_eth_dev_info_get() return value to int > --- > doc/guides/rel_notes/deprecation.rst | 1 - > doc/guides/rel_notes/release_19_11.rst | 5 +- > lib/librte_ethdev/rte_ethdev.c | 69 ++++++++++++++++++-------- > lib/librte_ethdev/rte_ethdev.h | 6 ++- > 4 files changed, 57 insertions(+), 24 deletions(-) >=20 > diff --git a/doc/guides/rel_notes/deprecation.rst > b/doc/guides/rel_notes/deprecation.rst > index 0ee8533b1..cbb4c34ef 100644 > --- a/doc/guides/rel_notes/deprecation.rst > +++ b/doc/guides/rel_notes/deprecation.rst > @@ -88,7 +88,6 @@ Deprecation Notices > negative errno values to indicate various error conditions (e.g. > invalid port ID, unsupported operation, failed operation): >=20 > - - ``rte_eth_dev_info_get`` > - ``rte_eth_promiscuous_enable`` and ``rte_eth_promiscuous_disable`` > - ``rte_eth_allmulticast_enable`` and ``rte_eth_allmulticast_disable`` > - ``rte_eth_link_get`` and ``rte_eth_link_get_nowait`` diff --git > a/doc/guides/rel_notes/release_19_11.rst > b/doc/guides/rel_notes/release_19_11.rst > index 66297d8f3..c8d97f16e 100644 > --- a/doc/guides/rel_notes/release_19_11.rst > +++ b/doc/guides/rel_notes/release_19_11.rst > @@ -94,6 +94,9 @@ API Changes > Also, make sure to start the actual text at the margin. > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > +* ethdev: changed ``rte_eth_dev_infos_get`` return value from ``void`` > +to > + ``int`` to provide a way to report various error conditions. > + >=20 > ABI Changes > ----------- > @@ -145,7 +148,7 @@ The libraries prepended with a plus sign were > incremented in this version. > librte_distributor.so.1 > librte_eal.so.11 > librte_efd.so.1 > - librte_ethdev.so.12 > + + librte_ethdev.so.13 > librte_eventdev.so.7 > librte_flow_classify.so.1 > librte_gro.so.1 > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethde= v.c > index 17d183e1f..42b1d6e30 100644 > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -1125,7 +1125,6 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t > nb_rx_q, uint16_t nb_tx_q, >=20 > dev =3D &rte_eth_devices[port_id]; >=20 > - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, - > ENOTSUP); > RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, - > ENOTSUP); >=20 > if (dev->data->dev_started) { > @@ -1144,7 +1143,9 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t > nb_rx_q, uint16_t nb_tx_q, > */ > memcpy(&dev->data->dev_conf, dev_conf, sizeof(dev->data- > >dev_conf)); >=20 > - rte_eth_dev_info_get(port_id, &dev_info); > + ret =3D rte_eth_dev_info_get(port_id, &dev_info); > + if (ret !=3D 0) > + goto rollback; >=20 > /* If number of queues specified by application for both Rx and Tx is > * zero, use driver preferred values. This cannot be done individually > @@ -1406,6 +1407,7 @@ rte_eth_dev_start(uint16_t port_id) > struct rte_eth_dev *dev; > struct rte_eth_dev_info dev_info; > int diag; > + int ret; >=20 > RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL); >=20 > @@ -1420,7 +1422,9 @@ rte_eth_dev_start(uint16_t port_id) > return 0; > } >=20 > - rte_eth_dev_info_get(port_id, &dev_info); > + ret =3D rte_eth_dev_info_get(port_id, &dev_info); > + if (ret !=3D 0) > + return ret; >=20 > /* Lets restore MAC now if device does not support live change */ > if (*dev_info.dev_flags & RTE_ETH_DEV_NOLIVE_MAC_ADDR) @@ - > 1584,7 +1588,6 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t > rx_queue_id, > return -EINVAL; > } >=20 > - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, - > ENOTSUP); > RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_setup, - > ENOTSUP); >=20 > /* > @@ -1592,7 +1595,10 @@ rte_eth_rx_queue_setup(uint16_t port_id, > uint16_t rx_queue_id, > * This value must be provided in the private data of the memory > pool. > * First check that the memory pool has a valid private data. > */ > - rte_eth_dev_info_get(port_id, &dev_info); > + ret =3D rte_eth_dev_info_get(port_id, &dev_info); > + if (ret !=3D 0) > + return ret; > + > if (mp->private_data_size < sizeof(struct > rte_pktmbuf_pool_private)) { > RTE_ETHDEV_LOG(ERR, "%s private_data_size %d < %d\n", > mp->name, (int)mp->private_data_size, @@ -1703,6 > +1709,7 @@ rte_eth_tx_queue_setup(uint16_t port_id, uint16_t > tx_queue_id, > struct rte_eth_dev_info dev_info; > struct rte_eth_txconf local_conf; > void **txq; > + int ret; >=20 > RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL); >=20 > @@ -1712,10 +1719,11 @@ rte_eth_tx_queue_setup(uint16_t port_id, > uint16_t tx_queue_id, > return -EINVAL; > } >=20 > - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, - > ENOTSUP); > RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_setup, - > ENOTSUP); >=20 > - rte_eth_dev_info_get(port_id, &dev_info); > + ret =3D rte_eth_dev_info_get(port_id, &dev_info); > + if (ret !=3D 0) > + return ret; >=20 > /* Use default specified by driver, if nb_tx_desc is zero */ > if (nb_tx_desc =3D=3D 0) { > @@ -2540,7 +2548,7 @@ rte_eth_dev_fw_version_get(uint16_t port_id, > char *fw_version, size_t fw_size) > fw_version, > fw_size)); > } >=20 > -void > +int > rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info > *dev_info) { > struct rte_eth_dev *dev; > @@ -2558,7 +2566,7 @@ rte_eth_dev_info_get(uint16_t port_id, struct > rte_eth_dev_info *dev_info) > */ > memset(dev_info, 0, sizeof(struct rte_eth_dev_info)); >=20 > - RTE_ETH_VALID_PORTID_OR_RET(port_id); > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > dev =3D &rte_eth_devices[port_id]; >=20 > dev_info->rx_desc_lim =3D lim; > @@ -2567,13 +2575,15 @@ rte_eth_dev_info_get(uint16_t port_id, struct > rte_eth_dev_info *dev_info) > dev_info->min_mtu =3D RTE_ETHER_MIN_MTU; > dev_info->max_mtu =3D UINT16_MAX; >=20 > - RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get); > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, - > ENOTSUP); > (*dev->dev_ops->dev_infos_get)(dev, dev_info); > dev_info->driver_name =3D dev->device->driver->name; > dev_info->nb_rx_queues =3D dev->data->nb_rx_queues; > dev_info->nb_tx_queues =3D dev->data->nb_tx_queues; >=20 > dev_info->dev_flags =3D &dev->data->dev_flags; > + > + return 0; > } >=20 > int > @@ -2643,7 +2653,10 @@ rte_eth_dev_set_mtu(uint16_t port_id, uint16_t > mtu) > * which relies on dev->dev_ops->dev_infos_get. > */ > if (*dev->dev_ops->dev_infos_get !=3D NULL) { > - rte_eth_dev_info_get(port_id, &dev_info); > + ret =3D rte_eth_dev_info_get(port_id, &dev_info); > + if (ret !=3D 0) > + return ret; > + > if (mtu < dev_info.min_mtu || mtu > dev_info.max_mtu) > return -EINVAL; > } > @@ -2991,10 +3004,15 @@ rte_eth_dev_rss_hash_update(uint16_t port_id, > { > struct rte_eth_dev *dev; > struct rte_eth_dev_info dev_info =3D { .flow_type_rss_offloads =3D 0, }= ; > + int ret; >=20 > RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > + > + ret =3D rte_eth_dev_info_get(port_id, &dev_info); > + if (ret !=3D 0) > + return ret; > + > dev =3D &rte_eth_devices[port_id]; > - rte_eth_dev_info_get(port_id, &dev_info); > if ((dev_info.flow_type_rss_offloads | rss_conf->rss_hf) !=3D > dev_info.flow_type_rss_offloads) { > RTE_ETHDEV_LOG(ERR, > @@ -3100,9 +3118,11 @@ get_mac_addr_index(uint16_t port_id, const > struct rte_ether_addr *addr) > struct rte_eth_dev_info dev_info; > struct rte_eth_dev *dev =3D &rte_eth_devices[port_id]; > unsigned i; > + int ret; >=20 > - RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > - rte_eth_dev_info_get(port_id, &dev_info); > + ret =3D rte_eth_dev_info_get(port_id, &dev_info); > + if (ret !=3D 0) > + return -1; >=20 > for (i =3D 0; i < dev_info.max_mac_addrs; i++) > if (memcmp(addr, &dev->data->mac_addrs[i], @@ -3233,8 > +3253,12 @@ get_hash_mac_addr_index(uint16_t port_id, const struct > rte_ether_addr *addr) > struct rte_eth_dev_info dev_info; > struct rte_eth_dev *dev =3D &rte_eth_devices[port_id]; > unsigned i; > + int ret; > + > + ret =3D rte_eth_dev_info_get(port_id, &dev_info); > + if (ret !=3D 0) > + return -1; >=20 > - rte_eth_dev_info_get(port_id, &dev_info); > if (!dev->data->hash_mac_addrs) > return -1; >=20 > @@ -3319,11 +3343,15 @@ int rte_eth_set_queue_rate_limit(uint16_t > port_id, uint16_t queue_idx, > struct rte_eth_dev *dev; > struct rte_eth_dev_info dev_info; > struct rte_eth_link link; > + int ret; >=20 > RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); >=20 > + ret =3D rte_eth_dev_info_get(port_id, &dev_info); > + if (ret !=3D 0) > + return ret; > + > dev =3D &rte_eth_devices[port_id]; > - rte_eth_dev_info_get(port_id, &dev_info); > link =3D dev->data->dev_link; >=20 > if (queue_idx > dev_info.max_tx_queues) { @@ -4363,15 +4391,14 > @@ rte_eth_dev_adjust_nb_rx_tx_desc(uint16_t port_id, > uint16_t *nb_rx_desc, > uint16_t *nb_tx_desc) > { > - struct rte_eth_dev *dev; > struct rte_eth_dev_info dev_info; > + int ret; >=20 > RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); >=20 > - dev =3D &rte_eth_devices[port_id]; > - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, - > ENOTSUP); > - > - rte_eth_dev_info_get(port_id, &dev_info); > + ret =3D rte_eth_dev_info_get(port_id, &dev_info); > + if (ret !=3D 0) > + return ret; >=20 > if (nb_rx_desc !=3D NULL) > rte_eth_dev_adjust_nb_desc(nb_rx_desc, > &dev_info.rx_desc_lim); diff --git a/lib/librte_ethdev/rte_ethdev.h > b/lib/librte_ethdev/rte_ethdev.h index d9871782e..475dbdae1 100644 > --- a/lib/librte_ethdev/rte_ethdev.h > +++ b/lib/librte_ethdev/rte_ethdev.h > @@ -2366,8 +2366,12 @@ void rte_eth_macaddr_get(uint16_t port_id, > struct rte_ether_addr *mac_addr); > * @param dev_info > * A pointer to a structure of type *rte_eth_dev_info* to be filled wi= th > * the contextual information of the Ethernet device. > + * @return > + * - (0) if successful. > + * - (-ENOTSUP) if support for dev_infos_get() does not exist for the > device. > + * - (-ENODEV) if *port_id* invalid. > */ > -void rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info > *dev_info); > +int rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info > +*dev_info); >=20 > /** > * Retrieve the firmware version of a device. > -- > 2.17.1 Regards, Bernard.