net/smc/smc_stats.h
Source file repositories/reference/linux-study-clean/net/smc/smc_stats.h
File Facts
- System
- Linux kernel
- Corpus path
net/smc/smc_stats.h- Extension
.h- Size
- 7890 bytes
- Lines
- 281
- 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/init.hlinux/mutex.hlinux/percpu.hlinux/ctype.hlinux/smc.hsmc_clc.h
Detected Declarations
struct smc_stats_fbackstruct smc_stats_rsnstruct smc_stats_rmbcntstruct smc_stats_memsizestruct smc_stats_techstruct smc_stats
Annotated Snippet
struct smc_stats_fback {
int fback_code;
u16 count;
};
struct smc_stats_rsn {
struct smc_stats_fback srv[SMC_MAX_FBACK_RSN_CNT];
struct smc_stats_fback clnt[SMC_MAX_FBACK_RSN_CNT];
u64 srv_fback_cnt;
u64 clnt_fback_cnt;
};
struct smc_stats_rmbcnt {
u64 buf_size_small_peer_cnt;
u64 buf_size_small_cnt;
u64 buf_full_peer_cnt;
u64 buf_full_cnt;
u64 reuse_cnt;
u64 alloc_cnt;
u64 dgrade_cnt;
};
struct smc_stats_memsize {
u64 buf[SMC_BUF_MAX];
};
struct smc_stats_tech {
struct smc_stats_memsize tx_rmbsize;
struct smc_stats_memsize rx_rmbsize;
struct smc_stats_memsize tx_pd;
struct smc_stats_memsize rx_pd;
struct smc_stats_rmbcnt rmb_tx;
struct smc_stats_rmbcnt rmb_rx;
u64 clnt_v1_succ_cnt;
u64 clnt_v2_succ_cnt;
u64 srv_v1_succ_cnt;
u64 srv_v2_succ_cnt;
u64 urg_data_cnt;
u64 splice_cnt;
u64 cork_cnt;
u64 ndly_cnt;
u64 rx_bytes;
u64 tx_bytes;
u64 rx_cnt;
u64 tx_cnt;
u64 rx_rmbuse;
u64 tx_rmbuse;
};
struct smc_stats {
struct smc_stats_tech smc[2];
u64 clnt_hshake_err_cnt;
u64 srv_hshake_err_cnt;
};
#define SMC_STAT_PAYLOAD_SUB(_smc_stats, _tech, key, _len, _rc) \
do { \
typeof(_smc_stats) stats = (_smc_stats); \
typeof(_tech) t = (_tech); \
typeof(_len) l = (_len); \
int _pos; \
typeof(_rc) r = (_rc); \
int m = SMC_BUF_MAX - 1; \
this_cpu_inc((*stats).smc[t].key ## _cnt); \
if (r <= 0 || l <= 0) \
break; \
_pos = fls64((l - 1) >> 13); \
_pos = (_pos <= m) ? _pos : m; \
this_cpu_inc((*stats).smc[t].key ## _pd.buf[_pos]); \
this_cpu_add((*stats).smc[t].key ## _bytes, r); \
} \
while (0)
#define SMC_STAT_TX_PAYLOAD(_smc, length, rcode) \
do { \
typeof(_smc) __smc = _smc; \
struct net *_net = sock_net(&__smc->sk); \
struct smc_stats __percpu *_smc_stats = _net->smc.smc_stats; \
typeof(length) _len = (length); \
typeof(rcode) _rc = (rcode); \
bool is_smcd = !__smc->conn.lnk; \
if (is_smcd) \
SMC_STAT_PAYLOAD_SUB(_smc_stats, SMC_TYPE_D, tx, _len, _rc); \
else \
SMC_STAT_PAYLOAD_SUB(_smc_stats, SMC_TYPE_R, tx, _len, _rc); \
} \
while (0)
#define SMC_STAT_RX_PAYLOAD(_smc, length, rcode) \
do { \
Annotation
- Immediate include surface: `linux/init.h`, `linux/mutex.h`, `linux/percpu.h`, `linux/ctype.h`, `linux/smc.h`, `smc_clc.h`.
- Detected declarations: `struct smc_stats_fback`, `struct smc_stats_rsn`, `struct smc_stats_rmbcnt`, `struct smc_stats_memsize`, `struct smc_stats_tech`, `struct smc_stats`.
- 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.