On 6/20/2022 8:55 AM, Jiawen Wu wrote:
Add support for OEM subsystem vendor ID.
Signed-off-by: Jiawen Wu <jiawe...@trustnetic.com>
---
doc/guides/rel_notes/release_22_07.rst | 1 +
drivers/net/ngbe/ngbe_ethdev.c | 13 ++++++++++++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/doc/guides/rel_notes/release_22_07.rst
b/doc/guides/rel_notes/release_22_07.rst
index 96db85a707..b26efb8719 100644
--- a/doc/guides/rel_notes/release_22_07.rst
+++ b/doc/guides/rel_notes/release_22_07.rst
@@ -166,6 +166,7 @@ New Features
* **Updated Wangxun ngbe driver.**
* Added support for yt8531s PHY.
+ * Added support for OEM subsystem vendor ID.
* **Updated Wangxun txgbe driver.**
diff --git a/drivers/net/ngbe/ngbe_ethdev.c b/drivers/net/ngbe/ngbe_ethdev.c
index 5ac1c27a58..c4216f7e34 100644
--- a/drivers/net/ngbe/ngbe_ethdev.c
+++ b/drivers/net/ngbe/ngbe_ethdev.c
@@ -315,6 +315,7 @@ eth_ngbe_dev_init(struct rte_eth_dev *eth_dev, void
*init_params __rte_unused)
const struct rte_memzone *mz;
uint32_t ctrl_ext;
u32 led_conf = 0;
+ u32 ssid = 0;
Same comment with previous patch, can move the variable to the context
it is used, and no need to initialize.
int err, ret;
PMD_INIT_FUNC_TRACE();
@@ -359,7 +360,17 @@ eth_ngbe_dev_init(struct rte_eth_dev *eth_dev, void
*init_params __rte_unused)
hw->back = pci_dev;
hw->device_id = pci_dev->id.device_id;
hw->vendor_id = pci_dev->id.vendor_id;
- hw->sub_system_id = pci_dev->id.subsystem_device_id;
+ if (pci_dev->id.subsystem_vendor_id == PCI_VENDOR_ID_WANGXUN) {
+ hw->sub_system_id = pci_dev->id.subsystem_device_id;
+ } else {
+ ssid = ngbe_flash_read_dword(hw, 0xFFFDC);
+ if (ssid == 0x1) {
+ PMD_INIT_LOG(ERR,
+ "Read of internal subsystem device id
failed\n");
+ return -ENODEV;
+ }
+ hw->sub_system_id = (u16)ssid >> 8 | (u16)ssid << 8;
+ }
ngbe_map_device_id(hw);
hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;