On 10/10/2017 11:21 PM, Nipun Gupta wrote:
Signed-off-by: Nipun Gupta <nipun.gu...@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

Reply via email to