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 6 #include <net/netlink.h> 7 #include <net/genetlink.h> 8 9 #include "psp-nl-gen.h" 10 11 #include <uapi/linux/psp.h> 12 13 /* Common nested types */ 14 const struct nla_policy psp_keys_nl_policy[PSP_A_KEYS_SPI + 1] = { 15 [PSP_A_KEYS_KEY] = { .type = NLA_BINARY, }, 16 [PSP_A_KEYS_SPI] = { .type = NLA_U32, }, 17 }; 18 19 /* PSP_CMD_DEV_GET - do */ 20 static const struct nla_policy psp_dev_get_nl_policy[PSP_A_DEV_ID + 1] = { 21 [PSP_A_DEV_ID] = NLA_POLICY_MIN(NLA_U32, 1), 22 }; 23 24 /* PSP_CMD_DEV_SET - do */ 25 static const struct nla_policy psp_dev_set_nl_policy[PSP_A_DEV_PSP_VERSIONS_ENA + 1] = { 26 [PSP_A_DEV_ID] = NLA_POLICY_MIN(NLA_U32, 1), 27 [PSP_A_DEV_PSP_VERSIONS_ENA] = NLA_POLICY_MASK(NLA_U32, 0xf), 28 }; 29 30 /* PSP_CMD_KEY_ROTATE - do */ 31 static const struct nla_policy psp_key_rotate_nl_policy[PSP_A_DEV_ID + 1] = { 32 [PSP_A_DEV_ID] = NLA_POLICY_MIN(NLA_U32, 1), 33 }; 34 35 /* PSP_CMD_RX_ASSOC - do */ 36 static const struct nla_policy psp_rx_assoc_nl_policy[PSP_A_ASSOC_SOCK_FD + 1] = { 37 [PSP_A_ASSOC_DEV_ID] = NLA_POLICY_MIN(NLA_U32, 1), 38 [PSP_A_ASSOC_VERSION] = NLA_POLICY_MAX(NLA_U32, 3), 39 [PSP_A_ASSOC_SOCK_FD] = { .type = NLA_U32, }, 40 }; 41 42 /* PSP_CMD_TX_ASSOC - do */ 43 static const struct nla_policy psp_tx_assoc_nl_policy[PSP_A_ASSOC_SOCK_FD + 1] = { 44 [PSP_A_ASSOC_DEV_ID] = NLA_POLICY_MIN(NLA_U32, 1), 45 [PSP_A_ASSOC_VERSION] = NLA_POLICY_MAX(NLA_U32, 3), 46 [PSP_A_ASSOC_TX_KEY] = NLA_POLICY_NESTED(psp_keys_nl_policy), 47 [PSP_A_ASSOC_SOCK_FD] = { .type = NLA_U32, }, 48 }; 49 50 /* Ops table for psp */ 51 static const struct genl_split_ops psp_nl_ops[] = { 52 { 53 .cmd = PSP_CMD_DEV_GET, 54 .pre_doit = psp_device_get_locked, 55 .doit = psp_nl_dev_get_doit, 56 .post_doit = psp_device_unlock, 57 .policy = psp_dev_get_nl_policy, 58 .maxattr = PSP_A_DEV_ID, 59 .flags = GENL_CMD_CAP_DO, 60 }, 61 { 62 .cmd = PSP_CMD_DEV_GET, 63 .dumpit = psp_nl_dev_get_dumpit, 64 .flags = GENL_CMD_CAP_DUMP, 65 }, 66 { 67 .cmd = PSP_CMD_DEV_SET, 68 .pre_doit = psp_device_get_locked, 69 .doit = psp_nl_dev_set_doit, 70 .post_doit = psp_device_unlock, 71 .policy = psp_dev_set_nl_policy, 72 .maxattr = PSP_A_DEV_PSP_VERSIONS_ENA, 73 .flags = GENL_CMD_CAP_DO, 74 }, 75 { 76 .cmd = PSP_CMD_KEY_ROTATE, 77 .pre_doit = psp_device_get_locked, 78 .doit = psp_nl_key_rotate_doit, 79 .post_doit = psp_device_unlock, 80 .policy = psp_key_rotate_nl_policy, 81 .maxattr = PSP_A_DEV_ID, 82 .flags = GENL_CMD_CAP_DO, 83 }, 84 { 85 .cmd = PSP_CMD_RX_ASSOC, 86 .pre_doit = psp_assoc_device_get_locked, 87 .doit = psp_nl_rx_assoc_doit, 88 .post_doit = psp_device_unlock, 89 .policy = psp_rx_assoc_nl_policy, 90 .maxattr = PSP_A_ASSOC_SOCK_FD, 91 .flags = GENL_CMD_CAP_DO, 92 }, 93 { 94 .cmd = PSP_CMD_TX_ASSOC, 95 .pre_doit = psp_assoc_device_get_locked, 96 .doit = psp_nl_tx_assoc_doit, 97 .post_doit = psp_device_unlock, 98 .policy = psp_tx_assoc_nl_policy, 99 .maxattr = PSP_A_ASSOC_SOCK_FD, 100 .flags = GENL_CMD_CAP_DO, 101 }, 102 }; 103 104 static const struct genl_multicast_group psp_nl_mcgrps[] = { 105 [PSP_NLGRP_MGMT] = { "mgmt", }, 106 [PSP_NLGRP_USE] = { "use", }, 107 }; 108 109 struct genl_family psp_nl_family __ro_after_init = { 110 .name = PSP_FAMILY_NAME, 111 .version = PSP_FAMILY_VERSION, 112 .netnsok = true, 113 .parallel_ops = true, 114 .module = THIS_MODULE, 115 .split_ops = psp_nl_ops, 116 .n_split_ops = ARRAY_SIZE(psp_nl_ops), 117 .mcgrps = psp_nl_mcgrps, 118 .n_mcgrps = ARRAY_SIZE(psp_nl_mcgrps), 119 }; 120