From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 667841B1FF for ; Fri, 13 Oct 2017 07:57:25 +0200 (CEST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Oct 2017 22:57:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,369,1503385200"; d="scan'208";a="162659618" Received: from nikhilr-mobl.amr.corp.intel.com (HELO [10.106.138.13]) ([10.106.138.13]) by fmsmga006.fm.intel.com with ESMTP; 12 Oct 2017 22:57:23 -0700 To: Nipun Gupta , dev@dpdk.org Cc: hemant.agrawal@nxp.com, jerin.jacob@caviumnetworks.com References: <1507657887-11366-1-git-send-email-nipun.gupta@nxp.com> <1507828729-18194-1-git-send-email-nipun.gupta@nxp.com> <1507828729-18194-3-git-send-email-nipun.gupta@nxp.com> From: "Rao, Nikhil" Message-ID: <7e7200d2-04cb-2d06-6895-7e3b33178d7c@intel.com> Date: Fri, 13 Oct 2017 11:27:22 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <1507828729-18194-3-git-send-email-nipun.gupta@nxp.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2 3/4] event/dpaa2: support event eth adapter X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Oct 2017 05:57:27 -0000 On 10/12/2017 10:48 PM, Nipun Gupta wrote: > Signed-off-by: Nipun Gupta > --- > drivers/event/Makefile | 4 +- > drivers/event/dpaa2/Makefile | 2 + > drivers/event/dpaa2/dpaa2_eventdev.c | 151 ++++++++++++++++++++++++++++++++++- > drivers/event/dpaa2/dpaa2_eventdev.h | 8 ++ > 4 files changed, 162 insertions(+), 3 deletions(-) > > diff --git a/drivers/event/Makefile b/drivers/event/Makefile > index 3f6b898..accba6e 100644 > --- a/drivers/event/Makefile > +++ b/drivers/event/Makefile > @@ -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 > diff --git a/drivers/event/dpaa2/Makefile b/drivers/event/dpaa2/Makefile > index 3497d09..2d1d7c4 100644 > --- a/drivers/event/dpaa2/Makefile > +++ b/drivers/event/dpaa2/Makefile > @@ -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 > diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c > index 8a6a3e3..ee3a164 100644 > --- a/drivers/event/dpaa2/dpaa2_eventdev.c > +++ b/drivers/event/dpaa2/dpaa2_eventdev.c > @@ -53,11 +53,14 @@ > #include > #include > #include > +#include > +#include > > #include > #include > #include > #include > +#include > #include "dpaa2_eventdev.h" > #include > #include > @@ -557,6 +560,147 @@ 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_all(const struct rte_eventdev *dev, > + const struct rte_eth_dev *eth_dev, > + 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 i, ret; > + > + PMD_DRV_FUNC_TRACE(); > + > + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) { > + ret = dpaa2_eth_eventq_attach(eth_dev, i, > + dpcon_id, queue_conf); > + if (ret) { > + PMD_DRV_ERR("dpaa2_eth_eventq_attach failed: ret %d\n", > + ret); > + goto fail; > + } > + } > + return 0; > +fail: > + for (i = (i - 1); i >= 0 ; i--) > + dpaa2_eth_eventq_detach(eth_dev, i); > + > + return ret; > +} > + > +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(); > + > + if (rx_queue_id == -1) > + return dpaa2_eventdev_eth_queue_add_all(dev, > + eth_dev, queue_conf); > + > + 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_all(const struct rte_eventdev *dev, > + const struct rte_eth_dev *eth_dev) > +{ > + int i, ret; > + > + PMD_DRV_FUNC_TRACE(); > + > + RTE_SET_USED(dev); > + > + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) { > + ret = dpaa2_eth_eventq_detach(eth_dev, i); > + if (ret) { > + PMD_DRV_ERR("dpaa2_eth_eventq_detach 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(); > + > + if (rx_queue_id == -1) > + return dpaa2_eventdev_eth_queue_del_all(dev, eth_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; > +} > + > +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 +716,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 > diff --git a/drivers/event/dpaa2/dpaa2_eventdev.h b/drivers/event/dpaa2/dpaa2_eventdev.h > index f79f78a..ae8e07e 100644 > --- a/drivers/event/dpaa2/dpaa2_eventdev.h > +++ b/drivers/event/dpaa2/dpaa2_eventdev.h > @@ -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; > Reviewed-by: Nikhil Rao