accel-config: While initing devices also init groups
ramesh.thomas at intel.com
PATCH 1/1 accel-config: While initing devices also init groups
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
Grouped workqueues and engines rely on state stored in structures associated with groups. Initialize the groups at the time of device init so they are available when workqueues are enabled. Flags are used to ensure groups do not get initialized again if they are already initialized once.
Signed-off-by Ramesh Thomas <ramesh.thomas(a)intel.com>
--- accfg/lib/libaccfg.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-)
accfg/lib/libaccfg.c +18 -13
@@ -911,10 +911,26 @@ static int filter_file_name_prefix(const struct dirent *d)return !strncmp (filename_prefix, d->d_name, filename_prefix_len); } +static void groups_init (struct accfg_device *device) +{ +struct accfg_ctx *ctx = device->ctx; + +if (device->group_init) { +dbg (ctx,"group is initialized already\n" ); +return ; + } + device->group_init =1 ; +set_filename_prefix ("group" ); +device_parse (device->ctx, device->device_path,"group" , + filter_file_name_prefix, + device, add_group); +} +static void devices_init (struct accfg_ctx *ctx) {char **accel_name;char *path; +struct accfg_device *device;if (ctx->devices_init) {dbg (ctx,"device is initialized already\n" );
@@ -933,21 +949,10 @@ static void devices_init(struct accfg_ctx *ctx) filter_file_name_prefix, ctx, add_device);free (path); } -} -static void groups_init (struct accfg_device *device) -{ -struct accfg_ctx *ctx = device->ctx; - -if (device->group_init) { -dbg (ctx,"group is intialized already\n" ); -return ; + accfg_device_foreach(ctx, device) { +groups_init (device); } - device->group_init =1 ; -set_filename_prefix ("group" ); -device_parse (device->ctx, device->device_path,"group" , - filter_file_name_prefix, - device, add_group); }static void engines_init (struct accfg_device *device)
Signature · 1 line
2.26.2
Dave Jiang
Reviewed-by on v1 1/1Quoted 9 lines · ramesh.thomas(a)intel.com
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
Grouped workqueues and engines rely on state stored in structures associated with groups. Initialize the groups at the time of device init so they are available when workqueues are enabled. Flags are used to ensure groups do not get initialized again if they are already initialized once.
Signed-off-by Ramesh Thomas <ramesh.thomas(a)intel.com>
Reviewed-by Dave Jiang <dave.jiang(a)intel.com>
Quoted 59 lines
--- accfg/lib/libaccfg.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-)accfg/lib/libaccfg.c +18
-13@@ -911,10 +911,26 @@ static int filter_file_name_prefix(const struct dirent *d)return !strncmp (filename_prefix, d->d_name, filename_prefix_len); } +static void groups_init (struct accfg_device *device) +{ +struct accfg_ctx *ctx = device->ctx; + +if (device->group_init) { +dbg (ctx,"group is initialized already\n" ); +return ; + } + device->group_init =1 ; +set_filename_prefix ("group" ); +device_parse (device->ctx, device->device_path,"group" , + filter_file_name_prefix, + device, add_group); +} +static void devices_init (struct accfg_ctx *ctx) {char **accel_name;char *path; +struct accfg_device *device;if (ctx->devices_init) {dbg (ctx,"device is initialized already\n" );@@ -933,21 +949,10 @@ static void devices_init(struct accfg_ctx *ctx) filter_file_name_prefix, ctx, add_device);free (path); } -} -static void groups_init (struct accfg_device *device) -{ -struct accfg_ctx *ctx = device->ctx; - -if (device->group_init) { -dbg (ctx,"group is intialized already\n" ); -return ; + accfg_device_foreach(ctx, device) { +groups_init (device); } - device->group_init =1 ; -set_filename_prefix ("group" ); -device_parse (device->ctx, device->device_path,"group" , - filter_file_name_prefix, - device, add_group); }static void engines_init (struct accfg_device *device)