/driver/bus/ifpga: fix driver probe failure handler
In the original code, when a device probe a driver, if the driver in the driver list does not support this device, a error is returned.
After this patch, a device wil try to match driver in the driver list one by one until an appropriate driver is found. If the current driver does not support the device or some error happens, just try the next driver in the list.
If all the drivers in the list are tried and no driver matches. 0 is returned.
--- drivers/bus/ifpga/ifpga_bus.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/bus/ifpga/ifpga_bus.c +12 -5
@@ -306,12 +306,19 @@ void rte_ifpga_driver_unregister(struct rte_afu_driver *driver) } TAILQ_FOREACH(drv, &ifpga_afu_drv_list, next) { -if (ifpga_probe_one_driver (drv, afu_dev)) { - ret =-1 ; -break ; - } + ret =ifpga_probe_one_driver (drv, afu_dev); +if (ret <0 ) +/* negative value is an error */ +return ret; +if (ret >0 ) +/* positive value means driver doesn't support it */ +continue ; +return 0 ; } -return ret; +if ((ret >0 ) && (afu_dev->driver ==NULL )) +return 0 ; +else +return ret; }/*
Signature · 1 line
1.8.3.1
Xu, Rosen
Acked-byQuoted 56 lines
-----Original Message-----
From: Pei, Andy
Sent: Monday, January 14, 2019 9:41
To: [email protected]
Cc: Xu, Rosen <[email protected]>; Zhang, Tianfei <[email protected]>; Pei, Andy <[email protected]>
Subject: [DPDK] /driver/bus/ifpga: fix driver probe failure handlerIn the original code, when a device probe a driver, if the driver in the driver list does not support this device, a error is returned.
After this patch, a device wil try to match driver in the driver list one by one until an appropriate driver is found. If the current driver does not support the device or some error happens, just try the next driver in the list. If all the drivers in the list are tried and no driver matches. 0 is returned.Signed-off-by AndyPei <[email protected]>--- drivers/bus/ifpga/ifpga_bus.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)drivers/bus/ifpga/ifpga_bus.c +12
-5@@ -306,12 +306,19 @@ void rte_ifpga_driver_unregister(struct rte_afu_driver *driver) } TAILQ_FOREACH(drv, &ifpga_afu_drv_list, next) { -if (ifpga_probe_one_driver (drv, afu_dev)) { - ret =-1 ; -break ; - } + ret =ifpga_probe_one_driver (drv, afu_dev); +if (ret <0 ) +/* negative value is an error */ +return ret; +if (ret >0 ) +/* positive value means driver doesn't support it */ +continue ; +return 0 ; } -return ret; +if ((ret >0 ) && (afu_dev->driver ==NULL )) +return 0 ; +else +return ret; }
Quoted 3 lines
/*
--
1.8.3.1
Hi Andy,
Quoted 8 lines
-----Original Message-----
From: Pei, Andy
Sent: Monday, January 14, 2019 9:41
To: [email protected]
Cc: Xu, Rosen <[email protected]>; Zhang, Tianfei <[email protected]>; Pei, Andy <[email protected]>
Subject: [DPDK] /driver/bus/ifpga: fix driver probe failure handler
The subject should be started with bus/ifpga.
I think the tital should be fix ifpga afu driver probe failure handler
Quoted 1 line
In the original code, when a device probe a driver, if the driver in the driver
In the original code, when a AFU device is scanned, if its driver in the driver
Quoted 1 line
list does not support this device, a error is returned.
an error will return
Quoted 1 line
After this patch, a device wil try to match driver in the driver list one by one
With this patch, a device will......
Quoted 5 lines
until an appropriate driver is found. If the current driver does not support the device or some error happens, just try the next driver in the list. If all the drivers in the list are tried and no driver matches. 0 is returned.
Fixes 05fa3d4a6539
Pls use git fixline 05fa3d4a6539 to generate the full fixline
Quoted 3 lines
Don't need these cc, pls only Cc: [email protected]
Quoted 37 lines
Signed-off-by AndyPei <[email protected]>--- drivers/bus/ifpga/ifpga_bus.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)drivers/bus/ifpga/ifpga_bus.c +12
-5@@ -306,12 +306,19 @@ void rte_ifpga_driver_unregister(struct rte_afu_driver *driver) } TAILQ_FOREACH(drv, &ifpga_afu_drv_list, next) { -if (ifpga_probe_one_driver (drv, afu_dev)) { - ret =-1 ; -break ; - } + ret =ifpga_probe_one_driver (drv, afu_dev); +if (ret <0 ) +/* negative value is an error */ +return ret; +if (ret >0 ) +/* positive value means driver doesn't support it */ +continue ; +return 0 ; } -return ret; +if ((ret >0 ) && (afu_dev->driver ==NULL )) +return 0 ; +else +return ret; }/*
--
1.8.3.1
[DPDK] bus/ifpga: fix ifpga afu driver probe failure handler
In reply to AndyPeiFrom: AndyPei <[email protected]>
In the original code, when an AFU device probe a driver, if the first driver in the driver list does not support this device or some error happens, an error is returned. With this patch, a device wil try to match driver in the driver list one by one until an appropriate driver is found. If some error happens, the error is returned. If the current driver does not support the device, just try the next driver in the list. If all the drivers in the list are tried and no driver matches, 0 is returned. Otherwise, the error code is returned.
--- drivers/bus/ifpga/ifpga_bus.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/bus/ifpga/ifpga_bus.c +12 -5
@@ -306,12 +306,19 @@ void rte_ifpga_driver_unregister(struct rte_afu_driver *driver) } TAILQ_FOREACH(drv, &ifpga_afu_drv_list, next) { -if (ifpga_probe_one_driver (drv, afu_dev)) { - ret =-1 ; -break ; - } + ret =ifpga_probe_one_driver (drv, afu_dev); +if (ret <0 ) +/* negative value is an error */ +return ret; +if (ret >0 ) +/* positive value means driver doesn't support it */ +continue ; +return 0 ; } -return ret; +if ((ret >0 ) && (afu_dev->driver ==NULL )) +return 0 ; +else +return ret; }/*
Signature · 1 line
1.8.3.1
PATCH v2 1/1 bus/ifpga: fix ifpga afu driver probe failure handler
From: Andy Pei <[email protected]>
In the original code, when an AFU device probe a driver, if the first driver in the driver list does not support this device or some error happens, bus probe returns an error.
With this patch, a device will try to match driver in the driver list one by one until an appropriate driver is found.
If some error happens, the error is returned. If the current driver does not support the device, just try the next driver in the list.
If all the drivers in the list are tried and no driver matches, 0 is returned. Otherwise, the error code is returned.
--- drivers/bus/ifpga/ifpga_bus.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/bus/ifpga/ifpga_bus.c +12 -5
@@ -306,12 +306,19 @@ ifpga_probe_all_drivers(struct rte_afu_device *afu_dev) } TAILQ_FOREACH(drv, &ifpga_afu_drv_list, next) { -if (ifpga_probe_one_driver (drv, afu_dev)) { - ret =-1 ; -break ; - } + ret =ifpga_probe_one_driver (drv, afu_dev); +if (ret <0 ) +/* negative value is an error */ +return ret; +if (ret >0 ) +/* positive value means driver doesn't support it */ +continue ; +return 0 ; } -return ret; +if ((ret >0 ) && (afu_dev->driver ==NULL )) +return 0 ; +else +return ret; }/*
Signature · 1 line
2.17.2
Thomas Monjalon
AppliedRe: [dpdk-stable] [PATCH v2] bus/ifpga: fix ifpga afu driver probe failure handler
18/01/2019 12:12, Ferruh Yigit:
Quoted 15 lines
From: Andy Pei <[email protected]>
In the original code, when an AFU device probe a driver, if the first driver in the driver list does not support this device or some error happens, bus probe returns an error.
With this patch, a device will try to match driver in the driver list one by one until an appropriate driver is found.
If some error happens, the error is returned. If the current driver does not support the device, just try the next driver in the list.
If all the drivers in the list are tried and no driver matches, 0 is returned. Otherwise, the error code is returned.
Quoted 6 lines
Fixes 05fa3d4a6539 ("bus/ifpga: add Intel FPGA bus library")Signed-off-by Andy Pei <[email protected]>Reviewed-by Ferruh Yigit <[email protected]>Acked-by Rosen Xu <[email protected]>
Applied, thanks