]> git.droids-corp.org - dpdk.git/commitdiff
ethdev: add link state interrupt flag
authorStephen Hemminger <stephen@networkplumber.org>
Thu, 19 Jun 2014 22:12:38 +0000 (15:12 -0700)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Fri, 27 Jun 2014 00:21:50 +0000 (02:21 +0200)
Only some devices support the link state interrupt configuration option.
Link state control does not work in virtual drivers
(virtio, vmxnet3, igbvf, and ixgbevf). Instead of having the application
try and guess whether it will work or not provide a driver flag that
can be checked instead.

Note: if device driver doesn't support link state control, what
would happen previously is that the code would never detect link
transitions. This prevents that.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
[Thomas: rename flag]
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
lib/librte_eal/common/include/rte_pci.h
lib/librte_ether/rte_ethdev.c
lib/librte_pmd_e1000/em_ethdev.c
lib/librte_pmd_e1000/igb_ethdev.c
lib/librte_pmd_ixgbe/ixgbe_ethdev.c

index 3608ee04c7aabd173e5def852d9b755e631b7685..d6b1c1b8998f99008aff86fd05ce361462b27c88 100644 (file)
@@ -197,6 +197,8 @@ struct rte_pci_driver {
 #define RTE_PCI_DRV_MULTIPLE 0x0002
 /** Device needs to be unbound even if no module is provided */
 #define RTE_PCI_DRV_FORCE_UNBIND 0x0004
+/** Device driver supports link state interrupt */
+#define RTE_PCI_DRV_INTR_LSC   0x0008
 
 /**< Internal use only - Macro used by pci addr parsing functions **/
 #define GET_PCIADDR_FIELD(in, fd, lim, dlm)                   \
index a292b6e01c3d33f344c45f756523230b1bcb7b46..ef81a76ddcaec5a92688dfb32c05ea0f56622c4a 100644 (file)
@@ -639,6 +639,20 @@ rte_eth_dev_configure(uint8_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
        /* Copy the dev_conf parameter into the dev structure */
        memcpy(&dev->data->dev_conf, dev_conf, sizeof(dev->data->dev_conf));
 
+       /*
+        * If link state interrupt is enabled, check that the
+        * device supports it.
+        */
+       if (dev_conf->intr_conf.lsc == 1) {
+               const struct rte_pci_driver *pci_drv = &dev->driver->pci_drv;
+
+               if (!(pci_drv->drv_flags & RTE_PCI_DRV_INTR_LSC)) {
+                       PMD_DEBUG_TRACE("driver %s does not support lsc\n",
+                                       pci_drv->name);
+                       return (-EINVAL);
+               }
+       }
+
        /*
         * If jumbo frames are enabled, check that the maximum RX packet
         * length is supported by the configured device.
index 8b2a340a36a948f153a39f90f88729e3b9712848..4555294bc582535b9ac3e32d749b8a9099fe299a 100644 (file)
@@ -286,7 +286,7 @@ static struct eth_driver rte_em_pmd = {
        {
                .name = "rte_em_pmd",
                .id_table = pci_id_em_map,
-               .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+               .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
        },
        .eth_dev_init = eth_em_dev_init,
        .dev_private_size = sizeof(struct e1000_adapter),
index 86f2d0ca2d44bd3e5fbba6f938d7c032ad9fb11f..3187d920f02155f3acf4f45bd2ada243ff5768d6 100644 (file)
@@ -662,7 +662,7 @@ static struct eth_driver rte_igb_pmd = {
        {
                .name = "rte_igb_pmd",
                .id_table = pci_id_igb_map,
-               .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+               .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
        },
        .eth_dev_init = eth_igb_dev_init,
        .dev_private_size = sizeof(struct e1000_adapter),
index e0c80b37d35333715ce25fad1e3a0fab33cb2794..59122a19537c6928d6b0d5b6637299e28441da3e 100644 (file)
@@ -1049,7 +1049,7 @@ static struct eth_driver rte_ixgbe_pmd = {
        {
                .name = "rte_ixgbe_pmd",
                .id_table = pci_id_ixgbe_map,
-               .drv_flags = RTE_PCI_DRV_NEED_MAPPING,
+               .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
        },
        .eth_dev_init = eth_ixgbe_dev_init,
        .dev_private_size = sizeof(struct ixgbe_adapter),