net/mlx5: change eth device reference for secondary process
rte_eth_dev created by primary process were not available in secondary process, it was not possible to use the primary process local memory object from a secondary process. This patch modify the reference of primary rte_eth_dev object, use local rte_eth_dev secondary process instead. Signed-off-by: Xueming Li <xuemingl@mellanox.com> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
This commit is contained in:
parent
c9a4779135
commit
aee1b165db
@ -87,7 +87,7 @@ struct mlx5_xstats_ctrl {
|
||||
};
|
||||
|
||||
struct priv {
|
||||
struct rte_eth_dev *dev; /* Ethernet device. */
|
||||
struct rte_eth_dev *dev; /* Ethernet device of master process. */
|
||||
struct ibv_context *ctx; /* Verbs context. */
|
||||
struct ibv_device_attr_ex device_attr; /* Device properties. */
|
||||
struct ibv_pd *pd; /* Protection Domain. */
|
||||
@ -208,8 +208,8 @@ void priv_dev_interrupt_handler_uninstall(struct priv *, struct rte_eth_dev *);
|
||||
void priv_dev_interrupt_handler_install(struct priv *, struct rte_eth_dev *);
|
||||
int mlx5_set_link_down(struct rte_eth_dev *dev);
|
||||
int mlx5_set_link_up(struct rte_eth_dev *dev);
|
||||
void priv_select_tx_function(struct priv *);
|
||||
void priv_select_rx_function(struct priv *);
|
||||
void priv_dev_select_tx_function(struct priv *priv, struct rte_eth_dev *dev);
|
||||
void priv_dev_select_rx_function(struct priv *priv, struct rte_eth_dev *dev);
|
||||
|
||||
/* mlx5_mac.c */
|
||||
|
||||
|
@ -1296,7 +1296,9 @@ priv_dev_interrupt_handler_install(struct priv *priv, struct rte_eth_dev *dev)
|
||||
* Change the link state (UP / DOWN).
|
||||
*
|
||||
* @param priv
|
||||
* Pointer to Ethernet device structure.
|
||||
* Pointer to private data structure.
|
||||
* @param dev
|
||||
* Pointer to rte_eth_dev structure.
|
||||
* @param up
|
||||
* Nonzero for link up, otherwise link down.
|
||||
*
|
||||
@ -1304,17 +1306,16 @@ priv_dev_interrupt_handler_install(struct priv *priv, struct rte_eth_dev *dev)
|
||||
* 0 on success, errno value on failure.
|
||||
*/
|
||||
static int
|
||||
priv_set_link(struct priv *priv, int up)
|
||||
priv_dev_set_link(struct priv *priv, struct rte_eth_dev *dev, int up)
|
||||
{
|
||||
struct rte_eth_dev *dev = priv->dev;
|
||||
int err;
|
||||
|
||||
if (up) {
|
||||
err = priv_set_flags(priv, ~IFF_UP, IFF_UP);
|
||||
if (err)
|
||||
return err;
|
||||
priv_select_tx_function(priv);
|
||||
priv_select_rx_function(priv);
|
||||
priv_dev_select_tx_function(priv, dev);
|
||||
priv_dev_select_rx_function(priv, dev);
|
||||
} else {
|
||||
err = priv_set_flags(priv, ~IFF_UP, ~IFF_UP);
|
||||
if (err)
|
||||
@ -1341,7 +1342,7 @@ mlx5_set_link_down(struct rte_eth_dev *dev)
|
||||
int err;
|
||||
|
||||
priv_lock(priv);
|
||||
err = priv_set_link(priv, 0);
|
||||
err = priv_dev_set_link(priv, dev, 0);
|
||||
priv_unlock(priv);
|
||||
return err;
|
||||
}
|
||||
@ -1362,7 +1363,7 @@ mlx5_set_link_up(struct rte_eth_dev *dev)
|
||||
int err;
|
||||
|
||||
priv_lock(priv);
|
||||
err = priv_set_link(priv, 1);
|
||||
err = priv_dev_set_link(priv, dev, 1);
|
||||
priv_unlock(priv);
|
||||
return err;
|
||||
}
|
||||
@ -1371,29 +1372,33 @@ mlx5_set_link_up(struct rte_eth_dev *dev)
|
||||
* Configure the TX function to use.
|
||||
*
|
||||
* @param priv
|
||||
* Pointer to private structure.
|
||||
* Pointer to private data structure.
|
||||
* @param dev
|
||||
* Pointer to rte_eth_dev structure.
|
||||
*/
|
||||
void
|
||||
priv_select_tx_function(struct priv *priv)
|
||||
priv_dev_select_tx_function(struct priv *priv, struct rte_eth_dev *dev)
|
||||
{
|
||||
priv->dev->tx_pkt_burst = mlx5_tx_burst;
|
||||
assert(priv != NULL);
|
||||
assert(dev != NULL);
|
||||
dev->tx_pkt_burst = mlx5_tx_burst;
|
||||
/* Select appropriate TX function. */
|
||||
if (priv->mps == MLX5_MPW_ENHANCED) {
|
||||
if (priv_check_vec_tx_support(priv) > 0) {
|
||||
if (priv_check_raw_vec_tx_support(priv) > 0)
|
||||
priv->dev->tx_pkt_burst = mlx5_tx_burst_raw_vec;
|
||||
dev->tx_pkt_burst = mlx5_tx_burst_raw_vec;
|
||||
else
|
||||
priv->dev->tx_pkt_burst = mlx5_tx_burst_vec;
|
||||
dev->tx_pkt_burst = mlx5_tx_burst_vec;
|
||||
DEBUG("selected Enhanced MPW TX vectorized function");
|
||||
} else {
|
||||
priv->dev->tx_pkt_burst = mlx5_tx_burst_empw;
|
||||
dev->tx_pkt_burst = mlx5_tx_burst_empw;
|
||||
DEBUG("selected Enhanced MPW TX function");
|
||||
}
|
||||
} else if (priv->mps && priv->txq_inline) {
|
||||
priv->dev->tx_pkt_burst = mlx5_tx_burst_mpw_inline;
|
||||
dev->tx_pkt_burst = mlx5_tx_burst_mpw_inline;
|
||||
DEBUG("selected MPW inline TX function");
|
||||
} else if (priv->mps) {
|
||||
priv->dev->tx_pkt_burst = mlx5_tx_burst_mpw;
|
||||
dev->tx_pkt_burst = mlx5_tx_burst_mpw;
|
||||
DEBUG("selected MPW TX function");
|
||||
}
|
||||
}
|
||||
@ -1402,15 +1407,19 @@ priv_select_tx_function(struct priv *priv)
|
||||
* Configure the RX function to use.
|
||||
*
|
||||
* @param priv
|
||||
* Pointer to private structure.
|
||||
* Pointer to private data structure.
|
||||
* @param dev
|
||||
* Pointer to rte_eth_dev structure.
|
||||
*/
|
||||
void
|
||||
priv_select_rx_function(struct priv *priv)
|
||||
priv_dev_select_rx_function(struct priv *priv, struct rte_eth_dev *dev)
|
||||
{
|
||||
assert(priv != NULL);
|
||||
assert(dev != NULL);
|
||||
if (priv_check_vec_rx_support(priv) > 0) {
|
||||
priv->dev->rx_pkt_burst = mlx5_rx_burst_vec;
|
||||
dev->rx_pkt_burst = mlx5_rx_burst_vec;
|
||||
DEBUG("selected RX vectorized function");
|
||||
} else {
|
||||
priv->dev->rx_pkt_burst = mlx5_rx_burst;
|
||||
dev->rx_pkt_burst = mlx5_rx_burst;
|
||||
}
|
||||
}
|
||||
|
@ -1068,6 +1068,8 @@ mlx5_dev_filter_ctrl(struct rte_eth_dev *dev,
|
||||
int ret = EINVAL;
|
||||
struct priv *priv = dev->data->dev_private;
|
||||
|
||||
if (mlx5_is_secondary())
|
||||
return -E_RTE_SECONDARY;
|
||||
switch (filter_type) {
|
||||
case RTE_ETH_FILTER_GENERIC:
|
||||
if (filter_op != RTE_ETH_FILTER_GET)
|
||||
|
@ -350,6 +350,7 @@ mlx5_dev_rss_reta_update(struct rte_eth_dev *dev,
|
||||
int ret;
|
||||
struct priv *priv = dev->data->dev_private;
|
||||
|
||||
assert(!mlx5_is_secondary());
|
||||
mlx5_dev_stop(dev);
|
||||
priv_lock(priv);
|
||||
ret = priv_dev_rss_reta_update(priv, reta_conf, reta_size);
|
||||
|
@ -1250,6 +1250,7 @@ priv_rx_intr_vec_enable(struct priv *priv)
|
||||
unsigned int count = 0;
|
||||
struct rte_intr_handle *intr_handle = priv->dev->intr_handle;
|
||||
|
||||
assert(!mlx5_is_secondary());
|
||||
if (!priv->dev->data->dev_conf.intr_conf.rxq)
|
||||
return 0;
|
||||
priv_rx_intr_vec_disable(priv);
|
||||
|
@ -66,8 +66,8 @@ mlx5_dev_start(struct rte_eth_dev *dev)
|
||||
return 0;
|
||||
}
|
||||
/* Update Rx/Tx callback. */
|
||||
priv_select_tx_function(priv);
|
||||
priv_select_rx_function(priv);
|
||||
priv_dev_select_tx_function(priv, dev);
|
||||
priv_dev_select_rx_function(priv, dev);
|
||||
DEBUG("%p: allocating and configuring hash RX queues", (void *)dev);
|
||||
err = priv_create_hash_rxqs(priv);
|
||||
if (!err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user