diff options
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r-- | include/linux/netdevice.h | 113 |
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 | */ |
898 | struct net_device_ops { | 908 | struct 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 | ||
1397 | extern struct netdev_queue *netdev_pick_tx(struct net_device *dev, | 1414 | extern struct netdev_queue *netdev_pick_tx(struct net_device *dev, |
1398 | struct sk_buff *skb); | 1415 | struct sk_buff *skb); |
1416 | extern 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 | ||
2117 | extern int netif_set_xps_queue(struct net_device *dev, struct cpumask *mask, | ||
2118 | u16 index); | ||
2119 | #else | ||
2120 | static 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); | |||
2197 | extern void dev_set_group(struct net_device *, int); | 2227 | extern void dev_set_group(struct net_device *, int); |
2198 | extern int dev_set_mac_address(struct net_device *, | 2228 | extern int dev_set_mac_address(struct net_device *, |
2199 | struct sockaddr *); | 2229 | struct sockaddr *); |
2230 | extern int dev_change_carrier(struct net_device *, | ||
2231 | bool new_carrier); | ||
2200 | extern int dev_hard_start_xmit(struct sk_buff *skb, | 2232 | extern 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); | |||
2614 | extern void netdev_features_change(struct net_device *dev); | 2646 | extern void netdev_features_change(struct net_device *dev); |
2615 | /* Load a device via the kmod */ | 2647 | /* Load a device via the kmod */ |
2616 | extern void dev_load(struct net *net, const char *name); | 2648 | extern void dev_load(struct net *net, const char *name); |
2617 | extern void dev_mcast_init(void); | ||
2618 | extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, | 2649 | extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, |
2619 | struct rtnl_link_stats64 *storage); | 2650 | struct rtnl_link_stats64 *storage); |
2620 | extern void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64, | 2651 | extern void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64, |
@@ -2624,12 +2655,30 @@ extern int netdev_max_backlog; | |||
2624 | extern int netdev_tstamp_prequeue; | 2655 | extern int netdev_tstamp_prequeue; |
2625 | extern int weight_p; | 2656 | extern int weight_p; |
2626 | extern int bpf_jit_enable; | 2657 | extern int bpf_jit_enable; |
2627 | extern int netdev_set_master(struct net_device *dev, struct net_device *master); | 2658 | |
2628 | extern int netdev_set_bond_master(struct net_device *dev, | 2659 | extern bool netdev_has_upper_dev(struct net_device *dev, |
2629 | struct net_device *master); | 2660 | struct net_device *upper_dev); |
2661 | extern bool netdev_has_any_upper_dev(struct net_device *dev); | ||
2662 | extern struct net_device *netdev_master_upper_dev_get(struct net_device *dev); | ||
2663 | extern struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev); | ||
2664 | extern int netdev_upper_dev_link(struct net_device *dev, | ||
2665 | struct net_device *upper_dev); | ||
2666 | extern int netdev_master_upper_dev_link(struct net_device *dev, | ||
2667 | struct net_device *upper_dev); | ||
2668 | extern void netdev_upper_dev_unlink(struct net_device *dev, | ||
2669 | struct net_device *upper_dev); | ||
2630 | extern int skb_checksum_help(struct sk_buff *skb); | 2670 | extern int skb_checksum_help(struct sk_buff *skb); |
2631 | extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, | 2671 | extern struct sk_buff *__skb_gso_segment(struct sk_buff *skb, |
2632 | netdev_features_t features); | 2672 | netdev_features_t features, bool tx_path); |
2673 | extern struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb, | ||
2674 | netdev_features_t features); | ||
2675 | |||
2676 | static inline | ||
2677 | struct 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 |
2634 | extern void netdev_rx_csum_fault(struct net_device *dev); | 2683 | extern void netdev_rx_csum_fault(struct net_device *dev); |
2635 | #else | 2684 | #else |
@@ -2642,9 +2691,9 @@ extern void net_enable_timestamp(void); | |||
2642 | extern void net_disable_timestamp(void); | 2691 | extern void net_disable_timestamp(void); |
2643 | 2692 | ||
2644 | #ifdef CONFIG_PROC_FS | 2693 | #ifdef CONFIG_PROC_FS |
2645 | extern void *dev_seq_start(struct seq_file *seq, loff_t *pos); | 2694 | extern int __init dev_proc_init(void); |
2646 | extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos); | 2695 | #else |
2647 | extern void dev_seq_stop(struct seq_file *seq, void *v); | 2696 | #define dev_proc_init() 0 |
2648 | #endif | 2697 | #endif |
2649 | 2698 | ||
2650 | extern int netdev_class_create_file(struct class_attribute *class_attr); | 2699 | extern 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 */ |