net/sfc/base: import libefx licensing
Provide API to deal with licenses on SFN7xxx and SFN8xxx family adapters. EFSYS_OPT_LICENSING should be enabled to use it. From Solarflare Communications Inc. Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
This commit is contained in:
parent
354df7eadf
commit
05fce2ce84
@ -2351,6 +2351,151 @@ efx_hash_bytes(
|
||||
__in size_t length,
|
||||
__in uint32_t init);
|
||||
|
||||
#if EFSYS_OPT_LICENSING
|
||||
|
||||
/* LICENSING */
|
||||
|
||||
typedef struct efx_key_stats_s {
|
||||
uint32_t eks_valid;
|
||||
uint32_t eks_invalid;
|
||||
uint32_t eks_blacklisted;
|
||||
uint32_t eks_unverifiable;
|
||||
uint32_t eks_wrong_node;
|
||||
uint32_t eks_licensed_apps_lo;
|
||||
uint32_t eks_licensed_apps_hi;
|
||||
uint32_t eks_licensed_features_lo;
|
||||
uint32_t eks_licensed_features_hi;
|
||||
} efx_key_stats_t;
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_lic_init(
|
||||
__in efx_nic_t *enp);
|
||||
|
||||
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);
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_lic_get_key_stats(
|
||||
__in efx_nic_t *enp,
|
||||
__out efx_key_stats_t *ksp);
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_lic_app_state(
|
||||
__in efx_nic_t *enp,
|
||||
__in uint64_t app_id,
|
||||
__out boolean_t *licensedp);
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_lic_get_id(
|
||||
__in efx_nic_t *enp,
|
||||
__in size_t buffer_size,
|
||||
__out uint32_t *typep,
|
||||
__out size_t *lengthp,
|
||||
__out_opt uint8_t *bufferp);
|
||||
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_lic_find_start(
|
||||
__in efx_nic_t *enp,
|
||||
__in_bcount(buffer_size)
|
||||
caddr_t bufferp,
|
||||
__in size_t buffer_size,
|
||||
__out uint32_t *startp
|
||||
);
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_lic_find_end(
|
||||
__in efx_nic_t *enp,
|
||||
__in_bcount(buffer_size)
|
||||
caddr_t bufferp,
|
||||
__in size_t buffer_size,
|
||||
__in uint32_t offset,
|
||||
__out uint32_t *endp
|
||||
);
|
||||
|
||||
extern __checkReturn __success(return != B_FALSE) boolean_t
|
||||
efx_lic_find_key(
|
||||
__in efx_nic_t *enp,
|
||||
__in_bcount(buffer_size)
|
||||
caddr_t bufferp,
|
||||
__in size_t buffer_size,
|
||||
__in uint32_t offset,
|
||||
__out uint32_t *startp,
|
||||
__out uint32_t *lengthp
|
||||
);
|
||||
|
||||
extern __checkReturn __success(return != B_FALSE) boolean_t
|
||||
efx_lic_validate_key(
|
||||
__in efx_nic_t *enp,
|
||||
__in_bcount(length) caddr_t keyp,
|
||||
__in uint32_t length
|
||||
);
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_lic_read_key(
|
||||
__in efx_nic_t *enp,
|
||||
__in_bcount(buffer_size)
|
||||
caddr_t bufferp,
|
||||
__in size_t buffer_size,
|
||||
__in uint32_t offset,
|
||||
__in uint32_t length,
|
||||
__out_bcount_part(key_max_size, *lengthp)
|
||||
caddr_t keyp,
|
||||
__in size_t key_max_size,
|
||||
__out uint32_t *lengthp
|
||||
);
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_lic_write_key(
|
||||
__in efx_nic_t *enp,
|
||||
__in_bcount(buffer_size)
|
||||
caddr_t bufferp,
|
||||
__in size_t buffer_size,
|
||||
__in uint32_t offset,
|
||||
__in_bcount(length) caddr_t keyp,
|
||||
__in uint32_t length,
|
||||
__out uint32_t *lengthp
|
||||
);
|
||||
|
||||
__checkReturn efx_rc_t
|
||||
efx_lic_delete_key(
|
||||
__in efx_nic_t *enp,
|
||||
__in_bcount(buffer_size)
|
||||
caddr_t bufferp,
|
||||
__in size_t buffer_size,
|
||||
__in uint32_t offset,
|
||||
__in uint32_t length,
|
||||
__in uint32_t end,
|
||||
__out uint32_t *deltap
|
||||
);
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_lic_create_partition(
|
||||
__in efx_nic_t *enp,
|
||||
__in_bcount(buffer_size)
|
||||
caddr_t bufferp,
|
||||
__in size_t buffer_size
|
||||
);
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_lic_finish_partition(
|
||||
__in efx_nic_t *enp,
|
||||
__in_bcount(buffer_size)
|
||||
caddr_t bufferp,
|
||||
__in size_t buffer_size
|
||||
);
|
||||
|
||||
#endif /* EFSYS_OPT_LICENSING */
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -319,6 +319,16 @@
|
||||
# endif
|
||||
#endif /* EFSYS_OPT_BIST */
|
||||
|
||||
#if EFSYS_OPT_LICENSING
|
||||
/* Support MCDI licensing API */
|
||||
# if !EFSYS_OPT_MCDI
|
||||
# error "LICENSING requires MCDI"
|
||||
# endif
|
||||
# if !EFSYS_HAS_UINT64
|
||||
# error "LICENSING requires UINT64"
|
||||
# endif
|
||||
#endif /* EFSYS_OPT_LICENSING */
|
||||
|
||||
#if EFSYS_OPT_ALLOW_UNCONFIGURED_NIC
|
||||
/* Support adapters with missing static config (for factory use only) */
|
||||
# if !EFSYS_OPT_MEDFORD
|
||||
|
@ -569,6 +569,39 @@ efx_mcdi_nvram_test(
|
||||
|
||||
#endif /* EFSYS_OPT_VPD || EFSYS_OPT_NVRAM */
|
||||
|
||||
#if EFSYS_OPT_LICENSING
|
||||
|
||||
typedef struct efx_lic_ops_s {
|
||||
efx_rc_t (*elo_update_licenses)(efx_nic_t *);
|
||||
efx_rc_t (*elo_get_key_stats)(efx_nic_t *, efx_key_stats_t *);
|
||||
efx_rc_t (*elo_app_state)(efx_nic_t *, uint64_t, boolean_t *);
|
||||
efx_rc_t (*elo_get_id)(efx_nic_t *, size_t, uint32_t *,
|
||||
size_t *, uint8_t *);
|
||||
efx_rc_t (*elo_find_start)
|
||||
(efx_nic_t *, caddr_t, size_t, uint32_t *);
|
||||
efx_rc_t (*elo_find_end)(efx_nic_t *, caddr_t, size_t,
|
||||
uint32_t, uint32_t *);
|
||||
boolean_t (*elo_find_key)(efx_nic_t *, caddr_t, size_t,
|
||||
uint32_t, uint32_t *, uint32_t *);
|
||||
boolean_t (*elo_validate_key)(efx_nic_t *,
|
||||
caddr_t, uint32_t);
|
||||
efx_rc_t (*elo_read_key)(efx_nic_t *,
|
||||
caddr_t, size_t, uint32_t, uint32_t,
|
||||
caddr_t, size_t, uint32_t *);
|
||||
efx_rc_t (*elo_write_key)(efx_nic_t *,
|
||||
caddr_t, size_t, uint32_t,
|
||||
caddr_t, uint32_t, uint32_t *);
|
||||
efx_rc_t (*elo_delete_key)(efx_nic_t *,
|
||||
caddr_t, size_t, uint32_t,
|
||||
uint32_t, uint32_t, uint32_t *);
|
||||
efx_rc_t (*elo_create_partition)(efx_nic_t *,
|
||||
caddr_t, size_t);
|
||||
efx_rc_t (*elo_finish_partition)(efx_nic_t *,
|
||||
caddr_t, size_t);
|
||||
} efx_lic_ops_t;
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct efx_drv_cfg_s {
|
||||
uint32_t edc_min_vi_count;
|
||||
uint32_t edc_max_vi_count;
|
||||
@ -618,6 +651,10 @@ struct efx_nic_s {
|
||||
uint32_t en_rss_context;
|
||||
#endif /* EFSYS_OPT_RX_SCALE */
|
||||
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
|
||||
struct {
|
||||
|
1751
drivers/net/sfc/base/efx_lic.c
Normal file
1751
drivers/net/sfc/base/efx_lic.c
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user