From: Yongseok Koh Date: Thu, 6 Jul 2017 18:41:09 +0000 (-0700) Subject: net/mlx5: select Rx/Tx callbacks when starting device X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=f3d2dcc856fe6de4e14a9a44eb760da4634df655;p=dpdk.git net/mlx5: select Rx/Tx callbacks when starting device The callbacks are global to a device but the selection is made every queue configuration, which is redundant. Signed-off-by: Yongseok Koh Acked-by: Nelio Laranjeiro --- diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c index 039335e2e4..54c4c6caea 100644 --- a/drivers/net/mlx5/mlx5_ethdev.c +++ b/drivers/net/mlx5/mlx5_ethdev.c @@ -923,8 +923,6 @@ mlx5_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) struct priv *priv = dev->data->dev_private; int ret = 0; unsigned int i; - uint16_t (*rx_func)(void *, struct rte_mbuf **, uint16_t) = - mlx5_rx_burst; unsigned int max_frame_len; int rehash; int restart = priv->started; @@ -944,7 +942,7 @@ mlx5_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) /* Temporarily replace RX handler with a fake one, assuming it has not * been copied elsewhere. */ dev->rx_pkt_burst = removed_rx_burst; - /* Make sure everyone has left mlx5_rx_burst() and uses + /* Make sure everyone has left dev->rx_pkt_burst() and uses * removed_rx_burst() instead. */ rte_wmb(); usleep(1000); @@ -1018,17 +1016,13 @@ recover: /* Double fault, disable RX. */ break; } - /* - * Use a safe RX burst function in case of error, otherwise mimic - * mlx5_dev_start(). - */ + /* Mimic mlx5_dev_start(). */ if (ret) { ERROR("unable to reconfigure RX queues, RX disabled"); - rx_func = removed_rx_burst; } else if (restart && - !rehash && - !priv_create_hash_rxqs(priv) && - !priv_rehash_flows(priv)) { + !rehash && + !priv_create_hash_rxqs(priv) && + !priv_rehash_flows(priv)) { if (dev->data->dev_conf.fdir_conf.mode == RTE_FDIR_MODE_NONE) priv_fdir_enable(priv); priv_dev_interrupt_handler_install(priv, dev); @@ -1036,7 +1030,12 @@ recover: priv->mtu = mtu; /* Burst functions can now be called again. */ rte_wmb(); - dev->rx_pkt_burst = rx_func; + /* + * Use a safe RX burst function in case of error, otherwise select RX + * burst function again. + */ + if (!ret) + priv_select_rx_function(priv); out: priv_unlock(priv); assert(ret >= 0); diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 22be999e8b..98b20eb92b 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -1226,8 +1226,6 @@ mlx5_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, DEBUG("%p: adding RX queue %p to list", (void *)dev, (void *)rxq_ctrl); (*priv->rxqs)[idx] = &rxq_ctrl->rxq; - /* Update receive callback. */ - priv_select_rx_function(priv); } priv_unlock(priv); return -ret; diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index 40f23da93a..595a9e064a 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -72,6 +72,9 @@ mlx5_dev_start(struct rte_eth_dev *dev) priv_unlock(priv); return 0; } + /* Update Rx/Tx callback. */ + priv_select_tx_function(priv); + priv_select_rx_function(priv); DEBUG("%p: allocating and configuring hash RX queues", (void *)dev); err = priv_create_hash_rxqs(priv); if (!err) diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c index ac9dfc5f0c..03e23f58d0 100644 --- a/drivers/net/mlx5/mlx5_txq.c +++ b/drivers/net/mlx5/mlx5_txq.c @@ -496,8 +496,6 @@ mlx5_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, DEBUG("%p: adding TX queue %p to list", (void *)dev, (void *)txq_ctrl); (*priv->txqs)[idx] = &txq_ctrl->txq; - /* Update send callback. */ - priv_select_tx_function(priv); } priv_unlock(priv); return -ret;