[dpdk-dev] net/bonding: set slave MAC addresses correctly

Message ID 20171228021231.15363-1-3chas3@gmail.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

Chas Williams Dec. 28, 2017, 2:12 a.m. UTC
  From: Chas Williams <chas3@att.com>

Use rte_eth_dev_default_mac_addr_set() to change a slave MAC address.
mac_address_set() only updates the software copy and does nothing to
update the hardware.

Signed-off-by: Chas Williams <chas3@att.com>
---
 drivers/net/bonding/rte_eth_bond_api.c |  2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c | 10 ++++++----
 2 files changed, 7 insertions(+), 5 deletions(-)
  

Comments

Doherty, Declan Jan. 9, 2018, 4:15 p.m. UTC | #1
On 28/12/2017 2:12 AM, Chas Williams wrote:
> From: Chas Williams <chas3@att.com>
> 
> Use rte_eth_dev_default_mac_addr_set() to change a slave MAC address.
> mac_address_set() only updates the software copy and does nothing to
> update the hardware.
> 
> Signed-off-by: Chas Williams <chas3@att.com>
> ---
...
>

Acked-by: Declan Doherty <declan.doherty@intel.com>
  
Ferruh Yigit Jan. 10, 2018, 8:36 p.m. UTC | #2
On 1/9/2018 4:15 PM, Doherty, Declan wrote:
> On 28/12/2017 2:12 AM, Chas Williams wrote:
>> From: Chas Williams <chas3@att.com>
>>
>> Use rte_eth_dev_default_mac_addr_set() to change a slave MAC address.
>> mac_address_set() only updates the software copy and does nothing to
>> update the hardware.
>>
>> Signed-off-by: Chas Williams <chas3@att.com>

> Acked-by: Declan Doherty <declan.doherty@intel.com>

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

Patch

diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index 703bb39..532683b 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -453,7 +453,7 @@  __eth_bond_slave_remove_lock_free(uint16_t bonded_port_id,
 			&rte_eth_devices[bonded_port_id].data->port_id);
 
 	/* Restore original MAC address of slave device */
-	mac_address_set(&rte_eth_devices[slave_port_id],
+	rte_eth_dev_default_mac_addr_set(slave_port_id,
 			&(internals->slaves[slave_idx].persisted_mac_addr));
 
 	slave_eth_dev = &rte_eth_devices[slave_port_id];
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index d1d3663..02688f7 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1511,7 +1511,8 @@  mac_address_slaves_update(struct rte_eth_dev *bonded_eth_dev)
 	case BONDING_MODE_BALANCE:
 	case BONDING_MODE_BROADCAST:
 		for (i = 0; i < internals->slave_count; i++) {
-			if (mac_address_set(&rte_eth_devices[internals->slaves[i].port_id],
+			if (rte_eth_dev_default_mac_addr_set(
+					internals->slaves[i].port_id,
 					bonded_eth_dev->data->mac_addrs)) {
 				RTE_BOND_LOG(ERR, "Failed to update port Id %d MAC address",
 						internals->slaves[i].port_id);
@@ -1529,15 +1530,16 @@  mac_address_slaves_update(struct rte_eth_dev *bonded_eth_dev)
 		for (i = 0; i < internals->slave_count; i++) {
 			if (internals->slaves[i].port_id ==
 					internals->current_primary_port) {
-				if (mac_address_set(&rte_eth_devices[internals->primary_port],
+				if (rte_eth_dev_default_mac_addr_set(
+						internals->primary_port,
 						bonded_eth_dev->data->mac_addrs)) {
 					RTE_BOND_LOG(ERR, "Failed to update port Id %d MAC address",
 							internals->current_primary_port);
 					return -1;
 				}
 			} else {
-				if (mac_address_set(
-						&rte_eth_devices[internals->slaves[i].port_id],
+				if (rte_eth_dev_default_mac_addr_set(
+						internals->slaves[i].port_id,
 						&internals->slaves[i].persisted_mac_addr)) {
 					RTE_BOND_LOG(ERR, "Failed to update port Id %d MAC address",
 							internals->slaves[i].port_id);