Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/sfxge/common/efx_lic.c
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | |||||
efx_mcdi_fc_license_update_license( | efx_mcdi_fc_license_update_license( | ||||
__in efx_nic_t *enp); | __in efx_nic_t *enp); | ||||
static __checkReturn efx_rc_t | static __checkReturn efx_rc_t | ||||
efx_mcdi_fc_license_get_key_stats( | efx_mcdi_fc_license_get_key_stats( | ||||
__in efx_nic_t *enp, | __in efx_nic_t *enp, | ||||
__out efx_key_stats_t *eksp); | __out efx_key_stats_t *eksp); | ||||
static efx_lic_ops_t __efx_lic_v1_ops = { | static const efx_lic_ops_t __efx_lic_v1_ops = { | ||||
efx_mcdi_fc_license_update_license, /* elo_update_licenses */ | efx_mcdi_fc_license_update_license, /* elo_update_licenses */ | ||||
efx_mcdi_fc_license_get_key_stats, /* elo_get_key_stats */ | efx_mcdi_fc_license_get_key_stats, /* elo_get_key_stats */ | ||||
NULL, /* elo_app_state */ | NULL, /* elo_app_state */ | ||||
NULL, /* elo_get_id */ | NULL, /* elo_get_id */ | ||||
}; | }; | ||||
#endif /* EFSYS_OPT_SIENA */ | #endif /* EFSYS_OPT_SIENA */ | ||||
Show All 9 Lines | efx_mcdi_licensing_get_key_stats( | ||||
__out efx_key_stats_t *eksp); | __out efx_key_stats_t *eksp); | ||||
static __checkReturn efx_rc_t | static __checkReturn efx_rc_t | ||||
efx_mcdi_licensed_app_state( | efx_mcdi_licensed_app_state( | ||||
__in efx_nic_t *enp, | __in efx_nic_t *enp, | ||||
__in uint64_t app_id, | __in uint64_t app_id, | ||||
__out boolean_t *licensedp); | __out boolean_t *licensedp); | ||||
static efx_lic_ops_t __efx_lic_v2_ops = { | static const efx_lic_ops_t __efx_lic_v2_ops = { | ||||
efx_mcdi_licensing_update_licenses, /* elo_update_licenses */ | efx_mcdi_licensing_update_licenses, /* elo_update_licenses */ | ||||
efx_mcdi_licensing_get_key_stats, /* elo_get_key_stats */ | efx_mcdi_licensing_get_key_stats, /* elo_get_key_stats */ | ||||
efx_mcdi_licensed_app_state, /* elo_app_state */ | efx_mcdi_licensed_app_state, /* elo_app_state */ | ||||
NULL, /* elo_get_id */ | NULL, /* elo_get_id */ | ||||
}; | }; | ||||
#endif /* EFSYS_OPT_HUNTINGTON */ | #endif /* EFSYS_OPT_HUNTINGTON */ | ||||
Show All 18 Lines | |||||
efx_mcdi_licensing_v3_get_id( | efx_mcdi_licensing_v3_get_id( | ||||
__in efx_nic_t *enp, | __in efx_nic_t *enp, | ||||
__in size_t buffer_size, | __in size_t buffer_size, | ||||
__out uint32_t *typep, | __out uint32_t *typep, | ||||
__out size_t *lengthp, | __out size_t *lengthp, | ||||
__out_bcount_part_opt(buffer_size, *lengthp) | __out_bcount_part_opt(buffer_size, *lengthp) | ||||
uint8_t *bufferp); | uint8_t *bufferp); | ||||
static efx_lic_ops_t __efx_lic_v3_ops = { | static const efx_lic_ops_t __efx_lic_v3_ops = { | ||||
efx_mcdi_licensing_v3_update_licenses, /* elo_update_licenses */ | efx_mcdi_licensing_v3_update_licenses, /* elo_update_licenses */ | ||||
efx_mcdi_licensing_v3_report_license, /* elo_get_key_stats */ | efx_mcdi_licensing_v3_report_license, /* elo_get_key_stats */ | ||||
efx_mcdi_licensing_v3_app_state, /* elo_app_state */ | efx_mcdi_licensing_v3_app_state, /* elo_app_state */ | ||||
efx_mcdi_licensing_v3_get_id, /* elo_get_id */ | efx_mcdi_licensing_v3_get_id, /* elo_get_id */ | ||||
}; | }; | ||||
#endif /* EFSYS_OPT_MEDFORD */ | #endif /* EFSYS_OPT_MEDFORD */ | ||||
▲ Show 20 Lines • Show All 499 Lines • ▼ Show 20 Lines | |||||
#endif /* EFSYS_OPT_MEDFORD */ | #endif /* EFSYS_OPT_MEDFORD */ | ||||
__checkReturn efx_rc_t | __checkReturn efx_rc_t | ||||
efx_lic_init( | efx_lic_init( | ||||
__in efx_nic_t *enp) | __in efx_nic_t *enp) | ||||
{ | { | ||||
efx_lic_ops_t *elop; | const efx_lic_ops_t *elop; | ||||
efx_rc_t rc; | efx_rc_t rc; | ||||
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); | 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_PROBE); | ||||
EFSYS_ASSERT(!(enp->en_mod_flags & EFX_MOD_LIC)); | EFSYS_ASSERT(!(enp->en_mod_flags & EFX_MOD_LIC)); | ||||
switch (enp->en_family) { | switch (enp->en_family) { | ||||
#if EFSYS_OPT_SIENA | #if EFSYS_OPT_SIENA | ||||
case EFX_FAMILY_SIENA: | case EFX_FAMILY_SIENA: | ||||
elop = (efx_lic_ops_t *)&__efx_lic_v1_ops; | elop = &__efx_lic_v1_ops; | ||||
break; | break; | ||||
#endif /* EFSYS_OPT_SIENA */ | #endif /* EFSYS_OPT_SIENA */ | ||||
#if EFSYS_OPT_HUNTINGTON | #if EFSYS_OPT_HUNTINGTON | ||||
case EFX_FAMILY_HUNTINGTON: | case EFX_FAMILY_HUNTINGTON: | ||||
elop = (efx_lic_ops_t *)&__efx_lic_v2_ops; | elop = &__efx_lic_v2_ops; | ||||
break; | break; | ||||
#endif /* EFSYS_OPT_HUNTINGTON */ | #endif /* EFSYS_OPT_HUNTINGTON */ | ||||
#if EFSYS_OPT_MEDFORD | #if EFSYS_OPT_MEDFORD | ||||
case EFX_FAMILY_MEDFORD: | case EFX_FAMILY_MEDFORD: | ||||
elop = (efx_lic_ops_t *)&__efx_lic_v3_ops; | elop = &__efx_lic_v3_ops; | ||||
break; | break; | ||||
#endif /* EFSYS_OPT_MEDFORD */ | #endif /* EFSYS_OPT_MEDFORD */ | ||||
default: | default: | ||||
EFSYS_ASSERT(0); | EFSYS_ASSERT(0); | ||||
rc = ENOTSUP; | rc = ENOTSUP; | ||||
goto fail1; | goto fail1; | ||||
} | } | ||||
enp->en_elop = elop; | enp->en_elop = elop; | ||||
enp->en_mod_flags |= EFX_MOD_LIC; | enp->en_mod_flags |= EFX_MOD_LIC; | ||||
return (0); | return (0); | ||||
fail1: | fail1: | ||||
EFSYS_PROBE1(fail1, efx_rc_t, rc); | EFSYS_PROBE1(fail1, efx_rc_t, rc); | ||||
return (rc); | return (rc); | ||||
} | } | ||||
void | void | ||||
efx_lic_fini( | efx_lic_fini( | ||||
__in efx_nic_t *enp) | __in efx_nic_t *enp) | ||||
{ | { | ||||
efx_lic_ops_t *elop = enp->en_elop; | const efx_lic_ops_t *elop = enp->en_elop; | ||||
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); | 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_PROBE); | ||||
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC); | EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC); | ||||
enp->en_elop = NULL; | enp->en_elop = NULL; | ||||
enp->en_mod_flags &= ~EFX_MOD_LIC; | enp->en_mod_flags &= ~EFX_MOD_LIC; | ||||
} | } | ||||
__checkReturn efx_rc_t | __checkReturn efx_rc_t | ||||
efx_lic_update_licenses( | efx_lic_update_licenses( | ||||
__in efx_nic_t *enp) | __in efx_nic_t *enp) | ||||
{ | { | ||||
efx_lic_ops_t *elop = enp->en_elop; | const efx_lic_ops_t *elop = enp->en_elop; | ||||
efx_rc_t rc; | efx_rc_t rc; | ||||
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); | EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); | ||||
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC); | EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC); | ||||
if ((rc = elop->elo_update_licenses(enp)) != 0) | if ((rc = elop->elo_update_licenses(enp)) != 0) | ||||
goto fail1; | goto fail1; | ||||
return (0); | return (0); | ||||
fail1: | fail1: | ||||
EFSYS_PROBE1(fail1, efx_rc_t, rc); | EFSYS_PROBE1(fail1, efx_rc_t, rc); | ||||
return (rc); | return (rc); | ||||
} | } | ||||
__checkReturn efx_rc_t | __checkReturn efx_rc_t | ||||
efx_lic_get_key_stats( | efx_lic_get_key_stats( | ||||
__in efx_nic_t *enp, | __in efx_nic_t *enp, | ||||
__out efx_key_stats_t *eksp) | __out efx_key_stats_t *eksp) | ||||
{ | { | ||||
efx_lic_ops_t *elop = enp->en_elop; | const efx_lic_ops_t *elop = enp->en_elop; | ||||
efx_rc_t rc; | efx_rc_t rc; | ||||
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); | EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); | ||||
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC); | EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC); | ||||
if ((rc = elop->elo_get_key_stats(enp, eksp)) != 0) | if ((rc = elop->elo_get_key_stats(enp, eksp)) != 0) | ||||
goto fail1; | goto fail1; | ||||
return (0); | return (0); | ||||
fail1: | fail1: | ||||
EFSYS_PROBE1(fail1, efx_rc_t, rc); | EFSYS_PROBE1(fail1, efx_rc_t, rc); | ||||
return (rc); | return (rc); | ||||
} | } | ||||
__checkReturn efx_rc_t | __checkReturn efx_rc_t | ||||
efx_lic_app_state( | efx_lic_app_state( | ||||
__in efx_nic_t *enp, | __in efx_nic_t *enp, | ||||
__in uint64_t app_id, | __in uint64_t app_id, | ||||
__out boolean_t *licensedp) | __out boolean_t *licensedp) | ||||
{ | { | ||||
efx_lic_ops_t *elop = enp->en_elop; | const efx_lic_ops_t *elop = enp->en_elop; | ||||
efx_rc_t rc; | efx_rc_t rc; | ||||
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); | EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); | ||||
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC); | EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC); | ||||
if (elop->elo_app_state == NULL) { | if (elop->elo_app_state == NULL) { | ||||
rc = ENOTSUP; | rc = ENOTSUP; | ||||
goto fail1; | goto fail1; | ||||
Show All 15 Lines | |||||
efx_lic_get_id( | efx_lic_get_id( | ||||
__in efx_nic_t *enp, | __in efx_nic_t *enp, | ||||
__in size_t buffer_size, | __in size_t buffer_size, | ||||
__out uint32_t *typep, | __out uint32_t *typep, | ||||
__out size_t *lengthp, | __out size_t *lengthp, | ||||
__out_opt uint8_t *bufferp | __out_opt uint8_t *bufferp | ||||
) | ) | ||||
{ | { | ||||
efx_lic_ops_t *elop = enp->en_elop; | const efx_lic_ops_t *elop = enp->en_elop; | ||||
efx_rc_t rc; | efx_rc_t rc; | ||||
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); | EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); | ||||
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC); | EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC); | ||||
if (elop->elo_get_id == NULL) { | if (elop->elo_get_id == NULL) { | ||||
rc = ENOTSUP; | rc = ENOTSUP; | ||||
goto fail1; | goto fail1; | ||||
Show All 17 Lines |