ethdev: make driver-only headers private
[dpdk.git] / drivers / net / qede / qede_ethdev.c
index 150c70d..ab5f5b1 100644 (file)
@@ -1163,12 +1163,13 @@ err:
        return -1; /* common error code is < 0 */
 }
 
-static void qede_dev_stop(struct rte_eth_dev *eth_dev)
+static int qede_dev_stop(struct rte_eth_dev *eth_dev)
 {
        struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev);
        struct ecore_dev *edev = QEDE_INIT_EDEV(qdev);
 
        PMD_INIT_FUNC_TRACE(edev);
+       eth_dev->data->dev_started = 0;
 
        /* Bring the link down */
        qede_dev_set_link_state(eth_dev, false);
@@ -1183,7 +1184,7 @@ static void qede_dev_stop(struct rte_eth_dev *eth_dev)
 
        /* Disable vport */
        if (qede_activate_vport(eth_dev, false))
-               return;
+               return 0;
 
        if (qdev->enable_lro)
                qede_enable_tpa(eth_dev, false);
@@ -1195,6 +1196,8 @@ static void qede_dev_stop(struct rte_eth_dev *eth_dev)
        ecore_hw_stop_fastpath(edev); /* TBD - loop */
 
        DP_INFO(edev, "Device is stopped\n");
+
+       return 0;
 }
 
 static const char * const valid_args[] = {
@@ -1544,21 +1547,26 @@ static void qede_poll_sp_sb_cb(void *param)
        }
 }
 
-static void qede_dev_close(struct rte_eth_dev *eth_dev)
+static int qede_dev_close(struct rte_eth_dev *eth_dev)
 {
        struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
        struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev);
        struct ecore_dev *edev = QEDE_INIT_EDEV(qdev);
+       int ret = 0;
 
        PMD_INIT_FUNC_TRACE(edev);
 
+       /* only close in case of the primary process */
+       if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+               return 0;
+
        /* dev_stop() shall cleanup fp resources in hw but without releasing
         * dma memories and sw structures so that dev_start() can be called
         * by the app without reconfiguration. However, in dev_close() we
         * can release all the resources and device can be brought up newly
         */
        if (eth_dev->data->dev_started)
-               qede_dev_stop(eth_dev);
+               ret = qede_dev_stop(eth_dev);
 
        if (qdev->vport_started)
                qede_stop_vport(edev);
@@ -1588,6 +1596,8 @@ static void qede_dev_close(struct rte_eth_dev *eth_dev)
 
        if (ECORE_IS_CMT(edev))
                rte_eal_alarm_cancel(qede_poll_sp_sb_cb, (void *)eth_dev);
+
+       return ret;
 }
 
 static int
@@ -1875,6 +1885,8 @@ static int qede_allmulticast_enable(struct rte_eth_dev *eth_dev)
            QED_FILTER_RX_MODE_TYPE_MULTI_PROMISC;
        enum _ecore_status_t ecore_status;
 
+       if (rte_eth_promiscuous_get(eth_dev->data->port_id) == 1)
+               type = QED_FILTER_RX_MODE_TYPE_PROMISC;
        ecore_status = qed_configure_filter_rx_mode(eth_dev, type);
 
        return ecore_status >= ECORE_SUCCESS ? 0 : -EAGAIN;
@@ -2332,7 +2344,9 @@ static int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
        }
        if (dev->data->dev_started) {
                dev->data->dev_started = 0;
-               qede_dev_stop(dev);
+               rc = qede_dev_stop(dev);
+               if (rc != 0)
+                       return rc;
                restart = true;
        }
        rte_delay_ms(1000);
@@ -2355,7 +2369,7 @@ static int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
                        fp->rxq->rx_buf_size = rc;
                }
        }
-       if (max_rx_pkt_len > RTE_ETHER_MAX_LEN)
+       if (frame_size > QEDE_ETH_MAX_LEN)
                dev->data->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
        else
                dev->data->dev_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
@@ -2533,6 +2547,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf)
        }
 
        rte_eth_copy_pci_info(eth_dev, pci_dev);
+       eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
 
        /* @DPDK */
        edev->vendor_id = pci_dev->id.vendor_id;
@@ -2770,20 +2785,8 @@ static int qede_dev_common_uninit(struct rte_eth_dev *eth_dev)
 {
        struct qede_dev *qdev = eth_dev->data->dev_private;
        struct ecore_dev *edev = &qdev->edev;
-
        PMD_INIT_FUNC_TRACE(edev);
-
-       /* only uninitialize in the primary process */
-       if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-               return 0;
-
-       /* safe to close dev here */
        qede_dev_close(eth_dev);
-
-       eth_dev->dev_ops = NULL;
-       eth_dev->rx_pkt_burst = NULL;
-       eth_dev->tx_pkt_burst = NULL;
-
        return 0;
 }