include/net/dsa_stubs.h

Source file repositories/reference/linux-study-clean/include/net/dsa_stubs.h

File Facts

System
Linux kernel
Corpus path
include/net/dsa_stubs.h
Extension
.h
Size
1314 bytes
Lines
49
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

struct dsa_stubs {
	int (*conduit_hwtstamp_validate)(struct net_device *dev,
					 const struct kernel_hwtstamp_config *config,
					 struct netlink_ext_ack *extack);
};

static inline int dsa_conduit_hwtstamp_validate(struct net_device *dev,
						const struct kernel_hwtstamp_config *config,
						struct netlink_ext_ack *extack)
{
	if (!netdev_uses_dsa(dev))
		return 0;

	/* rtnl_lock() is a sufficient guarantee, because as long as
	 * netdev_uses_dsa() returns true, the dsa_core module is still
	 * registered, and so, dsa_unregister_stubs() couldn't have run.
	 * For netdev_uses_dsa() to start returning false, it would imply that
	 * dsa_conduit_teardown() has executed, which requires rtnl_lock().
	 */
	ASSERT_RTNL();

	return dsa_stubs->conduit_hwtstamp_validate(dev, config, extack);
}

#else

static inline int dsa_conduit_hwtstamp_validate(struct net_device *dev,
						const struct kernel_hwtstamp_config *config,
						struct netlink_ext_ack *extack)
{
	return 0;
}

#endif

Annotation

Implementation Notes