net/mlx5: implement vectorized MPRQ burst
[dpdk.git] / drivers / net / mlx4 / mlx4.c
index 71061a7..34c2bbb 100644 (file)
@@ -81,7 +81,7 @@ const char *pmd_mlx4_init_params[] = {
        NULL,
 };
 
-static void mlx4_dev_stop(struct rte_eth_dev *dev);
+static int mlx4_dev_stop(struct rte_eth_dev *dev);
 
 /**
  * Initialize shared data between primary and secondary process.
@@ -343,13 +343,13 @@ err:
  * @param dev
  *   Pointer to Ethernet device structure.
  */
-static void
+static int
 mlx4_dev_stop(struct rte_eth_dev *dev)
 {
        struct mlx4_priv *priv = dev->data->dev_private;
 
        if (!priv->started)
-               return;
+               return 0;
        DEBUG("%p: detaching flows from all RX queues", (void *)dev);
        priv->started = 0;
        dev->tx_pkt_burst = mlx4_tx_burst_removed;
@@ -360,6 +360,8 @@ mlx4_dev_stop(struct rte_eth_dev *dev)
        mlx4_flow_sync(priv, NULL);
        mlx4_rxq_intr_disable(priv);
        mlx4_rss_deinit(priv);
+
+       return 0;
 }
 
 /**
@@ -370,12 +372,14 @@ mlx4_dev_stop(struct rte_eth_dev *dev)
  * @param dev
  *   Pointer to Ethernet device structure.
  */
-static void
+static int
 mlx4_dev_close(struct rte_eth_dev *dev)
 {
        struct mlx4_priv *priv = dev->data->dev_private;
        unsigned int i;
 
+       if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+               return 0;
        DEBUG("%p: closing device \"%s\"",
              (void *)dev,
              ((priv->ctx != NULL) ? priv->ctx->device->name : ""));
@@ -400,6 +404,9 @@ mlx4_dev_close(struct rte_eth_dev *dev)
                MLX4_ASSERT(priv->ctx == NULL);
        mlx4_intr_uninstall(priv);
        memset(priv, 0, sizeof(*priv));
+       /* mac_addrs must not be freed because part of dev_private */
+       dev->data->mac_addrs = NULL;
+       return 0;
 }
 
 static const struct eth_dev_ops mlx4_dev_ops = {
@@ -1028,6 +1035,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
                eth_dev->data->mac_addrs = priv->mac;
                eth_dev->device = &pci_dev->device;
                rte_eth_copy_pci_info(eth_dev, pci_dev);
+               eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
                /* Initialize local interrupt handle for current port. */
                memset(&priv->intr_handle, 0, sizeof(struct rte_intr_handle));
                priv->intr_handle.fd = -1;