Merge tag 'vfio-v4.11-rc1' of git://github.com/awilliam/linux-vfio
[sfrench/cifs-2.6.git] / include / linux / netdevice.h
index 70ad0291d517b41cd1d4a3c2c7fc046f13e27980..f40f0ab3847a8caaf46bd4d5f224c65014f501cc 100644 (file)
@@ -352,6 +352,7 @@ enum gro_result {
        GRO_HELD,
        GRO_NORMAL,
        GRO_DROP,
+       GRO_CONSUMED,
 };
 typedef enum gro_result gro_result_t;
 
@@ -463,7 +464,6 @@ static inline bool napi_reschedule(struct napi_struct *napi)
        return false;
 }
 
-bool __napi_complete(struct napi_struct *n);
 bool napi_complete_done(struct napi_struct *n, int work_done);
 /**
  *     napi_complete - NAPI processing complete
@@ -917,8 +917,8 @@ struct netdev_xdp {
  *     Callback used when the transmitter has not made any progress
  *     for dev->watchdog ticks.
  *
- * struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev,
- *                      struct rtnl_link_stats64 *storage);
+ * void (*ndo_get_stats64)(struct net_device *dev,
+ *                         struct rtnl_link_stats64 *storage);
  * struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
  *     Called when a user wants to get the network device usage
  *     statistics. Drivers must do one of the following:
@@ -968,11 +968,12 @@ struct netdev_xdp {
  *      with PF and querying it may introduce a theoretical security risk.
  * int (*ndo_set_vf_rss_query_en)(struct net_device *dev, int vf, bool setting);
  * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb);
- * int (*ndo_setup_tc)(struct net_device *dev, u8 tc)
- *     Called to setup 'tc' number of traffic classes in the net device. This
- *     is always called from the stack with the rtnl lock held and netif tx
- *     queues stopped. This allows the netdevice to perform queue management
- *     safely.
+ * int (*ndo_setup_tc)(struct net_device *dev, u32 handle,
+ *                    __be16 protocol, struct tc_to_netdev *tc);
+ *     Called to setup any 'tc' scheduler, classifier or action on @dev.
+ *     This is always called from the stack with the rtnl lock held and netif
+ *     tx queues stopped. This allows the netdevice to perform queue
+ *     management safely.
  *
  *     Fiber Channel over Ethernet (FCoE) offload functions.
  * int (*ndo_fcoe_enable)(struct net_device *dev);
@@ -1166,8 +1167,8 @@ struct net_device_ops {
                                                   struct neigh_parms *);
        void                    (*ndo_tx_timeout) (struct net_device *dev);
 
-       struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev,
-                                                    struct rtnl_link_stats64 *storage);
+       void                    (*ndo_get_stats64)(struct net_device *dev,
+                                                  struct rtnl_link_stats64 *storage);
        bool                    (*ndo_has_offload_stats)(const struct net_device *dev, int attr_id);
        int                     (*ndo_get_offload_stats)(int attr_id,
                                                         const struct net_device *dev,
@@ -1183,9 +1184,6 @@ struct net_device_ops {
        int                     (*ndo_netpoll_setup)(struct net_device *dev,
                                                     struct netpoll_info *info);
        void                    (*ndo_netpoll_cleanup)(struct net_device *dev);
-#endif
-#ifdef CONFIG_NET_RX_BUSY_POLL
-       int                     (*ndo_busy_poll)(struct napi_struct *dev);
 #endif
        int                     (*ndo_set_vf_mac)(struct net_device *dev,
                                                  int queue, u8 *mac);
@@ -1511,6 +1509,7 @@ enum netdev_priv_flags {
  *     @max_mtu:       Interface Maximum MTU value
  *     @type:          Interface hardware type
  *     @hard_header_len: Maximum hardware header length.
+ *     @min_header_len:  Minimum hardware header length
  *
  *     @needed_headroom: Extra headroom the hardware may need, but not in all
  *                       cases can this be guaranteed
@@ -1552,7 +1551,6 @@ enum netdev_priv_flags {
  *     @ax25_ptr:      AX.25 specific data
  *     @ieee80211_ptr: IEEE 802.11 specific data, assign before registering
  *
- *     @last_rx:       Time of last Rx
  *     @dev_addr:      Hw address (before bcast,
  *                     because most packets are unicast)
  *
@@ -1728,6 +1726,7 @@ struct net_device {
        unsigned int            max_mtu;
        unsigned short          type;
        unsigned short          hard_header_len;
+       unsigned short          min_header_len;
 
        unsigned short          needed_headroom;
        unsigned short          needed_tailroom;
@@ -1778,8 +1777,6 @@ struct net_device {
 /*
  * Cache lines mostly used on receive path (including eth_type_trans())
  */
