src/dpdk/drivers/crypto/scheduler/scheduler_pmd_ops.c
static int
scheduler_attach_init_worker(struct rte_cryptodev *dev)
{
	struct scheduler_ctx *sched_ctx = dev->data->dev_private;
	uint8_t scheduler_id = dev->data->dev_id;
	int i;

	for (i = sched_ctx->nb_init_workers - 1; i >= 0; i--) {
		const char *dev_name = sched_ctx->init_worker_names[i];
		struct rte_cryptodev *worker_dev =
				rte_cryptodev_pmd_get_named_dev(dev_name);
		int status;

		if (!worker_dev) {
			CR_SCHED_LOG(ERR, "Failed to locate worker dev %s",
					dev_name);
			return -EINVAL;
		}

		status = rte_cryptodev_scheduler_worker_attach(
				scheduler_id, worker_dev->data->dev_id);

		if (status < 0) {
			CR_SCHED_LOG(ERR, "Failed to attach worker cryptodev %u",
					worker_dev->data->dev_id);
			return status;
		}

		CR_SCHED_LOG(INFO, "Scheduler %s attached worker %s",
				dev->data->name,
				sched_ctx->init_worker_names[i]);

		rte_free(sched_ctx->init_worker_names[i]);
		sched_ctx->init_worker_names[i] = NULL;

		sched_ctx->nb_init_workers -= 1;
	}

	return 0;
}
/** attaching the workers predefined by scheduler's EAL options */
attaching the workers predefined by scheduler's EAL options
attaching the workers predefined by scheduler ' s EAL options
static int
scheduler_attach_init_worker(struct rte_cryptodev *dev)
{
	struct scheduler_ctx *sched_ctx = dev->data->dev_private;
	uint8_t scheduler_id = dev->data->dev_id;
	int i;
	for (i = sched_ctx->nb_init_workers - 1; i >= 0; i--) {
		const char *dev_name = sched_ctx->init_worker_names[i];
		struct rte_cryptodev *worker_dev =
				rte_cryptodev_pmd_get_named_dev(dev_name);
		int status;
		if (!worker_dev) {
			CR_SCHED_LOG(ERR, "Failed to locate worker dev %s",
					dev_name);
			return -EINVAL;
		}
		status = rte_cryptodev_scheduler_worker_attach(
				scheduler_id, worker_dev->data->dev_id);
		if (status < 0) {
			CR_SCHED_LOG(ERR, "Failed to attach worker cryptodev %u",
					worker_dev->data->dev_id);
			return status;
		}
		CR_SCHED_LOG(INFO, "Scheduler %s attached worker %s",
				dev->data->name,
				sched_ctx->init_worker_names[i]);
		rte_free(sched_ctx->init_worker_names[i]);
		sched_ctx->init_worker_names[i] = NULL;
		sched_ctx->nb_init_workers -= 1;
	}
	return 0;
}
static int scheduler_attach_init_worker ( struct rte_cryptodev * dev ) { struct scheduler_ctx * sched_ctx = dev -> data -> dev_private ; uint8_t scheduler_id = dev -> data -> dev_id ; int i ; for ( i = sched_ctx -> nb_init_workers - 1 ; i >= 0 ; i -- ) { const char * dev_name = sched_ctx -> init_worker_names [ i ] ; struct rte_cryptodev * worker_dev = rte_cryptodev_pmd_get_named_dev ( dev_name ) ; int status ; if ( ! worker_dev ) { CR_SCHED_LOG ( ERR , " " , dev_name ) ; return - EINVAL ; } status = rte_cryptodev_scheduler_worker_attach ( scheduler_id , worker_dev -> data -> dev_id ) ; if ( status < 0 ) { CR_SCHED_LOG ( ERR , " " , worker_dev -> data -> dev_id ) ; return status ; } CR_SCHED_LOG ( INFO , " " , dev -> data -> name , sched_ctx -> init_worker_names [ i ] ) ; rte_free ( sched_ctx -> init_worker_names [ i ] ) ; sched_ctx -> init_worker_names [ i ] = NULL ; sched_ctx -> nb_init_workers -= 1 ; } return 0 ; }
attaching the workers predefined by scheduler's EAL options
attaching the workers predefined by scheduler ' s EAL options