[dpdk-dev,4/6] net/tap: keep kernel-assigned MAC address

Message ID 1485855778-15496-4-git-send-email-pascal.mazon@6wind.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers

Checks

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

Commit Message

Pascal Mazon Jan. 31, 2017, 9:42 a.m. UTC
  There's no point in having a different internal MAC address than the one
provided by the kernel when creating the netdevice.

Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
---
 drivers/net/tap/rte_eth_tap.c | 22 ----------------------
 1 file changed, 22 deletions(-)
  

Comments

Ferruh Yigit Jan. 31, 2017, 1:13 p.m. UTC | #1
On 1/31/2017 9:42 AM, Pascal Mazon wrote:
> There's no point in having a different internal MAC address than the one
> provided by the kernel when creating the netdevice.

Agree that this is not required, but also not a defect, worth learning
author's intention before deciding.

> 
> Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
> ---
<...>
  

Patch

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 3d15031008c6..f8b07b4a8fa1 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -552,28 +552,6 @@  pmd_mac_address(int fd, struct rte_eth_dev *dev, struct ether_addr *addr)
 		return -1;
 	}
 
-	/* Set the host based MAC address to this special MAC format */
-	ifr.ifr_hwaddr.sa_data[0] = 'T';
-	ifr.ifr_hwaddr.sa_data[1] = 'a';
-	ifr.ifr_hwaddr.sa_data[2] = 'p';
-	ifr.ifr_hwaddr.sa_data[3] = '-';
-	ifr.ifr_hwaddr.sa_data[4] = dev->data->port_id;
-	ifr.ifr_hwaddr.sa_data[5] = dev->data->numa_node;
-	if (ioctl(fd, SIOCSIFHWADDR, &ifr) == -1) {
-		RTE_LOG(ERR, PMD, "%s: ioctl failed (SIOCSIFHWADDR) (%s)\n",
-			dev->data->name, ifr.ifr_name);
-		return -1;
-	}
-
-	/* Set the local application MAC address, needs to be different then
-	 * the host based MAC address.
-	 */
-	ifr.ifr_hwaddr.sa_data[0] = 'd';
-	ifr.ifr_hwaddr.sa_data[1] = 'n';
-	ifr.ifr_hwaddr.sa_data[2] = 'e';
-	ifr.ifr_hwaddr.sa_data[3] = 't';
-	ifr.ifr_hwaddr.sa_data[4] = dev->data->port_id;
-	ifr.ifr_hwaddr.sa_data[5] = dev->data->numa_node;
 	rte_memcpy(addr, ifr.ifr_hwaddr.sa_data, ETH_ALEN);
 
 	return 0;