sfxge(4): fix out of bounds read when dereferencing sdup
Introduce and use macro to make sure that MCDI buffers allocated on stack are rounded up properly. Submitted by: Gautam Dawar <gdawar at solarflare.com> Sponsored by: Solarflare Communications, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D18259
This commit is contained in:
parent
57e163eaeb
commit
b9a30ab024
@ -100,11 +100,10 @@ efx_mcdi_set_evq_tmr(
|
||||
__in uint32_t timer_ns)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_SET_EVQ_TMR_IN_LEN,
|
||||
MC_CMD_SET_EVQ_TMR_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_SET_EVQ_TMR_IN_LEN,
|
||||
MC_CMD_SET_EVQ_TMR_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_SET_EVQ_TMR;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_SET_EVQ_TMR_IN_LEN;
|
||||
@ -150,9 +149,9 @@ efx_mcdi_init_evq(
|
||||
__in boolean_t low_latency)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[
|
||||
MAX(MC_CMD_INIT_EVQ_IN_LEN(EFX_EVQ_NBUFS(EFX_EVQ_MAXNEVS)),
|
||||
MC_CMD_INIT_EVQ_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload,
|
||||
MC_CMD_INIT_EVQ_IN_LEN(EFX_EVQ_NBUFS(EFX_EVQ_MAXNEVS)),
|
||||
MC_CMD_INIT_EVQ_OUT_LEN);
|
||||
efx_qword_t *dma_addr;
|
||||
uint64_t addr;
|
||||
int npages;
|
||||
@ -167,7 +166,6 @@ efx_mcdi_init_evq(
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_INIT_EVQ;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_INIT_EVQ_IN_LEN(npages);
|
||||
@ -287,9 +285,9 @@ efx_mcdi_init_evq_v2(
|
||||
__in uint32_t flags)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[
|
||||
MAX(MC_CMD_INIT_EVQ_V2_IN_LEN(EFX_EVQ_NBUFS(EFX_EVQ_MAXNEVS)),
|
||||
MC_CMD_INIT_EVQ_V2_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload,
|
||||
MC_CMD_INIT_EVQ_V2_IN_LEN(EFX_EVQ_NBUFS(EFX_EVQ_MAXNEVS)),
|
||||
MC_CMD_INIT_EVQ_V2_OUT_LEN);
|
||||
boolean_t interrupting;
|
||||
unsigned int evq_type;
|
||||
efx_qword_t *dma_addr;
|
||||
@ -304,7 +302,6 @@ efx_mcdi_init_evq_v2(
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_INIT_EVQ;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_INIT_EVQ_V2_IN_LEN(npages);
|
||||
@ -411,11 +408,10 @@ efx_mcdi_fini_evq(
|
||||
__in uint32_t instance)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_FINI_EVQ_IN_LEN,
|
||||
MC_CMD_FINI_EVQ_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_FINI_EVQ_IN_LEN,
|
||||
MC_CMD_FINI_EVQ_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_FINI_EVQ;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_FINI_EVQ_IN_LEN;
|
||||
@ -630,8 +626,8 @@ efx_mcdi_driver_event(
|
||||
__in efx_qword_t data)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_DRIVER_EVENT_IN_LEN,
|
||||
MC_CMD_DRIVER_EVENT_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_DRIVER_EVENT_IN_LEN,
|
||||
MC_CMD_DRIVER_EVENT_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
req.emr_cmd = MC_CMD_DRIVER_EVENT;
|
||||
|
@ -199,12 +199,11 @@ efx_mcdi_filter_op_add(
|
||||
__inout ef10_filter_handle_t *handle)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_FILTER_OP_V3_IN_LEN,
|
||||
MC_CMD_FILTER_OP_EXT_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_FILTER_OP_V3_IN_LEN,
|
||||
MC_CMD_FILTER_OP_EXT_OUT_LEN);
|
||||
efx_filter_match_flags_t match_flags;
|
||||
efx_rc_t rc;
|
||||
|
||||
memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_FILTER_OP;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_FILTER_OP_V3_IN_LEN;
|
||||
@ -403,11 +402,10 @@ efx_mcdi_filter_op_delete(
|
||||
__inout ef10_filter_handle_t *handle)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_FILTER_OP_EXT_IN_LEN,
|
||||
MC_CMD_FILTER_OP_EXT_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_FILTER_OP_EXT_IN_LEN,
|
||||
MC_CMD_FILTER_OP_EXT_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_FILTER_OP;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_FILTER_OP_EXT_IN_LEN;
|
||||
@ -977,13 +975,12 @@ efx_mcdi_get_parser_disp_info(
|
||||
__out size_t *list_lengthp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_PARSER_DISP_INFO_IN_LEN,
|
||||
MC_CMD_GET_PARSER_DISP_INFO_OUT_LENMAX)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_PARSER_DISP_INFO_IN_LEN,
|
||||
MC_CMD_GET_PARSER_DISP_INFO_OUT_LENMAX);
|
||||
size_t matches_count;
|
||||
size_t list_size;
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_PARSER_DISP_INFO;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_PARSER_DISP_INFO_IN_LEN;
|
||||
|
@ -78,8 +78,8 @@ efx_mcdi_trigger_interrupt(
|
||||
__in unsigned int level)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_TRIGGER_INTERRUPT_IN_LEN,
|
||||
MC_CMD_TRIGGER_INTERRUPT_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_TRIGGER_INTERRUPT_IN_LEN,
|
||||
MC_CMD_TRIGGER_INTERRUPT_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
|
||||
@ -91,7 +91,6 @@ efx_mcdi_trigger_interrupt(
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_TRIGGER_INTERRUPT;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_TRIGGER_INTERRUPT_IN_LEN;
|
||||
|
@ -102,11 +102,10 @@ efx_mcdi_vadapter_set_mac(
|
||||
{
|
||||
efx_port_t *epp = &(enp->en_port);
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_VADAPTOR_SET_MAC_IN_LEN,
|
||||
MC_CMD_VADAPTOR_SET_MAC_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_VADAPTOR_SET_MAC_IN_LEN,
|
||||
MC_CMD_VADAPTOR_SET_MAC_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_VADAPTOR_SET_MAC;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_VADAPTOR_SET_MAC_IN_LEN;
|
||||
@ -168,11 +167,10 @@ efx_mcdi_mtu_set(
|
||||
__in uint32_t mtu)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_SET_MAC_EXT_IN_LEN,
|
||||
MC_CMD_SET_MAC_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_SET_MAC_EXT_IN_LEN,
|
||||
MC_CMD_SET_MAC_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_SET_MAC;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_SET_MAC_EXT_IN_LEN;
|
||||
@ -205,11 +203,10 @@ efx_mcdi_mtu_get(
|
||||
__out size_t *mtu)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_SET_MAC_EXT_IN_LEN,
|
||||
MC_CMD_SET_MAC_V2_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_SET_MAC_EXT_IN_LEN,
|
||||
MC_CMD_SET_MAC_V2_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_SET_MAC;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_SET_MAC_EXT_IN_LEN;
|
||||
@ -301,11 +298,10 @@ ef10_mac_reconfigure(
|
||||
{
|
||||
efx_port_t *epp = &(enp->en_port);
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_SET_MAC_IN_LEN,
|
||||
MC_CMD_SET_MAC_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_SET_MAC_IN_LEN,
|
||||
MC_CMD_SET_MAC_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_SET_MAC;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_SET_MAC_IN_LEN;
|
||||
|
@ -47,15 +47,14 @@ efx_mcdi_get_port_assignment(
|
||||
__out uint32_t *portp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_PORT_ASSIGNMENT_IN_LEN,
|
||||
MC_CMD_GET_PORT_ASSIGNMENT_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_PORT_ASSIGNMENT_IN_LEN,
|
||||
MC_CMD_GET_PORT_ASSIGNMENT_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
|
||||
enp->en_family == EFX_FAMILY_MEDFORD ||
|
||||
enp->en_family == EFX_FAMILY_MEDFORD2);
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_PORT_ASSIGNMENT;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_PORT_ASSIGNMENT_IN_LEN;
|
||||
@ -94,15 +93,14 @@ efx_mcdi_get_port_modes(
|
||||
__out_opt uint32_t *default_modep)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_PORT_MODES_IN_LEN,
|
||||
MC_CMD_GET_PORT_MODES_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_PORT_MODES_IN_LEN,
|
||||
MC_CMD_GET_PORT_MODES_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
|
||||
enp->en_family == EFX_FAMILY_MEDFORD ||
|
||||
enp->en_family == EFX_FAMILY_MEDFORD2);
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_PORT_MODES;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_PORT_MODES_IN_LEN;
|
||||
@ -207,13 +205,12 @@ efx_mcdi_vadaptor_alloc(
|
||||
__in uint32_t port_id)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_VADAPTOR_ALLOC_IN_LEN,
|
||||
MC_CMD_VADAPTOR_ALLOC_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_VADAPTOR_ALLOC_IN_LEN,
|
||||
MC_CMD_VADAPTOR_ALLOC_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
EFSYS_ASSERT3U(enp->en_vport_id, ==, EVB_PORT_ID_NULL);
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_VADAPTOR_ALLOC;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_VADAPTOR_ALLOC_IN_LEN;
|
||||
@ -246,11 +243,10 @@ efx_mcdi_vadaptor_free(
|
||||
__in uint32_t port_id)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_VADAPTOR_FREE_IN_LEN,
|
||||
MC_CMD_VADAPTOR_FREE_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_VADAPTOR_FREE_IN_LEN,
|
||||
MC_CMD_VADAPTOR_FREE_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_VADAPTOR_FREE;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_VADAPTOR_FREE_IN_LEN;
|
||||
@ -280,15 +276,14 @@ efx_mcdi_get_mac_address_pf(
|
||||
__out_ecount_opt(6) uint8_t mac_addrp[6])
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_MAC_ADDRESSES_IN_LEN,
|
||||
MC_CMD_GET_MAC_ADDRESSES_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_MAC_ADDRESSES_IN_LEN,
|
||||
MC_CMD_GET_MAC_ADDRESSES_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
|
||||
enp->en_family == EFX_FAMILY_MEDFORD ||
|
||||
enp->en_family == EFX_FAMILY_MEDFORD2);
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_MAC_ADDRESSES;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_MAC_ADDRESSES_IN_LEN;
|
||||
@ -339,15 +334,14 @@ efx_mcdi_get_mac_address_vf(
|
||||
__out_ecount_opt(6) uint8_t mac_addrp[6])
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_VPORT_GET_MAC_ADDRESSES_IN_LEN,
|
||||
MC_CMD_VPORT_GET_MAC_ADDRESSES_OUT_LENMAX)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_VPORT_GET_MAC_ADDRESSES_IN_LEN,
|
||||
MC_CMD_VPORT_GET_MAC_ADDRESSES_OUT_LENMAX);
|
||||
efx_rc_t rc;
|
||||
|
||||
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
|
||||
enp->en_family == EFX_FAMILY_MEDFORD ||
|
||||
enp->en_family == EFX_FAMILY_MEDFORD2);
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_VPORT_GET_MAC_ADDRESSES;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_VPORT_GET_MAC_ADDRESSES_IN_LEN;
|
||||
@ -404,15 +398,14 @@ efx_mcdi_get_clock(
|
||||
__out uint32_t *dpcpu_freqp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_CLOCK_IN_LEN,
|
||||
MC_CMD_GET_CLOCK_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_CLOCK_IN_LEN,
|
||||
MC_CMD_GET_CLOCK_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
|
||||
enp->en_family == EFX_FAMILY_MEDFORD ||
|
||||
enp->en_family == EFX_FAMILY_MEDFORD2);
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_CLOCK;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_CLOCK_IN_LEN;
|
||||
@ -462,12 +455,11 @@ efx_mcdi_get_rxdp_config(
|
||||
__out uint32_t *end_paddingp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_RXDP_CONFIG_IN_LEN,
|
||||
MC_CMD_GET_RXDP_CONFIG_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_RXDP_CONFIG_IN_LEN,
|
||||
MC_CMD_GET_RXDP_CONFIG_OUT_LEN);
|
||||
uint32_t end_padding;
|
||||
efx_rc_t rc;
|
||||
|
||||
memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_RXDP_CONFIG;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_RXDP_CONFIG_IN_LEN;
|
||||
@ -522,11 +514,10 @@ efx_mcdi_get_vector_cfg(
|
||||
__out_opt uint32_t *vf_nvecp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_VECTOR_CFG_IN_LEN,
|
||||
MC_CMD_GET_VECTOR_CFG_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_VECTOR_CFG_IN_LEN,
|
||||
MC_CMD_GET_VECTOR_CFG_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_VECTOR_CFG;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_VECTOR_CFG_IN_LEN;
|
||||
@ -572,8 +563,8 @@ efx_mcdi_alloc_vis(
|
||||
__out uint32_t *vi_shiftp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_ALLOC_VIS_IN_LEN,
|
||||
MC_CMD_ALLOC_VIS_EXT_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_ALLOC_VIS_IN_LEN,
|
||||
MC_CMD_ALLOC_VIS_EXT_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
if (vi_countp == NULL) {
|
||||
@ -581,7 +572,6 @@ efx_mcdi_alloc_vis(
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_ALLOC_VIS;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_ALLOC_VIS_IN_LEN;
|
||||
@ -664,8 +654,8 @@ efx_mcdi_alloc_piobuf(
|
||||
__out efx_piobuf_handle_t *handlep)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_ALLOC_PIOBUF_IN_LEN,
|
||||
MC_CMD_ALLOC_PIOBUF_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_ALLOC_PIOBUF_IN_LEN,
|
||||
MC_CMD_ALLOC_PIOBUF_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
if (handlep == NULL) {
|
||||
@ -673,7 +663,6 @@ efx_mcdi_alloc_piobuf(
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_ALLOC_PIOBUF;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_ALLOC_PIOBUF_IN_LEN;
|
||||
@ -712,11 +701,10 @@ efx_mcdi_free_piobuf(
|
||||
__in efx_piobuf_handle_t handle)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_FREE_PIOBUF_IN_LEN,
|
||||
MC_CMD_FREE_PIOBUF_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_FREE_PIOBUF_IN_LEN,
|
||||
MC_CMD_FREE_PIOBUF_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_FREE_PIOBUF;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_FREE_PIOBUF_IN_LEN;
|
||||
@ -747,11 +735,10 @@ efx_mcdi_link_piobuf(
|
||||
__in efx_piobuf_handle_t handle)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_LINK_PIOBUF_IN_LEN,
|
||||
MC_CMD_LINK_PIOBUF_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_LINK_PIOBUF_IN_LEN,
|
||||
MC_CMD_LINK_PIOBUF_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_LINK_PIOBUF;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_LINK_PIOBUF_IN_LEN;
|
||||
@ -782,11 +769,10 @@ efx_mcdi_unlink_piobuf(
|
||||
__in uint32_t vi_index)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_UNLINK_PIOBUF_IN_LEN,
|
||||
MC_CMD_UNLINK_PIOBUF_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_UNLINK_PIOBUF_IN_LEN,
|
||||
MC_CMD_UNLINK_PIOBUF_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_UNLINK_PIOBUF;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_UNLINK_PIOBUF_IN_LEN;
|
||||
@ -984,11 +970,10 @@ ef10_mcdi_get_pf_count(
|
||||
__out uint32_t *pf_countp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_PF_COUNT_IN_LEN,
|
||||
MC_CMD_GET_PF_COUNT_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_PF_COUNT_IN_LEN,
|
||||
MC_CMD_GET_PF_COUNT_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_PF_COUNT;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_PF_COUNT_IN_LEN;
|
||||
@ -1028,15 +1013,14 @@ ef10_get_datapath_caps(
|
||||
{
|
||||
efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_CAPABILITIES_IN_LEN,
|
||||
MC_CMD_GET_CAPABILITIES_V5_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_CAPABILITIES_IN_LEN,
|
||||
MC_CMD_GET_CAPABILITIES_V5_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
if ((rc = ef10_mcdi_get_pf_count(enp, &encp->enc_hw_pf_count)) != 0)
|
||||
goto fail1;
|
||||
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_CAPABILITIES;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_CAPABILITIES_IN_LEN;
|
||||
@ -2073,8 +2057,8 @@ ef10_nic_reset(
|
||||
__in efx_nic_t *enp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_ENTITY_RESET_IN_LEN,
|
||||
MC_CMD_ENTITY_RESET_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_ENTITY_RESET_IN_LEN,
|
||||
MC_CMD_ENTITY_RESET_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
/* ef10_nic_reset() is called to recover from BADASSERT failures. */
|
||||
@ -2083,7 +2067,6 @@ ef10_nic_reset(
|
||||
if ((rc = efx_mcdi_exit_assertion_handler(enp)) != 0)
|
||||
goto fail2;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_ENTITY_RESET;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_ENTITY_RESET_IN_LEN;
|
||||
@ -2420,11 +2403,10 @@ efx_mcdi_get_nic_global(
|
||||
__out uint32_t *valuep)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_NIC_GLOBAL_IN_LEN,
|
||||
MC_CMD_GET_NIC_GLOBAL_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_NIC_GLOBAL_IN_LEN,
|
||||
MC_CMD_GET_NIC_GLOBAL_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_NIC_GLOBAL;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_NIC_GLOBAL_IN_LEN;
|
||||
@ -2464,10 +2446,9 @@ efx_mcdi_set_nic_global(
|
||||
__in uint32_t value)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MC_CMD_SET_NIC_GLOBAL_IN_LEN];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_SET_NIC_GLOBAL_IN_LEN, 0);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_SET_NIC_GLOBAL;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_SET_NIC_GLOBAL_IN_LEN;
|
||||
|
@ -269,11 +269,10 @@ ef10_phy_get_link(
|
||||
__out ef10_link_state_t *elsp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_LINK_IN_LEN,
|
||||
MC_CMD_GET_LINK_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_LINK_IN_LEN,
|
||||
MC_CMD_GET_LINK_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_LINK;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_LINK_IN_LEN;
|
||||
@ -328,8 +327,8 @@ ef10_phy_reconfigure(
|
||||
{
|
||||
efx_port_t *epp = &(enp->en_port);
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_SET_LINK_IN_LEN,
|
||||
MC_CMD_SET_LINK_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_SET_LINK_IN_LEN,
|
||||
MC_CMD_SET_LINK_OUT_LEN);
|
||||
uint32_t cap_mask;
|
||||
#if EFSYS_OPT_PHY_LED_CONTROL
|
||||
unsigned int led_mode;
|
||||
@ -343,7 +342,6 @@ ef10_phy_reconfigure(
|
||||
if (supported == B_FALSE)
|
||||
goto out;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_SET_LINK;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_SET_LINK_IN_LEN;
|
||||
@ -491,12 +489,11 @@ ef10_phy_verify(
|
||||
__in efx_nic_t *enp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_PHY_STATE_IN_LEN,
|
||||
MC_CMD_GET_PHY_STATE_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_PHY_STATE_IN_LEN,
|
||||
MC_CMD_GET_PHY_STATE_OUT_LEN);
|
||||
uint32_t state;
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_PHY_STATE;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_PHY_STATE_IN_LEN;
|
||||
@ -614,7 +611,8 @@ ef10_bist_poll(
|
||||
* MCDI_CTL_SDU_LEN_MAX_V1 is large enough cover all BIST results,
|
||||
* whilst not wasting stack.
|
||||
*/
|
||||
uint8_t payload[MAX(MC_CMD_POLL_BIST_IN_LEN, MCDI_CTL_SDU_LEN_MAX_V1)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_POLL_BIST_IN_LEN,
|
||||
MCDI_CTL_SDU_LEN_MAX_V1);
|
||||
efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
|
||||
efx_mcdi_req_t req;
|
||||
uint32_t value_mask = 0;
|
||||
@ -632,7 +630,6 @@ ef10_bist_poll(
|
||||
|
||||
_NOTE(ARGUNUSED(type))
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_POLL_BIST;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_POLL_BIST_IN_LEN;
|
||||
|
@ -56,8 +56,8 @@ efx_mcdi_init_rxq(
|
||||
{
|
||||
efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_INIT_RXQ_V3_IN_LEN,
|
||||
MC_CMD_INIT_RXQ_V3_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_INIT_RXQ_V3_IN_LEN,
|
||||
MC_CMD_INIT_RXQ_V3_OUT_LEN);
|
||||
int npages = EFX_RXQ_NBUFS(ndescs);
|
||||
int i;
|
||||
efx_qword_t *dma_addr;
|
||||
@ -100,7 +100,6 @@ efx_mcdi_init_rxq(
|
||||
want_outer_classes = B_FALSE;
|
||||
}
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_INIT_RXQ;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_INIT_RXQ_V3_IN_LEN;
|
||||
@ -173,11 +172,10 @@ efx_mcdi_fini_rxq(
|
||||
__in uint32_t instance)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_FINI_RXQ_IN_LEN,
|
||||
MC_CMD_FINI_RXQ_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_FINI_RXQ_IN_LEN,
|
||||
MC_CMD_FINI_RXQ_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_FINI_RXQ;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_FINI_RXQ_IN_LEN;
|
||||
@ -215,8 +213,8 @@ efx_mcdi_rss_context_alloc(
|
||||
__out uint32_t *rss_contextp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_RSS_CONTEXT_ALLOC_IN_LEN,
|
||||
MC_CMD_RSS_CONTEXT_ALLOC_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_RSS_CONTEXT_ALLOC_IN_LEN,
|
||||
MC_CMD_RSS_CONTEXT_ALLOC_OUT_LEN);
|
||||
uint32_t rss_context;
|
||||
uint32_t context_type;
|
||||
efx_rc_t rc;
|
||||
@ -238,7 +236,6 @@ efx_mcdi_rss_context_alloc(
|
||||
goto fail2;
|
||||
}
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_RSS_CONTEXT_ALLOC;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_RSS_CONTEXT_ALLOC_IN_LEN;
|
||||
@ -301,8 +298,8 @@ efx_mcdi_rss_context_free(
|
||||
__in uint32_t rss_context)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_RSS_CONTEXT_FREE_IN_LEN,
|
||||
MC_CMD_RSS_CONTEXT_FREE_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_RSS_CONTEXT_FREE_IN_LEN,
|
||||
MC_CMD_RSS_CONTEXT_FREE_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
if (rss_context == EF10_RSS_CONTEXT_INVALID) {
|
||||
@ -310,7 +307,6 @@ efx_mcdi_rss_context_free(
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_RSS_CONTEXT_FREE;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_RSS_CONTEXT_FREE_IN_LEN;
|
||||
@ -351,8 +347,8 @@ efx_mcdi_rss_context_set_flags(
|
||||
efx_rx_hash_type_t type_ipv6_tcp;
|
||||
efx_rx_hash_type_t modes;
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_RSS_CONTEXT_SET_FLAGS_IN_LEN,
|
||||
MC_CMD_RSS_CONTEXT_SET_FLAGS_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_RSS_CONTEXT_SET_FLAGS_IN_LEN,
|
||||
MC_CMD_RSS_CONTEXT_SET_FLAGS_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
EFX_STATIC_ASSERT(EFX_RX_CLASS_IPV4_TCP_LBN ==
|
||||
@ -377,7 +373,6 @@ efx_mcdi_rss_context_set_flags(
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_RSS_CONTEXT_SET_FLAGS;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_RSS_CONTEXT_SET_FLAGS_IN_LEN;
|
||||
@ -466,8 +461,8 @@ efx_mcdi_rss_context_set_key(
|
||||
__in size_t n)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_RSS_CONTEXT_SET_KEY_IN_LEN,
|
||||
MC_CMD_RSS_CONTEXT_SET_KEY_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_RSS_CONTEXT_SET_KEY_IN_LEN,
|
||||
MC_CMD_RSS_CONTEXT_SET_KEY_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
if (rss_context == EF10_RSS_CONTEXT_INVALID) {
|
||||
@ -475,7 +470,6 @@ efx_mcdi_rss_context_set_key(
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_RSS_CONTEXT_SET_KEY;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_RSS_CONTEXT_SET_KEY_IN_LEN;
|
||||
@ -523,8 +517,8 @@ efx_mcdi_rss_context_set_table(
|
||||
__in size_t n)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_RSS_CONTEXT_SET_TABLE_IN_LEN,
|
||||
MC_CMD_RSS_CONTEXT_SET_TABLE_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_RSS_CONTEXT_SET_TABLE_IN_LEN,
|
||||
MC_CMD_RSS_CONTEXT_SET_TABLE_OUT_LEN);
|
||||
uint8_t *req_table;
|
||||
int i, rc;
|
||||
|
||||
@ -533,7 +527,6 @@ efx_mcdi_rss_context_set_table(
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_RSS_CONTEXT_SET_TABLE;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_RSS_CONTEXT_SET_TABLE_IN_LEN;
|
||||
|
@ -58,8 +58,8 @@ efx_mcdi_init_txq(
|
||||
__in efsys_mem_t *esmp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_INIT_TXQ_IN_LEN(EFX_TXQ_MAX_BUFS),
|
||||
MC_CMD_INIT_TXQ_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_INIT_TXQ_IN_LEN(EFX_TXQ_MAX_BUFS),
|
||||
MC_CMD_INIT_TXQ_OUT_LEN);
|
||||
efx_qword_t *dma_addr;
|
||||
uint64_t addr;
|
||||
int npages;
|
||||
@ -80,7 +80,6 @@ efx_mcdi_init_txq(
|
||||
goto fail2;
|
||||
}
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_INIT_TXQ;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_INIT_TXQ_IN_LEN(npages);
|
||||
@ -147,11 +146,10 @@ efx_mcdi_fini_txq(
|
||||
__in uint32_t instance)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_FINI_TXQ_IN_LEN,
|
||||
MC_CMD_FINI_TXQ_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_FINI_TXQ_IN_LEN,
|
||||
MC_CMD_FINI_TXQ_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_FINI_TXQ;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_FINI_TXQ_IN_LEN;
|
||||
|
@ -328,12 +328,11 @@ efx_mcdi_fc_license_update_license(
|
||||
__in efx_nic_t *enp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MC_CMD_FC_IN_LICENSE_LEN];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_FC_IN_LICENSE_LEN, 0);
|
||||
efx_rc_t rc;
|
||||
|
||||
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_SIENA);
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_FC;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_FC_IN_LICENSE_LEN;
|
||||
@ -374,13 +373,12 @@ efx_mcdi_fc_license_get_key_stats(
|
||||
__out efx_key_stats_t *eksp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_FC_IN_LICENSE_LEN,
|
||||
MC_CMD_FC_OUT_LICENSE_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_FC_IN_LICENSE_LEN,
|
||||
MC_CMD_FC_OUT_LICENSE_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_SIENA);
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_FC;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_FC_IN_LICENSE_LEN;
|
||||
@ -690,8 +688,8 @@ efx_mcdi_licensed_app_state(
|
||||
__out boolean_t *licensedp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_LICENSED_APP_STATE_IN_LEN,
|
||||
MC_CMD_GET_LICENSED_APP_STATE_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_LICENSED_APP_STATE_IN_LEN,
|
||||
MC_CMD_GET_LICENSED_APP_STATE_OUT_LEN);
|
||||
uint32_t app_state;
|
||||
efx_rc_t rc;
|
||||
|
||||
@ -703,7 +701,6 @@ efx_mcdi_licensed_app_state(
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_LICENSED_APP_STATE;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_LICENSED_APP_STATE_IN_LEN;
|
||||
@ -749,12 +746,11 @@ efx_mcdi_licensing_update_licenses(
|
||||
__in efx_nic_t *enp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MC_CMD_LICENSING_IN_LEN];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_LICENSING_IN_LEN, 0);
|
||||
efx_rc_t rc;
|
||||
|
||||
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON);
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_LICENSING;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_LICENSING_IN_LEN;
|
||||
@ -792,13 +788,12 @@ efx_mcdi_licensing_get_key_stats(
|
||||
__out efx_key_stats_t *eksp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_LICENSING_IN_LEN,
|
||||
MC_CMD_LICENSING_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_LICENSING_IN_LEN,
|
||||
MC_CMD_LICENSING_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON);
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_LICENSING;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_LICENSING_IN_LEN;
|
||||
@ -856,13 +851,12 @@ efx_mcdi_licensing_v3_update_licenses(
|
||||
__in efx_nic_t *enp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MC_CMD_LICENSING_V3_IN_LEN];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_LICENSING_V3_IN_LEN, 0);
|
||||
efx_rc_t rc;
|
||||
|
||||
EFSYS_ASSERT((enp->en_family == EFX_FAMILY_MEDFORD) ||
|
||||
(enp->en_family == EFX_FAMILY_MEDFORD2));
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_LICENSING_V3;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_LICENSING_V3_IN_LEN;
|
||||
@ -893,14 +887,13 @@ efx_mcdi_licensing_v3_report_license(
|
||||
__out efx_key_stats_t *eksp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_LICENSING_V3_IN_LEN,
|
||||
MC_CMD_LICENSING_V3_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_LICENSING_V3_IN_LEN,
|
||||
MC_CMD_LICENSING_V3_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
EFSYS_ASSERT((enp->en_family == EFX_FAMILY_MEDFORD) ||
|
||||
(enp->en_family == EFX_FAMILY_MEDFORD2));
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_LICENSING_V3;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_LICENSING_V3_IN_LEN;
|
||||
@ -957,15 +950,14 @@ efx_mcdi_licensing_v3_app_state(
|
||||
__out boolean_t *licensedp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_LICENSED_V3_APP_STATE_IN_LEN,
|
||||
MC_CMD_GET_LICENSED_V3_APP_STATE_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_LICENSED_V3_APP_STATE_IN_LEN,
|
||||
MC_CMD_GET_LICENSED_V3_APP_STATE_OUT_LEN);
|
||||
uint32_t app_state;
|
||||
efx_rc_t rc;
|
||||
|
||||
EFSYS_ASSERT((enp->en_family == EFX_FAMILY_MEDFORD) ||
|
||||
(enp->en_family == EFX_FAMILY_MEDFORD2));
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_LICENSED_V3_APP_STATE;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_LICENSED_V3_APP_STATE_IN_LEN;
|
||||
@ -1017,8 +1009,8 @@ efx_mcdi_licensing_v3_get_id(
|
||||
uint8_t *bufferp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_LICENSING_GET_ID_V3_IN_LEN,
|
||||
MC_CMD_LICENSING_GET_ID_V3_OUT_LENMIN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_LICENSING_GET_ID_V3_IN_LEN,
|
||||
MC_CMD_LICENSING_GET_ID_V3_OUT_LENMIN);
|
||||
efx_rc_t rc;
|
||||
|
||||
req.emr_cmd = MC_CMD_LICENSING_GET_ID_V3;
|
||||
@ -1029,7 +1021,6 @@ efx_mcdi_licensing_v3_get_id(
|
||||
req.emr_in_length = MC_CMD_LICENSING_GET_ID_V3_IN_LEN;
|
||||
req.emr_out_buf = bufferp;
|
||||
req.emr_out_length = MC_CMD_LICENSING_GET_ID_V3_OUT_LENMIN;
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
} else {
|
||||
/* Request full buffer */
|
||||
req.emr_in_buf = bufferp;
|
||||
|
@ -929,10 +929,10 @@ efx_mcdi_version(
|
||||
__out_opt efx_mcdi_boot_t *statusp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MAX(MC_CMD_GET_VERSION_IN_LEN,
|
||||
MC_CMD_GET_VERSION_OUT_LEN),
|
||||
MAX(MC_CMD_GET_BOOT_STATUS_IN_LEN,
|
||||
MC_CMD_GET_BOOT_STATUS_OUT_LEN))];
|
||||
EFX_MCDI_DECLARE_BUF(payload,
|
||||
MAX(MC_CMD_GET_VERSION_IN_LEN, MC_CMD_GET_BOOT_STATUS_IN_LEN),
|
||||
MAX(MC_CMD_GET_VERSION_OUT_LEN,
|
||||
MC_CMD_GET_BOOT_STATUS_OUT_LEN));
|
||||
efx_word_t *ver_words;
|
||||
uint16_t version[4];
|
||||
uint32_t build;
|
||||
@ -941,7 +941,6 @@ efx_mcdi_version(
|
||||
|
||||
EFSYS_ASSERT3U(enp->en_features, &, EFX_FEATURE_MCDI);
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_VERSION;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_VERSION_IN_LEN;
|
||||
@ -1047,12 +1046,11 @@ efx_mcdi_get_capabilities(
|
||||
__out_opt uint32_t *tso2ncp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_CAPABILITIES_IN_LEN,
|
||||
MC_CMD_GET_CAPABILITIES_V2_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_CAPABILITIES_IN_LEN,
|
||||
MC_CMD_GET_CAPABILITIES_V2_OUT_LEN);
|
||||
boolean_t v2_capable;
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_CAPABILITIES;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_CAPABILITIES_IN_LEN;
|
||||
@ -1115,7 +1113,8 @@ efx_mcdi_do_reboot(
|
||||
__in efx_nic_t *enp,
|
||||
__in boolean_t after_assertion)
|
||||
{
|
||||
uint8_t payload[MAX(MC_CMD_REBOOT_IN_LEN, MC_CMD_REBOOT_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_REBOOT_IN_LEN,
|
||||
MC_CMD_REBOOT_OUT_LEN);
|
||||
efx_mcdi_req_t req;
|
||||
efx_rc_t rc;
|
||||
|
||||
@ -1128,7 +1127,6 @@ efx_mcdi_do_reboot(
|
||||
*/
|
||||
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_REBOOT;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_REBOOT_IN_LEN;
|
||||
@ -1179,8 +1177,8 @@ efx_mcdi_read_assertion(
|
||||
__in efx_nic_t *enp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_ASSERTS_IN_LEN,
|
||||
MC_CMD_GET_ASSERTS_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_ASSERTS_IN_LEN,
|
||||
MC_CMD_GET_ASSERTS_OUT_LEN);
|
||||
const char *reason;
|
||||
unsigned int flags;
|
||||
unsigned int index;
|
||||
@ -1281,11 +1279,10 @@ efx_mcdi_drv_attach(
|
||||
__in boolean_t attach)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_DRV_ATTACH_IN_LEN,
|
||||
MC_CMD_DRV_ATTACH_EXT_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_DRV_ATTACH_IN_LEN,
|
||||
MC_CMD_DRV_ATTACH_EXT_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_DRV_ATTACH;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_DRV_ATTACH_IN_LEN;
|
||||
@ -1340,11 +1337,10 @@ efx_mcdi_get_board_cfg(
|
||||
{
|
||||
efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip);
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_BOARD_CFG_IN_LEN,
|
||||
MC_CMD_GET_BOARD_CFG_OUT_LENMIN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_BOARD_CFG_IN_LEN,
|
||||
MC_CMD_GET_BOARD_CFG_OUT_LENMIN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_BOARD_CFG;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_BOARD_CFG_IN_LEN;
|
||||
@ -1420,11 +1416,10 @@ efx_mcdi_get_resource_limits(
|
||||
__out_opt uint32_t *ntxqp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_RESOURCE_LIMITS_IN_LEN,
|
||||
MC_CMD_GET_RESOURCE_LIMITS_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_RESOURCE_LIMITS_IN_LEN,
|
||||
MC_CMD_GET_RESOURCE_LIMITS_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_RESOURCE_LIMITS;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_RESOURCE_LIMITS_IN_LEN;
|
||||
@ -1467,8 +1462,8 @@ efx_mcdi_get_phy_cfg(
|
||||
efx_port_t *epp = &(enp->en_port);
|
||||
efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_PHY_CFG_IN_LEN,
|
||||
MC_CMD_GET_PHY_CFG_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_PHY_CFG_IN_LEN,
|
||||
MC_CMD_GET_PHY_CFG_OUT_LEN);
|
||||
#if EFSYS_OPT_NAMES
|
||||
const char *namep;
|
||||
size_t namelen;
|
||||
@ -1476,7 +1471,6 @@ efx_mcdi_get_phy_cfg(
|
||||
uint32_t phy_media_type;
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_PHY_CFG;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_PHY_CFG_IN_LEN;
|
||||
@ -1715,11 +1709,10 @@ efx_mcdi_bist_start(
|
||||
__in efx_bist_type_t type)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_START_BIST_IN_LEN,
|
||||
MC_CMD_START_BIST_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_START_BIST_IN_LEN,
|
||||
MC_CMD_START_BIST_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_START_BIST;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_START_BIST_IN_LEN;
|
||||
@ -1778,11 +1771,10 @@ efx_mcdi_log_ctrl(
|
||||
__in efx_nic_t *enp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_LOG_CTRL_IN_LEN,
|
||||
MC_CMD_LOG_CTRL_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_LOG_CTRL_IN_LEN,
|
||||
MC_CMD_LOG_CTRL_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_LOG_CTRL;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_LOG_CTRL_IN_LEN;
|
||||
@ -1827,8 +1819,8 @@ efx_mcdi_mac_stats(
|
||||
__in uint16_t period_ms)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_MAC_STATS_IN_LEN,
|
||||
MC_CMD_MAC_STATS_V2_OUT_DMA_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_MAC_STATS_IN_LEN,
|
||||
MC_CMD_MAC_STATS_V2_OUT_DMA_LEN);
|
||||
int clear = (action == EFX_STATS_CLEAR);
|
||||
int upload = (action == EFX_STATS_UPLOAD);
|
||||
int enable = (action == EFX_STATS_ENABLE_NOEVENTS);
|
||||
@ -1836,7 +1828,6 @@ efx_mcdi_mac_stats(
|
||||
int disable = (action == EFX_STATS_DISABLE);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_MAC_STATS;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_MAC_STATS_IN_LEN;
|
||||
@ -2008,11 +1999,10 @@ efx_mcdi_get_function_info(
|
||||
__out_opt uint32_t *vfp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_FUNCTION_INFO_IN_LEN,
|
||||
MC_CMD_GET_FUNCTION_INFO_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_FUNCTION_INFO_IN_LEN,
|
||||
MC_CMD_GET_FUNCTION_INFO_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_FUNCTION_INFO;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_FUNCTION_INFO_IN_LEN;
|
||||
@ -2053,11 +2043,10 @@ efx_mcdi_privilege_mask(
|
||||
__out uint32_t *maskp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_PRIVILEGE_MASK_IN_LEN,
|
||||
MC_CMD_PRIVILEGE_MASK_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_PRIVILEGE_MASK_IN_LEN,
|
||||
MC_CMD_PRIVILEGE_MASK_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_PRIVILEGE_MASK;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_PRIVILEGE_MASK_IN_LEN;
|
||||
@ -2102,11 +2091,10 @@ efx_mcdi_set_workaround(
|
||||
__out_opt uint32_t *flagsp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_WORKAROUND_IN_LEN,
|
||||
MC_CMD_WORKAROUND_EXT_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_WORKAROUND_IN_LEN,
|
||||
MC_CMD_WORKAROUND_EXT_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_WORKAROUND;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_WORKAROUND_IN_LEN;
|
||||
@ -2146,10 +2134,9 @@ efx_mcdi_get_workarounds(
|
||||
__out_opt uint32_t *enabledp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MC_CMD_GET_WORKAROUNDS_OUT_LEN];
|
||||
EFX_MCDI_DECLARE_BUF(payload, 0, MC_CMD_GET_WORKAROUNDS_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_WORKAROUNDS;
|
||||
req.emr_in_buf = NULL;
|
||||
req.emr_in_length = 0;
|
||||
@ -2195,14 +2182,13 @@ efx_mcdi_get_phy_media_info(
|
||||
__out_bcount(len) uint8_t *data)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_PHY_MEDIA_INFO_IN_LEN,
|
||||
MC_CMD_GET_PHY_MEDIA_INFO_OUT_LEN(
|
||||
EFX_PHY_MEDIA_INFO_PAGE_SIZE))];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_PHY_MEDIA_INFO_IN_LEN,
|
||||
MC_CMD_GET_PHY_MEDIA_INFO_OUT_LEN(
|
||||
EFX_PHY_MEDIA_INFO_PAGE_SIZE));
|
||||
efx_rc_t rc;
|
||||
|
||||
EFSYS_ASSERT((uint32_t)offset + len <= EFX_PHY_MEDIA_INFO_PAGE_SIZE);
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_PHY_MEDIA_INFO;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_PHY_MEDIA_INFO_IN_LEN;
|
||||
|
@ -412,6 +412,17 @@ efx_mcdi_phy_module_get_info(
|
||||
(((mask) & (MC_CMD_PRIVILEGE_MASK_IN_GRP_ ## priv)) == \
|
||||
(MC_CMD_PRIVILEGE_MASK_IN_GRP_ ## priv))
|
||||
|
||||
/*
|
||||
* The buffer size must be a multiple of dword to ensure that MCDI works
|
||||
* properly with Siena based boards (which use on-chip buffer). Also, it
|
||||
* should be at minimum the size of two dwords to allow space for extended
|
||||
* error responses if the request/response buffer sizes are smaller.
|
||||
*/
|
||||
#define EFX_MCDI_DECLARE_BUF(_name, _in_len, _out_len) \
|
||||
uint8_t _name[P2ROUNDUP(MAX(MAX(_in_len, _out_len), \
|
||||
(2 * sizeof (efx_dword_t))), \
|
||||
sizeof (efx_dword_t))] = {0}
|
||||
|
||||
typedef enum efx_mcdi_feature_id_e {
|
||||
EFX_MCDI_FEATURE_FW_UPDATE = 0,
|
||||
EFX_MCDI_FEATURE_LINK_CONTROL,
|
||||
|
@ -818,13 +818,12 @@ efx_mcdi_get_loopback_modes(
|
||||
{
|
||||
efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_LOOPBACK_MODES_IN_LEN,
|
||||
MC_CMD_GET_LOOPBACK_MODES_OUT_V2_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_LOOPBACK_MODES_IN_LEN,
|
||||
MC_CMD_GET_LOOPBACK_MODES_OUT_V2_LEN);
|
||||
efx_qword_t mask;
|
||||
efx_qword_t modes;
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_LOOPBACK_MODES;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_LOOPBACK_MODES_IN_LEN;
|
||||
|
@ -543,12 +543,11 @@ efx_mcdi_nvram_partitions(
|
||||
__out unsigned int *npartnp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_NVRAM_PARTITIONS_IN_LEN,
|
||||
MC_CMD_NVRAM_PARTITIONS_OUT_LENMAX)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_NVRAM_PARTITIONS_IN_LEN,
|
||||
MC_CMD_NVRAM_PARTITIONS_OUT_LENMAX);
|
||||
unsigned int npartn;
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_NVRAM_PARTITIONS;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_NVRAM_PARTITIONS_IN_LEN;
|
||||
@ -606,11 +605,10 @@ efx_mcdi_nvram_metadata(
|
||||
__in size_t size)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_NVRAM_METADATA_IN_LEN,
|
||||
MC_CMD_NVRAM_METADATA_OUT_LENMAX)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_NVRAM_METADATA_IN_LEN,
|
||||
MC_CMD_NVRAM_METADATA_OUT_LENMAX);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_NVRAM_METADATA;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_NVRAM_METADATA_IN_LEN;
|
||||
@ -696,12 +694,11 @@ efx_mcdi_nvram_info(
|
||||
__out_opt uint32_t *erase_sizep,
|
||||
__out_opt uint32_t *write_sizep)
|
||||
{
|
||||
uint8_t payload[MAX(MC_CMD_NVRAM_INFO_IN_LEN,
|
||||
MC_CMD_NVRAM_INFO_V2_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_NVRAM_INFO_IN_LEN,
|
||||
MC_CMD_NVRAM_INFO_V2_OUT_LEN);
|
||||
efx_mcdi_req_t req;
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_NVRAM_INFO;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_NVRAM_INFO_IN_LEN;
|
||||
@ -757,12 +754,11 @@ efx_mcdi_nvram_update_start(
|
||||
__in efx_nic_t *enp,
|
||||
__in uint32_t partn)
|
||||
{
|
||||
uint8_t payload[MAX(MC_CMD_NVRAM_UPDATE_START_V2_IN_LEN,
|
||||
MC_CMD_NVRAM_UPDATE_START_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_NVRAM_UPDATE_START_V2_IN_LEN,
|
||||
MC_CMD_NVRAM_UPDATE_START_OUT_LEN);
|
||||
efx_mcdi_req_t req;
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_NVRAM_UPDATE_START;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_NVRAM_UPDATE_START_V2_IN_LEN;
|
||||
@ -799,8 +795,8 @@ efx_mcdi_nvram_read(
|
||||
__in uint32_t mode)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_NVRAM_READ_IN_V2_LEN,
|
||||
MC_CMD_NVRAM_READ_OUT_LENMAX)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_NVRAM_READ_IN_V2_LEN,
|
||||
MC_CMD_NVRAM_READ_OUT_LENMAX);
|
||||
efx_rc_t rc;
|
||||
|
||||
if (size > MC_CMD_NVRAM_READ_OUT_LENMAX) {
|
||||
@ -808,7 +804,6 @@ efx_mcdi_nvram_read(
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_NVRAM_READ;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_NVRAM_READ_IN_V2_LEN;
|
||||
@ -854,11 +849,10 @@ efx_mcdi_nvram_erase(
|
||||
__in size_t size)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_NVRAM_ERASE_IN_LEN,
|
||||
MC_CMD_NVRAM_ERASE_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_NVRAM_ERASE_IN_LEN,
|
||||
MC_CMD_NVRAM_ERASE_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_NVRAM_ERASE;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_NVRAM_ERASE_IN_LEN;
|
||||
@ -968,12 +962,11 @@ efx_mcdi_nvram_update_finish(
|
||||
{
|
||||
const efx_nic_cfg_t *encp = &enp->en_nic_cfg;
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_NVRAM_UPDATE_FINISH_V2_IN_LEN,
|
||||
MC_CMD_NVRAM_UPDATE_FINISH_V2_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_NVRAM_UPDATE_FINISH_V2_IN_LEN,
|
||||
MC_CMD_NVRAM_UPDATE_FINISH_V2_OUT_LEN);
|
||||
uint32_t verify_result = MC_CMD_NVRAM_VERIFY_RC_UNKNOWN;
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_NVRAM_UPDATE_FINISH;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_NVRAM_UPDATE_FINISH_V2_IN_LEN;
|
||||
@ -1039,12 +1032,11 @@ efx_mcdi_nvram_test(
|
||||
__in uint32_t partn)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_NVRAM_TEST_IN_LEN,
|
||||
MC_CMD_NVRAM_TEST_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_NVRAM_TEST_IN_LEN,
|
||||
MC_CMD_NVRAM_TEST_OUT_LEN);
|
||||
int result;
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_NVRAM_TEST;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_NVRAM_TEST_IN_LEN;
|
||||
|
@ -69,8 +69,9 @@ efx_mcdi_set_tunnel_encap_udp_ports(
|
||||
__out boolean_t *resetting)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_IN_LENMAX,
|
||||
MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload,
|
||||
MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_IN_LENMAX,
|
||||
MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS_OUT_LEN);
|
||||
efx_word_t flags;
|
||||
efx_rc_t rc;
|
||||
unsigned int i;
|
||||
@ -81,7 +82,6 @@ efx_mcdi_set_tunnel_encap_udp_ports(
|
||||
else
|
||||
entries_num = etcp->etc_udp_entries_num;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_SET_TUNNEL_ENCAP_UDP_PORTS;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length =
|
||||
|
@ -218,8 +218,8 @@ efx_mcdi_read_sensors(
|
||||
__in uint32_t size)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_READ_SENSORS_EXT_IN_LEN,
|
||||
MC_CMD_READ_SENSORS_EXT_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_READ_SENSORS_EXT_IN_LEN,
|
||||
MC_CMD_READ_SENSORS_EXT_OUT_LEN);
|
||||
uint32_t addr_lo, addr_hi;
|
||||
efx_rc_t rc;
|
||||
|
||||
@ -257,8 +257,8 @@ efx_mcdi_sensor_info_npages(
|
||||
__out uint32_t *npagesp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_SENSOR_INFO_EXT_IN_LEN,
|
||||
MC_CMD_SENSOR_INFO_OUT_LENMAX)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_SENSOR_INFO_EXT_IN_LEN,
|
||||
MC_CMD_SENSOR_INFO_OUT_LENMAX);
|
||||
int page;
|
||||
efx_rc_t rc;
|
||||
|
||||
@ -301,8 +301,8 @@ efx_mcdi_sensor_info(
|
||||
__in size_t npages)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_SENSOR_INFO_EXT_IN_LEN,
|
||||
MC_CMD_SENSOR_INFO_OUT_LENMAX)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_SENSOR_INFO_EXT_IN_LEN,
|
||||
MC_CMD_SENSOR_INFO_OUT_LENMAX);
|
||||
uint32_t page;
|
||||
efx_rc_t rc;
|
||||
|
||||
@ -370,8 +370,8 @@ efx_mcdi_sensor_info_page(
|
||||
efx_mon_stat_limits_t *limits)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_SENSOR_INFO_EXT_IN_LEN,
|
||||
MC_CMD_SENSOR_INFO_OUT_LENMAX)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_SENSOR_INFO_EXT_IN_LEN,
|
||||
MC_CMD_SENSOR_INFO_OUT_LENMAX);
|
||||
efx_rc_t rc;
|
||||
uint32_t mask_copy;
|
||||
efx_dword_t *maskp;
|
||||
@ -383,7 +383,6 @@ efx_mcdi_sensor_info_page(
|
||||
memset(limits, 0,
|
||||
((sizeof (*mask_part) * 8) - 1) * sizeof (efx_mon_stat_limits_t));
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_SENSOR_INFO;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_SENSOR_INFO_EXT_IN_LEN;
|
||||
|
@ -97,14 +97,13 @@ siena_mac_reconfigure(
|
||||
efx_port_t *epp = &(enp->en_port);
|
||||
efx_oword_t multicast_hash[2];
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MAX(MC_CMD_SET_MAC_IN_LEN,
|
||||
MC_CMD_SET_MAC_OUT_LEN),
|
||||
MAX(MC_CMD_SET_MCAST_HASH_IN_LEN,
|
||||
MC_CMD_SET_MCAST_HASH_OUT_LEN))];
|
||||
EFX_MCDI_DECLARE_BUF(payload,
|
||||
MAX(MC_CMD_SET_MAC_IN_LEN, MC_CMD_SET_MCAST_HASH_IN_LEN),
|
||||
MAX(MC_CMD_SET_MAC_OUT_LEN, MC_CMD_SET_MCAST_HASH_OUT_LEN));
|
||||
|
||||
unsigned int fcntl;
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_SET_MAC;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_SET_MAC_IN_LEN;
|
||||
|
@ -47,11 +47,10 @@ siena_nic_get_partn_mask(
|
||||
__out unsigned int *maskp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_NVRAM_TYPES_IN_LEN,
|
||||
MC_CMD_NVRAM_TYPES_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_NVRAM_TYPES_IN_LEN,
|
||||
MC_CMD_NVRAM_TYPES_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_NVRAM_TYPES;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_NVRAM_TYPES_IN_LEN;
|
||||
|
@ -447,12 +447,11 @@ siena_nvram_get_subtype(
|
||||
__out uint32_t *subtypep)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_BOARD_CFG_IN_LEN,
|
||||
MC_CMD_GET_BOARD_CFG_OUT_LENMAX)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_BOARD_CFG_IN_LEN,
|
||||
MC_CMD_GET_BOARD_CFG_OUT_LENMAX);
|
||||
efx_word_t *fw_list;
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_BOARD_CFG;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_BOARD_CFG_IN_LEN;
|
||||
|
@ -198,11 +198,10 @@ siena_phy_get_link(
|
||||
__out siena_link_state_t *slsp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_LINK_IN_LEN,
|
||||
MC_CMD_GET_LINK_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_LINK_IN_LEN,
|
||||
MC_CMD_GET_LINK_OUT_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_LINK;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_LINK_IN_LEN;
|
||||
@ -273,10 +272,9 @@ siena_phy_reconfigure(
|
||||
{
|
||||
efx_port_t *epp = &(enp->en_port);
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MAX(MC_CMD_SET_ID_LED_IN_LEN,
|
||||
MC_CMD_SET_ID_LED_OUT_LEN),
|
||||
MAX(MC_CMD_SET_LINK_IN_LEN,
|
||||
MC_CMD_SET_LINK_OUT_LEN))];
|
||||
EFX_MCDI_DECLARE_BUF(payload,
|
||||
MAX(MC_CMD_SET_ID_LED_IN_LEN, MC_CMD_SET_LINK_IN_LEN),
|
||||
MAX(MC_CMD_SET_ID_LED_OUT_LEN, MC_CMD_SET_LINK_OUT_LEN));
|
||||
uint32_t cap_mask;
|
||||
#if EFSYS_OPT_PHY_LED_CONTROL
|
||||
unsigned int led_mode;
|
||||
@ -284,7 +282,6 @@ siena_phy_reconfigure(
|
||||
unsigned int speed;
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_SET_LINK;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_SET_LINK_IN_LEN;
|
||||
@ -390,12 +387,11 @@ siena_phy_verify(
|
||||
__in efx_nic_t *enp)
|
||||
{
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_GET_PHY_STATE_IN_LEN,
|
||||
MC_CMD_GET_PHY_STATE_OUT_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_GET_PHY_STATE_IN_LEN,
|
||||
MC_CMD_GET_PHY_STATE_OUT_LEN);
|
||||
uint32_t state;
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_GET_PHY_STATE;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_GET_PHY_STATE_IN_LEN;
|
||||
@ -559,8 +555,8 @@ siena_phy_stats_update(
|
||||
uint32_t vmask = encp->enc_mcdi_phy_stat_mask;
|
||||
uint64_t smask;
|
||||
efx_mcdi_req_t req;
|
||||
uint8_t payload[MAX(MC_CMD_PHY_STATS_IN_LEN,
|
||||
MC_CMD_PHY_STATS_OUT_DMA_LEN)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_PHY_STATS_IN_LEN,
|
||||
MC_CMD_PHY_STATS_OUT_DMA_LEN);
|
||||
efx_rc_t rc;
|
||||
|
||||
if ((esmp == NULL) || (EFSYS_MEM_SIZE(esmp) < EFX_PHY_STATS_SIZE)) {
|
||||
@ -568,7 +564,6 @@ siena_phy_stats_update(
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_PHY_STATS;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_PHY_STATS_IN_LEN;
|
||||
@ -655,14 +650,13 @@ siena_phy_bist_poll(
|
||||
__in size_t count)
|
||||
{
|
||||
efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
|
||||
uint8_t payload[MAX(MC_CMD_POLL_BIST_IN_LEN,
|
||||
MCDI_CTL_SDU_LEN_MAX)];
|
||||
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_POLL_BIST_IN_LEN,
|
||||
MCDI_CTL_SDU_LEN_MAX);
|
||||
uint32_t value_mask = 0;
|
||||
efx_mcdi_req_t req;
|
||||
uint32_t result;
|
||||
efx_rc_t rc;
|
||||
|
||||
(void) memset(payload, 0, sizeof (payload));
|
||||
req.emr_cmd = MC_CMD_POLL_BIST;
|
||||
req.emr_in_buf = payload;
|
||||
req.emr_in_length = MC_CMD_POLL_BIST_IN_LEN;
|
||||
|
Loading…
x
Reference in New Issue
Block a user