event/sw: fix missing device pointer
PATCH 1/1 event/sw: fix missing device pointer
After calling rte_event_dev_info_get() the ".dev" field of the info structure should have a pointer to the underlying device, allowing the user to e.g. get the device name using using rte_dev_name(info.dev).
The SW eventdev info structure did not return a correct device pointer, though, instead returning NULL, which caused crashes getting "rte_dev_name". Initializing the dev pointer inside the "eventdev" struct in the device probe function fixes this by ensuring we have a valid pointer to return in info_get calls.
--- drivers/event/sw/sw_evdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/event/sw/sw_evdev.c +1 -0
@@ -1080,6 +1080,7 @@ sw_probe(struct rte_vdev_device *vdev)SW_LOG_ERR ("eventdev vdev init() failed" );return -EFAULT ; } + dev->dev = &vdev->device; dev->dev_ops = &evdev_sw_ops; dev->enqueue = sw_event_enqueue; dev->enqueue_burst = sw_event_enqueue_burst;
Signature · 1 line
2.39.2
Quoted 19 lines
-----Original Message-----
From: Richardson, Bruce <[email protected]>
Sent: Monday, October 16, 2023 4:17 PM
To: [email protected]
Cc: Richardson, Bruce <[email protected]>; [email protected]; Van Haaren, Harry <[email protected]>; Jerin Jacob <[email protected]>
Subject: [PATCH] event/sw: fix missing device pointerAfter calling
rte_event_dev_info_get()the ".dev" field of the info structure should have a pointer to the underlying device, allowing the user to e.g. get the device name using usingrte_dev_name(info.dev).The SW eventdev info structure did not return a correct device pointer, though, instead returning NULL, which caused crashes getting "
rte_dev_name". Initializing the dev pointer inside the "eventdev" struct in the device probe function fixes this by ensuring we have a valid pointer to return ininfo_getcalls.
Quoted 4 lines
Fixes aaa4a221da26 ("event/sw: add new software-only eventdev driver")Signed-off-by Bruce Richardson <[email protected]>
PATCH v2 1/2 event/sw: fix missing device pointer
In reply to Bruce RichardsonAfter calling rte_event_dev_info_get() the ".dev" field of the info structure should have a pointer to the underlying device, allowing the user to e.g. get the device name using rte_dev_name(info.dev).
The SW eventdev info structure did not return a correct device pointer, though, instead returning NULL, which caused crashes getting "rte_dev_name". Initializing the dev pointer inside the "eventdev" struct in the device probe function fixes this by ensuring we have a valid pointer to return in info_get calls.
--- drivers/event/sw/sw_evdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/event/sw/sw_evdev.c +1 -0
@@ -1080,6 +1080,7 @@ sw_probe(struct rte_vdev_device *vdev)SW_LOG_ERR ("eventdev vdev init() failed" );return -EFAULT ; } + dev->dev = &vdev->device; dev->dev_ops = &evdev_sw_ops; dev->enqueue = sw_event_enqueue; dev->enqueue_burst = sw_event_enqueue_burst;
Signature · 1 line
2.39.2
PATCH v2 2/2 event/dsw: fix missing device pointer
After calling rte_event_dev_info_get() the ".dev" field of the info structure should have a pointer to the underlying device, allowing the user to e.g. get the device name using rte_dev_name(info.dev).
The distributed software eventdev info structure did not return a correct device pointer, though, instead returning NULL, which caused crashes getting "rte_dev_name". Initializing the dev pointer inside the "eventdev" struct in the device probe function fixes this by ensuring we have a valid pointer to return in info_get calls.
--- drivers/event/dsw/dsw_evdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/event/dsw/dsw_evdev.c +1 -0
@@ -440,6 +440,7 @@ dsw_probe(struct rte_vdev_device *vdev)return -EFAULT ; dev->dev_ops = &dsw_evdev_ops; + dev->dev = &vdev->device; dev->enqueue = dsw_event_enqueue; dev->enqueue_burst = dsw_event_enqueue_burst; dev->enqueue_new_burst = dsw_event_enqueue_new_burst;
Signature · 1 line
2.39.2
v3 cover Fix device info for SW eventdevs
In reply to Bruce RichardsonThe SW-based eventdevs were missing some basic info in the returned structure from info_get, which could cause crashes if any of the null pointers were dereferenced. These 4 small patches fix these issues.
Bruce Richardson (4):
event/sw: fix missing device pointer
event/dsw: fix missing device pointer
event/skeleton: fix missing device pointer
event/skeleton: set driver name string
drivers/event/dsw/dsw_evdev.c | 1 + drivers/event/skeleton/skeleton_eventdev.c | 7 +++++-- drivers/event/sw/sw_evdev.c | 1 + 3 files changed, 7 insertions(+), 2 deletions(-)
--
2.39.2
PATCH v3 1/4 event/sw: fix missing device pointer
Initialize the "dev" pointer in the eventdev structure so it can be returned in calls to "rte_event_dev_info_get()" and avoid potential crashes due to a NULL value being passed to "rte_dev_name()"
--- drivers/event/sw/sw_evdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/event/sw/sw_evdev.c +1 -0
@@ -1080,6 +1080,7 @@ sw_probe(struct rte_vdev_device *vdev)SW_LOG_ERR ("eventdev vdev init() failed" );return -EFAULT ; } + dev->dev = &vdev->device; dev->dev_ops = &evdev_sw_ops; dev->enqueue = sw_event_enqueue; dev->enqueue_burst = sw_event_enqueue_burst;
Signature · 1 line
2.39.2
PATCH v3 2/4 event/dsw: fix missing device pointer
In reply to Bruce RichardsonInitialize the "dev" pointer in the eventdev structure so it can be returned in calls to "rte_event_dev_info_get()" and avoid potential crashes due to a NULL value being passed to "rte_dev_name()"
--- drivers/event/dsw/dsw_evdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/event/dsw/dsw_evdev.c +1 -0
@@ -440,6 +440,7 @@ dsw_probe(struct rte_vdev_device *vdev)return -EFAULT ; dev->dev_ops = &dsw_evdev_ops; + dev->dev = &vdev->device; dev->enqueue = dsw_event_enqueue; dev->enqueue_burst = dsw_event_enqueue_burst; dev->enqueue_new_burst = dsw_event_enqueue_new_burst;
Signature · 1 line
2.39.2
Re: [PATCH v3 2/4] event/dsw: fix missing device pointer
Quoted 18 lines · Bruce Richardson
Initialize the "dev" pointer in the eventdev structure so it can be returned in calls to "
rte_event_dev_info_get()" and avoid potential crashes due to a NULL value being passed to "rte_dev_name()"Fixes 46a186b1f0c5 ("event/dsw: add device registration and build system")Signed-off-by Bruce Richardson <[email protected]>--- drivers/event/dsw/dsw_evdev.c | 1 + 1 file changed, 1 insertion(+)drivers/event/dsw/dsw_evdev.c +0
-0
drivers/event/dsw/dsw_evdev.c dsw_probe(struct rte_vdev_device *vdev) · line 446
Quoted 7 lines
drivers/event/dsw/dsw_evdev.c +1
-0@@ -440,6 +440,7 @@ dsw_probe(struct rte_vdev_device *vdev)return -EFAULT ; dev->dev_ops = &dsw_evdev_ops; + dev->dev = &vdev->device; dev->enqueue = dsw_event_enqueue; dev->enqueue_burst = dsw_event_enqueue_burst; dev->enqueue_new_burst = dsw_event_enqueue_new_burst;
PATCH v3 3/4 event/skeleton: fix missing device pointer
In reply to Bruce RichardsonInitialize the "dev" pointer in the eventdev structure so it can be returned in calls to "rte_event_dev_info_get()" and avoid potential crashes due to a NULL value being passed to "rte_dev_name()"
--- drivers/event/skeleton/skeleton_eventdev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/event/skeleton/skeleton_eventdev.c +3 -2
@@ -428,7 +428,7 @@ RTE_PMD_REGISTER_PCI_TABLE(event_skeleton_pci, pci_id_skeleton_map);/* VDEV based event device */ static int -skeleton_eventdev_create (const char *name,int socket_id) +skeleton_eventdev_create (const char *name,int socket_id,struct rte_vdev_device *vdev) {struct rte_eventdev *eventdev;
@@ -440,6 +440,7 @@ skeleton_eventdev_create(const char *name, int socket_id) } eventdev->dev_ops = &skeleton_eventdev_ops; + eventdev->dev = &vdev->device; eventdev->enqueue = skeleton_eventdev_enqueue; eventdev->enqueue_burst = skeleton_eventdev_enqueue_burst; eventdev->dequeue = skeleton_eventdev_dequeue;
@@ -459,7 +460,7 @@ skeleton_eventdev_probe(struct rte_vdev_device *vdev) name =rte_vdev_device_name (vdev);RTE_LOG (INFO ,PMD ,"Initializing %s on NUMA node %d\n" , name,rte_socket_id ()); -return skeleton_eventdev_create (name,rte_socket_id ()); +return skeleton_eventdev_create (name,rte_socket_id (), vdev); } static int
Signature · 1 line
2.39.2
PATCH v3 4/4 event/skeleton: set driver name string
In reply to Bruce RichardsonWhen calling rte_eventdev_info_get() the driver name string field should be populated.
--- drivers/event/skeleton/skeleton_eventdev.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/event/skeleton/skeleton_eventdev.c +2 -0
@@ -24,6 +24,7 @@#define EVENTDEV_NAME_SKELETON_PMD event_skeleton/**< Skeleton event device PMD name */ +#define EVENTDEV_NAME_STRING RTE_STR(EVENTDEV_NAME_SKELETON_PMD)static uint16_t skeleton_eventdev_enqueue (void *port,const struct rte_event *ev)
@@ -88,6 +89,7 @@ skeleton_eventdev_info_get(struct rte_eventdev *dev,RTE_SET_USED (skel); + dev_info->driver_name =EVENTDEV_NAME_STRING ; dev_info->min_dequeue_timeout_ns =1 ; dev_info->max_dequeue_timeout_ns =10000 ; dev_info->dequeue_timeout_ns =25 ;
Signature · 1 line
2.39.2
PATCH v4 1/2 event/*: set device pointer for vdev-based eventdevs
In reply to Bruce RichardsonThe eventdevs based on vdevs, rather than on e.g. HW PCI devices, were, as a rule, not setting the ".dev" pointer in the eventdev structure. This caused issues as a NULL pointer was returned in calls to info_get, triggering crashes if the pointer is passed unchecked to e.g. rte_dev_name() to print out the name of an event device.
Most effective, and future-proofed fix, is to not rely on the eventdev drivers to set the pointer themselves, but to change the vdev init function to take the vdev struct as parameter, and set the "dev" pointer centrally on init. This allows us to fix all drivers in one go, enforced by compiler error if the parameter is missing.
--- drivers/event/dpaa/dpaa_eventdev.c | 6 +++--- drivers/event/dpaa2/dpaa2_eventdev.c | 6 +++--- drivers/event/dsw/dsw_evdev.c | 2 +- drivers/event/octeontx/ssovf_evdev.c | 2 +- drivers/event/opdl/opdl_evdev.c | 2 +- drivers/event/skeleton/skeleton_eventdev.c | 6 +++--- drivers/event/sw/sw_evdev.c | 2 +- lib/eventdev/eventdev_pmd_vdev.h | 3 ++- 8 files changed, 15 insertions(+), 14 deletions(-)
drivers/event/dpaa/dpaa_eventdev.c +3 -3
@@ -994,14 +994,14 @@ dpaa_event_check_flags(const char *params) }static int -dpaa_event_dev_create (const char *name,const char *params) +dpaa_event_dev_create (const char *name,const char *params,struct rte_vdev_device *vdev) {struct rte_eventdev *eventdev;struct dpaa_eventdev *priv; eventdev =rte_event_pmd_vdev_init (name,sizeof (struct dpaa_eventdev ), -rte_socket_id ()); +rte_socket_id (), vdev);if (eventdev ==NULL ) {DPAA_EVENTDEV_ERR ("Failed to create eventdev vdev %s" , name); goto fail;
@@ -1051,7 +1051,7 @@ dpaa_event_dev_probe(struct rte_vdev_device *vdev) params =rte_vdev_device_args (vdev); -return dpaa_event_dev_create (name, params); +return dpaa_event_dev_create (name, params, vdev); } static int
drivers/event/dpaa2/dpaa2_eventdev.c +3 -3
@@ -1086,7 +1086,7 @@ dpaa2_eventdev_setup_dpci(struct dpaa2_dpci_dev *dpci_dev, }static int -dpaa2_eventdev_create (const char *name) +dpaa2_eventdev_create (const char *name,struct rte_vdev_device *vdev) {struct rte_eventdev *eventdev;struct dpaa2_eventdev *priv;
@@ -1096,7 +1096,7 @@ dpaa2_eventdev_create(const char *name) eventdev =rte_event_pmd_vdev_init (name,sizeof (struct dpaa2_eventdev ), -rte_socket_id ()); +rte_socket_id (), vdev);if (eventdev ==NULL ) {DPAA2_EVENTDEV_ERR ("Failed to create Event device %s" , name); goto fail;
@@ -1190,7 +1190,7 @@ dpaa2_eventdev_probe(struct rte_vdev_device *vdev) name =rte_vdev_device_name (vdev);DPAA2_EVENTDEV_INFO ("Initializing %s" , name); -return dpaa2_eventdev_create (name); +return dpaa2_eventdev_create (name, vdev); } static int
drivers/event/dsw/dsw_evdev.c +1 -1
@@ -435,7 +435,7 @@ dsw_probe(struct rte_vdev_device *vdev) name =rte_vdev_device_name (vdev); dev =rte_event_pmd_vdev_init (name,sizeof (struct dsw_evdev ), -rte_socket_id ()); +rte_socket_id (), vdev);if (dev ==NULL )return -EFAULT ;
drivers/event/octeontx/ssovf_evdev.c +1 -1
@@ -880,7 +880,7 @@ ssovf_vdev_probe(struct rte_vdev_device *vdev) } eventdev =rte_event_pmd_vdev_init (name,sizeof (struct ssovf_evdev ), -rte_socket_id ()); +rte_socket_id (), vdev);if (eventdev ==NULL ) {ssovf_log_err ("Failed to create eventdev vdev %s" , name);return -ENOMEM ;
drivers/event/opdl/opdl_evdev.c +1 -1
@@ -697,7 +697,7 @@ opdl_probe(struct rte_vdev_device *vdev) } } dev =rte_event_pmd_vdev_init (name, -sizeof (struct opdl_evdev ), socket_id); +sizeof (struct opdl_evdev ), socket_id, vdev);if (dev ==NULL ) {PMD_DRV_LOG (ERR ,"eventdev vdev init() failed" );
drivers/event/skeleton/skeleton_eventdev.c +3 -3
@@ -428,12 +428,12 @@ RTE_PMD_REGISTER_PCI_TABLE(event_skeleton_pci, pci_id_skeleton_map);/* VDEV based event device */ static int -skeleton_eventdev_create (const char *name,int socket_id) +skeleton_eventdev_create (const char *name,int socket_id,struct rte_vdev_device *vdev) {struct rte_eventdev *eventdev; eventdev =rte_event_pmd_vdev_init (name, -sizeof (struct skeleton_eventdev ), socket_id); +sizeof (struct skeleton_eventdev ), socket_id, vdev);if (eventdev ==NULL ) {PMD_DRV_ERR ("Failed to create eventdev vdev %s" , name); goto fail;
@@ -459,7 +459,7 @@ skeleton_eventdev_probe(struct rte_vdev_device *vdev) name =rte_vdev_device_name (vdev);RTE_LOG (INFO ,PMD ,"Initializing %s on NUMA node %d\n" , name,rte_socket_id ()); -return skeleton_eventdev_create (name,rte_socket_id ()); +return skeleton_eventdev_create (name,rte_socket_id (), vdev); } static int
drivers/event/sw/sw_evdev.c +1 -1
@@ -1075,7 +1075,7 @@ sw_probe(struct rte_vdev_device *vdev) min_burst_size, deq_burst_size, refill_once); dev =rte_event_pmd_vdev_init (name, -sizeof (struct sw_evdev ), socket_id); +sizeof (struct sw_evdev ), socket_id, vdev);if (dev ==NULL ) {SW_LOG_ERR ("eventdev vdev init() failed" );return -EFAULT ;
lib/eventdev/eventdev_pmd_vdev.h +2 -1
@@ -45,7 +45,7 @@ extern "C" {__rte_internal static inline struct rte_eventdev *rte_event_pmd_vdev_init (const char *name,size_t dev_private_size, -int socket_id) +int socket_id,struct rte_vdev_device *vdev) {struct rte_eventdev *eventdev;
@@ -67,6 +67,7 @@ rte_event_pmd_vdev_init(const char *name, size_t dev_private_size,rte_panic ("Cannot allocate memzone for private device" " data" ); } + eventdev->dev = &vdev->device;return eventdev; }
Signature · 1 line
2.39.2
PATCH v4 2/2 event/skeleton: set driver name string
When calling rte_eventdev_info_get() the driver name string field should be populated.
--- drivers/event/skeleton/skeleton_eventdev.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/event/skeleton/skeleton_eventdev.c +2 -0
@@ -24,6 +24,7 @@#define EVENTDEV_NAME_SKELETON_PMD event_skeleton/**< Skeleton event device PMD name */ +#define EVENTDEV_NAME_STRING RTE_STR(EVENTDEV_NAME_SKELETON_PMD)static uint16_t skeleton_eventdev_enqueue (void *port,const struct rte_event *ev)
@@ -88,6 +89,7 @@ skeleton_eventdev_info_get(struct rte_eventdev *dev,RTE_SET_USED (skel); + dev_info->driver_name =EVENTDEV_NAME_STRING ; dev_info->min_dequeue_timeout_ns =1 ; dev_info->max_dequeue_timeout_ns =10000 ; dev_info->dequeue_timeout_ns =25 ;
Signature · 1 line
2.39.2
Re: [PATCH v4 2/2] event/skeleton: set driver name string
Quoted 8 lines · Bruce Richardson
When calling
rte_eventdev_info_get()the driver name string field should be populated.Fixes bbbb929da5e6 ("event/skeleton: add skeleton eventdev driver")Signed-off-by Bruce Richardson <[email protected]>
event/dpaa2 seems affected too.
Can rte_eventdev_info_get() fill this based on the driver attached to the device, like ethdev does?
Something like untested:
lib/eventdev/rte_eventdev.c +0 -0
@@ -104,6 +104,7 @@ rte_event_dev_info_get(uint8_t dev_id, struct
rte_event_dev_info *dev_info)
dev_info->dequeue_timeout_ns = dev->data->dev_conf.dequeue_timeout_ns;
dev_info->dev = dev->dev;+ dev_info->driver_name = dev->dev->driver->name;
rte_eventdev_trace_info_get(dev_id, dev_info, dev_info->dev);
Signature · 1 line
David Marchand
Re: [PATCH v4 2/2] event/skeleton: set driver name string
Quoted 6 lines · David Marchand
Quoted 4 lines · Bruce Richardson
When calling
rte_eventdev_info_get()the driver name string field should be populated.
Quoted 7 lines
Quoted 4 lines
Fixes bbbb929da5e6 ("event/skeleton: add skeleton eventdev driver")Signed-off-by Bruce Richardson <[email protected]>event/dpaa2 seems affected too.
Ok, hadn't noticed that. I tested all the SW drivers I could and didn't find any of them affected.
Quoted 11 lines
Can
rte_eventdev_info_get()fill this based on the driver attached to the device, like ethdev does?Something like untested:
lib/eventdev/rte_eventdev.c +0
-0
lib/eventdev/rte_eventdev.c rte_event_dev_info_get(uint8_t dev_id, struct · line 110
Quoted 7 lines
lib/eventdev/rte_eventdev.c +1
-0@@ -104,6 +104,7 @@ rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info) dev_info->dequeue_timeout_ns = dev->data->dev_conf.dequeue_timeout_ns; dev_info->dev = dev->dev; + dev_info->driver_name = dev->dev->driver->name;rte_eventdev_trace_info_get (dev_id, dev_info, dev_info->dev);
Ok, let me do up and test a patch.
/Bruce
Re: [PATCH v4 2/2] event/skeleton: set driver name string
Quoted 31 lines · Bruce Richardson
Quoted 6 lines · David Marchand
Quoted 4 lines · Bruce Richardson
When calling
rte_eventdev_info_get()the driver name string field should be populated.Quoted 7 lines
Quoted 4 lines
Fixes bbbb929da5e6 ("event/skeleton: add skeleton eventdev driver")Signed-off-by Bruce Richardson <[email protected]>event/dpaa2 seems affected too.
Ok, hadn't noticed that. I tested all the SW drivers I could and didn't find any of them affected.
Quoted 13 lines
Can
rte_eventdev_info_get()fill this based on the driver attached to the device, like ethdev does?Something like untested:
lib/eventdev/rte_eventdev.c +0
-0@@ -104,6 +104,7 @@ rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info) dev_info->dequeue_timeout_ns = dev->data->dev_conf.dequeue_timeout_ns;
Quoted 7 lines
lib/eventdev/rte_eventdev.c rte_event_dev_info_get(uint8_t dev_id, struct · line 110
Quoted 5 lines
lib/eventdev/rte_eventdev.c +1
-0dev_info->dev = dev->dev; + dev_info->driver_name = dev->dev->driver->name;rte_eventdev_trace_info_get (dev_id, dev_info, dev_info->dev);Ok, let me do up and test a patch.
V5 sent with this fix instead. I just added some additional conditionals around it, just in case we end up with some Null pointers in that chain (hopefully not after the previous patch, but better to check).
Testing with skeleton, sw, dsw and opdl drivers showed no issues with reporting the driver name.
/Bruce
Re: [PATCH v4 1/2] event/*: set device pointer for vdev-based eventdevs
In reply to Bruce RichardsonQuoted 22 lines · Bruce Richardson
The eventdevs based on vdevs, rather than on e.g. HW PCI devices, were, as a rule, not setting the ".dev" pointer in the eventdev structure. This caused issues as a NULL pointer was returned in calls to
info_get, triggering crashes if the pointer is passed unchecked to e.g.rte_dev_name()to print out the name of an event device.Most effective, and future-proofed fix, is to not rely on the eventdev drivers to set the pointer themselves, but to change the vdev init function to take the vdev struct as parameter, and set the "dev" pointer centrally on init. This allows us to fix all drivers in one go, enforced by compiler error if the parameter is missing.
Fixes aaa4a221da26 ("event/sw: add new software-only eventdev driver")Fixes 46a186b1f0c5 ("event/dsw: add device registration and build system")Fixes bbbb929da5e6 ("event/skeleton: add skeleton eventdev driver")Fixes 3c7f3dcfb099 ("event/opdl: add PMD main body and helper function")Fixes 9caac5dd1e7f ("event/dpaa: introduce PMD")Fixes 8a5d7a8ec74b ("event/dpaa2: initialize device")Fixes 34498de6000f ("event/octeontx: add octeontx eventdev driver")
Quoted 1 line
Signed-off-by Bruce Richardson <[email protected]>
Signature · 1 line
David Marchand
PATCH v5 1/2 eventdev: fix device pointer for vdev-based eventdevs
In reply to Bruce RichardsonThe eventdevs based on vdevs, rather than on e.g. HW PCI devices, were, as a rule, not setting the ".dev" pointer in the eventdev structure. This caused issues as a NULL pointer was returned in calls to info_get, triggering crashes if the pointer is passed unchecked to e.g. rte_dev_name() to print out the name of an event device.
Most effective, and future-proofed fix, is to not rely on the eventdev drivers to set the pointer themselves, but to change the vdev init function to take the vdev struct as parameter, and set the "dev" pointer centrally on init. This allows us to fix all drivers in one go, enforced by compiler error if the parameter is missing.
--- drivers/event/dpaa/dpaa_eventdev.c | 6 +++--- drivers/event/dpaa2/dpaa2_eventdev.c | 6 +++--- drivers/event/dsw/dsw_evdev.c | 2 +- drivers/event/octeontx/ssovf_evdev.c | 2 +- drivers/event/opdl/opdl_evdev.c | 2 +- drivers/event/skeleton/skeleton_eventdev.c | 6 +++--- drivers/event/sw/sw_evdev.c | 2 +- lib/eventdev/eventdev_pmd_vdev.h | 3 ++- 8 files changed, 15 insertions(+), 14 deletions(-)
drivers/event/dpaa/dpaa_eventdev.c +3 -3
@@ -994,14 +994,14 @@ dpaa_event_check_flags(const char *params) }static int -dpaa_event_dev_create (const char *name,const char *params) +dpaa_event_dev_create (const char *name,const char *params,struct rte_vdev_device *vdev) {struct rte_eventdev *eventdev;struct dpaa_eventdev *priv; eventdev =rte_event_pmd_vdev_init (name,sizeof (struct dpaa_eventdev ), -rte_socket_id ()); +rte_socket_id (), vdev);if (eventdev ==NULL ) {DPAA_EVENTDEV_ERR ("Failed to create eventdev vdev %s" , name); goto fail;
@@ -1051,7 +1051,7 @@ dpaa_event_dev_probe(struct rte_vdev_device *vdev) params =rte_vdev_device_args (vdev); -return dpaa_event_dev_create (name, params); +return dpaa_event_dev_create (name, params, vdev); } static int
drivers/event/dpaa2/dpaa2_eventdev.c +3 -3
@@ -1086,7 +1086,7 @@ dpaa2_eventdev_setup_dpci(struct dpaa2_dpci_dev *dpci_dev, }static int -dpaa2_eventdev_create (const char *name) +dpaa2_eventdev_create (const char *name,struct rte_vdev_device *vdev) {struct rte_eventdev *eventdev;struct dpaa2_eventdev *priv;
@@ -1096,7 +1096,7 @@ dpaa2_eventdev_create(const char *name) eventdev =rte_event_pmd_vdev_init (name,sizeof (struct dpaa2_eventdev ), -rte_socket_id ()); +rte_socket_id (), vdev);if (eventdev ==NULL ) {DPAA2_EVENTDEV_ERR ("Failed to create Event device %s" , name); goto fail;
@@ -1190,7 +1190,7 @@ dpaa2_eventdev_probe(struct rte_vdev_device *vdev) name =rte_vdev_device_name (vdev);DPAA2_EVENTDEV_INFO ("Initializing %s" , name); -return dpaa2_eventdev_create (name); +return dpaa2_eventdev_create (name, vdev); } static int
drivers/event/dsw/dsw_evdev.c +1 -1
@@ -435,7 +435,7 @@ dsw_probe(struct rte_vdev_device *vdev) name =rte_vdev_device_name (vdev); dev =rte_event_pmd_vdev_init (name,sizeof (struct dsw_evdev ), -rte_socket_id ()); +rte_socket_id (), vdev);if (dev ==NULL )return -EFAULT ;
drivers/event/octeontx/ssovf_evdev.c +1 -1
@@ -880,7 +880,7 @@ ssovf_vdev_probe(struct rte_vdev_device *vdev) } eventdev =rte_event_pmd_vdev_init (name,sizeof (struct ssovf_evdev ), -rte_socket_id ()); +rte_socket_id (), vdev);if (eventdev ==NULL ) {ssovf_log_err ("Failed to create eventdev vdev %s" , name);return -ENOMEM ;
drivers/event/opdl/opdl_evdev.c +1 -1
@@ -697,7 +697,7 @@ opdl_probe(struct rte_vdev_device *vdev) } } dev =rte_event_pmd_vdev_init (name, -sizeof (struct opdl_evdev ), socket_id); +sizeof (struct opdl_evdev ), socket_id, vdev);if (dev ==NULL ) {PMD_DRV_LOG (ERR ,"eventdev vdev init() failed" );
drivers/event/skeleton/skeleton_eventdev.c +3 -3
@@ -428,12 +428,12 @@ RTE_PMD_REGISTER_PCI_TABLE(event_skeleton_pci, pci_id_skeleton_map);/* VDEV based event device */ static int -skeleton_eventdev_create (const char *name,int socket_id) +skeleton_eventdev_create (const char *name,int socket_id,struct rte_vdev_device *vdev) {struct rte_eventdev *eventdev; eventdev =rte_event_pmd_vdev_init (name, -sizeof (struct skeleton_eventdev ), socket_id); +sizeof (struct skeleton_eventdev ), socket_id, vdev);if (eventdev ==NULL ) {PMD_DRV_ERR ("Failed to create eventdev vdev %s" , name); goto fail;
@@ -459,7 +459,7 @@ skeleton_eventdev_probe(struct rte_vdev_device *vdev) name =rte_vdev_device_name (vdev);RTE_LOG (INFO ,PMD ,"Initializing %s on NUMA node %d\n" , name,rte_socket_id ()); -return skeleton_eventdev_create (name,rte_socket_id ()); +return skeleton_eventdev_create (name,rte_socket_id (), vdev); } static int
drivers/event/sw/sw_evdev.c +1 -1
@@ -1075,7 +1075,7 @@ sw_probe(struct rte_vdev_device *vdev) min_burst_size, deq_burst_size, refill_once); dev =rte_event_pmd_vdev_init (name, -sizeof (struct sw_evdev ), socket_id); +sizeof (struct sw_evdev ), socket_id, vdev);if (dev ==NULL ) {SW_LOG_ERR ("eventdev vdev init() failed" );return -EFAULT ;
lib/eventdev/eventdev_pmd_vdev.h +2 -1
@@ -45,7 +45,7 @@ extern "C" {__rte_internal static inline struct rte_eventdev *rte_event_pmd_vdev_init (const char *name,size_t dev_private_size, -int socket_id) +int socket_id,struct rte_vdev_device *vdev) {struct rte_eventdev *eventdev;
@@ -67,6 +67,7 @@ rte_event_pmd_vdev_init(const char *name, size_t dev_private_size,rte_panic ("Cannot allocate memzone for private device" " data" ); } + eventdev->dev = &vdev->device;return eventdev; }
Signature · 1 line
2.39.2
PATCH v5 2/2 eventdev: fix missing driver names in info struct
Rather than relying on the individual drivers to always populated the driver name field in the info structure - something missed by some drivers, we can do so in the eventdev rte_event_dev_info_get() function. This fixes issues
--- lib/eventdev/rte_eventdev.c | 2 ++ 1 file changed, 2 insertions(+)
lib/eventdev/rte_eventdev.c +2 -0
@@ -104,6 +104,8 @@ rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info) dev_info->dequeue_timeout_ns = dev->data->dev_conf.dequeue_timeout_ns; dev_info->dev = dev->dev; +if (dev->dev !=NULL && dev->dev->driver !=NULL ) + dev_info->driver_name = dev->dev->driver->name;rte_eventdev_trace_info_get (dev_id, dev_info, dev_info->dev);
Signature · 1 line
2.39.2
Re: [PATCH v5 2/2] eventdev: fix missing driver names in info struct
Quoted 6 lines · Bruce Richardson
Rather than relying on the individual drivers to always populated the driver name field in the info structure - something missed by some drivers, we can do so in the eventdev
rte_event_dev_info_get()function. This fixes issues
Quoted 6 lines
Fixes bbbb929da5e6 ("event/skeleton: add skeleton eventdev driver")Fixes 0ce3ce7c275c ("event/dpaa2: add configuration functions")Suggested-by David Marchand <[email protected]>Signed-off-by Bruce Richardson <[email protected]>
Series applied to dpdk-next--eventdev/for-main. Thanks