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.h113
1 files changed, 96 insertions, 17 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9ef07d0868b6..b3d00fa4b314 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -67,6 +67,8 @@ extern void netdev_set_default_ethtool_ops(struct net_device *dev,
67#define NET_ADDR_PERM 0 /* address is permanent (default) */ 67#define NET_ADDR_PERM 0 /* address is permanent (default) */
68#define NET_ADDR_RANDOM 1 /* address is generated randomly */ 68#define NET_ADDR_RANDOM 1 /* address is generated randomly */
69#define NET_ADDR_STOLEN 2 /* address is stolen from other device */ 69#define NET_ADDR_STOLEN 2 /* address is stolen from other device */
70#define NET_ADDR_SET 3 /* address is set using
71 * dev_set_mac_address() */
70 72
71/* Backlog congestion levels */ 73/* Backlog congestion levels */
72#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */ 74#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */
@@ -859,8 +861,7 @@ struct netdev_fcoe_hbainfo {
859 * flow_id is a flow ID to be passed to rps_may_expire_flow() later. 861 * flow_id is a flow ID to be passed to rps_may_expire_flow() later.
860 * Return the filter ID on success, or a negative error code. 862 * Return the filter ID on success, or a negative error code.
861 * 863 *
862 * Slave management functions (for bridge, bonding, etc). User should 864 * Slave management functions (for bridge, bonding, etc).
863 * call netdev_set_master() to set dev->master properly.
864 * int (*ndo_add_slave)(struct net_device *dev, struct net_device *slave_dev); 865 * int (*ndo_add_slave)(struct net_device *dev, struct net_device *slave_dev);
865 * Called to make another netdev an underling. 866 * Called to make another netdev an underling.
866 * 867 *
@@ -883,7 +884,8 @@ struct netdev_fcoe_hbainfo {
883 * struct net_device *dev, 884 * struct net_device *dev,
884 * const unsigned char *addr, u16 flags) 885 * const unsigned char *addr, u16 flags)
885 * Adds an FDB entry to dev for addr. 886 * Adds an FDB entry to dev for addr.
886 * int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev, 887 * int (*ndo_fdb_del)(struct ndmsg *ndm, struct nlattr *tb[],
888 * struct net_device *dev,
887 * const unsigned char *addr) 889 * const unsigned char *addr)
888 * Deletes the FDB entry from dev coresponding to addr. 890 * Deletes the FDB entry from dev coresponding to addr.
889 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, 891 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb,
@@ -894,6 +896,14 @@ struct netdev_fcoe_hbainfo {
894 * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh) 896 * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh)
895 * int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq, 897 * int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq,
896 * struct net_device *dev) 898 * struct net_device *dev)
899 *
900 * int (*ndo_change_carrier)(struct net_device *dev, bool new_carrier);
901 * Called to change device carrier. Soft-devices (like dummy, team, etc)
902 * which do not represent real hardware may define this to allow their
903 * userspace components to manage their virtual carrier state. Devices
904 * that determine carrier state from physical hardware properties (eg
905 * network cables) or protocol-dependent mechanisms (eg
906 * USB_CDC_NOTIFY_NETWORK_CONNECTION) should NOT implement this function.
897 */ 907 */
898struct net_device_ops { 908struct net_device_ops {
899 int (*ndo_init)(struct net_device *dev); 909 int (*ndo_init)(struct net_device *dev);
@@ -999,6 +1009,7 @@ struct net_device_ops {
999 const unsigned char *addr, 1009 const unsigned char *addr,
1000 u16 flags); 1010 u16 flags);
1001 int (*ndo_fdb_del)(struct ndmsg *ndm, 1011 int (*ndo_fdb_del)(struct ndmsg *ndm,
1012 struct nlattr *tb[],
1002 struct net_device *dev, 1013 struct net_device *dev,
1003 const unsigned char *addr); 1014 const unsigned char *addr);
1004 int (*ndo_fdb_dump)(struct sk_buff *skb, 1015 int (*ndo_fdb_dump)(struct sk_buff *skb,
@@ -1010,7 +1021,12 @@ struct net_device_ops {
1010 struct nlmsghdr *nlh); 1021 struct nlmsghdr *nlh);
1011 int (*ndo_bridge_getlink)(struct sk_buff *skb, 1022 int (*ndo_bridge_getlink)(struct sk_buff *skb,
1012 u32 pid, u32 seq, 1023 u32 pid, u32 seq,
1013 struct net_device *dev); 1024 struct net_device *dev,
1025 u32 filter_mask);
1026 int (*ndo_bridge_dellink)(struct net_device *dev,
1027 struct nlmsghdr *nlh);
1028 int (*ndo_change_carrier)(struct net_device *dev,
1029 bool new_carrier);
1014}; 1030};
1015 1031
1016/* 1032/*
@@ -1161,9 +1177,7 @@ struct net_device {
1161 * avoid dirtying this cache line. 1177 * avoid dirtying this cache line.
1162 */ 1178 */
1163 1179
1164 struct net_device *master; /* Pointer to master device of a group, 1180 struct list_head upper_dev_list; /* List of upper devices */
1165 * which this device is member of.
1166 */
1167 1181
1168 /* Interface address info used in eth_type_trans() */ 1182 /* Interface address info used in eth_type_trans() */
1169 unsigned char *dev_addr; /* hw address, (before bcast 1183 unsigned char *dev_addr; /* hw address, (before bcast
@@ -1263,7 +1277,7 @@ struct net_device {
1263 void (*destructor)(struct net_device *dev); 1277 void (*destructor)(struct net_device *dev);
1264 1278
1265#ifdef CONFIG_NETPOLL 1279#ifdef CONFIG_NETPOLL
1266 struct netpoll_info *npinfo; 1280 struct netpoll_info __rcu *npinfo;
1267#endif 1281#endif
1268 1282
1269#ifdef CONFIG_NET_NS 1283#ifdef CONFIG_NET_NS
@@ -1277,9 +1291,12 @@ struct net_device {
1277 struct pcpu_lstats __percpu *lstats; /* loopback stats */ 1291 struct pcpu_lstats __percpu *lstats; /* loopback stats */
1278 struct pcpu_tstats __percpu *tstats; /* tunnel stats */ 1292 struct pcpu_tstats __percpu *tstats; /* tunnel stats */
1279 struct pcpu_dstats __percpu *dstats; /* dummy stats */ 1293 struct pcpu_dstats __percpu *dstats; /* dummy stats */
1294 struct pcpu_vstats __percpu *vstats; /* veth stats */
1280 }; 1295 };
1281 /* GARP */ 1296 /* GARP */
1282 struct garp_port __rcu *garp_port; 1297 struct garp_port __rcu *garp_port;
1298 /* MRP */
1299 struct mrp_port __rcu *mrp_port;
1283 1300
1284 /* class/net/name entry */ 1301 /* class/net/name entry */
1285 struct device dev; 1302 struct device dev;
@@ -1396,6 +1413,7 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev,
1396 1413
1397extern struct netdev_queue *netdev_pick_tx(struct net_device *dev, 1414extern struct netdev_queue *netdev_pick_tx(struct net_device *dev,
1398 struct sk_buff *skb); 1415 struct sk_buff *skb);
1416extern u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb);
1399 1417
1400/* 1418/*
1401 * Net namespace inlines 1419 * Net namespace inlines
@@ -2095,6 +2113,18 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
2095 __netif_schedule(txq->qdisc); 2113 __netif_schedule(txq->qdisc);
2096} 2114}
2097 2115
2116#ifdef CONFIG_XPS
2117extern int netif_set_xps_queue(struct net_device *dev, struct cpumask *mask,
2118 u16 index);
2119#else
2120static inline int netif_set_xps_queue(struct net_device *dev,
2121 struct cpumask *mask,
2122 u16 index)
2123{
2124 return 0;
2125}
2126#endif
2127
2098/* 2128/*
2099 * Returns a Tx hash for the given packet when dev->real_num_tx_queues is used 2129 * Returns a Tx hash for the given packet when dev->real_num_tx_queues is used
2100 * as a distribution range limit for the returned value. 2130 * as a distribution range limit for the returned value.
@@ -2197,6 +2227,8 @@ extern int dev_set_mtu(struct net_device *, int);
2197extern void dev_set_group(struct net_device *, int); 2227extern void dev_set_group(struct net_device *, int);
2198extern int dev_set_mac_address(struct net_device *, 2228extern int dev_set_mac_address(struct net_device *,
2199 struct sockaddr *); 2229 struct sockaddr *);
2230extern int dev_change_carrier(struct net_device *,
2231 bool new_carrier);
2200extern int dev_hard_start_xmit(struct sk_buff *skb, 2232extern int dev_hard_start_xmit(struct sk_buff *skb,
2201 struct net_device *dev, 2233 struct net_device *dev,
2202 struct netdev_queue *txq); 2234 struct netdev_queue *txq);
@@ -2614,7 +2646,6 @@ extern void netdev_notify_peers(struct net_device *dev);
2614extern void netdev_features_change(struct net_device *dev); 2646extern void netdev_features_change(struct net_device *dev);
2615/* Load a device via the kmod */ 2647/* Load a device via the kmod */
2616extern void dev_load(struct net *net, const char *name); 2648extern void dev_load(struct net *net, const char *name);
2617extern void dev_mcast_init(void);
2618extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, 2649extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
2619 struct rtnl_link_stats64 *storage); 2650 struct rtnl_link_stats64 *storage);
2620extern void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64, 2651extern void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64,
@@ -2624,12 +2655,30 @@ extern int netdev_max_backlog;
2624extern int netdev_tstamp_prequeue; 2655extern int netdev_tstamp_prequeue;
2625extern int weight_p; 2656extern int weight_p;
2626extern int bpf_jit_enable; 2657extern int bpf_jit_enable;
2627extern int netdev_set_master(struct net_device *dev, struct net_device *master); 2658
2628extern int netdev_set_bond_master(struct net_device *dev, 2659extern bool netdev_has_upper_dev(struct net_device *dev,
2629 struct net_device *master); 2660 struct net_device *upper_dev);
2661extern bool netdev_has_any_upper_dev(struct net_device *dev);
2662extern struct net_device *netdev_master_upper_dev_get(struct net_device *dev);
2663extern struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev);
2664extern int netdev_upper_dev_link(struct net_device *dev,
2665 struct net_device *upper_dev);
2666extern int netdev_master_upper_dev_link(struct net_device *dev,
2667 struct net_device *upper_dev);
2668extern void netdev_upper_dev_unlink(struct net_device *dev,
2669 struct net_device *upper_dev);
2630extern int skb_checksum_help(struct sk_buff *skb); 2670extern int skb_checksum_help(struct sk_buff *skb);
2631extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, 2671extern struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
2632 netdev_features_t features); 2672 netdev_features_t features, bool tx_path);
2673extern struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,
2674 netdev_features_t features);
2675
2676static inline
2677struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features)
2678{
2679 return __skb_gso_segment(skb, features, true);
2680}
2681
2633#ifdef CONFIG_BUG 2682#ifdef CONFIG_BUG
2634extern void netdev_rx_csum_fault(struct net_device *dev); 2683extern void netdev_rx_csum_fault(struct net_device *dev);
2635#else 2684#else
@@ -2642,9 +2691,9 @@ extern void net_enable_timestamp(void);
2642extern void net_disable_timestamp(void); 2691extern void net_disable_timestamp(void);
2643 2692
2644#ifdef CONFIG_PROC_FS 2693#ifdef CONFIG_PROC_FS
2645extern void *dev_seq_start(struct seq_file *seq, loff_t *pos); 2694extern int __init dev_proc_init(void);
2646extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos); 2695#else
2647extern void dev_seq_stop(struct seq_file *seq, void *v); 2696#define dev_proc_init() 0
2648#endif 2697#endif
2649 2698
2650extern int netdev_class_create_file(struct class_attribute *class_attr); 2699extern int netdev_class_create_file(struct class_attribute *class_attr);
@@ -2846,4 +2895,34 @@ do { \
2846}) 2895})
2847#endif 2896#endif
2848 2897
2898/*
2899 * The list of packet types we will receive (as opposed to discard)
2900 * and the routines to invoke.
2901 *
2902 * Why 16. Because with 16 the only overlap we get on a hash of the
2903 * low nibble of the protocol value is RARP/SNAP/X.25.
2904 *
2905 * NOTE: That is no longer true with the addition of VLAN tags. Not
2906 * sure which should go first, but I bet it won't make much
2907 * difference if we are running VLANs. The good news is that
2908 * this protocol won't be in the list unless compiled in, so
2909 * the average user (w/out VLANs) will not be adversely affected.
2910 * --BLG
2911 *
2912 * 0800 IP
2913 * 8100 802.1Q VLAN
2914 * 0001 802.3
2915 * 0002 AX.25
2916 * 0004 802.2
2917 * 8035 RARP
2918 * 0005 SNAP
2919 * 0805 X.25
2920 * 0806 ARP
2921 * 8137 IPX
2922 * 0009 Localtalk
2923 * 86DD IPv6
2924 */
2925#define PTYPE_HASH_SIZE (16)
2926#define PTYPE_HASH_MASK (PTYPE_HASH_SIZE - 1)
2927
2849#endif /* _LINUX_NETDEVICE_H */ 2928#endif /* _LINUX_NETDEVICE_H */