net/smc/smc_netlink.c
Source file repositories/reference/linux-study-clean/net/smc/smc_netlink.c
File Facts
- System
- Linux kernel
- Corpus path
net/smc/smc_netlink.c- Extension
.c- Size
- 3682 bytes
- Lines
- 158
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/list.hlinux/ctype.hlinux/mutex.hlinux/if.hlinux/smc.hsmc_core.hsmc_ism.hsmc_ib.hsmc_clc.hsmc_stats.hsmc_netlink.h
Detected Declarations
function smc_nl_initfunction smc_nl_exit
Annotated Snippet
// 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_ism.h"
#include "smc_ib.h"
#include "smc_clc.h"
#include "smc_stats.h"
#include "smc_netlink.h"
const struct nla_policy
smc_gen_ueid_policy[SMC_NLA_EID_TABLE_MAX + 1] = {
[SMC_NLA_EID_TABLE_UNSPEC] = { .type = NLA_UNSPEC },
[SMC_NLA_EID_TABLE_ENTRY] = { .type = NLA_STRING,
.len = SMC_MAX_EID_LEN,
},
};
#define SMC_CMD_MAX_ATTR 1
/* SMC_GENL generic netlink operation definition */
static const struct genl_ops smc_gen_nl_ops[] = {
{
.cmd = SMC_NETLINK_GET_SYS_INFO,
/* can be retrieved by unprivileged users */
.dumpit = smc_nl_get_sys_info,
},
{
.cmd = SMC_NETLINK_GET_LGR_SMCR,
/* can be retrieved by unprivileged users */
.dumpit = smcr_nl_get_lgr,
},
{
.cmd = SMC_NETLINK_GET_LINK_SMCR,
/* can be retrieved by unprivileged users */
.dumpit = smcr_nl_get_link,
},
{
.cmd = SMC_NETLINK_GET_LGR_SMCD,
/* can be retrieved by unprivileged users */
.dumpit = smcd_nl_get_lgr,
},
{
.cmd = SMC_NETLINK_GET_DEV_SMCD,
/* can be retrieved by unprivileged users */
.dumpit = smcd_nl_get_device,
},
{
.cmd = SMC_NETLINK_GET_DEV_SMCR,
/* can be retrieved by unprivileged users */
.dumpit = smcr_nl_get_device,
},
{
.cmd = SMC_NETLINK_GET_STATS,
/* can be retrieved by unprivileged users */
.dumpit = smc_nl_get_stats,
},
{
.cmd = SMC_NETLINK_GET_FBACK_STATS,
/* can be retrieved by unprivileged users */
.dumpit = smc_nl_get_fback_stats,
},
{
.cmd = SMC_NETLINK_DUMP_UEID,
/* can be retrieved by unprivileged users */
.dumpit = smc_nl_dump_ueid,
},
{
.cmd = SMC_NETLINK_ADD_UEID,
.flags = GENL_ADMIN_PERM,
.doit = smc_nl_add_ueid,
.policy = smc_gen_ueid_policy,
},
{
.cmd = SMC_NETLINK_REMOVE_UEID,
.flags = GENL_ADMIN_PERM,
Annotation
- Immediate include surface: `linux/module.h`, `linux/list.h`, `linux/ctype.h`, `linux/mutex.h`, `linux/if.h`, `linux/smc.h`, `smc_core.h`, `smc_ism.h`.
- Detected declarations: `function smc_nl_init`, `function smc_nl_exit`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.