Lines Matching full:dev
8 * Version: @(#)dev.h 1.0.10 08/12/93
64 void netdev_set_default_ethtool_ops(struct net_device *dev,
222 #define netdev_uc_count(dev) netdev_hw_addr_list_count(&(dev)->uc) argument
223 #define netdev_uc_empty(dev) netdev_hw_addr_list_empty(&(dev)->uc) argument
224 #define netdev_for_each_uc_addr(ha, dev) \ argument
225 netdev_hw_addr_list_for_each(ha, &(dev)->uc)
227 #define netdev_mc_count(dev) netdev_hw_addr_list_count(&(dev)->mc) argument
228 #define netdev_mc_empty(dev) netdev_hw_addr_list_empty(&(dev)->mc) argument
229 #define netdev_for_each_mc_addr(ha, dev) \ argument
230 netdev_hw_addr_list_for_each(ha, &(dev)->mc)
248 * dev->hard_header_len ? (dev->hard_header_len +
254 #define LL_RESERVED_SPACE(dev) \ argument
255 ((((dev)->hard_header_len+(dev)->needed_headroom)&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
256 #define LL_RESERVED_SPACE_EXTRA(dev,extra) \ argument
257 ((((dev)->hard_header_len+(dev)->needed_headroom+(extra))&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
260 int (*create) (struct sk_buff *skb, struct net_device *dev,
266 const struct net_device *dev,
316 struct net_device *dev; member
346 * case skb->dev was changed by rx_handler.
367 * If the rx_handler changed skb->dev, to divert the skb to another
373 * are registered on exact device (ptype->dev == skb->dev).
375 * If the rx_handler didn't changed skb->dev, but want the skb to be normally
439 /* Try to reschedule poll. Called by dev->poll() after napi_complete(). */
561 struct net_device *dev; member
576 * please use this field instead of dev->trans_start
582 * (/sys/class/net/DEV/Q/trans_timeout)
683 bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index, u32 flow_id,
695 struct net_device *dev; member
777 typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
785 * int (*ndo_init)(struct net_device *dev);
791 * void (*ndo_uninit)(struct net_device *dev);
795 * int (*ndo_open)(struct net_device *dev);
799 * int (*ndo_stop)(struct net_device *dev);
804 * struct net_device *dev);
813 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb,
818 * void (*ndo_change_rx_flags)(struct net_device *dev, int flags);
822 * void (*ndo_set_rx_mode)(struct net_device *dev);
827 * int (*ndo_set_mac_address)(struct net_device *dev, void *addr);
832 * int (*ndo_validate_addr)(struct net_device *dev);
835 * int (*ndo_do_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd);
840 * int (*ndo_set_config)(struct net_device *dev, struct ifmap *map);
845 * int (*ndo_change_mtu)(struct net_device *dev, int new_mtu);
850 * void (*ndo_tx_timeout)(struct net_device *dev);
852 * for dev->watchdog ticks.
854 * struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev,
856 * struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
862 * (which should normally be dev->stats) and return a pointer to
865 * 3. Update dev->stats asynchronously and atomically, and define
868 * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, __be16 proto, u16 vid);
872 * int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, __be16 proto, u16 vid);
876 * void (*ndo_poll_controller)(struct net_device *dev);
879 * int (*ndo_set_vf_mac)(struct net_device *dev, int vf, u8* mac);
880 * int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan, u8 qos);
881 * int (*ndo_set_vf_rate)(struct net_device *dev, int vf, int min_tx_rate,
883 * int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting);
884 * int (*ndo_set_vf_trust)(struct net_device *dev, int vf, bool setting);
885 * int (*ndo_get_vf_config)(struct net_device *dev,
887 * int (*ndo_set_vf_link_state)(struct net_device *dev, int vf, int link_state);
888 * int (*ndo_set_vf_port)(struct net_device *dev, int vf,
894 * int (*ndo_set_vf_rss_query_en)(struct net_device *dev, int vf, bool setting);
895 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb);
896 * int (*ndo_setup_tc)(struct net_device *dev, u8 tc)
903 * int (*ndo_fcoe_enable)(struct net_device *dev);
908 * int (*ndo_fcoe_disable)(struct net_device *dev);
913 * int (*ndo_fcoe_ddp_setup)(struct net_device *dev, u16 xid,
920 * int (*ndo_fcoe_ddp_done)(struct net_device *dev, u16 xid);
925 * int (*ndo_fcoe_ddp_target)(struct net_device *dev, u16 xid,
932 * int (*ndo_fcoe_get_hbainfo)(struct net_device *dev,
939 * int (*ndo_fcoe_get_wwn)(struct net_device *dev, u64 *wwn, int type);
946 * int (*ndo_rx_flow_steer)(struct net_device *dev, const struct sk_buff *skb,
953 * int (*ndo_add_slave)(struct net_device *dev, struct net_device *slave_dev);
956 * int (*ndo_del_slave)(struct net_device *dev, struct net_device *slave_dev);
960 * netdev_features_t (*ndo_fix_features)(struct net_device *dev,
966 * int (*ndo_set_features)(struct net_device *dev, netdev_features_t features);
969 * Must return >0 or -errno if it changed dev->features itself.
972 * struct net_device *dev,
974 * Adds an FDB entry to dev for addr.
976 * struct net_device *dev,
978 * Deletes the FDB entry from dev coresponding to addr.
980 * struct net_device *dev, struct net_device *filter_dev,
985 * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh,
988 * struct net_device *dev, u32 filter_mask,
990 * int (*ndo_bridge_dellink)(struct net_device *dev, struct nlmsghdr *nlh,
993 * int (*ndo_change_carrier)(struct net_device *dev, bool new_carrier);
1001 * int (*ndo_get_phys_port_id)(struct net_device *dev,
1007 * void (*ndo_add_vxlan_port)(struct net_device *dev,
1014 * void (*ndo_del_vxlan_port)(struct net_device *dev,
1021 * struct net_device *dev)
1024 * to use for the offload and 'dev' is the net device that will
1033 * struct net_device *dev,
1039 * struct net_device *dev
1047 * int (*ndo_set_tx_maxrate)(struct net_device *dev,
1051 * int (*ndo_get_iflink)(const struct net_device *dev);
1053 * void (*ndo_change_proto_down)(struct net_device *dev,
1058 * int (*ndo_fill_metadata_dst)(struct net_device *dev, struct sk_buff *skb);
1065 int (*ndo_init)(struct net_device *dev);
1066 void (*ndo_uninit)(struct net_device *dev);
1067 int (*ndo_open)(struct net_device *dev);
1068 int (*ndo_stop)(struct net_device *dev);
1070 struct net_device *dev);
1071 u16 (*ndo_select_queue)(struct net_device *dev,
1075 void (*ndo_change_rx_flags)(struct net_device *dev,
1077 void (*ndo_set_rx_mode)(struct net_device *dev);
1078 int (*ndo_set_mac_address)(struct net_device *dev,
1080 int (*ndo_validate_addr)(struct net_device *dev);
1081 int (*ndo_do_ioctl)(struct net_device *dev,
1083 int (*ndo_set_config)(struct net_device *dev,
1085 int (*ndo_change_mtu)(struct net_device *dev,
1087 int (*ndo_neigh_setup)(struct net_device *dev,
1089 void (*ndo_tx_timeout) (struct net_device *dev);
1091 struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev,
1093 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
1095 int (*ndo_vlan_rx_add_vid)(struct net_device *dev,
1097 int (*ndo_vlan_rx_kill_vid)(struct net_device *dev,
1100 void (*ndo_poll_controller)(struct net_device *dev);
1101 int (*ndo_netpoll_setup)(struct net_device *dev,
1103 void (*ndo_netpoll_cleanup)(struct net_device *dev);
1106 int (*ndo_busy_poll)(struct napi_struct *dev);
1108 int (*ndo_set_vf_mac)(struct net_device *dev,
1110 int (*ndo_set_vf_vlan)(struct net_device *dev,
1112 int (*ndo_set_vf_rate)(struct net_device *dev,
1115 int (*ndo_set_vf_spoofchk)(struct net_device *dev,
1117 int (*ndo_set_vf_trust)(struct net_device *dev,
1119 int (*ndo_get_vf_config)(struct net_device *dev,
1122 int (*ndo_set_vf_link_state)(struct net_device *dev,
1124 int (*ndo_get_vf_stats)(struct net_device *dev,
1128 int (*ndo_set_vf_port)(struct net_device *dev,
1131 int (*ndo_get_vf_port)(struct net_device *dev,
1134 struct net_device *dev,
1136 int (*ndo_setup_tc)(struct net_device *dev, u8 tc);
1138 int (*ndo_fcoe_enable)(struct net_device *dev);
1139 int (*ndo_fcoe_disable)(struct net_device *dev);
1140 int (*ndo_fcoe_ddp_setup)(struct net_device *dev,
1144 int (*ndo_fcoe_ddp_done)(struct net_device *dev,
1146 int (*ndo_fcoe_ddp_target)(struct net_device *dev,
1150 int (*ndo_fcoe_get_hbainfo)(struct net_device *dev,
1157 int (*ndo_fcoe_get_wwn)(struct net_device *dev,
1162 int (*ndo_rx_flow_steer)(struct net_device *dev,
1167 int (*ndo_add_slave)(struct net_device *dev,
1169 int (*ndo_del_slave)(struct net_device *dev,
1171 netdev_features_t (*ndo_fix_features)(struct net_device *dev,
1173 int (*ndo_set_features)(struct net_device *dev,
1180 struct net_device *dev,
1186 struct net_device *dev,
1191 struct net_device *dev,
1195 int (*ndo_bridge_setlink)(struct net_device *dev,
1200 struct net_device *dev,
1203 int (*ndo_bridge_dellink)(struct net_device *dev,
1206 int (*ndo_change_carrier)(struct net_device *dev,
1208 int (*ndo_get_phys_port_id)(struct net_device *dev,
1210 int (*ndo_get_phys_port_name)(struct net_device *dev,
1212 void (*ndo_add_vxlan_port)(struct net_device *dev,
1215 void (*ndo_del_vxlan_port)(struct net_device *dev,
1220 struct net_device *dev);
1225 struct net_device *dev,
1227 int (*ndo_get_lock_subclass)(struct net_device *dev);
1229 struct net_device *dev,
1231 int (*ndo_set_tx_maxrate)(struct net_device *dev,
1234 int (*ndo_get_iflink)(const struct net_device *dev);
1235 int (*ndo_change_proto_down)(struct net_device *dev,
1237 int (*ndo_fill_metadata_dst)(struct net_device *dev,
1258 * @IFF_DONT_BRIDGE: disallow bridging this ether dev
1504 * @dev: Class/net/name entry
1754 void (*destructor)(struct net_device *dev);
1774 struct device dev; member
1803 #define to_net_dev(d) container_of(d, struct net_device, dev)
1808 int netdev_get_prio_tc_map(const struct net_device *dev, u32 prio) in netdev_get_prio_tc_map() argument
1810 return dev->prio_tc_map[prio & TC_BITMASK]; in netdev_get_prio_tc_map()
1814 int netdev_set_prio_tc_map(struct net_device *dev, u8 prio, u8 tc) in netdev_set_prio_tc_map() argument
1816 if (tc >= dev->num_tc) in netdev_set_prio_tc_map()
1819 dev->prio_tc_map[prio & TC_BITMASK] = tc & TC_BITMASK; in netdev_set_prio_tc_map()
1824 void netdev_reset_tc(struct net_device *dev) in netdev_reset_tc() argument
1826 dev->num_tc = 0; in netdev_reset_tc()
1827 memset(dev->tc_to_txq, 0, sizeof(dev->tc_to_txq)); in netdev_reset_tc()
1828 memset(dev->prio_tc_map, 0, sizeof(dev->prio_tc_map)); in netdev_reset_tc()
1832 int netdev_set_tc_queue(struct net_device *dev, u8 tc, u16 count, u16 offset) in netdev_set_tc_queue() argument
1834 if (tc >= dev->num_tc) in netdev_set_tc_queue()
1837 dev->tc_to_txq[tc].count = count; in netdev_set_tc_queue()
1838 dev->tc_to_txq[tc].offset = offset; in netdev_set_tc_queue()
1843 int netdev_set_num_tc(struct net_device *dev, u8 num_tc) in netdev_set_num_tc() argument
1848 dev->num_tc = num_tc; in netdev_set_num_tc()
1853 int netdev_get_num_tc(struct net_device *dev) in netdev_get_num_tc() argument
1855 return dev->num_tc; in netdev_get_num_tc()
1859 struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev, in netdev_get_tx_queue() argument
1862 return &dev->_tx[index]; in netdev_get_tx_queue()
1865 static inline struct netdev_queue *skb_get_tx_queue(const struct net_device *dev, in skb_get_tx_queue() argument
1868 return netdev_get_tx_queue(dev, skb_get_queue_mapping(skb)); in skb_get_tx_queue()
1871 static inline void netdev_for_each_tx_queue(struct net_device *dev, in netdev_for_each_tx_queue() argument
1879 for (i = 0; i < dev->num_tx_queues; i++) in netdev_for_each_tx_queue()
1880 f(dev, &dev->_tx[i], arg); in netdev_for_each_tx_queue()
1883 struct netdev_queue *netdev_pick_tx(struct net_device *dev,
1891 struct net *dev_net(const struct net_device *dev) in dev_net() argument
1893 return read_pnet(&dev->nd_net); in dev_net()
1897 void dev_net_set(struct net_device *dev, struct net *net) in dev_net_set() argument
1899 write_pnet(&dev->nd_net, net); in dev_net_set()
1902 static inline bool netdev_uses_dsa(struct net_device *dev) in netdev_uses_dsa() argument
1905 if (dev->dsa_ptr != NULL) in netdev_uses_dsa()
1906 return dsa_uses_tagged_protocol(dev->dsa_ptr); in netdev_uses_dsa()
1913 * @dev: network device
1917 static inline void *netdev_priv(const struct net_device *dev) in netdev_priv() argument
1919 return (char *)dev + ALIGN(sizeof(struct net_device), NETDEV_ALIGN); in netdev_priv()
1925 #define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev))
1931 #define SET_NETDEV_DEVTYPE(net, devtype) ((net)->dev.type = (devtype))
1940 * @dev: network device
1948 void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
2020 struct net_device *dev; /* NULL is wildcarded here */ member
2129 struct net_device *dev; member
2139 struct net_device *upper_dev; /* new upper dev */
2140 bool master; /* is upper dev master */
2145 struct net_device *dev) in netdev_notifier_info_init() argument
2147 info->dev = dev; in netdev_notifier_info_init()
2153 return info->dev; in netdev_notifier_info_to_dev()
2156 int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
2178 static inline struct net_device *next_net_device(struct net_device *dev) in next_net_device() argument
2183 net = dev_net(dev); in next_net_device()
2184 lh = dev->dev_list.next; in next_net_device()
2188 static inline struct net_device *next_net_device_rcu(struct net_device *dev) in next_net_device_rcu() argument
2193 net = dev_net(dev); in next_net_device_rcu()
2194 lh = rcu_dereference(list_next_rcu(&dev->dev_list)); in next_net_device_rcu()
2211 int netdev_boot_setup_check(struct net_device *dev);
2223 int dev_get_iflink(const struct net_device *dev);
2224 int dev_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb);
2230 int dev_alloc_name(struct net_device *dev, const char *name);
2231 int dev_open(struct net_device *dev);
2232 int dev_close(struct net_device *dev);
2234 void dev_disable_lro(struct net_device *dev);
2238 int register_netdevice(struct net_device *dev);
2239 void unregister_netdevice_queue(struct net_device *dev, struct list_head *head);
2241 static inline void unregister_netdevice(struct net_device *dev) in unregister_netdevice() argument
2243 unregister_netdevice_queue(dev, NULL); in unregister_netdevice()
2246 int netdev_refcnt_read(const struct net_device *dev);
2247 void free_netdev(struct net_device *dev);
2248 void netdev_freemem(struct net_device *dev);
2250 int init_dummy_netdev(struct net_device *dev);
2262 int dev_restart(struct net_device *dev);
2475 static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, in dev_hard_header() argument
2480 if (!dev->header_ops || !dev->header_ops->create) in dev_hard_header()
2483 return dev->header_ops->create(skb, dev, type, daddr, saddr, len); in dev_hard_header()
2489 const struct net_device *dev = skb->dev; in dev_parse_header() local
2491 if (!dev->header_ops || !dev->header_ops->parse) in dev_parse_header()
2493 return dev->header_ops->parse(skb, haddr); in dev_parse_header()
2496 typedef int gifconf_func_t(struct net_device * dev, char __user * bufptr, int len);
2572 static inline void netif_tx_schedule_all(struct net_device *dev) in netif_tx_schedule_all() argument
2576 for (i = 0; i < dev->num_tx_queues; i++) in netif_tx_schedule_all()
2577 netif_schedule_queue(netdev_get_tx_queue(dev, i)); in netif_tx_schedule_all()
2587 * @dev: network device
2591 static inline void netif_start_queue(struct net_device *dev) in netif_start_queue() argument
2593 netif_tx_start_queue(netdev_get_tx_queue(dev, 0)); in netif_start_queue()
2596 static inline void netif_tx_start_all_queues(struct net_device *dev) in netif_tx_start_all_queues() argument
2600 for (i = 0; i < dev->num_tx_queues; i++) { in netif_tx_start_all_queues()
2601 struct netdev_queue *txq = netdev_get_tx_queue(dev, i); in netif_tx_start_all_queues()
2610 * @dev: network device
2615 static inline void netif_wake_queue(struct net_device *dev) in netif_wake_queue() argument
2617 netif_tx_wake_queue(netdev_get_tx_queue(dev, 0)); in netif_wake_queue()
2620 static inline void netif_tx_wake_all_queues(struct net_device *dev) in netif_tx_wake_all_queues() argument
2624 for (i = 0; i < dev->num_tx_queues; i++) { in netif_tx_wake_all_queues()
2625 struct netdev_queue *txq = netdev_get_tx_queue(dev, i); in netif_tx_wake_all_queues()
2637 * @dev: network device
2642 static inline void netif_stop_queue(struct net_device *dev) in netif_stop_queue() argument
2644 netif_tx_stop_queue(netdev_get_tx_queue(dev, 0)); in netif_stop_queue()
2647 void netif_tx_stop_all_queues(struct net_device *dev);
2656 * @dev: network device
2660 static inline bool netif_queue_stopped(const struct net_device *dev) in netif_queue_stopped() argument
2662 return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0)); in netif_queue_stopped()
2736 * @dev: network device
2743 static inline void netdev_sent_queue(struct net_device *dev, unsigned int bytes) in netdev_sent_queue() argument
2745 netdev_tx_sent_queue(netdev_get_tx_queue(dev, 0), bytes); in netdev_sent_queue()
2774 * @dev: network device
2782 static inline void netdev_completed_queue(struct net_device *dev, in netdev_completed_queue() argument
2785 netdev_tx_completed_queue(netdev_get_tx_queue(dev, 0), pkts, bytes); in netdev_completed_queue()
2810 * @dev: network device
2816 static inline u16 netdev_cap_txqueue(struct net_device *dev, u16 queue_index) in netdev_cap_txqueue() argument
2818 if (unlikely(queue_index >= dev->real_num_tx_queues)) { in netdev_cap_txqueue()
2820 dev->name, queue_index, in netdev_cap_txqueue()
2821 dev->real_num_tx_queues); in netdev_cap_txqueue()
2830 * @dev: network device
2834 static inline bool netif_running(const struct net_device *dev) in netif_running() argument
2836 return test_bit(__LINK_STATE_START, &dev->state); in netif_running()
2848 * @dev: network device
2853 static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index) in netif_start_subqueue() argument
2855 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); in netif_start_subqueue()
2862 * @dev: network device
2867 static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index) in netif_stop_subqueue() argument
2869 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); in netif_stop_subqueue()
2875 * @dev: network device
2880 static inline bool __netif_subqueue_stopped(const struct net_device *dev, in __netif_subqueue_stopped() argument
2883 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); in __netif_subqueue_stopped()
2888 static inline bool netif_subqueue_stopped(const struct net_device *dev, in netif_subqueue_stopped() argument
2891 return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb)); in netif_subqueue_stopped()
2894 void netif_wake_subqueue(struct net_device *dev, u16 queue_index);
2897 int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask,
2900 static inline int netif_set_xps_queue(struct net_device *dev, in netif_set_xps_queue() argument
2908 u16 __skb_tx_hash(const struct net_device *dev, struct sk_buff *skb,
2912 * Returns a Tx hash for the given packet when dev->real_num_tx_queues is used
2915 static inline u16 skb_tx_hash(const struct net_device *dev, in skb_tx_hash() argument
2918 return __skb_tx_hash(dev, skb, dev->real_num_tx_queues); in skb_tx_hash()
2923 * @dev: network device
2927 static inline bool netif_is_multiqueue(const struct net_device *dev) in netif_is_multiqueue() argument
2929 return dev->num_tx_queues > 1; in netif_is_multiqueue()
2932 int netif_set_real_num_tx_queues(struct net_device *dev, unsigned int txq);
2935 int netif_set_real_num_rx_queues(struct net_device *dev, unsigned int rxq);
2937 static inline int netif_set_real_num_rx_queues(struct net_device *dev, in netif_set_real_num_rx_queues() argument
2948 struct net_device *dev = queue->dev; in get_netdev_rx_queue_index() local
2949 int index = queue - dev->_rx; in get_netdev_rx_queue_index()
2951 BUG_ON(index >= dev->num_rx_queues); in get_netdev_rx_queue_index()
3022 int netdev_rx_handler_register(struct net_device *dev,
3025 void netdev_rx_handler_unregister(struct net_device *dev);
3042 int dev_get_phys_port_id(struct net_device *dev,
3044 int dev_get_phys_port_name(struct net_device *dev,
3046 int dev_change_proto_down(struct net_device *dev, bool proto_down);
3047 struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev);
3048 struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
3050 int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
3051 int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
3052 bool is_skb_forwardable(struct net_device *dev, struct sk_buff *skb);
3061 * @dev: network device
3065 static inline void dev_put(struct net_device *dev) in dev_put() argument
3067 this_cpu_dec(*dev->pcpu_refcnt); in dev_put()
3072 * @dev: network device
3076 static inline void dev_hold(struct net_device *dev) in dev_hold() argument
3078 this_cpu_inc(*dev->pcpu_refcnt); in dev_hold()
3090 void linkwatch_init_dev(struct net_device *dev);
3091 void linkwatch_fire_event(struct net_device *dev);
3092 void linkwatch_forget_dev(struct net_device *dev);
3096 * @dev: network device
3100 static inline bool netif_carrier_ok(const struct net_device *dev) in netif_carrier_ok() argument
3102 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); in netif_carrier_ok()
3105 unsigned long dev_trans_start(struct net_device *dev);
3107 void __netdev_watchdog_up(struct net_device *dev);
3109 void netif_carrier_on(struct net_device *dev);
3111 void netif_carrier_off(struct net_device *dev);
3115 * @dev: network device
3126 static inline void netif_dormant_on(struct net_device *dev) in netif_dormant_on() argument
3128 if (!test_and_set_bit(__LINK_STATE_DORMANT, &dev->state)) in netif_dormant_on()
3129 linkwatch_fire_event(dev); in netif_dormant_on()
3134 * @dev: network device
3138 static inline void netif_dormant_off(struct net_device *dev) in netif_dormant_off() argument
3140 if (test_and_clear_bit(__LINK_STATE_DORMANT, &dev->state)) in netif_dormant_off()
3141 linkwatch_fire_event(dev); in netif_dormant_off()
3146 * @dev: network device
3150 static inline bool netif_dormant(const struct net_device *dev) in netif_dormant() argument
3152 return test_bit(__LINK_STATE_DORMANT, &dev->state); in netif_dormant()
3158 * @dev: network device
3162 static inline bool netif_oper_up(const struct net_device *dev) in netif_oper_up() argument
3164 return (dev->operstate == IF_OPER_UP || in netif_oper_up()
3165 dev->operstate == IF_OPER_UNKNOWN /* backward compat */); in netif_oper_up()
3170 * @dev: network device
3174 static inline bool netif_device_present(struct net_device *dev) in netif_device_present() argument
3176 return test_bit(__LINK_STATE_PRESENT, &dev->state); in netif_device_present()
3179 void netif_device_detach(struct net_device *dev);
3181 void netif_device_attach(struct net_device *dev);
3272 * @dev: network device
3276 static inline void netif_tx_lock(struct net_device *dev) in netif_tx_lock() argument
3281 spin_lock(&dev->tx_global_lock); in netif_tx_lock()
3283 for (i = 0; i < dev->num_tx_queues; i++) { in netif_tx_lock()
3284 struct netdev_queue *txq = netdev_get_tx_queue(dev, i); in netif_tx_lock()
3298 static inline void netif_tx_lock_bh(struct net_device *dev) in netif_tx_lock_bh() argument
3301 netif_tx_lock(dev); in netif_tx_lock_bh()
3304 static inline void netif_tx_unlock(struct net_device *dev) in netif_tx_unlock() argument
3308 for (i = 0; i < dev->num_tx_queues; i++) { in netif_tx_unlock()
3309 struct netdev_queue *txq = netdev_get_tx_queue(dev, i); in netif_tx_unlock()
3318 spin_unlock(&dev->tx_global_lock); in netif_tx_unlock()
3321 static inline void netif_tx_unlock_bh(struct net_device *dev) in netif_tx_unlock_bh() argument
3323 netif_tx_unlock(dev); in netif_tx_unlock_bh()
3327 #define HARD_TX_LOCK(dev, txq, cpu) { \ argument
3328 if ((dev->features & NETIF_F_LLTX) == 0) { \
3333 #define HARD_TX_TRYLOCK(dev, txq) \ argument
3334 (((dev->features & NETIF_F_LLTX) == 0) ? \
3338 #define HARD_TX_UNLOCK(dev, txq) { \ argument
3339 if ((dev->features & NETIF_F_LLTX) == 0) { \
3344 static inline void netif_tx_disable(struct net_device *dev) in netif_tx_disable() argument
3351 for (i = 0; i < dev->num_tx_queues; i++) { in netif_tx_disable()
3352 struct netdev_queue *txq = netdev_get_tx_queue(dev, i); in netif_tx_disable()
3361 static inline void netif_addr_lock(struct net_device *dev) in netif_addr_lock() argument
3363 spin_lock(&dev->addr_list_lock); in netif_addr_lock()
3366 static inline void netif_addr_lock_nested(struct net_device *dev) in netif_addr_lock_nested() argument
3370 if (dev->netdev_ops->ndo_get_lock_subclass) in netif_addr_lock_nested()
3371 subclass = dev->netdev_ops->ndo_get_lock_subclass(dev); in netif_addr_lock_nested()
3373 spin_lock_nested(&dev->addr_list_lock, subclass); in netif_addr_lock_nested()
3376 static inline void netif_addr_lock_bh(struct net_device *dev) in netif_addr_lock_bh() argument
3378 spin_lock_bh(&dev->addr_list_lock); in netif_addr_lock_bh()
3381 static inline void netif_addr_unlock(struct net_device *dev) in netif_addr_unlock() argument
3383 spin_unlock(&dev->addr_list_lock); in netif_addr_unlock()
3386 static inline void netif_addr_unlock_bh(struct net_device *dev) in netif_addr_unlock_bh() argument
3388 spin_unlock_bh(&dev->addr_list_lock); in netif_addr_unlock_bh()
3395 #define for_each_dev_addr(dev, ha) \ argument
3396 list_for_each_entry_rcu(ha, &dev->dev_addrs.list, list)
3400 void ether_setup(struct net_device *dev);
3414 int register_netdev(struct net_device *dev);
3415 void unregister_netdev(struct net_device *dev);
3423 struct net_device *dev,
3428 struct net_device *dev,
3434 int dev_addr_add(struct net_device *dev, const unsigned char *addr,
3436 int dev_addr_del(struct net_device *dev, const unsigned char *addr,
3438 void dev_addr_flush(struct net_device *dev);
3439 int dev_addr_init(struct net_device *dev);
3442 int dev_uc_add(struct net_device *dev, const unsigned char *addr);
3443 int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr);
3444 int dev_uc_del(struct net_device *dev, const unsigned char *addr);
3448 void dev_uc_flush(struct net_device *dev);
3449 void dev_uc_init(struct net_device *dev);
3453 * @dev: device to sync
3460 static inline int __dev_uc_sync(struct net_device *dev, in __dev_uc_sync() argument
3466 return __hw_addr_sync_dev(&dev->uc, dev, sync, unsync); in __dev_uc_sync()
3471 * @dev: device to sync
3476 static inline void __dev_uc_unsync(struct net_device *dev, in __dev_uc_unsync() argument
3480 __hw_addr_unsync_dev(&dev->uc, dev, unsync); in __dev_uc_unsync()
3484 int dev_mc_add(struct net_device *dev, const unsigned char *addr);
3485 int dev_mc_add_global(struct net_device *dev, const unsigned char *addr);
3486 int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr);
3487 int dev_mc_del(struct net_device *dev, const unsigned char *addr);
3488 int dev_mc_del_global(struct net_device *dev, const unsigned char *addr);
3492 void dev_mc_flush(struct net_device *dev);
3493 void dev_mc_init(struct net_device *dev);
3497 * @dev: device to sync
3504 static inline int __dev_mc_sync(struct net_device *dev, in __dev_mc_sync() argument
3510 return __hw_addr_sync_dev(&dev->mc, dev, sync, unsync); in __dev_mc_sync()
3515 * @dev: device to sync
3520 static inline void __dev_mc_unsync(struct net_device *dev, in __dev_mc_unsync() argument
3524 __hw_addr_unsync_dev(&dev->mc, dev, unsync); in __dev_mc_unsync()
3528 void dev_set_rx_mode(struct net_device *dev);
3529 void __dev_set_rx_mode(struct net_device *dev);
3530 int dev_set_promiscuity(struct net_device *dev, int inc);
3531 int dev_set_allmulti(struct net_device *dev, int inc);
3532 void netdev_state_change(struct net_device *dev);
3533 void netdev_notify_peers(struct net_device *dev);
3534 void netdev_features_change(struct net_device *dev);
3537 struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
3547 bool netdev_has_upper_dev(struct net_device *dev, struct net_device *upper_dev);
3548 struct net_device *netdev_upper_get_next_dev_rcu(struct net_device *dev,
3550 struct net_device *netdev_all_upper_get_next_dev_rcu(struct net_device *dev,
3554 #define netdev_for_each_upper_dev_rcu(dev, updev, iter) \ argument
3555 for (iter = &(dev)->adj_list.upper, \
3556 updev = netdev_upper_get_next_dev_rcu(dev, &(iter)); \
3558 updev = netdev_upper_get_next_dev_rcu(dev, &(iter)))
3561 #define netdev_for_each_all_upper_dev_rcu(dev, updev, iter) \ argument
3562 for (iter = &(dev)->all_adj_list.upper, \
3563 updev = netdev_all_upper_get_next_dev_rcu(dev, &(iter)); \
3565 updev = netdev_all_upper_get_next_dev_rcu(dev, &(iter)))
3567 void *netdev_lower_get_next_private(struct net_device *dev,
3569 void *netdev_lower_get_next_private_rcu(struct net_device *dev,
3572 #define netdev_for_each_lower_private(dev, priv, iter) \ argument
3573 for (iter = (dev)->adj_list.lower.next, \
3574 priv = netdev_lower_get_next_private(dev, &(iter)); \
3576 priv = netdev_lower_get_next_private(dev, &(iter)))
3578 #define netdev_for_each_lower_private_rcu(dev, priv, iter) \ argument
3579 for (iter = &(dev)->adj_list.lower, \
3580 priv = netdev_lower_get_next_private_rcu(dev, &(iter)); \
3582 priv = netdev_lower_get_next_private_rcu(dev, &(iter)))
3584 void *netdev_lower_get_next(struct net_device *dev,
3586 #define netdev_for_each_lower_dev(dev, ldev, iter) \ argument
3587 for (iter = &(dev)->adj_list.lower, \
3588 ldev = netdev_lower_get_next(dev, &(iter)); \
3590 ldev = netdev_lower_get_next(dev, &(iter)))
3593 void *netdev_lower_get_first_private_rcu(struct net_device *dev);
3594 struct net_device *netdev_master_upper_dev_get(struct net_device *dev);
3595 struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev);
3596 int netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev);
3597 int netdev_master_upper_dev_link(struct net_device *dev,
3599 int netdev_master_upper_dev_link_private(struct net_device *dev,
3602 void netdev_upper_dev_unlink(struct net_device *dev,
3604 void netdev_adjacent_rename_links(struct net_device *dev, char *oldname);
3605 void *netdev_lower_dev_get_private(struct net_device *dev,
3613 int dev_get_nest_level(struct net_device *dev,
3614 bool (*type_check)(struct net_device *dev));
3631 void netdev_bonding_info_change(struct net_device *dev,
3654 void netdev_rx_csum_fault(struct net_device *dev);
3656 static inline void netdev_rx_csum_fault(struct net_device *dev) in netdev_rx_csum_fault() argument
3671 struct sk_buff *skb, struct net_device *dev, in __netdev_start_xmit() argument
3675 return ops->ndo_start_xmit(skb, dev); in __netdev_start_xmit()
3678 static inline netdev_tx_t netdev_start_xmit(struct sk_buff *skb, struct net_device *dev, in netdev_start_xmit() argument
3681 const struct net_device_ops *ops = dev->netdev_ops; in netdev_start_xmit()
3684 rc = __netdev_start_xmit(ops, skb, dev, more); in netdev_start_xmit()
3708 const char *netdev_drivername(const struct net_device *dev);
3727 struct net_device *dev) in netdev_get_wanted_features() argument
3729 return (dev->features & ~dev->hw_features) | dev->wanted_features; in netdev_get_wanted_features()
3744 int __netdev_update_features(struct net_device *dev);
3745 void netdev_update_features(struct net_device *dev);
3746 void netdev_change_features(struct net_device *dev);
3749 struct net_device *dev);
3752 struct net_device *dev,
3792 static inline void netif_set_gso_max_size(struct net_device *dev, in netif_set_gso_max_size() argument
3795 dev->gso_max_size = size; in netif_set_gso_max_size()
3811 static inline bool netif_is_macvlan(struct net_device *dev) in netif_is_macvlan() argument
3813 return dev->priv_flags & IFF_MACVLAN; in netif_is_macvlan()
3816 static inline bool netif_is_macvlan_port(struct net_device *dev) in netif_is_macvlan_port() argument
3818 return dev->priv_flags & IFF_MACVLAN_PORT; in netif_is_macvlan_port()
3821 static inline bool netif_is_ipvlan(struct net_device *dev) in netif_is_ipvlan() argument
3823 return dev->priv_flags & IFF_IPVLAN_SLAVE; in netif_is_ipvlan()
3826 static inline bool netif_is_ipvlan_port(struct net_device *dev) in netif_is_ipvlan_port() argument
3828 return dev->priv_flags & IFF_IPVLAN_MASTER; in netif_is_ipvlan_port()
3831 static inline bool netif_is_bond_master(struct net_device *dev) in netif_is_bond_master() argument
3833 return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING; in netif_is_bond_master()
3836 static inline bool netif_is_bond_slave(struct net_device *dev) in netif_is_bond_slave() argument
3838 return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING; in netif_is_bond_slave()
3841 static inline bool netif_supports_nofcs(struct net_device *dev) in netif_supports_nofcs() argument
3843 return dev->priv_flags & IFF_SUPP_NOFCS; in netif_supports_nofcs()
3846 static inline bool netif_is_l3_master(const struct net_device *dev) in netif_is_l3_master() argument
3848 return dev->priv_flags & IFF_L3MDEV_MASTER; in netif_is_l3_master()
3851 static inline bool netif_is_l3_slave(const struct net_device *dev) in netif_is_l3_slave() argument
3853 return dev->priv_flags & IFF_L3MDEV_SLAVE; in netif_is_l3_slave()
3856 static inline bool netif_is_bridge_master(const struct net_device *dev) in netif_is_bridge_master() argument
3858 return dev->priv_flags & IFF_EBRIDGE; in netif_is_bridge_master()
3861 static inline bool netif_is_bridge_port(const struct net_device *dev) in netif_is_bridge_port() argument
3863 return dev->priv_flags & IFF_BRIDGE_PORT; in netif_is_bridge_port()
3866 static inline bool netif_is_ovs_master(const struct net_device *dev) in netif_is_ovs_master() argument
3868 return dev->priv_flags & IFF_OPENVSWITCH; in netif_is_ovs_master()
3872 static inline void netif_keep_dst(struct net_device *dev) in netif_keep_dst() argument
3874 dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM); in netif_keep_dst()
3883 static inline const char *netdev_name(const struct net_device *dev) in netdev_name() argument
3885 if (!dev->name[0] || strchr(dev->name, '%')) in netdev_name()
3887 return dev->name; in netdev_name()
3890 static inline const char *netdev_reg_state(const struct net_device *dev) in netdev_reg_state() argument
3892 switch (dev->reg_state) { in netdev_reg_state()
3901 WARN_ONCE(1, "%s: unknown reg_state %d\n", dev->name, dev->reg_state); in netdev_reg_state()
3906 void netdev_printk(const char *level, const struct net_device *dev,
3909 void netdev_emerg(const struct net_device *dev, const char *format, ...);
3911 void netdev_alert(const struct net_device *dev, const char *format, ...);
3913 void netdev_crit(const struct net_device *dev, const char *format, ...);
3915 void netdev_err(const struct net_device *dev, const char *format, ...);
3917 void netdev_warn(const struct net_device *dev, const char *format, ...);
3919 void netdev_notice(const struct net_device *dev, const char *format, ...);
3921 void netdev_info(const struct net_device *dev, const char *format, ...);
3946 #define netdev_vdbg(dev, format, args...) \ argument
3949 netdev_printk(KERN_DEBUG, dev, format, ##args); \
3959 #define netdev_WARN(dev, format, args...) \ argument
3960 WARN(1, "netdevice: %s%s\n" format, netdev_name(dev), \
3961 netdev_reg_state(dev), ##args)
3965 #define netif_printk(priv, type, level, dev, fmt, args...) \ argument
3968 netdev_printk(level, (dev), fmt, ##args); \
3971 #define netif_level(level, priv, type, dev, fmt, args...) \ argument
3974 netdev_##level(dev, fmt, ##args); \
3977 #define netif_emerg(priv, type, dev, fmt, args...) \ argument
3978 netif_level(emerg, priv, type, dev, fmt, ##args)
3979 #define netif_alert(priv, type, dev, fmt, args...) \ argument
3980 netif_level(alert, priv, type, dev, fmt, ##args)
3981 #define netif_crit(priv, type, dev, fmt, args...) \ argument
3982 netif_level(crit, priv, type, dev, fmt, ##args)
3983 #define netif_err(priv, type, dev, fmt, args...) \ argument
3984 netif_level(err, priv, type, dev, fmt, ##args)
3985 #define netif_warn(priv, type, dev, fmt, args...) \ argument
3986 netif_level(warn, priv, type, dev, fmt, ##args)
3987 #define netif_notice(priv, type, dev, fmt, args...) \ argument
3988 netif_level(notice, priv, type, dev, fmt, ##args)
3989 #define netif_info(priv, type, dev, fmt, args...) \ argument
3990 netif_level(info, priv, type, dev, fmt, ##args)
3999 #define netif_dbg(priv, type, dev, format, args...) \ argument
4000 netif_printk(priv, type, KERN_DEBUG, dev, format, ##args)
4002 #define netif_dbg(priv, type, dev, format, args...) \ argument
4005 netif_printk(priv, type, KERN_DEBUG, dev, format, ##args); \
4013 #define netif_vdbg(priv, type, dev, format, args...) \ argument
4016 netif_printk(priv, type, KERN_DEBUG, dev, format, ##args); \