summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5/mlx5_trigger.c
diff options
context:
space:
mode:
authorNĂ©lio Laranjeiro <nelio.laranjeiro@6wind.com>2018-03-05 13:21:04 +0100
committerFerruh Yigit <ferruh.yigit@intel.com>2018-03-30 14:08:44 +0200
commitaf4f09f28294fac762ff413fbf14b48c42c128fd (patch)
tree481fe7dd62629d4da99b4825c7363d2747709d7e /drivers/net/mlx5/mlx5_trigger.c
parent7b2423cd2e84c61d3052147cea7643d15d49d1e9 (diff)
downloaddpdk-af4f09f28294fac762ff413fbf14b48c42c128fd.zip
dpdk-af4f09f28294fac762ff413fbf14b48c42c128fd.tar.gz
dpdk-af4f09f28294fac762ff413fbf14b48c42c128fd.tar.xz
net/mlx5: prefix all functions with mlx5
This change removes the need to distinguish unlocked priv_*() functions which are therefore renamed using a mlx5_*() prefix for consistency. At the same time, all functions from mlx5 uses a pointer to the ETH device instead of the one to the PMD private data. Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Diffstat (limited to 'drivers/net/mlx5/mlx5_trigger.c')
-rw-r--r--drivers/net/mlx5/mlx5_trigger.c118
1 files changed, 51 insertions, 67 deletions
diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
index 3ce9391..07226b8 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -21,12 +21,13 @@
* Pointer to Ethernet device structure.
*/
static void
-priv_txq_stop(struct priv *priv)
+mlx5_txq_stop(struct rte_eth_dev *dev)
{
+ struct priv *priv = dev->data->dev_private;
unsigned int i;
for (i = 0; i != priv->txqs_n; ++i)
- mlx5_priv_txq_release(priv, i);
+ mlx5_txq_release(dev, i);
}
/**
@@ -39,8 +40,9 @@ priv_txq_stop(struct priv *priv)
* 0 on success, errno on error.
*/
static int
-priv_txq_start(struct priv *priv)
+mlx5_txq_start(struct rte_eth_dev *dev)
{
+ struct priv *priv = dev->data->dev_private;
unsigned int i;
int ret = 0;
@@ -48,28 +50,28 @@ priv_txq_start(struct priv *priv)
for (i = 0; i != priv->txqs_n; ++i) {
unsigned int idx = 0;
struct mlx5_mr *mr;
- struct mlx5_txq_ctrl *txq_ctrl = mlx5_priv_txq_get(priv, i);
+ struct mlx5_txq_ctrl *txq_ctrl = mlx5_txq_get(dev, i);
if (!txq_ctrl)
continue;
LIST_FOREACH(mr, &priv->mr, next) {
- priv_txq_mp2mr_reg(priv, &txq_ctrl->txq, mr->mp, idx++);
+ mlx5_txq_mp2mr_reg(&txq_ctrl->txq, mr->mp, idx++);
if (idx == MLX5_PMD_TX_MP_CACHE)
break;
}
txq_alloc_elts(txq_ctrl);
- txq_ctrl->ibv = mlx5_priv_txq_ibv_new(priv, i);
+ txq_ctrl->ibv = mlx5_txq_ibv_new(dev, i);
if (!txq_ctrl->ibv) {
ret = ENOMEM;
goto error;
}
}
- ret = priv_tx_uar_remap(priv, priv->ctx->cmd_fd);
+ ret = mlx5_tx_uar_remap(dev, priv->ctx->cmd_fd);
if (ret)
goto error;
return ret;
error:
- priv_txq_stop(priv);
+ mlx5_txq_stop(dev);
return ret;
}
@@ -80,12 +82,13 @@ error:
* Pointer to Ethernet device structure.
*/
static void
-priv_rxq_stop(struct priv *priv)
+mlx5_rxq_stop(struct rte_eth_dev *dev)
{
+ struct priv *priv = dev->data->dev_private;
unsigned int i;
for (i = 0; i != priv->rxqs_n; ++i)
- mlx5_priv_rxq_release(priv, i);
+ mlx5_rxq_release(dev, i);
}
/**
@@ -98,20 +101,21 @@ priv_rxq_stop(struct priv *priv)
* 0 on success, errno on error.
*/
static int
-priv_rxq_start(struct priv *priv)
+mlx5_rxq_start(struct rte_eth_dev *dev)
{
+ struct priv *priv = dev->data->dev_private;
unsigned int i;
int ret = 0;
for (i = 0; i != priv->rxqs_n; ++i) {
- struct mlx5_rxq_ctrl *rxq_ctrl = mlx5_priv_rxq_get(priv, i);
+ struct mlx5_rxq_ctrl *rxq_ctrl = mlx5_rxq_get(dev, i);
if (!rxq_ctrl)
continue;
ret = rxq_alloc_elts(rxq_ctrl);
if (ret)
goto error;
- rxq_ctrl->ibv = mlx5_priv_rxq_ibv_new(priv, i);
+ rxq_ctrl->ibv = mlx5_rxq_ibv_new(dev, i);
if (!rxq_ctrl->ibv) {
ret = ENOMEM;
goto error;
@@ -119,7 +123,7 @@ priv_rxq_start(struct priv *priv)
}
return -ret;
error:
- priv_rxq_stop(priv);
+ mlx5_rxq_stop(dev);
return -ret;
}
@@ -142,7 +146,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
int err;
dev->data->dev_started = 1;
- err = priv_flow_create_drop_queue(priv);
+ err = mlx5_flow_create_drop_queue(dev);
if (err) {
ERROR("%p: Drop queue allocation failed: %s",
(void *)dev, strerror(err));
@@ -150,46 +154,46 @@ mlx5_dev_start(struct rte_eth_dev *dev)
}
DEBUG("%p: allocating and configuring hash RX queues", (void *)dev);
rte_mempool_walk(mlx5_mp2mr_iter, priv);
- err = priv_txq_start(priv);
+ err = mlx5_txq_start(dev);
if (err) {
ERROR("%p: TXQ allocation failed: %s",
(void *)dev, strerror(err));
goto error;
}
- err = priv_rxq_start(priv);
+ err = mlx5_rxq_start(dev);
if (err) {
ERROR("%p: RXQ allocation failed: %s",
(void *)dev, strerror(err));
goto error;
}
- err = priv_rx_intr_vec_enable(priv);
+ err = mlx5_rx_intr_vec_enable(dev);
if (err) {
ERROR("%p: RX interrupt vector creation failed",
(void *)priv);
goto error;
}
- priv_xstats_init(priv);
+ mlx5_xstats_init(dev);
/* Update link status and Tx/Rx callbacks for the first time. */
memset(&dev->data->dev_link, 0, sizeof(struct rte_eth_link));
INFO("Forcing port %u link to be up", dev->data->port_id);
- err = priv_force_link_status_change(priv, ETH_LINK_UP);
+ err = mlx5_force_link_status_change(dev, ETH_LINK_UP);
if (err) {
DEBUG("Failed to set port %u link to be up",
dev->data->port_id);
goto error;
}
- priv_dev_interrupt_handler_install(priv, dev);
+ mlx5_dev_interrupt_handler_install(dev);
return 0;
error:
/* Rollback. */
dev->data->dev_started = 0;
for (mr = LIST_FIRST(&priv->mr); mr; mr = LIST_FIRST(&priv->mr))
- priv_mr_release(priv, mr);
- priv_flow_stop(priv, &priv->flows);
- priv_dev_traffic_disable(priv, dev);
- priv_txq_stop(priv);
- priv_rxq_stop(priv);
- priv_flow_delete_drop_queue(priv);
+ mlx5_mr_release(mr);
+ mlx5_flow_stop(dev, &priv->flows);
+ mlx5_traffic_disable(dev);
+ mlx5_txq_stop(dev);
+ mlx5_rxq_stop(dev);
+ mlx5_flow_delete_drop_queue(dev);
return err;
}
@@ -214,21 +218,21 @@ mlx5_dev_stop(struct rte_eth_dev *dev)
rte_wmb();
usleep(1000 * priv->rxqs_n);
DEBUG("%p: cleaning up and destroying hash RX queues", (void *)dev);
- priv_flow_stop(priv, &priv->flows);
- priv_dev_traffic_disable(priv, dev);
- priv_rx_intr_vec_disable(priv);
- priv_dev_interrupt_handler_uninstall(priv, dev);
- priv_txq_stop(priv);
- priv_rxq_stop(priv);
+ mlx5_flow_stop(dev, &priv->flows);
+ mlx5_traffic_disable(dev);
+ mlx5_rx_intr_vec_disable(dev);
+ mlx5_dev_interrupt_handler_uninstall(dev);
+ mlx5_txq_stop(dev);
+ mlx5_rxq_stop(dev);
for (mr = LIST_FIRST(&priv->mr); mr; mr = LIST_FIRST(&priv->mr))
- priv_mr_release(priv, mr);
- priv_flow_delete_drop_queue(priv);
+ mlx5_mr_release(mr);
+ mlx5_flow_delete_drop_queue(dev);
}
/**
* Enable traffic flows configured by control plane
*
- * @param priv
+ * @param dev
* Pointer to Ethernet device private data.
* @param dev
* Pointer to Ethernet device structure.
@@ -237,8 +241,9 @@ mlx5_dev_stop(struct rte_eth_dev *dev)
* 0 on success.
*/
int
-priv_dev_traffic_enable(struct priv *priv, struct rte_eth_dev *dev)
+mlx5_traffic_enable(struct rte_eth_dev *dev)
{
+ struct priv *priv = dev->data->dev_private;
struct rte_flow_item_eth bcast = {
.dst.addr_bytes = "\xff\xff\xff\xff\xff\xff",
};
@@ -356,40 +361,18 @@ error:
/**
* Disable traffic flows configured by control plane
*
- * @param priv
- * Pointer to Ethernet device private data.
* @param dev
- * Pointer to Ethernet device structure.
- *
- * @return
- * 0 on success.
- */
-int
-priv_dev_traffic_disable(struct priv *priv,
- struct rte_eth_dev *dev __rte_unused)
-{
- priv_flow_flush(priv, &priv->ctrl_flows);
- return 0;
-}
-
-/**
- * Restart traffic flows configured by control plane
- *
- * @param priv
* Pointer to Ethernet device private data.
- * @param dev
- * Pointer to Ethernet device structure.
*
* @return
* 0 on success.
*/
int
-priv_dev_traffic_restart(struct priv *priv, struct rte_eth_dev *dev)
+mlx5_traffic_disable(struct rte_eth_dev *dev)
{
- if (dev->data->dev_started) {
- priv_dev_traffic_disable(priv, dev);
- priv_dev_traffic_enable(priv, dev);
- }
+ struct priv *priv = dev->data->dev_private;
+
+ mlx5_flow_list_flush(dev, &priv->ctrl_flows);
return 0;
}
@@ -397,7 +380,7 @@ priv_dev_traffic_restart(struct priv *priv, struct rte_eth_dev *dev)
* Restart traffic flows configured by control plane
*
* @param dev
- * Pointer to Ethernet device structure.
+ * Pointer to Ethernet device private data.
*
* @return
* 0 on success.
@@ -405,8 +388,9 @@ priv_dev_traffic_restart(struct priv *priv, struct rte_eth_dev *dev)
int
mlx5_traffic_restart(struct rte_eth_dev *dev)
{
- struct priv *priv = dev->data->dev_private;
-
- priv_dev_traffic_restart(priv, dev);
+ if (dev->data->dev_started) {
+ mlx5_traffic_disable(dev);
+ mlx5_traffic_enable(dev);
+ }
return 0;
}