From patchwork Tue Sep 10 08:25:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59058 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 C3E391ECC5; Tue, 10 Sep 2019 10:26:21 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 501BA1EB02; Tue, 10 Sep 2019 10:26:20 +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-us2.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id CB1B21C0068; Tue, 10 Sep 2019 08:26:18 +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; Tue, 10 Sep 2019 01:26:15 -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; Tue, 10 Sep 2019 01:26:15 -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 x8A8QE9j002196; Tue, 10 Sep 2019 09:26:14 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 5C3741613D2; Tue, 10 Sep 2019 09:26:14 +0100 (BST) From: Andrew Rybchenko To: Chas Williams CC: , Igor Romanov , Date: Tue, 10 Sep 2019 09:25:41 +0100 Message-ID: <1568103959-25572-2-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568103959-25572-1-git-send-email-arybchenko@solarflare.com> References: <1568103959-25572-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-2.752800-4.000000-10 X-TMASE-MatchedRID: YeFRLOJIG73wxP67pPeLzpr5ykm9NtIcL1eX+z9B1QytoJm7kj+/wIB5 w6KBECW19rat2/So2B6TYH7CGnYD1b4br6qTk1yGo7iJS6I6zaF6i696PjRPiAdkFovAReUoaUX s6FguVy07jKV1tWL3wH8ZtJhEdnVZo1ezCH3oysR1e7Xbb6Im2n0tCKdnhB589yM15V5aWpj6C0 ePs7A07QdNP5JHgU8AckpXVdNbCabo1zp+P7NjofJ1HuhXrQpmtqgPveaojd3THQzetcyrtky9D Z/PK92sLiMekQx6uafTIhaLIDV7T0qPrVOIQE1y2kC7SwvGlKhDwb7Jglhh1lFkOwaJdCKgGObb x/Uctjc= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--2.752800-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568103979-OF17guZygbVC Subject: [dpdk-dev] [PATCH 01/18] net/bonding: fix link speed update in broadcast mode 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: Igor Romanov Fix the issue that the link speed of the bond device was set to the link speed of the first active slave in broadcast mode. Set the link speed of the bond device to the minimum value across all of the slaves in that case. Fixes: deba8a2f8b0b ("net/bonding: fix link properties management") Cc: stable@dpdk.org Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko Acked-by: Chas Williams --- drivers/net/bonding/rte_eth_bond_pmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index f774e5677..fed71bd95 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -2395,8 +2395,8 @@ bond_ethdev_link_update(struct rte_eth_dev *ethdev, int wait_to_complete) * packet loss will occur on this slave if transmission at rates * greater than this are attempted */ - for (idx = 1; idx < bond_ctx->active_slave_count; idx++) { - link_update(bond_ctx->active_slaves[0], &slave_link); + for (idx = 0; idx < bond_ctx->active_slave_count; idx++) { + link_update(bond_ctx->active_slaves[idx], &slave_link); if (slave_link.link_speed < ethdev->data->dev_link.link_speed) From patchwork Tue Sep 10 08:25:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59065 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 D59D41EDCF; Tue, 10 Sep 2019 10:26:39 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id BD7A91ECC1 for ; Tue, 10 Sep 2019 10:26:21 +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-us2.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id A440C1C006E; Tue, 10 Sep 2019 08:26:20 +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; Tue, 10 Sep 2019 01:26:17 -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; Tue, 10 Sep 2019 01:26:17 -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 x8A8QENp002212; Tue, 10 Sep 2019 09:26:14 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 96AE41613D1; Tue, 10 Sep 2019 09:26:14 +0100 (BST) From: Andrew Rybchenko To: Neil Horman , John McNamara , Marko Kovacevic , "Ori Kam" , Bruce Richardson , Pablo de Lara , Radu Nicolau , Akhil Goyal , Tomasz Kantecki , Chas Williams , Thomas Monjalon , Ferruh Yigit CC: , Igor Romanov Date: Tue, 10 Sep 2019 09:25:42 +0100 Message-ID: <1568103959-25572-3-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568103959-25572-1-git-send-email-arybchenko@solarflare.com> References: <1568103959-25572-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.793500-4.000000-10 X-TMASE-MatchedRID: VK5cIMsVziYwpyA3tQmxTTKVTrGMDe/D0mSc1YzbC53iYlKox3ryNARj Z4/TzBlyZcz/Uu/FtYO17bjsdF3gfJrjPXzSqsiQz5CYDcN91Jt6i696PjRPiB3RY4pGTCyHZqH qViVNkhl8bO6hWfRWzo9CL1e45ag4p6uK8TOJS3EHK0IhbYfex/moZ6x4ZgCUChtLrGEu0+NKNN gKeyWO9GwG2Hqyve3AcwG5CvPIBQ9G7jIPw/RhEMGNvKPnBgOa+ERbVRJAp9jDra5IbmQvVlIAu 7hxUqwyhIhJxBzgKNZ/eb1mZFz9kfXTveotkyhyT7O/YHJhINDUk/02d006RVIxScKXZnK0/aUL 5uSAEgQzOxQAU9FLMdwU8VHXGipCHxPMjOKY7A8LbigRnpKlKZvjAepGmdoOZMWrDgJq+ovJ/b3 owWBm5lVLJ4rTtpsXP8o613ScOC4oQIGMpk2nb43yL6HOPv9VLhtbn7Q1D7wnRDObsCo8QyWaLM nNn+OM5APDq2B3cAxn2JWP8qFf9FKehBzm9vnO5B2Qzud0EsI35c5BnKCu9g== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--1.793500-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568103981-b-sHKwgMiubY Subject: [dpdk-dev] [PATCH 02/18] ethdev: change link status get functions 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" From: Igor Romanov Change rte_eth_link_get() and rte_eth_link_get_nowait() return value from void to int and return negative errno values in case of error conditions. Return value of link_update callback is ignored since the callback returns not errors but whether link up status has changed or not. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- doc/guides/rel_notes/deprecation.rst | 1 - doc/guides/rel_notes/release_19_11.rst | 4 ++++ doc/guides/sample_app_ug/link_status_intr.rst | 9 ++++++--- drivers/net/bonding/rte_eth_bond_pmd.c | 2 +- lib/librte_ethdev/rte_ethdev.c | 16 ++++++++++------ lib/librte_ethdev/rte_ethdev.h | 12 ++++++++++-- 6 files changed, 31 insertions(+), 13 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 165d13726..43b15ec2f 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_link_get`` and ``rte_eth_link_get_nowait`` - ``rte_eth_dev_stop`` - ``rte_eth_dev_close`` - ``rte_eth_macaddr_get`` diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst index d728592c8..3ff1296a2 100644 --- a/doc/guides/rel_notes/release_19_11.rst +++ b/doc/guides/rel_notes/release_19_11.rst @@ -108,6 +108,10 @@ API Changes * ethdev: changed ``rte_eth_dev_xstats_reset`` return value from ``void`` to ``int`` to provide a way to report various error conditions. +* ethdev: changed ``rte_eth_link_get`` and ``rte_eth_link_get_nowait`` + return value from ``void`` to ``int`` to provide a way to report various + error conditions. + ABI Changes ----------- diff --git a/doc/guides/sample_app_ug/link_status_intr.rst b/doc/guides/sample_app_ug/link_status_intr.rst index cfb1bcd58..5283be8b7 100644 --- a/doc/guides/sample_app_ug/link_status_intr.rst +++ b/doc/guides/sample_app_ug/link_status_intr.rst @@ -164,6 +164,7 @@ An example callback function that has been written as indicated below. lsi_event_callback(uint16_t port_id, enum rte_eth_event_type type, void *param) { struct rte_eth_link link; + int ret; RTE_SET_USED(param); @@ -171,9 +172,11 @@ An example callback function that has been written as indicated below. printf("Event type: %s\n", type == RTE_ETH_EVENT_INTR_LSC ? "LSC interrupt" : "unknown event"); - rte_eth_link_get_nowait(port_id, &link); - - if (link.link_status) { + ret = rte_eth_link_get_nowait(port_id, &link); + if (ret < 0) { + printf("Failed to get port %d link status: %s\n\n", + port_id, rte_strerror(-ret)); + } else if (link.link_status) { printf("Port %d Link Up - speed %u Mbps - %s\n\n", port_id, (unsigned)link.link_speed, (link.link_duplex == ETH_LINK_FULL_DUPLEX) ? ("full-duplex") : ("half-duplex")); } else diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index fed71bd95..9316f93f7 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -2358,7 +2358,7 @@ bond_ethdev_slave_link_status_change_monitor(void *cb_arg) static int bond_ethdev_link_update(struct rte_eth_dev *ethdev, int wait_to_complete) { - void (*link_update)(uint16_t port_id, struct rte_eth_link *eth_link); + int (*link_update)(uint16_t port_id, struct rte_eth_link *eth_link); struct bond_dev_private *bond_ctx; struct rte_eth_link slave_link; diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 1bd1e32b0..b9fa5f562 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -2015,40 +2015,44 @@ rte_eth_allmulticast_get(uint16_t port_id) return dev->data->all_multicast; } -void +int rte_eth_link_get(uint16_t port_id, struct rte_eth_link *eth_link) { 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]; if (dev->data->dev_conf.intr_conf.lsc && dev->data->dev_started) rte_eth_linkstatus_get(dev, eth_link); else { - RTE_FUNC_PTR_OR_RET(*dev->dev_ops->link_update); + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP); (*dev->dev_ops->link_update)(dev, 1); *eth_link = dev->data->dev_link; } + + return 0; } -void +int rte_eth_link_get_nowait(uint16_t port_id, struct rte_eth_link *eth_link) { 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]; if (dev->data->dev_conf.intr_conf.lsc && dev->data->dev_started) rte_eth_linkstatus_get(dev, eth_link); else { - RTE_FUNC_PTR_OR_RET(*dev->dev_ops->link_update); + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP); (*dev->dev_ops->link_update)(dev, 0); *eth_link = dev->data->dev_link; } + + return 0; } int diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index 14420dbbe..aba5b4c86 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -2103,8 +2103,12 @@ int rte_eth_allmulticast_get(uint16_t port_id); * @param link * A pointer to an *rte_eth_link* structure to be filled with * the status, the speed and the mode of the Ethernet device link. + * @return + * - (0) if successful. + * - (-ENOTSUP) if the function is not supported in PMD driver. + * - (-ENODEV) if *port_id* invalid. */ -void rte_eth_link_get(uint16_t port_id, struct rte_eth_link *link); +int rte_eth_link_get(uint16_t port_id, struct rte_eth_link *link); /** * Retrieve the status (ON/OFF), the speed (in Mbps) and the mode (HALF-DUPLEX @@ -2116,8 +2120,12 @@ void rte_eth_link_get(uint16_t port_id, struct rte_eth_link *link); * @param link * A pointer to an *rte_eth_link* structure to be filled with * the status, the speed and the mode of the Ethernet device link. + * @return + * - (0) if successful. + * - (-ENOTSUP) if the function is not supported in PMD driver. + * - (-ENODEV) if *port_id* invalid. */ -void rte_eth_link_get_nowait(uint16_t port_id, struct rte_eth_link *link); +int rte_eth_link_get_nowait(uint16_t port_id, struct rte_eth_link *link); /** * Retrieve the general I/O statistics of an Ethernet device. From patchwork Tue Sep 10 08:25:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59059 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 C0B711ED1D; Tue, 10 Sep 2019 10:26:25 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 6DD2C1EC22 for ; Tue, 10 Sep 2019 10:26:20 +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-us2.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 3D52A1C0069; Tue, 10 Sep 2019 08:26:19 +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; Tue, 10 Sep 2019 01:26:16 -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; Tue, 10 Sep 2019 01:26:16 -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 x8A8QESw002219; Tue, 10 Sep 2019 09:26:14 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id CE6AF1613D2; Tue, 10 Sep 2019 09:26:14 +0100 (BST) From: Andrew Rybchenko To: Wenzhuo Lu , Jingjing Wu , Bernard Iremonger CC: , Igor Romanov Date: Tue, 10 Sep 2019 09:25:43 +0100 Message-ID: <1568103959-25572-4-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568103959-25572-1-git-send-email-arybchenko@solarflare.com> References: <1568103959-25572-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-10.742200-4.000000-10 X-TMASE-MatchedRID: lZQXsOY9JGPDOgXZFRFV826HurDH4PpP57BplDPz0BDg91xayX4L85GW qGxfG/4gM22M43riQ2pURYNSY0mK56rpbcAnxpVuPwKTD1v8YV5MkOX0UoduuTbpMgyAfh26XOU bNKHXyRqqQx9ElEpmA8ldmexlvb+4SkJz50w3SpEZSSlznqUtbWcCy3wC35zduSIn8GC9fqv71G pSv+DMDMtych7JTK7QWxJjxfdFXl5F9nnmLepmE3Gg/sD2gWLWBGvINcfHqhcOkJQR4QWbsON7x qD5/++Z9rOOao+AG9OwLDCXsKwkDB6kTThkAlz/B7TqRAYVohZQ4asQfcq3nJsoi2XrUn/Jn6Kd MrRsL14qtq5d3cxkNaDjb4oyKcfRAt/GKvI4Y04FT86l5yHp38tPhfz3VXBTecnjL7UR5c8= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--10.742200-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568103979-vaj7py4b67TR Subject: [dpdk-dev] [PATCH 03/18] app/testpmd: check status of getting link info 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: Igor Romanov Add a wrapper for rte_eth_eth_link_get_nowait() that prints an error and returns a status code if the function fails. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- app/test-pmd/config.c | 13 ++++++++++--- app/test-pmd/softnicfwd.c | 16 +++++++++++++--- app/test-pmd/testpmd.c | 10 +++++++++- app/test-pmd/testpmd.h | 1 + app/test-pmd/util.c | 14 ++++++++++++++ 5 files changed, 47 insertions(+), 7 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 857b6dabc..33a4e9827 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -484,7 +484,9 @@ port_infos_display(portid_t port_id) return; } port = &ports[port_id]; - rte_eth_link_get_nowait(port_id, &link); + ret = eth_link_get_nowait_print_err(port_id, &link); + if (ret < 0) + return; ret = eth_dev_info_get_print_err(port_id, &dev_info); if (ret != 0) @@ -635,7 +637,9 @@ port_summary_display(portid_t port_id) return; } - rte_eth_link_get_nowait(port_id, &link); + ret = eth_link_get_nowait_print_err(port_id, &link); + if (ret < 0) + return; ret = eth_dev_info_get_print_err(port_id, &dev_info); if (ret != 0) @@ -3521,10 +3525,13 @@ set_queue_rate_limit(portid_t port_id, uint16_t queue_idx, uint16_t rate) { int diag; struct rte_eth_link link; + int ret; if (port_id_is_invalid(port_id, ENABLED_WARN)) return 1; - rte_eth_link_get_nowait(port_id, &link); + ret = eth_link_get_nowait_print_err(port_id, &link); + if (ret < 0) + return 1; if (rate > link.link_speed) { printf("Invalid rate value:%u bigger than link speed: %u\n", rate, link.link_speed); diff --git a/app/test-pmd/softnicfwd.c b/app/test-pmd/softnicfwd.c index 94e6669d3..e9d437364 100644 --- a/app/test-pmd/softnicfwd.c +++ b/app/test-pmd/softnicfwd.c @@ -163,16 +163,22 @@ softnic_begin(void *arg __rte_unused) return 0; } -static void +static int set_tm_hiearchy_nodes_shaper_rate(portid_t port_id, struct tm_hierarchy *h) { struct rte_eth_link link_params; uint64_t tm_port_rate; + int ret; memset(&link_params, 0, sizeof(link_params)); - rte_eth_link_get(port_id, &link_params); + ret = rte_eth_link_get(port_id, &link_params); + if (ret < 0) { + printf("Error during getting device (port %u) link info: %s\n", + port_id, rte_strerror(-ret)); + return ret; + } tm_port_rate = (uint64_t)ETH_SPEED_NUM_10G * BYTES_IN_MBPS; /* Set tm hierarchy shapers rate */ @@ -183,6 +189,8 @@ set_tm_hiearchy_nodes_shaper_rate(portid_t port_id, = h->subport_node_shaper_rate / PIPE_NODES_PER_SUBPORT; h->tc_node_shaper_rate = h->pipe_node_shaper_rate; h->tc_node_shared_shaper_rate = h->subport_node_shaper_rate; + + return 0; } static int @@ -554,7 +562,9 @@ softport_tm_hierarchy_specify(portid_t port_id, memset(&h, 0, sizeof(struct tm_hierarchy)); /* TM hierarchy shapers rate */ - set_tm_hiearchy_nodes_shaper_rate(port_id, &h); + status = set_tm_hiearchy_nodes_shaper_rate(port_id, &h); + if (status) + return status; /* Add root node (level 0) */ status = softport_tm_root_node_add(port_id, &h, error); diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 2a57978fd..0f6e27962 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2625,6 +2625,7 @@ check_all_ports_link_status(uint32_t port_mask) portid_t portid; uint8_t count, all_ports_up, print_flag = 0; struct rte_eth_link link; + int ret; printf("Checking link statuses...\n"); fflush(stdout); @@ -2634,7 +2635,14 @@ check_all_ports_link_status(uint32_t port_mask) if ((port_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + ret = rte_eth_link_get_nowait(portid, &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index f1529696f..c039e2961 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -826,6 +826,7 @@ int eth_dev_info_get_print_err(uint16_t port_id, struct rte_eth_dev_info *dev_info); void eth_set_promisc_mode(uint16_t port_id, int enable); void eth_set_allmulticast_mode(uint16_t port, int enable); +int eth_link_get_nowait_print_err(uint16_t port_id, struct rte_eth_link *link); /* Functions to manage the set of filtered Multicast MAC addresses */ diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index 1aec5d755..6c24bf8d9 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -277,3 +277,17 @@ eth_set_allmulticast_mode(uint16_t port, int enable) enable ? "enabling" : "disabling", port, rte_strerror(-ret)); } + +int +eth_link_get_nowait_print_err(uint16_t port_id, + struct rte_eth_link *link) +{ + int ret; + + ret = rte_eth_link_get_nowait(port_id, link); + if (ret < 0) + printf("Device (port %u) link get (without wait) failed: %s\n", + port_id, rte_strerror(-ret)); + + return ret; +} From patchwork Tue Sep 10 08:25:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59061 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 531EE1ED6B; Tue, 10 Sep 2019 10:26:30 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 010E71EC22 for ; Tue, 10 Sep 2019 10:26:20 +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-us2.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id C5CB51C0068; Tue, 10 Sep 2019 08:26:19 +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; Tue, 10 Sep 2019 01:26:16 -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; Tue, 10 Sep 2019 01:26:16 -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 x8A8QFU6002226; Tue, 10 Sep 2019 09:26:15 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 0B1CD1613D2; Tue, 10 Sep 2019 09:26:15 +0100 (BST) From: Andrew Rybchenko To: Chas Williams CC: , Igor Romanov Date: Tue, 10 Sep 2019 09:25:44 +0100 Message-ID: <1568103959-25572-5-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568103959-25572-1-git-send-email-arybchenko@solarflare.com> References: <1568103959-25572-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-3.263600-4.000000-10 X-TMASE-MatchedRID: 1e4GURu5ZSnDOgXZFRFV83CO70QAsBdCWw/S0HB7eoNjLp8Cm8vwF2dC uMvHMJPkGWRGldniBlVw5T4Iaj538mJZXQNDzktSDDB/0m4/XMTqobkz1A0A7VeIuu+Gkot8auP Bry+3W1EzlETC5jrcQoL7JbSyOvcew+noLBygYTgFxov+3JYvY6izFDHVmY+juqWf6Nh7tmEYAR BTx8mGnXA1rXsS2KwWpM0DuMZdHThqpXWtxrBsQSQ7ls378/zHA76tPJIOKsWnMb4m7aAqt/N+o A4oIb1dGayYH7HN0cQGQylveAJ0foF4KlUH7HJ6ngIgpj8eDcAZ1CdBJOsoY8RB0bsfrpPIcSqb xBgG0w4dp3EGyknOe4fo+FzzAvMHGz0UHwxBT90jb4ddzb6Mmck+pYzE0OROtMSv1prjUULbZG6 BvIk2Wl8/9cUrr/tcPgbCb+jU1TuTdSRXlCnjBIjjlF305EnAWUm8SESyzd/NBqGt1DPvvA== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--3.263600-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568103980-otnQuYoFf4yY Subject: [dpdk-dev] [PATCH 04/18] net/bonding: check status of getting link info 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: Igor Romanov The return value of rte_eth_link_get() and rte_eth_link_get_nowait() was changed from void to int. Update the usage of the functions according to the new return type. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- drivers/net/bonding/rte_eth_bond_8023ad.c | 24 +++++++--- drivers/net/bonding/rte_eth_bond_api.c | 19 ++++++-- drivers/net/bonding/rte_eth_bond_pmd.c | 55 ++++++++++++++++++++--- 3 files changed, 83 insertions(+), 15 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index e64fb6e41..e50d946eb 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c @@ -675,6 +675,7 @@ selection_logic(struct bond_dev_private *internals, uint16_t slave_id) uint16_t default_slave = 0; uint8_t mode_count_id, mode_band_id; struct rte_eth_link link_info; + int ret; slaves = internals->active_slaves; slaves_count = internals->active_slave_count; @@ -687,8 +688,14 @@ selection_logic(struct bond_dev_private *internals, uint16_t slave_id) if (agg->aggregator_port_id != slaves[i]) continue; + ret = rte_eth_link_get_nowait(slaves[i], &link_info); + if (ret < 0) { + RTE_BOND_LOG(ERR, + "Slave (port %u) link get failed: %s\n", + slaves[i], rte_strerror(-ret)); + continue; + } agg_count[agg->aggregator_port_id] += 1; - rte_eth_link_get_nowait(slaves[i], &link_info); agg_bandwidth[agg->aggregator_port_id] += link_info.link_speed; /* Actors system ID is not checked since all slave device have the same @@ -821,18 +828,25 @@ bond_mode_8023ad_periodic_cb(void *arg) /* Update link status on each port */ for (i = 0; i < internals->active_slave_count; i++) { uint16_t key; + int ret; slave_id = internals->active_slaves[i]; - rte_eth_link_get_nowait(slave_id, &link_info); - rte_eth_macaddr_get(slave_id, &slave_addr); + ret = rte_eth_link_get_nowait(slave_id, &link_info); + if (ret < 0) { + RTE_BOND_LOG(ERR, + "Slave (port %u) link get failed: %s\n", + slave_id, rte_strerror(-ret)); + } - if (link_info.link_status != 0) { + if (ret >= 0 && link_info.link_status != 0) { key = link_speed_key(link_info.link_speed) << 1; if (link_info.link_duplex == ETH_LINK_FULL_DUPLEX) key |= BOND_LINK_FULL_DUPLEX_KEY; - } else + } else { key = 0; + } + rte_eth_macaddr_get(slave_id, &slave_addr); port = &bond_mode_8023ad_ports[slave_id]; key = rte_cpu_to_be_16(key); diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index e2e27e9f2..2cef88720 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -557,9 +557,6 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id) } } - /* Add slave details to bonded device */ - slave_eth_dev->data->dev_flags |= RTE_ETH_DEV_BONDED_SLAVE; - /* Update all slave devices MACs */ mac_address_slaves_update(bonded_eth_dev); @@ -571,7 +568,18 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id) /* If bonded device is started then we can add the slave to our active * slave array */ if (bonded_eth_dev->data->dev_started) { - rte_eth_link_get_nowait(slave_port_id, &link_props); + ret = rte_eth_link_get_nowait(slave_port_id, &link_props); + if (ret < 0) { + rte_eth_dev_callback_unregister(slave_port_id, + RTE_ETH_EVENT_INTR_LSC, + bond_ethdev_lsc_event_callback, + &bonded_eth_dev->data->port_id); + internals->slave_count--; + RTE_BOND_LOG(ERR, + "Slave (port %u) link get failed: %s\n", + slave_port_id, rte_strerror(-ret)); + return -1; + } if (link_props.link_status == ETH_LINK_UP) { if (internals->active_slave_count == 0 && @@ -581,6 +589,9 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id) } } + /* Add slave details to bonded device */ + slave_eth_dev->data->dev_flags |= RTE_ETH_DEV_BONDED_SLAVE; + slave_vlan_filter_set(bonded_port_id, slave_port_id); return 0; diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 9316f93f7..a2d13d95c 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -846,8 +846,14 @@ bandwidth_left(uint16_t port_id, uint64_t load, uint8_t update_idx, struct bwg_slave *bwg_slave) { struct rte_eth_link link_status; + int ret; - rte_eth_link_get_nowait(port_id, &link_status); + ret = rte_eth_link_get_nowait(port_id, &link_status); + if (ret < 0) { + RTE_BOND_LOG(ERR, "Slave (port %u) link get failed: %s", + port_id, rte_strerror(-ret)); + return; + } uint64_t link_bwg = link_status.link_speed * 1000000ULL / 8; if (link_bwg == 0) return; @@ -2363,7 +2369,9 @@ bond_ethdev_link_update(struct rte_eth_dev *ethdev, int wait_to_complete) struct bond_dev_private *bond_ctx; struct rte_eth_link slave_link; + bool one_link_update_succeeded; uint32_t idx; + int ret; bond_ctx = ethdev->data->dev_private; @@ -2396,7 +2404,17 @@ bond_ethdev_link_update(struct rte_eth_dev *ethdev, int wait_to_complete) * greater than this are attempted */ for (idx = 0; idx < bond_ctx->active_slave_count; idx++) { - link_update(bond_ctx->active_slaves[idx], &slave_link); + ret = link_update(bond_ctx->active_slaves[idx], + &slave_link); + if (ret < 0) { + ethdev->data->dev_link.link_speed = + ETH_SPEED_NUM_NONE; + RTE_BOND_LOG(ERR, + "Slave (port %u) link get failed: %s", + bond_ctx->active_slaves[idx], + rte_strerror(-ret)); + return 0; + } if (slave_link.link_speed < ethdev->data->dev_link.link_speed) @@ -2406,7 +2424,13 @@ bond_ethdev_link_update(struct rte_eth_dev *ethdev, int wait_to_complete) break; case BONDING_MODE_ACTIVE_BACKUP: /* Current primary slave */ - link_update(bond_ctx->current_primary_port, &slave_link); + ret = link_update(bond_ctx->current_primary_port, &slave_link); + if (ret < 0) { + RTE_BOND_LOG(ERR, "Slave (port %u) link get failed: %s", + bond_ctx->current_primary_port, + rte_strerror(-ret)); + return 0; + } ethdev->data->dev_link.link_speed = slave_link.link_speed; break; @@ -2426,13 +2450,28 @@ bond_ethdev_link_update(struct rte_eth_dev *ethdev, int wait_to_complete) * of all the slaves */ ethdev->data->dev_link.link_speed = ETH_SPEED_NUM_NONE; + one_link_update_succeeded = false; for (idx = 0; idx < bond_ctx->active_slave_count; idx++) { - link_update(bond_ctx->active_slaves[idx], &slave_link); + ret = link_update(bond_ctx->active_slaves[idx], + &slave_link); + if (ret < 0) { + RTE_BOND_LOG(ERR, + "Slave (port %u) link get failed: %s", + bond_ctx->active_slaves[idx], + rte_strerror(-ret)); + continue; + } + one_link_update_succeeded = true; ethdev->data->dev_link.link_speed += slave_link.link_speed; } + + if (!one_link_update_succeeded) { + RTE_BOND_LOG(ERR, "All slaves link get failed"); + return 0; + } } @@ -2734,6 +2773,7 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type, struct bond_dev_private *internals; struct rte_eth_link link; int rc = -1; + int ret; uint8_t lsc_flag = 0; int valid_slave = 0; @@ -2774,8 +2814,11 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type, active_pos = find_slave_by_id(internals->active_slaves, internals->active_slave_count, port_id); - rte_eth_link_get_nowait(port_id, &link); - if (link.link_status) { + ret = rte_eth_link_get_nowait(port_id, &link); + if (ret < 0) + RTE_BOND_LOG(ERR, "Slave (port %u) link get failed", port_id); + + if (ret == 0 && link.link_status) { if (active_pos < internals->active_slave_count) goto link_update; From patchwork Tue Sep 10 08:25:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59062 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 11F3C1ED8E; Tue, 10 Sep 2019 10:26:33 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 188F11ECC1 for ; Tue, 10 Sep 2019 10:26:21 +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-us2.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id F00461C0068; Tue, 10 Sep 2019 08:26:19 +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; Tue, 10 Sep 2019 01:26:16 -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; Tue, 10 Sep 2019 01:26:16 -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 x8A8QFU8002226; Tue, 10 Sep 2019 09:26:15 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 49F2E1613D2; Tue, 10 Sep 2019 09:26:15 +0100 (BST) From: Andrew Rybchenko To: Wenzhuo Lu , Konstantin Ananyev CC: , Igor Romanov Date: Tue, 10 Sep 2019 09:25:45 +0100 Message-ID: <1568103959-25572-6-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568103959-25572-1-git-send-email-arybchenko@solarflare.com> References: <1568103959-25572-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-3.903100-4.000000-10 X-TMASE-MatchedRID: yxMxR3EH7TrDOgXZFRFV83CO70QAsBdCWw/S0HB7eoNjLp8Cm8vwFwoe RRhCZWIBRjuuru99Q9KPQi9XuOWoOPpl4kxHvczFMiMrbc70PfetggmrIZxcdVIxScKXZnK0Mvt VjOCcgkni8zVgXoAltsIJ+4gwXrEtJ0RPnyOnrZJrT2FOTF9Wozbub4mA2Ivrk6jjjncelPSH1r ytNSSBQiPLfnbtcIsun1mf+5YO6GUbQUwCz3g8H0xxOVsU6WB3jXIoMHNtzsK9Tbikt9AWZ0CBS GS7bIBtA1B/p1SzcogrKiD/U8b7STG+qee9IpZ3 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--3.903100-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568103980-48nLXXPVWwGs Subject: [dpdk-dev] [PATCH 05/18] net/ixgbe: check status of getting link info 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: Igor Romanov The return value of rte_eth_link_get() and rte_eth_link_get_nowait() was changed from void to int. Update the usage of the functions according to the new return type. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- drivers/net/ixgbe/ixgbe_ethdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 715646b5a..0aa039a71 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -2514,9 +2514,12 @@ ixgbe_set_vf_rate_limit(struct rte_eth_dev *dev, uint16_t vf, uint32_t queue_end; uint16_t total_rate = 0; struct rte_pci_device *pci_dev; + int ret; pci_dev = RTE_ETH_DEV_TO_PCI(dev); - rte_eth_link_get_nowait(dev->data->port_id, &link); + ret = rte_eth_link_get_nowait(dev->data->port_id, &link); + if (ret < 0) + return ret; if (vf >= pci_dev->max_vfs) return -EINVAL; From patchwork Tue Sep 10 08:25:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59063 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 DB1B11EDB4; Tue, 10 Sep 2019 10:26:35 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 489031EB02 for ; Tue, 10 Sep 2019 10:26:21 +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-us2.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 25D4A1C0068; Tue, 10 Sep 2019 08:26:20 +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; Tue, 10 Sep 2019 01:26:17 -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; Tue, 10 Sep 2019 01:26:16 -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 x8A8QFUA002226; Tue, 10 Sep 2019 09:26:15 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id A224F1613D2; Tue, 10 Sep 2019 09:26:15 +0100 (BST) From: Andrew Rybchenko To: Jakub Grajciar CC: Date: Tue, 10 Sep 2019 09:25:46 +0100 Message-ID: <1568103959-25572-7-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568103959-25572-1-git-send-email-arybchenko@solarflare.com> References: <1568103959-25572-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-2.614500-4.000000-10 X-TMASE-MatchedRID: m3UrM73BECPDOgXZFRFV83CO70QAsBdC3V4UShoTXad+SLLtNOiBhhnq ZOIRSjISfMtvnnFP0XhTvVffeIwvQyHhSBQfglfsA9lly13c/gFKgIbix5+XxEFungmhsSsCEG3 UzQEO6wqPBX+OQ5pJCm7LD6wi4cwC1aorlXfSzHmeAiCmPx4NwBnUJ0Ek6yhjxEHRux+uk8hxKp vEGAbTDkcJbjdBythVYAL6X/NdAGqyJvpQRd8E0JCRa/husYgGGLQYciovTMRTo0JZGTZDx4bWF wnRX1x9GFPRNHvUQnd3jtuaHNW7a5N1JFeUKeMEiOOUXfTkScBZSbxIRLLN380Goa3UM++8 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--2.614500-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568103980-eXsLqIrloTSQ Subject: [dpdk-dev] [PATCH 06/18] net/memif: check status of getting link info 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" The return value of rte_eth_link_get() was changed from void to int. Update the usage of the function according to the new return type. Just log error if something goes wrong. Signed-off-by: Andrew Rybchenko --- drivers/net/memif/rte_eth_memif.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c index af260f7a8..a347e27bd 100644 --- a/drivers/net/memif/rte_eth_memif.c +++ b/drivers/net/memif/rte_eth_memif.c @@ -266,7 +266,10 @@ eth_memif_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) return 0; if (unlikely(ring == NULL)) { /* Secondary process will attempt to request regions. */ - rte_eth_link_get(mq->in_port, &link); + ret = rte_eth_link_get(mq->in_port, &link); + if (ret < 0) + MIF_LOG(ERR, "Failed to get port %u link info: %s", + mq->in_port, rte_strerror(-ret)); return 0; } @@ -392,8 +395,13 @@ eth_memif_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) if (unlikely((pmd->flags & ETH_MEMIF_FLAG_CONNECTED) == 0)) return 0; if (unlikely(ring == NULL)) { + int ret; + /* Secondary process will attempt to request regions. */ - rte_eth_link_get(mq->in_port, &link); + ret = rte_eth_link_get(mq->in_port, &link); + if (ret < 0) + MIF_LOG(ERR, "Failed to get port %u link info: %s", + mq->in_port, rte_strerror(-ret)); return 0; } From patchwork Tue Sep 10 08:25:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59064 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 2A6871EDC0; Tue, 10 Sep 2019 10:26:38 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 7792D1EC22 for ; Tue, 10 Sep 2019 10:26:21 +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-us2.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 4F14B1C0068; Tue, 10 Sep 2019 08:26:20 +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; Tue, 10 Sep 2019 01:26:17 -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; Tue, 10 Sep 2019 01:26:17 -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 x8A8QFUC002226; Tue, 10 Sep 2019 09:26:15 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id D67A91613D2; Tue, 10 Sep 2019 09:26:15 +0100 (BST) From: Andrew Rybchenko To: Maryam Tahhan , Reshma Pattan CC: , Igor Romanov Date: Tue, 10 Sep 2019 09:25:47 +0100 Message-ID: <1568103959-25572-8-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568103959-25572-1-git-send-email-arybchenko@solarflare.com> References: <1568103959-25572-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-0.720200-4.000000-10 X-TMASE-MatchedRID: qnxxgFbkbxrMgjSVbwXY23CO70QAsBdCWw/S0HB7eoM7FE26mju9O2rj wa8vt1tRNOr0WzHbLlePQi9XuOWoOGk5Fql3Faa7JmbrB1j4Xwp9LQinZ4QefPcjNeVeWlqY+gt Hj7OwNO2eVW/ZdL52j6g8QnLUY0yCrf+kqWJbHxpnXtBHRQ1KM8Uc3IXooDeSx3qKK1Jnp4LS+g 5W3bfqMb+7GW5l8hyAlbgjgyiEi2i16TYRbSDuaNpAu0sLxpSoQ8G+yYJYYdZRZDsGiXQioBjm2 8f1HLY3 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--0.720200-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568103981-y3NC25XAX5-m Subject: [dpdk-dev] [PATCH 07/18] app/proc-info: check status of getting link info 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: Igor Romanov The return value of rte_eth_link_get() and rte_eth_link_get_nowait() was changed from void to int. Update the usage of the functions according to the new return type. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- app/proc-info/main.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/app/proc-info/main.c b/app/proc-info/main.c index 94e808dc6..a3f854b89 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -678,13 +678,18 @@ show_port(void) printf(" - generic config\n"); printf("\t -- Socket %d\n", rte_eth_dev_socket_id(i)); - rte_eth_link_get(i, &link); - printf("\t -- link speed %d duplex %d," - " auto neg %d status %d\n", - link.link_speed, - link.link_duplex, - link.link_autoneg, - link.link_status); + ret = rte_eth_link_get(i, &link); + if (ret < 0) { + printf("Link get failed (port %u): %s\n", + i, rte_strerror(-ret)); + } else { + printf("\t -- link speed %d duplex %d," + " auto neg %d status %d\n", + link.link_speed, + link.link_duplex, + link.link_autoneg, + link.link_status); + } printf("\t -- promiscuous (%d)\n", rte_eth_promiscuous_get(i)); ret = rte_eth_dev_get_mtu(i, &mtu); From patchwork Tue Sep 10 08:25:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59066 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 E13521EDD6; Tue, 10 Sep 2019 10:26:41 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id EC5021ECD5 for ; Tue, 10 Sep 2019 10:26:21 +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-us2.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 7A0451C005F; Tue, 10 Sep 2019 08:26:20 +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; Tue, 10 Sep 2019 01:26:17 -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; Tue, 10 Sep 2019 01:26:17 -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 x8A8QGnW002257; Tue, 10 Sep 2019 09:26:16 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 1700A1613D1; Tue, 10 Sep 2019 09:26:16 +0100 (BST) From: Andrew Rybchenko To: Chas Williams , Bruce Richardson CC: , Igor Romanov Date: Tue, 10 Sep 2019 09:25:48 +0100 Message-ID: <1568103959-25572-9-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568103959-25572-1-git-send-email-arybchenko@solarflare.com> References: <1568103959-25572-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-2.709700-4.000000-10 X-TMASE-MatchedRID: eHJXlKx9HErDOgXZFRFV83CO70QAsBdCWw/S0HB7eoOBzO52zKOpBSEP i3T0m113qtmwPAUfwvIQlFkmdk3VOiHhSBQfglfsA9lly13c/gHVoHA9HwvQm2tEzrC9eANpRlS qJpn6jyev2DHFCgS4xJEOYQ7YFMsPjxXQnG46XeIc9jA4mLo8uQRryDXHx6oXpzG+Ju2gKretbj X4EGqr77FGJJSB7R5RIHa4I0zrQ8s+DMYP1Y4Xz54CIKY/Hg3AGdQnQSTrKGPEQdG7H66TyJ8TM nmE+d0ZAz/lYxXNEFqHraWnC6j4F/4tWfskNCmPNLuH3gey2cww/BY1UT9ThGlVJDYcmX9HPyIN IEpr9PNl7mVH48l/0SUfX8/+25d2k3UkV5Qp4wSI45Rd9ORJwFlJvEhEss3fvN+d4ahMo5NWXGv UUmKP2w== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--2.709700-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568103981-Lez92GbLo9zX Subject: [dpdk-dev] [PATCH 08/18] app/test: check status of getting link info 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: Igor Romanov The return value of rte_eth_link_get() and rte_eth_link_get_nowait() was changed from void to int. Update the usage of the functions according to the new return type. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- app/test/test_link_bonding.c | 12 ++++++++++-- app/test/test_pmd_perf.c | 11 ++++++++++- app/test/test_pmd_ring.c | 8 +++++++- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index cbbbc98a1..d0d6fc23d 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -554,6 +554,7 @@ test_start_bonded_device(void) int current_slave_count, current_bonding_mode, primary_port; uint16_t slaves[RTE_MAX_ETHPORTS]; + int retval; /* Add slave to bonded device*/ TEST_ASSERT_SUCCESS(test_add_slave_to_bonded_device(), @@ -590,7 +591,10 @@ test_start_bonded_device(void) "Primary port (%d) is not expected value (%d).", primary_port, test_params->slave_port_ids[0]); - rte_eth_link_get(test_params->bonded_port_id, &link_status); + retval = rte_eth_link_get(test_params->bonded_port_id, &link_status); + TEST_ASSERT(retval >= 0, + "Bonded port (%d) link get failed: %s\n", + test_params->bonded_port_id, rte_strerror(-retval)); TEST_ASSERT_EQUAL(link_status.link_status, 1, "Bonded port (%d) status (%d) is not expected value (%d).\n", test_params->bonded_port_id, link_status.link_status, 1); @@ -605,10 +609,14 @@ test_stop_bonded_device(void) uint16_t slaves[RTE_MAX_ETHPORTS]; struct rte_eth_link link_status; + int retval; rte_eth_dev_stop(test_params->bonded_port_id); - rte_eth_link_get(test_params->bonded_port_id, &link_status); + retval = rte_eth_link_get(test_params->bonded_port_id, &link_status); + TEST_ASSERT(retval >= 0, + "Bonded port (%d) link get failed: %s\n", + test_params->bonded_port_id, rte_strerror(-retval)); TEST_ASSERT_EQUAL(link_status.link_status, 0, "Bonded port (%d) status (%d) is not expected value (%d).", test_params->bonded_port_id, link_status.link_status, 0); diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index 85ef11899..36b06ce5d 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -125,6 +125,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) uint16_t portid; uint8_t count, all_ports_up, print_flag = 0; struct rte_eth_link link; + int ret; printf("Checking link statuses...\n"); fflush(stdout); @@ -134,7 +135,15 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) if ((port_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + ret = rte_eth_link_get_nowait(portid, &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } + /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) { diff --git a/app/test/test_pmd_ring.c b/app/test/test_pmd_ring.c index 65ab6e7e0..02873f26a 100644 --- a/app/test/test_pmd_ring.c +++ b/app/test/test_pmd_ring.c @@ -24,6 +24,7 @@ test_ethdev_configure_port(int port) { struct rte_eth_conf null_conf; struct rte_eth_link link; + int ret; memset(&null_conf, 0, sizeof(struct rte_eth_conf)); @@ -54,7 +55,12 @@ test_ethdev_configure_port(int port) return -1; } - rte_eth_link_get(port, &link); + ret = rte_eth_link_get(port, &link); + if (ret < 0) { + printf("Link get failed for port %u: %s", + port, rte_strerror(-ret)); + return -1; + } return 0; } From patchwork Tue Sep 10 08:25:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59068 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 C84091EDE8; Tue, 10 Sep 2019 10:26:44 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 447ED1ED01 for ; Tue, 10 Sep 2019 10:26: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-us2.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id F2AED1C0068; Tue, 10 Sep 2019 08:26:20 +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; Tue, 10 Sep 2019 01:26:17 -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; Tue, 10 Sep 2019 01:26:17 -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 x8A8QGsh002264; Tue, 10 Sep 2019 09:26:16 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 43DA61613D1; Tue, 10 Sep 2019 09:26:16 +0100 (BST) From: Andrew Rybchenko To: Cristian Dumitrescu CC: Date: Tue, 10 Sep 2019 09:25:49 +0100 Message-ID: <1568103959-25572-10-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568103959-25572-1-git-send-email-arybchenko@solarflare.com> References: <1568103959-25572-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-2.932000-4.000000-10 X-TMASE-MatchedRID: 3VvmmxedNeLDOgXZFRFV83CO70QAsBdC3V4UShoTXad+SLLtNOiBhiXD Fxgit6TpGTEKg4xHKqqbHAuQ1dUnuWJZXQNDzktSSHCU59h5KrGk2H/b/X5aJSS30GKAkBxW+L9 A4dCyMAmOfMKGwpDs0IAy6p60ZV62fJ5/bZ6npdjGVuWouVipcg4fnpimCd+K3zh22y9SOU46dq /CPRG/j+5a42dmEMfFQi92ZTPKn7ErhaFDO8jEykrJ4noprRVr9x2/PpWu5qhihGjZhDzVFPDsn HBTQS9kyoRE4tv/7I7j/Qm+fSvAAma0vgPD7M1v1PYfTfPNTUk= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--2.932000-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568103981-mdqGiyj_v0My Subject: [dpdk-dev] [PATCH 09/18] app/pipeline: check status of getting link info 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" The return value of rte_eth_link_get_nowait() was changed from void to int. Update the usage of the function according to the new return type. Signed-off-by: Andrew Rybchenko --- app/test-pipeline/init.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/test-pipeline/init.c b/app/test-pipeline/init.c index 871d9fa2d..67d54ae05 100644 --- a/app/test-pipeline/init.c +++ b/app/test-pipeline/init.c @@ -161,10 +161,19 @@ app_ports_check_link(void) for (i = 0; i < app.n_ports; i++) { struct rte_eth_link link; uint16_t port; + int ret; port = app.ports[i]; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(port, &link); + ret = rte_eth_link_get_nowait(port, &link); + if (ret < 0) { + RTE_LOG(INFO, USER1, + "Failed to get port %u link status: %s\n", + port, rte_strerror(-ret)); + all_ports_up = 0; + continue; + } + RTE_LOG(INFO, USER1, "Port %u (%u Gbps) %s\n", port, link.link_speed / 1000, From patchwork Tue Sep 10 08:25:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59076 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 D192A1EE3A; Tue, 10 Sep 2019 10:27:00 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id A4B881ED55 for ; Tue, 10 Sep 2019 10:26:28 +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-us2.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 7B9241C005F; Tue, 10 Sep 2019 08:26: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; Tue, 10 Sep 2019 01:26: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; Tue, 10 Sep 2019 01:26:17 -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 x8A8QG9j002276; Tue, 10 Sep 2019 09:26:16 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 9FD891613D1; Tue, 10 Sep 2019 09:26:16 +0100 (BST) From: Andrew Rybchenko To: Marko Kovacevic , Ori Kam , Bruce Richardson , Pablo de Lara , Radu Nicolau , Akhil Goyal , Tomasz Kantecki , Konstantin Ananyev , Ferruh Yigit , "Declan Doherty" , David Hunt , Anatoly Burakov , John McNamara , Harry van Haaren , Xiaoyun Li , Byron Marohn CC: , Igor Romanov Date: Tue, 10 Sep 2019 09:25:50 +0100 Message-ID: <1568103959-25572-11-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568103959-25572-1-git-send-email-arybchenko@solarflare.com> References: <1568103959-25572-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.423700-4.000000-10 X-TMASE-MatchedRID: JJf+xfeHh43DOgXZFRFV80hwlOfYeSqx3V4UShoTXafPA7gCOGkjyMQ5 vcyCjz1IBJ9/1CPLxecFzmXTkU7qqx1YpEPWJiyzBi0Si9jXsY0/pOSL72dTf7Zk7gsuflVKrW4 1+BBqq+9dn27CIn0HMZf1EF8dUCKB3EFLWHIZiz/m96eHJyFxjaIik2/euMx1YUNrmP5tw/GjxY yRBa/qJcFwgTvxipFajoczmuoPCq2TuAhkrGey/o3JQK187LAZPXotVib+k4Ng5PRr/5NPxKl6j RLpvZIHuqxyArLgsJD7fIvYQPgCDcxaBa5BMwcf9e4Cq69vGxaF15h6/oibNbKsWJ44GuEGPNxa u39/BitFwHZmk+dWMmhnUCrcDtVn X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--1.423700-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568103982-mdC38LXaN3C4 Subject: [dpdk-dev] [PATCH 10/18] examples: check status of getting link info 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: Igor Romanov Check return code of rte_eth_link_get_nowait() in all check_all_ports_link_status() functions in examples. Check is repeated for every function since the logic of some of them is different from others. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- examples/exception_path/main.c | 10 +++++++++- examples/ip_fragmentation/main.c | 10 +++++++++- examples/ip_reassembly/main.c | 10 +++++++++- examples/ipsec-secgw/ipsec-secgw.c | 10 +++++++++- examples/ipv4_multicast/main.c | 10 +++++++++- examples/kni/main.c | 10 +++++++++- examples/l2fwd-crypto/main.c | 10 +++++++++- examples/l2fwd-jobstats/main.c | 10 +++++++++- examples/l2fwd-keepalive/main.c | 10 +++++++++- examples/l2fwd/main.c | 10 +++++++++- examples/l3fwd-acl/main.c | 10 +++++++++- examples/l3fwd-power/main.c | 10 +++++++++- examples/l3fwd/main.c | 10 +++++++++- examples/link_status_interrupt/main.c | 10 +++++++++- examples/load_balancer/init.c | 10 +++++++++- .../multi_process/client_server_mp/mp_server/init.c | 10 +++++++++- examples/multi_process/symmetric_mp/main.c | 10 +++++++++- examples/performance-thread/l3fwd-thread/main.c | 10 +++++++++- examples/server_node_efd/server/init.c | 10 +++++++++- examples/vm_power_manager/main.c | 10 +++++++++- 20 files changed, 180 insertions(+), 20 deletions(-) diff --git a/examples/exception_path/main.c b/examples/exception_path/main.c index f3c0206b5..85dbd7ec7 100644 --- a/examples/exception_path/main.c +++ b/examples/exception_path/main.c @@ -488,6 +488,7 @@ check_all_ports_link_status(uint32_t port_mask) uint16_t portid; uint8_t count, all_ports_up, print_flag = 0; struct rte_eth_link link; + int ret; printf("\nChecking link status"); fflush(stdout); @@ -497,7 +498,14 @@ check_all_ports_link_status(uint32_t port_mask) if ((port_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + ret = rte_eth_link_get_nowait(portid, &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index 70139ee4d..f90edc5a2 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -592,6 +592,7 @@ check_all_ports_link_status(uint32_t port_mask) uint16_t portid; uint8_t count, all_ports_up, print_flag = 0; struct rte_eth_link link; + int ret; printf("\nChecking link status"); fflush(stdout); @@ -601,7 +602,14 @@ check_all_ports_link_status(uint32_t port_mask) if ((port_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + ret = rte_eth_link_get_nowait(portid, &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index e810e9f3f..c822c8c58 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -711,6 +711,7 @@ check_all_ports_link_status(uint32_t port_mask) uint16_t portid; uint8_t count, all_ports_up, print_flag = 0; struct rte_eth_link link; + int ret; printf("\nChecking link status"); fflush(stdout); @@ -720,7 +721,14 @@ check_all_ports_link_status(uint32_t port_mask) if ((port_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + ret = rte_eth_link_get_nowait(portid, &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index 8154fc76a..2520e5108 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -1629,6 +1629,7 @@ check_all_ports_link_status(uint32_t port_mask) uint16_t portid; uint8_t count, all_ports_up, print_flag = 0; struct rte_eth_link link; + int ret; printf("\nChecking link status"); fflush(stdout); @@ -1638,7 +1639,14 @@ check_all_ports_link_status(uint32_t port_mask) if ((port_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + ret = rte_eth_link_get_nowait(portid, &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index 8fd19f4cf..6b165f2f0 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -575,6 +575,7 @@ check_all_ports_link_status(uint32_t port_mask) uint16_t portid; uint8_t count, all_ports_up, print_flag = 0; struct rte_eth_link link; + int ret; printf("\nChecking link status"); fflush(stdout); @@ -584,7 +585,14 @@ check_all_ports_link_status(uint32_t port_mask) if ((port_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + ret = rte_eth_link_get_nowait(portid, &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) diff --git a/examples/kni/main.c b/examples/kni/main.c index 1069fd08b..08366a5fa 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -654,6 +654,7 @@ check_all_ports_link_status(uint32_t port_mask) uint16_t portid; uint8_t count, all_ports_up, print_flag = 0; struct rte_eth_link link; + int ret; printf("\nChecking link status\n"); fflush(stdout); @@ -663,7 +664,14 @@ check_all_ports_link_status(uint32_t port_mask) if ((port_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + ret = rte_eth_link_get_nowait(portid, &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index c4ef31031..7c84b40ff 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -1731,6 +1731,7 @@ check_all_ports_link_status(uint32_t port_mask) uint16_t portid; uint8_t count, all_ports_up, print_flag = 0; struct rte_eth_link link; + int ret; printf("\nChecking link status"); fflush(stdout); @@ -1740,7 +1741,14 @@ check_all_ports_link_status(uint32_t port_mask) if ((port_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + ret = rte_eth_link_get_nowait(portid, &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c index 3dd6e45b8..4f930d097 100644 --- a/examples/l2fwd-jobstats/main.c +++ b/examples/l2fwd-jobstats/main.c @@ -685,6 +685,7 @@ check_all_ports_link_status(uint32_t port_mask) uint16_t portid; uint8_t count, all_ports_up, print_flag = 0; struct rte_eth_link link; + int ret; printf("\nChecking link status"); fflush(stdout); @@ -694,7 +695,14 @@ check_all_ports_link_status(uint32_t port_mask) if ((port_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + ret = rte_eth_link_get_nowait(portid, &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c index 708f44ee0..21278eed7 100644 --- a/examples/l2fwd-keepalive/main.c +++ b/examples/l2fwd-keepalive/main.c @@ -450,6 +450,7 @@ check_all_ports_link_status(uint32_t port_mask) uint16_t portid; uint8_t count, all_ports_up, print_flag = 0; struct rte_eth_link link; + int ret; printf("\nChecking link status"); fflush(stdout); @@ -459,7 +460,14 @@ check_all_ports_link_status(uint32_t port_mask) if ((port_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + ret = rte_eth_link_get_nowait(portid, &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index db070a18b..6b9f09a4d 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -449,6 +449,7 @@ check_all_ports_link_status(uint32_t port_mask) uint16_t portid; uint8_t count, all_ports_up, print_flag = 0; struct rte_eth_link link; + int ret; printf("\nChecking link status"); fflush(stdout); @@ -462,7 +463,14 @@ check_all_ports_link_status(uint32_t port_mask) if ((port_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + ret = rte_eth_link_get_nowait(portid, &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index c974a357b..0abb8cb5e 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -1814,6 +1814,7 @@ check_all_ports_link_status(uint32_t port_mask) uint16_t portid; uint8_t count, all_ports_up, print_flag = 0; struct rte_eth_link link; + int ret; printf("\nChecking link status"); fflush(stdout); @@ -1823,7 +1824,14 @@ check_all_ports_link_status(uint32_t port_mask) if ((port_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + ret = rte_eth_link_get_nowait(portid, &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 8ddc9ceb1..2e3b1d3c6 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -1970,6 +1970,7 @@ check_all_ports_link_status(uint32_t port_mask) uint8_t count, all_ports_up, print_flag = 0; uint16_t portid; struct rte_eth_link link; + int ret; printf("\nChecking link status"); fflush(stdout); @@ -1979,7 +1980,14 @@ check_all_ports_link_status(uint32_t port_mask) if ((port_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + ret = rte_eth_link_get_nowait(portid, &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index 9ed495ee0..7253acac4 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -718,6 +718,7 @@ check_all_ports_link_status(uint32_t port_mask) uint16_t portid; uint8_t count, all_ports_up, print_flag = 0; struct rte_eth_link link; + int ret; printf("\nChecking link status"); fflush(stdout); @@ -731,7 +732,14 @@ check_all_ports_link_status(uint32_t port_mask) if ((port_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + ret = rte_eth_link_get_nowait(portid, &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index be57e6a98..d42fef12b 100644 --- a/examples/link_status_interrupt/main.c +++ b/examples/link_status_interrupt/main.c @@ -465,6 +465,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) uint8_t count, all_ports_up, print_flag = 0; uint16_t portid; struct rte_eth_link link; + int ret; printf("\nChecking link status"); fflush(stdout); @@ -474,7 +475,14 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) if ((port_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + ret = rte_eth_link_get_nowait(portid, &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) diff --git a/examples/load_balancer/init.c b/examples/load_balancer/init.c index 4d49c9514..762226754 100644 --- a/examples/load_balancer/init.c +++ b/examples/load_balancer/init.c @@ -331,6 +331,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) uint16_t portid; uint8_t count, all_ports_up, print_flag = 0; struct rte_eth_link link; + int ret; uint32_t n_rx_queues, n_tx_queues; printf("\nChecking link status"); @@ -345,7 +346,14 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) if ((n_rx_queues == 0) && (n_tx_queues == 0)) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + ret = rte_eth_link_get_nowait(portid, &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) diff --git a/examples/multi_process/client_server_mp/mp_server/init.c b/examples/multi_process/client_server_mp/mp_server/init.c index e55def84b..3d4a9cdfa 100644 --- a/examples/multi_process/client_server_mp/mp_server/init.c +++ b/examples/multi_process/client_server_mp/mp_server/init.c @@ -184,6 +184,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) uint16_t portid; uint8_t count, all_ports_up, print_flag = 0; struct rte_eth_link link; + int ret; printf("\nChecking link status"); fflush(stdout); @@ -193,7 +194,14 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) if ((port_mask & (1 << ports->id[portid])) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(ports->id[portid], &link); + ret = rte_eth_link_get_nowait(ports->id[portid], &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c index 95058a5dc..7f491452a 100644 --- a/examples/multi_process/symmetric_mp/main.c +++ b/examples/multi_process/symmetric_mp/main.c @@ -364,6 +364,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) uint16_t portid; uint8_t count, all_ports_up, print_flag = 0; struct rte_eth_link link; + int ret; printf("\nChecking link status"); fflush(stdout); @@ -373,7 +374,14 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) if ((port_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + ret = rte_eth_link_get_nowait(portid, &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index 9e25f064e..de0521922 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -3432,6 +3432,7 @@ check_all_ports_link_status(uint32_t port_mask) uint16_t portid; uint8_t count, all_ports_up, print_flag = 0; struct rte_eth_link link; + int ret; printf("\nChecking link status"); fflush(stdout); @@ -3441,7 +3442,14 @@ check_all_ports_link_status(uint32_t port_mask) if ((port_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + ret = rte_eth_link_get_nowait(portid, &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) diff --git a/examples/server_node_efd/server/init.c b/examples/server_node_efd/server/init.c index 335741a8f..00e2e4059 100644 --- a/examples/server_node_efd/server/init.c +++ b/examples/server_node_efd/server/init.c @@ -246,6 +246,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) uint8_t count, all_ports_up, print_flag = 0; uint16_t portid; struct rte_eth_link link; + int ret; printf("\nChecking link status"); fflush(stdout); @@ -255,7 +256,14 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) if ((port_mask & (1 << info->id[portid])) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(info->id[portid], &link); + ret = rte_eth_link_get_nowait(info->id[portid], &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c index a3a747829..288a2462a 100644 --- a/examples/vm_power_manager/main.c +++ b/examples/vm_power_manager/main.c @@ -237,6 +237,7 @@ check_all_ports_link_status(uint32_t port_mask) #define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */ uint16_t portid, count, all_ports_up, print_flag = 0; struct rte_eth_link link; + int ret; printf("\nChecking link status"); fflush(stdout); @@ -250,7 +251,14 @@ check_all_ports_link_status(uint32_t port_mask) if ((port_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + ret = rte_eth_link_get_nowait(portid, &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } /* print link status if flag set */ if (print_flag == 1) { if (link.link_status) From patchwork Tue Sep 10 08:25:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59067 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 420981EDE1; Tue, 10 Sep 2019 10:26:43 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 189F51ECFA for ; Tue, 10 Sep 2019 10:26: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-us2.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 27DDD1C005F; Tue, 10 Sep 2019 08:26: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; Tue, 10 Sep 2019 01:26: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; Tue, 10 Sep 2019 01:26: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 x8A8QGHH002285; Tue, 10 Sep 2019 09:26:16 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id D96C11613D1; Tue, 10 Sep 2019 09:26:16 +0100 (BST) From: Andrew Rybchenko To: Nicolas Chautru CC: , Igor Romanov Date: Tue, 10 Sep 2019 09:25:51 +0100 Message-ID: <1568103959-25572-12-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568103959-25572-1-git-send-email-arybchenko@solarflare.com> References: <1568103959-25572-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-2.648700-4.000000-10 X-TMASE-MatchedRID: vdeff2Q33gXDOgXZFRFV83CO70QAsBdCWw/S0HB7eoM7FE26mju9O7ny O1e9qRizrdoLblq9S5rMJYD0aRF0RV/b0/1cTOafFyv3UWjlpb0txMagbN9/PIpLyz8UyqY4Pl0 9xg2LPPP2Y7i50sDX+EVXxsfqi11sNyl1nd9CIt0URSScn+QSXt0H8LFZNFG76sBnwpOylLPT7v w5HIV9LlGeyDURAZSSJThO9rNWyQIwsLyiDqALuPc75DZHoUtBrRopBnHRVSNR19YoLS1LYgAfj IYhKfaMLIuhItrFRYEPXLxHfxLeXVRHOSKs7RDUXmH0pBaurgG+4xOvsJAknn7cGd19dSFd X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--2.648700-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568103981-NqfJCcaVVcBR Subject: [dpdk-dev] [PATCH 11/18] examples/bbdev_app: check status of getting link info 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: Igor Romanov The return value of rte_eth_link_get() and rte_eth_link_get_nowait() was changed from void to int. Update the usage of the functions according to the new return type. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- examples/bbdev_app/main.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c index 3d36629a1..349876589 100644 --- a/examples/bbdev_app/main.c +++ b/examples/bbdev_app/main.c @@ -312,6 +312,7 @@ check_port_link_status(uint16_t port_id) #define MAX_CHECK_TIME 90 /* 9s (90 * 100ms) in total */ uint8_t count; struct rte_eth_link link; + int link_get_err = -EINVAL; printf("\nChecking link status."); fflush(stdout); @@ -319,9 +320,9 @@ check_port_link_status(uint16_t port_id) for (count = 0; count <= MAX_CHECK_TIME && !rte_atomic16_read(&global_exit_flag); count++) { memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(port_id, &link); + link_get_err = rte_eth_link_get_nowait(port_id, &link); - if (link.link_status) { + if (link_get_err >= 0 && link.link_status) { const char *dp = (link.link_duplex == ETH_LINK_FULL_DUPLEX) ? "full-duplex" : "half-duplex"; @@ -334,7 +335,12 @@ check_port_link_status(uint16_t port_id) rte_delay_ms(CHECK_INTERVAL); } - printf("\nPort %d Link Down\n", port_id); + if (link_get_err >= 0) + printf("\nPort %d Link Down\n", port_id); + else + printf("\nGet link failed (port %d): %s\n", port_id, + rte_strerror(-link_get_err)); + return 0; } From patchwork Tue Sep 10 08:25:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59069 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 713211EDF2; Tue, 10 Sep 2019 10:26:46 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 90E2D1ECC1 for ; Tue, 10 Sep 2019 10:26: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-us2.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 5196C1C005F; Tue, 10 Sep 2019 08:26: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; Tue, 10 Sep 2019 01:26: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; Tue, 10 Sep 2019 01:26: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 x8A8QHie002295; Tue, 10 Sep 2019 09:26:17 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 134E81613D1; Tue, 10 Sep 2019 09:26:17 +0100 (BST) From: Andrew Rybchenko To: Cristian Dumitrescu CC: , Igor Romanov Date: Tue, 10 Sep 2019 09:25:52 +0100 Message-ID: <1568103959-25572-13-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568103959-25572-1-git-send-email-arybchenko@solarflare.com> References: <1568103959-25572-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-2.951000-4.000000-10 X-TMASE-MatchedRID: b9G8HiAV2WLDOgXZFRFV83CO70QAsBdCWw/S0HB7eoMGmHr1eMxt2UAc 6DyoS2rI2lO9wdJIjwWKGUoOUuWu8kgMxOkBoMP0U9ht8cPjV459LQinZ4QefPcjNeVeWlqY+gt Hj7OwNO2W79Uq8KMo9bcuXXkiU33CCu7i//gJOIHH+0bHvNGr2vsNTmPX05uVNH9TJ0G6KVH4sx hA236J5hnQEgrb3gkrFsMCCABgmQbMQrcaswZ6hNpAu0sLxpSoQ8G+yYJYYdZRZDsGiXQioBjm2 8f1HLY3 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--2.951000-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568103981-LXPHS3eH_v7I Subject: [dpdk-dev] [PATCH 12/18] examples/ip_pipeline: check status of getting link info 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: Igor Romanov The return value of rte_eth_link_get() and rte_eth_link_get_nowait() was changed from void to int. Update the usage of the functions according to the new return type. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- examples/ip_pipeline/cli.c | 9 ++++++++- examples/ip_pipeline/link.c | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c index c6cf4204e..4930310cc 100644 --- a/examples/ip_pipeline/cli.c +++ b/examples/ip_pipeline/cli.c @@ -248,12 +248,19 @@ print_link_info(struct link *link, char *out, size_t out_size) struct rte_ether_addr mac_addr; struct rte_eth_link eth_link; uint16_t mtu; + int ret; memset(&stats, 0, sizeof(stats)); rte_eth_stats_get(link->port_id, &stats); rte_eth_macaddr_get(link->port_id, &mac_addr); - rte_eth_link_get(link->port_id, ð_link); + ret = rte_eth_link_get(link->port_id, ð_link); + if (ret < 0) { + snprintf(out, out_size, "\n%s: link get failed: %s", + link->name, rte_strerror(-ret)); + return; + } + rte_eth_dev_get_mtu(link->port_id, &mtu); snprintf(out, out_size, diff --git a/examples/ip_pipeline/link.c b/examples/ip_pipeline/link.c index 744abf394..16bcffe35 100644 --- a/examples/ip_pipeline/link.c +++ b/examples/ip_pipeline/link.c @@ -264,7 +264,8 @@ link_is_up(const char *name) return 0; /* Resource */ - rte_eth_link_get(link->port_id, &link_params); + if (rte_eth_link_get(link->port_id, &link_params) < 0) + return 0; return (link_params.link_status == ETH_LINK_DOWN) ? 0 : 1; } From patchwork Tue Sep 10 08:25:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59070 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 9305C1EDFF; Tue, 10 Sep 2019 10:26:48 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id E5E701ECD5 for ; Tue, 10 Sep 2019 10:26: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-us2.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id B88841C005F; Tue, 10 Sep 2019 08:26: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; Tue, 10 Sep 2019 01:26: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; Tue, 10 Sep 2019 01:26: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 x8A8QHSe002302; Tue, 10 Sep 2019 09:26:17 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 497331613D1; Tue, 10 Sep 2019 09:26:17 +0100 (BST) From: Andrew Rybchenko To: Marko Kovacevic , Ori Kam , Bruce Richardson , Pablo de Lara , Radu Nicolau , Akhil Goyal , Tomasz Kantecki CC: , Igor Romanov Date: Tue, 10 Sep 2019 09:25:53 +0100 Message-ID: <1568103959-25572-14-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568103959-25572-1-git-send-email-arybchenko@solarflare.com> References: <1568103959-25572-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.083900-4.000000-10 X-TMASE-MatchedRID: lyqyZjZpZifDOgXZFRFV83CO70QAsBdCWw/S0HB7eoNYwVHjLI3nekAc 6DyoS2rI5o/rYvVL+ieAMuqetGVetv1UB9A6pTKC3QfwsVk0UbsIoUKaF27lxUikjr2tkQBV6/5 5SMsjjuw4EV9qAYUhrc6ub46DYFp1NecbHubliOXNfsKYLA825txzf81PLWfUX2dASmx1awooW7 9NkcUzjg9cvEd/Et5dVEc5IqztENReYfSkFq6uAb7jE6+wkCSenqg/VrSZEiM= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--1.083900-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568103982-xmolzglkHxFd Subject: [dpdk-dev] [PATCH 13/18] examples/ethtool: check status of getting link info 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: Igor Romanov The return value of rte_eth_link_get() and rte_eth_link_get_nowait() was changed from void to int. Update the usage of the functions according to the new return type. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- examples/ethtool/lib/rte_ethtool.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c index 43cacc057..8393b0d60 100644 --- a/examples/ethtool/lib/rte_ethtool.c +++ b/examples/ethtool/lib/rte_ethtool.c @@ -124,9 +124,13 @@ int rte_ethtool_get_link(uint16_t port_id) { struct rte_eth_link link; + int ret; RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); - rte_eth_link_get(port_id, &link); + ret = rte_eth_link_get(port_id, &link); + if (ret < 0) + return ret; + return link.link_status; } From patchwork Tue Sep 10 08:25:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59072 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 0B3221EE0F; Tue, 10 Sep 2019 10:26:53 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 578A01ECC1 for ; Tue, 10 Sep 2019 10:26:23 +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-us2.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id E5C311C005F; Tue, 10 Sep 2019 08:26: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; Tue, 10 Sep 2019 01:26:19 -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; Tue, 10 Sep 2019 01:26: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 x8A8QHEx002321; Tue, 10 Sep 2019 09:26:17 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id A1D071613D1; Tue, 10 Sep 2019 09:26:17 +0100 (BST) From: Andrew Rybchenko To: Marko Kovacevic , Ori Kam , Bruce Richardson , Pablo de Lara , Radu Nicolau , Akhil Goyal , Tomasz Kantecki CC: , Igor Romanov Date: Tue, 10 Sep 2019 09:25:54 +0100 Message-ID: <1568103959-25572-15-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568103959-25572-1-git-send-email-arybchenko@solarflare.com> References: <1568103959-25572-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.270300-4.000000-10 X-TMASE-MatchedRID: bPLNq/JhYEHDOgXZFRFV83CO70QAsBdCWw/S0HB7eoPhWjjGhpcHL0Ac 6DyoS2rIxRuqz2yp6brFW4nueYtaI7eDWl+JIEAdSHCU59h5KrFErs9MdsHhEpsoi2XrUn/Jn6K dMrRsL14qtq5d3cxkNWRC/Be9tHFfh2vqiJZqiFeft+yX/OMutV2fq4rjGDsb0w4FzSa9VszsKl lA5QymC4w9EW5Srerqvo7lbCBGMhOZdltLbweK91Lp4hUUe2ehOKBkFAm8GOUPoO5ncI6OuehbQ 2QpmASdyky8P5TYMPI= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--1.270300-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568103982-Vcsny9vrRokX Subject: [dpdk-dev] [PATCH 14/18] examples/flow_filtering: check status of getting link info 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: Igor Romanov The return value of rte_eth_link_get() and rte_eth_link_get_nowait() was changed from void to int. Update the usage of the functions according to the new return type. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko Acked-by: Ori Kam --- examples/flow_filtering/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/main.c index c40cfd098..cc9e7e780 100644 --- a/examples/flow_filtering/main.c +++ b/examples/flow_filtering/main.c @@ -100,15 +100,19 @@ assert_link_status(void) { struct rte_eth_link link; uint8_t rep_cnt = MAX_REPEAT_TIMES; + int link_get_err = -EINVAL; memset(&link, 0, sizeof(link)); do { - rte_eth_link_get(port_id, &link); - if (link.link_status == ETH_LINK_UP) + link_get_err = rte_eth_link_get(port_id, &link); + if (link_get_err == 0 && link.link_status == ETH_LINK_UP) break; rte_delay_ms(CHECK_INTERVAL); } while (--rep_cnt); + if (link_get_err < 0) + rte_exit(EXIT_FAILURE, ":: error: link get is failing: %s\n", + rte_strerror(-link_get_err)); if (link.link_status == ETH_LINK_DOWN) rte_exit(EXIT_FAILURE, ":: error: link is still down\n"); } From patchwork Tue Sep 10 08:25:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59071 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 740C81EE0C; Tue, 10 Sep 2019 10:26:50 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 1EA271ECFA for ; Tue, 10 Sep 2019 10:26:23 +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-us2.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 1D8BE1C005F; Tue, 10 Sep 2019 08:26:22 +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; Tue, 10 Sep 2019 01:26:19 -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; Tue, 10 Sep 2019 01:26:19 -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 x8A8QH3C002332; Tue, 10 Sep 2019 09:26:17 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id E25AD1613D1; Tue, 10 Sep 2019 09:26:17 +0100 (BST) From: Andrew Rybchenko To: Marko Kovacevic , Ori Kam , Bruce Richardson , Pablo de Lara , Radu Nicolau , Akhil Goyal , Tomasz Kantecki CC: , Igor Romanov Date: Tue, 10 Sep 2019 09:25:55 +0100 Message-ID: <1568103959-25572-16-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568103959-25572-1-git-send-email-arybchenko@solarflare.com> References: <1568103959-25572-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-3.408000-4.000000-10 X-TMASE-MatchedRID: cNpd0xYbW9WS3GYeSonf3XCO70QAsBdCWw/S0HB7eoPhWjjGhpcHL0Ac 6DyoS2rIxRuqz2yp6brpKzDH7HsX/GafXnRKKFGWmL8m0JtKLVMatKaG3iywBzP3zxumESVRsuf Gft03o1buEltDekBuBhYzAA53gts/B7pCtz5gCAsshGpBsK6H7n0tCKdnhB589yM15V5aWpj6C0 ePs7A07X8VRCNw0kiDZYbpBT2+uaQmmkDHZT5I8KexEudME0yqwQJaCfTGFYjcQJX2b6qZNLZhk YLuOOwJr9JKhIDfXP6NhEv1n0SvSeN/7oOYFLKs2kC7SwvGlKhDwb7Jglhh1lFkOwaJdCKgviPE qcclEtzAvpLE+mvX8g== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--3.408000-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568103982-Wq2rp3sYHJQA Subject: [dpdk-dev] [PATCH 15/18] examples/link_status_interrupt: check status of getting link 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: Igor Romanov The return value of rte_eth_link_get() and rte_eth_link_get_nowait() was changed from void to int. Update the usage of the functions according to the new return type. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- examples/link_status_interrupt/main.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index d42fef12b..a0b75d9f6 100644 --- a/examples/link_status_interrupt/main.c +++ b/examples/link_status_interrupt/main.c @@ -117,6 +117,7 @@ print_stats(void) const char clr[] = { 27, '[', '2', 'J', '\0' }; const char topLeft[] = { 27, '[', '1', ';', '1', 'H','\0' }; + int link_get_err; /* Clear screen and move to top left */ printf("%s%s", clr, topLeft); @@ -129,7 +130,7 @@ print_stats(void) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + link_get_err = rte_eth_link_get_nowait(portid, &link); printf("\nStatistics for port %u ------------------------------" "\nLink status: %25s" "\nLink speed: %26u" @@ -138,8 +139,11 @@ print_stats(void) "\nPackets received: %20"PRIu64 "\nPackets dropped: %21"PRIu64, portid, + link_get_err < 0 ? "Link get failed" : (link.link_status ? "Link up" : "Link down"), - (unsigned)link.link_speed, + link_get_err < 0 ? 0 : + (unsigned int)link.link_speed, + link_get_err < 0 ? "Link get failed" : (link.link_duplex == ETH_LINK_FULL_DUPLEX ? \ "full-duplex" : "half-duplex"), port_statistics[portid].tx, @@ -438,13 +442,19 @@ lsi_event_callback(uint16_t port_id, enum rte_eth_event_type type, void *param, void *ret_param) { struct rte_eth_link link; + int ret; RTE_SET_USED(param); RTE_SET_USED(ret_param); printf("\n\nIn registered callback...\n"); printf("Event type: %s\n", type == RTE_ETH_EVENT_INTR_LSC ? "LSC interrupt" : "unknown event"); - rte_eth_link_get_nowait(port_id, &link); + ret = rte_eth_link_get_nowait(port_id, &link); + if (ret < 0) { + printf("Failed link get on port %d: %s\n", + port_id, rte_strerror(-ret)); + return ret; + } if (link.link_status) { printf("Port %d Link Up - speed %u Mbps - %s\n\n", port_id, (unsigned)link.link_speed, From patchwork Tue Sep 10 08:25:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59073 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 51A331EE15; Tue, 10 Sep 2019 10:26:55 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 8EF541ECD5 for ; Tue, 10 Sep 2019 10:26:23 +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-us2.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 492291C005F; Tue, 10 Sep 2019 08:26:22 +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; Tue, 10 Sep 2019 01:26:19 -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; Tue, 10 Sep 2019 01:26:19 -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 x8A8QIZx002339; Tue, 10 Sep 2019 09:26:18 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 1CF431613D1; Tue, 10 Sep 2019 09:26:18 +0100 (BST) From: Andrew Rybchenko To: David Hunt CC: , Igor Romanov Date: Tue, 10 Sep 2019 09:25:56 +0100 Message-ID: <1568103959-25572-17-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568103959-25572-1-git-send-email-arybchenko@solarflare.com> References: <1568103959-25572-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.138400-4.000000-10 X-TMASE-MatchedRID: lyqyZjZpZifDOgXZFRFV83CO70QAsBdCWw/S0HB7eoPhWjjGhpcHL0Ac 6DyoS2rIZNUDHbPZ5K3jZDvcQ0T2FR8TzIzimOwPC24oEZ6SpSmb4wHqRpnaDg/qQbWYrUe+/IJ SWJW3WWr4rmPDDfu1DKLFX3skqzIGh6b54TmTRhk9gdVQQEC1Kcny9hUis3fSX8JKL/6hadMbkD c8OcWTVOQDw6tgd3AMZ9iVj/KhX/RSnoQc5vb5zuQdkM7ndBLCN+XOQZygrvY= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--1.138400-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568103982-U3_ugnXw8Crv Subject: [dpdk-dev] [PATCH 16/18] examples/distributor: check status of getting link info 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: Igor Romanov The return value of rte_eth_link_get() and rte_eth_link_get_nowait() was changed from void to int. Update the usage of the functions according to the new return type. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- examples/distributor/main.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/distributor/main.c b/examples/distributor/main.c index 125ee877f..49b4e611f 100644 --- a/examples/distributor/main.c +++ b/examples/distributor/main.c @@ -173,12 +173,18 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) return retval; struct rte_eth_link link; - rte_eth_link_get_nowait(port, &link); - while (!link.link_status) { + do { + retval = rte_eth_link_get_nowait(port, &link); + if (retval < 0) { + printf("Failed link get (port %u): %s\n", + port, rte_strerror(-retval)); + return retval; + } else if (link.link_status) + break; + printf("Waiting for Link up on port %"PRIu16"\n", port); sleep(1); - rte_eth_link_get_nowait(port, &link); - } + } while (!link.link_status); if (!link.link_status) { printf("Link down on port %"PRIu16"\n", port); From patchwork Tue Sep 10 08:25:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59074 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 F41731EE1C; Tue, 10 Sep 2019 10:26:56 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id C19CF1ED01 for ; Tue, 10 Sep 2019 10:26:23 +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-us2.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 72D2C1C005F; Tue, 10 Sep 2019 08:26:22 +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; Tue, 10 Sep 2019 01:26:19 -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; Tue, 10 Sep 2019 01:26:19 -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 x8A8QIOI002342; Tue, 10 Sep 2019 09:26:18 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 4AA2C1613D1; Tue, 10 Sep 2019 09:26:18 +0100 (BST) From: Andrew Rybchenko To: Cristian Dumitrescu , Jasvinder Singh CC: , Igor Romanov Date: Tue, 10 Sep 2019 09:25:57 +0100 Message-ID: <1568103959-25572-18-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568103959-25572-1-git-send-email-arybchenko@solarflare.com> References: <1568103959-25572-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-2.835300-4.000000-10 X-TMASE-MatchedRID: b9G8HiAV2WLDOgXZFRFV83CO70QAsBdCWw/S0HB7eoMHZBaLwEXlKGb6 PphVtfZg5luGXrVipbqvnk7fmgYwv857K+zzVwU2nIGynr5ObIZ9LQinZ4QefPcjNeVeWlqY+gt Hj7OwNO2W79Uq8KMo9Y+jXYg23jZNUdx9VOVmL2xzojB+PF22ZZRDtJQDdNvBjcce2mbV4S26BK jQdymAoVA3iYM+9nxaVF6qC0aCCIcQCrRxRjVv9tpAu0sLxpSoQ8G+yYJYYdZRZDsGiXQioBjm2 8f1HLY3 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--2.835300-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568103983-imHr3Z1LoIgm Subject: [dpdk-dev] [PATCH 17/18] examples/qos_sched: check status of getting link info 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: Igor Romanov The return value of rte_eth_link_get() and rte_eth_link_get_nowait() was changed from void to int. Update the usage of the functions according to the new return type. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- examples/qos_sched/init.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c index dbdbdefea..32e6e1ba2 100644 --- a/examples/qos_sched/init.c +++ b/examples/qos_sched/init.c @@ -154,7 +154,12 @@ app_init_port(uint16_t portid, struct rte_mempool *mp) printf("done: "); /* get link status */ - rte_eth_link_get(portid, &link); + ret = rte_eth_link_get(portid, &link); + if (ret < 0) + rte_exit(EXIT_FAILURE, + "rte_eth_link_get: err=%d, port=%u: %s\n", + ret, portid, rte_strerror(-ret)); + if (link.link_status) { printf(" Link Up - speed %u Mbps - %s\n", (uint32_t) link.link_speed, @@ -295,7 +300,11 @@ app_init_sched_port(uint32_t portid, uint32_t socketid) uint32_t pipe, subport; int err; - rte_eth_link_get(portid, &link); + err = rte_eth_link_get(portid, &link); + if (err < 0) + rte_exit(EXIT_FAILURE, + "rte_eth_link_get: err=%d, port=%u: %s\n", + err, portid, rte_strerror(-err)); port_params.socket = socketid; port_params.rate = (uint64_t) link.link_speed * 1000 * 1000 / 8; From patchwork Tue Sep 10 08:25:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Rybchenko X-Patchwork-Id: 59075 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 88C4E1EE20; Tue, 10 Sep 2019 10:26:58 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id D73281ECFA for ; Tue, 10 Sep 2019 10:26:23 +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-us2.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 9C8FB1C005F; Tue, 10 Sep 2019 08:26:22 +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; Tue, 10 Sep 2019 01:26:19 -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; Tue, 10 Sep 2019 01:26:19 -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 x8A8QIO6002349; Tue, 10 Sep 2019 09:26:18 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 7C87A1613D1; Tue, 10 Sep 2019 09:26:18 +0100 (BST) From: Andrew Rybchenko To: Ferruh Yigit CC: , Igor Romanov Date: Tue, 10 Sep 2019 09:25:58 +0100 Message-ID: <1568103959-25572-19-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1568103959-25572-1-git-send-email-arybchenko@solarflare.com> References: <1568103959-25572-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-2.518500-4.000000-10 X-TMASE-MatchedRID: URRd+XkY8EzDOgXZFRFV83CO70QAsBdCWw/S0HB7eoPhWjjGhpcHL1Me 5Blkpry7rdoLblq9S5oTqqN9z4iBnoHcC7KYYAdE+CjwEqX1p7n+hXFfA0iyR1xOQqP2lG9go8W MkQWv6iXBcIE78YqRWo6HM5rqDwqtG7DXKzx6Syj3BClr8BEJ+nW3O0+dre4ZRCYED5UIujTudc XSLlMrJAWYPyz/Nwwjeex89NWeDfZk1/3y1wsQLMcpHTRN10/1hdeYev6ImzWyrFieOBrhBjzcW rt/fwYrRcB2ZpPnVjJoZ1Aq3A7VZw== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--2.518500-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24898.005 X-MDID: 1568103983-0KcwU5-vD2KE Subject: [dpdk-dev] [PATCH 18/18] examples/kni: check status of getting link info 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: Igor Romanov The return value of rte_eth_link_get() and rte_eth_link_get_nowait() was changed from void to int. Update the usage of the functions according to the new return type. Signed-off-by: Igor Romanov Signed-off-by: Andrew Rybchenko --- examples/kni/main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/kni/main.c b/examples/kni/main.c index 08366a5fa..8eb5b610e 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -739,6 +739,7 @@ monitor_all_ports_link_status(void *arg) struct kni_port_params **p = kni_port_params_array; int prev; (void) arg; + int ret; while (monitor_links) { rte_delay_ms(500); @@ -746,7 +747,13 @@ monitor_all_ports_link_status(void *arg) if ((ports_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + ret = rte_eth_link_get_nowait(portid, &link); + if (ret < 0) { + RTE_LOG(ERR, APP, + "Get link failed (port %u): %s\n", + portid, rte_strerror(-ret)); + continue; + } for (i = 0; i < p[portid]->nb_kni; i++) { prev = rte_kni_update_link(p[portid]->kni[i], link.link_status);