net: l3mdev: Add hook in ip and ipv6
[cascardo/linux.git] / include / linux / netdevice.h
index 8395308..c2f5112 100644 (file)
@@ -106,7 +106,6 @@ enum netdev_tx {
        __NETDEV_TX_MIN  = INT_MIN,     /* make sure enum is signed */
        NETDEV_TX_OK     = 0x00,        /* driver took care of packet */
        NETDEV_TX_BUSY   = 0x10,        /* driver tx path was busy*/
-       NETDEV_TX_LOCKED = 0x20,        /* driver tx lock was already taken */
 };
 typedef enum netdev_tx netdev_tx_t;
 
@@ -570,28 +569,27 @@ struct netdev_queue {
 #if defined(CONFIG_XPS) && defined(CONFIG_NUMA)
        int                     numa_node;
 #endif
+       unsigned long           tx_maxrate;
+       /*
+        * Number of TX timeouts for this queue
+        * (/sys/class/net/DEV/Q/trans_timeout)
+        */
+       unsigned long           trans_timeout;
 /*
  * write-mostly part
  */
        spinlock_t              _xmit_lock ____cacheline_aligned_in_smp;
        int                     xmit_lock_owner;
        /*
-        * please use this field instead of dev->trans_start
+        * Time (in jiffies) of last Tx
         */
        unsigned long           trans_start;
 
-       /*
-        * Number of TX timeouts for this queue
-        * (/sys/class/net/DEV/Q/trans_timeout)
-        */
-       unsigned long           trans_timeout;
-
        unsigned long           state;
 
 #ifdef CONFIG_BQL
        struct dql              dql;
 #endif
-       unsigned long           tx_maxrate;
 } ____cacheline_aligned_in_smp;
 
 static inline int netdev_queue_numa_node_read(const struct netdev_queue *q)
