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.h41
1 files changed, 35 insertions, 6 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 85f99f60deea..50a4719512ed 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -320,6 +320,9 @@ struct net_device
320#define NETIF_F_TSO_ECN (SKB_GSO_TCP_ECN << 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) 321#define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT)
322 322
323 /* List of features with software fallbacks. */
324#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6)
325
323#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)
324#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)
325 328
@@ -549,6 +552,7 @@ struct packet_type {
549 struct net_device *); 552 struct net_device *);
550 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 553 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
551 int features); 554 int features);
555 int (*gso_send_check)(struct sk_buff *skb);
552 void *af_packet_priv; 556 void *af_packet_priv;
553 struct list_head list; 557 struct list_head list;
554}; 558};
@@ -923,10 +927,10 @@ static inline void netif_tx_lock_bh(struct net_device *dev)
923 927
924static inline int netif_tx_trylock(struct net_device *dev) 928static inline int netif_tx_trylock(struct net_device *dev)
925{ 929{
926 int err = spin_trylock(&dev->_xmit_lock); 930 int ok = spin_trylock(&dev->_xmit_lock);
927 if (!err) 931 if (likely(ok))
928 dev->xmit_lock_owner = smp_processor_id(); 932 dev->xmit_lock_owner = smp_processor_id();
929 return err; 933 return ok;
930} 934}
931 935
932static inline void netif_tx_unlock(struct net_device *dev) 936static inline void netif_tx_unlock(struct net_device *dev)
@@ -1001,13 +1005,38 @@ static inline int net_gso_ok(int features, int gso_type)
1001 1005
1002static inline int skb_gso_ok(struct sk_buff *skb, int features) 1006static inline int skb_gso_ok(struct sk_buff *skb, int features)
1003{ 1007{
1004 return net_gso_ok(features, skb_shinfo(skb)->gso_size ? 1008 return net_gso_ok(features, skb_shinfo(skb)->gso_type);
1005 skb_shinfo(skb)->gso_type : 0);
1006} 1009}
1007 1010
1008static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb) 1011static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
1009{ 1012{
1010 return !skb_gso_ok(skb, dev->features); 1013 return skb_is_gso(skb) &&
1014 (!skb_gso_ok(skb, dev->features) ||
1015 unlikely(skb->ip_summed != CHECKSUM_HW));
1016}
1017
1018/* On bonding slaves other than the currently active slave, suppress
1019 * duplicates except for 802.3ad ETH_P_SLOW and alb non-mcast/bcast.
1020 */
1021static 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 (master->priv_flags & IFF_MASTER_ALB) {
1029 if (skb->pkt_type != PACKET_BROADCAST &&
1030 skb->pkt_type != PACKET_MULTICAST)
1031 return 0;
1032 }
1033 if (master->priv_flags & IFF_MASTER_8023AD &&
1034 skb->protocol == __constant_htons(ETH_P_SLOW))
1035 return 0;
1036
1037 return 1;
1038 }
1039 return 0;
1011} 1040}
1012 1041
1013#endif /* __KERNEL__ */ 1042#endif /* __KERNEL__ */