Merge git://git.infradead.org/users/eparis/audit
[firefly-linux-kernel-4.4.55.git] / include / linux / netdevice.h
index 838407aea70503003e09c06fe17845f9e1c9d656..74fd5d37f15a472239c1c63cebe7ce9e59fc4c90 100644 (file)
@@ -998,6 +998,12 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
  *     Callback to use for xmit over the accelerated station. This
  *     is used in place of ndo_start_xmit on accelerated net
  *     devices.
+ * bool        (*ndo_gso_check) (struct sk_buff *skb,
+ *                       struct net_device *dev);
+ *     Called by core transmit path to determine if device is capable of
+ *     performing GSO on a packet. The device returns true if it is
+ *     able to GSO the packet, false otherwise. If the return value is
+ *     false the stack will do software GSO.
  */
 struct net_device_ops {
        int                     (*ndo_init)(struct net_device *dev);
@@ -1147,6 +1153,8 @@ struct net_device_ops {
                                                        struct net_device *dev,
                                                        void *priv);
        int                     (*ndo_get_lock_subclass)(struct net_device *dev);
+       bool                    (*ndo_gso_check) (struct sk_buff *skb,
+                                                 struct net_device *dev);
 };
 
 /**
@@ -3572,10 +3580,12 @@ static inline bool skb_gso_ok(struct sk_buff *skb, netdev_features_t features)
               (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST));
 }
 
-static inline bool netif_needs_gso(struct sk_buff *skb,
+static inline bool netif_needs_gso(struct net_device *dev, struct sk_buff *skb,
                                   netdev_features_t features)
 {
        return skb_is_gso(skb) && (!skb_gso_ok(skb, features) ||
+               (dev->netdev_ops->ndo_gso_check &&
+                !dev->netdev_ops->ndo_gso_check(skb, dev)) ||
                unlikely((skb->ip_summed != CHECKSUM_PARTIAL) &&
                         (skb->ip_summed != CHECKSUM_UNNECESSARY)));
 }