mlx5: manage all special flow types at once
This commit adds helpers to remove redundant code. Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
This commit is contained in:
parent
1371f4df16
commit
0d2186743d
@ -88,10 +88,7 @@ mlx5_dev_close(struct rte_eth_dev *dev)
|
|||||||
((priv->ctx != NULL) ? priv->ctx->device->name : ""));
|
((priv->ctx != NULL) ? priv->ctx->device->name : ""));
|
||||||
/* In case mlx5_dev_stop() has not been called. */
|
/* In case mlx5_dev_stop() has not been called. */
|
||||||
priv_dev_interrupt_handler_uninstall(priv, dev);
|
priv_dev_interrupt_handler_uninstall(priv, dev);
|
||||||
priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_ALLMULTI);
|
priv_special_flow_disable_all(priv);
|
||||||
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_mac_addrs_disable(priv);
|
priv_mac_addrs_disable(priv);
|
||||||
priv_destroy_hash_rxqs(priv);
|
priv_destroy_hash_rxqs(priv);
|
||||||
|
|
||||||
|
@ -199,6 +199,8 @@ int mlx5_dev_rss_reta_update(struct rte_eth_dev *,
|
|||||||
|
|
||||||
int priv_special_flow_enable(struct priv *, enum hash_rxq_flow_type);
|
int priv_special_flow_enable(struct priv *, enum hash_rxq_flow_type);
|
||||||
void priv_special_flow_disable(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_enable(struct rte_eth_dev *);
|
||||||
void mlx5_promiscuous_disable(struct rte_eth_dev *);
|
void mlx5_promiscuous_disable(struct rte_eth_dev *);
|
||||||
void mlx5_allmulticast_enable(struct rte_eth_dev *);
|
void mlx5_allmulticast_enable(struct rte_eth_dev *);
|
||||||
|
@ -267,6 +267,46 @@ priv_special_flow_disable(struct priv *priv, enum hash_rxq_flow_type flow_type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
* DPDK callback to enable promiscuous mode.
|
||||||
*
|
*
|
||||||
|
@ -80,10 +80,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
|
|||||||
" %s",
|
" %s",
|
||||||
(void *)priv, strerror(err));
|
(void *)priv, strerror(err));
|
||||||
/* Rollback. */
|
/* Rollback. */
|
||||||
priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_IPV6MULTI);
|
priv_special_flow_disable_all(priv);
|
||||||
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_mac_addrs_disable(priv);
|
priv_mac_addrs_disable(priv);
|
||||||
priv_destroy_hash_rxqs(priv);
|
priv_destroy_hash_rxqs(priv);
|
||||||
}
|
}
|
||||||
@ -113,10 +110,7 @@ mlx5_dev_stop(struct rte_eth_dev *dev)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DEBUG("%p: cleaning up and destroying hash RX queues", (void *)dev);
|
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_all(priv);
|
||||||
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_mac_addrs_disable(priv);
|
priv_mac_addrs_disable(priv);
|
||||||
priv_destroy_hash_rxqs(priv);
|
priv_destroy_hash_rxqs(priv);
|
||||||
priv_fdir_disable(priv);
|
priv_fdir_disable(priv);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user