aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/netdevice.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-01 17:08:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-01 17:08:52 -0400
commit73287a43cc79ca06629a88d1a199cd283f42456a (patch)
treeacf4456e260115bea77ee31a29f10ce17f0db45c /include/linux/netdevice.h
parent251df49db3327c64bf917bfdba94491fde2b4ee0 (diff)
parent20074f357da4a637430aec2879c9d864c5d2c23c (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller: "Highlights (1721 non-merge commits, this has to be a record of some sort): 1) Add 'random' mode to team driver, from Jiri Pirko and Eric Dumazet. 2) Make it so that any driver that supports configuration of multiple MAC addresses can provide the forwarding database add and del calls by providing a default implementation and hooking that up if the driver doesn't have an explicit set of handlers. From Vlad Yasevich. 3) Support GSO segmentation over tunnels and other encapsulating devices such as VXLAN, from Pravin B Shelar. 4) Support L2 GRE tunnels in the flow dissector, from Michael Dalton. 5) Implement Tail Loss Probe (TLP) detection in TCP, from Nandita Dukkipati. 6) In the PHY layer, allow supporting wake-on-lan in situations where the PHY registers have to be written for it to be configured. Use it to support wake-on-lan in mv643xx_eth. From Michael Stapelberg. 7) Significantly improve firewire IPV6 support, from YOSHIFUJI Hideaki. 8) Allow multiple packets to be sent in a single transmission using network coding in batman-adv, from Martin Hundebøll. 9) Add support for T5 cxgb4 chips, from Santosh Rastapur. 10) Generalize the VXLAN forwarding tables so that there is more flexibility in configurating various aspects of the endpoints. From David Stevens. 11) Support RSS and TSO in hardware over GRE tunnels in bxn2x driver, from Dmitry Kravkov. 12) Zero copy support in nfnelink_queue, from Eric Dumazet and Pablo Neira Ayuso. 13) Start adding networking selftests. 14) In situations of overload on the same AF_PACKET fanout socket, or per-cpu packet receive queue, minimize drop by distributing the load to other cpus/fanouts. From Willem de Bruijn and Eric Dumazet. 15) Add support for new payload offset BPF instruction, from Daniel Borkmann. 16) Convert several drivers over to mdoule_platform_driver(), from Sachin Kamat. 17) Provide a minimal BPF JIT image disassembler userspace tool, from Daniel Borkmann. 18) Rewrite F-RTO implementation in TCP to match the final specification of it in RFC4138 and RFC5682. From Yuchung Cheng. 19) Provide netlink socket diag of netlink sockets ("Yo dawg, I hear you like netlink, so I implemented netlink dumping of netlink sockets.") From Andrey Vagin. 20) Remove ugly passing of rtnetlink attributes into rtnl_doit functions, from Thomas Graf. 21) Allow userspace to be able to see if a configuration change occurs in the middle of an address or device list dump, from Nicolas Dichtel. 22) Support RFC3168 ECN protection for ipv6 fragments, from Hannes Frederic Sowa. 23) Increase accuracy of packet length used by packet scheduler, from Jason Wang. 24) Beginning set of changes to make ipv4/ipv6 fragment handling more scalable and less susceptible to overload and locking contention, from Jesper Dangaard Brouer. 25) Get rid of using non-type-safe NLMSG_* macros and use nlmsg_*() instead. From Hong Zhiguo. 26) Optimize route usage in IPVS by avoiding reference counting where possible, from Julian Anastasov. 27) Convert IPVS schedulers to RCU, also from Julian Anastasov. 28) Support cpu fanouts in xt_NFQUEUE netfilter target, from Holger Eitzenberger. 29) Network namespace support for nf_log, ebt_log, xt_LOG, ipt_ULOG, nfnetlink_log, and nfnetlink_queue. From Gao feng. 30) Implement RFC3168 ECN protection, from Hannes Frederic Sowa. 31) Support several new r8169 chips, from Hayes Wang. 32) Support tokenized interface identifiers in ipv6, from Daniel Borkmann. 33) Use usbnet_link_change() helper in USB net driver, from Ming Lei. 34) Add 802.1ad vlan offload support, from Patrick McHardy. 35) Support mmap() based netlink communication, also from Patrick McHardy. 36) Support HW timestamping in mlx4 driver, from Amir Vadai. 37) Rationalize AF_PACKET packet timestamping when transmitting, from Willem de Bruijn and Daniel Borkmann. 38) Bring parity to what's provided by /proc/net/packet socket dumping and the info provided by netlink socket dumping of AF_PACKET sockets. From Nicolas Dichtel. 39) Fix peeking beyond zero sized SKBs in AF_UNIX, from Benjamin Poirier" * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1722 commits) filter: fix va_list build error af_unix: fix a fatal race with bit fields bnx2x: Prevent memory leak when cnic is absent bnx2x: correct reading of speed capabilities net: sctp: attribute printl with __printf for gcc fmt checks netlink: kconfig: move mmap i/o into netlink kconfig netpoll: convert mutex into a semaphore netlink: Fix skb ref counting. net_sched: act_ipt forward compat with xtables mlx4_en: fix a build error on 32bit arches Revert "bnx2x: allow nvram test to run when device is down" bridge: avoid OOPS if root port not found drivers: net: cpsw: fix kernel warn on cpsw irq enable sh_eth: use random MAC address if no valid one supplied 3c509.c: call SET_NETDEV_DEV for all device types (ISA/ISAPnP/EISA) tg3: fix to append hardware time stamping flags unix/stream: fix peeking with an offset larger than data in queue unix/dgram: fix peeking with an offset larger than data in queue unix/dgram: peek beyond 0-sized skbs openvswitch: Remove unneeded ovs_netdev_get_ifindex() ...
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;