Hypervisor should be able to track VF statistics.
Signed-off-by: Gautam Dawar <gdawar@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
addrp, fn_resetp));
}
+ __checkReturn efx_rc_t
+ef10_evb_vport_stats(
+ __in efx_nic_t *enp,
+ __in efx_vswitch_id_t vswitch_id,
+ __in efx_vport_id_t vport_id,
+ __in efsys_mem_t *esmp)
+{
+ _NOTE(ARGUNUSED(vswitch_id))
+
+ return (efx_mcdi_mac_stats(enp, vport_id, esmp,
+ EFX_STATS_UPLOAD, 0));
+}
+
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */
#endif /* EFSYS_OPT_EVB */
__in_bcount_opt(EFX_MAC_ADDR_LEN) uint8_t *addrp,
__out_opt boolean_t *fn_resetp);
+extern __checkReturn efx_rc_t
+ef10_evb_vport_stats(
+ __in efx_nic_t *enp,
+ __in efx_vswitch_id_t vswitch_id,
+ __in efx_vport_id_t vport_id,
+ __out efsys_mem_t *esmp);
+
#endif /* EFSYS_OPT_EVB */
#if EFSYS_OPT_MCDI_PROXY_AUTH_SERVER
__in_bcount(EFX_MAC_ADDR_LEN) uint8_t *addrp,
__in uint16_t vid,
__out boolean_t *is_fn_resetp);
+
+extern __checkReturn efx_rc_t
+efx_evb_vport_stats(
+ __in efx_nic_t *enp,
+ __in efx_vswitch_t *evp,
+ __in efx_vport_id_t vport_id,
+ __out efsys_mem_t *stats_bufferp);
+
#endif /* EFSYS_OPT_EVB */
#if EFSYS_OPT_MCDI_PROXY_AUTH_SERVER
NULL, /* eeo_vadaptor_free */
NULL, /* eeo_vport_assign */
NULL, /* eeo_vport_reconfigure */
+ NULL, /* eeo_vport_stats */
};
#endif /* EFSYS_OPT_SIENA */
ef10_evb_vadaptor_free, /* eeo_vadaptor_free */
ef10_evb_vport_assign, /* eeo_vport_assign */
ef10_evb_vport_reconfigure, /* eeo_vport_reconfigure */
+ ef10_evb_vport_stats, /* eeo_vport_stats */
};
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */
return (rc);
}
+ __checkReturn efx_rc_t
+efx_evb_vport_stats(
+ __in efx_nic_t *enp,
+ __in efx_vswitch_t *evp,
+ __in efx_vport_id_t vport_id,
+ __out efsys_mem_t *stats_bufferp)
+{
+ efx_rc_t rc;
+ const efx_evb_ops_t *eeop = enp->en_eeop;
+
+ EFSYS_ASSERT(enp->en_mod_flags & EFX_MOD_EVB);
+
+ if (eeop->eeo_vport_stats == NULL) {
+ rc = ENOTSUP;
+ goto fail1;
+ }
+
+ if (stats_bufferp == NULL) {
+ rc = EINVAL;
+ goto fail2;
+ }
+
+ rc = eeop->eeo_vport_stats(enp, evp->ev_vswitch_id,
+ vport_id, stats_bufferp);
+ if (rc != 0)
+ goto fail3;
+
+ return (0);
+
+fail3:
+ EFSYS_PROBE(fail3);
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+ return (rc);
+}
+
#endif
efx_vport_id_t,
uint16_t *, uint8_t *,
boolean_t *);
+ efx_rc_t (*eeo_vport_stats)(efx_nic_t *, efx_vswitch_id_t,
+ efx_vport_id_t, efsys_mem_t *);
} efx_evb_ops_t;
extern __checkReturn boolean_t
efx_mac_stat_t last;
};
+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;
+
extern efx_rc_t
efx_mac_stats_mask_add_ranges(
__inout_bcount(mask_size) uint32_t *maskp,
__in_ecount(rng_count) const struct efx_mac_stats_range *rngp,
__in unsigned int rng_count);
+extern __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);
+
#endif /* EFSYS_OPT_MAC_STATS */
#ifdef __cplusplus
#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;