net/dsa/tag_yt921x.c
Source file repositories/reference/linux-study-clean/net/dsa/tag_yt921x.c
File Facts
- System
- Linux kernel
- Corpus path
net/dsa/tag_yt921x.c- Extension
.c- Size
- 4560 bytes
- Lines
- 169
- 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/etherdevice.htag.h
Detected Declarations
enum yt921x_tag_codefunction yt921x_tag_xmitfunction yt921x_tag_rcv
Annotated Snippet
switch (code) {
case YT921X_TAG_CODE_FORWARD:
case YT921X_TAG_CODE_PORT_COPY:
case YT921X_TAG_CODE_FDB_COPY:
/* Already forwarded by hardware */
dsa_default_offload_fwd_mark(skb);
break;
case YT921X_TAG_CODE_ACL:
case YT921X_TAG_CODE_UNK_UCAST:
case YT921X_TAG_CODE_UNK_MCAST:
/* NOTE: hardware doesn't distinguish between TRAP (copy
* to CPU only) and COPY (forward and copy to CPU). In
* order to perform a soft switch, NEVER use COPY action
* in the switch driver.
*/
break;
default:
dev_warn_ratelimited(&netdev->dev,
"Unknown code 0x%02x\n", code);
break;
}
}
/* Remove YT921x tag and update checksum */
skb_pull_rcsum(skb, YT921X_TAG_LEN);
dsa_strip_etype_header(skb, YT921X_TAG_LEN);
return skb;
}
static const struct dsa_device_ops yt921x_netdev_ops = {
.name = YT921X_TAG_NAME,
.proto = DSA_TAG_PROTO_YT921X,
.xmit = yt921x_tag_xmit,
.rcv = yt921x_tag_rcv,
.needed_headroom = YT921X_TAG_LEN,
};
MODULE_DESCRIPTION("DSA tag driver for Motorcomm YT921x switches");
MODULE_LICENSE("GPL");
MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_YT921X, YT921X_TAG_NAME);
module_dsa_tag_driver(yt921x_netdev_ops);
Annotation
- Immediate include surface: `linux/etherdevice.h`, `tag.h`.
- Detected declarations: `enum yt921x_tag_code`, `function yt921x_tag_xmit`, `function yt921x_tag_rcv`.
- 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.