net/mlx5: handle a single RSS hash key for all protocols
[dpdk.git] / drivers / net / mlx5 / mlx5.c
index 276401d..46c89c6 100644 (file)
@@ -198,27 +198,16 @@ mlx5_dev_close(struct rte_eth_dev *dev)
              ((priv->ctx != NULL) ? priv->ctx->device->name : ""));
        /* In case mlx5_dev_stop() has not been called. */
        priv_dev_interrupt_handler_uninstall(priv, dev);
-       priv_special_flow_disable_all(priv);
-       priv_mac_addrs_disable(priv);
        priv_destroy_hash_rxqs(priv);
-
+       priv_dev_traffic_disable(priv, dev);
        /* Prevent crashes when queues are still in use. */
        dev->rx_pkt_burst = removed_rx_burst;
        dev->tx_pkt_burst = removed_tx_burst;
        if (priv->rxqs != NULL) {
                /* XXX race condition if mlx5_rx_burst() is still running. */
                usleep(1000);
-               for (i = 0; (i != priv->rxqs_n); ++i) {
-                       struct mlx5_rxq_data *rxq = (*priv->rxqs)[i];
-                       struct mlx5_rxq_ctrl *rxq_ctrl;
-
-                       if (rxq == NULL)
-                               continue;
-                       rxq_ctrl = container_of(rxq, struct mlx5_rxq_ctrl, rxq);
-                       (*priv->rxqs)[i] = NULL;
-                       mlx5_rxq_cleanup(rxq_ctrl);
-                       rte_free(rxq_ctrl);
-               }
+               for (i = 0; (i != priv->rxqs_n); ++i)
+                       mlx5_priv_rxq_release(priv, i);
                priv->rxqs_n = 0;
                priv->rxqs = NULL;
        }
@@ -236,17 +225,23 @@ mlx5_dev_close(struct rte_eth_dev *dev)
                claim_zero(ibv_close_device(priv->ctx));
        } else
                assert(priv->ctx == NULL);
-       if (priv->rss_conf != NULL) {
-               for (i = 0; (i != hash_rxq_init_n); ++i)
-                       rte_free((*priv->rss_conf)[i]);
-               rte_free(priv->rss_conf);
-       }
+       if (priv->rss_conf.rss_key != NULL)
+               rte_free(priv->rss_conf.rss_key);
        if (priv->reta_idx != NULL)
                rte_free(priv->reta_idx);
        priv_socket_uninit(priv);
+       ret = mlx5_priv_hrxq_ibv_verify(priv);
+       if (ret)
+               WARN("%p: some Hash Rx queue still remain", (void *)priv);
+       ret = mlx5_priv_ind_table_ibv_verify(priv);
+       if (ret)
+               WARN("%p: some Indirection table still remain", (void *)priv);
        ret = mlx5_priv_rxq_ibv_verify(priv);
        if (ret)
                WARN("%p: some Verbs Rx queue still remain", (void *)priv);
+       ret = mlx5_priv_rxq_verify(priv);
+       if (ret)
+               WARN("%p: some Rx Queues still remain", (void *)priv);
        ret = mlx5_priv_txq_ibv_verify(priv);
        if (ret)
                WARN("%p: some Verbs Tx queue still remain", (void *)priv);
@@ -818,19 +813,6 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
                                priv->txq_inline = MLX5_WQE_SIZE_MAX -
                                                   MLX5_WQE_SIZE;
                }
-               /* Allocate and register default RSS hash keys. */
-               priv->rss_conf = rte_calloc(__func__, hash_rxq_init_n,
-                                           sizeof((*priv->rss_conf)[0]), 0);
-               if (priv->rss_conf == NULL) {
-                       err = ENOMEM;
-                       goto port_error;
-               }
-               err = rss_hash_rss_conf_new_key(priv,
-                                               rss_hash_default_key,
-                                               rss_hash_default_key_len,
-                                               ETH_RSS_PROTO_MASK);
-               if (err)
-                       goto port_error;
                /* Configure the first MAC address by default. */
                if (priv_get_mac(priv, &mac.addr_bytes)) {
                        ERROR("cannot get MAC address, is mlx5_en loaded?"
@@ -843,10 +825,6 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
                     mac.addr_bytes[0], mac.addr_bytes[1],
                     mac.addr_bytes[2], mac.addr_bytes[3],
                     mac.addr_bytes[4], mac.addr_bytes[5]);
-               /* Register MAC address. */
-               claim_zero(priv_mac_addr_add(priv, 0,
-                                            (const uint8_t (*)[ETHER_ADDR_LEN])
-                                            mac.addr_bytes));
 #ifndef NDEBUG
                {
                        char ifname[IF_NAMESIZE];
@@ -883,7 +861,10 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
                eth_dev->device->driver = &mlx5_driver.driver;
                priv->dev = eth_dev;
                eth_dev->dev_ops = &mlx5_dev_ops;
+               /* Register MAC address. */
+               claim_zero(mlx5_mac_addr_add(eth_dev, &mac, 0, 0));
                TAILQ_INIT(&priv->flows);
+               TAILQ_INIT(&priv->ctrl_flows);
 
                /* Hint libmlx5 to use PMD allocator for data plane resources */
                struct mlx5dv_ctx_allocators alctr = {
@@ -901,10 +882,8 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
                continue;
 
 port_error:
-               if (priv) {
-                       rte_free(priv->rss_conf);
+               if (priv)
                        rte_free(priv);
-               }
                if (pd)
                        claim_zero(ibv_dealloc_pd(pd));
                if (ctx)