1
2
3
4
5
6
7
8
9
10
11
12#include <linux/module.h>
13#include <linux/list.h>
14#include <linux/ctype.h>
15#include <linux/mutex.h>
16#include <linux/if.h>
17#include <linux/smc.h>
18
19#include "smc_core.h"
20#include "smc_ism.h"
21#include "smc_ib.h"
22#include "smc_netlink.h"
23
24#define SMC_CMD_MAX_ATTR 1
25
26
27static const struct genl_ops smc_gen_nl_ops[] = {
28 {
29 .cmd = SMC_NETLINK_GET_SYS_INFO,
30
31 .dumpit = smc_nl_get_sys_info,
32 },
33 {
34 .cmd = SMC_NETLINK_GET_LGR_SMCR,
35
36 .dumpit = smcr_nl_get_lgr,
37 },
38 {
39 .cmd = SMC_NETLINK_GET_LINK_SMCR,
40
41 .dumpit = smcr_nl_get_link,
42 },
43 {
44 .cmd = SMC_NETLINK_GET_LGR_SMCD,
45
46 .dumpit = smcd_nl_get_lgr,
47 },
48 {
49 .cmd = SMC_NETLINK_GET_DEV_SMCD,
50
51 .dumpit = smcd_nl_get_device,
52 },
53 {
54 .cmd = SMC_NETLINK_GET_DEV_SMCR,
55
56 .dumpit = smcr_nl_get_device,
57 },
58};
59
60static const struct nla_policy smc_gen_nl_policy[2] = {
61 [SMC_CMD_MAX_ATTR] = { .type = NLA_REJECT, },
62};
63
64
65struct genl_family smc_gen_nl_family __ro_after_init = {
66 .hdrsize = 0,
67 .name = SMC_GENL_FAMILY_NAME,
68 .version = SMC_GENL_FAMILY_VERSION,
69 .maxattr = SMC_CMD_MAX_ATTR,
70 .policy = smc_gen_nl_policy,
71 .netnsok = true,
72 .module = THIS_MODULE,
73 .ops = smc_gen_nl_ops,
74 .n_ops = ARRAY_SIZE(smc_gen_nl_ops)
75};
76
77int __init smc_nl_init(void)
78{
79 return genl_register_family(&smc_gen_nl_family);
80}
81
82void smc_nl_exit(void)
83{
84 genl_unregister_family(&smc_gen_nl_family);
85}
86