| 1 |
// SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) |
| 2 |
/* Do not edit directly, auto-generated from: */ |
| 3 |
/* Documentation/netlink/specs/psp.yaml */ |
| 4 |
/* YNL-GEN kernel source */ |
| 5 |
/* To regenerate run: tools/net/ynl/ynl-regen.sh */ |
| 6 |
|
| 7 |
#include <net/netlink.h> |
| 8 |
#include <net/genetlink.h> |
| 9 |
|
| 10 |
#include "psp-nl-gen.h" |
| 11 |
|
| 12 |
#include <uapi/linux/psp.h> |
| 13 |
|
| 14 |
/* Common nested types */ |
| 15 |
const struct nla_policy psp_keys_nl_policy[PSP_A_KEYS_SPI + 1] = { |
| 16 |
[PSP_A_KEYS_KEY] = { .type = NLA_BINARY, }, |
| 17 |
[PSP_A_KEYS_SPI] = { .type = NLA_U32, }, |
| 18 |
}; |
| 19 |
|
| 20 |
/* PSP_CMD_DEV_GET - do */ |
| 21 |
static const struct nla_policy psp_dev_get_nl_policy[PSP_A_DEV_ID + 1] = { |
| 22 |
[PSP_A_DEV_ID] = NLA_POLICY_MIN(NLA_U32, 1), |
| 23 |
}; |
| 24 |
|
| 25 |
/* PSP_CMD_DEV_SET - do */ |
| 26 |
static const struct nla_policy psp_dev_set_nl_policy[PSP_A_DEV_PSP_VERSIONS_ENA + 1] = { |
| 27 |
[PSP_A_DEV_ID] = NLA_POLICY_MIN(NLA_U32, 1), |
| 28 |
[PSP_A_DEV_PSP_VERSIONS_ENA] = NLA_POLICY_MASK(NLA_U32, 0xf), |
| 29 |
}; |
| 30 |
|
| 31 |
/* PSP_CMD_KEY_ROTATE - do */ |
| 32 |
static const struct nla_policy psp_key_rotate_nl_policy[PSP_A_DEV_ID + 1] = { |
| 33 |
[PSP_A_DEV_ID] = NLA_POLICY_MIN(NLA_U32, 1), |
| 34 |
}; |
| 35 |
|
| 36 |
/* PSP_CMD_RX_ASSOC - do */ |
| 37 |
static const struct nla_policy psp_rx_assoc_nl_policy[PSP_A_ASSOC_SOCK_FD + 1] = { |
| 38 |
[PSP_A_ASSOC_DEV_ID] = NLA_POLICY_MIN(NLA_U32, 1), |
| 39 |
[PSP_A_ASSOC_VERSION] = NLA_POLICY_MAX(NLA_U32, 3), |
| 40 |
[PSP_A_ASSOC_SOCK_FD] = { .type = NLA_U32, }, |
| 41 |
}; |
| 42 |
|
| 43 |
/* PSP_CMD_TX_ASSOC - do */ |
| 44 |
static const struct nla_policy psp_tx_assoc_nl_policy[PSP_A_ASSOC_SOCK_FD + 1] = { |
| 45 |
[PSP_A_ASSOC_DEV_ID] = NLA_POLICY_MIN(NLA_U32, 1), |
| 46 |
[PSP_A_ASSOC_VERSION] = NLA_POLICY_MAX(NLA_U32, 3), |
| 47 |
[PSP_A_ASSOC_TX_KEY] = NLA_POLICY_NESTED(psp_keys_nl_policy), |
| 48 |
[PSP_A_ASSOC_SOCK_FD] = { .type = NLA_U32, }, |
| 49 |
}; |
| 50 |
|
| 51 |
/* PSP_CMD_GET_STATS - do */ |
| 52 |
static const struct nla_policy psp_get_stats_nl_policy[PSP_A_STATS_DEV_ID + 1] = { |
| 53 |
[PSP_A_STATS_DEV_ID] = NLA_POLICY_MIN(NLA_U32, 1), |
| 54 |
}; |
| 55 |
|
| 56 |
/* Ops table for psp */ |
| 57 |
static const struct genl_split_ops psp_nl_ops[] = { |
| 58 |
{ |
| 59 |
.cmd = PSP_CMD_DEV_GET, |
| 60 |
.pre_doit = psp_device_get_locked, |
| 61 |
.doit = psp_nl_dev_get_doit, |
| 62 |
.post_doit = psp_device_unlock, |
| 63 |
.policy = psp_dev_get_nl_policy, |
| 64 |
.maxattr = PSP_A_DEV_ID, |
| 65 |
.flags = GENL_CMD_CAP_DO, |
| 66 |
}, |
| 67 |
{ |
| 68 |
.cmd = PSP_CMD_DEV_GET, |
| 69 |
.dumpit = psp_nl_dev_get_dumpit, |
| 70 |
.flags = GENL_CMD_CAP_DUMP, |
| 71 |
}, |
| 72 |
{ |
| 73 |
.cmd = PSP_CMD_DEV_SET, |
| 74 |
.pre_doit = psp_device_get_locked, |
| 75 |
.doit = psp_nl_dev_set_doit, |
| 76 |
.post_doit = psp_device_unlock, |
| 77 |
.policy = psp_dev_set_nl_policy, |
| 78 |
.maxattr = PSP_A_DEV_PSP_VERSIONS_ENA, |
| 79 |
.flags = GENL_CMD_CAP_DO, |
| 80 |
}, |
| 81 |
{ |
| 82 |
.cmd = PSP_CMD_KEY_ROTATE, |
| 83 |
.pre_doit = psp_device_get_locked, |
| 84 |
.doit = psp_nl_key_rotate_doit, |
| 85 |
.post_doit = psp_device_unlock, |
| 86 |
.policy = psp_key_rotate_nl_policy, |
| 87 |
.maxattr = PSP_A_DEV_ID, |
| 88 |
.flags = GENL_CMD_CAP_DO, |
| 89 |
}, |
| 90 |
{ |
| 91 |
.cmd = PSP_CMD_RX_ASSOC, |
| 92 |
.pre_doit = psp_assoc_device_get_locked, |
| 93 |
.doit = psp_nl_rx_assoc_doit, |
| 94 |
.post_doit = psp_device_unlock, |
| 95 |
.policy = psp_rx_assoc_nl_policy, |
| 96 |
.maxattr = PSP_A_ASSOC_SOCK_FD, |
| 97 |
.flags = GENL_CMD_CAP_DO, |
| 98 |
}, |
| 99 |
{ |
| 100 |
.cmd = PSP_CMD_TX_ASSOC, |
| 101 |
.pre_doit = psp_assoc_device_get_locked, |
| 102 |
.doit = psp_nl_tx_assoc_doit, |
| 103 |
.post_doit = psp_device_unlock, |
| 104 |
.policy = psp_tx_assoc_nl_policy, |
| 105 |
.maxattr = PSP_A_ASSOC_SOCK_FD, |
| 106 |
.flags = GENL_CMD_CAP_DO, |
| 107 |
}, |
| 108 |
{ |
| 109 |
.cmd = PSP_CMD_GET_STATS, |
| 110 |
.pre_doit = psp_device_get_locked, |
| 111 |
.doit = psp_nl_get_stats_doit, |
| 112 |
.post_doit = psp_device_unlock, |
| 113 |
.policy = psp_get_stats_nl_policy, |
| 114 |
.maxattr = PSP_A_STATS_DEV_ID, |
| 115 |
.flags = GENL_CMD_CAP_DO, |
| 116 |
}, |
| 117 |
{ |
| 118 |
.cmd = PSP_CMD_GET_STATS, |
| 119 |
.dumpit = psp_nl_get_stats_dumpit, |
| 120 |
.flags = GENL_CMD_CAP_DUMP, |
| 121 |
}, |
| 122 |
}; |
| 123 |
|
| 124 |
static const struct genl_multicast_group psp_nl_mcgrps[] = { |
| 125 |
[PSP_NLGRP_MGMT] = { "mgmt", }, |
| 126 |
[PSP_NLGRP_USE] = { "use", }, |
| 127 |
}; |
| 128 |
|
| 129 |
struct genl_family psp_nl_family __ro_after_init = { |
| 130 |
.name = PSP_FAMILY_NAME, |
| 131 |
.version = PSP_FAMILY_VERSION, |
| 132 |
.netnsok = true, |
| 133 |
.parallel_ops = true, |
| 134 |
.module = THIS_MODULE, |
| 135 |
.split_ops = psp_nl_ops, |
| 136 |
.n_split_ops = ARRAY_SIZE(psp_nl_ops), |
| 137 |
.mcgrps = psp_nl_mcgrps, |
| 138 |
.n_mcgrps = ARRAY_SIZE(psp_nl_mcgrps), |
| 139 |
}; |