tools/testing/selftests/net/can/test_raw_filter.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/can/test_raw_filter.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/net/can/test_raw_filter.c- Extension
.c- Size
- 9108 bytes
- Lines
- 406
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
stdio.hstdlib.hunistd.hstring.hsys/types.hsys/socket.hsys/ioctl.hsys/time.hnet/if.hlinux/if.hlinux/can.hlinux/can/raw.hkselftest_harness.h
Detected Declarations
function send_can_framesfunction filterfunction main
Annotated Snippet
if (i == variant->exp_num_rx) {
ASSERT_EQ(ret, 0)
TH_LOG("too many frames received");
} else {
ASSERT_NE(ret, 0)
TH_LOG("too few frames received");
ret = read(self->sock, &frame, sizeof(frame));
ASSERT_GE(ret, 0)
TH_LOG("failed to read frame %d, err: %d", i, errno);
TH_LOG("rx: can_id = 0x%08X rx = %d", frame.can_id, i);
ASSERT_EQ(ID, frame.can_id & CAN_SFF_MASK)
TH_LOG("received wrong can_id");
ASSERT_EQ(variant->testcase, frame.data[0])
TH_LOG("received wrong test case");
ASSERT_EQ(frame.can_id & ~CAN_ERR_MASK,
variant->exp_flags[i])
TH_LOG("received unexpected flags");
}
}
}
int main(int argc, char **argv)
{
char *ifname = getenv("CANIF");
if (!ifname) {
printf("CANIF environment variable must contain the test interface\n");
return KSFT_FAIL;
}
strncpy(CANIF, ifname, sizeof(CANIF) - 1);
return test_harness_run(argc, argv);
}
Annotation
- Immediate include surface: `stdio.h`, `stdlib.h`, `unistd.h`, `string.h`, `sys/types.h`, `sys/socket.h`, `sys/ioctl.h`, `sys/time.h`.
- Detected declarations: `function send_can_frames`, `function filter`, `function main`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.