diff options
Diffstat (limited to 'include/linux/netdevice.h')
| -rw-r--r-- | include/linux/netdevice.h | 75 |
1 files changed, 61 insertions, 14 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index bc747e5d7138..9264139bd8df 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -187,7 +187,7 @@ struct hh_cache | |||
| 187 | { | 187 | { |
| 188 | struct hh_cache *hh_next; /* Next entry */ | 188 | struct hh_cache *hh_next; /* Next entry */ |
| 189 | atomic_t hh_refcnt; /* number of users */ | 189 | atomic_t hh_refcnt; /* number of users */ |
| 190 | unsigned short hh_type; /* protocol identifier, f.e ETH_P_IP | 190 | __be16 hh_type; /* protocol identifier, f.e ETH_P_IP |
| 191 | * NOTE: For VLANs, this will be the | 191 | * NOTE: For VLANs, this will be the |
| 192 | * encapuslated type. --BLG | 192 | * encapuslated type. --BLG |
| 193 | */ | 193 | */ |
| @@ -313,8 +313,15 @@ struct net_device | |||
| 313 | 313 | ||
| 314 | /* Segmentation offload features */ | 314 | /* Segmentation offload features */ |
| 315 | #define NETIF_F_GSO_SHIFT 16 | 315 | #define NETIF_F_GSO_SHIFT 16 |
| 316 | #define NETIF_F_GSO_MASK 0xffff0000 | ||
| 316 | #define NETIF_F_TSO (SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT) | 317 | #define NETIF_F_TSO (SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT) |
| 317 | #define NETIF_F_UFO (SKB_GSO_UDPV4 << NETIF_F_GSO_SHIFT) | 318 | #define NETIF_F_UFO (SKB_GSO_UDP << NETIF_F_GSO_SHIFT) |
| 319 | #define NETIF_F_GSO_ROBUST (SKB_GSO_DODGY << NETIF_F_GSO_SHIFT) | ||
| 320 | #define NETIF_F_TSO_ECN (SKB_GSO_TCP_ECN << NETIF_F_GSO_SHIFT) | ||
| 321 | #define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT) | ||
| 322 | |||
| 323 | /* List of features with software fallbacks. */ | ||
| 324 | #define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6) | ||
| 318 | 325 | ||
| 319 | #define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM) | 326 | #define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM) |
| 320 | #define NETIF_F_ALL_CSUM (NETIF_F_IP_CSUM | NETIF_F_GEN_CSUM) | 327 | #define NETIF_F_ALL_CSUM (NETIF_F_IP_CSUM | NETIF_F_GEN_CSUM) |
| @@ -327,7 +334,6 @@ struct net_device | |||
| 327 | 334 | ||
| 328 | 335 | ||
| 329 | struct net_device_stats* (*get_stats)(struct net_device *dev); | 336 | struct net_device_stats* (*get_stats)(struct net_device *dev); |
| 330 | struct iw_statistics* (*get_wireless_stats)(struct net_device *dev); | ||
| 331 | 337 | ||
| 332 | /* List of functions to handle Wireless Extensions (instead of ioctl). | 338 | /* List of functions to handle Wireless Extensions (instead of ioctl). |
| 333 | * See <net/iw_handler.h> for details. Jean II */ | 339 | * See <net/iw_handler.h> for details. Jean II */ |
| @@ -335,7 +341,7 @@ struct net_device | |||
| 335 | /* Instance data managed by the core of Wireless Extensions. */ | 341 | /* Instance data managed by the core of Wireless Extensions. */ |
| 336 | struct iw_public_data * wireless_data; | 342 | struct iw_public_data * wireless_data; |
| 337 | 343 | ||
| 338 | struct ethtool_ops *ethtool_ops; | 344 | const struct ethtool_ops *ethtool_ops; |
| 339 | 345 | ||
| 340 | /* | 346 | /* |
| 341 | * This marks the end of the "visible" part of the structure. All | 347 | * This marks the end of the "visible" part of the structure. All |
| @@ -543,7 +549,9 @@ struct packet_type { | |||
| 543 | struct net_device *, | 549 | struct net_device *, |
| 544 | struct packet_type *, | 550 | struct packet_type *, |
| 545 | struct net_device *); | 551 | struct net_device *); |
| 546 | struct sk_buff *(*gso_segment)(struct sk_buff *skb, int sg); | 552 | struct sk_buff *(*gso_segment)(struct sk_buff *skb, |
| 553 | int features); | ||
| 554 | int (*gso_send_check)(struct sk_buff *skb); | ||
| 547 | void *af_packet_priv; | 555 | void *af_packet_priv; |
| 548 | struct list_head list; | 556 | struct list_head list; |
| 549 | }; | 557 | }; |
| @@ -699,7 +707,6 @@ extern int dev_hard_start_xmit(struct sk_buff *skb, | |||
| 699 | 707 | ||
| 700 | extern void dev_init(void); | 708 | extern void dev_init(void); |
| 701 | 709 | ||
| 702 | extern int netdev_nit; | ||
| 703 | extern int netdev_budget; | 710 | extern int netdev_budget; |
| 704 | 711 | ||
| 705 | /* Called by rtnetlink.c:rtnl_unlock() */ | 712 | /* Called by rtnetlink.c:rtnl_unlock() */ |
| @@ -919,10 +926,10 @@ static inline void netif_tx_lock_bh(struct net_device *dev) | |||
| 919 | 926 | ||
| 920 | static inline int netif_tx_trylock(struct net_device *dev) | 927 | static inline int netif_tx_trylock(struct net_device *dev) |
| 921 | { | 928 | { |
| 922 | int err = spin_trylock(&dev->_xmit_lock); | 929 | int ok = spin_trylock(&dev->_xmit_lock); |
| 923 | if (!err) | 930 | if (likely(ok)) |
| 924 | dev->xmit_lock_owner = smp_processor_id(); | 931 | dev->xmit_lock_owner = smp_processor_id(); |
| 925 | return err; | 932 | return ok; |
| 926 | } | 933 | } |
| 927 | 934 | ||
| 928 | static inline void netif_tx_unlock(struct net_device *dev) | 935 | static inline void netif_tx_unlock(struct net_device *dev) |
| @@ -968,8 +975,8 @@ extern void dev_mcast_init(void); | |||
| 968 | extern int netdev_max_backlog; | 975 | extern int netdev_max_backlog; |
| 969 | extern int weight_p; | 976 | extern int weight_p; |
| 970 | extern int netdev_set_master(struct net_device *dev, struct net_device *master); | 977 | extern int netdev_set_master(struct net_device *dev, struct net_device *master); |
| 971 | extern int skb_checksum_help(struct sk_buff *skb, int inward); | 978 | extern int skb_checksum_help(struct sk_buff *skb); |
| 972 | extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, int sg); | 979 | extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features); |
| 973 | #ifdef CONFIG_BUG | 980 | #ifdef CONFIG_BUG |
| 974 | extern void netdev_rx_csum_fault(struct net_device *dev); | 981 | extern void netdev_rx_csum_fault(struct net_device *dev); |
| 975 | #else | 982 | #else |
| @@ -989,11 +996,51 @@ extern void dev_seq_stop(struct seq_file *seq, void *v); | |||
| 989 | 996 | ||
| 990 | extern void linkwatch_run_queue(void); | 997 | extern void linkwatch_run_queue(void); |
| 991 | 998 | ||
| 999 | static inline int net_gso_ok(int features, int gso_type) | ||
| 1000 | { | ||
| 1001 | int feature = gso_type << NETIF_F_GSO_SHIFT; | ||
| 1002 | return (features & feature) == feature; | ||
| 1003 | } | ||
| 1004 | |||
| 1005 | static inline int skb_gso_ok(struct sk_buff *skb, int features) | ||
| 1006 | { | ||
| 1007 | return net_gso_ok(features, skb_shinfo(skb)->gso_type); | ||
| 1008 | } | ||
| 1009 | |||
| 992 | static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb) | 1010 | static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb) |
| 993 | { | 1011 | { |
| 994 | int feature = skb_shinfo(skb)->gso_type << NETIF_F_GSO_SHIFT; | 1012 | return skb_is_gso(skb) && |
| 995 | return skb_shinfo(skb)->gso_size && | 1013 | (!skb_gso_ok(skb, dev->features) || |
| 996 | (dev->features & feature) != feature; | 1014 | unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); |
| 1015 | } | ||
| 1016 | |||
| 1017 | /* On bonding slaves other than the currently active slave, suppress | ||
| 1018 | * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and | ||
| 1019 | * ARP on active-backup slaves with arp_validate enabled. | ||
| 1020 | */ | ||
| 1021 | static inline int skb_bond_should_drop(struct sk_buff *skb) | ||
| 1022 | { | ||
| 1023 | struct net_device *dev = skb->dev; | ||
| 1024 | struct net_device *master = dev->master; | ||
| 1025 | |||
| 1026 | if (master && | ||
| 1027 | (dev->priv_flags & IFF_SLAVE_INACTIVE)) { | ||
| 1028 | if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && | ||
| 1029 | skb->protocol == __constant_htons(ETH_P_ARP)) | ||
| 1030 | return 0; | ||
| 1031 | |||
| 1032 | if (master->priv_flags & IFF_MASTER_ALB) { | ||
| 1033 | if (skb->pkt_type != PACKET_BROADCAST && | ||
| 1034 | skb->pkt_type != PACKET_MULTICAST) | ||
| 1035 | return 0; | ||
| 1036 | } | ||
| 1037 | if (master->priv_flags & IFF_MASTER_8023AD && | ||
| 1038 | skb->protocol == __constant_htons(ETH_P_SLOW)) | ||
| 1039 | return 0; | ||
| 1040 | |||
| 1041 | return 1; | ||
| 1042 | } | ||
| 1043 | return 0; | ||
| 997 | } | 1044 | } |
| 998 | 1045 | ||
| 999 | #endif /* __KERNEL__ */ | 1046 | #endif /* __KERNEL__ */ |
