net/bnxt: update trusted VF status only when it changes
[dpdk.git] / drivers / net / iavf / iavf_ethdev.c
index 99b1f43..64037e1 100644 (file)
@@ -42,11 +42,11 @@ static int iavf_dev_info_get(struct rte_eth_dev *dev,
 static const uint32_t *iavf_dev_supported_ptypes_get(struct rte_eth_dev *dev);
 static int iavf_dev_stats_get(struct rte_eth_dev *dev,
                             struct rte_eth_stats *stats);
-static void iavf_dev_stats_reset(struct rte_eth_dev *dev);
-static void iavf_dev_promiscuous_enable(struct rte_eth_dev *dev);
-static void iavf_dev_promiscuous_disable(struct rte_eth_dev *dev);
-static void iavf_dev_allmulticast_enable(struct rte_eth_dev *dev);
-static void iavf_dev_allmulticast_disable(struct rte_eth_dev *dev);
+static int iavf_dev_stats_reset(struct rte_eth_dev *dev);
+static int iavf_dev_promiscuous_enable(struct rte_eth_dev *dev);
+static int iavf_dev_promiscuous_disable(struct rte_eth_dev *dev);
+static int iavf_dev_allmulticast_enable(struct rte_eth_dev *dev);
+static int iavf_dev_allmulticast_disable(struct rte_eth_dev *dev);
 static int iavf_dev_add_mac_addr(struct rte_eth_dev *dev,
                                struct rte_ether_addr *addr,
                                uint32_t index,
@@ -76,6 +76,16 @@ static int iavf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev,
 int iavf_logtype_init;
 int iavf_logtype_driver;
 
+#ifdef RTE_LIBRTE_IAVF_DEBUG_RX
+int iavf_logtype_rx;
+#endif
+#ifdef RTE_LIBRTE_IAVF_DEBUG_TX
+int iavf_logtype_tx;
+#endif
+#ifdef RTE_LIBRTE_IAVF_DEBUG_TX_FREE
+int iavf_logtype_tx_free;
+#endif
+
 static const struct rte_pci_id pci_id_iavf_map[] = {
        { RTE_PCI_DEVICE(IAVF_INTEL_VENDOR_ID, IAVF_DEV_ID_ADAPTIVE_VF) },
        { .vendor_id = 0, /* sentinel */ },
@@ -634,7 +644,7 @@ iavf_dev_link_update(struct rte_eth_dev *dev,
        return 0;
 }
 
-static void
+static int
 iavf_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
        struct iavf_adapter *adapter =
@@ -643,14 +653,18 @@ iavf_dev_promiscuous_enable(struct rte_eth_dev *dev)
        int ret;
 
        if (vf->promisc_unicast_enabled)
-               return;
+               return 0;
 
        ret = iavf_config_promisc(adapter, TRUE, vf->promisc_multicast_enabled);
        if (!ret)
                vf->promisc_unicast_enabled = TRUE;
+       else
+               ret = -EAGAIN;
+
+       return ret;
 }
 
-static void
+static int
 iavf_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
        struct iavf_adapter *adapter =
@@ -659,14 +673,18 @@ iavf_dev_promiscuous_disable(struct rte_eth_dev *dev)
        int ret;
 
        if (!vf->promisc_unicast_enabled)
-               return;
+               return 0;
 
        ret = iavf_config_promisc(adapter, FALSE, vf->promisc_multicast_enabled);
        if (!ret)
                vf->promisc_unicast_enabled = FALSE;
+       else
+               ret = -EAGAIN;
+
+       return ret;
 }
 
-static void
+static int
 iavf_dev_allmulticast_enable(struct rte_eth_dev *dev)
 {
        struct iavf_adapter *adapter =
@@ -675,14 +693,18 @@ iavf_dev_allmulticast_enable(struct rte_eth_dev *dev)
        int ret;
 
        if (vf->promisc_multicast_enabled)
-               return;
+               return 0;
 
        ret = iavf_config_promisc(adapter, vf->promisc_unicast_enabled, TRUE);
        if (!ret)
                vf->promisc_multicast_enabled = TRUE;
+       else
+               ret = -EAGAIN;
+
+       return ret;
 }
 
-static void
+static int
 iavf_dev_allmulticast_disable(struct rte_eth_dev *dev)
 {
        struct iavf_adapter *adapter =
@@ -691,11 +713,15 @@ iavf_dev_allmulticast_disable(struct rte_eth_dev *dev)
        int ret;
 
        if (!vf->promisc_multicast_enabled)
-               return;
+               return 0;
 
        ret = iavf_config_promisc(adapter, vf->promisc_unicast_enabled, FALSE);
        if (!ret)
                vf->promisc_multicast_enabled = FALSE;
+       else
+               ret = -EAGAIN;
+
+       return ret;
 }
 
 static int
@@ -1057,7 +1083,7 @@ iavf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
        return -EIO;
 }
 
-static void
+static int
 iavf_dev_stats_reset(struct rte_eth_dev *dev)
 {
        int ret;
@@ -1069,10 +1095,13 @@ iavf_dev_stats_reset(struct rte_eth_dev *dev)
 
        /* read stat values to clear hardware registers */
        ret = iavf_query_stats(adapter, &pstats);
+       if (ret != 0)
+               return ret;
 
        /* set stats offset base on current values */
-       if (ret == 0)
-               vsi->eth_stats_offset = *pstats;
+       vsi->eth_stats_offset = *pstats;
+
+       return 0;
 }
 
 static int
@@ -1421,6 +1450,24 @@ RTE_INIT(iavf_init_log)
        iavf_logtype_driver = rte_log_register("pmd.net.iavf.driver");
        if (iavf_logtype_driver >= 0)
                rte_log_set_level(iavf_logtype_driver, RTE_LOG_NOTICE);
+
+#ifdef RTE_LIBRTE_IAVF_DEBUG_RX
+       iavf_logtype_rx = rte_log_register("pmd.net.iavf.rx");
+       if (iavf_logtype_rx >= 0)
+               rte_log_set_level(iavf_logtype_rx, RTE_LOG_DEBUG);
+#endif
+
+#ifdef RTE_LIBRTE_IAVF_DEBUG_TX
+       iavf_logtype_tx = rte_log_register("pmd.net.iavf.tx");
+       if (iavf_logtype_tx >= 0)
+               rte_log_set_level(iavf_logtype_tx, RTE_LOG_DEBUG);
+#endif
+
+#ifdef RTE_LIBRTE_IAVF_DEBUG_TX_FREE
+       iavf_logtype_tx_free = rte_log_register("pmd.net.iavf.tx_free");
+       if (iavf_logtype_tx_free >= 0)
+               rte_log_set_level(iavf_logtype_tx_free, RTE_LOG_DEBUG);
+#endif
 }
 
 /* memory func for base code */