net: add rte prefix to ether structures
[dpdk.git] / drivers / net / e1000 / em_ethdev.c
index 9d089cf..b2fdb5e 100644 (file)
@@ -11,7 +11,6 @@
 #include <rte_common.h>
 #include <rte_interrupts.h>
 #include <rte_byteorder.h>
-#include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
@@ -90,14 +89,15 @@ static int eth_em_led_on(struct rte_eth_dev *dev);
 static int eth_em_led_off(struct rte_eth_dev *dev);
 
 static int em_get_rx_buffer_size(struct e1000_hw *hw);
-static int eth_em_rar_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
-                         uint32_t index, uint32_t pool);
+static int eth_em_rar_set(struct rte_eth_dev *dev,
+                       struct rte_ether_addr *mac_addr,
+                       uint32_t index, uint32_t pool);
 static void eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t index);
-static void eth_em_default_mac_addr_set(struct rte_eth_dev *dev,
-                                        struct ether_addr *addr);
+static int eth_em_default_mac_addr_set(struct rte_eth_dev *dev,
+                                        struct rte_ether_addr *addr);
 
 static int eth_em_set_mc_addr_list(struct rte_eth_dev *dev,
-                                  struct ether_addr *mc_addr_set,
+                                  struct rte_ether_addr *mc_addr_set,
                                   uint32_t nb_mc_addr);
 
 #define EM_FC_PAUSE_TIME 0x0680
@@ -106,9 +106,6 @@ static int eth_em_set_mc_addr_list(struct rte_eth_dev *dev,
 
 static enum e1000_fc_mode em_fc_setting = e1000_fc_full;
 
-int e1000_logtype_init;
-int e1000_logtype_driver;
-
 /*
  * The set of PCI devices this driver supports
  */
@@ -297,7 +294,7 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev)
        }
 
        /* Copy the permanent MAC address */
-       ether_addr_copy((struct ether_addr *) hw->mac.addr,
+       ether_addr_copy((struct rte_ether_addr *)hw->mac.addr,
                eth_dev->data->mac_addrs);
 
        /* initialize the vfta */
@@ -333,9 +330,6 @@ eth_em_dev_uninit(struct rte_eth_dev *eth_dev)
        eth_dev->rx_pkt_burst = NULL;
        eth_dev->tx_pkt_burst = NULL;
 
-       rte_free(eth_dev->data->mac_addrs);
-       eth_dev->data->mac_addrs = NULL;
-
        /* disable uio intr before callback unregister */
        rte_intr_disable(intr_handle);
        rte_intr_callback_unregister(intr_handle,
@@ -454,29 +448,10 @@ eth_em_configure(struct rte_eth_dev *dev)
 {
        struct e1000_interrupt *intr =
                E1000_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
-       struct rte_eth_dev_info dev_info;
-       uint64_t rx_offloads;
-       uint64_t tx_offloads;
 
        PMD_INIT_FUNC_TRACE();
        intr->flags |= E1000_FLAG_NEED_LINK_UPDATE;
 
-       eth_em_infos_get(dev, &dev_info);
-       rx_offloads = dev->data->dev_conf.rxmode.offloads;
-       if ((rx_offloads & dev_info.rx_offload_capa) != rx_offloads) {
-               PMD_DRV_LOG(ERR, "Some Rx offloads are not supported "
-                           "requested 0x%" PRIx64 " supported 0x%" PRIx64,
-                           rx_offloads, dev_info.rx_offload_capa);
-               return -ENOTSUP;
-       }
-       tx_offloads = dev->data->dev_conf.txmode.offloads;
-       if ((tx_offloads & dev_info.tx_offload_capa) != tx_offloads) {
-               PMD_DRV_LOG(ERR, "Some Tx offloads are not supported "
-                           "requested 0x%" PRIx64 " supported 0x%" PRIx64,
-                           tx_offloads, dev_info.tx_offload_capa);
-               return -ENOTSUP;
-       }
-
        PMD_INIT_FUNC_TRACE();
 
        return 0;
@@ -1183,7 +1158,7 @@ eth_em_link_update(struct rte_eth_dev *dev, int wait_to_complete)
                link.link_autoneg = !(dev->data->dev_conf.link_speeds &
                                ETH_LINK_SPEED_FIXED);
        } else if (!link_check && (link.link_status == ETH_LINK_UP)) {
-               link.link_speed = 0;
+               link.link_speed = ETH_SPEED_NUM_NONE;
                link.link_duplex = ETH_LINK_HALF_DUPLEX;
                link.link_status = ETH_LINK_DOWN;
                link.link_autoneg = ETH_LINK_FIXED;
@@ -1467,7 +1442,8 @@ eth_em_interrupt_setup(struct rte_eth_dev *dev)
        /* clear interrupt */
        E1000_READ_REG(hw, E1000_ICR);
        regval = E1000_READ_REG(hw, E1000_IMS);
-       E1000_WRITE_REG(hw, E1000_IMS, regval | E1000_ICR_LSC);
+       E1000_WRITE_REG(hw, E1000_IMS,
+                       regval | E1000_ICR_LSC | E1000_ICR_OTHER);
        return 0;
 }
 
@@ -1517,7 +1493,7 @@ em_rxq_intr_enable(struct e1000_hw *hw)
 static void
 em_lsc_intr_disable(struct e1000_hw *hw)
 {
-       E1000_WRITE_REG(hw, E1000_IMC, E1000_IMS_LSC);
+       E1000_WRITE_REG(hw, E1000_IMC, E1000_IMS_LSC | E1000_IMS_OTHER);
        E1000_WRITE_FLUSH(hw);
 }
 
@@ -1760,7 +1736,7 @@ eth_em_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 }
 
 static int
-eth_em_rar_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
+eth_em_rar_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
                uint32_t index, __rte_unused uint32_t pool)
 {
        struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -1779,13 +1755,13 @@ eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t index)
        e1000_rar_set(hw, addr, index);
 }
 
-static void
+static int
 eth_em_default_mac_addr_set(struct rte_eth_dev *dev,
-                           struct ether_addr *addr)
+                           struct rte_ether_addr *addr)
 {
        eth_em_rar_clear(dev, 0);
 
-       eth_em_rar_set(dev, (void *)addr, 0, 0);
+       return eth_em_rar_set(dev, (void *)addr, 0, 0);
 }
 
 static int
@@ -1831,7 +1807,7 @@ eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 
 static int
 eth_em_set_mc_addr_list(struct rte_eth_dev *dev,
-                       struct ether_addr *mc_addr_set,
+                       struct rte_ether_addr *mc_addr_set,
                        uint32_t nb_mc_addr)
 {
        struct e1000_hw *hw;
@@ -1845,14 +1821,8 @@ RTE_PMD_REGISTER_PCI(net_e1000_em, rte_em_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_e1000_em, pci_id_em_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_e1000_em, "* igb_uio | uio_pci_generic | vfio-pci");
 
-RTE_INIT(e1000_init_log);
-static void
-e1000_init_log(void)
+/* see e1000_logs.c */
+RTE_INIT(igb_init_log)
 {
-       e1000_logtype_init = rte_log_register("pmd.net.e1000.init");
-       if (e1000_logtype_init >= 0)
-               rte_log_set_level(e1000_logtype_init, RTE_LOG_NOTICE);
-       e1000_logtype_driver = rte_log_register("pmd.net.e1000.driver");
-       if (e1000_logtype_driver >= 0)
-               rte_log_set_level(e1000_logtype_driver, RTE_LOG_NOTICE);
+       e1000_igb_init_log();
 }