/* SPDX-License-Identifier: BSD-3-Clause
*
- * Copyright (c) 2008-2018 Solarflare Communications Inc.
- * All rights reserved.
+ * Copyright(c) 2019-2020 Xilinx, Inc.
+ * Copyright(c) 2008-2019 Solarflare Communications Inc.
*/
#include "efx.h"
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;
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;
*/
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) {
#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)
* 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);
{
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);
* 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);
* 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;