eal: clean up interrupt handle
[dpdk.git] / drivers / net / e1000 / em_ethdev.c
index 17e30db..ecefa56 100644 (file)
@@ -85,8 +85,7 @@ static int eth_em_rxq_interrupt_setup(struct rte_eth_dev *dev);
 static int eth_em_interrupt_get_status(struct rte_eth_dev *dev);
 static int eth_em_interrupt_action(struct rte_eth_dev *dev,
                                   struct rte_intr_handle *handle);
-static void eth_em_interrupt_handler(struct rte_intr_handle *handle,
-                                                       void *param);
+static void eth_em_interrupt_handler(void *param);
 
 static int em_hw_init(struct e1000_hw *hw);
 static int em_hardware_init(struct e1000_hw *hw);
@@ -169,6 +168,19 @@ static const struct rte_pci_id pci_id_em_map[] = {
        { RTE_PCI_DEVICE(E1000_INTEL_VENDOR_ID, E1000_DEV_ID_PCH_I218_V2) },
        { RTE_PCI_DEVICE(E1000_INTEL_VENDOR_ID, E1000_DEV_ID_PCH_I218_LM3) },
        { RTE_PCI_DEVICE(E1000_INTEL_VENDOR_ID, E1000_DEV_ID_PCH_I218_V3) },
+       { RTE_PCI_DEVICE(E1000_INTEL_VENDOR_ID, E1000_DEV_ID_PCH_SPT_I219_LM) },
+       { RTE_PCI_DEVICE(E1000_INTEL_VENDOR_ID, E1000_DEV_ID_PCH_SPT_I219_V) },
+       { RTE_PCI_DEVICE(E1000_INTEL_VENDOR_ID, E1000_DEV_ID_PCH_SPT_I219_LM2) },
+       { RTE_PCI_DEVICE(E1000_INTEL_VENDOR_ID, E1000_DEV_ID_PCH_SPT_I219_V2) },
+       { RTE_PCI_DEVICE(E1000_INTEL_VENDOR_ID, E1000_DEV_ID_PCH_LBG_I219_LM3) },
+       { RTE_PCI_DEVICE(E1000_INTEL_VENDOR_ID, E1000_DEV_ID_PCH_SPT_I219_LM4) },
+       { RTE_PCI_DEVICE(E1000_INTEL_VENDOR_ID, E1000_DEV_ID_PCH_SPT_I219_V4) },
+       { RTE_PCI_DEVICE(E1000_INTEL_VENDOR_ID, E1000_DEV_ID_PCH_SPT_I219_LM5) },
+       { RTE_PCI_DEVICE(E1000_INTEL_VENDOR_ID, E1000_DEV_ID_PCH_SPT_I219_V5) },
+       { RTE_PCI_DEVICE(E1000_INTEL_VENDOR_ID, E1000_DEV_ID_PCH_CNP_I219_LM6) },
+       { RTE_PCI_DEVICE(E1000_INTEL_VENDOR_ID, E1000_DEV_ID_PCH_CNP_I219_V6) },
+       { RTE_PCI_DEVICE(E1000_INTEL_VENDOR_ID, E1000_DEV_ID_PCH_CNP_I219_LM7) },
+       { RTE_PCI_DEVICE(E1000_INTEL_VENDOR_ID, E1000_DEV_ID_PCH_CNP_I219_V7) },
        { .vendor_id = 0, /* sentinel */ },
 };
 
@@ -192,6 +204,8 @@ static const struct eth_dev_ops eth_em_ops = {
        .rx_queue_release     = eth_em_rx_queue_release,
        .rx_queue_count       = eth_em_rx_queue_count,
        .rx_descriptor_done   = eth_em_rx_descriptor_done,
+       .rx_descriptor_status = eth_em_rx_descriptor_status,
+       .tx_descriptor_status = eth_em_tx_descriptor_status,
        .tx_queue_setup       = eth_em_tx_queue_setup,
        .tx_queue_release     = eth_em_tx_queue_release,
        .rx_queue_intr_enable = eth_em_rx_queue_intr_enable,
@@ -279,6 +293,19 @@ eth_em_dev_is_ich8(struct e1000_hw *hw)
        case E1000_DEV_ID_PCH_I218_LM2:
        case E1000_DEV_ID_PCH_I218_V3:
        case E1000_DEV_ID_PCH_I218_LM3:
+       case E1000_DEV_ID_PCH_SPT_I219_LM:
+       case E1000_DEV_ID_PCH_SPT_I219_V:
+       case E1000_DEV_ID_PCH_SPT_I219_LM2:
+       case E1000_DEV_ID_PCH_SPT_I219_V2:
+       case E1000_DEV_ID_PCH_LBG_I219_LM3:
+       case E1000_DEV_ID_PCH_SPT_I219_LM4:
+       case E1000_DEV_ID_PCH_SPT_I219_V4:
+       case E1000_DEV_ID_PCH_SPT_I219_LM5:
+       case E1000_DEV_ID_PCH_SPT_I219_V5:
+       case E1000_DEV_ID_PCH_CNP_I219_LM6:
+       case E1000_DEV_ID_PCH_CNP_I219_V6:
+       case E1000_DEV_ID_PCH_CNP_I219_LM7:
+       case E1000_DEV_ID_PCH_CNP_I219_V7:
                return 1;
        default:
                return 0;
@@ -313,7 +340,7 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev)
        }
 
        rte_eth_copy_pci_info(eth_dev, pci_dev);
