drivers/net/netdevsim/netdevsim.h

Source file repositories/reference/linux-study-clean/drivers/net/netdevsim/netdevsim.h

File Facts

System
Linux kernel
Corpus path
drivers/net/netdevsim/netdevsim.h
Extension
.h
Size
12063 bytes
Lines
488
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct nsim_sa {
	struct xfrm_state *xs;
	__be32 ipaddr[4];
	u32 key[4];
	u32 salt;
	bool used;
	bool crypt;
	bool rx;
};

struct nsim_ipsec {
	struct nsim_sa sa[NSIM_IPSEC_MAX_SA_COUNT];
	struct dentry *pfile;
	u32 count;
	u32 tx;
};

#define NSIM_MACSEC_MAX_SECY_COUNT 3
#define NSIM_MACSEC_MAX_RXSC_COUNT 1
struct nsim_rxsc {
	sci_t sci;
	bool used;
};

struct nsim_secy {
	sci_t sci;
	struct nsim_rxsc nsim_rxsc[NSIM_MACSEC_MAX_RXSC_COUNT];
	u8 nsim_rxsc_count;
	bool used;
};

struct nsim_macsec {
	struct nsim_secy nsim_secy[NSIM_MACSEC_MAX_SECY_COUNT];
	u8 nsim_secy_count;
};

struct nsim_vlan {
	DECLARE_BITMAP(ctag, VLAN_N_VID);
	DECLARE_BITMAP(stag, VLAN_N_VID);
};

struct nsim_ethtool_pauseparam {
	bool rx;
	bool tx;
	bool report_stats_rx;
	bool report_stats_tx;
};

struct nsim_ethtool {
	u32 get_err;
	u32 set_err;
	u32 channels;
	struct nsim_ethtool_pauseparam pauseparam;
	struct ethtool_coalesce coalesce;
	struct ethtool_ringparam ring;
	struct ethtool_fecparam fec;
};

struct nsim_rq {
	struct napi_struct napi;
	struct sk_buff_head skb_queue;
	struct page_pool *page_pool;
	struct hrtimer napi_timer;
};

struct netdevsim {
	struct net_device *netdev;
	struct nsim_dev *nsim_dev;
	struct nsim_dev_port *nsim_dev_port;
	struct mock_phc *phc;
	struct nsim_rq **rq;

	int rq_reset_mode;

	struct {
		atomic64_t rx_packets;
		atomic64_t rx_bytes;
		atomic64_t tx_packets;
		atomic64_t tx_bytes;
		struct psp_dev __rcu *dev;
		struct dentry *rereg;
		struct mutex rereg_lock;
		u32 spi;
		u32 assoc_cnt;
	} psp;

	struct nsim_bus_dev *nsim_bus_dev;

	struct bpf_prog	*bpf_offloaded;
	u32 bpf_offloaded_id;

Annotation

Implementation Notes