net/core/dev.h

Source file repositories/reference/linux-study-clean/net/core/dev.h

File Facts

System
Linux kernel
Corpus path
net/core/dev.h
Extension
.h
Size
12926 bytes
Lines
408
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 sd_flow_limit {
	struct rcu_head		rcu;
	unsigned int		count;
	u8			log_buckets;
	unsigned int		history_head;
	u16			history[FLOW_LIMIT_HISTORY];
	u8			buckets[];
};

extern int netdev_flow_limit_table_len;

struct napi_struct *
netdev_napi_by_id_lock(struct net *net, unsigned int napi_id);
struct net_device *dev_get_by_napi_id(unsigned int napi_id);

struct net_device *netdev_put_lock(struct net_device *dev, struct net *net,
				   netdevice_tracker *tracker);

static inline struct net_device *
__netdev_put_lock(struct net_device *dev, struct net *net)
{
	return netdev_put_lock(dev, net, NULL);
}

struct net_device *
netdev_xa_find_lock(struct net *net, struct net_device *dev,
		    unsigned long *index);

DEFINE_FREE(netdev_unlock, struct net_device *, if (_T) netdev_unlock(_T));

#define for_each_netdev_lock_scoped(net, var_name, ifindex)		\
	for (struct net_device *var_name __free(netdev_unlock) = NULL;	\
	     (var_name = netdev_xa_find_lock(net, var_name, &ifindex)); \
	     ifindex++)

struct net_device *
netdev_get_by_index_lock_ops_compat(struct net *net, int ifindex);
struct net_device *
netdev_xa_find_lock_ops_compat(struct net *net, struct net_device *dev,
			       unsigned long *index);

DEFINE_FREE(netdev_unlock_ops_compat, struct net_device *,
	    if (_T) netdev_unlock_ops_compat(_T));

#define for_each_netdev_lock_ops_compat_scoped(net, var_name, ifindex)	\
	for (struct net_device *var_name __free(netdev_unlock_ops_compat) = NULL; \
	     (var_name = netdev_xa_find_lock_ops_compat(net, var_name,	\
							&ifindex));	\
	     ifindex++)

#ifdef CONFIG_PROC_FS
int __init dev_proc_init(void);
#else
#define dev_proc_init() 0
#endif

void linkwatch_init_dev(struct net_device *dev);
void linkwatch_run_queue(void);

void dev_addr_flush(struct net_device *dev);
int dev_addr_init(struct net_device *dev);
void dev_addr_check(struct net_device *dev);
void __hw_addr_flush(struct netdev_hw_addr_list *list);

#if IS_ENABLED(CONFIG_NET_SHAPER)
void net_shaper_flush_netdev(struct net_device *dev);
void net_shaper_set_real_num_tx_queues(struct net_device *dev,
				       unsigned int txq);
#else
static inline void net_shaper_flush_netdev(struct net_device *dev) {}
static inline void net_shaper_set_real_num_tx_queues(struct net_device *dev,
						     unsigned int txq) {}
#endif

/* sysctls not referred to from outside net/core/ */
extern int		netdev_unregister_timeout_secs;
extern int		weight_p;
extern int		dev_weight_rx_bias;
extern int		dev_weight_tx_bias;

extern struct rw_semaphore dev_addr_sem;

/* rtnl helpers */
extern struct list_head net_todo_list;
void netdev_run_todo(void);

int netdev_queue_config_validate(struct net_device *dev, int rxq_idx,
				 struct netdev_queue_config *qcfg,
				 struct netlink_ext_ack *extack);

Annotation

Implementation Notes