net/axgbe: use PCI root complex device to distinguish AMD hardware
PATCH 1/1 net/axgbe: use PCI root complex device to distinguish AMD hardware
"bus/pci: optimize bus scan" broke axgbe on V1000/R1000. RV root complex pci device does not have any kernel driver assigned so it is removed from pci scan list which is used in "net/axgbe: add a HW quirk for register definitions"
Get root complex device id directly from pci sysfs instead of pci scan list
--- drivers/net/axgbe/axgbe_ethdev.c | 39 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 19 deletions(-)
drivers/net/axgbe/axgbe_ethdev.c +20 -19
@@ -10,6 +10,8 @@#include "axgbe_regs.h" #include "rte_time.h" +#include "eal_filesystem.h" +static int eth_axgbe_dev_init (struct rte_eth_dev *eth_dev);static int axgbe_dev_configure (struct rte_eth_dev *dev);static int axgbe_dev_start (struct rte_eth_dev *dev);
@@ -1923,28 +1925,27 @@ static void axgbe_default_config(struct axgbe_port *pdata) pdata->power_down =0 ; } -static int -pci_device_cmp (const struct rte_device *dev,const void *_pci_id) +/* +* Return PCI root complex device id on success else 0 +*/ +static uint16_t +get_pci_rc_devid (void ) { -const struct rte_pci_device *pdev =RTE_DEV_TO_PCI_CONST (dev); -const struct rte_pci_id *pcid = _pci_id; +char pci_sysfs[PATH_MAX ]; +const struct rte_pci_addr pci_rc_addr = {0 ,0 ,0 ,0 }; +unsigned long device_id; -if (pdev->id.vendor_id ==AMD_PCI_VENDOR_ID && - pdev->id.device_id == pcid->device_id) -return 0 ; -return 1 ; -} +snprintf (pci_sysfs,sizeof (pci_sysfs),"%s/" PCI_PRI_FMT "/device" , +rte_pci_get_sysfs_path (), pci_rc_addr.domain, + pci_rc_addr.bus, pci_rc_addr.devid, pci_rc_addr.function); -static bool -pci_search_device (int device_id) -{ -struct rte_bus *pci_bus; -struct rte_pci_id dev_id; +/* get device id */ +if (eal_parse_sysfs_value (pci_sysfs, &device_id) <0 ) { +PMD_INIT_LOG (ERR ,"Error in reading PCI sysfs\n" ); +return 0 ; + } - dev_id.device_id = device_id; - pci_bus =rte_bus_find_by_name ("pci" ); -return (pci_bus !=NULL ) && - (pci_bus->find_device (NULL , pci_device_cmp, &dev_id) !=NULL ); +return (uint16_t )device_id; }/*
@@ -1986,7 +1987,7 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev)/* * Use root complex device ID to differentiate RV AXGBE vs SNOWY AXGBE */ -if (pci_search_device (AMD_PCI_RV_ROOT_COMPLEX_ID )) { +if ((get_pci_rc_devid ()) ==AMD_PCI_RV_ROOT_COMPLEX_ID ) { pdata->xpcs_window_def_reg =PCS_V2_RV_WINDOW_DEF ; pdata->xpcs_window_sel_reg =PCS_V2_RV_WINDOW_SELECT ; }else {
Signature · 1 line
2.25.1
Hi Chandu,
I have tested this in the following configurations and it works very well in all cases:
* V1000 with Yocto v3.3.2 & Linux v5.10.47
* E3000 with Yocto v3.3.2 & Linux v5.10.47
* V1000 with Ubuntu Server v20.04.3 LTS
* E3000 with Ubuntu Server v20.04.3 LTS
I think this is a much better approach than scanning the whole PCI bus and comparing each and every device against the PCI Root Complex Device ID of the platform.
This solution looks good to me!
Acked by: Arsalan H. Awan <[email protected]>
________________________________________
From: Chandubabu Namburu <[email protected]>
Sent: Friday, November 26, 2021 3:24 PM
To: [email protected]
Cc: [email protected]; Awan, Arsalan; Chandubabu Namburu
Subject: [PATCH v1] net/axgbe: use PCI root complex device to distinguish AMD hardware
"bus/pci: optimize bus scan" broke axgbe on V1000/R1000. RV root complex pci device does not have any kernel driver assigned so it is removed from pci scan list which is used in "net/axgbe: add a HW quirk for register definitions"
Get root complex device id directly from pci sysfs instead of pci scan list
--- drivers/net/axgbe/axgbe_ethdev.c | 39 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 19 deletions(-)
drivers/net/axgbe/axgbe_ethdev.c +20 -19
@@ -10,6 +10,8 @@#include "axgbe_regs.h" #include "rte_time.h" +#include "eal_filesystem.h" +static int eth_axgbe_dev_init (struct rte_eth_dev *eth_dev);static int axgbe_dev_configure (struct rte_eth_dev *dev);static int axgbe_dev_start (struct rte_eth_dev *dev);
@@ -1923,28 +1925,27 @@ static void axgbe_default_config(struct axgbe_port *pdata) pdata->power_down =0 ; } -static int -pci_device_cmp (const struct rte_device *dev,const void *_pci_id) +/* +* Return PCI root complex device id on success else 0 +*/ +static uint16_t +get_pci_rc_devid (void ) { -const struct rte_pci_device *pdev =RTE_DEV_TO_PCI_CONST (dev); -const struct rte_pci_id *pcid = _pci_id; +char pci_sysfs[PATH_MAX ]; +const struct rte_pci_addr pci_rc_addr = {0 ,0 ,0 ,0 }; +unsigned long device_id; -if (pdev->id.vendor_id ==AMD_PCI_VENDOR_ID && - pdev->id.device_id == pcid->device_id) -return 0 ; -return 1 ; -} +snprintf (pci_sysfs,sizeof (pci_sysfs),"%s/" PCI_PRI_FMT "/device" , +rte_pci_get_sysfs_path (), pci_rc_addr.domain, + pci_rc_addr.bus, pci_rc_addr.devid, pci_rc_addr.function); -static bool -pci_search_device (int device_id) -{ -struct rte_bus *pci_bus; -struct rte_pci_id dev_id; +/* get device id */ +if (eal_parse_sysfs_value (pci_sysfs, &device_id) <0 ) { +PMD_INIT_LOG (ERR ,"Error in reading PCI sysfs\n" ); +return 0 ; + } - dev_id.device_id = device_id; - pci_bus =rte_bus_find_by_name ("pci" ); -return (pci_bus !=NULL ) && - (pci_bus->find_device (NULL , pci_device_cmp, &dev_id) !=NULL ); +return (uint16_t )device_id; }/*
@@ -1986,7 +1987,7 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev)/* * Use root complex device ID to differentiate RV AXGBE vs SNOWY AXGBE */ -if (pci_search_device (AMD_PCI_RV_ROOT_COMPLEX_ID )) { +if ((get_pci_rc_devid ()) ==AMD_PCI_RV_ROOT_COMPLEX_ID ) { pdata->xpcs_window_def_reg =PCS_V2_RV_WINDOW_DEF ; pdata->xpcs_window_sel_reg =PCS_V2_RV_WINDOW_SELECT ; }else {
--
2.25.1
Quoted 8 lines · Chandubabu Namburu
"bus/pci: optimize bus scan" broke axgbe on V1000/R1000. RV root complex pci device does not have any kernel driver assigned so it is removed from pci scan list which is used in "net/axgbe: add a HW quirk for register definitions"
Get root complex device id directly from pci sysfs instead of pci scan list
Please end the sentences with a '.'.
As you described, this change is a fix.
Please add a Fixes: tag and Cc: [email protected] in the commitlog if you think it should be backported to LTS releases.
https://doc.dpdk.org/guides/contributing/patches.html#patch-for-stable-releases
Quoted 35 lines
Signed-off-by Chandubabu Namburu <[email protected]>--- drivers/net/axgbe/axgbe_ethdev.c | 39 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 19 deletions(-)drivers/net/axgbe/axgbe_ethdev.c +9
-4@@ -10,6 +10,8 @@#include "axgbe_regs.h" #include "rte_time.h" +#include "eal_filesystem.h" +static int eth_axgbe_dev_init (struct rte_eth_dev *eth_dev);static int axgbe_dev_configure (struct rte_eth_dev *dev);static int axgbe_dev_start (struct rte_eth_dev *dev);@@ -1923,28 +1925,27 @@ static void axgbe_default_config(struct axgbe_port *pdata) pdata->power_down =0 ; } -static int -pci_device_cmp (const struct rte_device *dev,const void *_pci_id) +/* +* Return PCI root complex device id on success else 0 +*/ +static uint16_t +get_pci_rc_devid (void ) { -const struct rte_pci_device *pdev =RTE_DEV_TO_PCI_CONST (dev); -const struct rte_pci_id *pcid = _pci_id; +char pci_sysfs[PATH_MAX ]; +const struct rte_pci_addr pci_rc_addr = {0 ,0 ,0 ,0 };
drivers/net/axgbe/axgbe_ethdev.c static void axgbe_default_config(struct axgbe_port *pdata) · line 1940
Quoted 10 lines
drivers/net/axgbe/axgbe_ethdev.c +4
-5+unsigned long device_id; -if (pdev->id.vendor_id ==AMD_PCI_VENDOR_ID && - pdev->id.device_id == pcid->device_id) -return 0 ; -return 1 ; -} +snprintf (pci_sysfs,sizeof (pci_sysfs),"%s/" PCI_PRI_FMT "/device" , +rte_pci_get_sysfs_path (), pci_rc_addr.domain, + pci_rc_addr.bus, pci_rc_addr.devid, pci_rc_addr.function);
The use of rte_pci_get_sysfs_path() and in general is ugly because it only works for Linux.
We could come up with a better API in the pci bus, but I don't think it is worth it atm.
We can live with your implementation since this driver is only compiled on Linux.
Signature · 1 line
David Marchand
[Public]
Hi David Marchand,
Thank you for your comments. Will change patch and submit v2 for review
Regards,
Chandu
-----Original Message-----
From: David Marchand <[email protected]>
Sent: Wednesday, December 1, 2021 2:31 PM
To: Namburu, Chandu-babu <[email protected]>
Cc: dev <[email protected]>; Sebastian, Selwin <[email protected]>; [email protected]; Yigit, Ferruh <[email protected]>
Subject: Re: [PATCH v1] net/axgbe: use PCI root complex device to distinguish AMD hardware
Quoted 8 lines · Chandubabu Namburu
"bus/pci: optimize bus scan" broke axgbe on V1000/R1000.
RV root complex pci device does not have any kernel driver assigned so it is removed from pci scan list which is used in "net/axgbe: add a HW quirk for register definitions"Get root complex device id directly from pci sysfs instead of pci scan list
Please end the sentences with a '.'.
As you described, this change is a fix.
Please add a Fixes: tag and Cc: [email protected] in the commitlog if you think it should be backported to LTS releases.
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoc.dpdk.org%2Fguides%2Fcontributing%2Fpatches.html%23patch-for-stable-releases&data=04%7C01%7Cchandu%40amd.com%7C6618c303ecb146be0b5908d9b4a91c01%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637739460691977618%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=piC1U%2BPcPP2A0xwM3%2FA5qDUFXNLAj2SrLBywTFc3DFM%3D&reserved=0
Quoted 37 lines
Signed-off-by Chandubabu Namburu <[email protected]>--- drivers/net/axgbe/axgbe_ethdev.c | 39 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 19 deletions(-)drivers/net/axgbe/axgbe_ethdev.c +2
-0@@ -10,6 +10,8 @@#include "axgbe_regs.h" #include "rte_time.h" +#include "eal_filesystem.h" + static int eth_axgbe_dev_init(struct rte_eth_dev *eth_dev); staticint
axgbe_dev_configure(struct rte_eth_dev *dev); static intaxgbe_dev_start(struct rte_eth_dev *dev); @@ -1923,28 +1925,27 @@ static voidaxgbe_default_config(struct axgbe_port *pdata)pdata->power_down = 0;}
drivers/net/axgbe/axgbe_ethdev.c +7
-4-static int -pci_device_cmp (const struct rte_device *dev,const void *_pci_id) +/* +* Return PCI root complex device id on success else 0 */ static +uint16_t +get_pci_rc_devid (void ) { -const struct rte_pci_device *pdev =RTE_DEV_TO_PCI_CONST (dev); -const struct rte_pci_id *pcid = _pci_id; +char pci_sysfs[PATH_MAX ]; +const struct rte_pci_addr pci_rc_addr = {0 ,0 ,0 ,0 }; +unsigned long device_id;
drivers/net/axgbe/axgbe_ethdev.c static void axgbe_default_config(struct axgbe_port *pdata)
Quoted 10 lines
drivers/net/axgbe/axgbe_ethdev.c +4
-5-if (pdev->id.vendor_id ==AMD_PCI_VENDOR_ID && - pdev->id.device_id == pcid->device_id) -return 0 ; -return 1 ; -} +snprintf (pci_sysfs,sizeof (pci_sysfs),"%s/" PCI_PRI_FMT "/device" , +rte_pci_get_sysfs_path (), pci_rc_addr.domain, + pci_rc_addr.bus, pci_rc_addr.devid, + pci_rc_addr.function);
The use of rte_pci_get_sysfs_path() and in general is ugly because it only works for Linux. We could come up with a better API in the pci bus, but I don't think it is worth it atm.
We can live with your implementation since this driver is only compiled on Linux.
--
David Marchand
PATCH v2 1/1 net/axgbe: use PCI root complex device to distinguish AMD hardware
In reply to Chandubabu Namburu"bus/pci: optimize bus scan" broke axgbe on V1000/R1000. RV root complex pci device does not have any kernel driver assigned so it is removed from pci scan list which is used in "net/axgbe: add a HW quirk for register definitions".
Get root complex device id directly from pci sysfs instead of pci scan list.
--- drivers/net/axgbe/axgbe_ethdev.c | 39 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 19 deletions(-)
drivers/net/axgbe/axgbe_ethdev.c +20 -19
@@ -10,6 +10,8 @@#include "axgbe_regs.h" #include "rte_time.h" +#include "eal_filesystem.h" +static int eth_axgbe_dev_init (struct rte_eth_dev *eth_dev);static int axgbe_dev_configure (struct rte_eth_dev *dev);static int axgbe_dev_start (struct rte_eth_dev *dev);
@@ -2117,28 +2119,27 @@ static void axgbe_default_config(struct axgbe_port *pdata) pdata->power_down =0 ; } -static int -pci_device_cmp (const struct rte_device *dev,const void *_pci_id) +/* +* Return PCI root complex device id on success else 0 +*/ +static uint16_t +get_pci_rc_devid (void ) { -const struct rte_pci_device *pdev =RTE_DEV_TO_PCI_CONST (dev); -const struct rte_pci_id *pcid = _pci_id; +char pci_sysfs[PATH_MAX ]; +const struct rte_pci_addr pci_rc_addr = {0 ,0 ,0 ,0 }; +unsigned long device_id; -if (pdev->id.vendor_id ==AMD_PCI_VENDOR_ID && - pdev->id.device_id == pcid->device_id) -return 0 ; -return 1 ; -} +snprintf (pci_sysfs,sizeof (pci_sysfs),"%s/" PCI_PRI_FMT "/device" , +rte_pci_get_sysfs_path (), pci_rc_addr.domain, + pci_rc_addr.bus, pci_rc_addr.devid, pci_rc_addr.function); -static bool -pci_search_device (int device_id) -{ -struct rte_bus *pci_bus; -struct rte_pci_id dev_id; +/* get device id */ +if (eal_parse_sysfs_value (pci_sysfs, &device_id) <0 ) { +PMD_INIT_LOG (ERR ,"Error in reading PCI sysfs\n" ); +return 0 ; + } - dev_id.device_id = device_id; - pci_bus =rte_bus_find_by_name ("pci" ); -return (pci_bus !=NULL ) && - (pci_bus->find_device (NULL , pci_device_cmp, &dev_id) !=NULL ); +return (uint16_t )device_id; }/*
@@ -2180,7 +2181,7 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev)/* * Use root complex device ID to differentiate RV AXGBE vs SNOWY AXGBE */ -if (pci_search_device (AMD_PCI_RV_ROOT_COMPLEX_ID )) { +if ((get_pci_rc_devid ()) ==AMD_PCI_RV_ROOT_COMPLEX_ID ) { pdata->xpcs_window_def_reg =PCS_V2_RV_WINDOW_DEF ; pdata->xpcs_window_sel_reg =PCS_V2_RV_WINDOW_SELECT ; }else {
Signature · 1 line
2.25.1
[Public]
Hi David Marchand,
I have submitted v2 patch with your suggestion in git log. Please review changes.
Regards,
Chandu
-----Original Message-----
From: Namburu, Chandu-babu <[email protected]>
Sent: Thursday, December 2, 2021 9:41 PM
To: [email protected]; [email protected]
Cc: Sebastian, Selwin <[email protected]>; [email protected]; [email protected]; Namburu, Chandu-babu <[email protected]>; [email protected]
Subject: [PATCH v2] net/axgbe: use PCI root complex device to distinguish AMD hardware
"bus/pci: optimize bus scan" broke axgbe on V1000/R1000.
RV root complex pci device does not have any kernel driver assigned so it is removed from pci scan list which is used in "net/axgbe: add a HW quirk for register definitions".
Get root complex device id directly from pci sysfs instead of pci scan list.
--- drivers/net/axgbe/axgbe_ethdev.c | 39 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 19 deletions(-)
drivers/net/axgbe/axgbe_ethdev.c +2 -0
@@ -10,6 +10,8 @@#include "axgbe_regs.h" #include "rte_time.h" +#include "eal_filesystem.h" + static int eth_axgbe_dev_init(struct rte_eth_dev *eth_dev); static int axgbe_dev_configure(struct rte_eth_dev *dev); static int axgbe_dev_start(struct rte_eth_dev *dev); @@ -2117,28 +2119,27 @@ static void axgbe_default_config(struct axgbe_port *pdata) pdata->power_down = 0; }
-static int
-pci_device_cmp(const struct rte_device *dev, const void *_pci_id) +/*
+ * Return PCI root complex device id on success else 0 */ static +uint16_t
+get_pci_rc_devid(void)
{
- const struct rte_pci_device *pdev = RTE_DEV_TO_PCI_CONST(dev);
- const struct rte_pci_id *pcid = _pci_id;
+ char pci_sysfs[PATH_MAX];
+ const struct rte_pci_addr pci_rc_addr = {0, 0, 0, 0};
+ unsigned long device_id;
- if (pdev->id.vendor_id == AMD_PCI_VENDOR_ID &&
- pdev->id.device_id == pcid->device_id)
- return 0;
- return 1;
-}
+ snprintf(pci_sysfs, sizeof(pci_sysfs), "%s/" PCI_PRI_FMT "/device",
+ rte_pci_get_sysfs_path(), pci_rc_addr.domain,
+ pci_rc_addr.bus, pci_rc_addr.devid, pci_rc_addr.function);
-static bool
-pci_search_device(int device_id)
-{
- struct rte_bus *pci_bus;
- struct rte_pci_id dev_id;
+ /* get device id */
+ if (eal_parse_sysfs_value(pci_sysfs, &device_id) < 0) {
+ PMD_INIT_LOG(ERR, "Error in reading PCI sysfs\n");
+ return 0;
+ }
- dev_id.device_id = device_id;
- pci_bus = rte_bus_find_by_name("pci");
- return (pci_bus != NULL) &&
- (pci_bus->find_device(NULL, pci_device_cmp, &dev_id) != NULL);
+ return (uint16_t)device_id;
}
/*
@@ -2180,7 +2181,7 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev)
/*
* Use root complex device ID to differentiate RV AXGBE vs SNOWY AXGBE */
- if (pci_search_device(AMD_PCI_RV_ROOT_COMPLEX_ID)) {
+ if ((get_pci_rc_devid()) == AMD_PCI_RV_ROOT_COMPLEX_ID) {
pdata->xpcs_window_def_reg = PCS_V2_RV_WINDOW_DEF; pdata->xpcs_window_sel_reg = PCS_V2_RV_WINDOW_SELECT;
} else {
--
2.25.1
[Public]
Hi,
Gentle reminder.
This is patch is required to submit changes for new AMD products. Please review and let us know if any modification are required.
Regards,
Chandu
-----Original Message-----
From: Namburu, Chandu-babu
Sent: Wednesday, December 22, 2021 2:58 PM
To: [email protected]; [email protected]; [email protected]
Cc: Sebastian, Selwin <[email protected]>; [email protected]; [email protected]
Subject: RE: [PATCH v2] net/axgbe: use PCI root complex device to distinguish AMD hardware
[Public]
Hi David Marchand,
I have submitted v2 patch with your suggestion in git log. Please review changes.
Regards,
Chandu
-----Original Message-----
From: Namburu, Chandu-babu <[email protected]>
Sent: Thursday, December 2, 2021 9:41 PM
To: [email protected]; [email protected]
Cc: Sebastian, Selwin <[email protected]>; [email protected]; [email protected]; Namburu, Chandu-babu <[email protected]>; [email protected]
Subject: [PATCH v2] net/axgbe: use PCI root complex device to distinguish AMD hardware
"bus/pci: optimize bus scan" broke axgbe on V1000/R1000.
RV root complex pci device does not have any kernel driver assigned so it is removed from pci scan list which is used in "net/axgbe: add a HW quirk for register definitions".
Get root complex device id directly from pci sysfs instead of pci scan list.
--- drivers/net/axgbe/axgbe_ethdev.c | 39 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 19 deletions(-)
drivers/net/axgbe/axgbe_ethdev.c +2 -0
@@ -10,6 +10,8 @@#include "axgbe_regs.h" #include "rte_time.h" +#include "eal_filesystem.h" + static int eth_axgbe_dev_init(struct rte_eth_dev *eth_dev); static int axgbe_dev_configure(struct rte_eth_dev *dev); static int axgbe_dev_start(struct rte_eth_dev *dev); @@ -2117,28 +2119,27 @@ static void axgbe_default_config(struct axgbe_port *pdata) pdata->power_down = 0; }
-static int
-pci_device_cmp(const struct rte_device *dev, const void *_pci_id) +/*
+ * Return PCI root complex device id on success else 0 */ static +uint16_t
+get_pci_rc_devid(void)
{
- const struct rte_pci_device *pdev = RTE_DEV_TO_PCI_CONST(dev);
- const struct rte_pci_id *pcid = _pci_id;
+ char pci_sysfs[PATH_MAX];
+ const struct rte_pci_addr pci_rc_addr = {0, 0, 0, 0};
+ unsigned long device_id;
- if (pdev->id.vendor_id == AMD_PCI_VENDOR_ID &&
- pdev->id.device_id == pcid->device_id)
- return 0;
- return 1;
-}
+ snprintf(pci_sysfs, sizeof(pci_sysfs), "%s/" PCI_PRI_FMT "/device",
+ rte_pci_get_sysfs_path(), pci_rc_addr.domain,
+ pci_rc_addr.bus, pci_rc_addr.devid, pci_rc_addr.function);
-static bool
-pci_search_device(int device_id)
-{
- struct rte_bus *pci_bus;
- struct rte_pci_id dev_id;
+ /* get device id */
+ if (eal_parse_sysfs_value(pci_sysfs, &device_id) < 0) {
+ PMD_INIT_LOG(ERR, "Error in reading PCI sysfs\n");
+ return 0;
+ }
- dev_id.device_id = device_id;
- pci_bus = rte_bus_find_by_name("pci");
- return (pci_bus != NULL) &&
- (pci_bus->find_device(NULL, pci_device_cmp, &dev_id) != NULL);
+ return (uint16_t)device_id;
}
/*
@@ -2180,7 +2181,7 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev)
/*
* Use root complex device ID to differentiate RV AXGBE vs SNOWY AXGBE */
- if (pci_search_device(AMD_PCI_RV_ROOT_COMPLEX_ID)) {
+ if ((get_pci_rc_devid()) == AMD_PCI_RV_ROOT_COMPLEX_ID) {
pdata->xpcs_window_def_reg = PCS_V2_RV_WINDOW_DEF; pdata->xpcs_window_sel_reg = PCS_V2_RV_WINDOW_SELECT;
} else {
--
2.25.1
Acked by: Selwin Sebastian <[email protected]>
-----Original Message-----
From: Namburu, Chandu-babu <[email protected]>
Sent: Monday, January 10, 2022 12:08 PM
To: [email protected]; [email protected]; [email protected]
Cc: Sebastian, Selwin <[email protected]>; [email protected]; [email protected]
Subject: RE: [PATCH v2] net/axgbe: use PCI root complex device to distinguish AMD hardware
[Public]
Hi,
Gentle reminder.
This is patch is required to submit changes for new AMD products. Please review and let us know if any modification are required.
Regards,
Chandu
-----Original Message-----
From: Namburu, Chandu-babu
Sent: Wednesday, December 22, 2021 2:58 PM
To: [email protected]; [email protected]; [email protected]
Cc: Sebastian, Selwin <[email protected]>; [email protected]; [email protected]
Subject: RE: [PATCH v2] net/axgbe: use PCI root complex device to distinguish AMD hardware
[Public]
Hi David Marchand,
I have submitted v2 patch with your suggestion in git log. Please review changes.
Regards,
Chandu
-----Original Message-----
From: Namburu, Chandu-babu <[email protected]>
Sent: Thursday, December 2, 2021 9:41 PM
To: [email protected]; [email protected]
Cc: Sebastian, Selwin <[email protected]>; [email protected]; [email protected]; Namburu, Chandu-babu <[email protected]>; [email protected]
Subject: [PATCH v2] net/axgbe: use PCI root complex device to distinguish AMD hardware
"bus/pci: optimize bus scan" broke axgbe on V1000/R1000.
RV root complex pci device does not have any kernel driver assigned so it is removed from pci scan list which is used in "net/axgbe: add a HW quirk for register definitions".
Get root complex device id directly from pci sysfs instead of pci scan list.
--- drivers/net/axgbe/axgbe_ethdev.c | 39 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 19 deletions(-)
drivers/net/axgbe/axgbe_ethdev.c +2 -0
@@ -10,6 +10,8 @@#include "axgbe_regs.h" #include "rte_time.h" +#include "eal_filesystem.h" + static int eth_axgbe_dev_init(struct rte_eth_dev *eth_dev); static int axgbe_dev_configure(struct rte_eth_dev *dev); static int axgbe_dev_start(struct rte_eth_dev *dev); @@ -2117,28 +2119,27 @@ static void axgbe_default_config(struct axgbe_port *pdata) pdata->power_down = 0; }
-static int
-pci_device_cmp(const struct rte_device *dev, const void *_pci_id) +/*
+ * Return PCI root complex device id on success else 0 */ static +uint16_t
+get_pci_rc_devid(void)
{
- const struct rte_pci_device *pdev = RTE_DEV_TO_PCI_CONST(dev);
- const struct rte_pci_id *pcid = _pci_id;
+ char pci_sysfs[PATH_MAX];
+ const struct rte_pci_addr pci_rc_addr = {0, 0, 0, 0};
+ unsigned long device_id;
- if (pdev->id.vendor_id == AMD_PCI_VENDOR_ID &&
- pdev->id.device_id == pcid->device_id)
- return 0;
- return 1;
-}
+ snprintf(pci_sysfs, sizeof(pci_sysfs), "%s/" PCI_PRI_FMT "/device",
+ rte_pci_get_sysfs_path(), pci_rc_addr.domain,
+ pci_rc_addr.bus, pci_rc_addr.devid, pci_rc_addr.function);
-static bool
-pci_search_device(int device_id)
-{
- struct rte_bus *pci_bus;
- struct rte_pci_id dev_id;
+ /* get device id */
+ if (eal_parse_sysfs_value(pci_sysfs, &device_id) < 0) {
+ PMD_INIT_LOG(ERR, "Error in reading PCI sysfs\n");
+ return 0;
+ }
- dev_id.device_id = device_id;
- pci_bus = rte_bus_find_by_name("pci");
- return (pci_bus != NULL) &&
- (pci_bus->find_device(NULL, pci_device_cmp, &dev_id) != NULL);
+ return (uint16_t)device_id;
}
/*
@@ -2180,7 +2181,7 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev)
/*
* Use root complex device ID to differentiate RV AXGBE vs SNOWY AXGBE */
- if (pci_search_device(AMD_PCI_RV_ROOT_COMPLEX_ID)) {
+ if ((get_pci_rc_devid()) == AMD_PCI_RV_ROOT_COMPLEX_ID) {
pdata->xpcs_window_def_reg = PCS_V2_RV_WINDOW_DEF; pdata->xpcs_window_sel_reg = PCS_V2_RV_WINDOW_SELECT;
} else {
--
2.25.1
Quoted 2 lines · Selwin
Acked by: Selwin Sebastian <[email protected]>
Hi Selwin,
Patchwork doesn't recognize the tag, I guess because it is looking for exact "Acked-by: " tag, with '-'.
Can you please pay attention next time, able to see the status in the patchwork help maintainers to trace patch's status.
Cheers,
ferruh
Quoted 121 lines
-----Original Message-----
From: Namburu, Chandu-babu <[email protected]>
Sent: Monday, January 10, 2022 12:08 PM
To: [email protected]; [email protected]; [email protected]
Cc: Sebastian, Selwin <[email protected]>; [email protected]; [email protected]
Subject: RE: [PATCH v2] net/axgbe: use PCI root complex device to distinguish AMD hardware[Public]
Hi,
Gentle reminder.
This is patch is required to submit changes for new AMD products. Please review and let us know if any modification are required.
Regards,
Chandu-----Original Message-----
From: Namburu, Chandu-babu
Sent: Wednesday, December 22, 2021 2:58 PM
To: [email protected]; [email protected]; [email protected]
Cc: Sebastian, Selwin <[email protected]>; [email protected]; [email protected]
Subject: RE: [PATCH v2] net/axgbe: use PCI root complex device to distinguish AMD hardware[Public]
Hi David Marchand,
I have submitted v2 patch with your suggestion in git log. Please review changes.
Regards,
Chandu-----Original Message-----
From: Namburu, Chandu-babu <[email protected]>
Sent: Thursday, December 2, 2021 9:41 PM
To: [email protected]; [email protected]
Cc: Sebastian, Selwin <[email protected]>; [email protected]; [email protected]; Namburu, Chandu-babu <[email protected]>; [email protected]
Subject: [PATCH v2] net/axgbe: use PCI root complex device to distinguish AMD hardware"bus/pci: optimize bus scan" broke axgbe on V1000/R1000.
RV root complex pci device does not have any kernel driver assigned so it is removed from pci scan list which is used in "net/axgbe: add a HW quirk for register definitions".Get root complex device id directly from pci sysfs instead of pci scan list.
Fixes 991e0b1dbc4a (net/axgbe: add a HW quirk for register definitions)Signed-off-by Chandubabu Namburu <[email protected]>--- drivers/net/axgbe/axgbe_ethdev.c | 39 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 19 deletions(-)drivers/net/axgbe/axgbe_ethdev.c +19
-20@@ -10,6 +10,8 @@#include "axgbe_regs.h" #include "rte_time.h" +#include "eal_filesystem.h" + static int eth_axgbe_dev_init(struct rte_eth_dev *eth_dev); static int axgbe_dev_configure(struct rte_eth_dev *dev); static int axgbe_dev_start(struct rte_eth_dev *dev); @@ -2117,28 +2119,27 @@ static void axgbe_default_config(struct axgbe_port *pdata) pdata->power_down = 0; } -static int -pci_device_cmp (const struct rte_device *dev,const void *_pci_id) +/* +* Return PCI root complex device id on success else 0 */ static +uint16_t +get_pci_rc_devid (void ) { -const struct rte_pci_device *pdev =RTE_DEV_TO_PCI_CONST (dev); -const struct rte_pci_id *pcid = _pci_id; +char pci_sysfs[PATH_MAX ]; +const struct rte_pci_addr pci_rc_addr = {0 ,0 ,0 ,0 }; +unsigned long device_id; -if (pdev->id.vendor_id ==AMD_PCI_VENDOR_ID && - pdev->id.device_id == pcid->device_id) -return 0 ; -return 1 ; -} +snprintf (pci_sysfs,sizeof (pci_sysfs),"%s/" PCI_PRI_FMT "/device" , +rte_pci_get_sysfs_path (), pci_rc_addr.domain, + pci_rc_addr.bus, pci_rc_addr.devid, pci_rc_addr.function); -static bool -pci_search_device (int device_id) -{ -struct rte_bus *pci_bus; -struct rte_pci_id dev_id; +/* get device id */ +if (eal_parse_sysfs_value (pci_sysfs, &device_id) <0 ) { +PMD_INIT_LOG (ERR ,"Error in reading PCI sysfs\n" ); +return 0 ; + } - dev_id.device_id = device_id; - pci_bus =rte_bus_find_by_name ("pci" ); -return (pci_bus !=NULL ) && - (pci_bus->find_device (NULL , pci_device_cmp, &dev_id) !=NULL ); +return (uint16_t )device_id; }/* @@ -2180,7 +2181,7 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev)/* * Use root complex device ID to differentiate RV AXGBE vs SNOWY AXGBE */ -if (pci_search_device (AMD_PCI_RV_ROOT_COMPLEX_ID )) { +if ((get_pci_rc_devid ()) ==AMD_PCI_RV_ROOT_COMPLEX_ID ) { pdata->xpcs_window_def_reg =PCS_V2_RV_WINDOW_DEF ; pdata->xpcs_window_sel_reg =PCS_V2_RV_WINDOW_SELECT ; }else { --2.25.1
[AMD Official Use Only]
Hi Ferruh,
I'm Sorry... corrected and sent it again.
Thanks
Selwin
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, January 17, 2022 3:52 PM
To: Sebastian, Selwin <[email protected]>; Namburu, Chandu-babu <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v2] net/axgbe: use PCI root complex device to distinguish AMD hardware
[CAUTION: External Email]
Quoted 2 lines · Selwin
Acked by: Selwin Sebastian <[email protected]>
Hi Selwin,
Patchwork doesn't recognize the tag, I guess because it is looking for exact "Acked-by: " tag, with '-'.
Can you please pay attention next time, able to see the status in the patchwork help maintainers to trace patch's status.
Cheers,
ferruh
Quoted 132 lines
-----Original Message-----
From: Namburu, Chandu-babu <[email protected]>
Sent: Monday, January 10, 2022 12:08 PM
To: [email protected]; [email protected]; [email protected]
Cc: Sebastian, Selwin <[email protected]>; [email protected]; [email protected]
Subject: RE: [PATCH v2] net/axgbe: use PCI root complex device to distinguish AMD hardware[Public]
Hi,
Gentle reminder.
This is patch is required to submit changes for new AMD products. Please review and let us know if any modification are required.
Regards,
Chandu-----Original Message-----
From: Namburu, Chandu-babu
Sent: Wednesday, December 22, 2021 2:58 PM
To: [email protected]; [email protected]; [email protected]
Cc: Sebastian, Selwin <[email protected]>; [email protected]; [email protected]
Subject: RE: [PATCH v2] net/axgbe: use PCI root complex device to distinguish AMD hardware[Public]
Hi David Marchand,
I have submitted v2 patch with your suggestion in git log. Please review changes.
Regards,
Chandu-----Original Message-----
From: Namburu, Chandu-babu <[email protected]>
Sent: Thursday, December 2, 2021 9:41 PM
To: [email protected]; [email protected]
Cc: Sebastian, Selwin <[email protected]>; [email protected]; [email protected]; Namburu, Chandu-babu <[email protected]>; [email protected]
Subject: [PATCH v2] net/axgbe: use PCI root complex device to distinguish AMD hardware"bus/pci: optimize bus scan" broke axgbe on V1000/R1000.
RV root complex pci device does not have any kernel driver assigned so it is removed from pci scan list which is used in "net/axgbe: add a HW quirk for register definitions".Get root complex device id directly from pci sysfs instead of pci scan list.
Fixes 991e0b1dbc4a (net/axgbe: add a HW quirk for registerdefinitions)
Cc: [email protected]Signed-off-by Chandubabu Namburu <[email protected]>--- drivers/net/axgbe/axgbe_ethdev.c | 39 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 19 deletions(-)drivers/net/axgbe/axgbe_ethdev.c +20
-20@@ -10,6 +10,8 @@#include "axgbe_regs.h" #include "rte_time.h" +#include "eal_filesystem.h" + static int eth_axgbe_dev_init(struct rte_eth_dev *eth_dev); static int axgbe_dev_configure(struct rte_eth_dev *dev); static int axgbe_dev_start(struct rte_eth_dev *dev); @@ -2117,28 +2119,27 @@ static void axgbe_default_config(struct axgbe_port *pdata) pdata->power_down = 0; } -static int -pci_device_cmp (const struct rte_device *dev,const void *_pci_id) +/* +* Return PCI root complex device id on success else 0 */ static +uint16_t +get_pci_rc_devid (void ) { -const struct rte_pci_device *pdev =RTE_DEV_TO_PCI_CONST (dev); -const struct rte_pci_id *pcid = _pci_id; +char pci_sysfs[PATH_MAX ]; +const struct rte_pci_addr pci_rc_addr = {0 ,0 ,0 ,0 }; +unsigned long device_id; -if (pdev->id.vendor_id ==AMD_PCI_VENDOR_ID && - pdev->id.device_id == pcid->device_id) -return 0 ; -return 1 ; -} +snprintf (pci_sysfs,sizeof (pci_sysfs),"%s/" PCI_PRI_FMT "/device" , +rte_pci_get_sysfs_path (), pci_rc_addr.domain, + pci_rc_addr.bus, pci_rc_addr.devid, + pci_rc_addr.function); -static bool -pci_search_device (int device_id) -{ -struct rte_bus *pci_bus; -struct rte_pci_id dev_id; +/* get device id */ +if (eal_parse_sysfs_value (pci_sysfs, &device_id) <0 ) { +PMD_INIT_LOG (ERR ,"Error in reading PCI sysfs\n" ); +return 0 ; + } - dev_id.device_id = device_id; - pci_bus =rte_bus_find_by_name ("pci" ); -return (pci_bus !=NULL ) && - (pci_bus->find_device (NULL , pci_device_cmp, &dev_id) !=NULL ); +return (uint16_t )device_id; }/* @@ -2180,7 +2181,7 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev)/* * Use root complex device ID to differentiate RV AXGBE vs SNOWY AXGBE */ -if (pci_search_device (AMD_PCI_RV_ROOT_COMPLEX_ID )) { +if ((get_pci_rc_devid ()) ==AMD_PCI_RV_ROOT_COMPLEX_ID ) { pdata->xpcs_window_def_reg =PCS_V2_RV_WINDOW_DEF ; pdata->xpcs_window_sel_reg =PCS_V2_RV_WINDOW_SELECT ; }else { --2.25.1
Sebastian, Selwin
Acked-by-----Original Message-----
From: Namburu, Chandu-babu <[email protected]>
Sent: Monday, January 10, 2022 12:08 PM
To: [email protected]; [email protected]; [email protected]
Cc: Sebastian, Selwin <[email protected]>; [email protected]; [email protected]
Subject: RE: [PATCH v2] net/axgbe: use PCI root complex device to distinguish AMD hardware
[Public]
Hi,
Gentle reminder.
This is patch is required to submit changes for new AMD products. Please review and let us know if any modification are required.
Regards,
Chandu
-----Original Message-----
From: Namburu, Chandu-babu
Sent: Wednesday, December 22, 2021 2:58 PM
To: [email protected]; [email protected]; [email protected]
Cc: Sebastian, Selwin <[email protected]>; [email protected]; [email protected]
Subject: RE: [PATCH v2] net/axgbe: use PCI root complex device to distinguish AMD hardware
[Public]
Hi David Marchand,
I have submitted v2 patch with your suggestion in git log. Please review changes.
Regards,
Chandu
-----Original Message-----
From: Namburu, Chandu-babu <[email protected]>
Sent: Thursday, December 2, 2021 9:41 PM
To: [email protected]; [email protected]
Cc: Sebastian, Selwin <[email protected]>; [email protected]; [email protected]; Namburu, Chandu-babu <[email protected]>; [email protected]
Subject: [PATCH v2] net/axgbe: use PCI root complex device to distinguish AMD hardware
"bus/pci: optimize bus scan" broke axgbe on V1000/R1000.
RV root complex pci device does not have any kernel driver assigned so it is removed from pci scan list which is used in "net/axgbe: add a HW quirk for register definitions".
Get root complex device id directly from pci sysfs instead of pci scan list.
--- drivers/net/axgbe/axgbe_ethdev.c | 39 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 19 deletions(-)
drivers/net/axgbe/axgbe_ethdev.c +2 -0
@@ -10,6 +10,8 @@#include "axgbe_regs.h" #include "rte_time.h" +#include "eal_filesystem.h" + static int eth_axgbe_dev_init(struct rte_eth_dev *eth_dev); static int axgbe_dev_configure(struct rte_eth_dev *dev); static int axgbe_dev_start(struct rte_eth_dev *dev); @@ -2117,28 +2119,27 @@ static void axgbe_default_config(struct axgbe_port *pdata) pdata->power_down = 0; }
-static int
-pci_device_cmp(const struct rte_device *dev, const void *_pci_id) +/*
+ * Return PCI root complex device id on success else 0 */ static +uint16_t
+get_pci_rc_devid(void)
{
- const struct rte_pci_device *pdev = RTE_DEV_TO_PCI_CONST(dev);
- const struct rte_pci_id *pcid = _pci_id;
+ char pci_sysfs[PATH_MAX];
+ const struct rte_pci_addr pci_rc_addr = {0, 0, 0, 0};
+ unsigned long device_id;
- if (pdev->id.vendor_id == AMD_PCI_VENDOR_ID &&
- pdev->id.device_id == pcid->device_id)
- return 0;
- return 1;
-}
+ snprintf(pci_sysfs, sizeof(pci_sysfs), "%s/" PCI_PRI_FMT "/device",
+ rte_pci_get_sysfs_path(), pci_rc_addr.domain,
+ pci_rc_addr.bus, pci_rc_addr.devid, pci_rc_addr.function);
-static bool
-pci_search_device(int device_id)
-{
- struct rte_bus *pci_bus;
- struct rte_pci_id dev_id;
+ /* get device id */
+ if (eal_parse_sysfs_value(pci_sysfs, &device_id) < 0) {
+ PMD_INIT_LOG(ERR, "Error in reading PCI sysfs\n");
+ return 0;
+ }
- dev_id.device_id = device_id;
- pci_bus = rte_bus_find_by_name("pci");
- return (pci_bus != NULL) &&
- (pci_bus->find_device(NULL, pci_device_cmp, &dev_id) != NULL);
+ return (uint16_t)device_id;
}
/*
@@ -2180,7 +2181,7 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev)
/*
* Use root complex device ID to differentiate RV AXGBE vs SNOWY AXGBE */
- if (pci_search_device(AMD_PCI_RV_ROOT_COMPLEX_ID)) {
+ if ((get_pci_rc_devid()) == AMD_PCI_RV_ROOT_COMPLEX_ID) {
pdata->xpcs_window_def_reg = PCS_V2_RV_WINDOW_DEF; pdata->xpcs_window_sel_reg = PCS_V2_RV_WINDOW_SELECT;
} else {
--
2.25.1
Ferruh Yigit
AppliedOn 1/17/2022 10:29 AM, Sebastian, Selwin wrote:
<...>
Quoted 11 lines
-----Original Message-----
From: Namburu, Chandu-babu <[email protected]>
Sent: Thursday, December 2, 2021 9:41 PM
To: [email protected]; [email protected]
Cc: Sebastian, Selwin <[email protected]>; [email protected]; [email protected]; Namburu, Chandu-babu <[email protected]>; [email protected]
Subject: [PATCH v2] net/axgbe: use PCI root complex device to distinguish AMD hardware"bus/pci: optimize bus scan" broke axgbe on V1000/R1000.
RV root complex pci device does not have any kernel driver assigned so it is removed from pci scan list which is used in "net/axgbe: add a HW quirk for register definitions".
Quoted 9 lines
Get root complex device id directly from pci sysfs instead of pci scan list.
Fixes 991e0b1dbc4a (net/axgbe: add a HW quirk for register definitions)Signed-off-by Chandubabu Namburu <[email protected]>Acked-by Selwin Sebastian <[email protected]>
Applied to dpdk-next-net/main, thanks.