mlx5: adapt indirection table size depending on Rx queues number
[dpdk.git] / drivers / net / mlx5 / mlx5.c
index ddd74d0..4413248 100644 (file)
@@ -85,6 +85,11 @@ mlx5_dev_close(struct rte_eth_dev *dev)
        DEBUG("%p: closing device \"%s\"",
              (void *)dev,
              ((priv->ctx != NULL) ? priv->ctx->device->name : ""));
+       /* In case mlx5_dev_stop() has not been called. */
+       priv_allmulticast_disable(priv);
+       priv_promiscuous_disable(priv);
+       priv_mac_addrs_disable(priv);
+       priv_destroy_hash_rxqs(priv);
        /* Prevent crashes when queues are still in use. */
        dev->rx_pkt_burst = removed_rx_burst;
        dev->tx_pkt_burst = removed_tx_burst;
@@ -116,8 +121,6 @@ mlx5_dev_close(struct rte_eth_dev *dev)
                priv->txqs_n = 0;
                priv->txqs = NULL;
        }
-       if (priv->rss)
-               rxq_cleanup(&priv->rxq_parent);
        if (priv->pd != NULL) {
                assert(priv->ctx != NULL);
                claim_zero(ibv_dealloc_pd(priv->pd));
@@ -133,11 +136,21 @@ static const struct eth_dev_ops mlx5_dev_ops = {
        .dev_start = mlx5_dev_start,
        .dev_stop = mlx5_dev_stop,
        .dev_close = mlx5_dev_close,
+       .promiscuous_enable = mlx5_promiscuous_enable,
+       .promiscuous_disable = mlx5_promiscuous_disable,
+       .allmulticast_enable = mlx5_allmulticast_enable,
+       .allmulticast_disable = mlx5_allmulticast_disable,
+       .link_update = mlx5_link_update,
+       .stats_get = mlx5_stats_get,
+       .stats_reset = mlx5_stats_reset,
        .dev_infos_get = mlx5_dev_infos_get,
+       .vlan_filter_set = mlx5_vlan_filter_set,
        .rx_queue_setup = mlx5_rx_queue_setup,
        .tx_queue_setup = mlx5_tx_queue_setup,
        .rx_queue_release = mlx5_rx_queue_release,
        .tx_queue_release = mlx5_tx_queue_release,
+       .flow_ctrl_get = mlx5_dev_get_flow_ctrl,
+       .flow_ctrl_set = mlx5_dev_set_flow_ctrl,
        .mac_addr_remove = mlx5_mac_addr_remove,
        .mac_addr_add = mlx5_mac_addr_add,
        .mtu_set = mlx5_dev_set_mtu,
@@ -286,10 +299,9 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
                struct ether_addr mac;
 
 #ifdef HAVE_EXP_QUERY_DEVICE
-               exp_device_attr.comp_mask = IBV_EXP_DEVICE_ATTR_EXP_CAP_FLAGS;
-#ifdef RSS_SUPPORT
-               exp_device_attr.comp_mask |= IBV_EXP_DEVICE_ATTR_RSS_TBL_SZ;
-#endif /* RSS_SUPPORT */
+               exp_device_attr.comp_mask =
+                       IBV_EXP_DEVICE_ATTR_EXP_CAP_FLAGS |
+                       IBV_EXP_DEVICE_ATTR_RX_HASH;
 #endif /* HAVE_EXP_QUERY_DEVICE */
 
                DEBUG("using port %u (%08" PRIx32 ")", port, test);
@@ -339,32 +351,6 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
                        ERROR("ibv_exp_query_device() failed");
                        goto port_error;
                }
-#ifdef RSS_SUPPORT
-               if ((exp_device_attr.exp_device_cap_flags &
-                    IBV_EXP_DEVICE_QPG) &&
-                   (exp_device_attr.exp_device_cap_flags &
-                    IBV_EXP_DEVICE_UD_RSS) &&
-                   (exp_device_attr.comp_mask &
-                    IBV_EXP_DEVICE_ATTR_RSS_TBL_SZ) &&
-                   (exp_device_attr.max_rss_tbl_sz > 0)) {
-                       priv->hw_qpg = 1;
-                       priv->hw_rss = 1;
-                       priv->max_rss_tbl_sz = exp_device_attr.max_rss_tbl_sz;
-               } else {
-                       priv->hw_qpg = 0;
-                       priv->hw_rss = 0;
-                       priv->max_rss_tbl_sz = 0;
-               }
-               priv->hw_tss = !!(exp_device_attr.exp_device_cap_flags &
-                                 IBV_EXP_DEVICE_UD_TSS);
-               DEBUG("device flags: %s%s%s",
-                     (priv->hw_qpg ? "IBV_DEVICE_QPG " : ""),
-                     (priv->hw_tss ? "IBV_DEVICE_TSS " : ""),
-                     (priv->hw_rss ? "IBV_DEVICE_RSS " : ""));
-               if (priv->hw_rss)
-                       DEBUG("maximum RSS indirection table size: %u",
-                             exp_device_attr.max_rss_tbl_sz);
-#endif /* RSS_SUPPORT */
 
                priv->hw_csum =
                        ((exp_device_attr.exp_device_cap_flags &
@@ -379,6 +365,12 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
                DEBUG("L2 tunnel checksum offloads are %ssupported",
                      (priv->hw_csum_l2tun ? "" : "not "));
 
+               priv->ind_table_max_size = exp_device_attr.rx_hash_caps.max_rwq_indirection_table_size;
+               DEBUG("maximum RX indirection table size is %u",
+                     priv->ind_table_max_size);
+
+#else /* HAVE_EXP_QUERY_DEVICE */
+               priv->ind_table_max_size = RSS_INDIRECTION_TABLE_SIZE;
 #endif /* HAVE_EXP_QUERY_DEVICE */
 
                priv->vf = vf;