DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Rao, Nikhil" <nikhil.rao@intel.com>
To: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>,
	santosh.shukla@caviumnetworks.com,
	jerin.jacob@caviumnetworks.com
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH 2/3] event/octeontx: add support for event Rx adapter
Date: Tue, 17 Oct 2017 16:41:44 +0530	[thread overview]
Message-ID: <51ebfd06-c9ff-965e-f0ad-b2724f6d76c1@intel.com> (raw)
In-Reply-To: <1508230393-27018-2-git-send-email-pbhagavatula@caviumnetworks.com>

On 10/17/2017 2:23 PM, Pavan Nikhilesh wrote:
> Add Rx adapter queue add and delete API for both generic eth_devices as
> well as HW backed eth_octeontx which supports direct event injection to
> event device.
> The HW injected event needs to be converted into mbuf, previously this
> was done in eth_octeontx during rx_burst now it is moved to
> event_octeontx as events from Rx adapter are dequeued directly from
> event device.
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> ---
>   drivers/event/octeontx/Makefile       |   1 +
>   drivers/event/octeontx/ssovf_evdev.c  | 126 ++++++++++++++++++++++++++++++++++
>   drivers/event/octeontx/ssovf_evdev.h  |   1 +
>   drivers/event/octeontx/ssovf_worker.h |  31 ++++++++-
>   4 files changed, 156 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile
> index 08fc167..7f7b9b3 100644
> --- a/drivers/event/octeontx/Makefile
> +++ b/drivers/event/octeontx/Makefile
> @@ -39,6 +39,7 @@ LIB = librte_pmd_octeontx_ssovf.a
>   
>   CFLAGS += $(WERROR_FLAGS)
>   CFLAGS += -I$(RTE_SDK)/drivers/mempool/octeontx/
> +CFLAGS += -I$(RTE_SDK)/drivers/net/octeontx/
>   
>   EXPORT_MAP := rte_pmd_octeontx_ssovf_version.map
>   
> diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c
> index d829b49..7bdc85d 100644
> --- a/drivers/event/octeontx/ssovf_evdev.c
> +++ b/drivers/event/octeontx/ssovf_evdev.c
> @@ -36,6 +36,8 @@
>   #include <rte_debug.h>
>   #include <rte_dev.h>
>   #include <rte_eal.h>
> +#include <rte_ethdev.h>
> +#include <rte_event_eth_rx_adapter.h>
>   #include <rte_lcore.h>
>   #include <rte_log.h>
>   #include <rte_malloc.h>
> @@ -395,6 +397,123 @@ ssows_dump(struct ssows *ws, FILE *f)
>   	fprintf(f, "\tpwqp=0x%"PRIx64"\n", val);
>   }
>   
> +static int
> +ssovf_eth_rx_adapter_caps_get(const struct rte_eventdev *dev,
> +		const struct rte_eth_dev *eth_dev, uint32_t *caps)
> +{
> +	int ret;
> +	RTE_SET_USED(dev);
> +
> +	ret = strncmp(eth_dev->data->name, "eth_octeontx", 12);
> +	if (ret)
> +		*caps = RTE_EVENT_ETH_RX_ADAPTER_SW_CAP;
> +	else
> +		*caps = RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT;
> +
> +	return 0;
> +}
> +
> +static int
> +ssovf_eth_rx_adapter_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)
> +{
> +	int ret = 0;
> +	const struct octeontx_nic *nic = eth_dev->data->dev_private;
> +	pki_mod_qos_t pki_qos;
> +	RTE_SET_USED(dev);
> +
> +	ret = strncmp(eth_dev->data->name, "eth_octeontx", 12);
> +	if (ret)
> +		return -EINVAL;
> +
> +	if (rx_queue_id >= 0)
> +		return -EINVAL;
> +
> +	if (queue_conf->ev.sched_type == RTE_SCHED_TYPE_PARALLEL)
> +		return -ENOTSUP;
> +
> +	memset(&pki_qos, 0, sizeof(pki_mod_qos_t));
> +
> +	pki_qos.port_type = 0;
> +	pki_qos.index = 0;
> +	pki_qos.mmask.f_tag_type = 1;
> +	pki_qos.mmask.f_port_add = 1;
> +	pki_qos.mmask.f_grp_ok = 1;
> +	pki_qos.mmask.f_grp_bad = 1;
> +	pki_qos.mmask.f_grptag_ok = 1;
> +	pki_qos.mmask.f_grptag_bad = 1;
> +
> +	pki_qos.tag_type = queue_conf->ev.sched_type;
> +	pki_qos.qos_entry.port_add = 0;
> +	pki_qos.qos_entry.ggrp_ok = queue_conf->ev.queue_id;
> +	pki_qos.qos_entry.ggrp_bad = queue_conf->ev.queue_id;
> +	pki_qos.qos_entry.grptag_bad = 0;
> +	pki_qos.qos_entry.grptag_ok = 0;
> +
> +	ret = octeontx_pki_port_modify_qos(nic->port_id, &pki_qos);
> +	if (ret < 0)
> +		ssovf_log_err("failed to modify QOS, port=%d, q=%d",
> +				nic->port_id, queue_conf->ev.queue_id);
> +
> +	return ret;
> +}
> +
> +static int
> +ssovf_eth_rx_adapter_queue_del(const struct rte_eventdev *dev,
> +		const struct rte_eth_dev *eth_dev, int32_t rx_queue_id)
> +{
> +	int ret = 0;
> +	const struct octeontx_nic *nic = eth_dev->data->dev_private;
> +	pki_del_qos_t pki_qos;
> +	RTE_SET_USED(dev);
> +	RTE_SET_USED(rx_queue_id);
> +
> +	ret = strncmp(eth_dev->data->name, "eth_octeontx", 12);
> +	if (ret)
> +		return -EINVAL;
> +
> +	pki_qos.port_type = 0;
> +	pki_qos.index = 0;
> +	memset(&pki_qos, 0, sizeof(pki_del_qos_t));
> +	ret = octeontx_pki_port_delete_qos(nic->port_id, &pki_qos);
> +	if (ret < 0)
> +		ssovf_log_err("Failed to delete QOS port=%d, q=%d",
> +				nic->port_id, queue_conf->ev.queue_id);
> +	return ret;
> +}
> +
> +static int
> +ssovf_eth_rx_adapter_start(const struct rte_eventdev *dev,
> +					const struct rte_eth_dev *eth_dev)
> +{
> +	int ret;
> +	const struct octeontx_nic *nic = eth_dev->data->dev_private;
> +	RTE_SET_USED(dev);
> +
> +	ret = strncmp(eth_dev->data->name, "eth_octeontx", 12);
> +	if (ret)
> +		return 0;
> +	octeontx_pki_port_start(nic->port_id);
> +	return 0;
> +}
> +
> +
> +static int
> +ssovf_eth_rx_adapter_stop(const struct rte_eventdev *dev,
> +		const struct rte_eth_dev *eth_dev)
> +{
> +	int ret;
> +	const struct octeontx_nic *nic = eth_dev->data->dev_private;
> +	RTE_SET_USED(dev);
> +
> +	ret = strncmp(eth_dev->data->name, "eth_octeontx", 12);
> +	if (ret)
> +		return 0;
> +	octeontx_pki_port_stop(nic->port_id);
> +	return 0;
> +}
> +
>   static void
>   ssovf_dump(struct rte_eventdev *dev, FILE *f)
>   {
> @@ -488,6 +607,13 @@ static const struct rte_eventdev_ops ssovf_ops = {
>   	.port_link        = ssovf_port_link,
>   	.port_unlink      = ssovf_port_unlink,
>   	.timeout_ticks    = ssovf_timeout_ticks,
> +
> +	.eth_rx_adapter_caps_get  = ssovf_eth_rx_adapter_caps_get,
> +	.eth_rx_adapter_queue_add = ssovf_eth_rx_adapter_queue_add,
> +	.eth_rx_adapter_queue_del = ssovf_eth_rx_adapter_queue_del,
> +	.eth_rx_adapter_start = ssovf_eth_rx_adapter_start,
> +	.eth_rx_adapter_stop = ssovf_eth_rx_adapter_stop,
> +
>   	.dump             = ssovf_dump,
>   	.dev_start        = ssovf_start,
>   	.dev_stop         = ssovf_stop,
> diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h
> index 933c5a3..bbce492 100644
> --- a/drivers/event/octeontx/ssovf_evdev.h
> +++ b/drivers/event/octeontx/ssovf_evdev.h
> @@ -38,6 +38,7 @@
>   #include <rte_io.h>
>   
>   #include <octeontx_mbox.h>
> +#include <octeontx_ethdev.h>
>   
>   #define EVENTDEV_NAME_OCTEONTX_PMD event_octeontx
>   
> diff --git a/drivers/event/octeontx/ssovf_worker.h b/drivers/event/octeontx/ssovf_worker.h
> index 8dc1264..bd3d71a 100644
> --- a/drivers/event/octeontx/ssovf_worker.h
> +++ b/drivers/event/octeontx/ssovf_worker.h
> @@ -34,9 +34,11 @@
>   #include <rte_common.h>
>   #include <rte_branch_prediction.h>
>   
> -#include "ssovf_evdev.h"
>   #include <octeontx_mbox.h>
>   
> +#include "ssovf_evdev.h"
> +#include "octeontx_rxtx.h"
> +
>   enum {
>   	SSO_SYNC_ORDERED,
>   	SSO_SYNC_ATOMIC,
> @@ -50,6 +52,28 @@ enum {
>   
>   /* SSO Operations */
>   
> +static __rte_always_inline struct rte_mbuf *
> +ssovf_octeontx_wqe_to_pkt(uint64_t work, uint16_t port_id)
> +{
> +	struct rte_mbuf *mbuf;
> +	octtx_wqe_t *wqe = (octtx_wqe_t *)(uintptr_t)work;
> +	rte_prefetch_non_temporal(wqe);
> +
> +	/* Get mbuf from wqe */
> +	mbuf = (struct rte_mbuf *)((uintptr_t)wqe -
> +			OCTTX_PACKET_WQE_SKIP);
> +	mbuf->packet_type =
> +		ptype_table[wqe->s.w2.lcty][wqe->s.w2.lety][wqe->s.w2.lfty];
> +	mbuf->data_off = RTE_PTR_DIFF(wqe->s.w3.addr, mbuf->buf_addr);
> +	mbuf->pkt_len = wqe->s.w1.len;
> +	mbuf->data_len = mbuf->pkt_len;
> +	mbuf->nb_segs = 1;
> +	mbuf->ol_flags = 0;
> +	mbuf->port = port_id;
> +	rte_mbuf_refcnt_set(mbuf, 1);
> +	return mbuf;
> +}
> +
>   static __rte_always_inline uint16_t
>   ssows_get_work(struct ssows *ws, struct rte_event *ev)
>   {
> @@ -62,9 +86,10 @@ ssows_get_work(struct ssows *ws, struct rte_event *ev)
>   	ws->cur_tt = sched_type_queue & 0x3;
>   	ws->cur_grp = sched_type_queue >> 2;
>   	sched_type_queue = sched_type_queue << 38;
> -
>   	ev->event = sched_type_queue | (get_work0 & 0xffffffff);
> -	ev->u64 = get_work1;
> +	ev->u64 = get_work1 && !ev->event_type ?

I think the code readability would be better if you compared event_type 
to RTE_EVENT_TYPE_ETHDEV.

Reviewed by: Nikhil Rao <nikhil.rao@intel.com>

  reply	other threads:[~2017-10-17 11:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-17  8:53 [dpdk-dev] [PATCH 1/3] net/octeontx: " Pavan Nikhilesh
2017-10-17  8:53 ` [dpdk-dev] [PATCH 2/3] event/octeontx: " Pavan Nikhilesh
2017-10-17 11:11   ` Rao, Nikhil [this message]
2017-10-18  8:12     ` Pavan Nikhilesh Bhagavatula
2017-10-24 14:27     ` Jerin Jacob
2017-10-17  8:53 ` [dpdk-dev] [PATCH 3/3] doc: add event octeontx Rx adapter limitation Pavan Nikhilesh
2017-10-18  8:48   ` Mcnamara, John
2017-10-18  9:06     ` Pavan Nikhilesh Bhagavatula
2017-10-17  9:29 ` [dpdk-dev] [PATCH 1/3] net/octeontx: add support for event Rx adapter Bhagavatula, Pavan
2017-10-18  8:45 ` [dpdk-dev] [PATCH v2 " Pavan Nikhilesh
2017-10-18  8:45   ` [dpdk-dev] [PATCH v2 2/3] event/octeontx: " Pavan Nikhilesh
2017-10-18  8:45   ` [dpdk-dev] [PATCH v2 3/3] doc: add event octeontx Rx adapter limitation Pavan Nikhilesh
2017-10-18  8:52     ` Mcnamara, John
2017-10-23 18:09   ` [dpdk-dev] [PATCH v2 1/3] net/octeontx: add support for event Rx adapter Jerin Jacob
2017-10-24  6:56     ` Pavan Nikhilesh Bhagavatula
2017-10-24  8:10   ` [dpdk-dev] [PATCH v3 " Pavan Nikhilesh
2017-10-24  8:10     ` [dpdk-dev] [PATCH v3 2/3] event/octeontx: " Pavan Nikhilesh
2017-10-24  8:10     ` [dpdk-dev] [PATCH v3 3/3] doc: add event octeontx Rx adapter limitation Pavan Nikhilesh
2017-10-24 13:00   ` [dpdk-dev] [PATCH v4 1/3] net/octeontx: add support for event Rx adapter Pavan Nikhilesh
2017-10-24 13:00     ` [dpdk-dev] [PATCH v4 2/3] event/octeontx: " Pavan Nikhilesh
2017-10-24 13:00     ` [dpdk-dev] [PATCH v4 3/3] doc: add event octeontx Rx adapter limitation Pavan Nikhilesh
2017-10-24 14:21     ` [dpdk-dev] [PATCH v4 1/3] net/octeontx: add support for event Rx adapter 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=51ebfd06-c9ff-965e-f0ad-b2724f6d76c1@intel.com \
    --to=nikhil.rao@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=pbhagavatula@caviumnetworks.com \
    --cc=santosh.shukla@caviumnetworks.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).