sfxge(4): restructure efx_lic to support V3 licensing

Create separate implementations of the efx_lic API for each revision of
the licensing system. All processing of the V1/V2 license partition is
moved to efx_lic, and an implementation of V3 licensing uses the existing
TLV functions with extensions for writing new TLV entries.

Submitted by:   Richard Houldsworth <rhouldsworth at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D6364
This commit is contained in:
arybchik 2016-05-16 06:17:56 +00:00
parent 926e08a0de
commit 4c428ea97e
3 changed files with 1065 additions and 1 deletions

View File

@ -2311,6 +2311,97 @@ efx_lic_get_id(
__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 */

View File

@ -568,6 +568,27 @@ typedef struct efx_lic_ops_s {
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

File diff suppressed because it is too large Load Diff