DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: Nikhil Rao <nikhil.rao@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v1 4/4] eventdev: add interrupt driven queues in Rx event adapter
Date: Sun, 17 Jun 2018 19:19:59 +0530	[thread overview]
Message-ID: <20180617134958.GF7498@jerin> (raw)
In-Reply-To: <1528481718-7241-6-git-send-email-nikhil.rao@intel.com>

-----Original Message-----
> Date: Fri, 8 Jun 2018 23:45:18 +0530
> From: Nikhil Rao <nikhil.rao@intel.com>
> To: jerin.jacob@caviumnetworks.com
> CC: dev@dpdk.org, Nikhil Rao <nikhil.rao@intel.com>
> Subject: [PATCH v1 4/4] eventdev: add interrupt driven queues in Rx event
>  adapter
> X-Mailer: git-send-email 1.8.3.1
> 
> Add support for interrupt driven queues when eth device is
> configured for rxq interrupts and servicing weight for the
> queue is configured to be zero.
> 
> A interrupt driven packet received counter has been added to
> rte_event_eth_rx_adapter_stats.
> 
> Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
> ---
>  lib/librte_eventdev/rte_event_eth_rx_adapter.h     |    5 +-
>  lib/librte_eventdev/rte_event_eth_rx_adapter.c     | 1049 +++++++++++++++++++-
>  test/test/test_event_eth_rx_adapter.c              |  261 ++++-

Please move the testcase to separate patch.

>  .../prog_guide/event_ethernet_rx_adapter.rst       |   24 +
>  config/common_base                                 |    1 +

This patch creates build issue with meson build.
command to reproduce:
--------------------
export MESON_PARAMS='-Dwerror=true -Dexamples=all'
CC="ccache gcc" meson --default-library=shared $MESON_PARAMS gcc-shared-build
ninja -C gcc-shared-build

log:
---
../lib/librte_eventdev/rte_event_eth_rx_adapter.c: In function
‘rxa_intr_ring_check_avail’:
../lib/librte_eventdev/rte_event_eth_rx_adapter.c:916:5: error:
‘RTE_EVENT_ETH_INTR_RING_SIZE’ undeclared (first use in this function);
did you mean ‘RTE_EVENT_DEV_XSTATS_NAME_SIZE’?
     RTE_EVENT_ETH_INTR_RING_SIZE) {
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
     RTE_EVENT_DEV_XSTATS_NAME_SIZE
../lib/librte_eventdev/rte_event_eth_rx_adapter.c:916:5: note: each
undeclared identifier is reported only once for each function it appears
in
../lib/librte_eventdev/rte_event_eth_rx_adapter.c: In function
‘rxa_intr_thread’:
../lib/librte_eventdev/rte_event_eth_rx_adapter.c:971:8: error:
‘RTE_EVENT_ETH_INTR_RING_SIZE’ undeclared (first use in this function);
did you mean ‘RTE_EVENT_DEV_XSTATS_NAME_SIZE’?
        RTE_EVENT_ETH_INTR_RING_SIZE + 1, -1);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  6 files changed, 1296 insertions(+), 48 deletions(-)
> 
> diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.h b/lib/librte_eventdev/rte_event_eth_rx_adapter.h
> index 307b2b5..97f25e9 100644
> --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.h
> +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.h
> @@ -64,8 +64,7 @@
>   * the service function ID of the adapter in this case.
>   *
>   * Note:
> - * 1) Interrupt driven receive queues are currently unimplemented.
> - * 2) Devices created after an instance of rte_event_eth_rx_adapter_create
> + * 1) Devices created after an instance of rte_event_eth_rx_adapter_create
>   *  should be added to a new instance of the rx adapter.

Can we remove this NOTE and add this check in the code if it is not the
case?

