ethdev: add link state interrupt flag
[dpdk.git] / lib / librte_ether / rte_ethdev.c
index a292b6e..ef81a76 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.