bond_mode_8023ad_periodic_cb, arg);
}
+static int
+bond_mode_8023ad_register_lacp_mac(uint16_t slave_id)
+{
+ rte_eth_allmulticast_enable(slave_id);
+ if (rte_eth_allmulticast_get(slave_id)) {
+ RTE_BOND_LOG(DEBUG, "forced allmulti for port %u",
+ slave_id);
+ bond_mode_8023ad_ports[slave_id].forced_rx_flags =
+ BOND_8023AD_FORCED_ALLMULTI;
+ return 0;
+ }
+
+ rte_eth_promiscuous_enable(slave_id);
+ if (rte_eth_promiscuous_get(slave_id)) {
+ RTE_BOND_LOG(DEBUG, "forced promiscuous for port %u",
+ slave_id);
+ bond_mode_8023ad_ports[slave_id].forced_rx_flags =
+ BOND_8023AD_FORCED_PROMISC;
+ return 0;
+ }
+
+ return -1;
+}
+
+static void
+bond_mode_8023ad_unregister_lacp_mac(uint16_t slave_id)
+{
+ switch (bond_mode_8023ad_ports[slave_id].forced_rx_flags) {
+ case BOND_8023AD_FORCED_ALLMULTI:
+ RTE_BOND_LOG(DEBUG, "unset allmulti for port %u", slave_id);
+ rte_eth_allmulticast_disable(slave_id);
+ break;
+
+ case BOND_8023AD_FORCED_PROMISC:
+ RTE_BOND_LOG(DEBUG, "unset promisc for port %u", slave_id);
+ rte_eth_promiscuous_disable(slave_id);
+ break;
+
+ default:
+ break;
+ }
+}
+
void
bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev,
uint16_t slave_id)
/* use this port as agregator */
port->aggregator_port_id = slave_id;
- rte_eth_promiscuous_enable(slave_id);
+
+ if (bond_mode_8023ad_register_lacp_mac(slave_id) < 0) {
+ RTE_BOND_LOG(WARNING, "slave %u is most likely broken and won't receive LACP packets",
+ slave_id);
+ }
timer_cancel(&port->warning_timer);
old_partner_state = port->partner_state;
record_default(port);
+ bond_mode_8023ad_unregister_lacp_mac(slave_id);
+
/* If partner timeout state changes then disable timer */
if (!((old_partner_state ^ port->partner_state) &
STATE_LACP_SHORT_TIMEOUT))
uint16_t slave_count, idx;
uint8_t collecting; /* current slave collecting status */
- const uint8_t promisc = internals->promiscuous_en;
+ const uint8_t promisc = rte_eth_promiscuous_get(internals->port_id);
+ const uint8_t allmulti = rte_eth_allmulticast_get(internals->port_id);
uint8_t subtype;
uint16_t i;
uint16_t j;
/* Remove packet from array if:
* - it is slow packet but no dedicated rxq is present,
* - slave is not in collecting state,
- * - bonding interface is not in promiscuous mode and
- * packet is not multicast and address does not match,
+ * - bonding interface is not in promiscuous mode:
+ * - packet is unicast and address does not match,
+ * - packet is multicast and bonding interface
+ * is not in allmulti,
*/
if (unlikely(
(!dedicated_rxq &&
bufs[j])) ||
!collecting ||
(!promisc &&
- !rte_is_multicast_ether_addr(&hdr->d_addr) &&
- !rte_is_same_ether_addr(bond_mac,
- &hdr->d_addr)))) {
+ ((rte_is_unicast_ether_addr(&hdr->d_addr) &&
+ !rte_is_same_ether_addr(bond_mac,
+ &hdr->d_addr)) ||
+ (!allmulti &&
+ rte_is_multicast_ether_addr(&hdr->d_addr)))))) {
if (hdr->ether_type == ether_type_slow_be) {
bond_mode_8023ad_handle_slow_pkt(
}
}
- /* If bonded device is configure in promiscuous mode then re-apply config */
- if (internals->promiscuous_en)
- bond_ethdev_promiscuous_enable(eth_dev);
-
if (internals->mode == BONDING_MODE_8023AD) {
if (internals->mode4.dedicated_queues.enabled == 1) {
internals->mode4.dedicated_queues.rx_qid =
struct bond_dev_private *internals = eth_dev->data->dev_private;
int i;
- internals->promiscuous_en = 1;
-
switch (internals->mode) {
/* Promiscuous mode is propagated to all slaves */
case BONDING_MODE_ROUND_ROBIN:
case BONDING_MODE_BALANCE:
case BONDING_MODE_BROADCAST:
- for (i = 0; i < internals->slave_count; i++)
- rte_eth_promiscuous_enable(internals->slaves[i].port_id);
- break;
- /* In mode4 promiscus mode is managed when slave is added/removed */
case BONDING_MODE_8023AD:
+ for (i = 0; i < internals->slave_count; i++) {
+ uint16_t port_id = internals->slaves[i].port_id;
+
+ rte_eth_promiscuous_enable(port_id);
+ }
break;
/* Promiscuous mode is propagated only to primary slave */
case BONDING_MODE_ACTIVE_BACKUP:
struct bond_dev_private *internals = dev->data->dev_private;
int i;
- internals->promiscuous_en = 0;
-
switch (internals->mode) {
/* Promiscuous mode is propagated to all slaves */
case BONDING_MODE_ROUND_ROBIN:
case BONDING_MODE_BALANCE:
case BONDING_MODE_BROADCAST:
- for (i = 0; i < internals->slave_count; i++)
- rte_eth_promiscuous_disable(internals->slaves[i].port_id);
- break;
- /* In mode4 promiscus mode is set managed when slave is added/removed */
case BONDING_MODE_8023AD:
+ for (i = 0; i < internals->slave_count; i++) {
+ uint16_t port_id = internals->slaves[i].port_id;
+
+ if (internals->mode == BONDING_MODE_8023AD &&
+ bond_mode_8023ad_ports[port_id].forced_rx_flags ==
+ BOND_8023AD_FORCED_PROMISC)
+ continue;
+ rte_eth_promiscuous_disable(port_id);
+ }
break;
/* Promiscuous mode is propagated only to primary slave */
case BONDING_MODE_ACTIVE_BACKUP:
}
}
+static void
+bond_ethdev_allmulticast_enable(struct rte_eth_dev *eth_dev)
+{
+ struct bond_dev_private *internals = eth_dev->data->dev_private;
+ int i;
+
+ switch (internals->mode) {
+ /* allmulti mode is propagated to all slaves */
+ case BONDING_MODE_ROUND_ROBIN:
+ case BONDING_MODE_BALANCE:
+ case BONDING_MODE_BROADCAST:
+ case BONDING_MODE_8023AD:
+ for (i = 0; i < internals->slave_count; i++) {
+ uint16_t port_id = internals->slaves[i].port_id;
+
+ rte_eth_allmulticast_enable(port_id);
+ }
+ break;
+ /* allmulti mode is propagated only to primary slave */
+ case BONDING_MODE_ACTIVE_BACKUP:
+ case BONDING_MODE_TLB:
+ case BONDING_MODE_ALB:
+ default:
+ /* Do not touch allmulti when there cannot be primary ports */
+ if (internals->slave_count == 0)
+ break;
+ rte_eth_allmulticast_enable(internals->current_primary_port);
+ }
+}
+
+static void
+bond_ethdev_allmulticast_disable(struct rte_eth_dev *eth_dev)
+{
+ struct bond_dev_private *internals = eth_dev->data->dev_private;
+ int i;
+
+ switch (internals->mode) {
+ /* allmulti mode is propagated to all slaves */
+ case BONDING_MODE_ROUND_ROBIN:
+ case BONDING_MODE_BALANCE:
+ case BONDING_MODE_BROADCAST:
+ case BONDING_MODE_8023AD:
+ for (i = 0; i < internals->slave_count; i++) {
+ uint16_t port_id = internals->slaves[i].port_id;
+
+ if (internals->mode == BONDING_MODE_8023AD &&
+ bond_mode_8023ad_ports[port_id].forced_rx_flags ==
+ BOND_8023AD_FORCED_ALLMULTI)
+ continue;
+ rte_eth_allmulticast_disable(port_id);
+ }
+ break;
+ /* allmulti mode is propagated only to primary slave */
+ case BONDING_MODE_ACTIVE_BACKUP:
+ case BONDING_MODE_TLB:
+ case BONDING_MODE_ALB:
+ default:
+ /* Do not touch allmulti when there cannot be primary ports */
+ if (internals->slave_count == 0)
+ break;
+ rte_eth_allmulticast_disable(internals->current_primary_port);
+ }
+}
+
static void
bond_ethdev_delayed_lsc_propagation(void *arg)
{
.stats_reset = bond_ethdev_stats_reset,
.promiscuous_enable = bond_ethdev_promiscuous_enable,
.promiscuous_disable = bond_ethdev_promiscuous_disable,
+ .allmulticast_enable = bond_ethdev_allmulticast_enable,
+ .allmulticast_disable = bond_ethdev_allmulticast_disable,
.reta_update = bond_ethdev_rss_reta_update,
.reta_query = bond_ethdev_rss_reta_query,
.rss_hash_update = bond_ethdev_rss_hash_update,