Skip to contentSkip to conversation

net/bonding: add add/remove mac addrs

PATCH New Alex Kiselev 1 participant 1 message Jun 20, 2018

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

PATCH v4 1/1 net/bonding: add add/remove mac addrs

add functions to add/remove MAC addresses

---
 drivers/net/bonding/rte_eth_bond_api.c     |  12 ++-
 drivers/net/bonding/rte_eth_bond_pmd.c     | 131 ++++++++++++++++++++++++++++-
 drivers/net/bonding/rte_eth_bond_private.h |   8 ++
 3 files changed, 146 insertions(+), 5 deletions(-)
drivers/net/bonding/rte_eth_bond_api.c +11 -1
index d558df8b9..9123f4614 100644
@@ -373,6 +373,13 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id)
 		return -1;
 	}
 
+	/* Add additional MAC addresses to the slave */
+	if (slave_add_mac_addresses(bonded_eth_dev, slave_port_id) != 0) {
+		RTE_BOND_LOG(ERR, "Failed to add mac address(es) to slave %hu",
+				slave_port_id);
+		return -1;
+	}
+
 	internals->slave_count++;
 
 	if (bonded_eth_dev->data->dev_started) {
@@ -387,7 +394,7 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id)
 	/* Add slave details to bonded device */
 	slave_eth_dev->data->dev_flags |= RTE_ETH_DEV_BONDED_SLAVE;
 
-	/* Update all slave devices MACs*/
+	/* Update all slave devices MACs */
 	mac_address_slaves_update(bonded_eth_dev);
 
 	/* Register link status change callback with bonded device pointer as
@@ -491,6 +498,9 @@ __eth_bond_slave_remove_lock_free(uint16_t bonded_port_id,
 	rte_eth_dev_default_mac_addr_set(slave_port_id,
 			&(internals->slaves[slave_idx].persisted_mac_addr));
 
+	/* remove additional MAC addresses from the slave */
+	slave_remove_mac_addresses(bonded_eth_dev, slave_port_id);
+
 	/*
 	 * Remove bond device flows from slave device.
 	 * Note: don't restore flow isolate mode.
drivers/net/bonding/rte_eth_bond_pmd.c +127 -4

168 lines not on this page · raw message

drivers/net/bonding/rte_eth_bond_private.h +8 -0
index 65445b863..43e0e448d 100644
@@ -230,6 +230,14 @@ mac_address_get(struct rte_eth_dev *eth_dev, struct ether_addr *dst_mac_addr);
 int
 mac_address_slaves_update(struct rte_eth_dev *bonded_eth_dev);
 
+int
+slave_add_mac_addresses(struct rte_eth_dev *bonded_eth_dev,
+		uint16_t slave_port_id);
+
+int
+slave_remove_mac_addresses(struct rte_eth_dev *bonded_eth_dev,
+		uint16_t slave_port_id);
+
 int
 bond_ethdev_mode_set(struct rte_eth_dev *eth_dev, int mode);
 
Signature · 1 line
2.16.1.windows.1