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 F003DA2EDB for ; Fri, 6 Sep 2019 09:35:54 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DDDBE1F231; Fri, 6 Sep 2019 09:33:03 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id 8D1E41F183 for ; Fri, 6 Sep 2019 09:32:01 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us3.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 0A4F79C005B; Fri, 6 Sep 2019 07:32:00 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 6 Sep 2019 00:31:54 -0700 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Fri, 6 Sep 2019 00:31:53 -0700 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id x867VpP8027687; Fri, 6 Sep 2019 08:31:51 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 714311613D1; Fri, 6 Sep 2019 08:31:51 +0100 (BST) From: Andrew Rybchenko To: "John W. Linville" , Xiaolong Ye , Qi Zhang , Shepard Siegel , Ed Czeck , "John Miller" , Igor Russkikh , Pavel Belous , Allain Legacy , Matt Peters , Ravi Kumar , Rasesh Mody , Shahed Shaikh , Ajit Khaparde , Somnath Kotur , Chas Williams , Rahul Lakkireddy , Hemant Agrawal , Sachin Saxena , Wenzhuo Lu , Marcin Wojtas , Michal Krawczyk , "Guy Tzalik" , Evgeny Schemeilin , Gagandeep Singh , John Daley , "Hyong Youb Kim" , Gaetan Rivet , "Xiao Wang" , Ziyang Xuan , "Xiaoyun Wang" , Guoyang Zhou , Beilei Xing , Jingjing Wu , Qiming Yang , Rosen Xu , Konstantin Ananyev , Ferruh Yigit , Shijith Thotton , Srisivasubramanian Srinivasan , Jakub Grajciar , Matan Azrad , Shahaf Shuler , Yongseok Koh , "Viacheslav Ovsiienko" , Zyta Szpak , "Liron Himi" , Tomasz Duszynski , "Stephen Hemminger" , "K. Y. Srinivasan" , Haiyang Zhang , Rastislav Cernay , Jan Remes , Alejandro Lucero , Tetsuya Mukawa , "Jerin Jacob" , Nithin Dabilpuram , Kiran Kumar K , Bruce Richardson , Jasvinder Singh , Cristian Dumitrescu , Keith Wiles , Maciej Czekaj , Maxime Coquelin , Tiwei Bie , Zhihong Wang , Yong Wang , Thomas Monjalon CC: , Ivan Ilchenko Date: Fri, 6 Sep 2019 08:30:29 +0100 Message-ID: <1567755066-31389-18-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1567755066-31389-1-git-send-email-arybchenko@solarflare.com> References: <1566915962-5472-1-git-send-email-arybchenko@solarflare.com> <1567755066-31389-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24892.005 X-TM-AS-Result: No-10.628400-4.000000-10 X-TMASE-MatchedRID: z6Bo2YY7hCee/kF8Pup4HEPdsiR0fGlpy0Q+dW8+UWRjLp8Cm8vwF4gg kHfdF/Q7/7yMlJ1P+1GF0jPFsyHqkpXOyk7EwLglfid4LSHtIANj8vb8BkkBZJiQXtm0V8JT9Ac EWPYRUy16PoVsOkoUxvjdfwxN4PWFNkJPQaxNbIQPe5gzF3TVt99GcpCvqzHaBph69XjMbdlAHO g8qEtqyKOQvW008WlGb1OA6wLLPOCfO8RAj0nqTsebIMlISwjblCVC/a5T8eLRLEyE6G4DRAYxJ ykfuo4AkVsBuujJ0lHkeXelXJgnskutpzAV/3cDcI7vRACwF0LcVi8qZmJWcxpX1zEL4nq3849F r+w36gbJAvsRt1OSXNwrx2kjaXrW2tjnR/nW2NtWfOVCJoTbWlKzkDopemfsuWYx8s2K6RqtbjX 4EGqr7+BizFzQ56dqxkaSSVZFxZ7cmlTVZMpxw0rM69p7lDSsD9EeT78Tcxu6pZ/o2Hu2YTp0RQ 1/bKBc9CGg3AFhRKmX8L2xS4L+MMWKJ8at6hW2+CjwEqX1p7nUk/02d006RQCOLD+ckgKHN17Xw n/rN3Oa0O2hWYaro9oacvj7Z6YTeoT8ghp9T78vLP1C8DIeOqbsRRaTaNLRPaYQnKWC98G6ENxd trniRwmQXZkCKj1h+hv61yNX7Cxwbbtk9ldEbN+G9ND+fWcZEDnDEqNPdupMWZDkP/9XaUHWy4Q I5oX5B5RDdUIjBlpqLvv5uN1DppE4FU2ZdQO4KUnZzo2UQD1GOo6Qo+alrkkrZ4mFjTbD37NDIE 8N+wUV9V1w5LQC2QcqH1tMqZzsOYaLvc/+qameAiCmPx4NwBnUJ0Ek6yhjxEHRux+uk8jpP8tMO yYmaA== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--10.628400-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24892.005 X-MDID: 1567755120-wYd9OSbVbuAA Subject: [dpdk-dev] [PATCH v3 17/54] ethdev: change device info get callback to return 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" From: Ivan Ilchenko Change eth_dev_infos_get_t return value from void to int. Make eth_dev_infos_get_t implementations across all drivers to return negative errno values if case of error conditions. Signed-off-by: Ivan Ilchenko Signed-off-by: Andrew Rybchenko --- v3: - fix callback patch to take callback return value into account app/test/virtual_pmd.c | 4 ++- drivers/net/af_packet/rte_eth_af_packet.c | 4 ++- drivers/net/af_xdp/rte_eth_af_xdp.c | 4 ++- drivers/net/ark/ark_ethdev.c | 8 +++--- drivers/net/atlantic/atl_ethdev.c | 11 ++++++--- drivers/net/avp/avp_ethdev.c | 8 +++--- drivers/net/axgbe/axgbe_ethdev.c | 6 +++-- drivers/net/bnx2x/bnx2x_ethdev.c | 4 ++- drivers/net/bnxt/bnxt_ethdev.c | 12 ++++++--- drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++-- drivers/net/cxgbe/cxgbe_ethdev.c | 15 +++++++++--- drivers/net/cxgbe/cxgbe_pfvf.h | 4 +-- drivers/net/dpaa/dpaa_ethdev.c | 16 +++++++----- drivers/net/dpaa2/dpaa2_ethdev.c | 4 ++- drivers/net/e1000/em_ethdev.c | 12 ++++++--- drivers/net/e1000/igb_ethdev.c | 30 ++++++++++++++++------- drivers/net/ena/ena_ethdev.c | 8 +++--- drivers/net/enetc/enetc_ethdev.c | 4 ++- drivers/net/enic/enic_ethdev.c | 4 ++- drivers/net/failsafe/failsafe_ops.c | 6 +++-- drivers/net/fm10k/fm10k_ethdev.c | 8 +++--- drivers/net/hinic/hinic_pmd_ethdev.c | 4 ++- drivers/net/i40e/i40e_ethdev.c | 8 +++--- drivers/net/i40e/i40e_ethdev_vf.c | 8 +++--- drivers/net/i40e/i40e_vf_representor.c | 4 ++- drivers/net/iavf/iavf_ethdev.c | 6 +++-- drivers/net/ice/ice_ethdev.c | 8 +++--- drivers/net/ipn3ke/ipn3ke_representor.c | 4 ++- drivers/net/ixgbe/ixgbe_ethdev.c | 21 ++++++++++------ drivers/net/ixgbe/ixgbe_vf_representor.c | 4 ++- drivers/net/kni/rte_eth_kni.c | 4 ++- drivers/net/liquidio/lio_ethdev.c | 4 ++- drivers/net/memif/rte_eth_memif.c | 4 ++- drivers/net/mlx4/mlx4.h | 4 +-- drivers/net/mlx4/mlx4_ethdev.c | 4 ++- drivers/net/mlx5/mlx5.h | 2 +- drivers/net/mlx5/mlx5_ethdev.c | 4 ++- drivers/net/mvneta/mvneta_ethdev.c | 4 ++- drivers/net/mvpp2/mrvl_ethdev.c | 4 ++- drivers/net/netvsc/hn_ethdev.c | 16 +++++++++--- drivers/net/nfb/nfb_ethdev.c | 4 ++- drivers/net/nfp/nfp_net.c | 8 +++--- drivers/net/null/rte_eth_null.c | 6 +++-- drivers/net/octeontx/octeontx_ethdev.c | 4 ++- drivers/net/octeontx2/otx2_ethdev.h | 4 +-- drivers/net/octeontx2/otx2_ethdev_ops.c | 4 ++- drivers/net/pcap/rte_eth_pcap.c | 4 ++- drivers/net/qede/qede_ethdev.c | 10 ++++++-- drivers/net/ring/rte_eth_ring.c | 4 ++- drivers/net/sfc/sfc_ethdev.c | 4 ++- drivers/net/softnic/rte_eth_softnic.c | 4 ++- drivers/net/szedata2/rte_eth_szedata2.c | 4 ++- drivers/net/tap/rte_eth_tap.c | 4 ++- drivers/net/thunderx/nicvf_ethdev.c | 4 ++- drivers/net/vhost/rte_eth_vhost.c | 6 +++-- drivers/net/virtio/virtio_ethdev.c | 6 +++-- drivers/net/vmxnet3/vmxnet3_ethdev.c | 8 +++--- lib/librte_ethdev/rte_ethdev.c | 9 ++++++- lib/librte_ethdev/rte_ethdev_core.h | 4 +-- 59 files changed, 277 insertions(+), 119 deletions(-) diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c index 55c2bdb982..e295891c06 100644 --- a/app/test/virtual_pmd.c +++ b/app/test/virtual_pmd.c @@ -78,7 +78,7 @@ virtual_ethdev_configure_fail(struct rte_eth_dev *dev __rte_unused) return -1; } -static void +static int virtual_ethdev_info_get(struct rte_eth_dev *dev __rte_unused, struct rte_eth_dev_info *dev_info) { @@ -91,6 +91,8 @@ virtual_ethdev_info_get(struct rte_eth_dev *dev __rte_unused, dev_info->max_tx_queues = (uint16_t)512; dev_info->min_rx_bufsize = 0; + + return 0; } static int diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c index 6df09f2828..66131b53e7 100644 --- a/drivers/net/af_packet/rte_eth_af_packet.c +++ b/drivers/net/af_packet/rte_eth_af_packet.c @@ -299,7 +299,7 @@ eth_dev_configure(struct rte_eth_dev *dev __rte_unused) return 0; } -static void +static int eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct pmd_internals *internals = dev->data->dev_private; @@ -310,6 +310,8 @@ eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_rx_queues = (uint16_t)internals->nb_queues; dev_info->max_tx_queues = (uint16_t)internals->nb_queues; dev_info->min_rx_bufsize = 0; + + return 0; } static int diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 41ed5b2af4..aa716f3195 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -403,7 +403,7 @@ eth_dev_configure(struct rte_eth_dev *dev) return 0; } -static void +static int eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct pmd_internals *internals = dev->data->dev_private; @@ -421,6 +421,8 @@ eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->default_txportconf.nb_queues = 1; dev_info->default_rxportconf.ring_size = ETH_AF_XDP_DFLT_NUM_DESCS; dev_info->default_txportconf.ring_size = ETH_AF_XDP_DFLT_NUM_DESCS; + + return 0; } static int diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index 4c807f8ddc..2b3f8e3bbf 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -31,8 +31,8 @@ static int eth_ark_dev_configure(struct rte_eth_dev *dev); static int eth_ark_dev_start(struct rte_eth_dev *dev); static void eth_ark_dev_stop(struct rte_eth_dev *dev); static void eth_ark_dev_close(struct rte_eth_dev *dev); -static void eth_ark_dev_info_get(struct rte_eth_dev *dev, - struct rte_eth_dev_info *dev_info); +static int eth_ark_dev_info_get(struct rte_eth_dev *dev, + struct rte_eth_dev_info *dev_info); static int eth_ark_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete); static int eth_ark_dev_set_link_up(struct rte_eth_dev *dev); @@ -715,7 +715,7 @@ eth_ark_dev_close(struct rte_eth_dev *dev) dev->data->mac_addrs = 0; } -static void +static int eth_ark_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { @@ -747,6 +747,8 @@ eth_ark_dev_info_get(struct rte_eth_dev *dev, ETH_LINK_SPEED_40G | ETH_LINK_SPEED_50G | ETH_LINK_SPEED_100G); + + return 0; } static int diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index 4a99699ad5..b056f8229a 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -117,7 +117,7 @@ static int eth_atl_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, struct rte_pci_device *pci_dev); static int eth_atl_pci_remove(struct rte_pci_device *pci_dev); -static void atl_dev_info_get(struct rte_eth_dev *dev, +static int atl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); int atl_logtype_init; @@ -1074,7 +1074,7 @@ atl_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size) return 0; } -static void +static int atl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); @@ -1115,6 +1115,8 @@ atl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->speed_capa |= ETH_LINK_SPEED_100M; dev_info->speed_capa |= ETH_LINK_SPEED_2_5G; dev_info->speed_capa |= ETH_LINK_SPEED_5G; + + return 0; } static const uint32_t * @@ -1600,9 +1602,12 @@ static int atl_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { struct rte_eth_dev_info dev_info; + int ret; uint32_t frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; - atl_dev_info_get(dev, &dev_info); + ret = atl_dev_info_get(dev, &dev_info); + if (ret != 0) + return ret; if (mtu < RTE_ETHER_MIN_MTU || frame_size > dev_info.max_rx_pktlen) return -EINVAL; diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c index 504435edc2..c5801f319a 100644 --- a/drivers/net/avp/avp_ethdev.c +++ b/drivers/net/avp/avp_ethdev.c @@ -41,8 +41,8 @@ static int avp_dev_configure(struct rte_eth_dev *dev); static int avp_dev_start(struct rte_eth_dev *dev); static void avp_dev_stop(struct rte_eth_dev *dev); static void avp_dev_close(struct rte_eth_dev *dev); -static void avp_dev_info_get(struct rte_eth_dev *dev, - struct rte_eth_dev_info *dev_info); +static int avp_dev_info_get(struct rte_eth_dev *dev, + struct rte_eth_dev_info *dev_info); static int avp_vlan_offload_set(struct rte_eth_dev *dev, int mask); static int avp_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete); static void avp_dev_promiscuous_enable(struct rte_eth_dev *dev); @@ -2185,7 +2185,7 @@ avp_dev_promiscuous_disable(struct rte_eth_dev *eth_dev) rte_spinlock_unlock(&avp->lock); } -static void +static int avp_dev_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *dev_info) { @@ -2200,6 +2200,8 @@ avp_dev_info_get(struct rte_eth_dev *eth_dev, dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP; dev_info->tx_offload_capa = DEV_TX_OFFLOAD_VLAN_INSERT; } + + return 0; } static int diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c index 4fcede889d..5a7da75126 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -24,7 +24,7 @@ static int axgbe_dev_link_update(struct rte_eth_dev *dev, static int axgbe_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats); static void axgbe_dev_stats_reset(struct rte_eth_dev *dev); -static void axgbe_dev_info_get(struct rte_eth_dev *dev, +static int axgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); /* The set of PCI devices this driver supports */ @@ -354,7 +354,7 @@ axgbe_dev_stats_reset(struct rte_eth_dev *dev) } } -static void +static int axgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct axgbe_port *pdata = dev->data->dev_private; @@ -393,6 +393,8 @@ axgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->default_txconf = (struct rte_eth_txconf) { .tx_free_thresh = AXGBE_TX_FREE_THRESH, }; + + return 0; } static void axgbe_get_all_hw_features(struct axgbe_port *pdata) diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index cda29e64fc..b7359514e5 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -478,7 +478,7 @@ bnx2x_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, return num; } -static void +static int bnx2x_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct bnx2x_softc *sc = dev->data->dev_private; @@ -494,6 +494,8 @@ bnx2x_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->rx_desc_lim.nb_max = MAX_RX_AVAIL; dev_info->rx_desc_lim.nb_min = MIN_RX_SIZE_NONTPA; dev_info->tx_desc_lim.nb_max = MAX_TX_AVAIL; + + return 0; } static int diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 6685ee7d90..b521a72963 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -494,8 +494,8 @@ static int bnxt_init_nic(struct bnxt *bp) * Device configuration and status function */ -static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev, - struct rte_eth_dev_info *dev_info) +static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev, + struct rte_eth_dev_info *dev_info) { struct bnxt *bp = eth_dev->data->dev_private; uint16_t max_vnics, i, j, vpool, vrxq; @@ -588,6 +588,8 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev, dev_info->vmdq_pool_base = 0; dev_info->vmdq_queue_base = 0; + + return 0; } /* Configure the device based on the configuration provided */ @@ -1787,7 +1789,11 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu) new_pkt_size = new_mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE * BNXT_NUM_VLANS; - bnxt_dev_info_get_op(eth_dev, &dev_info); + rc = bnxt_dev_info_get_op(eth_dev, &dev_info); + if (rc != 0) { + PMD_DRV_LOG(ERR, "Error during getting ethernet device info\n"); + return rc; + } if (new_mtu < RTE_ETHER_MIN_MTU || new_mtu > BNXT_MAX_MTU) { PMD_DRV_LOG(ERR, "MTU requested must be within (%d, %d)\n", diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index a1b50141f9..a994c9abd2 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -2115,7 +2115,7 @@ bond_ethdev_close(struct rte_eth_dev *dev) /* forward declaration */ static int bond_ethdev_configure(struct rte_eth_dev *dev); -static void +static int bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct bond_dev_private *internals = dev->data->dev_private; @@ -2151,7 +2151,7 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) slave.port_id, strerror(-ret)); - return; + return ret; } if (slave_info.max_rx_queues < max_nb_rx_queues) @@ -2198,6 +2198,8 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->flow_type_rss_offloads = internals->flow_type_rss_offloads; dev_info->reta_size = internals->reta_size; + + return 0; } static int diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index efb458d470..19c2a3c4db 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -111,7 +111,7 @@ uint16_t cxgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, return work_done; } -void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev, +int cxgbe_dev_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *device_info) { struct port_info *pi = eth_dev->data->dev_private; @@ -146,6 +146,8 @@ void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev, device_info->rx_desc_lim = cxgbe_desc_lim; device_info->tx_desc_lim = cxgbe_desc_lim; cxgbe_get_speed_caps(pi, &device_info->speed_capa); + + return 0; } void cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev) @@ -281,7 +283,9 @@ int cxgbe_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu) int err; uint16_t new_mtu = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; - cxgbe_dev_info_get(eth_dev, &dev_info); + err = cxgbe_dev_info_get(eth_dev, &dev_info); + if (err != 0) + return err; /* Must accommodate at least RTE_ETHER_MIN_MTU */ if (new_mtu < RTE_ETHER_MIN_MTU || new_mtu > dev_info.max_rx_pktlen) @@ -587,7 +591,12 @@ int cxgbe_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, __func__, eth_dev->data->nb_rx_queues, queue_idx, nb_desc, socket_id, mp); - cxgbe_dev_info_get(eth_dev, &dev_info); + err = cxgbe_dev_info_get(eth_dev, &dev_info); + if (err != 0) { + dev_err(adap, "%s: error during getting ethernet device info", + __func__); + return err; + } /* Must accommodate at least RTE_ETHER_MIN_MTU */ if ((pkt_len < dev_info.min_rx_bufsize) || diff --git a/drivers/net/cxgbe/cxgbe_pfvf.h b/drivers/net/cxgbe/cxgbe_pfvf.h index 03145cea6d..011ec13860 100644 --- a/drivers/net/cxgbe/cxgbe_pfvf.h +++ b/drivers/net/cxgbe/cxgbe_pfvf.h @@ -10,8 +10,8 @@ void cxgbe_dev_rx_queue_release(void *q); void cxgbe_dev_tx_queue_release(void *q); void cxgbe_dev_stop(struct rte_eth_dev *eth_dev); void cxgbe_dev_close(struct rte_eth_dev *eth_dev); -void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev, - struct rte_eth_dev_info *device_info); +int cxgbe_dev_info_get(struct rte_eth_dev *eth_dev, + struct rte_eth_dev_info *device_info); void cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev); void cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev); void cxgbe_dev_allmulticast_enable(struct rte_eth_dev *eth_dev); diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 7154fb9b4c..25deadb949 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -124,7 +124,7 @@ static const struct rte_dpaa_xstats_name_off dpaa_xstats_strings[] = { static struct rte_dpaa_driver rte_dpaa_pmd; -static void +static int dpaa_eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); static inline void @@ -330,8 +330,8 @@ dpaa_fw_version_get(struct rte_eth_dev *dev __rte_unused, return 0; } -static void dpaa_eth_dev_info(struct rte_eth_dev *dev, - struct rte_eth_dev_info *dev_info) +static int dpaa_eth_dev_info(struct rte_eth_dev *dev, + struct rte_eth_dev_info *dev_info) { struct dpaa_if *dpaa_intf = dev->data->dev_private; @@ -346,13 +346,15 @@ static void dpaa_eth_dev_info(struct rte_eth_dev *dev, dev_info->max_vmdq_pools = ETH_16_POOLS; dev_info->flow_type_rss_offloads = DPAA_RSS_OFFLOAD_ALL; - if (dpaa_intf->fif->mac_type == fman_mac_1g) + if (dpaa_intf->fif->mac_type == fman_mac_1g) { dev_info->speed_capa = ETH_LINK_SPEED_1G; - else if (dpaa_intf->fif->mac_type == fman_mac_10g) + } else if (dpaa_intf->fif->mac_type == fman_mac_10g) { dev_info->speed_capa = (ETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G); - else + } else { DPAA_PMD_ERR("invalid link_speed: %s, %d", dpaa_intf->name, dpaa_intf->fif->mac_type); + return -EINVAL; + } dev_info->rx_offload_capa = dev_rx_offloads_sup | dev_rx_offloads_nodis; @@ -360,6 +362,8 @@ static void dpaa_eth_dev_info(struct rte_eth_dev *dev, dev_tx_offloads_nodis; dev_info->default_rxportconf.burst_size = DPAA_DEF_RX_BURST_SIZE; dev_info->default_txportconf.burst_size = DPAA_DEF_TX_BURST_SIZE; + + return 0; } static int dpaa_eth_link_update(struct rte_eth_dev *dev, diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index dd6a78f9fe..879bbc120d 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -243,7 +243,7 @@ dpaa2_fw_version_get(struct rte_eth_dev *dev, return 0; } -static void +static int dpaa2_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct dpaa2_dev_priv *priv = dev->data->dev_private; @@ -269,6 +269,8 @@ dpaa2_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_vfs = 0; dev_info->max_vmdq_pools = ETH_16_POOLS; dev_info->flow_type_rss_offloads = DPAA2_RSS_OFFLOAD_ALL; + + return 0; } static int diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index 20b5406237..305588f9b3 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -44,7 +44,7 @@ static int eth_em_link_update(struct rte_eth_dev *dev, static int eth_em_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats); static void eth_em_stats_reset(struct rte_eth_dev *dev); -static void eth_em_infos_get(struct rte_eth_dev *dev, +static int eth_em_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); static int eth_em_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf); @@ -1048,7 +1048,7 @@ em_get_max_pktlen(struct rte_eth_dev *dev) } } -static void +static int eth_em_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -1107,6 +1107,8 @@ eth_em_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->default_txportconf.nb_queues = 1; dev_info->default_txportconf.ring_size = 256; dev_info->default_rxportconf.ring_size = 256; + + return 0; } /* return 0 means link status changed, -1 means not changed */ @@ -1776,8 +1778,12 @@ eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) struct e1000_hw *hw; uint32_t frame_size; uint32_t rctl; + int ret; + + ret = eth_em_infos_get(dev, &dev_info); + if (ret != 0) + return ret; - eth_em_infos_get(dev, &dev_info); frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE; diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index fec2b4289a..6172f9ac64 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -102,10 +102,10 @@ static void eth_igb_stats_reset(struct rte_eth_dev *dev); static void eth_igb_xstats_reset(struct rte_eth_dev *dev); static int eth_igb_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size); -static void eth_igb_infos_get(struct rte_eth_dev *dev, +static int eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); static const uint32_t *eth_igb_supported_ptypes_get(struct rte_eth_dev *dev); -static void eth_igbvf_infos_get(struct rte_eth_dev *dev, +static int eth_igbvf_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); static int eth_igb_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf); @@ -2193,7 +2193,7 @@ eth_igb_fw_version_get(struct rte_eth_dev *dev, char *fw_version, return 0; } -static void +static int eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -2255,7 +2255,7 @@ eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) default: /* Should not happen */ - break; + return -EINVAL; } dev_info->hash_key_size = IGB_HKEY_MAX_INDEX * sizeof(uint32_t); dev_info->reta_size = ETH_RSS_RETA_SIZE_128; @@ -2291,6 +2291,7 @@ eth_igb_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_mtu = dev_info->max_rx_pktlen - E1000_ETH_OVERHEAD; dev_info->min_mtu = RTE_ETHER_MIN_MTU; + return 0; } static const uint32_t * @@ -2320,7 +2321,7 @@ eth_igb_supported_ptypes_get(struct rte_eth_dev *dev) return NULL; } -static void +static int eth_igbvf_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -2345,7 +2346,7 @@ eth_igbvf_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) break; default: /* Should not happen */ - break; + return -EINVAL; } dev_info->rx_queue_offload_capa = igb_get_rx_queue_offloads_capa(dev); @@ -2377,6 +2378,8 @@ eth_igbvf_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->rx_desc_lim = rx_desc_lim; dev_info->tx_desc_lim = tx_desc_lim; + + return 0; } /* return 0 means link status changed, -1 means not changed */ @@ -2794,6 +2797,7 @@ eth_igb_lsc_interrupt_setup(struct rte_eth_dev *dev, uint8_t on) static int eth_igb_rxq_interrupt_setup(struct rte_eth_dev *dev) { uint32_t mask, regval; + int ret; struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); @@ -2802,7 +2806,9 @@ static int eth_igb_rxq_interrupt_setup(struct rte_eth_dev *dev) struct rte_eth_dev_info dev_info; memset(&dev_info, 0, sizeof(dev_info)); - eth_igb_infos_get(dev, &dev_info); + ret = eth_igb_infos_get(dev, &dev_info); + if (ret != 0) + return ret; mask = (0xFFFFFFFF >> (32 - dev_info.max_rx_queues)) << misc_shift; regval = E1000_READ_REG(hw, E1000_EIMS); @@ -3176,9 +3182,12 @@ igbvf_stop_adapter(struct rte_eth_dev *dev) u16 i; struct rte_eth_dev_info dev_info; struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); + int ret; memset(&dev_info, 0, sizeof(dev_info)); - eth_igbvf_infos_get(dev, &dev_info); + ret = eth_igbvf_infos_get(dev, &dev_info); + if (ret != 0) + return; /* Clear interrupt mask to stop from interrupts being generated */ igbvf_intr_disable(hw); @@ -4475,6 +4484,7 @@ eth_igb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) struct e1000_hw *hw; struct rte_eth_dev_info dev_info; uint32_t frame_size = mtu + E1000_ETH_OVERHEAD; + int ret; hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -4483,7 +4493,9 @@ eth_igb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) if (hw->mac.type == e1000_82571) return -ENOTSUP; #endif - eth_igb_infos_get(dev, &dev_info); + ret = eth_igb_infos_get(dev, &dev_info); + if (ret != 0) + return ret; /* check that mtu is within the allowed range */ if (mtu < RTE_ETHER_MIN_MTU || diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 7d4a3b225e..8fefacf45f 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -227,8 +227,8 @@ static int ena_queue_start(struct ena_ring *ring); static int ena_queue_start_all(struct rte_eth_dev *dev, enum ena_ring_type ring_type); static void ena_stats_restart(struct rte_eth_dev *dev); -static void ena_infos_get(struct rte_eth_dev *dev, - struct rte_eth_dev_info *dev_info); +static int ena_infos_get(struct rte_eth_dev *dev, + struct rte_eth_dev_info *dev_info); static int ena_rss_reta_update(struct rte_eth_dev *dev, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size); @@ -1909,7 +1909,7 @@ static void ena_init_rings(struct ena_adapter *adapter) } } -static void ena_infos_get(struct rte_eth_dev *dev, +static int ena_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct ena_adapter *adapter; @@ -1982,6 +1982,8 @@ static void ena_infos_get(struct rte_eth_dev *dev, adapter->max_tx_sgl_size); dev_info->tx_desc_lim.nb_mtu_seg_max = RTE_MIN(ENA_PKT_MAX_BUFS, adapter->max_tx_sgl_size); + + return 0; } static uint16_t eth_ena_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c index 6c5501acb3..dec42b9763 100644 --- a/drivers/net/enetc/enetc_ethdev.c +++ b/drivers/net/enetc/enetc_ethdev.c @@ -144,7 +144,7 @@ enetc_hardware_init(struct enetc_eth_hw *hw) return 0; } -static void +static int enetc_dev_infos_get(struct rte_eth_dev *dev __rte_unused, struct rte_eth_dev_info *dev_info) { @@ -168,6 +168,8 @@ enetc_dev_infos_get(struct rte_eth_dev *dev __rte_unused, DEV_RX_OFFLOAD_TCP_CKSUM | DEV_RX_OFFLOAD_KEEP_CRC | DEV_RX_OFFLOAD_JUMBO_FRAME); + + return 0; } static int diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 06dc67122c..90fdeda901 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -500,7 +500,7 @@ static uint32_t speed_capa_from_pci_id(struct rte_eth_dev *eth_dev) return ETH_LINK_SPEED_10G; } -static void enicpmd_dev_info_get(struct rte_eth_dev *eth_dev, +static int enicpmd_dev_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *device_info) { struct enic *enic = pmd_priv(eth_dev); @@ -555,6 +555,8 @@ static void enicpmd_dev_info_get(struct rte_eth_dev *eth_dev, .nb_queues = ENIC_DEFAULT_TX_RINGS, }; device_info->speed_capa = speed_capa_from_pci_id(eth_dev); + + return 0; } static const uint32_t *enicpmd_dev_supported_ptypes_get(struct rte_eth_dev *dev) diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index b3df626aaa..cc14bc2bcc 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -860,7 +860,7 @@ fs_dev_merge_info(struct rte_eth_dev_info *info, * all sub_devices and the default capabilities. * */ -static void +static int fs_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *infos) { @@ -936,10 +936,12 @@ fs_dev_infos_get(struct rte_eth_dev *dev, ret = rte_eth_dev_info_get(PORT_ID(sdev), &sub_info); if (ret != 0) - return; + return ret; fs_dev_merge_info(infos, &sub_info); } + + return 0; } static const uint32_t * diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index db4d72129d..8cb7337ea5 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -60,8 +60,8 @@ static void fm10k_set_tx_function(struct rte_eth_dev *dev); static int fm10k_check_ftag(struct rte_devargs *devargs); static int fm10k_link_update(struct rte_eth_dev *dev, int wait_to_complete); -static void fm10k_dev_infos_get(struct rte_eth_dev *dev, - struct rte_eth_dev_info *dev_info); +static int fm10k_dev_infos_get(struct rte_eth_dev *dev, + struct rte_eth_dev_info *dev_info); static uint64_t fm10k_get_rx_queue_offloads_capa(struct rte_eth_dev *dev); static uint64_t fm10k_get_rx_port_offloads_capa(struct rte_eth_dev *dev); static uint64_t fm10k_get_tx_queue_offloads_capa(struct rte_eth_dev *dev); @@ -1360,7 +1360,7 @@ fm10k_stats_reset(struct rte_eth_dev *dev) fm10k_rebind_hw_stats(hw, hw_stats); } -static void +static int fm10k_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { @@ -1438,6 +1438,8 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev, dev_info->speed_capa = ETH_LINK_SPEED_1G | ETH_LINK_SPEED_2_5G | ETH_LINK_SPEED_10G | ETH_LINK_SPEED_25G | ETH_LINK_SPEED_40G | ETH_LINK_SPEED_100G; + + return 0; } #ifdef RTE_LIBRTE_FM10K_RX_OLFLAGS_ENABLE diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c index 044af9053c..17a3625d63 100644 --- a/drivers/net/hinic/hinic_pmd_ethdev.c +++ b/drivers/net/hinic/hinic_pmd_ethdev.c @@ -664,7 +664,7 @@ static void hinic_get_speed_capa(struct rte_eth_dev *dev, uint32_t *speed_capa) * @param info * Pointer to Info structure output buffer. */ -static void +static int hinic_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) { struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev); @@ -697,6 +697,8 @@ hinic_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) info->flow_type_rss_offloads = HINIC_RSS_OFFLOAD_ALL; info->rx_desc_lim = hinic_rx_desc_lim; info->tx_desc_lim = hinic_tx_desc_lim; + + return 0; } static int hinic_config_rx_mode(struct hinic_nic_dev *nic_dev, u32 rx_mode_ctrl) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 4e40b7ab52..390cb21964 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -239,8 +239,8 @@ static int i40e_dev_xstats_get_names(struct rte_eth_dev *dev, static void i40e_dev_stats_reset(struct rte_eth_dev *dev); static int i40e_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size); -static void i40e_dev_info_get(struct rte_eth_dev *dev, - struct rte_eth_dev_info *dev_info); +static int i40e_dev_info_get(struct rte_eth_dev *dev, + struct rte_eth_dev_info *dev_info); static int i40e_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on); @@ -3483,7 +3483,7 @@ i40e_need_stop_lldp(struct rte_eth_dev *dev) return false; } -static void +static int i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -3620,6 +3620,8 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) } dev_info->default_rxportconf.burst_size = 32; dev_info->default_txportconf.burst_size = 32; + + return 0; } static int diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index c77b30c54b..eca418522f 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -75,8 +75,8 @@ enum i40evf_aq_result { static int i40evf_dev_configure(struct rte_eth_dev *dev); static int i40evf_dev_start(struct rte_eth_dev *dev); static void i40evf_dev_stop(struct rte_eth_dev *dev); -static void i40evf_dev_info_get(struct rte_eth_dev *dev, - struct rte_eth_dev_info *dev_info); +static int i40evf_dev_info_get(struct rte_eth_dev *dev, + struct rte_eth_dev_info *dev_info); static int i40evf_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete); static int i40evf_dev_stats_get(struct rte_eth_dev *dev, @@ -2216,7 +2216,7 @@ i40evf_dev_allmulticast_disable(struct rte_eth_dev *dev) vf->promisc_multicast_enabled = FALSE; } -static void +static int i40evf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); @@ -2292,6 +2292,8 @@ i40evf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) .nb_min = I40E_MIN_RING_DESC, .nb_align = I40E_ALIGN_RING_DESC, }; + + return 0; } static int diff --git a/drivers/net/i40e/i40e_vf_representor.c b/drivers/net/i40e/i40e_vf_representor.c index 633dca6c3a..652f0accca 100644 --- a/drivers/net/i40e/i40e_vf_representor.c +++ b/drivers/net/i40e/i40e_vf_representor.c @@ -22,7 +22,7 @@ i40e_vf_representor_link_update(struct rte_eth_dev *ethdev, return i40e_dev_link_update(representor->adapter->eth_dev, wait_to_complete); } -static void +static int i40e_vf_representor_dev_infos_get(struct rte_eth_dev *ethdev, struct rte_eth_dev_info *dev_info) { @@ -100,6 +100,8 @@ i40e_vf_representor_dev_infos_get(struct rte_eth_dev *ethdev, representor->adapter->eth_dev->device->name; dev_info->switch_info.domain_id = representor->switch_domain_id; dev_info->switch_info.port_id = representor->vf_id; + + return 0; } static int diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 8f3907378c..99b1f43b82 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -37,7 +37,7 @@ static int iavf_dev_configure(struct rte_eth_dev *dev); static int iavf_dev_start(struct rte_eth_dev *dev); static void iavf_dev_stop(struct rte_eth_dev *dev); static void iavf_dev_close(struct rte_eth_dev *dev); -static void iavf_dev_info_get(struct rte_eth_dev *dev, +static int iavf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); static const uint32_t *iavf_dev_supported_ptypes_get(struct rte_eth_dev *dev); static int iavf_dev_stats_get(struct rte_eth_dev *dev, @@ -495,7 +495,7 @@ iavf_dev_stop(struct rte_eth_dev *dev) hw->adapter_stopped = 1; } -static void +static int iavf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); @@ -556,6 +556,8 @@ iavf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) .nb_min = IAVF_MIN_RING_DESC, .nb_align = IAVF_ALIGN_RING_DESC, }; + + return 0; } static const uint32_t * diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 63997fdfba..9d0e339a5d 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -36,8 +36,8 @@ static int ice_dev_start(struct rte_eth_dev *dev); static void ice_dev_stop(struct rte_eth_dev *dev); static void ice_dev_close(struct rte_eth_dev *dev); static int ice_dev_reset(struct rte_eth_dev *dev); -static void ice_dev_info_get(struct rte_eth_dev *dev, - struct rte_eth_dev_info *dev_info); +static int ice_dev_info_get(struct rte_eth_dev *dev, + struct rte_eth_dev_info *dev_info); static int ice_link_update(struct rte_eth_dev *dev, int wait_to_complete); static int ice_dev_set_link_up(struct rte_eth_dev *dev); @@ -2105,7 +2105,7 @@ ice_dev_reset(struct rte_eth_dev *dev) return 0; } -static void +static int ice_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -2225,6 +2225,8 @@ ice_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->default_txportconf.nb_queues = 1; dev_info->default_rxportconf.ring_size = ICE_BUF_SIZE_MIN; dev_info->default_txportconf.ring_size = ICE_BUF_SIZE_MIN; + + return 0; } static inline int diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c index 8300cc38c4..476d5e52bd 100644 --- a/drivers/net/ipn3ke/ipn3ke_representor.c +++ b/drivers/net/ipn3ke/ipn3ke_representor.c @@ -40,7 +40,7 @@ static rte_spinlock_t ipn3ke_link_notify_list_lk = RTE_SPINLOCK_INITIALIZER; static int ipn3ke_rpst_link_check(struct ipn3ke_rpst *rpst); -static void +static int ipn3ke_rpst_dev_infos_get(struct rte_eth_dev *ethdev, struct rte_eth_dev_info *dev_info) { @@ -101,6 +101,8 @@ ipn3ke_rpst_dev_infos_get(struct rte_eth_dev *ethdev, dev_info->switch_info.name = ethdev->device->name; dev_info->switch_info.domain_id = rpst->switch_domain_id; dev_info->switch_info.port_id = rpst->port_id; + + return 0; } static int diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 7eb3d0567b..0108db890b 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -182,11 +182,11 @@ static int ixgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev, uint8_t is_rx); static int ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size); -static void ixgbe_dev_info_get(struct rte_eth_dev *dev, - struct rte_eth_dev_info *dev_info); +static int ixgbe_dev_info_get(struct rte_eth_dev *dev, + struct rte_eth_dev_info *dev_info); static const uint32_t *ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev); -static void ixgbevf_dev_info_get(struct rte_eth_dev *dev, - struct rte_eth_dev_info *dev_info); +static int ixgbevf_dev_info_get(struct rte_eth_dev *dev, + struct rte_eth_dev_info *dev_info); static int ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); static int ixgbe_vlan_filter_set(struct rte_eth_dev *dev, @@ -3777,7 +3777,7 @@ ixgbe_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size) return 0; } -static void +static int ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); @@ -3861,6 +3861,8 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->default_txportconf.nb_queues = 1; dev_info->default_rxportconf.ring_size = 256; dev_info->default_txportconf.ring_size = 256; + + return 0; } static const uint32_t * @@ -3902,7 +3904,7 @@ ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev) return NULL; } -static void +static int ixgbevf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { @@ -3954,6 +3956,8 @@ ixgbevf_dev_info_get(struct rte_eth_dev *dev, dev_info->rx_desc_lim = rx_desc_lim; dev_info->tx_desc_lim = tx_desc_lim; + + return 0; } static int @@ -5018,8 +5022,11 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) struct rte_eth_dev_info dev_info; uint32_t frame_size = mtu + IXGBE_ETH_OVERHEAD; struct rte_eth_dev_data *dev_data = dev->data; + int ret; - ixgbe_dev_info_get(dev, &dev_info); + ret = ixgbe_dev_info_get(dev, &dev_info); + if (ret != 0) + return ret; /* check that mtu is within the allowed range */ if (mtu < RTE_ETHER_MIN_MTU || frame_size > dev_info.max_rx_pktlen) diff --git a/drivers/net/ixgbe/ixgbe_vf_representor.c b/drivers/net/ixgbe/ixgbe_vf_representor.c index 2c01f6e33c..dbbef294ae 100644 --- a/drivers/net/ixgbe/ixgbe_vf_representor.c +++ b/drivers/net/ixgbe/ixgbe_vf_representor.c @@ -34,7 +34,7 @@ ixgbe_vf_representor_mac_addr_set(struct rte_eth_dev *ethdev, representor->vf_id, mac_addr); } -static void +static int ixgbe_vf_representor_dev_infos_get(struct rte_eth_dev *ethdev, struct rte_eth_dev_info *dev_info) { @@ -76,6 +76,8 @@ ixgbe_vf_representor_dev_infos_get(struct rte_eth_dev *ethdev, representor->pf_ethdev->device->name; dev_info->switch_info.domain_id = representor->switch_domain_id; dev_info->switch_info.port_id = representor->vf_id; + + return 0; } static int ixgbe_vf_representor_dev_configure( diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c index 515c0aa14d..5e1623d250 100644 --- a/drivers/net/kni/rte_eth_kni.c +++ b/drivers/net/kni/rte_eth_kni.c @@ -200,7 +200,7 @@ eth_kni_dev_configure(struct rte_eth_dev *dev __rte_unused) return 0; } -static void +static int eth_kni_dev_info(struct rte_eth_dev *dev __rte_unused, struct rte_eth_dev_info *dev_info) { @@ -209,6 +209,8 @@ eth_kni_dev_info(struct rte_eth_dev *dev __rte_unused, dev_info->max_rx_queues = KNI_MAX_QUEUE_PER_PORT; dev_info->max_tx_queues = KNI_MAX_QUEUE_PER_PORT; dev_info->min_rx_bufsize = 0; + + return 0; } static int diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index c25dab00c7..d97e357e3c 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -367,7 +367,7 @@ lio_dev_stats_reset(struct rte_eth_dev *eth_dev) } } -static void +static int lio_dev_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *devinfo) { @@ -393,6 +393,7 @@ lio_dev_info_get(struct rte_eth_dev *eth_dev, devinfo->speed_capa = ETH_LINK_SPEED_10G; lio_dev_err(lio_dev, "Unknown CN23XX subsystem device id. Setting 10G as default link speed.\n"); + return -EINVAL; } devinfo->max_rx_queues = lio_dev->max_rx_queues; @@ -423,6 +424,7 @@ lio_dev_info_get(struct rte_eth_dev *eth_dev, ETH_RSS_NONFRAG_IPV6_TCP | ETH_RSS_IPV6_EX | ETH_RSS_IPV6_TCP_EX); + return 0; } static int diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c index a59f809671..0d4360e5c2 100644 --- a/drivers/net/memif/rte_eth_memif.c +++ b/drivers/net/memif/rte_eth_memif.c @@ -164,7 +164,7 @@ memif_mp_request_regions(struct rte_eth_dev *dev) return memif_connect(dev); } -static void +static int memif_dev_info(struct rte_eth_dev *dev __rte_unused, struct rte_eth_dev_info *dev_info) { dev_info->max_mac_addrs = 1; @@ -172,6 +172,8 @@ memif_dev_info(struct rte_eth_dev *dev __rte_unused, struct rte_eth_dev_info *de dev_info->max_rx_queues = ETH_MEMIF_MAX_NUM_Q_PAIRS; dev_info->max_tx_queues = ETH_MEMIF_MAX_NUM_Q_PAIRS; dev_info->min_rx_bufsize = 0; + + return 0; } static memif_ring_t * diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index 9823577169..7730b530af 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h @@ -219,8 +219,8 @@ int mlx4_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on); int mlx4_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats); void mlx4_stats_reset(struct rte_eth_dev *dev); int mlx4_fw_version_get(struct rte_eth_dev *dev, char *fw_ver, size_t fw_size); -void mlx4_dev_infos_get(struct rte_eth_dev *dev, - struct rte_eth_dev_info *info); +int mlx4_dev_infos_get(struct rte_eth_dev *dev, + struct rte_eth_dev_info *info); int mlx4_link_update(struct rte_eth_dev *dev, int wait_to_complete); int mlx4_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf); diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c index 5d28c0116d..623ebd88cb 100644 --- a/drivers/net/mlx4/mlx4_ethdev.c +++ b/drivers/net/mlx4/mlx4_ethdev.c @@ -611,7 +611,7 @@ mlx4_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) * @param[out] info * Info structure output buffer. */ -void +int mlx4_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) { struct mlx4_priv *priv = dev->data->dev_private; @@ -645,6 +645,8 @@ mlx4_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) ETH_LINK_SPEED_40G | ETH_LINK_SPEED_56G; info->flow_type_rss_offloads = mlx4_conv_rss_types(priv, 0, 1); + + return 0; } /** diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index f559f835d0..cd08d001e9 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -685,7 +685,7 @@ int mlx5_get_mtu(struct rte_eth_dev *dev, uint16_t *mtu); int mlx5_set_flags(struct rte_eth_dev *dev, unsigned int keep, unsigned int flags); int mlx5_dev_configure(struct rte_eth_dev *dev); -void mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info); +int mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info); int mlx5_read_clock(struct rte_eth_dev *dev, uint64_t *clock); int mlx5_fw_version_get(struct rte_eth_dev *dev, char *fw_ver, size_t fw_size); const uint32_t *mlx5_dev_supported_ptypes_get(struct rte_eth_dev *dev); diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index 33a32fc2fa..766e1946d5 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -542,7 +542,7 @@ mlx5_set_txlimit_params(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) * @param[out] info * Info structure output buffer. */ -void +int mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) { struct mlx5_priv *priv = dev->data->dev_private; @@ -600,6 +600,8 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) break; } } + + return 0; } /** diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c index a8def8fc4e..3ba0ac76e2 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -153,7 +153,7 @@ mvneta_dev_configure(struct rte_eth_dev *dev) * @param info * Info structure output buffer. */ -static void +static int mvneta_dev_infos_get(struct rte_eth_dev *dev __rte_unused, struct rte_eth_dev_info *info) { @@ -187,6 +187,8 @@ mvneta_dev_infos_get(struct rte_eth_dev *dev __rte_unused, info->default_txconf.offloads = 0; info->max_rx_pktlen = MVNETA_PKT_SIZE_MAX; + + return 0; } /** diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index 810a703fc3..345c24404d 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.c +++ b/drivers/net/mvpp2/mrvl_ethdev.c @@ -1422,7 +1422,7 @@ mrvl_xstats_get_names(struct rte_eth_dev *dev __rte_unused, * @param info * Info structure output buffer. */ -static void +static int mrvl_dev_infos_get(struct rte_eth_dev *dev __rte_unused, struct rte_eth_dev_info *info) { @@ -1457,6 +1457,8 @@ mrvl_dev_infos_get(struct rte_eth_dev *dev __rte_unused, info->default_rxconf.rx_drop_en = 1; info->max_rx_pktlen = MRVL_PKT_SIZE_MAX; + + return 0; } /** diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c index 2a90d674e9..7353211c12 100644 --- a/drivers/net/netvsc/hn_ethdev.c +++ b/drivers/net/netvsc/hn_ethdev.c @@ -238,10 +238,11 @@ hn_dev_link_update(struct rte_eth_dev *dev, return rte_eth_linkstatus_set(dev, &link); } -static void hn_dev_info_get(struct rte_eth_dev *dev, - struct rte_eth_dev_info *dev_info) +static int hn_dev_info_get(struct rte_eth_dev *dev, + struct rte_eth_dev_info *dev_info) { struct hn_data *hv = dev->data->dev_private; + int rc; dev_info->speed_capa = ETH_LINK_SPEED_10G; dev_info->min_rx_bufsize = HN_MIN_RX_BUF_SIZE; @@ -255,8 +256,15 @@ static void hn_dev_info_get(struct rte_eth_dev *dev, dev_info->max_rx_queues = hv->max_queues; dev_info->max_tx_queues = hv->max_queues; - hn_rndis_get_offload(hv, dev_info); - hn_vf_info_get(hv, dev_info); + rc = hn_rndis_get_offload(hv, dev_info); + if (rc != 0) + return rc; + + rc = hn_vf_info_get(hv, dev_info); + if (rc != 0) + return rc; + + return 0; } static int hn_rss_reta_update(struct rte_eth_dev *dev, diff --git a/drivers/net/nfb/nfb_ethdev.c b/drivers/net/nfb/nfb_ethdev.c index f4093d43d8..b039ab6fc2 100644 --- a/drivers/net/nfb/nfb_ethdev.c +++ b/drivers/net/nfb/nfb_ethdev.c @@ -188,7 +188,7 @@ nfb_eth_dev_configure(struct rte_eth_dev *dev __rte_unused) * @param[out] info * Info structure output buffer. */ -static void +static int nfb_eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { @@ -197,6 +197,8 @@ nfb_eth_dev_info(struct rte_eth_dev *dev, dev_info->max_rx_queues = dev->data->nb_rx_queues; dev_info->max_tx_queues = dev->data->nb_tx_queues; dev_info->speed_capa = ETH_LINK_SPEED_100G; + + return 0; } /** diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index f1a3ef2f92..3d5b99c943 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -81,8 +81,8 @@ static int nfp_net_configure(struct rte_eth_dev *dev); static void nfp_net_dev_interrupt_handler(void *param); static void nfp_net_dev_interrupt_delayed_handler(void *param); static int nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); -static void nfp_net_infos_get(struct rte_eth_dev *dev, - struct rte_eth_dev_info *dev_info); +static int nfp_net_infos_get(struct rte_eth_dev *dev, + struct rte_eth_dev_info *dev_info); static int nfp_net_init(struct rte_eth_dev *eth_dev); static int nfp_net_link_update(struct rte_eth_dev *dev, int wait_to_complete); static void nfp_net_promisc_enable(struct rte_eth_dev *dev); @@ -1204,7 +1204,7 @@ nfp_net_stats_reset(struct rte_eth_dev *dev) nn_cfg_readq(hw, NFP_NET_CFG_STATS_RX_DISCARDS); } -static void +static int nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct nfp_net_hw *hw; @@ -1275,6 +1275,8 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->speed_capa = ETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G | ETH_LINK_SPEED_25G | ETH_LINK_SPEED_40G | ETH_LINK_SPEED_50G | ETH_LINK_SPEED_100G; + + return 0; } static const uint32_t * diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c index 0c60d241ac..aec0cab8f9 100644 --- a/drivers/net/null/rte_eth_null.c +++ b/drivers/net/null/rte_eth_null.c @@ -259,14 +259,14 @@ eth_mtu_set(struct rte_eth_dev *dev __rte_unused, uint16_t mtu __rte_unused) return 0; } -static void +static int eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct pmd_internals *internals; if ((dev == NULL) || (dev_info == NULL)) - return; + return -EINVAL; internals = dev->data->dev_private; dev_info->max_mac_addrs = 1; @@ -276,6 +276,8 @@ eth_dev_info(struct rte_eth_dev *dev, dev_info->min_rx_bufsize = 0; dev_info->reta_size = internals->reta_size; dev_info->flow_type_rss_offloads = internals->flow_type_rss_offloads; + + return 0; } static int diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index 27eed47bb0..1faa7b7c6b 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -569,7 +569,7 @@ octeontx_dev_default_mac_addr_set(struct rte_eth_dev *dev, return ret; } -static void +static int octeontx_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { @@ -600,6 +600,8 @@ octeontx_dev_info(struct rte_eth_dev *dev, dev_info->rx_offload_capa = OCTEONTX_RX_OFFLOADS; dev_info->tx_offload_capa = OCTEONTX_TX_OFFLOADS; + + return 0; } static void diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h index 7b15d6bc86..5de0a1d4d1 100644 --- a/drivers/net/octeontx2/otx2_ethdev.h +++ b/drivers/net/octeontx2/otx2_ethdev.h @@ -357,8 +357,8 @@ otx2_eth_pmd_priv(struct rte_eth_dev *eth_dev) } /* Ops */ -void otx2_nix_info_get(struct rte_eth_dev *eth_dev, - struct rte_eth_dev_info *dev_info); +int otx2_nix_info_get(struct rte_eth_dev *eth_dev, + struct rte_eth_dev_info *dev_info); int otx2_nix_dev_filter_ctrl(struct rte_eth_dev *eth_dev, enum rte_filter_type filter_type, enum rte_filter_op filter_op, void *arg); diff --git a/drivers/net/octeontx2/otx2_ethdev_ops.c b/drivers/net/octeontx2/otx2_ethdev_ops.c index 7c6532b6fc..024c295aa6 100644 --- a/drivers/net/octeontx2/otx2_ethdev_ops.c +++ b/drivers/net/octeontx2/otx2_ethdev_ops.c @@ -403,7 +403,7 @@ otx2_nix_get_module_eeprom(struct rte_eth_dev *eth_dev, return 0; } -void +int otx2_nix_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *devinfo) { struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); @@ -467,4 +467,6 @@ otx2_nix_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *devinfo) devinfo->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP | RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP; + + return 0; } diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index 5489010b64..50a0655a33 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -652,7 +652,7 @@ eth_dev_configure(struct rte_eth_dev *dev __rte_unused) return 0; } -static void +static int eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { @@ -664,6 +664,8 @@ eth_dev_info(struct rte_eth_dev *dev, dev_info->max_rx_queues = dev->data->nb_rx_queues; dev_info->max_tx_queues = dev->data->nb_tx_queues; dev_info->min_rx_bufsize = 0; + + return 0; } static int diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 528b33e8c4..9eb57fd78e 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -1253,7 +1253,7 @@ static const struct rte_eth_desc_lim qede_tx_desc_lim = { .nb_mtu_seg_max = ETH_TX_MAX_BDS_PER_NON_LSO_PACKET }; -static void +static int qede_dev_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *dev_info) { @@ -1333,6 +1333,8 @@ qede_dev_info_get(struct rte_eth_dev *eth_dev, if (link.adv_speed & NVM_CFG1_PORT_DRV_SPEED_CAPABILITY_MASK_BB_100G) speed_cap |= ETH_LINK_SPEED_100G; dev_info->speed_capa = speed_cap; + + return 0; } /* return 0 means link status changed, -1 means not changed */ @@ -2228,7 +2230,11 @@ static int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) int i, rc; PMD_INIT_FUNC_TRACE(edev); - qede_dev_info_get(dev, &dev_info); + rc = qede_dev_info_get(dev, &dev_info); + if (rc != 0) { + DP_ERR(edev, "Error during getting ethernet device info\n"); + return rc; + } max_rx_pkt_len = mtu + QEDE_MAX_ETHER_HDR_LEN; frame_size = max_rx_pkt_len; if (mtu < RTE_ETHER_MIN_MTU || frame_size > dev_info.max_rx_pktlen) { diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c index 634da63211..686246032e 100644 --- a/drivers/net/ring/rte_eth_ring.c +++ b/drivers/net/ring/rte_eth_ring.c @@ -151,7 +151,7 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id, } -static void +static int eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { @@ -162,6 +162,8 @@ eth_dev_info(struct rte_eth_dev *dev, dev_info->max_rx_queues = (uint16_t)internals->max_rx_queues; dev_info->max_tx_queues = (uint16_t)internals->max_tx_queues; dev_info->min_rx_bufsize = 0; + + return 0; } static int diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 1f78a3d8ad..013b6bbd63 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -86,7 +86,7 @@ sfc_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size) return 0; } -static void +static int sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { const struct sfc_adapter_priv *sap = sfc_adapter_priv_by_eth_dev(dev); @@ -184,6 +184,8 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP | RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP; + + return 0; } static const uint32_t * diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c index e3ad241618..11723778fd 100644 --- a/drivers/net/softnic/rte_eth_softnic.c +++ b/drivers/net/softnic/rte_eth_softnic.c @@ -86,13 +86,15 @@ static int pmd_softnic_logtype; rte_log(RTE_LOG_ ## level, pmd_softnic_logtype, \ "%s(): " fmt "\n", __func__, ##args) -static void +static int pmd_dev_infos_get(struct rte_eth_dev *dev __rte_unused, struct rte_eth_dev_info *dev_info) { dev_info->max_rx_pktlen = UINT32_MAX; dev_info->max_rx_queues = UINT16_MAX; dev_info->max_tx_queues = UINT16_MAX; + + return 0; } static int diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c index 99d5ca5ac0..ca066a3d3d 100644 --- a/drivers/net/szedata2/rte_eth_szedata2.c +++ b/drivers/net/szedata2/rte_eth_szedata2.c @@ -1044,7 +1044,7 @@ eth_dev_configure(struct rte_eth_dev *dev) return 0; } -static void +static int eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { @@ -1061,6 +1061,8 @@ eth_dev_info(struct rte_eth_dev *dev, dev_info->rx_queue_offload_capa = 0; dev_info->tx_queue_offload_capa = 0; dev_info->speed_capa = ETH_LINK_SPEED_100G; + + return 0; } static int diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 64bd049110..f85458c3cd 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -915,7 +915,7 @@ tap_dev_speed_capa(void) return capa; } -static void +static int tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct pmd_internals *internals = dev->data->dev_private; @@ -939,6 +939,8 @@ tap_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) * functions together and not in partial combinations */ dev_info->flow_type_rss_offloads = ~TAP_RSS_HF_MASK; + + return 0; } static int diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 56769ef859..f3ba07ae37 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -1393,7 +1393,7 @@ nicvf_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx, return 0; } -static void +static int nicvf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { struct nicvf *nic = nicvf_pmd_priv(dev); @@ -1440,6 +1440,8 @@ nicvf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) DEV_TX_OFFLOAD_UDP_CKSUM | DEV_TX_OFFLOAD_TCP_CKSUM, }; + + return 0; } static nicvf_iova_addr_t diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index a4892d7a0d..74cc7361b2 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -1054,7 +1054,7 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t tx_queue_id, return 0; } -static void +static int eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { @@ -1063,7 +1063,7 @@ eth_dev_info(struct rte_eth_dev *dev, internal = dev->data->dev_private; if (internal == NULL) { VHOST_LOG(ERR, "Invalid device specified\n"); - return; + return -ENODEV; } dev_info->max_mac_addrs = 1; @@ -1075,6 +1075,8 @@ eth_dev_info(struct rte_eth_dev *dev, dev_info->tx_offload_capa = DEV_TX_OFFLOAD_MULTI_SEGS | DEV_TX_OFFLOAD_VLAN_INSERT; dev_info->rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP; + + return 0; } static int diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index f96588b9da..8fe9dcebda 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -45,7 +45,7 @@ static void virtio_dev_promiscuous_enable(struct rte_eth_dev *dev); static void virtio_dev_promiscuous_disable(struct rte_eth_dev *dev); static void virtio_dev_allmulticast_enable(struct rte_eth_dev *dev); static void virtio_dev_allmulticast_disable(struct rte_eth_dev *dev); -static void virtio_dev_info_get(struct rte_eth_dev *dev, +static int virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info); static int virtio_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete); @@ -2394,7 +2394,7 @@ virtio_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask) return 0; } -static void +static int virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { uint64_t tso_mask, host_features; @@ -2436,6 +2436,8 @@ virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) (1ULL << VIRTIO_NET_F_HOST_TSO6); if ((host_features & tso_mask) == tso_mask) dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_TCP_TSO; + + return 0; } /* diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 9cd5eb65be..551c511943 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -82,8 +82,8 @@ static int vmxnet3_dev_xstats_get_names(struct rte_eth_dev *dev, unsigned int n); static int vmxnet3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, unsigned int n); -static void vmxnet3_dev_info_get(struct rte_eth_dev *dev, - struct rte_eth_dev_info *dev_info); +static int vmxnet3_dev_info_get(struct rte_eth_dev *dev, + struct rte_eth_dev_info *dev_info); static const uint32_t * vmxnet3_dev_supported_ptypes_get(struct rte_eth_dev *dev); static int vmxnet3_dev_vlan_filter_set(struct rte_eth_dev *dev, @@ -1149,7 +1149,7 @@ vmxnet3_dev_stats_reset(struct rte_eth_dev *dev) } } -static void +static int vmxnet3_dev_info_get(struct rte_eth_dev *dev __rte_unused, struct rte_eth_dev_info *dev_info) { @@ -1186,6 +1186,8 @@ vmxnet3_dev_info_get(struct rte_eth_dev *dev __rte_unused, dev_info->rx_queue_offload_capa = 0; dev_info->tx_offload_capa = VMXNET3_TX_OFFLOAD_CAP; dev_info->tx_queue_offload_capa = 0; + + return 0; } static const uint32_t * diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 42b1d6e30a..30b0c7803f 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -2559,6 +2559,7 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info) .nb_seg_max = UINT16_MAX, .nb_mtu_seg_max = UINT16_MAX, }; + int diag; /* * Init dev_info before port_id check since caller does not have @@ -2576,7 +2577,13 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info) dev_info->max_mtu = UINT16_MAX; RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP); - (*dev->dev_ops->dev_infos_get)(dev, dev_info); + diag = (*dev->dev_ops->dev_infos_get)(dev, dev_info); + if (diag != 0) { + /* Cleanup already filled in device information */ + memset(dev_info, 0, sizeof(struct rte_eth_dev_info)); + return eth_err(port_id, diag); + } + dev_info->driver_name = dev->device->driver->name; dev_info->nb_rx_queues = dev->data->nb_rx_queues; dev_info->nb_tx_queues = dev->data->nb_tx_queues; diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h index 2922d5b7cc..2394b32c83 100644 --- a/lib/librte_ethdev/rte_ethdev_core.h +++ b/lib/librte_ethdev/rte_ethdev_core.h @@ -103,8 +103,8 @@ typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev, uint8_t is_rx); /**< @internal Set a queue statistics mapping for a tx/rx queue of an Ethernet device. */ -typedef void (*eth_dev_infos_get_t)(struct rte_eth_dev *dev, - struct rte_eth_dev_info *dev_info); +typedef int (*eth_dev_infos_get_t)(struct rte_eth_dev *dev, + struct rte_eth_dev_info *dev_info); /**< @internal Get specific information of an Ethernet device. */ typedef const uint32_t *(*eth_dev_supported_ptypes_get_t)(struct rte_eth_dev *dev); -- 2.17.1