net/mlx4: fix Rx resource leak in case of error
[dpdk.git] / drivers / net / mlx4 / mlx4.c
index f389e66..3dd72db 100644 (file)
@@ -61,6 +61,8 @@ const char *pmd_mlx4_init_params[] = {
        NULL,
 };
 
+static void mlx4_dev_stop(struct rte_eth_dev *dev);
+
 /**
  * DPDK callback for Ethernet device configuration.
  *
@@ -143,8 +145,7 @@ mlx4_dev_start(struct rte_eth_dev *dev)
        dev->rx_pkt_burst = mlx4_rx_burst;
        return 0;
 err:
-       /* Rollback. */
-       priv->started = 0;
+       mlx4_dev_stop(dev);
        return ret;
 }
 
@@ -194,6 +195,7 @@ mlx4_dev_close(struct rte_eth_dev *dev)
        dev->tx_pkt_burst = mlx4_tx_burst_removed;
        rte_wmb();
        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]);
        for (i = 0; i != dev->data->nb_tx_queues; ++i)
@@ -562,14 +564,14 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
                        (device_attr.vendor_part_id ==
                         PCI_DEVICE_ID_MELLANOX_CONNECTX3PRO);
                DEBUG("L2 tunnel checksum offloads are %ssupported",
-                     (priv->hw_csum_l2tun ? "" : "not "));
+                     priv->hw_csum_l2tun ? "" : "not ");
                priv->hw_rss_sup = device_attr_ex.rss_caps.rx_hash_fields_mask;
                if (!priv->hw_rss_sup) {
                        WARN("no RSS capabilities reported; disabling support"
                             " for UDP RSS and inner VXLAN RSS");
                        /* Fake support for all possible RSS hash fields. */
                        priv->hw_rss_sup = ~UINT64_C(0);
-                       priv->hw_rss_sup = mlx4_conv_rss_hf(priv, -1);
+                       priv->hw_rss_sup = mlx4_conv_rss_types(priv, -1);
                        /* Filter out known unsupported fields. */
                        priv->hw_rss_sup &=
                                ~(uint64_t)(IBV_RX_HASH_SRC_PORT_UDP |
@@ -578,6 +580,10 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
                }
                DEBUG("supported RSS hash fields mask: %016" PRIx64,
                      priv->hw_rss_sup);
+               priv->hw_fcs_strip = !!(device_attr_ex.raw_packet_caps &
+                                       IBV_RAW_PACKET_CAP_SCATTER_FCS);
+               DEBUG("FCS stripping toggling is %ssupported",
+                     priv->hw_fcs_strip ? "" : "not ");
                /* Configure the first MAC address by default. */
                if (mlx4_get_mac(priv, &mac.addr_bytes)) {
                        ERROR("cannot get MAC address, is mlx4_en loaded?"