net/ena: check memory BAR before initializing LLQ
[dpdk.git] / drivers / net / mlx4 / mlx4.c
index d048d21..910b76a 100644 (file)
@@ -201,6 +201,7 @@ mlx4_proc_priv_init(struct rte_eth_dev *dev)
        struct mlx4_proc_priv *ppriv;
        size_t ppriv_size;
 
+       mlx4_proc_priv_uninit(dev);
        /*
         * UAR register table follows the process private structure. BlueFlame
         * registers for Tx queues are stored in the table.
@@ -349,8 +350,8 @@ mlx4_dev_stop(struct rte_eth_dev *dev)
                return 0;
        DEBUG("%p: detaching flows from all RX queues", (void *)dev);
        priv->started = 0;
-       dev->tx_pkt_burst = mlx4_tx_burst_removed;
-       dev->rx_pkt_burst = mlx4_rx_burst_removed;
+       dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
+       dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
        rte_wmb();
        /* Disable datapath on secondary process. */
        mlx4_mp_req_stop_rxtx(dev);
@@ -382,17 +383,17 @@ mlx4_dev_close(struct rte_eth_dev *dev)
        DEBUG("%p: closing device \"%s\"",
              (void *)dev,
              ((priv->ctx != NULL) ? priv->ctx->device->name : ""));
-       dev->rx_pkt_burst = mlx4_rx_burst_removed;
-       dev->tx_pkt_burst = mlx4_tx_burst_removed;
+       dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
+       dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
        rte_wmb();
        /* Disable datapath on secondary process. */
        mlx4_mp_req_stop_rxtx(dev);
        mlx4_flow_clean(priv);
        mlx4_rss_deinit(priv);
        for (i = 0; i != dev->data->nb_rx_queues; ++i)
-               mlx4_rx_queue_release(dev->data->rx_queues[i]);
+               mlx4_rx_queue_release(dev, i);
        for (i = 0; i != dev->data->nb_tx_queues; ++i)
-               mlx4_tx_queue_release(dev->data->tx_queues[i]);
+               mlx4_tx_queue_release(dev, i);
        mlx4_proc_priv_uninit(dev);
        mlx4_mr_release(dev);
        if (priv->pd != NULL) {
@@ -1013,11 +1014,8 @@ err_secondary:
                              " (error: %s)", strerror(err));
                        goto port_error;
                }
-               INFO("port %u MAC address is %02x:%02x:%02x:%02x:%02x:%02x",
-                    priv->port,
-                    mac.addr_bytes[0], mac.addr_bytes[1],
-                    mac.addr_bytes[2], mac.addr_bytes[3],
-                    mac.addr_bytes[4], mac.addr_bytes[5]);
+               INFO("port %u MAC address is " RTE_ETHER_ADDR_PRT_FMT,
+                    priv->port, RTE_ETHER_ADDR_BYTES(&mac));
                /* Register MAC address. */
                priv->mac[0] = mac;
 
@@ -1044,9 +1042,19 @@ err_secondary:
                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;
-               priv->intr_handle.type = RTE_INTR_HANDLE_EXT;
+               priv->intr_handle =
+                       rte_intr_instance_alloc(RTE_INTR_INSTANCE_F_SHARED);
+               if (priv->intr_handle == NULL) {
+                       RTE_LOG(ERR, EAL, "Fail to allocate intr_handle\n");
+                       goto port_error;
+               }
+
+               if (rte_intr_fd_set(priv->intr_handle, -1))
+                       goto port_error;
+
+               if (rte_intr_type_set(priv->intr_handle, RTE_INTR_HANDLE_EXT))
+                       goto port_error;
+
                /*
                 * Override ethdev interrupt handle pointer with private
                 * handle instead of that of the parent PCI device used by
@@ -1059,7 +1067,7 @@ err_secondary:
                 * besides setting up eth_dev->intr_handle, the rest is
                 * handled by rte_intr_rx_ctl().
                 */
-               eth_dev->intr_handle = &priv->intr_handle;
+               eth_dev->intr_handle = priv->intr_handle;
                priv->dev_data = eth_dev->data;
                eth_dev->dev_ops = &mlx4_dev_ops;
 #ifdef HAVE_IBV_MLX4_BUF_ALLOCATORS
@@ -1104,6 +1112,8 @@ err_secondary:
                prev_dev = eth_dev;
                continue;
 port_error:
+               if (priv != NULL)
+                       rte_intr_instance_free(priv->intr_handle);
                rte_free(priv);
                if (eth_dev != NULL)
                        eth_dev->data->dev_private = NULL;
@@ -1319,7 +1329,7 @@ glue_error:
 #endif
 
 /* Initialize driver log type. */
-RTE_LOG_REGISTER(mlx4_logtype, pmd.net.mlx4, NOTICE)
+RTE_LOG_REGISTER_DEFAULT(mlx4_logtype, NOTICE)
 
 /**
  * Driver initialization routine.