net/txgbe: support OEM subsystem vendor ID
[dpdk.git] / drivers / net / txgbe / txgbe_ethdev.c
index 19d4444..dc8c3c7 100644 (file)
@@ -376,7 +376,7 @@ txgbe_dev_queue_stats_mapping_set(struct rte_eth_dev *eth_dev,
        if (hw->mac.type != txgbe_mac_raptor)
                return -ENOSYS;
 
-       if (stat_idx & !QMAP_FIELD_RESERVED_BITS_MASK)
+       if (stat_idx & ~QMAP_FIELD_RESERVED_BITS_MASK)
                return -EIO;
 
        PMD_INIT_LOG(DEBUG, "Setting port %d, %s queue_id %d to stat index %d",
@@ -594,6 +594,19 @@ eth_txgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)
        /* Vendor and Device ID need to be set before init of shared code */
        hw->device_id = pci_dev->id.device_id;
        hw->vendor_id = pci_dev->id.vendor_id;
+       if (pci_dev->id.subsystem_vendor_id == PCI_VENDOR_ID_WANGXUN) {
+               hw->subsystem_device_id = pci_dev->id.subsystem_device_id;
+       } else {
+               u32 ssid;
+
+               ssid = txgbe_flash_read_dword(hw, 0xFFFDC);
+               if (ssid == 0x1) {
+                       PMD_INIT_LOG(ERR,
+                               "Read of internal subsystem device id failed\n");
+                       return -ENODEV;
+               }
+               hw->subsystem_device_id = (u16)ssid >> 8 | (u16)ssid << 8;
+       }
        hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
        hw->allow_unsupported_sfp = 1;