>   */
>  
> @@ -199,6 +198,8 @@ struct rte_event_eth_rx_adapter_stats {
>  	 * block cycles can be used to compute the percentage of
>  	 * cycles the service is blocked by the event device.
>  	 */
> +	uint64_t rx_intr_packets;
> +	/**< Received packet count for interrupt mode Rx queues */
>  };
>  
>  /**
> diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
> index 40e9bc9..d038ee4 100644
> --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c
> +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
> @@ -2,6 +2,8 @@
>   * Copyright(c) 2017 Intel Corporation.
>   * All rights reserved.
>   */
> +#include <unistd.h>
> +#include <sys/epoll.h>
>  #include <rte_cycles.h>
>  #include <rte_common.h>
>  #include <rte_dev.h>
> @@ -11,6 +13,7 @@
>  #include <rte_malloc.h>
>  #include <rte_service_component.h>
>  #include <rte_thash.h>
> +#include <rte_interrupts.h>
>  
>  #include "rte_eventdev.h"
>  #include "rte_eventdev_pmd.h"
> @@ -24,6 +27,36 @@
>  #define ETH_RX_ADAPTER_MEM_NAME_LEN	32
> +static void *
> +rxa_intr_thread(void *arg)
> +{
> +	struct rte_event_eth_rx_adapter *rx_adapter = arg;
> +	struct rte_epoll_event *epoll_events = rx_adapter->epoll_events;
> +	int n, i;
> +	uint8_t val;
> +	ssize_t bytes_read;
> +
> +	while (1) {
> +		n = rte_epoll_wait(rx_adapter->epd, epoll_events,
> +				   RTE_EVENT_ETH_INTR_RING_SIZE + 1, -1);

Can you check with FreeBSD if everything is fine or not?

> +		if (unlikely(n < 0))
> +			RTE_EDEV_LOG_ERR("rte_epoll_wait returned error %d",
> +					n);
> +		for (i = 0; i < n; i++) {
> +			if (epoll_events[i].fd == rx_adapter->intr_pipe.readfd)
> +				goto done;
> +			rxa_intr_ring_enqueue(rx_adapter,
> +					epoll_events[i].epdata.data);
> +		}
> +	}
> +
> +done:
> +
> +static int
> +rxa_create_intr_thread(struct rte_event_eth_rx_adapter *rx_adapter)
> +{
> +	int err;
> +	uint8_t val;
> +	char thread_name[RTE_MAX_THREAD_NAME_LEN];
> +
> +	if (rx_adapter->intr_ring)
> +		return 0;
> +
> +	rx_adapter->intr_ring = rte_ring_create("intr_ring",
> +					RTE_EVENT_ETH_INTR_RING_SIZE,
> +					rte_socket_id(), 0);
> +	if (!rx_adapter->intr_ring)
> +		return -ENOMEM;
> +
> +	rx_adapter->epoll_events = rte_zmalloc_socket(rx_adapter->mem_name,
> +					(RTE_EVENT_ETH_INTR_RING_SIZE + 1) *
> +					sizeof(struct rte_epoll_event),
> +					RTE_CACHE_LINE_SIZE,
> +					rx_adapter->socket_id);
> +	if (!rx_adapter->epoll_events) {
> +		err = -ENOMEM;
> +		goto error;
> +	}
> +
> +	rte_spinlock_init(&rx_adapter->intr_ring_lock);
> +
> +	snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN,
> +			"rx-intr-thread");
> +	err = pthread_create(&rx_adapter->rx_intr_thread, NULL,
> +			rxa_intr_thread, rx_adapter);


Can you replace the pthread_* with new rte_ctrl_thread_create()
abstraction ?

>  #
> diff --git a/lib/librte_eventdev/Makefile b/lib/librte_eventdev/Makefile
> index b3e2546..e269357 100644
> --- a/lib/librte_eventdev/Makefile
> +++ b/lib/librte_eventdev/Makefile
> @@ -8,14 +8,16 @@ include $(RTE_SDK)/mk/rte.vars.mk
>  LIB = librte_eventdev.a
>  
>  # library version
> -LIBABIVER := 4
> +LIBABIVER := 5
>  
>  # build flags
>  CFLAGS += -DALLOW_EXPERIMENTAL_API
> +CFLAGS += -D_GNU_SOURCE
>  CFLAGS += -O3
>  CFLAGS += $(WERROR_FLAGS)
>  LDLIBS += -lrte_eal -lrte_ring -lrte_ethdev -lrte_hash -lrte_mempool -lrte_timer
>  LDLIBS += -lrte_mbuf -lrte_cryptodev
> +LDLIBS += -lpthread

This may not be required if we add rte_ctrl_thread library.

>  
>  # library source files
>  SRCS-y += rte_eventdev.c
> -- 
> 1.8.3.1
> 

  reply	other threads:[~2018-06-17 13:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-08 18:15 [dpdk-dev] [PATCH v1 0/4] eventdev: add interrupt driven queues to Rx adapter Nikhil Rao
2018-06-08 18:15 ` [dpdk-dev] [PATCH v1 1/4] eventdev: standardize Rx adapter internal function names Nikhil Rao
2018-06-17 13:24   ` Jerin Jacob
2018-06-08 18:15 ` [dpdk-dev] [PATCH v1 2/4] eventdev: improve err handling for Rx adapter queue add/del Nikhil Rao
2018-06-17 13:31   ` Jerin Jacob
2018-06-18 12:13     ` Rao, Nikhil
2018-06-08 18:15 ` [dpdk-dev] [PATCH v1 3/4] eventdev: move Rx adapter eth receive code to separate function Nikhil Rao
2018-06-17 13:35   ` Jerin Jacob
2018-06-08 18:15 ` [dpdk-dev] [PATCH v1 3/4] eventdev: move Rx adapter eth Rx " Nikhil Rao
2018-06-17 13:36   ` Jerin Jacob
2018-06-08 18:15 ` [dpdk-dev] [PATCH v1 4/4] eventdev: add interrupt driven queues in Rx event adapter Nikhil Rao
2018-06-17 13:49   ` Jerin Jacob [this message]
2018-06-18 13:15     ` Rao, Nikhil
2018-06-27 10:55 ` [dpdk-dev] [PATCH v2 0/5] eventdev: add interrupt driven queues to Rx adapter Nikhil Rao
2018-06-27 10:55   ` [dpdk-dev] [PATCH v2 1/5] eventdev: standardize Rx adapter internal function names Nikhil Rao
2018-06-27 10:55   ` [dpdk-dev] [PATCH v2 2/5] eventdev: improve err handling for Rx adapter queue add/del Nikhil Rao
2018-06-27 10:55   ` [dpdk-dev] [PATCH v2 3/5] eventdev: move Rx adapter eth Rx to separate function Nikhil Rao
2018-06-27 10:55   ` [dpdk-dev] [PATCH v2 4/5] eventdev: add interrupt driven queues to Rx adapter Nikhil Rao
2018-06-27 10:55   ` [dpdk-dev] [PATCH v2 5/5] eventdev: add Rx adapter tests for interrupt driven queues Nikhil Rao

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=20180617134958.GF7498@jerin \
    --to=jerin.jacob@caviumnetworks.com \
    --cc=dev@dpdk.org \
    --cc=nikhil.rao@intel.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).