1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>struct net_device</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Networking and Network Devices APIs"><link rel="up" href="netdev.html#id-1.4.2" title="Driver Support"><link rel="prev" href="API-enum-netdev-priv-flags.html" title="enum netdev_priv_flags"><link rel="next" href="API-netdev-priv.html" title="netdev_priv"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">struct net_device</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-enum-netdev-priv-flags.html">Prev</a> </td><th width="60%" align="center">Driver Support</th><td width="20%" align="right"> <a accesskey="n" href="API-netdev-priv.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-struct-net-device"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>struct net_device — 
2     The DEVICE structure. Actually, this whole structure is a big mistake. It mixes I/O data with strictly <span class="quote">“<span class="quote">high-level</span>”</span> data, and it has to know about almost every data structure used in the INET module.
3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="programlisting">
4struct net_device {
5  char name[IFNAMSIZ];
6  struct hlist_node name_hlist;
7  char * ifalias;
8  unsigned long mem_end;
9  unsigned long mem_start;
10  unsigned long base_addr;
11  int irq;
12  atomic_t carrier_changes;
13  unsigned long state;
14  struct list_head dev_list;
15  struct list_head napi_list;
16  struct list_head unreg_list;
17  struct list_head close_list;
18  struct {unnamed_struct};
19  struct garp_port __rcu * garp_port;
20  struct mrp_port __rcu * mrp_port;
21  struct device dev;
22  const struct attribute_group * sysfs_groups[4];
23  const struct attribute_group * sysfs_rx_queue_group;
24  const struct rtnl_link_ops * rtnl_link_ops;
25#define GSO_MAX_SIZE		65536
26  unsigned int gso_max_size;
27#define GSO_MAX_SEGS		65535
28  u16 gso_max_segs;
29  u16 gso_min_segs;
30#ifdef CONFIG_DCB
31  const struct dcbnl_rtnl_ops * dcbnl_ops;
32#endif
33  u8 num_tc;
34  struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE];
35  u8 prio_tc_map[TC_BITMASK + 1];
36#if IS_ENABLED(CONFIG_FCOE)
37  unsigned int fcoe_ddp_xid;
38#endif
39#if IS_ENABLED(CONFIG_CGROUP_NET_PRIO)
40  struct netprio_map __rcu * priomap;
41#endif
42  struct phy_device * phydev;
43  struct lock_class_key * qdisc_tx_busylock;
44  bool proto_down;
45};  </pre></div><div class="refsect1"><a name="id-1.4.2.125.5"></a><h2>Members</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">name[IFNAMSIZ]</span></dt><dd><p>
46   This is the first field of the <span class="quote">“<span class="quote">visible</span>”</span> part of this structure
47   (i.e. as seen by users in the <span class="quote">“<span class="quote">Space.c</span>”</span> file).  It is the name
48   of the interface.
49      </p></dd><dt><span class="term">name_hlist</span></dt><dd><p>
50   Device name hash chain, please keep it close to name[]
51      </p></dd><dt><span class="term">ifalias</span></dt><dd><p>
52   SNMP alias
53      </p></dd><dt><span class="term">mem_end</span></dt><dd><p>
54   Shared memory end
55      </p></dd><dt><span class="term">mem_start</span></dt><dd><p>
56   Shared memory start
57      </p></dd><dt><span class="term">base_addr</span></dt><dd><p>
58   Device I/O address
59      </p></dd><dt><span class="term">irq</span></dt><dd><p>
60   Device IRQ number
61      </p></dd><dt><span class="term">carrier_changes</span></dt><dd><p>
62   Stats to monitor carrier on&lt;-&gt;off transitions
63      </p></dd><dt><span class="term">state</span></dt><dd><p>
64   Generic network queuing layer state, see netdev_state_t
65      </p></dd><dt><span class="term">dev_list</span></dt><dd><p>
66   The global list of network devices
67      </p></dd><dt><span class="term">napi_list</span></dt><dd><p>
68   List entry, that is used for polling napi devices
69      </p></dd><dt><span class="term">unreg_list</span></dt><dd><p>
70   List entry, that is used, when we are unregistering the
71   device, see the function unregister_netdev
72      </p></dd><dt><span class="term">close_list</span></dt><dd><p>
73   List entry, that is used, when we are closing the device
74      </p></dd><dt><span class="term">{unnamed_struct}</span></dt><dd><p>
75   anonymous
76      </p></dd><dt><span class="term">garp_port</span></dt><dd><p>
77   GARP
78      </p></dd><dt><span class="term">mrp_port</span></dt><dd><p>
79   MRP
80      </p></dd><dt><span class="term">dev</span></dt><dd><p>
81   Class/net/name entry
82      </p></dd><dt><span class="term">sysfs_groups[4]</span></dt><dd><p>
83   Space for optional device, statistics and wireless
84   sysfs groups
85      </p></dd><dt><span class="term">sysfs_rx_queue_group</span></dt><dd><p>
86   Space for optional per-rx queue attributes
87      </p></dd><dt><span class="term">rtnl_link_ops</span></dt><dd><p>
88   Rtnl_link_ops
89      </p></dd><dt><span class="term">gso_max_size</span></dt><dd><p>
90   Maximum size of generic segmentation offload
91      </p></dd><dt><span class="term">gso_max_segs</span></dt><dd><p>
92   Maximum number of segments that can be passed to the
93   NIC for GSO
94      </p></dd><dt><span class="term">gso_min_segs</span></dt><dd><p>
95   Minimum number of segments that can be passed to the
96   NIC for GSO
97      </p></dd><dt><span class="term">dcbnl_ops</span></dt><dd><p>
98   Data Center Bridging netlink ops
99      </p></dd><dt><span class="term">num_tc</span></dt><dd><p>
100   Number of traffic classes in the net device
101      </p></dd><dt><span class="term">tc_to_txq[TC_MAX_QUEUE]</span></dt><dd><p>
102   XXX: need comments on this one
103      </p></dd><dt><span class="term">prio_tc_map[TC_BITMASK + 1]</span></dt><dd><p>
104   need comments on this one
105      </p></dd><dt><span class="term">fcoe_ddp_xid</span></dt><dd><p>
106   Max exchange id for FCoE LRO by ddp
107      </p></dd><dt><span class="term">priomap</span></dt><dd><p>
108   XXX: need comments on this one
109      </p></dd><dt><span class="term">phydev</span></dt><dd><p>
110   Physical device may attach itself
111   for hardware timestamping
112      </p></dd><dt><span class="term">qdisc_tx_busylock</span></dt><dd><p>
113   XXX: need comments on this one
114      </p></dd><dt><span class="term">proto_down</span></dt><dd><p>
115   protocol port state information can be sent to the
116   switch driver and used to set the phys state of the
117   switch port.
118      </p></dd></dl></div></div><div class="refsect1"><a name="id-1.4.2.125.6"></a><h2>FIXME</h2><p>
119   cleanup struct net_device such that network protocol info
120   moves out.
121</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-enum-netdev-priv-flags.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="netdev.html#id-1.4.2">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-netdev-priv.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">enum netdev_priv_flags</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">netdev_priv</span></td></tr></table></div></body></html>
122