All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ananyev, Konstantin" <konstantin.ananyev-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: "Richardson,
	Bruce" <bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"dev-VfR2kkLFssw@public.gmane.org"
	<dev-VfR2kkLFssw@public.gmane.org>,
	"Wiles,
	Keith" <keith.wiles-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: Re: [RFC PATCH 3/4] add support for a ring to be a pktdev
Date: Mon, 20 Apr 2015 10:32:04 +0000	[thread overview]
Message-ID: <2601191342CEEE43887BDE71AB97725821416F06@irsmsx105.ger.corp.intel.com> (raw)
In-Reply-To: <1429283804-28087-4-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Hi Bruce,

> -----Original Message-----
> From: dev [mailto:dev-bounces-VfR2kkLFssw@public.gmane.org] On Behalf Of Bruce Richardson
> Sent: Friday, April 17, 2015 4:17 PM
> To: dev-VfR2kkLFssw@public.gmane.org; Wiles, Keith
> Subject: [dpdk-dev] [RFC PATCH 3/4] add support for a ring to be a pktdev
> 
> Add a new public API function, and two internal wrapper functions so we
> can use ring as a pktdev.
> ---
>  lib/librte_ring/rte_ring.c | 41 +++++++++++++++++++++++++++++++++++++++++
>  lib/librte_ring/rte_ring.h |  3 +++
>  2 files changed, 44 insertions(+)
> 
> diff --git a/lib/librte_ring/Makefile b/lib/librte_ring/Makefile
> index 84ad3d3..bc5dd09 100644
> --- a/lib/librte_ring/Makefile
> +++ b/lib/librte_ring/Makefile
> @@ -47,6 +47,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_RING) := rte_ring.c
>  SYMLINK-$(CONFIG_RTE_LIBRTE_RING)-include := rte_ring.h
> 
>  # this lib needs eal and rte_malloc
> -DEPDIRS-$(CONFIG_RTE_LIBRTE_RING) += lib/librte_eal lib/librte_malloc
> +DEPDIRS-$(CONFIG_RTE_LIBRTE_RING) += lib/librte_eal lib/librte_malloc lib/librte_pktdev
> 
>  include $(RTE_SDK)/mk/rte.lib.mk
> diff --git a/lib/librte_ring/rte_ring.c b/lib/librte_ring/rte_ring.c
> index c9e59d4..424da20 100644
> --- a/lib/librte_ring/rte_ring.c
> +++ b/lib/librte_ring/rte_ring.c
> @@ -86,6 +86,7 @@
>  #include <rte_errno.h>
>  #include <rte_string_fns.h>
>  #include <rte_spinlock.h>
> +#include <rte_pktdev.h>

I don't think it is a good idea to make rte_ring dependent on rte_pktdev (or rte_ethdev).  
If we'd like to have pkt (or eth) device based on rte_ring, why not to create librte_pmd_ring
and put all that stuff there?  
Konstantin

