DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jiawen Wu <jiawenwu@trustnetic.com>
To: dev@dpdk.org
Cc: Jiawen Wu <jiawenwu@trustnetic.com>
Subject: [PATCH 2/7] net/ngbe: support OEM subsystem vendor ID
Date: Mon, 20 Jun 2022 15:55:07 +0800	[thread overview]
Message-ID: <20220620075512.588744-3-jiawenwu@trustnetic.com> (raw)
In-Reply-To: <20220620075512.588744-1-jiawenwu@trustnetic.com>

Add support for OEM subsystem vendor ID.

Signed-off-by: Jiawen Wu <jiawenwu@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;
 	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;
 
-- 
2.27.0




  parent reply	other threads:[~2022-06-20  7:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20  7:55 [PATCH 0/7] Fixes and supports for Wangxun NICs Jiawen Wu
2022-06-20  7:55 ` [PATCH 1/7] net/txgbe: support OEM subsystem vendor ID Jiawen Wu
2022-06-21 12:19   ` Ferruh Yigit
2022-06-20  7:55 ` Jiawen Wu [this message]
2022-06-21 12:19   ` [PATCH 2/7] net/ngbe: " Ferruh Yigit
2022-06-20  7:55 ` [PATCH 3/7] net/txgbe: fix register polling Jiawen Wu
2022-06-21 12:19   ` Ferruh Yigit
2022-06-22  2:44     ` Jiawen Wu
2022-06-20  7:55 ` [PATCH 4/7] net/ngbe: add more packet statistics Jiawen Wu
2022-06-20  7:55 ` [PATCH 5/7] net/ngbe: fix YT PHY UTP mode to link up Jiawen Wu
2022-06-20  7:55 ` [PATCH 6/7] net/ngbe: support autoneg on/off for external PHY SFI mode Jiawen Wu
2022-06-20  7:55 ` [PATCH 7/7] net/ngbe: support YT PHY SGMII to RGMII mode Jiawen Wu
2022-06-21 12:20 ` [PATCH 0/7] Fixes and supports for Wangxun NICs Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220620075512.588744-3-jiawenwu@trustnetic.com \
    --to=jiawenwu@trustnetic.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).