ethdev: change promiscuous callbacks to return status
[dpdk.git] / drivers / net / e1000 / em_ethdev.c
index 20b5406..8fe3917 100644 (file)
@@ -35,8 +35,8 @@ static int eth_em_configure(struct rte_eth_dev *dev);
 static int eth_em_start(struct rte_eth_dev *dev);
 static void eth_em_stop(struct rte_eth_dev *dev);
 static void eth_em_close(struct rte_eth_dev *dev);
-static void eth_em_promiscuous_enable(struct rte_eth_dev *dev);
-static void eth_em_promiscuous_disable(struct rte_eth_dev *dev);
+static int eth_em_promiscuous_enable(struct rte_eth_dev *dev);
+static int eth_em_promiscuous_disable(struct rte_eth_dev *dev);
 static void eth_em_allmulticast_enable(struct rte_eth_dev *dev);
 static void eth_em_allmulticast_disable(struct rte_eth_dev *dev);
 static int eth_em_link_update(struct rte_eth_dev *dev,
@@ -44,7 +44,7 @@ static int eth_em_link_update(struct rte_eth_dev *dev,
 static int eth_em_stats_get(struct rte_eth_dev *dev,
                                struct rte_eth_stats *rte_stats);
 static void eth_em_stats_reset(struct rte_eth_dev *dev);
-static void eth_em_infos_get(struct rte_eth_dev *dev,
+static int eth_em_infos_get(struct rte_eth_dev *dev,
                                struct rte_eth_dev_info *dev_info);
 static int eth_em_flow_ctrl_get(struct rte_eth_dev *dev,
                                struct rte_eth_fc_conf *fc_conf);
@@ -739,7 +739,7 @@ eth_em_stop(struct rte_eth_dev *dev)
        e1000_reset_hw(hw);
 
        /* Flush desc rings for i219 */
-       if (hw->mac.type >= e1000_pch_spt)
+       if (hw->mac.type == e1000_pch_spt || hw->mac.type == e1000_pch_cnp)
                em_flush_desc_rings(dev);
 
        if (hw->mac.type >= e1000_82544)
@@ -1048,7 +1048,7 @@ em_get_max_pktlen(struct rte_eth_dev *dev)
        }
 }
 
-static void
+static int
 eth_em_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
        struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -1107,6 +1107,8 @@ eth_em_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
        dev_info->default_txportconf.nb_queues = 1;
        dev_info->default_txportconf.ring_size = 256;
        dev_info->default_rxportconf.ring_size = 256;
+
+       return 0;
 }
 
 /* return 0 means link status changed, -1 means not changed */
@@ -1261,7 +1263,7 @@ em_release_manageability(struct e1000_hw *hw)
        }
 }
 
-static void
+static int
 eth_em_promiscuous_enable(struct rte_eth_dev *dev)
 {
        struct e1000_hw *hw =
@@ -1271,9 +1273,11 @@ eth_em_promiscuous_enable(struct rte_eth_dev *dev)
        rctl = E1000_READ_REG(hw, E1000_RCTL);
        rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE);
        E1000_WRITE_REG(hw, E1000_RCTL, rctl);
+
+       return 0;
 }
 
-static void
+static int
 eth_em_promiscuous_disable(struct rte_eth_dev *dev)
 {
        struct e1000_hw *hw =
@@ -1287,6 +1291,8 @@ eth_em_promiscuous_disable(struct rte_eth_dev *dev)
        else
                rctl &= (~E1000_RCTL_MPE);
        E1000_WRITE_REG(hw, E1000_RCTL, rctl);
+
+       return 0;
 }
 
 static void
@@ -1776,8 +1782,12 @@ eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
        struct e1000_hw *hw;
        uint32_t frame_size;
        uint32_t rctl;
+       int ret;
+
+       ret = eth_em_infos_get(dev, &dev_info);
+       if (ret != 0)
+               return ret;
 
-       eth_em_infos_get(dev, &dev_info);
        frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN +
                VLAN_TAG_SIZE;