DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] virtio: fix size of mac_addrs array in virtio ports
@ 2015-10-29  8:46 David Marchand
  2015-10-29  8:59 ` Yuanhan Liu
  2015-10-29  9:16 ` [dpdk-dev] [PATCH v2] " David Marchand
  0 siblings, 2 replies; 4+ messages in thread
From: David Marchand @ 2015-10-29  8:46 UTC (permalink / raw)
  To: dev

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);
 	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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] virtio: fix size of mac_addrs array in virtio ports
  2015-10-29  8:46 [dpdk-dev] [PATCH] virtio: fix size of mac_addrs array in virtio ports David Marchand
@ 2015-10-29  8:59 ` Yuanhan Liu
  2015-10-29  9:16 ` [dpdk-dev] [PATCH v2] " David Marchand
  1 sibling, 0 replies; 4+ messages in thread
From: Yuanhan Liu @ 2015-10-29  8:59 UTC (permalink / raw)
  To: David Marchand; +Cc: dev

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH v2] virtio: fix size of mac_addrs array in virtio ports
  2015-10-29  8:46 [dpdk-dev] [PATCH] virtio: fix size of mac_addrs array in virtio ports David Marchand
  2015-10-29  8:59 ` Yuanhan Liu
@ 2015-10-29  9:16 ` David Marchand
  2015-11-03 10:42   ` Thomas Monjalon
  1 sibling, 1 reply; 4+ messages in thread
From: David Marchand @ 2015-10-29  9:16 UTC (permalink / raw)
  To: dev

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>
---
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH v2] virtio: fix size of mac_addrs array in virtio ports
  2015-10-29  9:16 ` [dpdk-dev] [PATCH v2] " David Marchand
@ 2015-11-03 10:42   ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2015-11-03 10:42 UTC (permalink / raw)
  To: David Marchand, Ivan Boule; +Cc: dev

2015-10-29 10:16, David Marchand:
> 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>
> ---
> Changes since v1:
> * fix checkpatch warning (thanks Yuanhan)

Applied, thanks

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-11-03 10:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-29  8:46 [dpdk-dev] [PATCH] virtio: fix size of mac_addrs array in virtio ports David Marchand
2015-10-29  8:59 ` Yuanhan Liu
2015-10-29  9:16 ` [dpdk-dev] [PATCH v2] " David Marchand
2015-11-03 10:42   ` Thomas Monjalon

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).