Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 May 2016 06:23:50 +0000 (UTC)
From:      Andrew Rybchenko <arybchik@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r300007 - head/sys/dev/sfxge/common
Message-ID:  <201605170623.u4H6NoBo015780@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: arybchik
Date: Tue May 17 06:23:50 2016
New Revision: 300007
URL: https://svnweb.freebsd.org/changeset/base/300007

Log:
  sfxge(4): store licensing state in efx_lic
  
  Check licensing support at NIC startup to avoid multiple checks later.
  As state is stored, licensing initialisation is moved later in start
  procedure.
  
  Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:      1 week
  Differential Revision:  https://reviews.freebsd.org/D6385

Modified:
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_impl.h
  head/sys/dev/sfxge/common/efx_lic.c
  head/sys/dev/sfxge/common/efx_nic.c

Modified: head/sys/dev/sfxge/common/efx.h
==============================================================================
--- head/sys/dev/sfxge/common/efx.h	Tue May 17 06:04:33 2016	(r300006)
+++ head/sys/dev/sfxge/common/efx.h	Tue May 17 06:23:50 2016	(r300007)
@@ -2314,6 +2314,10 @@ extern				void
 efx_lic_fini(
 	__in			efx_nic_t *enp);
 
+extern	__checkReturn	boolean_t
+efx_lic_check_support(
+	__in			efx_nic_t *enp);
+
 extern	__checkReturn	efx_rc_t
 efx_lic_update_licenses(
 	__in		efx_nic_t *enp);

Modified: head/sys/dev/sfxge/common/efx_impl.h
==============================================================================
--- head/sys/dev/sfxge/common/efx_impl.h	Tue May 17 06:04:33 2016	(r300006)
+++ head/sys/dev/sfxge/common/efx_impl.h	Tue May 17 06:23:50 2016	(r300007)
@@ -636,6 +636,7 @@ struct efx_nic_s {
 	uint32_t		en_vport_id;
 #if EFSYS_OPT_LICENSING
 	const efx_lic_ops_t	*en_elop;
+	boolean_t		en_licensing_supported;
 #endif
 	union {
 #if EFSYS_OPT_SIENA

Modified: head/sys/dev/sfxge/common/efx_lic.c
==============================================================================
--- head/sys/dev/sfxge/common/efx_lic.c	Tue May 17 06:04:33 2016	(r300006)
+++ head/sys/dev/sfxge/common/efx_lic.c	Tue May 17 06:23:50 2016	(r300007)
@@ -1330,6 +1330,7 @@ efx_lic_init(
 	__in			efx_nic_t *enp)
 {
 	const efx_lic_ops_t *elop;
+	efx_key_stats_t eks;
 	efx_rc_t rc;
 
 	EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -1365,6 +1366,13 @@ efx_lic_init(
 	enp->en_elop = elop;
 	enp->en_mod_flags |= EFX_MOD_LIC;
 
+	/* Probe for support */
+	if (efx_lic_get_key_stats(enp, &eks) == 0) {
+		enp->en_licensing_supported = B_TRUE;
+	} else {
+		enp->en_licensing_supported = B_FALSE;
+	}
+
 	return (0);
 
 fail1:
@@ -1373,6 +1381,17 @@ fail1:
 	return (rc);
 }
 
+extern	__checkReturn	boolean_t
+efx_lic_check_support(
+	__in			efx_nic_t *enp)
+{
+	EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
+	EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
+	EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC);
+
+	return enp->en_licensing_supported;
+}
+
 				void
 efx_lic_fini(
 	__in			efx_nic_t *enp)

Modified: head/sys/dev/sfxge/common/efx_nic.c
==============================================================================
--- head/sys/dev/sfxge/common/efx_nic.c	Tue May 17 06:04:33 2016	(r300006)
+++ head/sys/dev/sfxge/common/efx_nic.c	Tue May 17 06:23:50 2016	(r300007)
@@ -580,7 +580,7 @@ efx_nic_reset(
 	EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
 	EFSYS_ASSERT(enp->en_mod_flags & EFX_MOD_PROBE);
 	/*
-	 * All modules except the MCDI, PROBE, NVRAM, VPD, MON, LIC
+	 * All modules except the MCDI, PROBE, NVRAM, VPD, MON
 	 * (which we do not reset here) must have been shut down or never
 	 * initialized.
 	 *
@@ -590,7 +590,7 @@ efx_nic_reset(
 	 */
 	mod_flags = enp->en_mod_flags;
 	mod_flags &= ~(EFX_MOD_MCDI | EFX_MOD_PROBE | EFX_MOD_NVRAM |
-		    EFX_MOD_VPD | EFX_MOD_MON | EFX_MOD_LIC);
+		    EFX_MOD_VPD | EFX_MOD_MON);
 	EFSYS_ASSERT3U(mod_flags, ==, 0);
 	if (mod_flags != 0) {
 		rc = EINVAL;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605170623.u4H6NoBo015780>