This commit adds helpers to remove redundant code.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
((priv->ctx != NULL) ? priv->ctx->device->name : ""));
/* In case mlx5_dev_stop() has not been called. */
priv_dev_interrupt_handler_uninstall(priv, dev);
- priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_ALLMULTI);
- priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_PROMISC);
- priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_BROADCAST);
- priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_IPV6MULTI);
+ priv_special_flow_disable_all(priv);
priv_mac_addrs_disable(priv);
priv_destroy_hash_rxqs(priv);
int priv_special_flow_enable(struct priv *, enum hash_rxq_flow_type);
void priv_special_flow_disable(struct priv *, enum hash_rxq_flow_type);
+int priv_special_flow_enable_all(struct priv *);
+void priv_special_flow_disable_all(struct priv *);
void mlx5_promiscuous_enable(struct rte_eth_dev *);
void mlx5_promiscuous_disable(struct rte_eth_dev *);
void mlx5_allmulticast_enable(struct rte_eth_dev *);
}
}
+/**
+ * Enable all special flows in all hash RX queues.
+ *
+ * @param priv
+ * Private structure.
+ */
+int
+priv_special_flow_enable_all(struct priv *priv)
+{
+ enum hash_rxq_flow_type flow_type;
+
+ for (flow_type = 0; flow_type != HASH_RXQ_FLOW_TYPE_MAC; ++flow_type) {
+ int ret;
+
+ ret = priv_special_flow_enable(priv, flow_type);
+ if (!ret)
+ continue;
+ /* Failure, rollback. */
+ while (flow_type)
+ priv_special_flow_disable(priv, --flow_type);
+ return ret;
+ }
+ return 0;
+}
+
+/**
+ * Disable all special flows in all hash RX queues.
+ *
+ * @param priv
+ * Private structure.
+ */
+void
+priv_special_flow_disable_all(struct priv *priv)
+{
+ enum hash_rxq_flow_type flow_type;
+
+ for (flow_type = 0; flow_type != HASH_RXQ_FLOW_TYPE_MAC; ++flow_type)
+ priv_special_flow_disable(priv, flow_type);
+}
+
/**
* DPDK callback to enable promiscuous mode.
*
" %s",
(void *)priv, strerror(err));
/* Rollback. */
- priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_IPV6MULTI);
- priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_BROADCAST);
- priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_ALLMULTI);
- priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_PROMISC);
+ priv_special_flow_disable_all(priv);
priv_mac_addrs_disable(priv);
priv_destroy_hash_rxqs(priv);
}
return;
}
DEBUG("%p: cleaning up and destroying hash RX queues", (void *)dev);
- priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_IPV6MULTI);
- priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_BROADCAST);
- priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_ALLMULTI);
- priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_PROMISC);
+ priv_special_flow_disable_all(priv);
priv_mac_addrs_disable(priv);
priv_destroy_hash_rxqs(priv);
priv_fdir_disable(priv);