Author: arybchik
Date: Sat Jun  4 16:49:58 2016
New Revision: 301379
URL: https://svnweb.freebsd.org/changeset/base/301379

Log:
  MFC r300007
  
  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.

Modified:
  stable/10/sys/dev/sfxge/common/efx.h
  stable/10/sys/dev/sfxge/common/efx_impl.h
  stable/10/sys/dev/sfxge/common/efx_lic.c
  stable/10/sys/dev/sfxge/common/efx_nic.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/sfxge/common/efx.h
==============================================================================
--- stable/10/sys/dev/sfxge/common/efx.h        Sat Jun  4 16:47:39 2016        
(r301378)
+++ stable/10/sys/dev/sfxge/common/efx.h        Sat Jun  4 16:49:58 2016        
(r301379)
@@ -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: stable/10/sys/dev/sfxge/common/efx_impl.h
==============================================================================
--- stable/10/sys/dev/sfxge/common/efx_impl.h   Sat Jun  4 16:47:39 2016        
(r301378)
+++ stable/10/sys/dev/sfxge/common/efx_impl.h   Sat Jun  4 16:49:58 2016        
(r301379)
@@ -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: stable/10/sys/dev/sfxge/common/efx_lic.c
==============================================================================
--- stable/10/sys/dev/sfxge/common/efx_lic.c    Sat Jun  4 16:47:39 2016        
(r301378)
+++ stable/10/sys/dev/sfxge/common/efx_lic.c    Sat Jun  4 16:49:58 2016        
(r301379)
@@ -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: stable/10/sys/dev/sfxge/common/efx_nic.c
==============================================================================
--- stable/10/sys/dev/sfxge/common/efx_nic.c    Sat Jun  4 16:47:39 2016        
(r301378)
+++ stable/10/sys/dev/sfxge/common/efx_nic.c    Sat Jun  4 16:49:58 2016        
(r301379)
@@ -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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to