Skip to contentSkip to conversation

vmxnet3: mac address set fixes

PATCH Applied David Harton 3 participants 3 messages Aug 25, 2017 – Sep 11, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vmxnet3: mac address set fixes

Updated vmxnet3_mac_addr_set() to store the newly set MAC address. Modified vmxnet3_write_mac() so the h/w is updated in an endian neutral manner.

---
 drivers/net/vmxnet3/vmxnet3_ethdev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/vmxnet3/vmxnet3_ethdev.c +4 -2
index 06735dd..6525bb2 100644
@@ -537,10 +537,10 @@ static int eth_vmxnet3_pci_remove(struct rte_pci_device *pci_dev)
 		     addr[0], addr[1], addr[2],
 		     addr[3], addr[4], addr[5]);
 
-	val = *(const uint32_t *)addr;
+	memcpy(&val, addr, 4);
 	VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_MACL, val);
 
-	val = (addr[5] << 8) | addr[4];
+	memcpy(&val, addr + 4, 2);
 	VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_MACH, val);
 }
 
@@ -1146,6 +1146,8 @@ static int eth_vmxnet3_pci_remove(struct rte_pci_device *pci_dev)
 {
 	struct vmxnet3_hw *hw = dev->data->dev_private;
 
+	ether_addr_copy(mac_addr, (struct ether_addr *)(hw->perm_addr));
+	ether_addr_copy(mac_addr, &dev->data->mac_addrs[0]);
 	vmxnet3_write_mac(hw, mac_addr->addr_bytes);
 }
 
Signature · 1 line
1.8.3.1
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · David Harton

Updated vmxnet3_mac_addr_set() to store the newly set MAC address. Modified vmxnet3_write_mac() so the h/w is updated in an endian neutral manner.

Quoted 34 lines
---
 drivers/net/vmxnet3/vmxnet3_ethdev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/vmxnet3/vmxnet3_ethdev.c +4 -2
index 06735dd..6525bb2 100644
@@ -537,10 +537,10 @@ static int eth_vmxnet3_pci_remove(struct rte_pci_device *pci_dev)
 		     addr[0], addr[1], addr[2],
 		     addr[3], addr[4], addr[5]);
 
-	val = *(const uint32_t *)addr;
+	memcpy(&val, addr, 4);
 	VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_MACL, val);
 
-	val = (addr[5] << 8) | addr[4];
+	memcpy(&val, addr + 4, 2);
 	VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_MACH, val);
 }
 
@@ -1146,6 +1146,8 @@ static int eth_vmxnet3_pci_remove(struct rte_pci_device *pci_dev)
 {
 	struct vmxnet3_hw *hw = dev->data->dev_private;
 
+	ether_addr_copy(mac_addr, (struct ether_addr *)(hw->perm_addr));
+	ether_addr_copy(mac_addr, &dev->data->mac_addrs[0]);
 	vmxnet3_write_mac(hw, mac_addr->addr_bytes);
 }
 
Signature · 1 line
1.8.3.1