include/net/smc.h
Source file repositories/reference/linux-study-clean/include/net/smc.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/smc.h- Extension
.h- Size
- 2503 bytes
- Lines
- 107
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/spinlock.hlinux/types.hlinux/wait.hlinux/dibs.h
Detected Declarations
struct tcp_sockstruct inet_request_sockstruct sockstruct smc_hashinfostruct smcd_gidstruct smcd_devstruct smc_hs_ctrl
Annotated Snippet
struct smc_hashinfo {
rwlock_t lock;
struct hlist_head ht;
};
/* SMCD/ISM device driver interface */
#define ISM_RESERVED_VLANID 0x1FFF
struct smcd_gid {
u64 gid;
u64 gid_ext;
};
struct smcd_dev {
struct dibs_dev *dibs;
struct list_head list;
spinlock_t lock;
struct list_head vlan;
struct workqueue_struct *event_wq;
u8 pnetid[SMC_MAX_PNETID_LEN];
bool pnetid_by_user;
struct list_head lgr_list;
spinlock_t lgr_lock;
atomic_t lgr_cnt;
wait_queue_head_t lgrs_deleted;
u8 going_away : 1;
struct smc_connection *conn[];
};
#define SMC_HS_CTRL_NAME_MAX 16
enum {
/* ops can be inherit from init_net */
SMC_HS_CTRL_FLAG_INHERITABLE = 0x1,
SMC_HS_CTRL_ALL_FLAGS = SMC_HS_CTRL_FLAG_INHERITABLE,
};
struct smc_hs_ctrl {
/* private */
struct list_head list;
struct module *owner;
/* public */
/* unique name */
char name[SMC_HS_CTRL_NAME_MAX];
int flags;
/* Invoked before computing SMC option for SYN packets.
* We can control whether to set SMC options by returning various value.
* Return 0 to disable SMC, or return any other value to enable it.
*/
int (*syn_option)(struct tcp_sock *tp);
/* Invoked before Set up SMC options for SYN-ACK packets
* We can control whether to respond SMC options by returning various
* value. Return 0 to disable SMC, or return any other value to enable
* it.
*/
int (*synack_option)(const struct tcp_sock *tp,
struct inet_request_sock *ireq);
};
#if IS_ENABLED(CONFIG_SMC_HS_CTRL_BPF)
#define smc_call_hsbpf(init_val, tp, func, ...) ({ \
typeof(init_val) __ret = (init_val); \
struct smc_hs_ctrl *ctrl; \
rcu_read_lock(); \
ctrl = rcu_dereference(sock_net((struct sock *)(tp))->smc.hs_ctrl); \
if (ctrl && ctrl->func) \
__ret = ctrl->func(tp, ##__VA_ARGS__); \
rcu_read_unlock(); \
__ret; \
})
#else
#define smc_call_hsbpf(init_val, tp, ...) ({ (void)(tp); (init_val); })
#endif /* CONFIG_SMC_HS_CTRL_BPF */
#endif /* _SMC_H */
Annotation
- Immediate include surface: `linux/device.h`, `linux/spinlock.h`, `linux/types.h`, `linux/wait.h`, `linux/dibs.h`.
- Detected declarations: `struct tcp_sock`, `struct inet_request_sock`, `struct sock`, `struct smc_hashinfo`, `struct smcd_gid`, `struct smcd_dev`, `struct smc_hs_ctrl`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.