DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: Flavio Leitner <fbl@sysclose.org>
Cc: dev <dev@dpdk.org>, Ilya Maximets <i.maximets@ovn.org>,
	 Maxime Coquelin <maxime.coquelin@redhat.com>,
	Shahaf Shuler <shahafs@mellanox.com>,
	Tiwei Bie <tiwei.bie@intel.com>,
	Obrembski MichalX <michalx.obrembski@intel.com>,
	 Stokes Ian <ian.stokes@intel.com>
Subject: Re: [dpdk-dev] [PATCH v5] vhost: add support for large buffers
Date: Tue, 29 Oct 2019 10:02:57 +0100	[thread overview]
Message-ID: <CAJFAV8xRuZdjSqWKc37DneaCJ9qNjOibioOORNhmmA91ciJWNQ@mail.gmail.com> (raw)
In-Reply-To: <20191015185951.6295-1-fbl@sysclose.org>

On Tue, Oct 15, 2019 at 9:00 PM Flavio Leitner <fbl@sysclose.org> wrote:
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
> index 5b85b832d..da69ab1db 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -1289,6 +1289,93 @@ get_zmbuf(struct vhost_virtqueue *vq)
>         return NULL;
>  }
>
> +static void
> +virtio_dev_extbuf_free(void *addr __rte_unused, void *opaque)
> +{
> +       rte_free(opaque);
> +}
> +
> +static int
> +virtio_dev_extbuf_alloc(struct rte_mbuf *pkt, uint32_t size)
> +{
> +       struct rte_mbuf_ext_shared_info *shinfo = NULL;
> +       uint32_t total_len = RTE_PKTMBUF_HEADROOM + size;
> +       uint16_t buf_len;
> +       rte_iova_t iova;
> +       void *buf;
> +
> +       /* Try to use pkt buffer to store shinfo to reduce the amount of memory
> +        * required, otherwise store shinfo in the new buffer.
> +        */
> +       if (rte_pktmbuf_tailroom(pkt) >= sizeof(*shinfo))
> +               shinfo = rte_pktmbuf_mtod(pkt,
> +                                         struct rte_mbuf_ext_shared_info *);
> +       else {
> +               total_len += sizeof(*shinfo) + sizeof(uintptr_t);
> +               total_len = RTE_ALIGN_CEIL(total_len, sizeof(uintptr_t));
> +       }
> +
> +       if (unlikely(total_len > UINT16_MAX))
> +               return -ENOSPC;
> +
> +       buf_len = total_len;
> +       buf = rte_malloc(NULL, buf_len, RTE_CACHE_LINE_SIZE);

Using rte_malloc() means that the allocation can end up on any numa node.
This external buffer might end up on a different node than the mbuf
(which resides on mp->socket_id node).


-- 
David Marchand

  parent reply	other threads:[~2019-10-29  9:03 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-01 22:19 [dpdk-dev] [PATCH] vhost: add support to large linear mbufs Flavio Leitner
2019-10-01 23:10 ` Flavio Leitner
2019-10-02  4:45 ` Shahaf Shuler
2019-10-02  8:04   ` David Marchand
2019-10-02  9:00     ` Shahaf Shuler
2019-10-02 12:58       ` Flavio Leitner
2019-10-02 17:50         ` Shahaf Shuler
2019-10-02 18:15           ` Flavio Leitner
2019-10-03 16:57             ` Ilya Maximets
2019-10-03 21:25               ` Flavio Leitner
2019-10-02  7:51 ` Maxime Coquelin
2019-10-04 20:10 ` [dpdk-dev] [PATCH v2] vhost: add support for large buffers Flavio Leitner
2019-10-06  4:47   ` Shahaf Shuler
2019-10-10  5:12   ` Tiwei Bie
2019-10-10 12:12     ` Flavio Leitner
2019-10-11 17:09   ` [dpdk-dev] [PATCH v3] " Flavio Leitner
2019-10-14  2:44     ` Tiwei Bie
2019-10-15 16:17     ` [dpdk-dev] [PATCH v4] " Flavio Leitner
2019-10-15 17:41       ` Ilya Maximets
2019-10-15 18:44         ` Flavio Leitner
2019-10-15 18:59       ` [dpdk-dev] [PATCH v5] " Flavio Leitner
2019-10-16 10:02         ` Maxime Coquelin
2019-10-16 11:13         ` Maxime Coquelin
2019-10-16 13:32           ` Ilya Maximets
2019-10-16 13:46             ` Maxime Coquelin
2019-10-16 14:02               ` Flavio Leitner
2019-10-16 14:08                 ` Ilya Maximets
2019-10-16 14:14                   ` Flavio Leitner
2019-10-16 14:05               ` Ilya Maximets
2019-10-29  9:02         ` David Marchand [this message]
2019-10-29 12:21           ` Flavio Leitner
2019-10-29 16:19             ` David Marchand

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=CAJFAV8xRuZdjSqWKc37DneaCJ9qNjOibioOORNhmmA91ciJWNQ@mail.gmail.com \
    --to=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=fbl@sysclose.org \
    --cc=i.maximets@ovn.org \
    --cc=ian.stokes@intel.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=michalx.obrembski@intel.com \
    --cc=shahafs@mellanox.com \
    --cc=tiwei.bie@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).