From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 3A77A378E for ; Thu, 29 Oct 2015 09:58:15 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 29 Oct 2015 01:58:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,213,1444719600"; d="scan'208";a="837809153" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.66.49]) by orsmga002.jf.intel.com with ESMTP; 29 Oct 2015 01:58:14 -0700 Date: Thu, 29 Oct 2015 16:59:52 +0800 From: Yuanhan Liu To: David Marchand Message-ID: <20151029085952.GB29042@yliu-dev.sh.intel.com> References: <1446108375-14178-1-git-send-email-david.marchand@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1446108375-14178-1-git-send-email-david.marchand@6wind.com> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH] virtio: fix size of mac_addrs array in virtio ports X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Oct 2015 08:58:15 -0000 On Thu, Oct 29, 2015 at 09:46:15AM +0100, David Marchand wrote: > From: Ivan Boule > > Make the virtio PMD allocate the array of unicast MAC addresses with > the maximum of entries (VIRTIO_MAX_MAC_ADDRS) that it exports. > > Signed-off-by: Ivan Boule > Signed-off-by: David Marchand > --- > drivers/net/virtio/virtio_ethdev.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c > index 12fcc23..79a97c3 100644 > --- a/drivers/net/virtio/virtio_ethdev.c > +++ b/drivers/net/virtio/virtio_ethdev.c > @@ -1175,11 +1175,11 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) > } > > /* Allocate memory for storing MAC addresses */ > - eth_dev->data->mac_addrs = rte_zmalloc("virtio", ETHER_ADDR_LEN, 0); > + eth_dev->data->mac_addrs = rte_zmalloc("virtio", VIRTIO_MAX_MAC_ADDRS * ETHER_ADDR_LEN, 0); Looks good to me, except that you should try to limit it to 80 chars. --yliu > if (eth_dev->data->mac_addrs == NULL) { > PMD_INIT_LOG(ERR, > "Failed to allocate %d bytes needed to store MAC addresses", > - ETHER_ADDR_LEN); > + VIRTIO_MAX_MAC_ADDRS * ETHER_ADDR_LEN); > return -ENOMEM; > } > > -- > 1.9.1