[dpdk-dev] [PATCH 2/3] eal: fix remove incorrect event_cb

wangyunjian wangyunjian at huawei.com
Wed Jun 3 14:55:04 CEST 2020


From: Yunjian Wang <wangyunjian at huawei.com>

When the device_name is NULL, it will remove the event_cb directly.
We need to compare the 'cb_fn' and 'cb_arg' at the same time.

Fixes: a753e53d517b ("eal: add device event monitor framework")
Cc: stable at dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
---
 lib/librte_eal/common/eal_common_dev.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 4cfdb80..6b465bc 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -516,7 +516,12 @@ static int cmp_dev_name(const struct rte_device *dev, const void *_name)
 				    event_cb->cb_arg != cb_arg))
 					continue;
 			}
-		} else if (device_name != NULL) {
+		} else if (device_name == NULL && event_cb->dev_name == NULL) {
+			if (event_cb->cb_fn != cb_fn ||
+			    (cb_arg != (void *)-1 &&
+			    event_cb->cb_arg != cb_arg))
+				continue;
+		} else {
 			continue;
 		}
 
-- 
1.8.3.1




More information about the dev mailing list