[dpdk-dev] [PATCH] virtio: fix size of mac_addrs array in virtio ports
Yuanhan Liu
yuanhan.liu at linux.intel.com
Thu Oct 29 09:59:52 CET 2015
On Thu, Oct 29, 2015 at 09:46:15AM +0100, David Marchand wrote:
> From: Ivan Boule <ivan.boule at 6wind.com>
>
> 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 at 6wind.com>
> Signed-off-by: David Marchand <david.marchand at 6wind.com>
> ---
> 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
More information about the dev
mailing list