DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: Nipun Gupta <nipun.gupta@nxp.com>, <dev@dpdk.org>
Cc: <jerin.jacob@caviumnetworks.com>, <nikhil.rao@intel.com>
Subject: Re: [dpdk-dev] [PATCH v2 2/4] net/dpaa2: add API's to support event eth adapter
Date: Fri, 13 Oct 2017 20:25:41 +0530	[thread overview]
Message-ID: <4c751bec-20a1-cb47-4961-abfc35e7cb76@nxp.com> (raw)
In-Reply-To: <1507828729-18194-2-git-send-email-nipun.gupta@nxp.com>

On 10/12/2017 10:48 PM, Nipun Gupta wrote:
> Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
> ---
>  drivers/net/dpaa2/dpaa2_ethdev.c            | 67 +++++++++++++++++++++++++++++
>  drivers/net/dpaa2/dpaa2_ethdev.h            | 15 +++++++
>  drivers/net/dpaa2/dpaa2_rxtx.c              | 20 +++++++++
>  drivers/net/dpaa2/rte_pmd_dpaa2_version.map |  7 +++
>  4 files changed, 109 insertions(+)
>
> diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
> index 39c32b3..724719a 100644
> --- a/drivers/net/dpaa2/dpaa2_ethdev.c
> +++ b/drivers/net/dpaa2/dpaa2_ethdev.c
> @@ -1634,6 +1634,73 @@ void dpaa2_dev_stats_get(struct rte_eth_dev *dev,
>  	return 0;
>  }
>
> +int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
> +		int eth_rx_queue_id,
> +		uint16_t dpcon_id,
> +		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
> +{
> +	struct dpaa2_dev_priv *eth_priv = dev->data->dev_private;
> +	struct fsl_mc_io *dpni = (struct fsl_mc_io *)eth_priv->hw;
> +	struct dpaa2_queue *dpaa2_ethq = eth_priv->rx_vq[eth_rx_queue_id];
> +	uint8_t flow_id = dpaa2_ethq->flow_id;
> +
> +	struct dpni_queue cfg;
> +	uint8_t options;
> +	int ret;
> +
> +	memset(&cfg, 0, sizeof(struct dpni_queue));
> +	options = DPNI_QUEUE_OPT_DEST;
> +	cfg.destination.type = DPNI_DEST_DPCON;
> +	cfg.destination.id = dpcon_id;
> +	cfg.destination.priority = queue_conf->ev.priority;
> +
> +	options |= DPNI_QUEUE_OPT_USER_CTX;
> +	cfg.user_context = (uint64_t)(dpaa2_ethq);
> +
> +	ret = dpni_set_queue(dpni, CMD_PRI_LOW,
> +		eth_priv->token, DPNI_QUEUE_RX,
> +		dpaa2_ethq->tc_index, flow_id, options, &cfg);
> +	if (ret) {
> +		RTE_LOG(ERR, PMD, "Error in dpni_set_queue: ret: %d\n", ret);
> +		return ret;
> +	}
> +
> +	if (queue_conf->ev.sched_type == RTE_SCHED_TYPE_PARALLEL)
> +		dpaa2_ethq->cb = dpaa2_dev_process_parallel_event;
> +	else
> +		return -1;
> +
Should not you check the type supported in the start of function?
This way you will not be doing hw "dpni_set_queue" for not supported case?

> +	memcpy(&dpaa2_ethq->ev, &queue_conf->ev, sizeof(struct rte_event));
> +
> +	return 0;
> +}
> +
> +int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
> +		int eth_rx_queue_id)
> +{
> +	struct dpaa2_dev_priv *eth_priv = dev->data->dev_private;
> +	struct fsl_mc_io *dpni = (struct fsl_mc_io *)eth_priv->hw;
> +	struct dpaa2_queue *dpaa2_ethq = eth_priv->rx_vq[eth_rx_queue_id];
> +	uint8_t flow_id = dpaa2_ethq->flow_id;
> +	struct dpni_queue cfg;
> +	uint8_t options;
> +	int ret;
> +
> +	memset(&cfg, 0, sizeof(struct dpni_queue));
> +	options = DPNI_QUEUE_OPT_DEST;
> +	cfg.destination.type = DPNI_DEST_NONE;
> +
> +	ret = dpni_set_queue(dpni, CMD_PRI_LOW,
> +		eth_priv->token, DPNI_QUEUE_RX,
> +		dpaa2_ethq->tc_index, flow_id, options, &cfg);
> +	if (ret) {
> +		RTE_LOG(ERR, PMD, "Error in dpni_set_queue: ret: %d\n", ret);
> +		return ret;
> +	}
> +
> +	return 0;

trivial one.
you can simply "return ret" in both cases.

> +}
> +
>  static struct eth_dev_ops dpaa2_ethdev_ops = {
>  	.dev_configure	  = dpaa2_eth_dev_configure,
>  	.dev_start	      = dpaa2_dev_start,
> diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h
> index 7b14ae0..b8e94aa 100644
> --- a/drivers/net/dpaa2/dpaa2_ethdev.h
> +++ b/drivers/net/dpaa2/dpaa2_ethdev.h
> @@ -34,6 +34,8 @@
>  #ifndef _DPAA2_ETHDEV_H
>  #define _DPAA2_ETHDEV_H
>
> +#include <rte_event_eth_rx_adapter.h>
> +
>  #include <mc/fsl_dpni.h>
>  #include <mc/fsl_mc_sys.h>
>
> @@ -100,8 +102,21 @@ int dpaa2_remove_flow_dist(struct rte_eth_dev *eth_dev,
>
>  int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv, void *blist);
>
> +int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
> +		int eth_rx_queue_id,
> +		uint16_t dpcon_id,
> +		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf);
> +
> +int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
> +		int eth_rx_queue_id);
> +
>  uint16_t dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs,
>  			       uint16_t nb_pkts);
> +void dpaa2_dev_process_parallel_event(struct qbman_swp *swp,
> +				      const struct qbman_fd *fd,
> +				      const struct qbman_result *dq,
> +				      struct dpaa2_queue *rxq,
> +				      struct rte_event *ev);
>  uint16_t dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
>  uint16_t dummy_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
>  #endif /* _DPAA2_ETHDEV_H */
> diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
> index 7cfa73a..a317f7f 100644
> --- a/drivers/net/dpaa2/dpaa2_rxtx.c
> +++ b/drivers/net/dpaa2/dpaa2_rxtx.c
> @@ -514,6 +514,26 @@ static inline int __attribute__((hot))
>  	return num_rx;
>  }
>
> +void __attribute__((hot))
> +dpaa2_dev_process_parallel_event(struct qbman_swp *swp,
> +				 const struct qbman_fd *fd,
> +				 const struct qbman_result *dq,
> +				 struct dpaa2_queue *rxq,
> +				 struct rte_event *ev)
> +{
> +	ev->mbuf = eth_fd_to_mbuf(fd);
> +
> +	ev->flow_id = rxq->ev.flow_id;
> +	ev->sub_event_type = rxq->ev.sub_event_type;
> +	ev->event_type = RTE_EVENT_TYPE_ETHDEV;
> +	ev->op = RTE_EVENT_OP_NEW;
> +	ev->sched_type = rxq->ev.sched_type;
> +	ev->queue_id = rxq->ev.queue_id;
> +	ev->priority = rxq->ev.priority;
> +
> +	qbman_swp_dqrr_consume(swp, dq);
> +}
> +
>  /*
>   * Callback to handle sending packets through WRIOP based interface
>   */
> diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
> index 8591cc0..b741bc0 100644
> --- a/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
> +++ b/drivers/net/dpaa2/rte_pmd_dpaa2_version.map
> @@ -2,3 +2,10 @@ DPDK_17.05 {
>
>  	local: *;
>  };
> +
> +DPDK_17.11 {
> +	global:
> +
> +	dpaa2_eth_eventq_attach;
> +	dpaa2_eth_eventq_detach;
> +};
>

  reply	other threads:[~2017-10-13 14:55 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-10 17:51 [dpdk-dev] [PATCH 1/4] drivers: add queue parameter in event processing callback Nipun Gupta
2017-10-10 17:51 ` [dpdk-dev] [PATCH 2/4] net/dpaa2: add API's to support event eth adapter Nipun Gupta
2017-10-10 17:51 ` [dpdk-dev] [PATCH 3/4] event/dpaa2: " Nipun Gupta
2017-10-11  3:45   ` Rao, Nikhil
2017-10-11 11:03     ` Nipun Gupta
2017-10-11  4:10   ` Rao, Nikhil
2017-10-11 11:03     ` Nipun Gupta
2017-10-10 17:51 ` [dpdk-dev] [PATCH 4/4] event/dpaa2: improve the err handling and log msg Nipun Gupta
2017-10-12 17:18 ` [dpdk-dev] [PATCH v2 1/4] drivers: add queue parameter in event processing callback Nipun Gupta
2017-10-12 17:18   ` [dpdk-dev] [PATCH v2 2/4] net/dpaa2: add API's to support event eth adapter Nipun Gupta
2017-10-13 14:55     ` Hemant Agrawal [this message]
2017-10-12 17:18   ` [dpdk-dev] [PATCH v2 3/4] event/dpaa2: " Nipun Gupta
2017-10-13  5:57     ` Rao, Nikhil
2017-10-13 14:52       ` Hemant Agrawal
2017-10-12 17:18   ` [dpdk-dev] [PATCH v2 4/4] event/dpaa2: improve the err handling and log msg Nipun Gupta
2017-10-13 14:52     ` Hemant Agrawal
2017-10-13 14:48   ` [dpdk-dev] [PATCH v2 1/4] drivers: add queue parameter in event processing callback Hemant Agrawal
2017-10-16 21:44 ` [dpdk-dev] [PATCH v3 " Nipun Gupta
2017-10-16 21:44   ` [dpdk-dev] [PATCH v3 2/4] net/dpaa2: add API's to support event eth adapter Nipun Gupta
2017-10-16 21:44   ` [dpdk-dev] [PATCH v3 3/4] event/dpaa2: " Nipun Gupta
2017-10-17  5:00     ` Jerin Jacob
2017-10-17 10:28       ` Nipun Gupta
2017-10-16 21:44   ` [dpdk-dev] [PATCH v3 4/4] event/dpaa2: improve the err handling and log msg Nipun Gupta
2017-10-17 16:38 ` [dpdk-dev] [PATCH v4 1/5] drivers: add queue parameter in event processing callback Nipun Gupta
2017-10-17 16:38   ` [dpdk-dev] [PATCH v4 2/5] net/dpaa2: add API's to support event eth adapter Nipun Gupta
2017-10-17 12:32     ` Hemant Agrawal
2017-10-17 16:38   ` [dpdk-dev] [PATCH v4 3/5] drivers: add net as dependency for event drivers Nipun Gupta
2017-10-21 10:05     ` Jerin Jacob
2017-10-17 16:38   ` [dpdk-dev] [PATCH v4 4/5] event/dpaa2: support event eth adapter Nipun Gupta
2017-10-17 16:38   ` [dpdk-dev] [PATCH v4 5/5] event/dpaa2: improve the err handling and log msg Nipun Gupta
2017-10-23 12:37 ` [dpdk-dev] [PATCH v5 1/5] drivers: add queue parameter in event processing callback Nipun Gupta
2017-10-23 12:37   ` [dpdk-dev] [PATCH v5 2/5] net/dpaa2: add API's to support event eth adapter Nipun Gupta
2017-10-23 12:37   ` [dpdk-dev] [PATCH v5 3/5] drivers: add net as dependency for event drivers Nipun Gupta
2017-10-23  6:24     ` Jerin Jacob
2017-10-23 12:37   ` [dpdk-dev] [PATCH v5 4/5] event/dpaa2: support event eth adapter Nipun Gupta
2017-10-23 12:37   ` [dpdk-dev] [PATCH v5 5/5] event/dpaa2: improve the err handling and log msg Nipun Gupta
2017-10-23 17:49   ` [dpdk-dev] [PATCH v5 1/5] drivers: add queue parameter in event processing callback Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4c751bec-20a1-cb47-4961-abfc35e7cb76@nxp.com \
    --to=hemant.agrawal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=nikhil.rao@intel.com \
    --cc=nipun.gupta@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).