@@ -831,7 +829,6 @@ struct tc_to_netdev {
  *     the queue before that can happen; it's for obsolete devices and weird
  *     corner cases, but the stack really does a non-trivial amount
  *     of useless work if you return NETDEV_TX_BUSY.
- *        (can also return NETDEV_TX_LOCKED iff NETIF_F_LLTX)
  *     Required; cannot be NULL.
  *
  * netdev_features_t (*ndo_fix_features)(struct net_device *dev,
@@ -1548,7 +1545,6 @@ enum netdev_priv_flags {
  *
  *     @offload_fwd_mark:      Offload device fwding mark
  *
- *     @trans_start:           Time (in jiffies) of last Tx
  *     @watchdog_timeo:        Represents the timeout that is used by
  *                             the watchdog (see dev_watchdog())
  *     @watchdog_timer:        List of timers
@@ -1586,8 +1582,6 @@ enum netdev_priv_flags {
  *     @gso_max_size:  Maximum size of generic segmentation offload
  *     @gso_max_segs:  Maximum number of segments that can be passed to the
  *                     NIC for GSO
- *     @gso_min_segs:  Minimum number of segments that can be passed to the
- *                     NIC for GSO
  *
  *     @dcbnl_ops:     Data Center Bridging netlink ops
  *     @num_tc:        Number of traffic classes in the net device
@@ -1656,6 +1650,7 @@ struct net_device {
        netdev_features_t       vlan_features;
        netdev_features_t       hw_enc_features;
        netdev_features_t       mpls_features;
+       netdev_features_t       gso_partial_features;
 
        int                     ifindex;
        int                     group;
@@ -1798,13 +1793,6 @@ struct net_device {
 #endif
 
        /* These may be needed for future network-power-down code. */
-
-       /*
-        * trans_start here is expensive for high speed devices on SMP,
-        * please use netdev_queue->trans_start instead.
-        */
-       unsigned long           trans_start;
-
        struct timer_list       watchdog_timer;
 
        int __percpu            *pcpu_refcnt;
@@ -1858,7 +1846,7 @@ struct net_device {
        unsigned int            gso_max_size;
 #define GSO_MAX_SEGS           65535
        u16                     gso_max_segs;
-       u16                     gso_min_segs;
+
 #ifdef CONFIG_DCB
        const struct dcbnl_rtnl_ops *dcbnl_ops;
 #endif
@@ -2123,7 +2111,10 @@ struct napi_gro_cb {
        /* Used in GRE, set in fou/gue_gro_receive */
        u8      is_fou:1;
 
-       /* 6 bit hole */
+       /* Used to determine if flush_id can be ignored */
+       u8      is_atomic:1;
+
+       /* 5 bit hole */
 
        /* used to support CHECKSUM_COMPLETE for tunneling protocols */
        __wsum  csum;
@@ -2162,23 +2153,6 @@ struct packet_offload {
        struct list_head         list;
 };
 
-struct udp_offload;
-
-struct udp_offload_callbacks {
-       struct sk_buff          **(*gro_receive)(struct sk_buff **head,
-                                                struct sk_buff *skb,
-                                                struct udp_offload *uoff);
-       int                     (*gro_complete)(struct sk_buff *skb,
-                                               int nhoff,
-                                               struct udp_offload *uoff);
-};
-
-struct udp_offload {
-       __be16                   port;
-       u8                       ipproto;
-       struct udp_offload_callbacks callbacks;
-};
-
 /* often modified stats are per-CPU, other are shared (netdev->stats) */
 struct pcpu_sw_netstats {
        u64     rx_packets;
@@ -2259,6 +2233,8 @@ struct netdev_lag_lower_state_info {
 #define NETDEV_BONDING_INFO    0x0019
 #define NETDEV_PRECHANGEUPPER  0x001A
 #define NETDEV_CHANGELOWERSTATE        0x001B
+#define NETDEV_OFFLOAD_PUSH_VXLAN      0x001C
+#define NETDEV_OFFLOAD_PUSH_GENEVE     0x001D
 
 int register_netdevice_notifier(struct notifier_block *nb);
 int unregister_netdevice_notifier(struct notifier_block *nb);
@@ -2750,7 +2726,6 @@ struct softnet_data {
        /* stats */
        unsigned int            processed;
        unsigned int            time_squeeze;
-       unsigned int            cpu_collision;
        unsigned int            received_rps;
 #ifdef CONFIG_RPS
        struct softnet_data     *rps_ipi_list;
@@ -2763,11 +2738,15 @@ struct softnet_data {
        struct sk_buff          *completion_queue;
 
 #ifdef CONFIG_RPS
-       /* Elements below can be accessed between CPUs for RPS */
+       /* input_queue_head should be written by cpu owning this struct,
+        * and only read by other cpus. Worth using a cache line.
+        */
+       unsigned int            input_queue_head ____cacheline_aligned_in_smp;
+
+       /* Elements below can be accessed between CPUs for RPS/RFS */
        struct call_single_data csd ____cacheline_aligned_in_smp;
        struct softnet_data     *rps_ipi_next;
        unsigned int            cpu;
-       unsigned int            input_queue_head;
        unsigned int            input_queue_tail;
 #endif
        unsigned int            dropped;
@@ -2804,7 +2783,7 @@ static inline void netif_tx_schedule_all(struct net_device *dev)
                netif_schedule_queue(netdev_get_tx_queue(dev, i));
 }
 
-static inline void netif_tx_start_queue(struct netdev_queue *dev_queue)
+static __always_inline void netif_tx_start_queue(struct netdev_queue *dev_queue)
 {
        clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state);
 }
@@ -2854,7 +2833,7 @@ static inline void netif_tx_wake_all_queues(struct net_device *dev)
        }
 }
 
-static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue)
+static __always_inline void netif_tx_stop_queue(struct netdev_queue *dev_queue)
 {
        set_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state);
 }
@@ -3276,7 +3255,10 @@ struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
                                    struct netdev_queue *txq, int *ret);
 int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
 int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
-bool is_skb_forwardable(struct net_device *dev, struct sk_buff *skb);
+bool is_skb_forwardable(const struct net_device *dev,
+                       const struct sk_buff *skb);
+
+void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev);
 
 extern int             netdev_budget;
 
@@ -3493,6 +3475,15 @@ static inline void txq_trans_update(struct netdev_queue *txq)
                txq->trans_start = jiffies;
 }
 
+/* legacy drivers only, netdev_start_xmit() sets txq->trans_start */
+static inline void netif_trans_update(struct net_device *dev)
+{
+       struct netdev_queue *txq = netdev_get_tx_queue(dev, 0);
+
+       if (txq->trans_start != jiffies)
+               txq->trans_start = jiffies;
+}
+
 /**
  *     netif_tx_lock - grab network device transmit lock
  *     @dev: network device
@@ -4004,13 +3995,14 @@ netdev_features_t netif_skb_features(struct sk_buff *skb);
 
 static inline bool net_gso_ok(netdev_features_t features, int gso_type)
 {
-       netdev_features_t feature = gso_type << NETIF_F_GSO_SHIFT;
+       netdev_features_t feature = (netdev_features_t)gso_type << NETIF_F_GSO_SHIFT;
 
        /* check flags correspondence */
        BUILD_BUG_ON(SKB_GSO_TCPV4   != (NETIF_F_TSO >> NETIF_F_GSO_SHIFT));
        BUILD_BUG_ON(SKB_GSO_UDP     != (NETIF_F_UFO >> NETIF_F_GSO_SHIFT));
        BUILD_BUG_ON(SKB_GSO_DODGY   != (NETIF_F_GSO_ROBUST >> NETIF_F_GSO_SHIFT));
        BUILD_BUG_ON(SKB_GSO_TCP_ECN != (NETIF_F_TSO_ECN >> NETIF_F_GSO_SHIFT));
+       BUILD_BUG_ON(SKB_GSO_TCP_FIXEDID != (NETIF_F_TSO_MANGLEID >> NETIF_F_GSO_SHIFT));
        BUILD_BUG_ON(SKB_GSO_TCPV6   != (NETIF_F_TSO6 >> NETIF_F_GSO_SHIFT));
        BUILD_BUG_ON(SKB_GSO_FCOE    != (NETIF_F_FSO >> NETIF_F_GSO_SHIFT));
        BUILD_BUG_ON(SKB_GSO_GRE     != (NETIF_F_GSO_GRE >> NETIF_F_GSO_SHIFT));
@@ -4019,6 +4011,7 @@ static inline bool net_gso_ok(netdev_features_t features, int gso_type)
        BUILD_BUG_ON(SKB_GSO_SIT     != (NETIF_F_GSO_SIT >> NETIF_F_GSO_SHIFT));
        BUILD_BUG_ON(SKB_GSO_UDP_TUNNEL != (NETIF_F_GSO_UDP_TUNNEL >> NETIF_F_GSO_SHIFT));
        BUILD_BUG_ON(SKB_GSO_UDP_TUNNEL_CSUM != (NETIF_F_GSO_UDP_TUNNEL_CSUM >> NETIF_F_GSO_SHIFT));
+       BUILD_BUG_ON(SKB_GSO_PARTIAL != (NETIF_F_GSO_PARTIAL >> NETIF_F_GSO_SHIFT));
        BUILD_BUG_ON(SKB_GSO_TUNNEL_REMCSUM != (NETIF_F_GSO_TUNNEL_REMCSUM >> NETIF_F_GSO_SHIFT));
 
        return (features & feature) == feature;