[dpdk-dev,v3] net/null:Different mac address support

Message ID 1520393514-25882-1-git-send-email-malleshx.koujalagi@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Mallesh Koujalagi March 7, 2018, 3:31 a.m. UTC
  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 | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
  

Comments

Ferruh Yigit March 7, 2018, 10:45 a.m. UTC | #1
On 3/7/2018 3:31 AM, Mallesh Koujalagi wrote:
> 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>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

There are some commit formatting issues which I can fix while applying for this
one, but for future can you please run "./devtools/check-git-log.sh" before
sending patches.
  
Mallesh Koujalagi March 7, 2018, 6:11 p.m. UTC | #2
Sure!! Thanks Ferruh.

-----Original Message-----
From: Yigit, Ferruh 

Sent: Wednesday, March 7, 2018 2:45 AM
To: Koujalagi, MalleshX <malleshx.koujalagi@intel.com>; dev@dpdk.org
Cc: mtetsuyah@gmail.com; stephen@networkplumber.org
Subject: Re: [PATCH v3] net/null:Different mac address support

On 3/7/2018 3:31 AM, Mallesh Koujalagi wrote:
> 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>


Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>


There are some commit formatting issues which I can fix while applying for this one, but for future can you please run "./devtools/check-git-log.sh" before sending patches.
  
Ferruh Yigit March 16, 2018, 1:57 p.m. UTC | #3
On 3/7/2018 10:45 AM, Ferruh Yigit wrote:
> On 3/7/2018 3:31 AM, Mallesh Koujalagi wrote:
>> 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>
> 
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 9385ffd..42e3a77 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -73,6 +73,7 @@  struct pmd_internals {
 	struct null_queue rx_null_queues[RTE_MAX_QUEUES_PER_PORT];
 	struct null_queue tx_null_queues[RTE_MAX_QUEUES_PER_PORT];
 
+	struct ether_addr eth_addr;
 	/** Bit mask of RSS offloads, the bit offset also means flow type */
 	uint64_t flow_type_rss_offloads;
 
@@ -84,9 +85,6 @@  struct pmd_internals {
 
 	uint8_t rss_key[40];                /**< 40-byte hash key. */
 };
-
-
-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,
@@ -519,7 +517,6 @@  eth_dev_null_create(struct rte_vdev_device *dev,
 		rte_free(data);
 		return -ENOMEM;
 	}
-
 	/* now put it all together
 	 * - store queue data in internals,
 	 * - store numa_node info in ethdev data
@@ -533,6 +530,7 @@  eth_dev_null_create(struct rte_vdev_device *dev,
 	internals->packet_size = packet_size;
 	internals->packet_copy = packet_copy;
 	internals->port_id = eth_dev->data->port_id;
+	eth_random_addr(internals->eth_addr.addr_bytes);
 
 	internals->flow_type_rss_offloads =  ETH_RSS_PROTO_MASK;
 	internals->reta_size = RTE_DIM(internals->reta_conf) * RTE_RETA_GROUP_SIZE;
@@ -543,7 +541,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 = &internals->eth_addr;
 
 	eth_dev->data = data;
 	eth_dev->dev_ops = &ops;