From owner-svn-src-stable@freebsd.org Sat Jun 4 16:50:00 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C3B1B6ADD9; Sat, 4 Jun 2016 16:50:00 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 540861114; Sat, 4 Jun 2016 16:50:00 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u54GnxNV044160; Sat, 4 Jun 2016 16:49:59 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u54GnxRC044156; Sat, 4 Jun 2016 16:49:59 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201606041649.u54GnxRC044156@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Sat, 4 Jun 2016 16:49:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r301379 - stable/10/sys/dev/sfxge/common X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2016 16:50:00 -0000 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 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;