-       unsigned long           last_rx;
-
        /* Interface address info used in eth_type_trans() */
        unsigned char           *dev_addr;
 
@@ -1869,8 +1866,12 @@ struct net_device {
                struct pcpu_vstats __percpu             *vstats;
        };
 
+#if IS_ENABLED(CONFIG_GARP)
        struct garp_port __rcu  *garp_port;
+#endif
+#if IS_ENABLED(CONFIG_MRP)
        struct mrp_port __rcu   *mrp_port;
+#endif
 
        struct device           dev;
        const struct attribute_group *sysfs_groups[4];
@@ -2667,6 +2668,19 @@ static inline void skb_gro_remcsum_cleanup(struct sk_buff *skb,
        remcsum_unadjust((__sum16 *)ptr, grc->delta);
 }
 
+#ifdef CONFIG_XFRM_OFFLOAD
+static inline void skb_gro_flush_final(struct sk_buff *skb, struct sk_buff **pp, int flush)
+{
+       if (PTR_ERR(pp) != -EINPROGRESS)
+               NAPI_GRO_CB(skb)->flush |= flush;
+}
+#else
+static inline void skb_gro_flush_final(struct sk_buff *skb, struct sk_buff **pp, int flush)
+{
+       NAPI_GRO_CB(skb)->flush |= flush;
+}
+#endif
+
 static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
                                  unsigned short type,
                                  const void *daddr, const void *saddr,
@@ -2694,6 +2708,8 @@ static inline bool dev_validate_header(const struct net_device *dev,
 {
        if (likely(len >= dev->hard_header_len))
                return true;
+       if (len < dev->min_header_len)
+               return false;
 
        if (capable(CAP_SYS_RAWIO)) {
                memset(ll_header + len, 0, dev->hard_header_len - len);
@@ -3107,7 +3123,19 @@ static inline bool netif_subqueue_stopped(const struct net_device *dev,
        return __netif_subqueue_stopped(dev, skb_get_queue_mapping(skb));
 }
 
-void netif_wake_subqueue(struct net_device *dev, u16 queue_index);
+/**
+ *     netif_wake_subqueue - allow sending packets on subqueue
+ *     @dev: network device
+ *     @queue_index: sub queue index
+ *
+ * Resume individual transmit queue of a device with multiple transmit queues.
+ */
+static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
+{
+       struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
+
+       netif_tx_wake_queue(txq);
+}
 
 #ifdef CONFIG_XPS
 int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask,
@@ -3801,6 +3829,10 @@ void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64,
 extern int             netdev_max_backlog;
 extern int             netdev_tstamp_prequeue;
 extern int             weight_p;
+extern int             dev_weight_rx_bias;
+extern int             dev_weight_tx_bias;
+extern int             dev_rx_weight;
+extern int             dev_tx_weight;
 
 bool netdev_has_upper_dev(struct net_device *dev, struct net_device *upper_dev);
 struct net_device *netdev_upper_get_next_dev_rcu(struct net_device *dev,
@@ -3878,10 +3910,6 @@ void *netdev_lower_dev_get_private(struct net_device *dev,
                                   struct net_device *lower_dev);
 void netdev_lower_state_changed(struct net_device *lower_dev,
                                void *lower_state_info);
-int netdev_default_l2upper_neigh_construct(struct net_device *dev,
-                                          struct neighbour *n);
-void netdev_default_l2upper_neigh_destroy(struct net_device *dev,
-                                         struct neighbour *n);
 
 /* RSS keys are 40 or 52 bytes long */
 #define NETDEV_RSS_KEY_LEN 52
@@ -4334,6 +4362,15 @@ do {                                                             \
 })
 #endif
 
+/* if @cond then downgrade to debug, else print at @level */
+#define netif_cond_dbg(priv, type, netdev, cond, level, fmt, args...)     \
+       do {                                                              \
+               if (cond)                                                 \
+                       netif_dbg(priv, type, netdev, fmt, ##args);       \
+               else                                                      \
+                       netif_ ## level(priv, type, netdev, fmt, ##args); \
+       } while (0)
+
 #if defined(VERBOSE_DEBUG)
 #define netif_vdbg     netif_dbg
 #else