New upstream version 17.08
[deb_dpdk.git] / drivers / net / liquidio / lio_ethdev.c
index c7f1fb6..479936a 100644 (file)
@@ -395,6 +395,25 @@ lio_dev_info_get(struct rte_eth_dev *eth_dev,
                 struct rte_eth_dev_info *devinfo)
 {
        struct lio_device *lio_dev = LIO_DEV(eth_dev);
+       struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+
+       devinfo->pci_dev = pci_dev;
+
+       switch (pci_dev->id.subsystem_device_id) {
+       /* CN23xx 10G cards */
+       case PCI_SUBSYS_DEV_ID_CN2350_210:
+       case PCI_SUBSYS_DEV_ID_CN2360_210:
+               devinfo->speed_capa = ETH_LINK_SPEED_10G;
+               break;
+       /* CN23xx 25G cards */
+       case PCI_SUBSYS_DEV_ID_CN2350_225:
+       case PCI_SUBSYS_DEV_ID_CN2360_225:
+               devinfo->speed_capa = ETH_LINK_SPEED_25G;
+               break;
+       default:
+               lio_dev_err(lio_dev,
+                           "Unknown CN23XX subsystem device id. Not setting speed capability.\n");
+       }
 
        devinfo->max_rx_queues = lio_dev->max_rx_queues;
        devinfo->max_tx_queues = lio_dev->max_tx_queues;
@@ -1977,7 +1996,7 @@ lio_eth_dev_uninit(struct rte_eth_dev *eth_dev)
 static int
 lio_eth_dev_init(struct rte_eth_dev *eth_dev)
 {
-       struct rte_pci_device *pdev = RTE_DEV_TO_PCI(eth_dev->device);
+       struct rte_pci_device *pdev = RTE_ETH_DEV_TO_PCI(eth_dev);
        struct lio_device *lio_dev = LIO_DEV(eth_dev);
 
        PMD_INIT_FUNC_TRACE();