virtio: fix size of MAC address array
authorIvan Boule <ivan.boule@6wind.com>
Thu, 29 Oct 2015 08:46:15 +0000 (09:46 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 3 Nov 2015 10:40:58 +0000 (11:40 +0100)
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 <ivan.boule@6wind.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
drivers/net/virtio/virtio_ethdev.c

index 2ba7dea..6001108 100644 (file)
@@ -1279,11 +1279,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);
        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;
        }