X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fsfc%2Fbase%2Fefx_mcdi.c;h=477b128686dc10a72642dbcbd3a631c713f72802;hb=d622cad892a1fc715635d137d1598053fd0b8e3a;hp=584fd4d2f7d6e555d8fa8f9f78a2cab6f987641a;hpb=e5ba497b7e366a247d5c801ec9f965a0268eac37;p=dpdk.git diff --git a/drivers/net/sfc/base/efx_mcdi.c b/drivers/net/sfc/base/efx_mcdi.c index 584fd4d2f7..477b128686 100644 --- a/drivers/net/sfc/base/efx_mcdi.c +++ b/drivers/net/sfc/base/efx_mcdi.c @@ -360,7 +360,11 @@ efx_mcdi_read_response_header( rc = EIO; goto fail1; } +#if EFSYS_OPT_MCDI_PROXY_AUTH_SERVER + if (((cmd != emrp->emr_cmd) && (emrp->emr_cmd != MC_CMD_PROXY_CMD)) || +#else if ((cmd != emrp->emr_cmd) || +#endif (seq != ((emip->emi_seq - 1) & EFX_MASK32(MCDI_HEADER_SEQ)))) { /* Response is for a different request */ rc = EIO; @@ -442,6 +446,11 @@ efx_mcdi_finish_response( efx_dword_t hdr[2]; unsigned int hdr_len; size_t bytes; + unsigned int resp_off; +#if EFSYS_OPT_MCDI_PROXY_AUTH_SERVER + unsigned int resp_cmd; + boolean_t proxied_cmd_resp = B_FALSE; +#endif /* EFSYS_OPT_MCDI_PROXY_AUTH_SERVER */ if (emrp->emr_out_buf == NULL) return; @@ -456,14 +465,35 @@ efx_mcdi_finish_response( */ efx_mcdi_read_response(enp, &hdr[1], hdr_len, sizeof (hdr[1])); hdr_len += sizeof (hdr[1]); + resp_off = hdr_len; emrp->emr_out_length_used = EFX_DWORD_FIELD(hdr[1], - MC_CMD_V2_EXTN_IN_ACTUAL_LEN); + MC_CMD_V2_EXTN_IN_ACTUAL_LEN); +#if EFSYS_OPT_MCDI_PROXY_AUTH_SERVER + /* + * A proxy MCDI command is executed by PF on behalf of + * one of its VFs. The command to be proxied follows + * immediately afterward in the host buffer. + * PROXY_CMD inner call complete response should be copied to + * output buffer so that it can be returned to the requesting + * function in MC_CMD_PROXY_COMPLETE payload. + */ + resp_cmd = + EFX_DWORD_FIELD(hdr[1], MC_CMD_V2_EXTN_IN_EXTENDED_CMD); + proxied_cmd_resp = ((emrp->emr_cmd == MC_CMD_PROXY_CMD) && + (resp_cmd != MC_CMD_PROXY_CMD)); + if (proxied_cmd_resp) { + resp_off = 0; + emrp->emr_out_length_used += hdr_len; + } +#endif /* EFSYS_OPT_MCDI_PROXY_AUTH_SERVER */ + } else { + resp_off = hdr_len; } /* Copy payload out into caller supplied buffer */ bytes = MIN(emrp->emr_out_length_used, emrp->emr_out_length); - efx_mcdi_read_response(enp, emrp->emr_out_buf, hdr_len, bytes); + efx_mcdi_read_response(enp, emrp->emr_out_buf, resp_off, bytes); #if EFSYS_OPT_MCDI_LOGGING if (emtp->emt_logger != NULL) { @@ -845,6 +875,18 @@ efx_mcdi_ev_proxy_response( } #endif /* EFSYS_OPT_MCDI_PROXY_AUTH */ +#if EFSYS_OPT_MCDI_PROXY_AUTH_SERVER + void +efx_mcdi_ev_proxy_request( + __in efx_nic_t *enp, + __in unsigned int index) +{ + const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp; + + if (emtp->emt_ev_proxy_request != NULL) + emtp->emt_ev_proxy_request(emtp->emt_context, index); +} +#endif /* EFSYS_OPT_MCDI_PROXY_AUTH_SERVER */ void efx_mcdi_ev_death( __in efx_nic_t *enp, @@ -1792,17 +1834,10 @@ fail1: #if EFSYS_OPT_MAC_STATS -typedef enum efx_stats_action_e { - EFX_STATS_CLEAR, - EFX_STATS_UPLOAD, - EFX_STATS_ENABLE_NOEVENTS, - EFX_STATS_ENABLE_EVENTS, - EFX_STATS_DISABLE, -} efx_stats_action_t; - -static __checkReturn efx_rc_t + __checkReturn efx_rc_t efx_mcdi_mac_stats( __in efx_nic_t *enp, + __in uint32_t vport_id, __in_opt efsys_mem_t *esmp, __in efx_stats_action_t action, __in uint16_t period_ms) @@ -1868,7 +1903,7 @@ efx_mcdi_mac_stats( * vadapter has already been deleted. */ MCDI_IN_SET_DWORD(req, MAC_STATS_IN_PORT_ID, - (disable ? EVB_PORT_ID_NULL : enp->en_vport_id)); + (disable ? EVB_PORT_ID_NULL : vport_id)); efx_mcdi_execute(enp, &req); @@ -1901,7 +1936,8 @@ efx_mcdi_mac_stats_clear( { efx_rc_t rc; - if ((rc = efx_mcdi_mac_stats(enp, NULL, EFX_STATS_CLEAR, 0)) != 0) + if ((rc = efx_mcdi_mac_stats(enp, enp->en_vport_id, NULL, + EFX_STATS_CLEAR, 0)) != 0) goto fail1; return (0); @@ -1924,7 +1960,8 @@ efx_mcdi_mac_stats_upload( * avoid having to pull the statistics buffer into the cache to * maintain cumulative statistics. */ - if ((rc = efx_mcdi_mac_stats(enp, esmp, EFX_STATS_UPLOAD, 0)) != 0) + if ((rc = efx_mcdi_mac_stats(enp, enp->en_vport_id, esmp, + EFX_STATS_UPLOAD, 0)) != 0) goto fail1; return (0); @@ -1952,13 +1989,14 @@ efx_mcdi_mac_stats_periodic( * Medford uses a fixed 1sec period before v6.2.1.1033 firmware. */ if (period_ms == 0) - rc = efx_mcdi_mac_stats(enp, NULL, EFX_STATS_DISABLE, 0); + rc = efx_mcdi_mac_stats(enp, enp->en_vport_id, NULL, + EFX_STATS_DISABLE, 0); else if (events) - rc = efx_mcdi_mac_stats(enp, esmp, EFX_STATS_ENABLE_EVENTS, - period_ms); + rc = efx_mcdi_mac_stats(enp, enp->en_vport_id, esmp, + EFX_STATS_ENABLE_EVENTS, period_ms); else - rc = efx_mcdi_mac_stats(enp, esmp, EFX_STATS_ENABLE_NOEVENTS, - period_ms); + rc = efx_mcdi_mac_stats(enp, enp->en_vport_id, esmp, + EFX_STATS_ENABLE_NOEVENTS, period_ms); if (rc != 0) goto fail1;