sfxge(4): use correct port number in sensor decoding
The port mask used for per-port sensors in mcdi_sensor_map assumes zero-based port numbering. The port mask used in the code is based on the one-based MCDI port number. Fix this to lookup the correct per-port sensors, and to allow reporting of sensor events from higher port numbers. Submitted by: Andy Moreton <amoreton at solarflare.com> Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D8947
This commit is contained in:
parent
f3cacdeb18
commit
b5a8496927
@ -50,6 +50,9 @@ __FBSDID("$FreeBSD$");
|
||||
#define MCDI_MON_PORT_P4 (0x08)
|
||||
#define MCDI_MON_PORT_Px (0xFFFF)
|
||||
|
||||
/* Get port mask from one-based MCDI port number */
|
||||
#define MCDI_MON_PORT_MASK(_emip) (1U << ((_emip)->emi_port - 1))
|
||||
|
||||
/* Entry for MCDI sensor in sensor map */
|
||||
#define STAT(portmask, stat) \
|
||||
{ (MCDI_MON_PORT_##portmask), (EFX_MON_STAT_##stat) }
|
||||
@ -166,10 +169,10 @@ static const struct mcdi_sensor_map_s {
|
||||
static void
|
||||
mcdi_mon_decode_stats(
|
||||
__in efx_nic_t *enp,
|
||||
__in_ecount(sensor_mask_size) uint32_t *sensor_mask,
|
||||
__in_bcount(sensor_mask_size) uint32_t *sensor_mask,
|
||||
__in size_t sensor_mask_size,
|
||||
__in_opt efsys_mem_t *esmp,
|
||||
__out_ecount_opt(sensor_mask_size) uint32_t *stat_maskp,
|
||||
__out_bcount_opt(sensor_mask_size) uint32_t *stat_maskp,
|
||||
__inout_ecount_opt(EFX_MON_NSTATS) efx_mon_stat_value_t *stat)
|
||||
{
|
||||
efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip);
|
||||
@ -192,7 +195,8 @@ mcdi_mon_decode_stats(
|
||||
sensor_max =
|
||||
MIN((8 * sensor_mask_size), EFX_ARRAY_SIZE(mcdi_sensor_map));
|
||||
|
||||
port_mask = 1U << emip->emi_port;
|
||||
EFSYS_ASSERT(emip->emi_port > 0); /* MCDI port number is one-based */
|
||||
port_mask = MCDI_MON_PORT_MASK(emip);
|
||||
|
||||
memset(stat_mask, 0, sizeof (stat_mask));
|
||||
|
||||
@ -269,9 +273,8 @@ mcdi_mon_ev(
|
||||
efx_mon_stat_t id;
|
||||
efx_rc_t rc;
|
||||
|
||||
port_mask = (emip->emi_port == 1)
|
||||
? MCDI_MON_PORT_P1
|
||||
: MCDI_MON_PORT_P2;
|
||||
EFSYS_ASSERT(emip->emi_port > 0); /* MCDI port number is one-based */
|
||||
port_mask = MCDI_MON_PORT_MASK(emip);
|
||||
|
||||
sensor = (uint16_t)MCDI_EV_FIELD(eqp, SENSOREVT_MONITOR);
|
||||
state = (uint16_t)MCDI_EV_FIELD(eqp, SENSOREVT_STATE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user