xref: /linux/Documentation/networking/net_cachelines/net_device.rst (revision 2b0cfa6e49566c8fa6759734cf821aa6e8271a9e)
1.. SPDX-License-Identifier: GPL-2.0
2.. Copyright (C) 2023 Google LLC
3
4===========================================
5net_device struct fast path usage breakdown
6===========================================
7
8Type                                Name                    fastpath_tx_access  fastpath_rx_access  Comments
9..struct                            ..net_device
10char                                name[16]                -                   -
11struct_netdev_name_node*            name_node
12struct_dev_ifalias*                 ifalias
13unsigned_long                       mem_end
14unsigned_long                       mem_start
15unsigned_long                       base_addr
16unsigned_long                       state
17struct_list_head                    dev_list
18struct_list_head                    napi_list
19struct_list_head                    unreg_list
20struct_list_head                    close_list
21struct_list_head                    ptype_all               read_mostly         -                   dev_nit_active(tx)
22struct_list_head                    ptype_specific                              read_mostly         deliver_ptype_list_skb/__netif_receive_skb_core(rx)
23struct                              adj_list
24unsigned_int                        flags                   read_mostly         read_mostly         __dev_queue_xmit,__dev_xmit_skb,ip6_output,__ip6_finish_output(tx);ip6_rcv_core(rx)
25xdp_features_t                      xdp_features
26unsigned_long_long                  priv_flags              read_mostly         -                   __dev_queue_xmit(tx)
27struct_net_device_ops*              netdev_ops              read_mostly         -                   netdev_core_pick_tx,netdev_start_xmit(tx)
28struct_xdp_metadata_ops*            xdp_metadata_ops
29int                                 ifindex                 -                   read_mostly         ip6_rcv_core
30unsigned_short                      gflags
31unsigned_short                      hard_header_len         read_mostly         read_mostly         ip6_xmit(tx);gro_list_prepare(rx)
32unsigned_int                        mtu                     read_mostly         -                   ip_finish_output2
33unsigned_short                      needed_headroom         read_mostly         -                   LL_RESERVED_SPACE/ip_finish_output2
34unsigned_short                      needed_tailroom
35netdev_features_t                   features                read_mostly         read_mostly         HARD_TX_LOCK,netif_skb_features,sk_setup_caps(tx);netif_elide_gro(rx)
36netdev_features_t                   hw_features
37netdev_features_t                   wanted_features
38netdev_features_t                   vlan_features
39netdev_features_t                   hw_enc_features         -                   -                   netif_skb_features
40netdev_features_t                   mpls_features
41netdev_features_t                   gso_partial_features    read_mostly                             gso_features_check
42unsigned_int                        min_mtu
43unsigned_int                        max_mtu
44unsigned_short                      type
45unsigned_char                       min_header_len
46unsigned_char                       name_assign_type
47int                                 group
48struct_net_device_stats             stats
49struct_net_device_core_stats*       core_stats
50atomic_t                            carrier_up_count
51atomic_t                            carrier_down_count
52struct_iw_handler_def*              wireless_handlers
53struct_iw_public_data*              wireless_data
54struct_ethtool_ops*                 ethtool_ops
55struct_l3mdev_ops*                  l3mdev_ops
56struct_ndisc_ops*                   ndisc_ops
57struct_xfrmdev_ops*                 xfrmdev_ops
58struct_tlsdev_ops*                  tlsdev_ops
59struct_header_ops*                  header_ops              read_mostly         -                   ip_finish_output2,ip6_finish_output2(tx)
60unsigned_char                       operstate
61unsigned_char                       link_mode
62unsigned_char                       if_port
63unsigned_char                       dma
64unsigned_char                       perm_addr[32]
65unsigned_char                       addr_assign_type
66unsigned_char                       addr_len
67unsigned_char                       upper_level
68unsigned_char                       lower_level
69unsigned_short                      neigh_priv_len
70unsigned_short                      padded
71unsigned_short                      dev_id
72unsigned_short                      dev_port
73spinlock_t                          addr_list_lock
74int                                 irq
75struct_netdev_hw_addr_list          uc
76struct_netdev_hw_addr_list          mc
77struct_netdev_hw_addr_list          dev_addrs
78struct_kset*                        queues_kset
79struct_list_head                    unlink_list
80unsigned_int                        promiscuity
81unsigned_int                        allmulti
82bool                                uc_promisc
83unsigned_char                       nested_level
84struct_in_device*                   ip_ptr                  read_mostly         read_mostly         __in_dev_get
85struct_inet6_dev*                   ip6_ptr                 read_mostly         read_mostly         __in6_dev_get
86struct_vlan_info*                   vlan_info
87struct_dsa_port*                    dsa_ptr
88struct_tipc_bearer*                 tipc_ptr
89void*                               atalk_ptr
90void*                               ax25_ptr
91struct_wireless_dev*                ieee80211_ptr
92struct_wpan_dev*                    ieee802154_ptr
93struct_mpls_dev*                    mpls_ptr
94struct_mctp_dev*                    mctp_ptr
95unsigned_char*                      dev_addr
96struct_netdev_queue*                _rx                     read_mostly         -                   netdev_get_rx_queue(rx)
97unsigned_int                        num_rx_queues
98unsigned_int                        real_num_rx_queues      -                   read_mostly         get_rps_cpu
99struct_bpf_prog*                    xdp_prog                -                   read_mostly         netif_elide_gro()
100unsigned_long                       gro_flush_timeout       -                   read_mostly         napi_complete_done
101int                                 napi_defer_hard_irqs    -                   read_mostly         napi_complete_done
102unsigned_int                        gro_max_size            -                   read_mostly         skb_gro_receive
103unsigned_int                        gro_ipv4_max_size       -                   read_mostly         skb_gro_receive
104rx_handler_func_t*                  rx_handler              read_mostly         -                   __netif_receive_skb_core
105void*                               rx_handler_data         read_mostly         -
106struct_netdev_queue*                ingress_queue           read_mostly         -
107struct_bpf_mprog_entry              tcx_ingress             -                   read_mostly         sch_handle_ingress
108struct_nf_hook_entries*             nf_hooks_ingress
109unsigned_char                       broadcast[32]
110struct_cpu_rmap*                    rx_cpu_rmap
111struct_hlist_node                   index_hlist
112struct_netdev_queue*                _tx                     read_mostly         -                   netdev_get_tx_queue(tx)
113unsigned_int                        num_tx_queues           -                   -
114unsigned_int                        real_num_tx_queues      read_mostly         -                   skb_tx_hash,netdev_core_pick_tx(tx)
115unsigned_int                        tx_queue_len
116spinlock_t                          tx_global_lock
117struct_xdp_dev_bulk_queue__percpu*  xdp_bulkq
118struct_xps_dev_maps*                xps_maps[2]             read_mostly         -                   __netif_set_xps_queue
119struct_bpf_mprog_entry              tcx_egress              read_mostly         -                   sch_handle_egress
120struct_nf_hook_entries*             nf_hooks_egress         read_mostly         -
121struct_hlist_head                   qdisc_hash[16]
122struct_timer_list                   watchdog_timer
123int                                 watchdog_timeo
124u32                                 proto_down_reason
125struct_list_head                    todo_list
126int__percpu*                        pcpu_refcnt
127refcount_t                          dev_refcnt
128struct_ref_tracker_dir              refcnt_tracker
129struct_list_head                    link_watch_list
130enum:8                              reg_state
131bool                                dismantle
132enum:16                             rtnl_link_state
133bool                                needs_free_netdev
134void*priv_destructor                struct_net_device
135struct_netpoll_info*                npinfo                  -                   read_mostly         napi_poll/napi_poll_lock
136possible_net_t                      nd_net                  -                   read_mostly         (dev_net)napi_busy_loop,tcp_v(4/6)_rcv,ip(v6)_rcv,ip(6)_input,ip(6)_input_finish
137void*                               ml_priv
138enum_netdev_ml_priv_type            ml_priv_type
139struct_pcpu_lstats__percpu*         lstats
140struct_pcpu_sw_netstats__percpu*    tstats
141struct_pcpu_dstats__percpu*         dstats
142struct_garp_port*                   garp_port
143struct_mrp_port*                    mrp_port
144struct_dm_hw_stat_delta*            dm_private
145struct_device                       dev                     -                   -
146struct_attribute_group*             sysfs_groups[4]
147struct_attribute_group*             sysfs_rx_queue_group
148struct_rtnl_link_ops*               rtnl_link_ops
149unsigned_int                        gso_max_size            read_mostly         -                   sk_dst_gso_max_size
150unsigned_int                        tso_max_size
151u16                                 gso_max_segs            read_mostly         -                   gso_max_segs
152u16                                 tso_max_segs
153unsigned_int                        gso_ipv4_max_size       read_mostly         -                   sk_dst_gso_max_size
154struct_dcbnl_rtnl_ops*              dcbnl_ops
155s16                                 num_tc                  read_mostly         -                   skb_tx_hash
156struct_netdev_tc_txq                tc_to_txq[16]           read_mostly         -                   skb_tx_hash
157u8                                  prio_tc_map[16]
158unsigned_int                        fcoe_ddp_xid
159struct_netprio_map*                 priomap
160struct_phy_device*                  phydev
161struct_sfp_bus*                     sfp_bus
162struct_lock_class_key*              qdisc_tx_busylock
163bool                                proto_down
164unsigned:1                          wol_enabled
165unsigned:1                          threaded                -                   -                   napi_poll(napi_enable,dev_set_threaded)
166struct_list_head                    net_notifier_list
167struct_macsec_ops*                  macsec_ops
168struct_udp_tunnel_nic_info*         udp_tunnel_nic_info
169struct_udp_tunnel_nic*              udp_tunnel_nic
170unsigned_int                        xdp_zc_max_segs
171struct_bpf_xdp_entity               xdp_state[3]
172u8                                  dev_addr_shadow[32]
173netdevice_tracker                   linkwatch_dev_tracker
174netdevice_tracker                   watchdog_dev_tracker
175netdevice_tracker                   dev_registered_tracker
176struct_rtnl_hw_stats64*             offload_xstats_l3
177struct_devlink_port*                devlink_port
178struct_dpll_pin*                    dpll_pin
179