From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by dpdk.org (Postfix) with ESMTP id 8871B8EA1 for ; Thu, 29 Oct 2015 10:16:56 +0100 (CET) Received: by wicfx6 with SMTP id fx6so221481096wic.1 for ; Thu, 29 Oct 2015 02:16:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind_com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=it39Dt4Jj2XHXOxjkBrT1KFnNCN6lA7HVTpxtq3p5tk=; b=PegDsab1mrGI2l9/6zPwSWzSxlt2vPIp1hxjmWMqf83MMHxDbni+Un9Y7IQksQ4Jv9 dD2eBr6W/gAbug2QhM4x8+DmS3b7c3+JE2Kuef9rgJ6j94Pev3lJXtxZmsY+VIQPOxqe V4NyztwYecsy5BD0BGLdKi7rBxNO72vc5taojxtz/8DyisNiiAzTztEc0DWocCW1HLCJ 3HwBMcBiUtKIraXUmvy0WaY5VtWp2E8vYcKgIUPOGm5DgTmUYwF3DB6u21RBvQsGqUXq 6+LncC7m0X/8McUpQqw/xT2wtGHyoKLek0ruEqHRnyKElRmQ8zwYKtzt571dMNepWS5M W2kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=it39Dt4Jj2XHXOxjkBrT1KFnNCN6lA7HVTpxtq3p5tk=; b=P2QLYIhGWk5cFKcVsKT6hwUe0RT8edJ8RHjRSdYkGzWi8+oMK2DVflz/ryMeMl43Bm m5iEZhIpYwXVR6CR0YT6+hlunLZvLZyY2sOa/yG8B3BxPGuXqugfgKCtq9qpLIqIOuM9 RXeHv0XUHEOMdgxSaXZiK8Y8R/nbzDB+WVnvKNkWy/qaAXy0+Mm7Kazih/MFnuawDIqs ixwdSsSh4od9b6eoneS/mgg/rLpa1jW1qpRjg7G+48PFvbz/dIJ57JQP04xKa4/4t47E azA9Bm4tEByjsvJzOcf4gnWqmr9wn+//geEbI+SR4GcyS+vsuddYPFGNaIv6VBCcM6vE qIqw== X-Gm-Message-State: ALoCoQkGkKfJJd6vJvkUa7JxL0czjOcnIbP6ig5qBmuBD40XEgoSbYdKBnzLdn/x84z8GLujuAi/ X-Received: by 10.194.2.144 with SMTP id 16mr864369wju.90.1446110216404; Thu, 29 Oct 2015 02:16:56 -0700 (PDT) Received: from gloops.dev.6wind.com (89-158-215-180.rev.numericable.fr. [89.158.215.180]) by smtp.gmail.com with ESMTPSA id lv4sm705758wjb.43.2015.10.29.02.16.55 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Oct 2015 02:16:55 -0700 (PDT) From: David Marchand To: dev@dpdk.org Date: Thu, 29 Oct 2015 10:16:50 +0100 Message-Id: <1446110210-25980-1-git-send-email-david.marchand@6wind.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446108375-14178-1-git-send-email-david.marchand@6wind.com> References: <1446108375-14178-1-git-send-email-david.marchand@6wind.com> Subject: [dpdk-dev] [PATCH v2] 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 09:16:56 -0000 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 --- Changes since v1: * fix checkpatch warning (thanks Yuanhan) drivers/net/virtio/virtio_ethdev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 12fcc23..636b182 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1163,6 +1163,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) struct virtio_net_config *config; struct virtio_net_config local_config; struct rte_pci_device *pci_dev; + const size_t mac_array_size = VIRTIO_MAX_MAC_ADDRS * ETHER_ADDR_LEN; RTE_BUILD_BUG_ON(RTE_PKTMBUF_HEADROOM < sizeof(struct virtio_net_hdr)); @@ -1175,11 +1176,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", mac_array_size, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to allocate %d bytes needed to store MAC addresses", - ETHER_ADDR_LEN); + mac_array_size); return -ENOMEM; } -- 1.9.1