> 
>  #include "rte_ring.h"
> 
> @@ -208,6 +208,47 @@ rte_ring_create(const char *name, unsigned count, int socket_id,
>  	return r;
>  }
> 
> +static uint16_t
> +dev_rx(void *r, struct rte_mbuf **pkts, uint16_t max_pkts)
> +{
> +	return rte_ring_dequeue_burst(r, (void *)pkts, max_pkts);
> +}
> +
> +static uint16_t
> +dev_tx(void *r, struct rte_mbuf **pkts, uint16_t max_pkts)
> +{
> +	return rte_ring_enqueue_burst(r, (void *)pkts, max_pkts);
> +}
> +
> +#define rte_ring_dev_data rte_pkt_dev_data
> +
> +struct rte_pkt_dev *
> +rte_ring_get_dev(struct rte_ring *r)
> +{
> +	struct ring_as_pktdev {
> +		RTE_PKT_DEV_HDR(rte_ring_dev);
> +		struct rte_ring_dev_data dev_data;
> +		void *ring;
> +	} *p;
> +	if (r == NULL ||
> +			(p = rte_zmalloc(NULL, sizeof(*p), 0)) == NULL)
> +		return NULL;
> +
> +	p->ring = r;
> +	p->rx_pkt_burst = dev_rx;
> +	p->tx_pkt_burst = dev_tx;
> +	p->data = &p->dev_data;
> +
> +	snprintf(p->dev_data.name, sizeof(p->dev_data.name), "%s", r->name);
> +	p->dev_data.nb_rx_queues = 1;
> +	p->dev_data.nb_tx_queues = 1;
> +	p->dev_data.rx_queues = &p->ring;
> +	p->dev_data.tx_queues = &p->ring;
> +
> +	return (void *)p;
> +}
> +
> +
>  /*
>   * change the high water mark. If *count* is 0, water marking is
>   * disabled
> diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h
> index af68888..c2f28be 100644
> --- a/lib/librte_ring/rte_ring.h
> +++ b/lib/librte_ring/rte_ring.h
> @@ -301,6 +302,10 @@ int rte_ring_init(struct rte_ring *r, const char *name, unsigned count,
>  struct rte_ring *rte_ring_create(const char *name, unsigned count,
>  				 int socket_id, unsigned flags);
> 
> +struct rte_pkt_dev;
> +
> +struct rte_pkt_dev *rte_ring_get_dev(struct rte_ring *r);
> +
>  /**
>   * Change the high water mark.
>   *
> --
> 2.1.0

  parent reply	other threads:[~2015-04-20 10:32 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-13 19:44 [RFC PATCH 0/4 v2] Extending DPDK with multiple device support Keith Wiles
     [not found] ` <1428954274-26944-1-git-send-email-keith.wiles-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-13 19:44   ` [RFC PATCH 1/4 v2] Adding the common device files for " Keith Wiles
     [not found]     ` <1428954274-26944-2-git-send-email-keith.wiles-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-05-04 13:13       ` Marc Sune
     [not found]         ` <55477083.2060109-kpkqNMk1I7M@public.gmane.org>
2015-05-04 14:44           ` Wiles, Keith
2015-04-13 19:44   ` [RFC PATCH 2/4 v2] Add the ethdev changes " Keith Wiles
2015-04-13 19:44   ` [RFC PATCH 3/4 v2] Add the test file changes for common " Keith Wiles
2015-04-13 19:44   ` [RFC PATCH 4/4 v2] Update PMD files for new " Keith Wiles
2015-04-17 15:16   ` [RFC PATCH 0/4] pktdev Bruce Richardson
     [not found]     ` <1429283804-28087-1-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-17 15:16       ` [RFC PATCH 1/4] Add example pktdev implementation Bruce Richardson
     [not found]         ` <1429283804-28087-2-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-20 11:26           ` Ananyev, Konstantin
     [not found]             ` <2601191342CEEE43887BDE71AB97725821416F4D-pww93C2UFcwu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-04-20 15:02               ` Bruce Richardson
2015-04-21  8:40                 ` Ananyev, Konstantin
     [not found]                   ` <2601191342CEEE43887BDE71AB9772582141B5D1-pww93C2UFcwu0RiL9chJVbfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-04-21  9:23                     ` Bruce Richardson
2015-04-17 15:16       ` [RFC PATCH 2/4] Make ethdev explicitly a subclass of pktdev Bruce Richardson
2015-04-17 15:16       ` [RFC PATCH 3/4] add support for a ring to be a pktdev Bruce Richardson
     [not found]         ` <1429283804-28087-4-git-send-email-bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-17 17:31           ` Neil Horman
2015-04-18  0:00           ` Ouyang, Changchun
2015-04-20 10:32           ` Ananyev, Konstantin [this message]
2015-04-17 15:16       ` [RFC PATCH 4/4] example app showing pktdevs used in a chain Bruce Richardson
2015-04-17 17:28       ` [RFC PATCH 0/4] pktdev Neil Horman
2015-04-17 18:49       ` Marc Sune
     [not found]         ` <553155C7.3000106-kpkqNMk1I7M@public.gmane.org>
2015-04-17 19:50           ` Wiles, Keith
     [not found]             ` <D156C7D3.1B1F0%keith.wiles-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-20  6:51               ` Marc Sune
     [not found]                 ` <5534A1EE.4060905-kpkqNMk1I7M@public.gmane.org>
2015-04-20 10:43                   ` Bruce Richardson
2015-04-20 17:03                     ` Marc Sune
2015-04-20 13:19                   ` Wiles, Keith
     [not found]                     ` <D15A663F.1D665%keith.wiles-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-04-20 13:30                       ` Wiles, Keith
2015-05-04 13:13   ` [RFC PATCH 0/4 v2] Extending DPDK with multiple device support Marc Sune

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=2601191342CEEE43887BDE71AB97725821416F06@irsmsx105.ger.corp.intel.com \
    --to=konstantin.ananyev-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=bruce.richardson-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    --cc=keith.wiles-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.