X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fmlx5%2Fmlx5_trigger.c;h=ff1203d7aecccd96044a331139b7112d0fc1c8b1;hb=6069d815bc4dd73e82396a607882fe8395e592ed;hp=f5d965ff8f9c8a2b6dc1887f9fa1accc39c46850;hpb=e60fbd5b24fcb9cda3dcd6d02039e5ba8798235c;p=dpdk.git diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index f5d965ff8f..ff1203d7ae 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -37,6 +37,8 @@ #endif #include #include +#include +#include #ifdef PEDANTIC #pragma GCC diagnostic error "-pedantic" #endif @@ -60,49 +62,36 @@ int mlx5_dev_start(struct rte_eth_dev *dev) { struct priv *priv = dev->data->dev_private; - unsigned int i = 0; - unsigned int r; - struct rxq *rxq; + int err; priv_lock(priv); if (priv->started) { priv_unlock(priv); return 0; } - DEBUG("%p: attaching configured flows to all RX queues", (void *)dev); - priv->started = 1; - if (priv->rss) { - rxq = &priv->rxq_parent; - r = 1; - } else { - rxq = (*priv->rxqs)[0]; - r = priv->rxqs_n; - } - /* Iterate only once when RSS is enabled. */ - do { - int ret; - - /* Ignore nonexistent RX queues. */ - if (rxq == NULL) - continue; - ret = rxq_mac_addrs_add(rxq); - if (!ret) - continue; - WARN("%p: QP flow attachment failed: %s", - (void *)dev, strerror(ret)); + DEBUG("%p: allocating and configuring hash RX queues", (void *)dev); + err = priv_create_hash_rxqs(priv); + if (!err) + err = priv_promiscuous_enable(priv); + if (!err) + err = priv_mac_addrs_enable(priv); + if (!err) + err = priv_allmulticast_enable(priv); + if (!err) + priv->started = 1; + else { + ERROR("%p: an error occurred while configuring hash RX queues:" + " %s", + (void *)priv, strerror(err)); /* Rollback. */ - while (i != 0) { - rxq = (*priv->rxqs)[--i]; - if (rxq != NULL) { - rxq_mac_addrs_del(rxq); - } - } - priv->started = 0; - priv_unlock(priv); - return -ret; - } while ((--r) && ((rxq = (*priv->rxqs)[++i]), i)); + priv_allmulticast_disable(priv); + priv_promiscuous_disable(priv); + priv_mac_addrs_disable(priv); + priv_destroy_hash_rxqs(priv); + } + priv_dev_interrupt_handler_install(priv, dev); priv_unlock(priv); - return 0; + return -err; } /** @@ -117,30 +106,18 @@ void mlx5_dev_stop(struct rte_eth_dev *dev) { struct priv *priv = dev->data->dev_private; - unsigned int i = 0; - unsigned int r; - struct rxq *rxq; priv_lock(priv); if (!priv->started) { priv_unlock(priv); return; } - DEBUG("%p: detaching flows from all RX queues", (void *)dev); + DEBUG("%p: cleaning up and destroying hash RX queues", (void *)dev); + priv_allmulticast_disable(priv); + priv_promiscuous_disable(priv); + priv_mac_addrs_disable(priv); + priv_destroy_hash_rxqs(priv); + priv_dev_interrupt_handler_uninstall(priv, dev); priv->started = 0; - if (priv->rss) { - rxq = &priv->rxq_parent; - r = 1; - } else { - rxq = (*priv->rxqs)[0]; - r = priv->rxqs_n; - } - /* Iterate only once when RSS is enabled. */ - do { - /* Ignore nonexistent RX queues. */ - if (rxq == NULL) - continue; - rxq_mac_addrs_del(rxq); - } while ((--r) && ((rxq = (*priv->rxqs)[++i]), i)); priv_unlock(priv); }