-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net/smc: Introduce generic netlink interface for diagnostic purposes
Introduce generic netlink interface infrastructure to expose the diagnostic information regarding smc linkgroups, links and devices. Signed-off-by: Guvenc Gulce <guvenc@linux.ibm.com> Signed-off-by: Karsten Graul <kgraul@linux.ibm.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
- Loading branch information
Guvenc Gulce
authored and
Jakub Kicinski
committed
Dec 2, 2020
1 parent
49407ae
commit e8372d9
Showing
5 changed files
with
97 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* | ||
* Shared Memory Communications over RDMA (SMC-R) and RoCE | ||
* | ||
* Generic netlink support functions to interact with SMC module | ||
* | ||
* Copyright IBM Corp. 2020 | ||
* | ||
* Author(s): Guvenc Gulce <guvenc@linux.ibm.com> | ||
*/ | ||
|
||
#include <linux/module.h> | ||
#include <linux/list.h> | ||
#include <linux/ctype.h> | ||
#include <linux/mutex.h> | ||
#include <linux/if.h> | ||
#include <linux/smc.h> | ||
|
||
#include "smc_core.h" | ||
#include "smc_netlink.h" | ||
|
||
#define SMC_CMD_MAX_ATTR 1 | ||
|
||
/* SMC_GENL generic netlink operation definition */ | ||
static const struct genl_ops smc_gen_nl_ops[] = { | ||
}; | ||
|
||
static const struct nla_policy smc_gen_nl_policy[2] = { | ||
[SMC_CMD_MAX_ATTR] = { .type = NLA_REJECT, }, | ||
}; | ||
|
||
/* SMC_GENL family definition */ | ||
struct genl_family smc_gen_nl_family __ro_after_init = { | ||
.hdrsize = 0, | ||
.name = SMC_GENL_FAMILY_NAME, | ||
.version = SMC_GENL_FAMILY_VERSION, | ||
.maxattr = SMC_CMD_MAX_ATTR, | ||
.policy = smc_gen_nl_policy, | ||
.netnsok = true, | ||
.module = THIS_MODULE, | ||
.ops = smc_gen_nl_ops, | ||
.n_ops = ARRAY_SIZE(smc_gen_nl_ops) | ||
}; | ||
|
||
int __init smc_nl_init(void) | ||
{ | ||
return genl_register_family(&smc_gen_nl_family); | ||
} | ||
|
||
void smc_nl_exit(void) | ||
{ | ||
genl_unregister_family(&smc_gen_nl_family); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
/* | ||
* Shared Memory Communications over RDMA (SMC-R) and RoCE | ||
* | ||
* SMC Generic netlink operations | ||
* | ||
* Copyright IBM Corp. 2020 | ||
* | ||
* Author(s): Guvenc Gulce <guvenc@linux.ibm.com> | ||
*/ | ||
|
||
#ifndef _SMC_NETLINK_H | ||
#define _SMC_NETLINK_H | ||
|
||
#include <net/netlink.h> | ||
#include <net/genetlink.h> | ||
|
||
extern struct genl_family smc_gen_nl_family; | ||
|
||
int smc_nl_init(void) __init; | ||
void smc_nl_exit(void); | ||
|
||
#endif |