net/dsa/tag_xrs700x.c
Source file repositories/reference/linux-study-clean/net/dsa/tag_xrs700x.c
File Facts
- System
- Linux kernel
- Corpus path
net/dsa/tag_xrs700x.c- Extension
.c- Size
- 1299 bytes
- Lines
- 62
- 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/bitops.htag.h
Detected Declarations
function Copyright
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* XRS700x tag format handling
* Copyright (c) 2008-2009 Marvell Semiconductor
* Copyright (c) 2020 NovaTech LLC
*/
#include <linux/bitops.h>
#include "tag.h"
#define XRS700X_NAME "xrs700x"
static struct sk_buff *xrs700x_xmit(struct sk_buff *skb, struct net_device *dev)
{
u8 *trailer;
trailer = skb_put(skb, 1);
trailer[0] = dsa_xmit_port_mask(skb, dev);
return skb;
}
static struct sk_buff *xrs700x_rcv(struct sk_buff *skb, struct net_device *dev)
{
int source_port;
u8 *trailer;
trailer = skb_tail_pointer(skb) - 1;
source_port = ffs((int)trailer[0]) - 1;
if (source_port < 0)
return NULL;
skb->dev = dsa_conduit_find_user(dev, 0, source_port);
if (!skb->dev)
return NULL;
if (pskb_trim_rcsum(skb, skb->len - 1))
return NULL;
/* Frame is forwarded by hardware, don't forward in software. */
dsa_default_offload_fwd_mark(skb);
return skb;
}
static const struct dsa_device_ops xrs700x_netdev_ops = {
.name = XRS700X_NAME,
.proto = DSA_TAG_PROTO_XRS700X,
.xmit = xrs700x_xmit,
.rcv = xrs700x_rcv,
.needed_tailroom = 1,
};
MODULE_DESCRIPTION("DSA tag driver for XRS700x switches");
MODULE_LICENSE("GPL");
MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_XRS700X, XRS700X_NAME);
module_dsa_tag_driver(xrs700x_netdev_ops);
Annotation
- Immediate include surface: `linux/bitops.h`, `tag.h`.
- Detected declarations: `function Copyright`.
- 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.