dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: David Marchand <david.marchand@6wind.com>
Cc: dev@dpdk.org
Subject: Re: [PATCH] virtio: fix size of mac_addrs array in virtio ports
Date: Thu, 29 Oct 2015 16:59:52 +0800	[thread overview]
Message-ID: <20151029085952.GB29042@yliu-dev.sh.intel.com> (raw)
In-Reply-To: <1446108375-14178-1-git-send-email-david.marchand@6wind.com>

On Thu, Oct 29, 2015 at 09:46:15AM +0100, David Marchand wrote:
> From: Ivan Boule <ivan.boule@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@6wind.com>
> Signed-off-by: David Marchand <david.marchand@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

  reply	other threads:[~2015-10-29  8:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-29  8:46 [PATCH] virtio: fix size of mac_addrs array in virtio ports David Marchand
2015-10-29  8:59 ` Yuanhan Liu [this message]
2015-10-29  9:16 ` [PATCH v2] " David Marchand
2015-11-03 10:42   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151029085952.GB29042@yliu-dev.sh.intel.com \
    --to=yuanhan.liu@linux.intel.com \
    --cc=david.marchand@6wind.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).