Skip to content

Commit

Permalink
net/memif: fix crash with different number of Rx/Tx queues
Browse files Browse the repository at this point in the history
[ upstream commit 231435a ]

There's a bug in memif_stats_get() function due to confusion
between C2S (client->server) and S2C (server->client) rings,
causing a crash if there's a different number of Rx and Tx queues.

Fixit by selectiing the correct rings for Rx and Tx i.e for Rx, S2C
rings are selected and for Tx, C2S rings are selected.

Bugzilla ID: 734
Fixes: 09c7e63 ("net/memif: introduce memory interface PMD")

Signed-off-by: Huzaifa Rahman <huzaifa.rahman@emumba.com>
Reviewed-by: Joyce Kong <joyce.kong@arm.com>
  • Loading branch information
Huzaifa Rahman authored and kevintraynor committed Oct 20, 2022
1 parent 37560c8 commit ee7decc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/net/memif/rte_eth_memif.c
Original file line number Diff line number Diff line change
Expand Up @@ -1447,8 +1447,8 @@ memif_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
stats->opackets = 0;
stats->obytes = 0;

tmp = (pmd->role == MEMIF_ROLE_CLIENT) ? pmd->run.num_c2s_rings :
pmd->run.num_s2c_rings;
tmp = (pmd->role == MEMIF_ROLE_CLIENT) ? pmd->run.num_s2c_rings :
pmd->run.num_c2s_rings;
nq = (tmp < RTE_ETHDEV_QUEUE_STAT_CNTRS) ? tmp :
RTE_ETHDEV_QUEUE_STAT_CNTRS;

Expand All @@ -1461,8 +1461,8 @@ memif_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
stats->ibytes += mq->n_bytes;
}

tmp = (pmd->role == MEMIF_ROLE_CLIENT) ? pmd->run.num_s2c_rings :
pmd->run.num_c2s_rings;
tmp = (pmd->role == MEMIF_ROLE_CLIENT) ? pmd->run.num_c2s_rings :
pmd->run.num_s2c_rings;
nq = (tmp < RTE_ETHDEV_QUEUE_STAT_CNTRS) ? tmp :
RTE_ETHDEV_QUEUE_STAT_CNTRS;

Expand Down

0 comments on commit ee7decc

Please sign in to comment.