Add MAC stats lock in xstats_get_by_id() callback before reading
number of supported MAC stats.
Fixes: 73280c1e4ff ("net/sfc: support xstats retrieval by ID")
Cc: stable@dpdk.org
Signed-off-by: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
int ret;
int rc;
- if (unlikely(values == NULL) ||
- unlikely((ids == NULL) && (n < port->mac_stats_nb_supported)))
- return port->mac_stats_nb_supported;
-
rte_spinlock_lock(&port->mac_stats_lock);
+ if (unlikely(values == NULL) ||
+ unlikely(ids == NULL && n < port->mac_stats_nb_supported)) {
+ ret = port->mac_stats_nb_supported;
+ goto unlock;
+ }
+
rc = sfc_port_update_mac_stats(sa);
if (rc != 0) {
SFC_ASSERT(rc > 0);