Bug 1298
Summary: | memif disconnect thread vs. rx_burst worker thread(s) crash | ||
---|---|---|---|
Product: | DPDK | Reporter: | Mike (bly454) |
Component: | ethdev | Assignee: | dev |
Status: | UNCONFIRMED --- | ||
Severity: | normal | ||
Priority: | Normal | ||
Version: | 21.11 | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All |
Description
Mike
2023-10-12 17:37:37 CEST
We believe there is an additional improvement required to ensure the memif attibutes for a given interface/queue is valid. This is because memif.disconnect will zero out the MQ attributes. As such, the following checks are needed up front in the memif rx-burst function. diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c index 34a25133ca..2ae5db9929 100644 --- a/drivers/net/memif/rte_eth_memif.c +++ b/drivers/net/memif/rte_eth_memif.c @@ -295,7 +295,12 @@ static uint16_t eth_memif_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) { struct memif_queue *mq = queue; + if (unlikely(mq->mempool == NULL)) + return 0; struct pmd_internals *pmd = rte_eth_devices[mq->in_port].data->dev_private; + if (unlikely((pmd->flags & ETH_MEMIF_FLAG_CONNECTED) == 0)) + return 0; + struct pmd_process_private *proc_private = rte_eth_devices[mq->in_port].process_private; memif_ring_t *ring = memif_get_ring_from_queue(proc_private, mq); @@ -313,8 +318,6 @@ eth_memif_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) int ret; struct rte_eth_link link; - if (unlikely((pmd->flags & ETH_MEMIF_FLAG_CONNECTED) == 0)) - return 0; if (unlikely(ring == NULL)) { /* Secondary process will attempt to request regions. */ ret = rte_eth_link_get(mq->in_port, &link); **************************************************************** Here is the supporting evidence of why the above change is necessary. This is from the same BT provided when this defect was submitted. **************************************************************** (gdb) f #0 0x00007f17e374d225 in eth_memif_rx (queue=0x1189023b00, bufs=0x7f17e28100e8, nb_pkts=32) at ../git/drivers/net/memif/rte_eth_memif.c:338 338 last_slot = __atomic_load_n(&ring->head, __ATOMIC_ACQUIRE); (gdb) p mq $78 = (struct memif_queue *) 0x1189023b00 (gdb) p mq->in_port $79 = 0 (gdb) p *mq $80 = { mempool = 0x0, pmd = 0x0, type = MEMIF_RING_C2S, region = 0, in_port = 0, ring_offset = 0, last_head = 0, last_tail = 0, buffers = 0x0, n_pkts = 0, n_bytes = 0, intr_handle = 0x0, log2_ring_size = 0 '\000' } |