[v1,2/2] dmadev: get DMA device using device ID

Message ID 20230918123227.1562074-2-amitprakashs@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v1,1/2] dmadev: add DMA operation structure |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS

Commit Message

Amit Prakash Shukla Sept. 18, 2023, 12:32 p.m. UTC
  Added a function that lookup for the dma device using device id and
returns the pointer to the same.

Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>
---
 lib/dmadev/rte_dmadev.c     |  9 +++++++++
 lib/dmadev/rte_dmadev_pmd.h | 16 ++++++++++++++++
 lib/dmadev/version.map      |  1 +
 3 files changed, 26 insertions(+)
  

Comments

Jerin Jacob Sept. 18, 2023, 1:42 p.m. UTC | #1
On Mon, Sep 18, 2023 at 6:02 PM Amit Prakash Shukla
<amitprakashs@marvell.com> wrote:
> dmadev: get DMA device using device ID

dmadev: add PMD API to get DMA device using device ID
or so

>
> Added a function that lookup for the dma device using device id and

internal function that

> returns the pointer to the same.
>
> Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>
>  #endif
> diff --git a/lib/dmadev/version.map b/lib/dmadev/version.map
> index 7031d6b335..cdad39044d 100644
> --- a/lib/dmadev/version.map
> +++ b/lib/dmadev/version.map
> @@ -26,6 +26,7 @@ INTERNAL {
>         rte_dma_fp_objs;
>         rte_dma_pmd_allocate;
>         rte_dma_pmd_release;
> +       rte_dma_pmd_dev_get;

Move after rte_dma_pmd_allocate() to sort in alphabetical order.


>
>         local: *;
>  };
> --
> 2.25.1
>
  
Amit Prakash Shukla Sept. 18, 2023, 1:47 p.m. UTC | #2
> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Monday, September 18, 2023 7:12 PM
> To: Amit Prakash Shukla <amitprakashs@marvell.com>
> Cc: Chengwen Feng <fengchengwen@huawei.com>; Kevin Laatz
> <kevin.laatz@intel.com>; Bruce Richardson <bruce.richardson@intel.com>;
> dev@dpdk.org; Jerin Jacob Kollanukkaran <jerinj@marvell.com>;
> mb@smartsharesystems.com; conor.walsh@intel.com; Vamsi Krishna
> Attunuru <vattunuru@marvell.com>; g.singh@nxp.com;
> sachin.saxena@oss.nxp.com; hemant.agrawal@nxp.com;
> cheng1.jiang@intel.com; Nithin Kumar Dabilpuram
> <ndabilpuram@marvell.com>; Anoob Joseph <anoobj@marvell.com>
> Subject: [EXT] Re: [PATCH v1 2/2] dmadev: get DMA device using device ID
> 
> External Email
> 
> ----------------------------------------------------------------------
> On Mon, Sep 18, 2023 at 6:02 PM Amit Prakash Shukla
> <amitprakashs@marvell.com> wrote:
> > dmadev: get DMA device using device ID
> 
> dmadev: add PMD API to get DMA device using device ID or so
> 
> >
> > Added a function that lookup for the dma device using device id and
> 
> internal function that
> 
> > returns the pointer to the same.
> >
> > Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>  #endif
> > diff --git a/lib/dmadev/version.map b/lib/dmadev/version.map index
> > 7031d6b335..cdad39044d 100644
> > --- a/lib/dmadev/version.map
> > +++ b/lib/dmadev/version.map
> > @@ -26,6 +26,7 @@ INTERNAL {
> >         rte_dma_fp_objs;
> >         rte_dma_pmd_allocate;
> >         rte_dma_pmd_release;
> > +       rte_dma_pmd_dev_get;
> 
> Move after rte_dma_pmd_allocate() to sort in alphabetical order.

Ack. I will change it as part of V2. Thanks.

> 
> 
> >
> >         local: *;
> >  };
> > --
> > 2.25.1
> >
  

Patch

diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c
index bf7d5ec519..f1783c971b 100644
--- a/lib/dmadev/rte_dmadev.c
+++ b/lib/dmadev/rte_dmadev.c
@@ -121,6 +121,15 @@  dma_find_by_name(const char *name)
 	return NULL;
 }
 
+struct rte_dma_dev*
+rte_dma_pmd_dev_get(uint8_t dev_id)
+{
+	if (rte_dma_devices == NULL)
+		return NULL;
+
+	return &rte_dma_devices[dev_id];
+}
+
 static void dma_fp_object_dummy(struct rte_dma_fp_object *obj);
 
 static int
diff --git a/lib/dmadev/rte_dmadev_pmd.h b/lib/dmadev/rte_dmadev_pmd.h
index c61cedfb23..f8dd970b88 100644
--- a/lib/dmadev/rte_dmadev_pmd.h
+++ b/lib/dmadev/rte_dmadev_pmd.h
@@ -167,6 +167,22 @@  struct rte_dma_dev *rte_dma_pmd_allocate(const char *name, int numa_node,
 __rte_internal
 int rte_dma_pmd_release(const char *name);
 
+/**
+ * @internal
+ *
+ * Get the rte_dma_dev structure device pointer for the device. Assumes a
+ * valid device index.
+ *
+ * @param dev_id
+ *   Device ID value to select the device structure.
+ *
+ * @return
+ *   - rte_dma_dev structure pointer for the given device ID on success, NULL
+ *   otherwise
+ */
+__rte_internal
+struct rte_dma_dev *rte_dma_pmd_dev_get(uint8_t dev_id);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/dmadev/version.map b/lib/dmadev/version.map
index 7031d6b335..cdad39044d 100644
--- a/lib/dmadev/version.map
+++ b/lib/dmadev/version.map
@@ -26,6 +26,7 @@  INTERNAL {
 	rte_dma_fp_objs;
 	rte_dma_pmd_allocate;
 	rte_dma_pmd_release;
+	rte_dma_pmd_dev_get;
 
 	local: *;
 };