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.

Dependency Surface

Detected Declarations

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

Implementation Notes