aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/sfxge
diff options
context:
space:
mode:
authorAndrew Rybchenko <arybchik@FreeBSD.org>2018-11-30 07:06:01 +0000
committerAndrew Rybchenko <arybchik@FreeBSD.org>2018-11-30 07:06:01 +0000
commitb2053d80255fccf7a4be3a1184f6832af2b7f199 (patch)
treeefea2180c01624f6c0239153d8999b20f9afbf2e /sys/dev/sfxge
parentc6d5e85dbe9d3b4bacffef4b8107b1cf82555c04 (diff)
downloadsrc-b2053d80255fccf7a4be3a1184f6832af2b7f199.tar.gz
src-b2053d80255fccf7a4be3a1184f6832af2b7f199.zip
sfxge(4): add API to inform libefx of hardware removal
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. Submitted by: Andy Moreton <amoreton at solarflare.com> Sponsored by: Solarflare Communications, Inc. Differential Revision: https://reviews.freebsd.org/D18261
Notes
Notes: svn path=/head/; revision=341299
Diffstat (limited to 'sys/dev/sfxge')
-rw-r--r--sys/dev/sfxge/common/ef10_impl.h4
-rw-r--r--sys/dev/sfxge/common/ef10_nic.c12
-rw-r--r--sys/dev/sfxge/common/efx.h4
-rw-r--r--sys/dev/sfxge/common/efx_impl.h1
-rw-r--r--sys/dev/sfxge/common/efx_nic.c18
5 files changed, 35 insertions, 4 deletions
diff --git a/sys/dev/sfxge/common/ef10_impl.h b/sys/dev/sfxge/common/ef10_impl.h
index cd7142483ea5..794cae183572 100644
--- a/sys/dev/sfxge/common/ef10_impl.h
+++ b/sys/dev/sfxge/common/ef10_impl.h
@@ -220,6 +220,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/sys/dev/sfxge/common/ef10_nic.c b/sys/dev/sfxge/common/ef10_nic.c
index ae134a50901f..28d27a8a3428 100644
--- a/sys/dev/sfxge/common/ef10_nic.c
+++ b/sys/dev/sfxge/common/ef10_nic.c
@@ -2347,13 +2347,21 @@ 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/sys/dev/sfxge/common/efx.h b/sys/dev/sfxge/common/efx.h
index 57189e944d68..710d7d2d52c7 100644
--- a/sys/dev/sfxge/common/efx.h
+++ b/sys/dev/sfxge/common/efx.h
@@ -187,6 +187,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/sys/dev/sfxge/common/efx_impl.h b/sys/dev/sfxge/common/efx_impl.h
index 973914b218b4..e1f9a288134d 100644
--- a/sys/dev/sfxge/common/efx_impl.h
+++ b/sys/dev/sfxge/common/efx_impl.h
@@ -386,6 +386,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/sys/dev/sfxge/common/efx_nic.c b/sys/dev/sfxge/common/efx_nic.c
index abb164a9214d..906bd2169b52 100644
--- a/sys/dev/sfxge/common/efx_nic.c
+++ b/sys/dev/sfxge/common/efx_nic.c
@@ -130,6 +130,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 */
@@ -150,6 +151,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 */
@@ -170,6 +172,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 */
@@ -190,6 +193,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 */
@@ -702,11 +706,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