include/linux/if_team.h

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

File Facts

System
Linux kernel
Corpus path
include/linux/if_team.h
Extension
.h
Size
8354 bytes
Lines
328
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct team_pcpu_stats {
	u64_stats_t		rx_packets;
	u64_stats_t		rx_bytes;
	u64_stats_t		rx_multicast;
	u64_stats_t		tx_packets;
	u64_stats_t		tx_bytes;
	struct u64_stats_sync	syncp;
	u32			rx_dropped;
	u32			tx_dropped;
	u32			rx_nohandler;
};

struct team;

struct team_port {
	struct net_device *dev;
	struct hlist_node tx_hlist; /* node in tx-enabled ports hash list */
	struct list_head list; /* node in ordinary list */
	struct team *team;
	int tx_index; /* index of tx enabled port. If disabled, -1 */
	bool rx_enabled;

	bool linkup; /* either state.linkup or user.linkup */

	struct {
		bool linkup;
		u32 speed;
		u8 duplex;
	} state;

	/* Values set by userspace */
	struct {
		bool linkup;
		bool linkup_enabled;
	} user;

	/* Custom gennetlink interface related flags */
	bool changed;
	bool removed;

	/*
	 * A place for storing original values of the device before it
	 * become a port.
	 */
	struct {
		unsigned char dev_addr[MAX_ADDR_LEN];
		unsigned int mtu;
	} orig;

#ifdef CONFIG_NET_POLL_CONTROLLER
	struct netpoll *np;
#endif

	s32 priority; /* lower number ~ higher priority */
	u16 queue_id;
	struct list_head qom_list; /* node in queue override mapping list */
	struct rcu_head	rcu;
	long mode_priv[];
};

static inline struct team_port *team_port_get_rcu(const struct net_device *dev)
{
	return rcu_dereference(dev->rx_handler_data);
}

static inline bool team_port_rx_enabled(struct team_port *port)
{
	return READ_ONCE(port->rx_enabled);
}

static inline bool team_port_tx_enabled(struct team_port *port)
{
	return READ_ONCE(port->tx_index) != -1;
}

static inline bool team_port_enabled(struct team_port *port)
{
	return team_port_rx_enabled(port) && team_port_tx_enabled(port);
}

static inline bool team_port_txable(struct team_port *port)
{
	return port->linkup && team_port_tx_enabled(port);
}

static inline bool team_port_dev_txable(const struct net_device *port_dev)
{
	struct team_port *port;
	bool txable;

Annotation

Implementation Notes