13/10/2021 09:41, Thomas Monjalon: > 13/10/2021 02:21, fengchengwen: > > On 2021/10/13 3:09, Thomas Monjalon wrote: > > > 11/10/2021 09:33, Chengwen Feng: > > >> +static void > > >> +dma_release(struct rte_dma_dev *dev) > > >> +{ > > >> + rte_free(dev->dev_private); > > >> + memset(dev, 0, sizeof(struct rte_dma_dev)); > > >> +} > [...] > > >> +int > > >> +rte_dma_pmd_release(const char *name) > > >> +{ > > >> + struct rte_dma_dev *dev; > > >> + > > >> + if (dma_check_name(name) != 0) > > >> + return -EINVAL; > > >> + > > >> + dev = dma_find_by_name(name); > > >> + if (dev == NULL) > > >> + return -EINVAL; > > >> + > > >> + dma_release(dev); > > >> + return 0; > > >> +} > > > > > > Trying to understand the logic of creation/destroy. > > > skeldma_probe > > > \-> skeldma_create > > > \-> rte_dma_pmd_allocate > > > \-> dma_allocate > > > \-> dma_data_prepare > > > \-> dma_dev_data_prepare > > > skeldma_remove > > > \-> skeldma_destroy > > > \-> rte_dma_pmd_release > > > \-> dma_release > > > > This patch only provide device allocate function, the 2st patch provide > > extra logic: > > > > diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c > > index 42a4693bd9..a6a5680d2b 100644 > > --- a/lib/dmadev/rte_dmadev.c > > +++ b/lib/dmadev/rte_dmadev.c > > @@ -201,6 +201,9 @@ rte_dma_pmd_release(const char *name) > > if (dev == NULL) > > return -EINVAL; > > > > + if (dev->state == RTE_DMA_DEV_READY) > > + return rte_dma_close(dev->dev_id); > > + > > dma_release(dev); > > return 0; > > } > > > > So the skeldma remove will be: > > > > skeldma_remove > > \-> skeldma_destroy > > \-> rte_dma_pmd_release > > \-> rte_dma_close > > \-> dma_release > > OK, in this case, no need to dma_release from rte_dma_pmd_release, > because it is already called from rte_dma_close.
Ping for reply please.