---
name: "struct_net_device"
section: "9"
platform: "linux"
package: "linux-manual-4.9"
version: "4.9.228-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/struct_net_device"
---

# struct\_net\_device(9)

The DEVICE structure. Actually, this whole structure is a big mistake. It mixes I/O data with strictly “high-level” data, and it has to know about almost every data structure used in the INET module.

## NAME

struct\_net\_device - The DEVICE structure. Actually, this whole structure is a big mistake. It mixes I/O data with strictly “high-level” data, and it has to know about almost every data structure used in the INET module.

## SYNOPSIS

```
struct net_device {
  char name[IFNAMSIZ];
  struct hlist_node name_hlist;
  char * ifalias;
  unsigned long mem_end;
  unsigned long mem_start;
  unsigned long base_addr;
  int irq;
  atomic_t carrier_changes;
  unsigned long state;
  struct list_head dev_list;
  struct list_head napi_list;
  struct list_head unreg_list;
  struct list_head close_list;
  struct list_head ptype_all;
  struct list_head ptype_specific;
  struct {unnamed_struct};
  struct garp_port __rcu * garp_port;
  struct mrp_port __rcu * mrp_port;
  struct device dev;
  const struct attribute_group * sysfs_groups[4];
  const struct attribute_group * sysfs_rx_queue_group;
  const struct rtnl_link_ops * rtnl_link_ops;
#define GSO_MAX_SIZE		65536
  unsigned int gso_max_size;
#define GSO_MAX_SEGS		65535
  u16 gso_max_segs;
#ifdef CONFIG_DCB
  const struct dcbnl_rtnl_ops * dcbnl_ops;
#endif
  u8 num_tc;
  struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE];
  u8 prio_tc_map[TC_BITMASK + 1];
#if IS_ENABLED(CONFIG_FCOE)
  unsigned int fcoe_ddp_xid;
#endif
#if IS_ENABLED(CONFIG_CGROUP_NET_PRIO)
  struct netprio_map __rcu * priomap;
#endif
  struct phy_device * phydev;
  struct lock_class_key * qdisc_tx_busylock;
  struct lock_class_key * qdisc_running_key;
  bool proto_down;
};
```

## MEMBERS

name\[IFNAMSIZ\]

This is the first field of the “visible” part of this structure (i.e. as seen by users in the “Space.c” file). It is the name of the interface.

name\_hlist

Device name hash chain, please keep it close to name\[\]

ifalias

SNMP alias

mem\_end

Shared memory end

mem\_start

Shared memory start

base\_addr

Device I/O address

irq

Device IRQ number

carrier\_changes

Stats to monitor carrier on\<-\>off transitions

state

Generic network queuing layer state, see netdev\_state\_t

dev\_list

The global list of network devices

napi\_list

List entry used for polling NAPI devices

unreg\_list

List entry when we are unregistering the device; see the function unregister\_netdev

close\_list

List entry used when we are closing the device

ptype\_all

Device-specific packet handlers for all protocols

ptype\_specific

Device-specific, protocol-specific packet handlers

{unnamed\_struct}

anonymous

garp\_port

GARP

mrp\_port

MRP

dev

Class/net/name entry

sysfs\_groups\[4\]

Space for optional device, statistics and wireless sysfs groups

sysfs\_rx\_queue\_group

Space for optional per-rx queue attributes

rtnl\_link\_ops

Rtnl\_link\_ops

gso\_max\_size

Maximum size of generic segmentation offload

gso\_max\_segs

Maximum number of segments that can be passed to the NIC for GSO

dcbnl\_ops

Data Center Bridging netlink ops

num\_tc

Number of traffic classes in the net device

tc\_to\_txq\[TC\_MAX\_QUEUE\]

XXX: need comments on this one

prio\_tc\_map\[TC\_BITMASK + 1\]

XXX: need comments on this one

fcoe\_ddp\_xid

Max exchange id for FCoE LRO by ddp

priomap

XXX: need comments on this one

phydev

Physical device may attach itself for hardware timestamping

qdisc\_tx\_busylock

lockdep class annotating Qdisc-\>busylock spinlock

qdisc\_running\_key

lockdep class annotating Qdisc-\>running seqcount

proto\_down

protocol port state information can be sent to the switch driver and used to set the phys state of the switch port.

## DESCRIPTION

interface address info:

FIXME: cleanup struct net\_device such that network protocol info moves out.

## COPYRIGHT
