From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 04984A00BE; Tue, 29 Oct 2019 10:03:15 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CD1531BED5; Tue, 29 Oct 2019 10:03:14 +0100 (CET) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 2FBC51BED4 for ; Tue, 29 Oct 2019 10:03:14 +0100 (CET) Received: from mail-vk1-f198.google.com (mail-vk1-f198.google.com [209.85.221.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 83D2B4E924 for ; Tue, 29 Oct 2019 09:03:13 +0000 (UTC) Received: by mail-vk1-f198.google.com with SMTP id q5so6244882vkg.20 for ; Tue, 29 Oct 2019 02:03:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aYIoQ3+Af2FFgTE/x46zALvqSJK9dIAvAa+5frw81Po=; b=fpg/RwwWhUffKOhLjHO8UlP83teHwRhCk6bwpOdSbOIoqD5Q2SCbLm5zHdDSpaauZq 86p4R/TPKDhsnuwGxVwAEumF2Xnfqianp0je5hYPO4jmD1NYwSIj/kGgDfa+W5M0qTZA B+K05yyDTHakR9blznrqkrtGuw6aJv2w9VN4KYStw6KkKwLpjx8829mKRLowkzW+DcXP tYIAtW4by8iW2CTEuk43bcAtD6BiKpIlRIFhZWfq1WWy24ztbojzgXfcd24CAA5nxibA +8nur6DDbuvNfFOg/N66GTiAzdxMJuN5YxkZ54o94XLAxMV+J00ZR59ca64R/ne49dyu PsTw== X-Gm-Message-State: APjAAAVtRE+GcWje9JPc3wZkdH4VG1VRbMIx+CMvQUwFdCdX3CVCMY6g CihqenPjItONaqYpp3mk6bOuNMuEDe3Nj3YwsN5JoD0kSeCQ+/DhFYOj13e9+8/aziORMSNfKPT MH9Bk/rILYW9tqdgRWHI= X-Received: by 2002:a67:7790:: with SMTP id s138mr1036672vsc.198.1572339792628; Tue, 29 Oct 2019 02:03:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqytGpzp6Xj8VHW4ApRGYg239ir1hP+h7isaY2gd33wbYl3lU/hFyvveMXjka7NAB6Fn1zeo0Nwl2ktmr1yjCyk= X-Received: by 2002:a67:7790:: with SMTP id s138mr1036648vsc.198.1572339792270; Tue, 29 Oct 2019 02:03:12 -0700 (PDT) MIME-Version: 1.0 References: <20191015161727.32570-1-fbl@sysclose.org> <20191015185951.6295-1-fbl@sysclose.org> In-Reply-To: <20191015185951.6295-1-fbl@sysclose.org> From: David Marchand Date: Tue, 29 Oct 2019 10:02:57 +0100 Message-ID: To: Flavio Leitner Cc: dev , Ilya Maximets , Maxime Coquelin , Shahaf Shuler , Tiwei Bie , Obrembski MichalX , Stokes Ian Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v5] vhost: add support for large buffers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, Oct 15, 2019 at 9:00 PM Flavio Leitner 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