net/smc/smc_cdc.h
Source file repositories/reference/linux-study-clean/net/smc/smc_cdc.h
File Facts
- System
- Linux kernel
- Corpus path
net/smc/smc_cdc.h- Extension
.h- Size
- 8472 bytes
- Lines
- 306
- 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/kernel.hlinux/atomic.hlinux/in.hlinux/compiler.hsmc.hsmc_core.hsmc_wr.h
Detected Declarations
struct smc_cdc_msgstruct smcd_cdc_msgstruct smc_cdc_tx_pendfunction smc_cdc_rxed_any_closefunction smc_cdc_rxed_any_close_or_senddonefunction smc_curs_addfunction smc_curs_copyfunction smc_curs_copy_netfunction smcd_curs_copyfunction smc_curs_difffunction smc_curs_compfunction smc_curs_diff_largefunction smc_host_cursor_to_cdcfunction smc_host_msg_to_cdcfunction smc_cdc_cursor_to_hostfunction smcr_cdc_msg_to_hostfunction smcd_cdc_msg_to_hostfunction smc_cdc_msg_to_host
Annotated Snippet
struct smc_cdc_msg {
struct smc_wr_rx_hdr common; /* .type = 0xFE */
u8 len; /* 44 */
__be16 seqno;
__be32 token;
union smc_cdc_cursor prod;
union smc_cdc_cursor cons; /* piggy backed "ack" */
struct smc_cdc_producer_flags prod_flags;
struct smc_cdc_conn_state_flags conn_state_flags;
u8 reserved[18];
};
/* SMC-D cursor format */
union smcd_cdc_cursor {
struct {
u16 wrap;
u32 count;
struct smc_cdc_producer_flags prod_flags;
struct smc_cdc_conn_state_flags conn_state_flags;
} __packed;
#ifdef KERNEL_HAS_ATOMIC64
atomic64_t acurs; /* for atomic processing */
#else
u64 acurs; /* for atomic processing */
#endif
} __aligned(8);
/* CDC message for SMC-D */
struct smcd_cdc_msg {
struct smc_wr_rx_hdr common; /* Type = 0xFE */
u8 res1[7];
union smcd_cdc_cursor prod;
union smcd_cdc_cursor cons;
u8 res3[8];
} __aligned(8);
static inline bool smc_cdc_rxed_any_close(struct smc_connection *conn)
{
return conn->local_rx_ctrl.conn_state_flags.peer_conn_abort ||
conn->local_rx_ctrl.conn_state_flags.peer_conn_closed;
}
static inline bool smc_cdc_rxed_any_close_or_senddone(
struct smc_connection *conn)
{
return smc_cdc_rxed_any_close(conn) ||
conn->local_rx_ctrl.conn_state_flags.peer_done_writing;
}
static inline void smc_curs_add(int size, union smc_host_cursor *curs,
int value)
{
curs->count += value;
if (curs->count >= size) {
curs->wrap++;
curs->count -= size;
}
}
/* Copy cursor src into tgt */
static inline void smc_curs_copy(union smc_host_cursor *tgt,
union smc_host_cursor *src,
struct smc_connection *conn)
{
#ifndef KERNEL_HAS_ATOMIC64
unsigned long flags;
spin_lock_irqsave(&conn->acurs_lock, flags);
tgt->acurs = src->acurs;
spin_unlock_irqrestore(&conn->acurs_lock, flags);
#else
atomic64_set(&tgt->acurs, atomic64_read(&src->acurs));
#endif
}
static inline void smc_curs_copy_net(union smc_cdc_cursor *tgt,
union smc_cdc_cursor *src,
struct smc_connection *conn)
{
#ifndef KERNEL_HAS_ATOMIC64
unsigned long flags;
spin_lock_irqsave(&conn->acurs_lock, flags);
tgt->acurs = src->acurs;
spin_unlock_irqrestore(&conn->acurs_lock, flags);
#else
atomic64_set(&tgt->acurs, atomic64_read(&src->acurs));
#endif
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/atomic.h`, `linux/in.h`, `linux/compiler.h`, `smc.h`, `smc_core.h`, `smc_wr.h`.
- Detected declarations: `struct smc_cdc_msg`, `struct smcd_cdc_msg`, `struct smc_cdc_tx_pend`, `function smc_cdc_rxed_any_close`, `function smc_cdc_rxed_any_close_or_senddone`, `function smc_curs_add`, `function smc_curs_copy`, `function smc_curs_copy_net`, `function smcd_curs_copy`, `function smc_curs_diff`.
- 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.