From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id 240734C9F for ; Mon, 10 Sep 2018 11:33: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-us1.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 76B95780069 for ; Mon, 10 Sep 2018 09:33:52 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 10 Sep 2018 02:33:48 -0700 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Mon, 10 Sep 2018 02:33:48 -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 w8A9XkHR023845; Mon, 10 Sep 2018 10:33:46 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 8E2041626D2; Mon, 10 Sep 2018 10:33:46 +0100 (BST) From: Andrew Rybchenko To: CC: Andy Moreton Date: Mon, 10 Sep 2018 10:33:24 +0100 Message-ID: <1536572016-18134-26-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1536572016-18134-1-git-send-email-arybchenko@solarflare.com> References: <1536572016-18134-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24084.005 X-TM-AS-Result: No-6.959200-4.000000-10 X-TMASE-MatchedRID: 0UUeOgJVC+RdFN0T1voizz+4a4C1bX1BGEfoClqBl86en0qBdy7fjGRV afH3iZmYRB4o3Hb/MDC42Q68Rp7DiW94Ipa1otxoSjc25srXNgj/lBG+uXYJkLw2tvOM+/MnNR3 Cad/nFs1B/6T0eWCz/bR/4ZyrTbfcqH7dGVt6/4kHwuCWPSIIAOWNJG9IamrcHY64nxYpfpU3Aw ihR7/Pv+LzNWBegCW2wgn7iDBesS15zdAzex5xZkqI+9VC4oXsnXNeD6IV797yLZdoo4/aSOJQX iArPmxWFGvu2Ug6EwCUTGVAhB5EbQ== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--6.959200-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24084.005 X-MDID: 1536572033-UKOdFBUIDOT1 Subject: [dpdk-dev] [PATCH 25/37] net/sfc/base: add API to inform libefx of hardware removal 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: , X-List-Received-Date: Mon, 10 Sep 2018 09:33:54 -0000 From: Andy Moreton The efx_nic_hw_unavailable() checks ensure that if the NIC hardware has failed or has been physically removed then libefx will stop further attempts to access the hardware. Add an interface for libefx clients to force unavailability, so the hardware is treated as dead or removed even if still physically present. Signed-off-by: Andy Moreton Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/base/ef10_impl.h | 4 ++++ drivers/net/sfc/base/ef10_nic.c | 12 ++++++++++-- drivers/net/sfc/base/efx.h | 4 ++++ drivers/net/sfc/base/efx_impl.h | 1 + drivers/net/sfc/base/efx_nic.c | 18 ++++++++++++++++-- 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/drivers/net/sfc/base/ef10_impl.h b/drivers/net/sfc/base/ef10_impl.h index 0214a75ef..2819ae6ed 100644 --- a/drivers/net/sfc/base/ef10_impl.h +++ b/drivers/net/sfc/base/ef10_impl.h @@ -194,6 +194,10 @@ extern __checkReturn boolean_t ef10_nic_hw_unavailable( __in efx_nic_t *enp); +extern void +ef10_nic_set_hw_unavailable( + __in efx_nic_t *enp); + #if EFSYS_OPT_DIAG extern __checkReturn efx_rc_t diff --git a/drivers/net/sfc/base/ef10_nic.c b/drivers/net/sfc/base/ef10_nic.c index ff96a7ff2..0a2474f3e 100644 --- a/drivers/net/sfc/base/ef10_nic.c +++ b/drivers/net/sfc/base/ef10_nic.c @@ -2320,12 +2320,20 @@ ef10_nic_hw_unavailable( return (B_FALSE); unavail: - EFSYS_PROBE(hw_unavail); - enp->en_reset_flags |= EFX_RESET_HW_UNAVAIL; + ef10_nic_set_hw_unavailable(enp); return (B_TRUE); } + void +ef10_nic_set_hw_unavailable( + __in efx_nic_t *enp) +{ + EFSYS_PROBE(hw_unavail); + enp->en_reset_flags |= EFX_RESET_HW_UNAVAIL; +} + + void ef10_nic_fini( __in efx_nic_t *enp) diff --git a/drivers/net/sfc/base/efx.h b/drivers/net/sfc/base/efx.h index fce519037..0982a34d6 100644 --- a/drivers/net/sfc/base/efx.h +++ b/drivers/net/sfc/base/efx.h @@ -159,6 +159,10 @@ extern __checkReturn boolean_t efx_nic_hw_unavailable( __in efx_nic_t *enp); +extern void +efx_nic_set_hw_unavailable( + __in efx_nic_t *enp); + #if EFSYS_OPT_DIAG extern __checkReturn efx_rc_t diff --git a/drivers/net/sfc/base/efx_impl.h b/drivers/net/sfc/base/efx_impl.h index 8a7dc8cf6..2c95571b1 100644 --- a/drivers/net/sfc/base/efx_impl.h +++ b/drivers/net/sfc/base/efx_impl.h @@ -358,6 +358,7 @@ typedef struct efx_nic_ops_s { efx_rc_t (*eno_get_bar_region)(efx_nic_t *, efx_nic_region_t, uint32_t *, size_t *); boolean_t (*eno_hw_unavailable)(efx_nic_t *); + void (*eno_set_hw_unavailable)(efx_nic_t *); #if EFSYS_OPT_DIAG efx_rc_t (*eno_register_test)(efx_nic_t *); #endif /* EFSYS_OPT_DIAG */ diff --git a/drivers/net/sfc/base/efx_nic.c b/drivers/net/sfc/base/efx_nic.c index 22e464a4e..e5cb0105f 100644 --- a/drivers/net/sfc/base/efx_nic.c +++ b/drivers/net/sfc/base/efx_nic.c @@ -101,6 +101,7 @@ static const efx_nic_ops_t __efx_nic_siena_ops = { NULL, /* eno_get_vi_pool */ NULL, /* eno_get_bar_region */ NULL, /* eno_hw_unavailable */ + NULL, /* eno_set_hw_unavailable */ #if EFSYS_OPT_DIAG siena_nic_register_test, /* eno_register_test */ #endif /* EFSYS_OPT_DIAG */ @@ -121,6 +122,7 @@ static const efx_nic_ops_t __efx_nic_hunt_ops = { ef10_nic_get_vi_pool, /* eno_get_vi_pool */ ef10_nic_get_bar_region, /* eno_get_bar_region */ ef10_nic_hw_unavailable, /* eno_hw_unavailable */ + ef10_nic_set_hw_unavailable, /* eno_set_hw_unavailable */ #if EFSYS_OPT_DIAG ef10_nic_register_test, /* eno_register_test */ #endif /* EFSYS_OPT_DIAG */ @@ -141,6 +143,7 @@ static const efx_nic_ops_t __efx_nic_medford_ops = { ef10_nic_get_vi_pool, /* eno_get_vi_pool */ ef10_nic_get_bar_region, /* eno_get_bar_region */ ef10_nic_hw_unavailable, /* eno_hw_unavailable */ + ef10_nic_set_hw_unavailable, /* eno_set_hw_unavailable */ #if EFSYS_OPT_DIAG ef10_nic_register_test, /* eno_register_test */ #endif /* EFSYS_OPT_DIAG */ @@ -161,6 +164,7 @@ static const efx_nic_ops_t __efx_nic_medford2_ops = { ef10_nic_get_vi_pool, /* eno_get_vi_pool */ ef10_nic_get_bar_region, /* eno_get_bar_region */ ef10_nic_hw_unavailable, /* eno_hw_unavailable */ + ef10_nic_set_hw_unavailable, /* eno_set_hw_unavailable */ #if EFSYS_OPT_DIAG ef10_nic_register_test, /* eno_register_test */ #endif /* EFSYS_OPT_DIAG */ @@ -673,11 +677,21 @@ efx_nic_hw_unavailable( return (B_FALSE); unavail: - EFSYS_PROBE(hw_unavail); - return (B_TRUE); } + void +efx_nic_set_hw_unavailable( + __in efx_nic_t *enp) +{ + const efx_nic_ops_t *enop = enp->en_enop; + + EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); + + if (enop->eno_set_hw_unavailable != NULL) + enop->eno_set_hw_unavailable(enp); +} + #if EFSYS_OPT_DIAG -- 2.17.1