-       eth_dev->data->dev_flags = RTE_ETH_DEV_DETACHABLE;
+       eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
 
        hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
        hw->device_id = pci_dev->id.device_id;
@@ -540,6 +567,8 @@ em_set_pba(struct e1000_hw *hw)
                case e1000_pchlan:
                case e1000_pch2lan:
                case e1000_pch_lpt:
+               case e1000_pch_spt:
+               case e1000_pch_cnp:
                        pba = E1000_PBA_26K;
                        break;
                default:
@@ -611,7 +640,7 @@ eth_em_start(struct rte_eth_dev *dev)
                                        dev->data->nb_rx_queues * sizeof(int), 0);
                if (intr_handle->intr_vec == NULL) {
                        PMD_INIT_LOG(ERR, "Failed to allocate %d rx_queues"
-                                               " intr_vec\n", dev->data->nb_rx_queues);
+                                               " intr_vec", dev->data->nb_rx_queues);
                        return -ENOMEM;
                }
 
@@ -708,7 +737,7 @@ eth_em_start(struct rte_eth_dev *dev)
                                                (void *)dev);
                if (dev->data->dev_conf.intr_conf.lsc != 0)
                        PMD_INIT_LOG(INFO, "lsc won't enable because of"
-                                    " no intr multiplex\n");
+                                    " no intr multiplexn");
        }
        /* check if rxq interrupt is enabled */
        if (dev->data->dev_conf.intr_conf.rxq != 0)
@@ -856,7 +885,9 @@ em_hardware_init(struct e1000_hw *hw)
                hw->fc.low_water = 0x5048;
                hw->fc.pause_time = 0x0650;
                hw->fc.refresh_time = 0x0400;
-       } else if (hw->mac.type == e1000_pch_lpt) {
+       } else if (hw->mac.type == e1000_pch_lpt ||
+                  hw->mac.type == e1000_pch_spt ||
+                  hw->mac.type == e1000_pch_cnp) {
                hw->fc.requested_mode = e1000_fc_full;
        }
 
@@ -1031,6 +1062,8 @@ em_get_max_pktlen(const struct e1000_hw *hw)
        case e1000_ich10lan:
        case e1000_pch2lan:
        case e1000_pch_lpt:
+       case e1000_pch_spt:
+       case e1000_pch_cnp:
        case e1000_82574:
        case e1000_80003es2lan: /* 9K Jumbo Frame size */
        case e1000_82583:
@@ -1054,6 +1087,16 @@ eth_em_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
        dev_info->min_rx_bufsize = 256; /* See BSIZE field of RCTL register. */
        dev_info->max_rx_pktlen = em_get_max_pktlen(hw);
        dev_info->max_mac_addrs = hw->mac.rar_entry_count;
+       dev_info->rx_offload_capa =
+               DEV_RX_OFFLOAD_VLAN_STRIP |
+               DEV_RX_OFFLOAD_IPV4_CKSUM |
+               DEV_RX_OFFLOAD_UDP_CKSUM  |
+               DEV_RX_OFFLOAD_TCP_CKSUM;
+       dev_info->tx_offload_capa =
+               DEV_TX_OFFLOAD_VLAN_INSERT |
+               DEV_TX_OFFLOAD_IPV4_CKSUM  |
+               DEV_TX_OFFLOAD_UDP_CKSUM   |
+               DEV_TX_OFFLOAD_TCP_CKSUM;
 
        /*
         * Starting with 631xESB hw supports 2 TX/RX queues per port.
@@ -1614,13 +1657,12 @@ eth_em_interrupt_action(struct rte_eth_dev *dev,
  *  void
  */
 static void
-eth_em_interrupt_handler(struct rte_intr_handle *handle,
-                        void *param)
+eth_em_interrupt_handler(void *param)
 {
        struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
 
        eth_em_interrupt_get_status(dev);
-       eth_em_interrupt_action(dev, handle);
+       eth_em_interrupt_action(dev, dev->intr_handle);
        _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }