diff options
author | Jakub Grajciar <jgrajcia@cisco.com> | 2019-11-05 10:58:00 +0100 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2019-11-05 12:55:51 +0000 |
commit | 718a19b8f9aa3dca26aaf4eb6bd9f60eb6376d30 (patch) | |
tree | 836defb8f0fdc55083e9934936e83a27b41eeb1a | |
parent | 16572355c9069e2e8e4836dc6bd6a65feed2d390 (diff) |
libmemif: reset number of queues on disconnect
Type: fix
Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
Change-Id: If4df47b1109ac90d4d5834b3aa7d326f6b3761d2
-rw-r--r-- | extras/libmemif/src/main.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/extras/libmemif/src/main.c b/extras/libmemif/src/main.c index 870120df997..dde5aff8030 100644 --- a/extras/libmemif/src/main.c +++ b/extras/libmemif/src/main.c @@ -1663,7 +1663,6 @@ memif_msg_queue_free (libmemif_main_t * lm, memif_msg_queue_elt_t ** e) int memif_disconnect_internal (memif_connection_t * c) { - uint16_t num; int err = MEMIF_ERR_SUCCESS, i; /* 0 */ memif_queue_t *mq; libmemif_main_t *lm; @@ -1695,10 +1694,7 @@ memif_disconnect_internal (memif_connection_t * c) if (c->tx_queues != NULL) { - num = - (c->args.is_master) ? c->run_args.num_m2s_rings : c-> - run_args.num_s2m_rings; - for (i = 0; i < num; i++) + for (i = 0; i < c->tx_queues_num; i++) { mq = &c->tx_queues[i]; if (mq != NULL) @@ -1713,13 +1709,11 @@ memif_disconnect_internal (memif_connection_t * c) lm->free (c->tx_queues); c->tx_queues = NULL; } + c->tx_queues_num = 0; if (c->rx_queues != NULL) { - num = - (c->args.is_master) ? c->run_args.num_s2m_rings : c-> - run_args.num_m2s_rings; - for (i = 0; i < num; i++) + for (i = 0; i < c->rx_queues_num; i++) { mq = &c->rx_queues[i]; if (mq != NULL) @@ -1739,6 +1733,7 @@ memif_disconnect_internal (memif_connection_t * c) lm->free (c->rx_queues); c->rx_queues = NULL; } + c->rx_queues_num = 0; for (i = 0; i < c->regions_num; i++) { @@ -2082,6 +2077,7 @@ memif_init_queues (libmemif_main_t * lm, memif_connection_t * conn) mq[x].alloc_bufs = 0; } conn->tx_queues = mq; + conn->tx_queues_num = conn->run_args.num_s2m_rings; mq = (memif_queue_t *) lm->alloc (sizeof (memif_queue_t) * @@ -2107,6 +2103,7 @@ memif_init_queues (libmemif_main_t * lm, memif_connection_t * conn) mq[x].alloc_bufs = 0; } conn->rx_queues = mq; + conn->rx_queues_num = conn->run_args.num_m2s_rings; return MEMIF_ERR_SUCCESS; } |