* [PATCH v1 2/2] dmadev: get DMA device using device ID
2023-09-18 12:32 [PATCH v1 1/2] dmadev: add DMA operation structure Amit Prakash Shukla
@ 2023-09-18 12:32 ` Amit Prakash Shukla
2023-09-18 13:42 ` Jerin Jacob
2023-09-18 12:59 ` [PATCH v1 1/2] dmadev: add DMA operation structure Bruce Richardson
2023-09-19 11:41 ` [PATCH v2] dmadev: get DMA device using device ID Amit Prakash Shukla
2 siblings, 1 reply; 9+ messages in thread
From: Amit Prakash Shukla @ 2023-09-18 12:32 UTC (permalink / raw)
To: Chengwen Feng, Kevin Laatz, Bruce Richardson
Cc: dev, jerinj, mb, conor.walsh, vattunuru, g.singh, sachin.saxena,
hemant.agrawal, cheng1.jiang, ndabilpuram, anoobj,
Amit Prakash Shukla
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(+)
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: *;
};
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v1 2/2] dmadev: get DMA device using device ID
2023-09-18 12:32 ` [PATCH v1 2/2] dmadev: get DMA device using device ID Amit Prakash Shukla
@ 2023-09-18 13:42 ` Jerin Jacob
2023-09-18 13:47 ` [EXT] " Amit Prakash Shukla
0 siblings, 1 reply; 9+ messages in thread
From: Jerin Jacob @ 2023-09-18 13:42 UTC (permalink / raw)
To: Amit Prakash Shukla
Cc: Chengwen Feng, Kevin Laatz, Bruce Richardson, dev, jerinj, mb,
conor.walsh, vattunuru, g.singh, sachin.saxena, hemant.agrawal,
cheng1.jiang, ndabilpuram, anoobj
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
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [EXT] Re: [PATCH v1 2/2] dmadev: get DMA device using device ID
2023-09-18 13:42 ` Jerin Jacob
@ 2023-09-18 13:47 ` Amit Prakash Shukla
0 siblings, 0 replies; 9+ messages in thread
From: Amit Prakash Shukla @ 2023-09-18 13:47 UTC (permalink / raw)
To: Jerin Jacob
Cc: Chengwen Feng, Kevin Laatz, Bruce Richardson, dev@dpdk.org,
Jerin Jacob Kollanukkaran, mb@smartsharesystems.com,
conor.walsh@intel.com, Vamsi Krishna Attunuru, g.singh@nxp.com,
sachin.saxena@oss.nxp.com, hemant.agrawal@nxp.com,
cheng1.jiang@intel.com, Nithin Kumar Dabilpuram, Anoob Joseph
> -----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
> >
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1 1/2] dmadev: add DMA operation structure
2023-09-18 12:32 [PATCH v1 1/2] dmadev: add DMA operation structure Amit Prakash Shukla
2023-09-18 12:32 ` [PATCH v1 2/2] dmadev: get DMA device using device ID Amit Prakash Shukla
@ 2023-09-18 12:59 ` Bruce Richardson
2023-09-18 13:42 ` [EXT] " Amit Prakash Shukla
2023-09-19 11:41 ` [PATCH v2] dmadev: get DMA device using device ID Amit Prakash Shukla
2 siblings, 1 reply; 9+ messages in thread
From: Bruce Richardson @ 2023-09-18 12:59 UTC (permalink / raw)
To: Amit Prakash Shukla
Cc: Chengwen Feng, Kevin Laatz, dev, jerinj, mb, conor.walsh,
vattunuru, g.singh, sachin.saxena, hemant.agrawal, cheng1.jiang,
ndabilpuram, anoobj
On Mon, Sep 18, 2023 at 06:02:26PM +0530, Amit Prakash Shukla wrote:
> For the event based DMA transfer, all the required parameters are to
> be sent as part of a structure. This patch adds a structure
> containing the parameters for event based DMA operation.
>
> Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>
> ---
> lib/dmadev/rte_dmadev.h | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/lib/dmadev/rte_dmadev.h b/lib/dmadev/rte_dmadev.h
> index b157ab7600..bf8db2d28d 100644
> --- a/lib/dmadev/rte_dmadev.h
> +++ b/lib/dmadev/rte_dmadev.h
> @@ -794,6 +794,18 @@ struct rte_dma_sge {
> uint32_t length; /**< The DMA operation length. */
> };
>
> +/**
> + * A structure used to hold event based DMA operation request entry.
> + */
> +struct rte_dma_op {
Would it be better called rte_dma_event_op, if it's just for use with
eventdev?
> + struct rte_dma_sge *src_seg; /**< Source segments. */
> + struct rte_dma_sge *dst_seg; /**< Destination segments. */
> + uint16_t nb_src; /**< Number of source segments. */
> + uint16_t nb_dst; /**< Number of destination segments. */
> + uint64_t flags; /**< Flags related to the operation. */
> + struct rte_mempool *op_mp; /**< Mempool from which op is allocated. */
> +};
> +
> #include "rte_dmadev_core.h"
>
> /**@{@name DMA operation flag
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [EXT] Re: [PATCH v1 1/2] dmadev: add DMA operation structure
2023-09-18 12:59 ` [PATCH v1 1/2] dmadev: add DMA operation structure Bruce Richardson
@ 2023-09-18 13:42 ` Amit Prakash Shukla
0 siblings, 0 replies; 9+ messages in thread
From: Amit Prakash Shukla @ 2023-09-18 13:42 UTC (permalink / raw)
To: Bruce Richardson
Cc: Chengwen Feng, Kevin Laatz, dev@dpdk.org,
Jerin Jacob Kollanukkaran, mb@smartsharesystems.com,
conor.walsh@intel.com, Vamsi Krishna Attunuru, g.singh@nxp.com,
sachin.saxena@oss.nxp.com, hemant.agrawal@nxp.com,
cheng1.jiang@intel.com, Nithin Kumar Dabilpuram, Anoob Joseph
Hi Bruce,
Thanks for the review. Please see my reply in-line.
> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: Monday, September 18, 2023 6:30 PM
> To: Amit Prakash Shukla <amitprakashs@marvell.com>
> Cc: Chengwen Feng <fengchengwen@huawei.com>; Kevin Laatz
> <kevin.laatz@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 1/2] dmadev: add DMA operation structure
>
> External Email
>
> ----------------------------------------------------------------------
> On Mon, Sep 18, 2023 at 06:02:26PM +0530, Amit Prakash Shukla wrote:
> > For the event based DMA transfer, all the required parameters are to
> > be sent as part of a structure. This patch adds a structure containing
> > the parameters for event based DMA operation.
> >
> > Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>
> > ---
> > lib/dmadev/rte_dmadev.h | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/lib/dmadev/rte_dmadev.h b/lib/dmadev/rte_dmadev.h index
> > b157ab7600..bf8db2d28d 100644
> > --- a/lib/dmadev/rte_dmadev.h
> > +++ b/lib/dmadev/rte_dmadev.h
> > @@ -794,6 +794,18 @@ struct rte_dma_sge {
> > uint32_t length; /**< The DMA operation length. */ };
> >
> > +/**
> > + * A structure used to hold event based DMA operation request entry.
> > + */
> > +struct rte_dma_op {
>
> Would it be better called rte_dma_event_op, if it's just for use with
> eventdev?
Yeah, this is used only for the eventdev. I will rename it to rte_event_dma_adapter_op and move this structure to rte_event_dma_adapter header file as part of dma adapter eventdev series.
I will send v2 for this series. Thanks!
>
> > + struct rte_dma_sge *src_seg; /**< Source segments. */
> > + struct rte_dma_sge *dst_seg; /**< Destination segments. */
> > + uint16_t nb_src; /**< Number of source segments. */
> > + uint16_t nb_dst; /**< Number of destination segments. */
> > + uint64_t flags; /**< Flags related to the operation. */
> > + struct rte_mempool *op_mp; /**< Mempool from which op is
> allocated. */
> > +};
> > +
> > #include "rte_dmadev_core.h"
> >
> > /**@{@name DMA operation flag
> > --
> > 2.25.1
> >
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2] dmadev: get DMA device using device ID
2023-09-18 12:32 [PATCH v1 1/2] dmadev: add DMA operation structure Amit Prakash Shukla
2023-09-18 12:32 ` [PATCH v1 2/2] dmadev: get DMA device using device ID Amit Prakash Shukla
2023-09-18 12:59 ` [PATCH v1 1/2] dmadev: add DMA operation structure Bruce Richardson
@ 2023-09-19 11:41 ` Amit Prakash Shukla
2023-09-21 15:43 ` Jerin Jacob
2 siblings, 1 reply; 9+ messages in thread
From: Amit Prakash Shukla @ 2023-09-19 11:41 UTC (permalink / raw)
To: Chengwen Feng, Kevin Laatz, Bruce Richardson
Cc: dev, jerinj, conor.walsh, vattunuru, g.singh, sachin.saxena,
hemant.agrawal, cheng1.jiang, ndabilpuram, anoobj, mb,
Amit Prakash Shukla
DMA library has a function to get DMA device based on device name but
there is no function to get DMA device using device id.
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>
---
v2:
- Dropped patch with dma event op structure.
- Resolved review suggestions.
lib/dmadev/rte_dmadev.c | 12 ++++++++++++
lib/dmadev/rte_dmadev_pmd.h | 15 +++++++++++++++
lib/dmadev/version.map | 1 +
3 files changed, 28 insertions(+)
diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c
index bf7d5ec519..d82464f0ca 100644
--- a/lib/dmadev/rte_dmadev.c
+++ b/lib/dmadev/rte_dmadev.c
@@ -121,6 +121,18 @@ 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 || dev_id >= dma_devices_max)
+ return NULL;
+
+ if (rte_dma_devices[dev_id].state == RTE_DMA_DEV_UNUSED)
+ 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..b1f50c3931 100644
--- a/lib/dmadev/rte_dmadev_pmd.h
+++ b/lib/dmadev/rte_dmadev_pmd.h
@@ -167,6 +167,21 @@ 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.
+ *
+ * @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..22aaa73419 100644
--- a/lib/dmadev/version.map
+++ b/lib/dmadev/version.map
@@ -25,6 +25,7 @@ INTERNAL {
rte_dma_fp_objs;
rte_dma_pmd_allocate;
+ rte_dma_pmd_dev_get;
rte_dma_pmd_release;
local: *;
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2] dmadev: get DMA device using device ID
2023-09-19 11:41 ` [PATCH v2] dmadev: get DMA device using device ID Amit Prakash Shukla
@ 2023-09-21 15:43 ` Jerin Jacob
2023-09-26 11:09 ` [EXT] " Amit Prakash Shukla
0 siblings, 1 reply; 9+ messages in thread
From: Jerin Jacob @ 2023-09-21 15:43 UTC (permalink / raw)
To: Amit Prakash Shukla
Cc: Chengwen Feng, Kevin Laatz, Bruce Richardson, dev, jerinj,
conor.walsh, vattunuru, g.singh, sachin.saxena, hemant.agrawal,
cheng1.jiang, ndabilpuram, anoobj, mb
On Tue, Sep 19, 2023 at 5:12 PM Amit Prakash Shukla
<amitprakashs@marvell.com> wrote:
>
> DMA library has a function to get DMA device based on device name but
> there is no function to get DMA device using device id.
>
> Added a function that lookup for the dma device using device id and
> returns the pointer to the same.
Looks like it is useful for getting nb_vchan. Could you use info_get()
API instead as it can be cached in slow path for DMA adapter?
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [EXT] Re: [PATCH v2] dmadev: get DMA device using device ID
2023-09-21 15:43 ` Jerin Jacob
@ 2023-09-26 11:09 ` Amit Prakash Shukla
0 siblings, 0 replies; 9+ messages in thread
From: Amit Prakash Shukla @ 2023-09-26 11:09 UTC (permalink / raw)
To: Jerin Jacob
Cc: Chengwen Feng, Kevin Laatz, Bruce Richardson, dev@dpdk.org,
Jerin Jacob Kollanukkaran, conor.walsh@intel.com,
Vamsi Krishna Attunuru, g.singh@nxp.com,
sachin.saxena@oss.nxp.com, hemant.agrawal@nxp.com,
cheng1.jiang@intel.com, Nithin Kumar Dabilpuram, Anoob Joseph,
mb@smartsharesystems.com
> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Thursday, September 21, 2023 9:13 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>;
> 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>;
> mb@smartsharesystems.com
> Subject: [EXT] Re: [PATCH v2] dmadev: get DMA device using device ID
>
> External Email
>
> ----------------------------------------------------------------------
> On Tue, Sep 19, 2023 at 5:12 PM Amit Prakash Shukla
> <amitprakashs@marvell.com> wrote:
> >
> > DMA library has a function to get DMA device based on device name but
> > there is no function to get DMA device using device id.
> >
> > Added a function that lookup for the dma device using device id and
> > returns the pointer to the same.
>
> Looks like it is useful for getting nb_vchan. Could you use info_get() API
> instead as it can be cached in slow path for DMA adapter?
Yeah, we can cache nb_vchan using rte_dma_info_get. We can drop the patch. Thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread