DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/null:Different mac address support
@ 2018-02-03  2:11 Mallesh Koujalagi
  2018-03-05 14:21 ` Ferruh Yigit
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Mallesh Koujalagi @ 2018-02-03  2:11 UTC (permalink / raw)
  To: dev; +Cc: mtetsuyah, ferruh.yigit, malleshx.koujalagi

After attaching two Null device to ovs, seeing "00.00.00.00.00.00" mac
address for both null devices. Fix this issue, by setting different mac
address.

Signed-off-by: Mallesh Koujalagi <malleshx.koujalagi@intel.com>
---
 drivers/net/null/rte_eth_null.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 9385ffd..98ac115 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -85,8 +85,17 @@ struct pmd_internals {
 	uint8_t rss_key[40];                /**< 40-byte hash key. */
 };
 
+static struct ether_addr base_eth_addr = {
+	.addr_bytes = {
+		0x4E /* N */,
+		0x55 /* U */,
+		0x4C /* L */,
+		0x4C /* L */,
+		0x00,
+		0x00
+	}
+};
 
-static struct ether_addr eth_addr = { .addr_bytes = {0} };
 static struct rte_eth_link pmd_link = {
 	.link_speed = ETH_SPEED_NUM_10G,
 	.link_duplex = ETH_LINK_FULL_DUPLEX,
@@ -492,6 +501,7 @@ eth_dev_null_create(struct rte_vdev_device *dev,
 	struct rte_eth_dev_data *data = NULL;
 	struct pmd_internals *internals = NULL;
 	struct rte_eth_dev *eth_dev = NULL;
+	struct ether_addr *eth_addr = NULL;
 
 	static const uint8_t default_rss_key[40] = {
 		0x6D, 0x5A, 0x56, 0xDA, 0x25, 0x5B, 0x0E, 0xC2, 0x41, 0x67, 0x25, 0x3D,
@@ -519,6 +529,15 @@ eth_dev_null_create(struct rte_vdev_device *dev,
 		rte_free(data);
 		return -ENOMEM;
 	}
+	eth_addr = rte_zmalloc_socket(rte_vdev_device_name(dev),
+			sizeof(*eth_addr), 0, dev->device.numa_node);
+	if (eth_addr == NULL) {
+		rte_eth_dev_release_port(eth_dev);
+		rte_free(data);
+		return -ENOMEM;
+	}
+	*eth_addr = base_eth_addr;
+	eth_addr->addr_bytes[5] = eth_dev->data->port_id;
 
 	/* now put it all together
 	 * - store queue data in internals,
@@ -543,7 +562,7 @@ eth_dev_null_create(struct rte_vdev_device *dev,
 	data->nb_rx_queues = (uint16_t)nb_rx_queues;
 	data->nb_tx_queues = (uint16_t)nb_tx_queues;
 	data->dev_link = pmd_link;
-	data->mac_addrs = &eth_addr;
+	data->mac_addrs = eth_addr;
 
 	eth_dev->data = data;
 	eth_dev->dev_ops = &ops;
-- 
2.7.4

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

end of thread, other threads:[~2018-03-16 13:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-03  2:11 [dpdk-dev] [PATCH] net/null:Different mac address support Mallesh Koujalagi
2018-03-05 14:21 ` Ferruh Yigit
2018-03-06  3:35 ` [dpdk-dev] [PATCH v2] " Mallesh Koujalagi
2018-03-06  4:26   ` Stephen Hemminger
2018-03-06 11:40   ` Ferruh Yigit
2018-03-07  3:31 ` [dpdk-dev] [PATCH v3] " Mallesh Koujalagi
2018-03-07 10:45   ` Ferruh Yigit
2018-03-07 18:11     ` Koujalagi, MalleshX
2018-03-16 13:57     ` Ferruh Yigit

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