[dpdk-dev,3/4] event/dpaa2: support event eth adapter
Checks
Commit Message
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
drivers/event/Makefile | 4 +-
drivers/event/dpaa2/Makefile | 2 +
drivers/event/dpaa2/dpaa2_eventdev.c | 96 +++++++++++++++++++++++++++++++++++-
drivers/event/dpaa2/dpaa2_eventdev.h | 8 +++
4 files changed, 107 insertions(+), 3 deletions(-)
Comments
On 10/10/2017 11:21 PM, Nipun Gupta wrote:
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
> drivers/event/Makefile | 4 +-
> drivers/event/dpaa2/Makefile | 2 +
> drivers/event/dpaa2/dpaa2_eventdev.c | 96 +++++++++++++++++++++++++++++++++++-
> drivers/event/dpaa2/dpaa2_eventdev.h | 8 +++
> 4 files changed, 107 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
> index 6967741..ca782c3 100644
> --- a/drivers/event/dpaa2/dpaa2_eventdev.c
> +++ b/drivers/event/dpaa2/dpaa2_eventdev.c
> @@ -53,11 +53,14 @@
> #include <rte_memzone.h>
> #include <rte_pci.h>
> #include <rte_vdev.h>
> +#include <rte_ethdev.h>
> +#include <rte_event_eth_rx_adapter.h>
>
> #include <fslmc_vfio.h>
> #include <dpaa2_hw_pvt.h>
> #include <dpaa2_hw_mempool.h>
> #include <dpaa2_hw_dpio.h>
> +#include <dpaa2_ethdev.h>
> #include "dpaa2_eventdev.h"
> #include <portal/dpaa2_hw_pvt.h>
> #include <mc/fsl_dpci.h>
> @@ -557,6 +560,92 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
> RTE_SET_USED(f);
> }
>
> +static int
> +dpaa2_eventdev_eth_caps_get(const struct rte_eventdev *dev,
> + const struct rte_eth_dev *eth_dev,
> + uint32_t *caps)
> +{
> + const char *ethdev_driver = eth_dev->device->driver->name;
> +
> + PMD_DRV_FUNC_TRACE();
> +
> + RTE_SET_USED(dev);
> +
> + if (!strcmp(ethdev_driver, "net_dpaa2"))
> + *caps = RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP;
> + else
> + *caps = RTE_EVENT_ETH_RX_ADAPTER_SW_CAP;
> +
> + return 0;
> +}
> +
> +static int
> +dpaa2_eventdev_eth_queue_add(const struct rte_eventdev *dev,
> + const struct rte_eth_dev *eth_dev,
> + int32_t rx_queue_id,
> + const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
> +{
> + struct dpaa2_eventdev *priv = dev->data->dev_private;
> + uint8_t ev_qid = queue_conf->ev.queue_id;
> + uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
> + int ret;
> +
> + PMD_DRV_FUNC_TRACE();
> +
> + ret = dpaa2_eth_eventq_attach(eth_dev, rx_queue_id,
> + dpcon_id, queue_conf);
> + if (ret) {
> + PMD_DRV_ERR("dpaa2_eth_eventq_attach failed: ret: %d\n", ret);
> + return ret;
> + }
> + return 0;
> +}
> +
> +static int
> +dpaa2_eventdev_eth_queue_del(const struct rte_eventdev *dev,
> + const struct rte_eth_dev *eth_dev,
> + int32_t rx_queue_id)
> +{
> + int ret;
> +
> + PMD_DRV_FUNC_TRACE();
> +
> + RTE_SET_USED(dev);
> +
> + ret = dpaa2_eth_eventq_detach(eth_dev, rx_queue_id);
> + if (ret) {
> + PMD_DRV_ERR("dpaa2_eth_eventq_detach failed: ret: %d\n", ret);
> + return ret;
> + }
> + return 0;
> +
> + return 0;
Duplicate return.
Nikhil
On 10/10/2017 11:21 PM, Nipun Gupta wrote:
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
> drivers/event/Makefile | 4 +-
> drivers/event/dpaa2/Makefile | 2 +
> drivers/event/dpaa2/dpaa2_eventdev.c | 96 +++++++++++++++++++++++++++++++++++-
> drivers/event/dpaa2/dpaa2_eventdev.h | 8 +++
> 4 files changed, 107 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c
> index 6967741..ca782c3 100644
> --- a/drivers/event/dpaa2/dpaa2_eventdev.c
> +++ b/drivers/event/dpaa2/dpaa2_eventdev.c
> @@ -53,11 +53,14 @@
> #include <rte_memzone.h>
> #include <rte_pci.h>
> #include <rte_vdev.h>
> +#include <rte_ethdev.h>
> +#include <rte_event_eth_rx_adapter.h>
>
> #include <fslmc_vfio.h>
> #include <dpaa2_hw_pvt.h>
> #include <dpaa2_hw_mempool.h>
> #include <dpaa2_hw_dpio.h>
> +#include <dpaa2_ethdev.h>
> #include "dpaa2_eventdev.h"
> #include <portal/dpaa2_hw_pvt.h>
> #include <mc/fsl_dpci.h>
> @@ -557,6 +560,92 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
> RTE_SET_USED(f);
> }
>
> +static int
> +dpaa2_eventdev_eth_caps_get(const struct rte_eventdev *dev,
> + const struct rte_eth_dev *eth_dev,
> + uint32_t *caps)
> +{
> + const char *ethdev_driver = eth_dev->device->driver->name;
> +
> + PMD_DRV_FUNC_TRACE();
> +
> + RTE_SET_USED(dev);
> +
> + if (!strcmp(ethdev_driver, "net_dpaa2"))
> + *caps = RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP;
> + else
> + *caps = RTE_EVENT_ETH_RX_ADAPTER_SW_CAP;
> +
> + return 0;
> +}
> +
> +static int
> +dpaa2_eventdev_eth_queue_add(const struct rte_eventdev *dev,
> + const struct rte_eth_dev *eth_dev,
> + int32_t rx_queue_id,
> + const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
> +{
> + struct dpaa2_eventdev *priv = dev->data->dev_private;
> + uint8_t ev_qid = queue_conf->ev.queue_id;
> + uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
> + int ret;
> +
> + PMD_DRV_FUNC_TRACE();
> +
> + ret = dpaa2_eth_eventq_attach(eth_dev, rx_queue_id,
> + dpcon_id, queue_conf);
Shouldn't the _add & _del functions be handling the case where
rx_queue_id == -1 ?
> + if (ret) {
> + PMD_DRV_ERR("dpaa2_eth_eventq_attach failed: ret: %d\n", ret);
> + return ret;
> + }
> + return 0;
> +}
> +
> +static int
> +dpaa2_eventdev_eth_queue_del(const struct rte_eventdev *dev,
> + const struct rte_eth_dev *eth_dev,
> + int32_t rx_queue_id)
> +{
> + int ret;
> +
> + PMD_DRV_FUNC_TRACE();
> +
> + RTE_SET_USED(dev);
> +
> + ret = dpaa2_eth_eventq_detach(eth_dev, rx_queue_id);
> + if (ret) {
> + PMD_DRV_ERR("dpaa2_eth_eventq_detach failed: ret: %d\n", ret);
> + return ret;
> + }
> + return 0;
> +
> + return 0;
> +}
> +
Nikhil
> -----Original Message-----
> From: Rao, Nikhil [mailto:nikhil.rao@intel.com]
> Sent: Wednesday, October 11, 2017 9:15
> To: Nipun Gupta <nipun.gupta@nxp.com>; dev@dpdk.org
> Cc: Hemant Agrawal <hemant.agrawal@nxp.com>;
> jerin.jacob@caviumnetworks.com
> Subject: Re: [PATCH 3/4] event/dpaa2: support event eth adapter
>
>
> On 10/10/2017 11:21 PM, Nipun Gupta wrote:
> > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > ---
> > drivers/event/Makefile | 4 +-
> > drivers/event/dpaa2/Makefile | 2 +
> > drivers/event/dpaa2/dpaa2_eventdev.c | 96
> +++++++++++++++++++++++++++++++++++-
> > drivers/event/dpaa2/dpaa2_eventdev.h | 8 +++
> > 4 files changed, 107 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c
> b/drivers/event/dpaa2/dpaa2_eventdev.c
> > index 6967741..ca782c3 100644
> > --- a/drivers/event/dpaa2/dpaa2_eventdev.c
> > +++ b/drivers/event/dpaa2/dpaa2_eventdev.c
> > @@ -53,11 +53,14 @@
> > #include <rte_memzone.h>
> > #include <rte_pci.h>
> > #include <rte_vdev.h>
> > +#include <rte_ethdev.h>
> > +#include <rte_event_eth_rx_adapter.h>
> >
> > #include <fslmc_vfio.h>
> > #include <dpaa2_hw_pvt.h>
> > #include <dpaa2_hw_mempool.h>
> > #include <dpaa2_hw_dpio.h>
> > +#include <dpaa2_ethdev.h>
> > #include "dpaa2_eventdev.h"
> > #include <portal/dpaa2_hw_pvt.h>
> > #include <mc/fsl_dpci.h>
> > @@ -557,6 +560,92 @@ static void dpaa2_eventdev_process_atomic(struct
> qbman_swp *swp,
> > RTE_SET_USED(f);
> > }
> >
> > +static int
> > +dpaa2_eventdev_eth_caps_get(const struct rte_eventdev *dev,
> > + const struct rte_eth_dev *eth_dev,
> > + uint32_t *caps)
> > +{
> > + const char *ethdev_driver = eth_dev->device->driver->name;
> > +
> > + PMD_DRV_FUNC_TRACE();
> > +
> > + RTE_SET_USED(dev);
> > +
> > + if (!strcmp(ethdev_driver, "net_dpaa2"))
> > + *caps = RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP;
> > + else
> > + *caps = RTE_EVENT_ETH_RX_ADAPTER_SW_CAP;
> > +
> > + return 0;
> > +}
> > +
> > +static int
> > +dpaa2_eventdev_eth_queue_add(const struct rte_eventdev *dev,
> > + const struct rte_eth_dev *eth_dev,
> > + int32_t rx_queue_id,
> > + const struct rte_event_eth_rx_adapter_queue_conf
> *queue_conf)
> > +{
> > + struct dpaa2_eventdev *priv = dev->data->dev_private;
> > + uint8_t ev_qid = queue_conf->ev.queue_id;
> > + uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
> > + int ret;
> > +
> > + PMD_DRV_FUNC_TRACE();
> > +
> > + ret = dpaa2_eth_eventq_attach(eth_dev, rx_queue_id,
> > + dpcon_id, queue_conf);
> > + if (ret) {
> > + PMD_DRV_ERR("dpaa2_eth_eventq_attach failed: ret: %d\n",
> ret);
> > + return ret;
> > + }
> > + return 0;
> > +}
> > +
> > +static int
> > +dpaa2_eventdev_eth_queue_del(const struct rte_eventdev *dev,
> > + const struct rte_eth_dev *eth_dev,
> > + int32_t rx_queue_id)
> > +{
> > + int ret;
> > +
> > + PMD_DRV_FUNC_TRACE();
> > +
> > + RTE_SET_USED(dev);
> > +
> > + ret = dpaa2_eth_eventq_detach(eth_dev, rx_queue_id);
> > + if (ret) {
> > + PMD_DRV_ERR("dpaa2_eth_eventq_detach failed: ret: %d\n",
> ret);
> > + return ret;
> > + }
> > + return 0;
> > +
> > + return 0;
>
> Duplicate return.
Don't know how this came up :/. Ill surely remove in next patch.
>
> Nikhil
> -----Original Message-----
> From: Rao, Nikhil [mailto:nikhil.rao@intel.com]
> Sent: Wednesday, October 11, 2017 9:40
> To: Nipun Gupta <nipun.gupta@nxp.com>; dev@dpdk.org
> Cc: Hemant Agrawal <hemant.agrawal@nxp.com>;
> jerin.jacob@caviumnetworks.com
> Subject: Re: [PATCH 3/4] event/dpaa2: support event eth adapter
>
> On 10/10/2017 11:21 PM, Nipun Gupta wrote:
> > Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> > ---
> > drivers/event/Makefile | 4 +-
> > drivers/event/dpaa2/Makefile | 2 +
> > drivers/event/dpaa2/dpaa2_eventdev.c | 96
> +++++++++++++++++++++++++++++++++++-
> > drivers/event/dpaa2/dpaa2_eventdev.h | 8 +++
> > 4 files changed, 107 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c
> b/drivers/event/dpaa2/dpaa2_eventdev.c
> > index 6967741..ca782c3 100644
> > --- a/drivers/event/dpaa2/dpaa2_eventdev.c
> > +++ b/drivers/event/dpaa2/dpaa2_eventdev.c
> > @@ -53,11 +53,14 @@
> > #include <rte_memzone.h>
> > #include <rte_pci.h>
> > #include <rte_vdev.h>
> > +#include <rte_ethdev.h>
> > +#include <rte_event_eth_rx_adapter.h>
> >
> > #include <fslmc_vfio.h>
> > #include <dpaa2_hw_pvt.h>
> > #include <dpaa2_hw_mempool.h>
> > #include <dpaa2_hw_dpio.h>
> > +#include <dpaa2_ethdev.h>
> > #include "dpaa2_eventdev.h"
> > #include <portal/dpaa2_hw_pvt.h>
> > #include <mc/fsl_dpci.h>
> > @@ -557,6 +560,92 @@ static void dpaa2_eventdev_process_atomic(struct
> qbman_swp *swp,
> > RTE_SET_USED(f);
> > }
> >
> > +static int
> > +dpaa2_eventdev_eth_caps_get(const struct rte_eventdev *dev,
> > + const struct rte_eth_dev *eth_dev,
> > + uint32_t *caps)
> > +{
> > + const char *ethdev_driver = eth_dev->device->driver->name;
> > +
> > + PMD_DRV_FUNC_TRACE();
> > +
> > + RTE_SET_USED(dev);
> > +
> > + if (!strcmp(ethdev_driver, "net_dpaa2"))
> > + *caps = RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP;
> > + else
> > + *caps = RTE_EVENT_ETH_RX_ADAPTER_SW_CAP;
> > +
> > + return 0;
> > +}
> > +
> > +static int
> > +dpaa2_eventdev_eth_queue_add(const struct rte_eventdev *dev,
> > + const struct rte_eth_dev *eth_dev,
> > + int32_t rx_queue_id,
> > + const struct rte_event_eth_rx_adapter_queue_conf
> *queue_conf)
> > +{
> > + struct dpaa2_eventdev *priv = dev->data->dev_private;
> > + uint8_t ev_qid = queue_conf->ev.queue_id;
> > + uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
> > + int ret;
> > +
> > + PMD_DRV_FUNC_TRACE();
> > +
> > + ret = dpaa2_eth_eventq_attach(eth_dev, rx_queue_id,
> > + dpcon_id, queue_conf);
>
> Shouldn't the _add & _del functions be handling the case where
> rx_queue_id == -1 ?
Thanks for pointing. I'll send a patch asap supporting this.
>
> > + if (ret) {
> > + PMD_DRV_ERR("dpaa2_eth_eventq_attach failed: ret: %d\n",
> ret);
> > + return ret;
> > + }
> > + return 0;
> > +}
> > +
> > +static int
> > +dpaa2_eventdev_eth_queue_del(const struct rte_eventdev *dev,
> > + const struct rte_eth_dev *eth_dev,
> > + int32_t rx_queue_id)
> > +{
> > + int ret;
> > +
> > + PMD_DRV_FUNC_TRACE();
> > +
> > + RTE_SET_USED(dev);
> > +
> > + ret = dpaa2_eth_eventq_detach(eth_dev, rx_queue_id);
> > + if (ret) {
> > + PMD_DRV_ERR("dpaa2_eth_eventq_detach failed: ret: %d\n",
> ret);
> > + return ret;
> > + }
> > + return 0;
> > +
> > + return 0;
> > +}
> > +
>
> Nikhil
@@ -31,7 +31,7 @@
include $(RTE_SDK)/mk/rte.vars.mk
-core-libs := librte_eal librte_eventdev
+core-libs := librte_eal librte_ether librte_eventdev
DIRS-$(CONFIG_RTE_LIBRTE_PMD_SKELETON_EVENTDEV) += skeleton
DEPDIRS-skeleton = $(core-libs)
@@ -40,6 +40,6 @@ DEPDIRS-sw = $(core-libs) librte_kvargs librte_ring
DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += octeontx
DEPDIRS-octeontx = $(core-libs)
DIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV) += dpaa2
-DEPDIRS-dpaa2 = $(core-libs) librte_bus_fslmc
+DEPDIRS-dpaa2 = $(core-libs) librte_bus_fslmc librte_pmd_dpaa2
include $(RTE_SDK)/mk/rte.subdir.mk
@@ -45,6 +45,8 @@ CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/portal
CFLAGS += -I$(RTE_SDK)/drivers/mempool/dpaa2
CFLAGS += -I$(RTE_SDK)/drivers/event/dpaa2
CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal
+CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2
+CFLAGS += -I$(RTE_SDK)/drivers/net/dpaa2/mc
# versioning export map
EXPORT_MAP := rte_pmd_dpaa2_event_version.map
@@ -53,11 +53,14 @@
#include <rte_memzone.h>
#include <rte_pci.h>
#include <rte_vdev.h>
+#include <rte_ethdev.h>
+#include <rte_event_eth_rx_adapter.h>
#include <fslmc_vfio.h>
#include <dpaa2_hw_pvt.h>
#include <dpaa2_hw_mempool.h>
#include <dpaa2_hw_dpio.h>
+#include <dpaa2_ethdev.h>
#include "dpaa2_eventdev.h"
#include <portal/dpaa2_hw_pvt.h>
#include <mc/fsl_dpci.h>
@@ -557,6 +560,92 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
RTE_SET_USED(f);
}
+static int
+dpaa2_eventdev_eth_caps_get(const struct rte_eventdev *dev,
+ const struct rte_eth_dev *eth_dev,
+ uint32_t *caps)
+{
+ const char *ethdev_driver = eth_dev->device->driver->name;
+
+ PMD_DRV_FUNC_TRACE();
+
+ RTE_SET_USED(dev);
+
+ if (!strcmp(ethdev_driver, "net_dpaa2"))
+ *caps = RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP;
+ else
+ *caps = RTE_EVENT_ETH_RX_ADAPTER_SW_CAP;
+
+ return 0;
+}
+
+static int
+dpaa2_eventdev_eth_queue_add(const struct rte_eventdev *dev,
+ const struct rte_eth_dev *eth_dev,
+ int32_t rx_queue_id,
+ const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
+{
+ struct dpaa2_eventdev *priv = dev->data->dev_private;
+ uint8_t ev_qid = queue_conf->ev.queue_id;
+ uint16_t dpcon_id = priv->evq_info[ev_qid].dpcon->dpcon_id;
+ int ret;
+
+ PMD_DRV_FUNC_TRACE();
+
+ ret = dpaa2_eth_eventq_attach(eth_dev, rx_queue_id,
+ dpcon_id, queue_conf);
+ if (ret) {
+ PMD_DRV_ERR("dpaa2_eth_eventq_attach failed: ret: %d\n", ret);
+ return ret;
+ }
+ return 0;
+}
+
+static int
+dpaa2_eventdev_eth_queue_del(const struct rte_eventdev *dev,
+ const struct rte_eth_dev *eth_dev,
+ int32_t rx_queue_id)
+{
+ int ret;
+
+ PMD_DRV_FUNC_TRACE();
+
+ RTE_SET_USED(dev);
+
+ ret = dpaa2_eth_eventq_detach(eth_dev, rx_queue_id);
+ if (ret) {
+ PMD_DRV_ERR("dpaa2_eth_eventq_detach failed: ret: %d\n", ret);
+ return ret;
+ }
+ return 0;
+
+ return 0;
+}
+
+static int
+dpaa2_eventdev_eth_start(const struct rte_eventdev *dev,
+ const struct rte_eth_dev *eth_dev)
+{
+ PMD_DRV_FUNC_TRACE();
+
+ RTE_SET_USED(dev);
+ RTE_SET_USED(eth_dev);
+
+ return 0;
+}
+
+static int
+dpaa2_eventdev_eth_stop(const struct rte_eventdev *dev,
+ const struct rte_eth_dev *eth_dev)
+{
+ PMD_DRV_FUNC_TRACE();
+
+ RTE_SET_USED(dev);
+ RTE_SET_USED(eth_dev);
+
+ return 0;
+}
+
static const struct rte_eventdev_ops dpaa2_eventdev_ops = {
.dev_infos_get = dpaa2_eventdev_info_get,
.dev_configure = dpaa2_eventdev_configure,
@@ -572,7 +661,12 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp,
.port_link = dpaa2_eventdev_port_link,
.port_unlink = dpaa2_eventdev_port_unlink,
.timeout_ticks = dpaa2_eventdev_timeout_ticks,
- .dump = dpaa2_eventdev_dump
+ .dump = dpaa2_eventdev_dump,
+ .eth_rx_adapter_caps_get = dpaa2_eventdev_eth_caps_get,
+ .eth_rx_adapter_queue_add = dpaa2_eventdev_eth_queue_add,
+ .eth_rx_adapter_queue_del = dpaa2_eventdev_eth_queue_del,
+ .eth_rx_adapter_start = dpaa2_eventdev_eth_start,
+ .eth_rx_adapter_stop = dpaa2_eventdev_eth_stop,
};
static int
@@ -74,6 +74,14 @@ enum {
DPAA2_EVENT_DPCI_MAX_QUEUES
};
+#define RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP \
+ (RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT | \
+ RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ | \
+ RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID)
+/**< Ethernet Rx adapter cap to return If the packet transfers from
+ * the ethdev to eventdev with DPAA2 devices.
+ */
+
struct dpaa2_dpcon_dev {
TAILQ_ENTRY(dpaa2_dpcon_dev) next;
struct fsl_mc_io dpcon;