aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/netdevice.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r--include/linux/netdevice.h79
1 files changed, 53 insertions, 26 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 6151e903eef0..f8898a435dc5 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -144,8 +144,6 @@ static inline bool dev_xmit_complete(int rc)
144# else 144# else
145# define LL_MAX_HEADER 96 145# define LL_MAX_HEADER 96
146# endif 146# endif
147#elif IS_ENABLED(CONFIG_TR)
148# define LL_MAX_HEADER 48
149#else 147#else
150# define LL_MAX_HEADER 32 148# define LL_MAX_HEADER 32
151#endif 149#endif
@@ -211,6 +209,7 @@ struct netdev_hw_addr {
211#define NETDEV_HW_ADDR_T_UNICAST 4 209#define NETDEV_HW_ADDR_T_UNICAST 4
212#define NETDEV_HW_ADDR_T_MULTICAST 5 210#define NETDEV_HW_ADDR_T_MULTICAST 5
213 bool global_use; 211 bool global_use;
212 int sync_cnt;
214 int refcount; 213 int refcount;
215 int synced; 214 int synced;
216 struct rcu_head rcu_head; 215 struct rcu_head rcu_head;
@@ -785,13 +784,13 @@ struct netdev_fcoe_hbainfo {
785 * 3. Update dev->stats asynchronously and atomically, and define 784 * 3. Update dev->stats asynchronously and atomically, and define
786 * neither operation. 785 * neither operation.
787 * 786 *
788 * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid); 787 * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, __be16 proto, u16t vid);
789 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) 788 * If device support VLAN filtering this function is called when a
790 * this function is called when a VLAN id is registered. 789 * VLAN id is registered.
791 * 790 *
792 * int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid); 791 * int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid);
793 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) 792 * If device support VLAN filtering this function is called when a
794 * this function is called when a VLAN id is unregistered. 793 * VLAN id is unregistered.
795 * 794 *
796 * void (*ndo_poll_controller)(struct net_device *dev); 795 * void (*ndo_poll_controller)(struct net_device *dev);
797 * 796 *
@@ -935,9 +934,9 @@ struct net_device_ops {
935 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); 934 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
936 935
937 int (*ndo_vlan_rx_add_vid)(struct net_device *dev, 936 int (*ndo_vlan_rx_add_vid)(struct net_device *dev,
938 unsigned short vid); 937 __be16 proto, u16 vid);
939 int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, 938 int (*ndo_vlan_rx_kill_vid)(struct net_device *dev,
940 unsigned short vid); 939 __be16 proto, u16 vid);
941#ifdef CONFIG_NET_POLL_CONTROLLER 940#ifdef CONFIG_NET_POLL_CONTROLLER
942 void (*ndo_poll_controller)(struct net_device *dev); 941 void (*ndo_poll_controller)(struct net_device *dev);
943 int (*ndo_netpoll_setup)(struct net_device *dev, 942 int (*ndo_netpoll_setup)(struct net_device *dev,
@@ -1073,6 +1072,8 @@ struct net_device {
1073 struct list_head dev_list; 1072 struct list_head dev_list;
1074 struct list_head napi_list; 1073 struct list_head napi_list;
1075 struct list_head unreg_list; 1074 struct list_head unreg_list;
1075 struct list_head upper_dev_list; /* List of upper devices */
1076
1076 1077
1077 /* currently active device features */ 1078 /* currently active device features */
1078 netdev_features_t features; 1079 netdev_features_t features;
@@ -1145,6 +1146,13 @@ struct net_device {
1145 spinlock_t addr_list_lock; 1146 spinlock_t addr_list_lock;
1146 struct netdev_hw_addr_list uc; /* Unicast mac addresses */ 1147 struct netdev_hw_addr_list uc; /* Unicast mac addresses */
1147 struct netdev_hw_addr_list mc; /* Multicast mac addresses */ 1148 struct netdev_hw_addr_list mc; /* Multicast mac addresses */
1149 struct netdev_hw_addr_list dev_addrs; /* list of device
1150 * hw addresses
1151 */
1152#ifdef CONFIG_SYSFS
1153 struct kset *queues_kset;
1154#endif
1155
1148 bool uc_promisc; 1156 bool uc_promisc;
1149 unsigned int promiscuity; 1157 unsigned int promiscuity;
1150 unsigned int allmulti; 1158 unsigned int allmulti;
@@ -1177,21 +1185,11 @@ struct net_device {
1177 * avoid dirtying this cache line. 1185 * avoid dirtying this cache line.
1178 */ 1186 */
1179 1187
1180 struct list_head upper_dev_list; /* List of upper devices */
1181
1182 /* Interface address info used in eth_type_trans() */ 1188 /* Interface address info used in eth_type_trans() */
1183 unsigned char *dev_addr; /* hw address, (before bcast 1189 unsigned char *dev_addr; /* hw address, (before bcast
1184 because most packets are 1190 because most packets are
1185 unicast) */ 1191 unicast) */
1186 1192
1187 struct netdev_hw_addr_list dev_addrs; /* list of device
1188 hw addresses */
1189
1190 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
1191
1192#ifdef CONFIG_SYSFS
1193 struct kset *queues_kset;
1194#endif
1195 1193
1196#ifdef CONFIG_RPS 1194#ifdef CONFIG_RPS
1197 struct netdev_rx_queue *_rx; 1195 struct netdev_rx_queue *_rx;
@@ -1202,18 +1200,14 @@ struct net_device {
1202 /* Number of RX queues currently active in device */ 1200 /* Number of RX queues currently active in device */
1203 unsigned int real_num_rx_queues; 1201 unsigned int real_num_rx_queues;
1204 1202
1205#ifdef CONFIG_RFS_ACCEL
1206 /* CPU reverse-mapping for RX completion interrupts, indexed
1207 * by RX queue number. Assigned by driver. This must only be
1208 * set if the ndo_rx_flow_steer operation is defined. */
1209 struct cpu_rmap *rx_cpu_rmap;
1210#endif
1211#endif 1203#endif
1212 1204
1213 rx_handler_func_t __rcu *rx_handler; 1205 rx_handler_func_t __rcu *rx_handler;
1214 void __rcu *rx_handler_data; 1206 void __rcu *rx_handler_data;
1215 1207
1216 struct netdev_queue __rcu *ingress_queue; 1208 struct netdev_queue __rcu *ingress_queue;
1209 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
1210
1217 1211
1218/* 1212/*
1219 * Cache lines mostly used on transmit path 1213 * Cache lines mostly used on transmit path
@@ -1235,6 +1229,12 @@ struct net_device {
1235#ifdef CONFIG_XPS 1229#ifdef CONFIG_XPS
1236 struct xps_dev_maps __rcu *xps_maps; 1230 struct xps_dev_maps __rcu *xps_maps;
1237#endif 1231#endif
1232#ifdef CONFIG_RFS_ACCEL
1233 /* CPU reverse-mapping for RX completion interrupts, indexed
1234 * by RX queue number. Assigned by driver. This must only be
1235 * set if the ndo_rx_flow_steer operation is defined. */
1236 struct cpu_rmap *rx_cpu_rmap;
1237#endif
1238 1238
1239 /* These may be needed for future network-power-down code. */ 1239 /* These may be needed for future network-power-down code. */
1240 1240
@@ -1475,6 +1475,11 @@ static inline void *netdev_priv(const struct net_device *dev)
1475 */ 1475 */
1476#define SET_NETDEV_DEVTYPE(net, devtype) ((net)->dev.type = (devtype)) 1476#define SET_NETDEV_DEVTYPE(net, devtype) ((net)->dev.type = (devtype))
1477 1477
1478/* Default NAPI poll() weight
1479 * Device drivers are strongly advised to not use bigger value
1480 */
1481#define NAPI_POLL_WEIGHT 64
1482
1478/** 1483/**
1479 * netif_napi_add - initialize a napi context 1484 * netif_napi_add - initialize a napi context
1480 * @dev: network device 1485 * @dev: network device
@@ -1612,6 +1617,9 @@ extern seqcount_t devnet_rename_seq; /* Device rename seq */
1612 list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list) 1617 list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list)
1613#define for_each_netdev_continue_rcu(net, d) \ 1618#define for_each_netdev_continue_rcu(net, d) \
1614 list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list) 1619 list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list)
1620#define for_each_netdev_in_bond_rcu(bond, slave) \
1621 for_each_netdev_rcu(&init_net, slave) \
1622 if (netdev_master_upper_dev_get_rcu(slave) == bond)
1615#define net_device_entry(lh) list_entry(lh, struct net_device, dev_list) 1623#define net_device_entry(lh) list_entry(lh, struct net_device, dev_list)
1616 1624
1617static inline struct net_device *next_net_device(struct net_device *dev) 1625static inline struct net_device *next_net_device(struct net_device *dev)
@@ -1684,7 +1692,6 @@ extern int netdev_refcnt_read(const struct net_device *dev);
1684extern void free_netdev(struct net_device *dev); 1692extern void free_netdev(struct net_device *dev);
1685extern void synchronize_net(void); 1693extern void synchronize_net(void);
1686extern int init_dummy_netdev(struct net_device *dev); 1694extern int init_dummy_netdev(struct net_device *dev);
1687extern void netdev_resync_ops(struct net_device *dev);
1688 1695
1689extern struct net_device *dev_get_by_index(struct net *net, int ifindex); 1696extern struct net_device *dev_get_by_index(struct net *net, int ifindex);
1690extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); 1697extern struct net_device *__dev_get_by_index(struct net *net, int ifindex);
@@ -2621,6 +2628,7 @@ extern int dev_uc_add(struct net_device *dev, const unsigned char *addr);
2621extern int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr); 2628extern int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr);
2622extern int dev_uc_del(struct net_device *dev, const unsigned char *addr); 2629extern int dev_uc_del(struct net_device *dev, const unsigned char *addr);
2623extern int dev_uc_sync(struct net_device *to, struct net_device *from); 2630extern int dev_uc_sync(struct net_device *to, struct net_device *from);
2631extern int dev_uc_sync_multiple(struct net_device *to, struct net_device *from);
2624extern void dev_uc_unsync(struct net_device *to, struct net_device *from); 2632extern void dev_uc_unsync(struct net_device *to, struct net_device *from);
2625extern void dev_uc_flush(struct net_device *dev); 2633extern void dev_uc_flush(struct net_device *dev);
2626extern void dev_uc_init(struct net_device *dev); 2634extern void dev_uc_init(struct net_device *dev);
@@ -2632,6 +2640,7 @@ extern int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr);
2632extern int dev_mc_del(struct net_device *dev, const unsigned char *addr); 2640extern int dev_mc_del(struct net_device *dev, const unsigned char *addr);
2633extern int dev_mc_del_global(struct net_device *dev, const unsigned char *addr); 2641extern int dev_mc_del_global(struct net_device *dev, const unsigned char *addr);
2634extern int dev_mc_sync(struct net_device *to, struct net_device *from); 2642extern int dev_mc_sync(struct net_device *to, struct net_device *from);
2643extern int dev_mc_sync_multiple(struct net_device *to, struct net_device *from);
2635extern void dev_mc_unsync(struct net_device *to, struct net_device *from); 2644extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
2636extern void dev_mc_flush(struct net_device *dev); 2645extern void dev_mc_flush(struct net_device *dev);
2637extern void dev_mc_init(struct net_device *dev); 2646extern void dev_mc_init(struct net_device *dev);
@@ -2678,6 +2687,19 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features)
2678{ 2687{
2679 return __skb_gso_segment(skb, features, true); 2688 return __skb_gso_segment(skb, features, true);
2680} 2689}
2690__be16 skb_network_protocol(struct sk_buff *skb);
2691
2692static inline bool can_checksum_protocol(netdev_features_t features,
2693 __be16 protocol)
2694{
2695 return ((features & NETIF_F_GEN_CSUM) ||
2696 ((features & NETIF_F_V4_CSUM) &&
2697 protocol == htons(ETH_P_IP)) ||
2698 ((features & NETIF_F_V6_CSUM) &&
2699 protocol == htons(ETH_P_IPV6)) ||
2700 ((features & NETIF_F_FCOE_CRC) &&
2701 protocol == htons(ETH_P_FCOE)));
2702}
2681 2703
2682#ifdef CONFIG_BUG 2704#ifdef CONFIG_BUG
2683extern void netdev_rx_csum_fault(struct net_device *dev); 2705extern void netdev_rx_csum_fault(struct net_device *dev);
@@ -2756,6 +2778,11 @@ static inline void netif_set_gso_max_size(struct net_device *dev,
2756 dev->gso_max_size = size; 2778 dev->gso_max_size = size;
2757} 2779}
2758 2780
2781static inline bool netif_is_bond_master(struct net_device *dev)
2782{
2783 return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING;
2784}
2785
2759static inline bool netif_is_bond_slave(struct net_device *dev) 2786static inline bool netif_is_bond_slave(struct net_device *dev)
2760{ 2787{
2761 return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING; 2788 return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING;