From patchwork Mon Sep 9 12:13:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59008 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F02501EC8E; Mon, 9 Sep 2019 14:13:27 +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 EE9CD1EC7E for ; Mon, 9 Sep 2019 14:13:22 +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-us5.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id B591058006B; Mon, 9 Sep 2019 12:13:21 +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; Mon, 9 Sep 2019 05:13:18 -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; Mon, 9 Sep 2019 05:13:18 -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 x89CDH2u012199; Mon, 9 Sep 2019 13:13:17 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 4F0B51613D1; Mon, 9 Sep 2019 13:13:17 +0100 (BST) From: Andrew Rybchenko To: Neil Horman , John McNamara , Marko Kovacevic , Thomas Monjalon , Ferruh Yigit CC: , Ivan Ilchenko Date: Mon, 9 Sep 2019 13:13:03 +0100 Message-ID: <1568031190-16510-2-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568031190-16510-1-git-send-email-arybchenko@solarflare.com> References: <1568031190-16510-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24898.005 X-TM-AS-Result: No-1.026800-4.000000-10 X-TMASE-MatchedRID: xz5dUIpVk2xWSqhPlGB83yAI8aJmq0jw8boZEVitthhWm0JlHAu9AR/1 64dzHy5ihHMkSqTHaFfOJ0IyxDDCgcigY/XF8iwS2fov7TwhL8k/pOSL72dTfwdkFovAReUoilv Ab18i4hPcL9OnXn2+9aW+3hCtK6/nFMFUQi+pamEc9jA4mLo8uZRy1HDTPOXabcPp/oilssi5vS otqh5mgHXLUUM1a6I3ICAmFnt3oi92m+j+coBLPkrM69p7lDSswwD0mzFpRrcv3cLibF2Jty8sM R89db4U4vM1YF6AJbbCCfuIMF6xLd934/rDAK3zCaXr04pRMJBnGZ5XELjBNvL4M1NM5pQzO519 7NBIC6ILnjCHTGtH7Z+K+UWNk1EB4eq8qhT/jFitUHFs6u2+5RfCmU/PQUHDPk9FCKh6GHrw7Jx wU0EvZMqEROLb/+yO4/0Jvn0rwAJmtL4Dw+zNb5hXfxzgoU6P X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--1.026800-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568031202-zC1F_W8unic8 Subject: [dpdk-dev] [PATCH 1/7] ethdev: change allmulticast mode controllers to return errors 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 rte_eth_allmulticast_enable()/rte_eth_allmulticast_disable() return value from void to int and return negative errno values in case of error conditions. Modify usage of these functions across the ethdev according to new return type. Signed-off-by: Ivan Ilchenko Signed-off-by: Andrew Rybchenko --- doc/guides/rel_notes/deprecation.rst | 1 - doc/guides/rel_notes/release_19_11.rst | 4 +++ lib/librte_ethdev/rte_ethdev.c | 37 +++++++++++++++++++------- lib/librte_ethdev/rte_ethdev.h | 14 ++++++++-- 4 files changed, 43 insertions(+), 13 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index b2e0a1fc7c..0d8e231ef5 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): - - ``rte_eth_allmulticast_enable`` and ``rte_eth_allmulticast_disable`` - ``rte_eth_link_get`` and ``rte_eth_link_get_nowait`` - ``rte_eth_dev_stop`` - ``rte_eth_dev_close`` diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst index 5299157df7..a79e6a08e6 100644 --- a/doc/guides/rel_notes/release_19_11.rst +++ b/doc/guides/rel_notes/release_19_11.rst @@ -101,6 +101,10 @@ API Changes ``rte_eth_promiscuous_disable`` return value from ``void`` to ``int`` to provide a way to report various error conditions. +* ethdev: changed ``rte_eth_allmulticast_enable`` and + ``rte_eth_allmulticast_disable`` return value from ``void`` to ``int`` to + provide a way to report various error conditions. + ABI Changes ----------- diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 98fe533c5a..577640fdbe 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -1416,10 +1416,23 @@ rte_eth_dev_config_restore(struct rte_eth_dev *dev, } /* replay all multicast configuration */ - if (rte_eth_allmulticast_get(port_id) == 1) - rte_eth_allmulticast_enable(port_id); - else if (rte_eth_allmulticast_get(port_id) == 0) - rte_eth_allmulticast_disable(port_id); + if (rte_eth_allmulticast_get(port_id) == 1) { + ret = rte_eth_allmulticast_enable(port_id); + if (ret != 0 && ret != -ENOTSUP) { + RTE_ETHDEV_LOG(ERR, + "Failed to enable allmulticast mode for device (port %u): %s\n", + port_id, rte_strerror(-ret)); + return ret; + } + } else if (rte_eth_allmulticast_get(port_id) == 0) { + ret = rte_eth_allmulticast_disable(port_id); + if (ret != 0 && ret != -ENOTSUP) { + RTE_ETHDEV_LOG(ERR, + "Failed to disable allmulticast mode for device (port %u): %s\n", + port_id, rte_strerror(-ret)); + return ret; + } + } return 0; } @@ -1945,30 +1958,34 @@ rte_eth_promiscuous_get(uint16_t port_id) return dev->data->promiscuous; } -void +int rte_eth_allmulticast_enable(uint16_t port_id) { struct rte_eth_dev *dev; - RTE_ETH_VALID_PORTID_OR_RET(port_id); + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; - RTE_FUNC_PTR_OR_RET(*dev->dev_ops->allmulticast_enable); + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->allmulticast_enable, -ENOTSUP); (*dev->dev_ops->allmulticast_enable)(dev); dev->data->all_multicast = 1; + + return 0; } -void +int rte_eth_allmulticast_disable(uint16_t port_id) { struct rte_eth_dev *dev; - RTE_ETH_VALID_PORTID_OR_RET(port_id); + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; - RTE_FUNC_PTR_OR_RET(*dev->dev_ops->allmulticast_disable); + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->allmulticast_disable, -ENOTSUP); dev->data->all_multicast = 0; (*dev->dev_ops->allmulticast_disable)(dev); + + return 0; } int diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index f07a829b29..d24e3f9a24 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -2060,16 +2060,26 @@ int rte_eth_promiscuous_get(uint16_t port_id); * * @param port_id * The port identifier of the Ethernet device. + * @return + * - (0) if successful. + * - (-ENOTSUP) if support for allmulticast_enable() does not exist + * for the device. + * - (-ENODEV) if *port_id* invalid. */ -void rte_eth_allmulticast_enable(uint16_t port_id); +int rte_eth_allmulticast_enable(uint16_t port_id); /** * Disable the receipt of all multicast frames by an Ethernet device. * * @param port_id * The port identifier of the Ethernet device. + * @return + * - (0) if successful. + * - (-ENOTSUP) if support for allmulticast_disable() does not exist + * for the device. + * - (-ENODEV) if *port_id* invalid. */ -void rte_eth_allmulticast_disable(uint16_t port_id); +int rte_eth_allmulticast_disable(uint16_t port_id); /** * Return the value of allmulticast mode for an Ethernet device.