The qstats argument is NULL when the application calls
rte_eth_stats_get(), which only asks for the port level statistics.
Both the primary and the secondary path dereference it unconditionally,
so plain statistics retrieval crashes.
Only fetch and copy the per queue statistics when qstats is given.
Fixes: 5db446ba97b0 ("net/sxe2: support statistics and multi-process")
Cc: [email protected]
Signed-off-by: Stephen Hemminger <[email protected]>
---
drivers/net/sxe2/sxe2_mp.c | 3 ++-
drivers/net/sxe2/sxe2_stats.c | 8 +++++---
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/net/sxe2/sxe2_mp.c b/drivers/net/sxe2/sxe2_mp.c
index a4a5c76495..a9598b6dd6 100644
--- a/drivers/net/sxe2/sxe2_mp.c
+++ b/drivers/net/sxe2/sxe2_mp.c
@@ -325,7 +325,8 @@ int32_t sxe2_mp_req_get_stats(struct rte_eth_dev *dev,
mz_data = (struct sxe2_mp_shared_data *)sxe2_mp_mz->addr;
memcpy(stats, &mz_data->payload.stats_blk.stats, sizeof(*stats));
- memcpy(qstats, &mz_data->payload.stats_blk.qstats, sizeof(*qstats));
+ if (qstats != NULL)
+ memcpy(qstats, &mz_data->payload.stats_blk.qstats,
sizeof(*qstats));
PMD_LOG_DEBUG(DRV, "sxe2_mp: stats received via IPC for port %u",
dev->data->port_id);
ret = 0;
diff --git a/drivers/net/sxe2/sxe2_stats.c b/drivers/net/sxe2/sxe2_stats.c
index 3ad8fe2fe9..0e4857a906 100644
--- a/drivers/net/sxe2/sxe2_stats.c
+++ b/drivers/net/sxe2/sxe2_stats.c
@@ -328,9 +328,11 @@ int32_t sxe2_stats_info_get(struct rte_eth_dev *dev,
if (ret)
goto end;
- ret = sxe2_drv_queue_info_get_update(adapter, qstats);
- if (ret)
- goto end;
+ if (qstats != NULL) {
+ ret = sxe2_drv_queue_info_get_update(adapter, qstats);
+ if (ret)
+ goto end;
+ }
sxe2_stats_update(adapter);
--
2.53.0