From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f193.google.com (mail-wr0-f193.google.com [209.85.128.193]) by dpdk.org (Postfix) with ESMTP id 84E97214A for ; Wed, 15 Mar 2017 09:18:48 +0100 (CET) Received: by mail-wr0-f193.google.com with SMTP id l37so1060839wrc.3 for ; Wed, 15 Mar 2017 01:18:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=S2MrTM8wqbQf1SUa1xszIRv/qTrUrRiXykU9Bmh05zI=; b=OUO7b7aJNl/pils+gufTz5FZ/qOqOCHcb7lNnUyjyf9uripesNV9aLNZLarUYNex0o jcmUWxwbIgIRHBvxTX4O0D+l5dqQ0amz7LvZOX/fCLZt8w+DuduzSZ4vINc48xAoj+mn MdsI6cc3ea9UTho5HVvMj3Ga27Rcb4YIPcgBOuV2uXzAHWlnFgLIqMVR3oABliisFuAV boihbQU/77PJN1PssgJCmL3qislDB/k7qxydYjtc6TQtPXayirDCmnAZaEMOcwG/L83l Mb1s0oKsFFXycXcHVAGsD7g+HBnNETOrsEjeVgYdLI6RueLYi2w+gABXslkUHlXpN5dn aIHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=S2MrTM8wqbQf1SUa1xszIRv/qTrUrRiXykU9Bmh05zI=; b=EB91IWtDGJqNvJgkaW/Zfk589oLxYMCCPwVsouLjC4mvx5gSzIyjMUgLQf2ZaDf3xe 7PdKPWMhha24COCSMBCHEmfUXlFvHUvCJeO1yK/TJRebEjT7dWCII//coo18kmlOkCr/ EXqZK3Rj1v/SC+Jp1OUqT+1ltJCw9A+tbOr0eBdz/cC3OmsjyC2WnFtiYdX9iEVKwgix rpmcXM5u4BesJGa6AKhSKuAtaFVLAyk3gh99BsIsRwQbsBWFAhSaMEasFqvZfy90pZES pxzx44lbuF/bubFC0WIT3uk47uf9wr90BQGJuYlvOzyT5WGuUUvA313yBRqqUvRoX0hI 5uBQ== X-Gm-Message-State: AFeK/H1YPLQvLC9G9q5Dyz3oR0lC7Jw9vXoK2u31JSe6y08iBZr32hopR8dy9AHpNbKuSt4+ojxMzyU6xvrNvA== X-Received: by 10.223.172.77 with SMTP id v71mr1994846wrc.131.1489565928295; Wed, 15 Mar 2017 01:18:48 -0700 (PDT) MIME-Version: 1.0 Sender: jblunck@gmail.com Received: by 10.28.211.20 with HTTP; Wed, 15 Mar 2017 01:18:47 -0700 (PDT) In-Reply-To: References: <1489444915-3660-1-git-send-email-ciwillia@brocade.com> From: Jan Blunck Date: Wed, 15 Mar 2017 09:18:47 +0100 X-Google-Sender-Auth: Isxp5lUg7uNkAECN2E6jSYByxFA Message-ID: To: "Charles (Chas) Williams" Cc: dev , yongwang@vmware.com Content-Type: text/plain; charset=UTF-8 Subject: Re: [dpdk-dev] [PATCH] net/vmxnet3: fix queue size changes 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: , X-List-Received-Date: Wed, 15 Mar 2017 08:18:48 -0000 On Tue, Mar 14, 2017 at 5:38 PM, Charles (Chas) Williams wrote: > > > On 03/14/2017 12:11 PM, Jan Blunck wrote: >> >> On Mon, Mar 13, 2017 at 11:41 PM, Charles (Chas) Williams >> wrote: >>> >>> If the user reconfigures the queues size, then the previosly allocated >>> memzone may potentially be too small. Instead, always free the old >>> memzone and allocate a new one. >>> >>> Fixes: dfaff37fc46d ("vmxnet3: import new vmxnet3 poll mode driver >>> implementation") >>> >>> Signed-off-by: Chas Williams >>> --- >>> drivers/net/vmxnet3/vmxnet3_rxtx.c | 6 +++--- >>> 1 file changed, 3 insertions(+), 3 deletions(-) >>> >>> diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c >>> b/drivers/net/vmxnet3/vmxnet3_rxtx.c >>> index 6649c3f..104e040 100644 >>> --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c >>> +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c >>> @@ -893,8 +893,8 @@ vmxnet3_recv_pkts(void *rx_queue, struct rte_mbuf >>> **rx_pkts, uint16_t nb_pkts) >>> >>> /* >>> * Create memzone for device rings. malloc can't be used as the physical >>> address is >>> - * needed. If the memzone is already created, then this function returns >>> a ptr >>> - * to the old one. >>> + * needed. If the memzone already exists, we free it since it may have >>> been created >>> + * with a different size. >>> */ >>> static const struct rte_memzone * >>> ring_dma_zone_reserve(struct rte_eth_dev *dev, const char *ring_name, >>> @@ -909,7 +909,7 @@ ring_dma_zone_reserve(struct rte_eth_dev *dev, const >>> char *ring_name, >>> >>> mz = rte_memzone_lookup(z_name); >>> if (mz) >>> - return mz; >>> + rte_memzone_free(mz); >>> >>> return rte_memzone_reserve_aligned(z_name, ring_size, >>> socket_id, 0, >>> VMXNET3_RING_BA_ALIGN); >> >> >> Chas, >> >> Thanks for hunting this one down. Wouldn't the rte_memzone_free() >> better fit into vmxnet3_cmd_ring_release() ? > > > I don't care which way it goes. I just did what is basically done in > gpa_zone_reserve() to match the "style". Tracking the current ring size > and avoiding reallocating a potentially large chunk of memory seems like > a better idea. > >> Also the ring_dma_zone_reserve() could get replaced by >> rte_eth_dma_zone_reserve() (see also > > > Yes, it probably should get changed to that along with tracking the size. Why don't we always allocate VMXNET3_RX_RING_MAX_SIZE entries? That way we don't need to reallocate on a later queue setup change?