From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 12A5FA0613 for ; Tue, 24 Sep 2019 19:01:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4D8492C57; Tue, 24 Sep 2019 19:01:55 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id E561E2C18 for ; Tue, 24 Sep 2019 19:01:53 +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-us4.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id C7A542800A1; Tue, 24 Sep 2019 17:01:49 +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, 24 Sep 2019 10:01:29 -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, 24 Sep 2019 10:01:28 -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 x8OH1R1Z000663; Tue, 24 Sep 2019 18:01:27 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 811511613D1; Tue, 24 Sep 2019 18:01:27 +0100 (BST) From: Andrew Rybchenko To: Thomas Monjalon , Ferruh Yigit CC: Date: Tue, 24 Sep 2019 18:01:20 +0100 Message-ID: <1569344480-7571-1-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24930.005 X-TM-AS-Result: No-1.417600-4.000000-10 X-TMASE-MatchedRID: hryna86yIqh2m+j+coBLPhIRh9wkXSlFBGvINcfHqhcZwGrh4y4izPo9 bow075aLrdoLblq9S5pfzZ2iPRxeXias4a+bgsTPD3uYMxd01beByxVkfd04JKSIGrjDxszFo8W MkQWv6iXBcIE78YqRWo6HM5rqDwqtaqjq4zfuvc0pcmbh6uxvuguxOI18Mbbf4S/zo9uu5kSipX 1x9i5Uilu4B3RH2LxxR9lUC+Y+ur7tI1bfTjj/h9CdEYmvlBTDhdeYev6ImzWyrFieOBrhBjzcW rt/fwYrRcB2ZpPnVjJuI9MGG9suFpRMZUCEHkRt X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--1.417600-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24930.005 X-MDID: 1569344510-Ku_d5i3ByJgq Subject: [dpdk-dev] [PATCH] ethdev: handle removed device properly on promisc replay 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" Promiscuous mode callback may return error if the device is removed. Use eth_err() helper to check the condition and return appropriate error code. Fixes: dff6d544fb3c ("ethdev: do nothing if promiscuous mode is applied again") Signed-off-by: Andrew Rybchenko --- lib/librte_ethdev/rte_ethdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index d0da3322e..af823607c 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -1401,7 +1401,8 @@ rte_eth_dev_config_restore(struct rte_eth_dev *dev, */ if (rte_eth_promiscuous_get(port_id) == 1 && *dev->dev_ops->promiscuous_enable != NULL) { - ret = (*dev->dev_ops->promiscuous_enable)(dev); + ret = eth_err(port_id, + (*dev->dev_ops->promiscuous_enable)(dev)); if (ret != 0 && ret != -ENOTSUP) { RTE_ETHDEV_LOG(ERR, "Failed to enable promiscuous mode for device (port %u): %s\n", @@ -1410,7 +1411,8 @@ rte_eth_dev_config_restore(struct rte_eth_dev *dev, } } else if (rte_eth_promiscuous_get(port_id) == 0 && *dev->dev_ops->promiscuous_disable != NULL) { - ret = (*dev->dev_ops->promiscuous_disable)(dev); + ret = eth_err(port_id, + (*dev->dev_ops->promiscuous_disable)(dev)); if (ret != 0 && ret != -ENOTSUP) { RTE_ETHDEV_LOG(ERR, "Failed to disable promiscuous mode for device (port %u): %s\n", -- 2.17.1