drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.c- Extension
.c- Size
- 11172 bytes
- Lines
- 303
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
fs_tracepoint.hlinux/stringify.h
Detected Declarations
function DECLARE_MASK_VALfunction print_lyr_2_4_hdrsfunction print_misc_parameters_hdrs
Annotated Snippet
#define CREATE_TRACE_POINTS
#include "fs_tracepoint.h"
#include <linux/stringify.h>
#define DECLARE_MASK_VAL(type, name) struct {type m; type v; } name
#define MASK_VAL(type, spec, name, mask, val, fld) \
DECLARE_MASK_VAL(type, name) = \
{.m = MLX5_GET(spec, mask, fld),\
.v = MLX5_GET(spec, val, fld)}
#define MASK_VAL_BE(type, spec, name, mask, val, fld) \
DECLARE_MASK_VAL(type, name) = \
{.m = MLX5_GET_BE(type, spec, mask, fld),\
.v = MLX5_GET_BE(type, spec, val, fld)}
#define GET_MASKED_VAL(name) (name.m & name.v)
#define GET_MASK_VAL(name, type, mask, val, fld) \
(name.m = MLX5_GET(type, mask, fld), \
name.v = MLX5_GET(type, val, fld), \
name.m & name.v)
#define PRINT_MASKED_VAL(name, p, format) { \
if (name.m) \
trace_seq_printf(p, __stringify(name) "=" format " ", name.v); \
}
#define PRINT_MASKED_VALP(name, cast, p, format) { \
if (name.m) \
trace_seq_printf(p, __stringify(name) "=" format " ", \
(cast)&name.v);\
}
static void print_lyr_2_4_hdrs(struct trace_seq *p,
const u32 *mask, const u32 *value)
{
#define MASK_VAL_L2(type, name, fld) \
MASK_VAL(type, fte_match_set_lyr_2_4, name, mask, value, fld)
DECLARE_MASK_VAL(u64, smac) = {
.m = MLX5_GET(fte_match_set_lyr_2_4, mask, smac_47_16) << 16 |
MLX5_GET(fte_match_set_lyr_2_4, mask, smac_15_0),
.v = MLX5_GET(fte_match_set_lyr_2_4, value, smac_47_16) << 16 |
MLX5_GET(fte_match_set_lyr_2_4, value, smac_15_0)};
DECLARE_MASK_VAL(u64, dmac) = {
.m = MLX5_GET(fte_match_set_lyr_2_4, mask, dmac_47_16) << 16 |
MLX5_GET(fte_match_set_lyr_2_4, mask, dmac_15_0),
.v = MLX5_GET(fte_match_set_lyr_2_4, value, dmac_47_16) << 16 |
MLX5_GET(fte_match_set_lyr_2_4, value, dmac_15_0)};
MASK_VAL_L2(u16, ethertype, ethertype);
MASK_VAL_L2(u8, ip_version, ip_version);
PRINT_MASKED_VALP(smac, u8 *, p, "%pM");
PRINT_MASKED_VALP(dmac, u8 *, p, "%pM");
PRINT_MASKED_VAL(ethertype, p, "%04x");
if ((ethertype.m == 0xffff && ethertype.v == ETH_P_IP) ||
(ip_version.m == 0xf && ip_version.v == 4)) {
#define MASK_VAL_L2_BE(type, name, fld) \
MASK_VAL_BE(type, fte_match_set_lyr_2_4, name, mask, value, fld)
MASK_VAL_L2_BE(u32, src_ipv4,
src_ipv4_src_ipv6.ipv4_layout.ipv4);
MASK_VAL_L2_BE(u32, dst_ipv4,
dst_ipv4_dst_ipv6.ipv4_layout.ipv4);
PRINT_MASKED_VALP(src_ipv4, typeof(&src_ipv4.v), p,
"%pI4");
PRINT_MASKED_VALP(dst_ipv4, typeof(&dst_ipv4.v), p,
"%pI4");
} else if ((ethertype.m == 0xffff && ethertype.v == ETH_P_IPV6) ||
(ip_version.m == 0xf && ip_version.v == 6)) {
static const struct in6_addr full_ones = {
.in6_u.u6_addr32 = {__constant_htonl(0xffffffff),
__constant_htonl(0xffffffff),
__constant_htonl(0xffffffff),
__constant_htonl(0xffffffff)},
};
DECLARE_MASK_VAL(struct in6_addr, src_ipv6);
DECLARE_MASK_VAL(struct in6_addr, dst_ipv6);
memcpy(src_ipv6.m.in6_u.u6_addr8,
MLX5_ADDR_OF(fte_match_set_lyr_2_4, mask,
src_ipv4_src_ipv6.ipv6_layout.ipv6),
sizeof(src_ipv6.m));
memcpy(dst_ipv6.m.in6_u.u6_addr8,
MLX5_ADDR_OF(fte_match_set_lyr_2_4, mask,
dst_ipv4_dst_ipv6.ipv6_layout.ipv6),
sizeof(dst_ipv6.m));
memcpy(src_ipv6.v.in6_u.u6_addr8,
MLX5_ADDR_OF(fte_match_set_lyr_2_4, value,
src_ipv4_src_ipv6.ipv6_layout.ipv6),
sizeof(src_ipv6.v));
memcpy(dst_ipv6.v.in6_u.u6_addr8,
MLX5_ADDR_OF(fte_match_set_lyr_2_4, value,
Annotation
- Immediate include surface: `fs_tracepoint.h`, `linux/stringify.h`.
- Detected declarations: `function DECLARE_MASK_VAL`, `function print_lyr_2_4_hdrs`, `function print_misc_parameters_hdrs`.
- Atlas domain: Driver Families / drivers/net.
- 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.