tools/net/ynl/tests/tc.c
Source file repositories/reference/linux-study-clean/tools/net/ynl/tests/tc.c
File Facts
- System
- Linux kernel
- Corpus path
tools/net/ynl/tests/tc.c- Extension
.c- Size
- 9827 bytes
- Lines
- 410
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
sched.hstdio.hstring.hstdlib.harpa/inet.hlinux/pkt_sched.hlinux/tc_act/tc_vlan.hlinux/tc_act/tc_gact.hlinux/if_ether.hnet/if.hynl.hkselftest_harness.htc-user.h
Detected Declarations
function tc_qdisc_printfunction print_vlanfunction print_gactfunction flower_printfunction tc_filter_printfunction tc_clsact_addfunction tc_clsact_delfunction tc_filter_addfunction tc_filter_delfunction ynl_dump_foreachfunction ynl_dump_foreach
Annotated Snippet
if (q->options._present.fq_codel) {
struct tc_fq_codel_attrs *fq_codel;
struct tc_fq_codel_xstats *stats;
fq_codel = &q->options.fq_codel;
stats = q->stats2.app.fq_codel;
EXPECT_EQ(true,
fq_codel->_present.limit &&
fq_codel->_present.target &&
q->stats2.app._len.fq_codel);
if (fq_codel->_present.limit)
printf("limit: %dp ", fq_codel->limit);
if (fq_codel->_present.target)
printf("target: %dms ",
(fq_codel->target + 500) / 1000);
if (q->stats2.app._len.fq_codel)
printf("new_flow_cnt: %d ",
stats->qdisc_stats.new_flow_count);
was_fq_codel = true;
}
}
printf("\n");
return was_fq_codel;
}
static const char *vlan_act_name(struct tc_vlan *p)
{
switch (p->v_action) {
case TCA_VLAN_ACT_POP:
return "pop";
case TCA_VLAN_ACT_PUSH:
return "push";
case TCA_VLAN_ACT_MODIFY:
return "modify";
default:
break;
}
return "not supported";
}
static const char *gact_act_name(struct tc_gact *p)
{
switch (p->action) {
case TC_ACT_SHOT:
return "drop";
case TC_ACT_OK:
return "ok";
case TC_ACT_PIPE:
return "pipe";
default:
break;
}
return "not supported";
}
static void print_vlan(struct tc_act_vlan_attrs *vlan)
{
printf("%s ", vlan_act_name(vlan->parms));
if (vlan->_present.push_vlan_id)
printf("id %u ", vlan->push_vlan_id);
if (vlan->_present.push_vlan_protocol)
printf("protocol %#x ", ntohs(vlan->push_vlan_protocol));
if (vlan->_present.push_vlan_priority)
printf("priority %u ", vlan->push_vlan_priority);
}
static void print_gact(struct tc_act_gact_attrs *gact)
{
struct tc_gact *p = gact->parms;
printf("%s ", gact_act_name(p));
}
static void flower_print(struct tc_flower_attrs *flower, const char *kind)
{
struct tc_act_attrs *a;
unsigned int i;
ksft_print_msg("%s:\n", kind);
if (flower->_present.key_vlan_id)
ksft_print_msg(" vlan_id: %u\n", flower->key_vlan_id);
if (flower->_present.key_vlan_prio)
ksft_print_msg(" vlan_prio: %u\n", flower->key_vlan_prio);
if (flower->_present.key_num_of_vlans)
Annotation
- Immediate include surface: `sched.h`, `stdio.h`, `string.h`, `stdlib.h`, `arpa/inet.h`, `linux/pkt_sched.h`, `linux/tc_act/tc_vlan.h`, `linux/tc_act/tc_gact.h`.
- Detected declarations: `function tc_qdisc_print`, `function print_vlan`, `function print_gact`, `function flower_print`, `function tc_filter_print`, `function tc_clsact_add`, `function tc_clsact_del`, `function tc_filter_add`, `function tc_filter_del`, `function ynl_dump_foreach`.
- Atlas domain: Support Tooling And Documentation / tools.
- 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.