diff options
author | arybchik <arybchik@FreeBSD.org> | 2015-12-10 07:15:09 +0000 |
---|---|---|
committer | arybchik <arybchik@FreeBSD.org> | 2015-12-10 07:15:09 +0000 |
commit | 3d29fd25507df8f28ae5668af416e2b89c541fc3 (patch) | |
tree | 39c7b09f558b103677a5ae859115e18fb0cc639b | |
parent | fcd41d4f012a952ccf988893a653da2b39eaa260 (diff) | |
download | FreeBSD-src-3d29fd25507df8f28ae5668af416e2b89c541fc3.zip FreeBSD-src-3d29fd25507df8f28ae5668af416e2b89c541fc3.tar.gz |
sfxge: [5/6] rework event completion error handling
Required for MCDI proxy authorization support.
Submitted by: Andy Moreton <amoreton at solarflare.com>
Sponsored by: Solarflare Communications, Inc.
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D4453
-rw-r--r-- | sys/dev/sfxge/common/efx_mcdi.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/sys/dev/sfxge/common/efx_mcdi.c b/sys/dev/sfxge/common/efx_mcdi.c index 6cde999..19c825b 100644 --- a/sys/dev/sfxge/common/efx_mcdi.c +++ b/sys/dev/sfxge/common/efx_mcdi.c @@ -543,6 +543,7 @@ efx_mcdi_ev_cpl( efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp; efx_mcdi_ops_t *emcop = enp->en_mcdi.em_emcop; + efx_nic_cfg_t *encp = &enp->en_nic_cfg; efx_mcdi_req_t *emrp; int state; @@ -567,20 +568,21 @@ efx_mcdi_ev_cpl( emip->emi_pending_req = NULL; EFSYS_UNLOCK(enp->en_eslp, state); - /* - * Fill out the remaining hdr fields, and copyout the payload - * if the user supplied an output buffer. - */ - if (errcode != 0) { - if (!emrp->emr_quiet) { - EFSYS_PROBE2(mcdi_err, int, emrp->emr_cmd, - int, errcode); - } - emrp->emr_out_length_used = 0; - emrp->emr_rc = efx_mcdi_request_errcode(errcode); + if (encp->enc_mcdi_max_payload_length > MCDI_CTL_SDU_LEN_MAX_V1) { + /* MCDIv2 response details do not fit into an event. */ + efx_mcdi_read_response_header(enp, emrp); } else { - emrp->emr_out_length_used = outlen; - emrp->emr_rc = 0; + if (errcode != 0) { + if (!emrp->emr_quiet) { + EFSYS_PROBE2(mcdi_err, int, emrp->emr_cmd, + int, errcode); + } + emrp->emr_out_length_used = 0; + emrp->emr_rc = efx_mcdi_request_errcode(errcode); + } else { + emrp->emr_out_length_used = outlen; + emrp->emr_rc = 0; + } } emcop->emco_request_copyout(enp, emrp); |