File: defaults.c

package info (click to toggle)
linux 6.18.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,742,096 kB
  • sloc: ansic: 26,781,576; asm: 272,087; sh: 148,750; python: 79,244; makefile: 57,741; perl: 36,527; xml: 19,542; cpp: 5,911; yacc: 4,939; lex: 2,950; awk: 1,607; sed: 30; ruby: 25
file content (51 lines) | stat: -rw-r--r-- 1,086 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// SPDX-License-Identifier: GPL-2.0
/* Copyright(c) 2023 Intel Corporation. All rights rsvd. */
#include <linux/kernel.h>
#include "idxd.h"

int idxd_load_iaa_device_defaults(struct idxd_device *idxd)
{
	struct idxd_engine *engine;
	struct idxd_group *group;
	struct idxd_wq *wq;

	if (!test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags))
		return 0;

	wq = idxd->wqs[0];

	if (wq->state != IDXD_WQ_DISABLED)
		return -EPERM;

	/* set mode to "dedicated" */
	set_bit(WQ_FLAG_DEDICATED, &wq->flags);
	wq->threshold = 0;

	/* only setting up 1 wq, so give it all the wq space */
	wq->size = idxd->max_wq_size;

	/* set priority to 10 */
	wq->priority = 10;

	/* set type to "kernel" */
	wq->type = IDXD_WQT_KERNEL;

	/* set wq group to 0 */
	group = idxd->groups[0];
	wq->group = group;
	group->num_wqs++;

	/* set name to "iaa_crypto" */
	strscpy_pad(wq->name, "iaa_crypto");

	/* set driver_name to "crypto" */
	strscpy_pad(wq->driver_name, "crypto");

	engine = idxd->engines[0];

	/* set engine group to 0 */
	engine->group = idxd->groups[0];
	engine->group->num_engines++;

	return 0;
}