gro: Only reset frag0 when skb can be pulled, CVE-2011-2723
[linux-flexiantxendom0-natty.git] / include / linux / netdevice.h
index 53c272f..191e4aa 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/if_link.h>
 
 #ifdef __KERNEL__
+#include <linux/pm_qos_params.h>
 #include <linux/timer.h>
 #include <linux/delay.h>
 #include <linux/mm.h>
@@ -53,6 +54,7 @@
 
 struct vlan_group;
 struct netpoll_info;
+struct phy_device;
 /* 802.11 specific */
 struct wireless_dev;
                                        /* source back-compat hooks */
@@ -64,6 +66,11 @@ struct wireless_dev;
 #define HAVE_FREE_NETDEV               /* free_netdev() */
 #define HAVE_NETDEV_PRIV               /* netdev_priv() */
 
+/* hardware address assignment types */
+#define NET_ADDR_PERM          0       /* address is permanent (default) */
+#define NET_ADDR_RANDOM                1       /* address is generated randomly */
+#define NET_ADDR_STOLEN                2       /* address is stolen from other device */
+
 /* Backlog congestion levels */
 #define NET_RX_SUCCESS         0       /* keep 'em coming, baby */
 #define NET_RX_DROP            1       /* packet dropped */
@@ -158,45 +165,39 @@ static inline bool dev_xmit_complete(int rc)
 #define MAX_HEADER (LL_MAX_HEADER + 48)
 #endif
 
-#endif  /*  __KERNEL__  */
-
 /*
- *     Network device statistics. Akin to the 2.0 ether stats but
- *     with byte counters.
+ *     Old network device statistics. Fields are native words
+ *     (unsigned long) so they can be read and written atomically.
  */
 
 struct net_device_stats {
-       unsigned long   rx_packets;             /* total packets received       */
-       unsigned long   tx_packets;             /* total packets transmitted    */
-       unsigned long   rx_bytes;               /* total bytes received         */
-       unsigned long   tx_bytes;               /* total bytes transmitted      */
-       unsigned long   rx_errors;              /* bad packets received         */
-       unsigned long   tx_errors;              /* packet transmit problems     */
-       unsigned long   rx_dropped;             /* no space in linux buffers    */
-       unsigned long   tx_dropped;             /* no space available in linux  */
-       unsigned long   multicast;              /* multicast packets received   */
+       unsigned long   rx_packets;
+       unsigned long   tx_packets;
+       unsigned long   rx_bytes;
+       unsigned long   tx_bytes;
+       unsigned long   rx_errors;
+       unsigned long   tx_errors;
+       unsigned long   rx_dropped;
+       unsigned long   tx_dropped;
+       unsigned long   multicast;
        unsigned long   collisions;
-
-       /* detailed rx_errors: */
        unsigned long   rx_length_errors;
-       unsigned long   rx_over_errors;         /* receiver ring buff overflow  */
-       unsigned long   rx_crc_errors;          /* recved pkt with crc error    */
-       unsigned long   rx_frame_errors;        /* recv'd frame alignment error */
-       unsigned long   rx_fifo_errors;         /* recv'r fifo overrun          */
-       unsigned long   rx_missed_errors;       /* receiver missed packet       */
-
-       /* detailed tx_errors */
+       unsigned long   rx_over_errors;
+       unsigned long   rx_crc_errors;
+       unsigned long   rx_frame_errors;
+       unsigned long   rx_fifo_errors;
+       unsigned long   rx_missed_errors;
        unsigned long   tx_aborted_errors;
        unsigned long   tx_carrier_errors;
        unsigned long   tx_fifo_errors;
        unsigned long   tx_heartbeat_errors;
        unsigned long   tx_window_errors;
-       
-       /* for cslip etc */
        unsigned long   rx_compressed;
        unsigned long   tx_compressed;
 };
 
+#endif  /*  __KERNEL__  */
+
 
 /* Media selection options. */
 enum {
@@ -218,35 +219,6 @@ struct neighbour;
 struct neigh_parms;
 struct sk_buff;
 
-struct netif_rx_stats {
-       unsigned total;
-       unsigned dropped;
-       unsigned time_squeeze;
-       unsigned cpu_collision;
-       unsigned received_rps;
-};
-
-DECLARE_PER_CPU(struct netif_rx_stats, netdev_rx_stat);
-
-struct dev_addr_list {
-       struct dev_addr_list    *next;
-       u8                      da_addr[MAX_ADDR_LEN];
-       u8                      da_addrlen;
-       u8                      da_synced;
-       int                     da_users;
-       int                     da_gusers;
-};
-
-/*
- *     We tag multicasts with these structures.
- */
-
-#define dev_mc_list    dev_addr_list
-#define dmi_addr       da_addr
-#define dmi_addrlen    da_addrlen
-#define dmi_users      da_users
-#define dmi_gusers     da_gusers
-
 struct netdev_hw_addr {
        struct list_head        list;
        unsigned char           addr[MAX_ADDR_LEN];
@@ -255,8 +227,10 @@ struct netdev_hw_addr {
 #define NETDEV_HW_ADDR_T_SAN           2
 #define NETDEV_HW_ADDR_T_SLAVE         3
 #define NETDEV_HW_ADDR_T_UNICAST       4
-       int                     refcount;
+#define NETDEV_HW_ADDR_T_MULTICAST     5
        bool                    synced;
+       bool                    global_use;
+       int                     refcount;
        struct rcu_head         rcu_head;
 };
 
@@ -265,16 +239,20 @@ struct netdev_hw_addr_list {
        int                     count;
 };
 
-#define netdev_uc_count(dev) ((dev)->uc.count)
-#define netdev_uc_empty(dev) ((dev)->uc.count == 0)
-#define netdev_for_each_uc_addr(ha, dev) \
-       list_for_each_entry(ha, &dev->uc.list, list)
+#define netdev_hw_addr_list_count(l) ((l)->count)
+#define netdev_hw_addr_list_empty(l) (netdev_hw_addr_list_count(l) == 0)
+#define netdev_hw_addr_list_for_each(ha, l) \
+       list_for_each_entry(ha, &(l)->list, list)
 
-#define netdev_mc_count(dev) ((dev)->mc_count)
-#define netdev_mc_empty(dev) (netdev_mc_count(dev) == 0)
+#define netdev_uc_count(dev) netdev_hw_addr_list_count(&(dev)->uc)
+#define netdev_uc_empty(dev) netdev_hw_addr_list_empty(&(dev)->uc)
+#define netdev_for_each_uc_addr(ha, dev) \
+       netdev_hw_addr_list_for_each(ha, &(dev)->uc)
 
-#define netdev_for_each_mc_addr(mclist, dev) \
-       for (mclist = dev->mc_list; mclist; mclist = mclist->next)
+#define netdev_mc_count(dev) netdev_hw_addr_list_count(&(dev)->mc)
+#define netdev_mc_empty(dev) netdev_hw_addr_list_empty(&(dev)->mc)
+#define netdev_for_each_mc_addr(ha, dev) \
+       netdev_hw_addr_list_for_each(ha, &(dev)->mc)
 
 struct hh_cache {
        struct hh_cache *hh_next;       /* Next entry                        */
@@ -303,6 +281,12 @@ struct hh_cache {
        unsigned long   hh_data[HH_DATA_ALIGN(LL_MAX_HEADER) / sizeof(long)];
 };
 
+static inline void hh_cache_put(struct hh_cache *hh)
+{
+       if (atomic_dec_and_test(&hh->hh_refcnt))
+               kfree(hh);
+}
+
 /* Reserve HH_DATA_MOD byte aligned hard_header_len, but at least that much.
  * Alternative is:
  *   dev->hard_header_len ? (dev->hard_header_len +
@@ -403,6 +387,8 @@ enum gro_result {
 };
 typedef enum gro_result gro_result_t;
 
+typedef struct sk_buff *rx_handler_func_t(struct sk_buff *skb);
+
 extern void __napi_schedule(struct napi_struct *n);
 
 static inline int napi_disable_pending(struct napi_struct *n)
@@ -507,6 +493,8 @@ static inline void napi_synchronize(const struct napi_struct *n)
 enum netdev_queue_state_t {
        __QUEUE_STATE_XOFF,
        __QUEUE_STATE_FROZEN,
+#define QUEUE_STATE_XOFF_OR_FROZEN ((1 << __QUEUE_STATE_XOFF)          | \
+                                   (1 << __QUEUE_STATE_FROZEN))
 };
 
 struct netdev_queue {
@@ -517,6 +505,12 @@ struct netdev_queue {
        struct Qdisc            *qdisc;
        unsigned long           state;
        struct Qdisc            *qdisc_sleeping;
+#ifdef CONFIG_RPS
+       struct kobject          kobj;
+#endif
+#if defined(CONFIG_XPS) && defined(CONFIG_NUMA)
+       int                     numa_node;
+#endif
 /*
  * write mostly part
  */
@@ -526,11 +520,24 @@ struct netdev_queue {
         * please use this field instead of dev->trans_start
         */
        unsigned long           trans_start;
-       unsigned long           tx_bytes;
-       unsigned long           tx_packets;
-       unsigned long           tx_dropped;
 } ____cacheline_aligned_in_smp;
 
+static inline int netdev_queue_numa_node_read(const struct netdev_queue *q)
+{
+#if defined(CONFIG_XPS) && defined(CONFIG_NUMA)
+       return q->numa_node;
+#else
+       return NUMA_NO_NODE;
+#endif
+}
+
+static inline void netdev_queue_numa_node_write(struct netdev_queue *q, int node)
+{
+#if defined(CONFIG_XPS) && defined(CONFIG_NUMA)
+       q->numa_node = node;
+#endif
+}
+
 #ifdef CONFIG_RPS
 /*
  * This structure holds an RPS map which can be of variable length.  The
@@ -543,14 +550,98 @@ struct rps_map {
 };
 #define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + (_num * sizeof(u16)))
 
+/*
+ * The rps_dev_flow structure contains the mapping of a flow to a CPU and the
+ * tail pointer for that CPU's input queue at the time of last enqueue.
+ */
+struct rps_dev_flow {
+       u16 cpu;
+       u16 fill;
+       unsigned int last_qtail;
+};
+
+/*
+ * The rps_dev_flow_table structure contains a table of flow mappings.
+ */
+struct rps_dev_flow_table {
+       unsigned int mask;
+       struct rcu_head rcu;
+       struct work_struct free_work;
+       struct rps_dev_flow flows[0];
+};
+#define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \
+    (_num * sizeof(struct rps_dev_flow)))
+
+/*
+ * The rps_sock_flow_table contains mappings of flows to the last CPU
+ * on which they were processed by the application (set in recvmsg).
+ */
+struct rps_sock_flow_table {
+       unsigned int mask;
+       u16 ents[0];
+};
+#define        RPS_SOCK_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_sock_flow_table) + \
+    (_num * sizeof(u16)))
+
+#define RPS_NO_CPU 0xffff
+
+static inline void rps_record_sock_flow(struct rps_sock_flow_table *table,
+                                       u32 hash)
+{
+       if (table && hash) {
+               unsigned int cpu, index = hash & table->mask;
+
+               /* We only give a hint, preemption can change cpu under us */
+               cpu = raw_smp_processor_id();
+
+               if (table->ents[index] != cpu)
+                       table->ents[index] = cpu;
+       }
+}
+
+static inline void rps_reset_sock_flow(struct rps_sock_flow_table *table,
+                                      u32 hash)
+{
+       if (table && hash)
+               table->ents[hash & table->mask] = RPS_NO_CPU;
+}
+
+extern struct rps_sock_flow_table __rcu *rps_sock_flow_table;
+
 /* This structure contains an instance of an RX queue. */
 struct netdev_rx_queue {
-       struct rps_map *rps_map;
-       struct kobject kobj;
-       struct netdev_rx_queue *first;
-       atomic_t count;
+       struct rps_map __rcu            *rps_map;
+       struct rps_dev_flow_table __rcu *rps_flow_table;
+       struct kobject                  kobj;
+       struct net_device               *dev;
 } ____cacheline_aligned_in_smp;
-#endif
+#endif /* CONFIG_RPS */
+
+#ifdef CONFIG_XPS
+/*
+ * This structure holds an XPS map which can be of variable length.  The
+ * map is an array of queues.
+ */
+struct xps_map {
+       unsigned int len;
+       unsigned int alloc_len;
+       struct rcu_head rcu;
+       u16 queues[0];
+};
+#define XPS_MAP_SIZE(_num) (sizeof(struct xps_map) + (_num * sizeof(u16)))
+#define XPS_MIN_MAP_ALLOC ((L1_CACHE_BYTES - sizeof(struct xps_map))   \
+    / sizeof(u16))
+
+/*
+ * This structure holds all XPS maps for device.  Maps are indexed by CPU.
+ */
+struct xps_dev_maps {
+       struct rcu_head rcu;
+       struct xps_map __rcu *cpu_map[0];
+};
+#define XPS_DEV_MAPS_SIZE (sizeof(struct xps_dev_maps) +               \
+    (nr_cpu_ids * sizeof(struct xps_map *)))
+#endif /* CONFIG_XPS */
 
 /*
  * This structure defines the management hooks for network devices.
@@ -623,13 +714,22 @@ struct netdev_rx_queue {
  *     Callback uses 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);
  * struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
  *     Called when a user wants to get the network device usage
- *     statistics. If not defined, the counters in dev->stats will
- *     be used.
+ *     statistics. Drivers must do one of the following:
+ *     1. Define @ndo_get_stats64 to fill in a zero-initialised
+ *        rtnl_link_stats64 structure passed by the caller.
+ *     2. Define @ndo_get_stats to update a net_device_stats structure
+ *        (which should normally be dev->stats) and return a pointer to
+ *        it. The structure may be changed asynchronously only if each
+ *        field is written atomically.
+ *     3. Update dev->stats asynchronously and atomically, and define
+ *        neither operation.
  *
  * void (*ndo_vlan_rx_register)(struct net_device *dev, struct vlan_group *grp);
- *     If device support VLAN receive accleration
+ *     If device support VLAN receive acceleration
  *     (ie. dev->features & NETIF_F_HW_VLAN_RX), then this function is called
  *     when vlan groups for the device changes.  Note: grp is NULL
  *     if no vlan's groups are being used.
@@ -650,6 +750,9 @@ struct netdev_rx_queue {
  * int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate);
  * int (*ndo_get_vf_config)(struct net_device *dev,
  *                         int vf, struct ifla_vf_info *ivf);
+ * int (*ndo_set_vf_port)(struct net_device *dev, int vf,
+ *                       struct nlattr *port[]);
+ * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb);
  */
 #define HAVE_NET_DEVICE_OPS
 struct net_device_ops {
@@ -678,6 +781,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);
        struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
 
        void                    (*ndo_vlan_rx_register)(struct net_device *dev,
@@ -688,6 +793,9 @@ struct net_device_ops {
                                                        unsigned short vid);
 #ifdef CONFIG_NET_POLL_CONTROLLER
        void                    (*ndo_poll_controller)(struct net_device *dev);
+       int                     (*ndo_netpoll_setup)(struct net_device *dev,
+                                                    struct netpoll_info *info);
+       void                    (*ndo_netpoll_cleanup)(struct net_device *dev);
 #endif
        int                     (*ndo_set_vf_mac)(struct net_device *dev,
                                                  int queue, u8 *mac);
@@ -698,6 +806,11 @@ struct net_device_ops {
        int                     (*ndo_get_vf_config)(struct net_device *dev,
                                                     int vf,
                                                     struct ifla_vf_info *ivf);
+       int                     (*ndo_set_vf_port)(struct net_device *dev,
+                                                  int vf,
+                                                  struct nlattr *port[]);
+       int                     (*ndo_get_vf_port)(struct net_device *dev,
+                                                  int vf, struct sk_buff *skb);
 #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
        int                     (*ndo_fcoe_enable)(struct net_device *dev);
        int                     (*ndo_fcoe_disable)(struct net_device *dev);
@@ -729,9 +842,12 @@ struct net_device {
        /*
         * This is the first field of the "visible" part of this structure
         * (i.e. as seen by users in the "Space.c" file).  It is the name
-        * the interface.
+        * of the interface.
         */
        char                    name[IFNAMSIZ];
+
+       struct pm_qos_request_list pm_qos_req;
+
        /* device name hash chain */
        struct hlist_node       name_hlist;
        /* snmp alias */
@@ -785,6 +901,7 @@ struct net_device {
 #define NETIF_F_SCTP_CSUM      (1 << 25) /* SCTP checksum offload */
 #define NETIF_F_FCOE_MTU       (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/
 #define NETIF_F_NTUPLE         (1 << 27) /* N-tuple filters supported */
+#define NETIF_F_RXHASH         (1 << 28) /* Receive hashing offload */
 
        /* Segmentation offload features */
 #define NETIF_F_GSO_SHIFT      16
@@ -797,7 +914,8 @@ struct net_device {
 #define NETIF_F_FSO            (SKB_GSO_FCOE << NETIF_F_GSO_SHIFT)
 
        /* List of features with software fallbacks. */
-#define NETIF_F_GSO_SOFTWARE   (NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6)
+#define NETIF_F_GSO_SOFTWARE   (NETIF_F_TSO | NETIF_F_TSO_ECN | \
+                                NETIF_F_TSO6 | NETIF_F_UFO)
 
 
 #define NETIF_F_GEN_CSUM       (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM)
@@ -818,6 +936,9 @@ struct net_device {
        int                     iflink;
 
        struct net_device_stats stats;
+       atomic_long_t           rx_dropped; /* dropped packets by core network
+                                            * Do not use this in drivers.
+                                            */
 
 #ifdef CONFIG_WIRELESS_EXT
        /* List of functions to handle Wireless Extensions (instead of ioctl).
@@ -835,13 +956,13 @@ struct net_device {
 
        unsigned int            flags;  /* interface flags (a la BSD)   */
        unsigned short          gflags;
-        unsigned short          priv_flags; /* Like 'flags' but invisible to userspace. */
+        unsigned int            priv_flags; /* Like 'flags' but invisible to userspace. */
        unsigned short          padded; /* How much padding added by alloc_netdev() */
 
        unsigned char           operstate; /* RFC2863 operstate */
        unsigned char           link_mode; /* mapping policy to operstate */
 
-       unsigned                mtu;    /* interface MTU value          */
+       unsigned int            mtu;    /* interface MTU value          */
        unsigned short          type;   /* interface hardware type      */
        unsigned short          hard_header_len;        /* hardware hdr length  */
 
@@ -852,43 +973,52 @@ struct net_device {
        unsigned short          needed_headroom;
        unsigned short          needed_tailroom;
 
-       struct net_device       *master; /* Pointer to master device of a group,
-                                         * which this device is member of.
-                                         */
-
        /* Interface address info. */
        unsigned char           perm_addr[MAX_ADDR_LEN]; /* permanent hw address */
+       unsigned char           addr_assign_type; /* hw address assignment type */
        unsigned char           addr_len;       /* hardware address length      */
        unsigned short          dev_id;         /* for shared network cards */
 
-       struct netdev_hw_addr_list      uc;     /* Secondary unicast
-                                                  mac addresses */
-       int                     uc_promisc;
        spinlock_t              addr_list_lock;
-       struct dev_addr_list    *mc_list;       /* Multicast mac addresses      */
-       int                     mc_count;       /* Number of installed mcasts   */
+       struct netdev_hw_addr_list      uc;     /* Unicast mac addresses */
+       struct netdev_hw_addr_list      mc;     /* Multicast mac addresses */
+       int                     uc_promisc;
        unsigned int            promiscuity;
        unsigned int            allmulti;
 
 
        /* Protocol specific pointers */
-       
+
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
+       struct vlan_group __rcu *vlgrp;         /* VLAN group */
+#endif
 #ifdef CONFIG_NET_DSA
        void                    *dsa_ptr;       /* dsa specific data */
 #endif
        void                    *atalk_ptr;     /* AppleTalk link       */
-       void                    *ip_ptr;        /* IPv4 specific data   */
-       void                    *dn_ptr;        /* DECnet specific data */
-       void                    *ip6_ptr;       /* IPv6 specific data */
+       struct in_device __rcu  *ip_ptr;        /* IPv4 specific data   */
+       struct dn_dev __rcu     *dn_ptr;        /* DECnet specific data */
+       struct inet6_dev __rcu  *ip6_ptr;       /* IPv6 specific data */
        void                    *ec_ptr;        /* Econet specific data */
        void                    *ax25_ptr;      /* AX.25 specific data */
        struct wireless_dev     *ieee80211_ptr; /* IEEE 802.11 specific data,
                                                   assign before registering */
 
 /*
- * Cache line mostly used on receive path (including eth_type_trans())
+ * Cache lines mostly used on receive path (including eth_type_trans())
  */
-       unsigned long           last_rx;        /* Time of last Rx      */
+       unsigned long           last_rx;        /* Time of last Rx
+                                                * This should not be set in
+                                                * drivers, unless really needed,
+                                                * because network stack (bonding)
+                                                * use it if/when necessary, to
+                                                * avoid dirtying this cache line.
+                                                */
+
+       struct net_device       *master; /* Pointer to master device of a group,
+                                         * which this device is member of.
+                                         */
+
        /* Interface address info used in eth_type_trans() */
        unsigned char           *dev_addr;      /* hw address, (before bcast
                                                   because most packets are
@@ -904,12 +1034,21 @@ struct net_device {
 
        struct netdev_rx_queue  *_rx;
 
-       /* Number of RX queues allocated at alloc_netdev_mq() time  */
+       /* Number of RX queues allocated at register_netdev() time */
        unsigned int            num_rx_queues;
+
+       /* Number of RX queues currently active in device */
+       unsigned int            real_num_rx_queues;
 #endif
 
-       struct netdev_queue     rx_queue;
+       rx_handler_func_t __rcu *rx_handler;
+       void __rcu              *rx_handler_data;
+
+       struct netdev_queue __rcu *ingress_queue;
 
+/*
+ * Cache lines mostly used on transmit path
+ */
        struct netdev_queue     *_tx ____cacheline_aligned_in_smp;
 
        /* Number of TX queues allocated at alloc_netdev_mq() time  */
@@ -923,9 +1062,11 @@ struct net_device {
 
        unsigned long           tx_queue_len;   /* Max frames per queue allowed */
        spinlock_t              tx_global_lock;
-/*
- * One part is mostly used on xmit path (device)
- */
+
+#ifdef CONFIG_XPS
+       struct xps_dev_maps __rcu *xps_maps;
+#endif
+
        /* These may be needed for future network-power-down code. */
 
        /*
@@ -938,7 +1079,7 @@ struct net_device {
        struct timer_list       watchdog_timer;
 
        /* Number of references to this device */
-       atomic_t                refcnt ____cacheline_aligned_in_smp;
+       int __percpu            *pcpu_refcnt;
 
        /* delayed register/unregister */
        struct list_head        todo_list;
@@ -974,14 +1115,14 @@ struct net_device {
 #endif
 
        /* mid-layer private */
-       void                    *ml_priv;
-
-       /* bridge stuff */
-       struct net_bridge_port  *br_port;
-       /* macvlan */
-       struct macvlan_port     *macvlan_port;
+       union {
+               void                            *ml_priv;
+               struct pcpu_lstats __percpu     *lstats; /* loopback stats */
+               struct pcpu_tstats __percpu     *tstats; /* tunnel stats */
+               struct pcpu_dstats __percpu     *dstats; /* dummy stats */
+       };
        /* GARP */
-       struct garp_port        *garp_port;
+       struct garp_port __rcu  *garp_port;
 
        /* class/net/name entry */
        struct device           dev;
@@ -1009,6 +1150,9 @@ struct net_device {
 #endif
        /* n-tuple filter list attached to this device */
        struct ethtool_rx_ntuple_list ethtool_ntuple_list;
+
+       /* phy device may attach itself for hardware timestamping */
+       struct phy_device *phydev;
 };
 #define to_net_dev(d) container_of(d, struct net_device, dev)
 
@@ -1039,11 +1183,7 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev,
 static inline
 struct net *dev_net(const struct net_device *dev)
 {
-#ifdef CONFIG_NET_NS
-       return dev->nd_net;
-#else
-       return &init_net;
-#endif
+       return read_pnet(&dev->nd_net);
 }
 
 static inline
@@ -1217,15 +1357,16 @@ static inline struct net_device *first_net_device(struct net *net)
 
 extern int                     netdev_boot_setup_check(struct net_device *dev);
 extern unsigned long           netdev_boot_base(const char *prefix, int unit);
-extern struct net_device    *dev_getbyhwaddr(struct net *net, unsigned short type, char *hwaddr);
+extern struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type,
+                                             const char *hwaddr);
 extern struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type);
 extern struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type);
 extern void            dev_add_pack(struct packet_type *pt);
 extern void            dev_remove_pack(struct packet_type *pt);
 extern void            __dev_remove_pack(struct packet_type *pt);
 
-extern struct net_device       *dev_get_by_flags(struct net *net, unsigned short flags,
-                                                 unsigned short mask);
+extern struct net_device       *dev_get_by_flags_rcu(struct net *net, unsigned short flags,
+                                                     unsigned short mask);
 extern struct net_device       *dev_get_by_name(struct net *net, const char *name);
 extern struct net_device       *dev_get_by_name_rcu(struct net *net, const char *name);
 extern struct net_device       *__dev_get_by_name(struct net *net, const char *name);
@@ -1243,6 +1384,7 @@ static inline void unregister_netdevice(struct net_device *dev)
        unregister_netdevice_queue(dev, NULL);
 }
 
+extern int             netdev_refcnt_read(const struct net_device *dev);
 extern void            free_netdev(struct net_device *dev);
 extern void            synchronize_net(void);
 extern int             register_netdevice_notifier(struct notifier_block *nb);
@@ -1291,9 +1433,12 @@ static inline int skb_gro_header_hard(struct sk_buff *skb, unsigned int hlen)
 static inline void *skb_gro_header_slow(struct sk_buff *skb, unsigned int hlen,
                                        unsigned int offset)
 {
+       if (!pskb_may_pull(skb, hlen))
+               return NULL;
+
        NAPI_GRO_CB(skb)->frag0 = NULL;
        NAPI_GRO_CB(skb)->frag0_len = 0;
-       return pskb_may_pull(skb, hlen) ? skb->data + offset : NULL;
+       return skb->data + offset;
 }
 
 static inline void *skb_gro_mac_header(struct sk_buff *skb)
@@ -1336,22 +1481,51 @@ static inline int unregister_gifconf(unsigned int family)
 }
 
 /*
- * Incoming packets are placed on per-cpu queues so that
- * no locking is needed.
+ * Incoming packets are placed on per-cpu queues
  */
 struct softnet_data {
        struct Qdisc            *output_queue;
+       struct Qdisc            **output_queue_tailp;
        struct list_head        poll_list;
        struct sk_buff          *completion_queue;
+       struct sk_buff_head     process_queue;
+
+       /* 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;
 
        /* Elements below can be accessed between CPUs for RPS */
-#ifdef CONFIG_SMP
        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                dropped;
        struct sk_buff_head     input_pkt_queue;
        struct napi_struct      backlog;
 };
 
+static inline void input_queue_head_incr(struct softnet_data *sd)
+{
+#ifdef CONFIG_RPS
+       sd->input_queue_head++;
+#endif
+}
+
+static inline void input_queue_tail_incr_save(struct softnet_data *sd,
+                                             unsigned int *qtail)
+{
+#ifdef CONFIG_RPS
+       *qtail = ++sd->input_queue_tail;
+#endif
+}
+
 DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data);
 
 #define HAVE_NETIF_QUEUE
@@ -1434,6 +1608,11 @@ static inline void netif_tx_wake_all_queues(struct net_device *dev)
 
 static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue)
 {
+       if (WARN_ON(!dev_queue)) {
+               printk(KERN_INFO "netif_stop_queue() cannot be called before "
+                      "register_netdev()");
+               return;
+       }
        set_bit(__QUEUE_STATE_XOFF, &dev_queue->state);
 }
 
@@ -1475,9 +1654,9 @@ static inline int netif_queue_stopped(const struct net_device *dev)
        return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0));
 }
 
-static inline int netif_tx_queue_frozen(const struct netdev_queue *dev_queue)
+static inline int netif_tx_queue_frozen_or_stopped(const struct netdev_queue *dev_queue)
 {
-       return test_bit(__QUEUE_STATE_FROZEN, &dev_queue->state);
+       return dev_queue->state & QUEUE_STATE_XOFF_OR_FROZEN;
 }
 
 /**
@@ -1568,6 +1747,16 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
                __netif_schedule(txq->qdisc);
 }
 
+/*
+ * Returns a Tx hash for the given packet when dev->real_num_tx_queues is used
+ * as a distribution range limit for the returned value.
+ */
+static inline u16 skb_tx_hash(const struct net_device *dev,
+                             const struct sk_buff *skb)
+{
+       return __skb_tx_hash(dev, skb, dev->real_num_tx_queues);
+}
+
 /**
  *     netif_is_multiqueue - test if device has multiple transmit queues
  *     @dev: network device
@@ -1576,7 +1765,33 @@ static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
  */
 static inline int netif_is_multiqueue(const struct net_device *dev)
 {
-       return (dev->num_tx_queues > 1);
+       return dev->num_tx_queues > 1;
+}
+
+extern int netif_set_real_num_tx_queues(struct net_device *dev,
+                                       unsigned int txq);
+
+#ifdef CONFIG_RPS
+extern int netif_set_real_num_rx_queues(struct net_device *dev,
+                                       unsigned int rxq);
+#else
+static inline int netif_set_real_num_rx_queues(struct net_device *dev,
+                                               unsigned int rxq)
+{
+       return 0;
+}
+#endif
+
+static inline int netif_copy_real_num_queues(struct net_device *to_dev,
+                                            const struct net_device *from_dev)
+{
+       netif_set_real_num_tx_queues(to_dev, from_dev->real_num_tx_queues);
+#ifdef CONFIG_RPS
+       return netif_set_real_num_rx_queues(to_dev,
+                                           from_dev->real_num_rx_queues);
+#else
+       return 0;
+#endif
 }
 
 /* Use this variant when it is known for sure that it
@@ -1601,8 +1816,7 @@ extern gro_result_t       dev_gro_receive(struct napi_struct *napi,
 extern gro_result_t    napi_skb_finish(gro_result_t ret, struct sk_buff *skb);
 extern gro_result_t    napi_gro_receive(struct napi_struct *napi,
                                         struct sk_buff *skb);
-extern void            napi_reuse_skb(struct napi_struct *napi,
-                                      struct sk_buff *skb);
+extern void            napi_gro_flush(struct napi_struct *napi);
 extern struct sk_buff *        napi_get_frags(struct napi_struct *napi);
 extern gro_result_t    napi_frags_finish(struct napi_struct *napi,
                                          struct sk_buff *skb,
@@ -1616,7 +1830,11 @@ static inline void napi_free_frags(struct napi_struct *napi)
        napi->skb = NULL;
 }
 
-extern void            netif_nit_deliver(struct sk_buff *skb);
+extern int netdev_rx_handler_register(struct net_device *dev,
+                                     rx_handler_func_t *rx_handler,
+                                     void *rx_handler_data);
+extern void netdev_rx_handler_unregister(struct net_device *dev);
+
 extern int             dev_valid_name(const char *name);
 extern int             dev_ioctl(struct net *net, unsigned int cmd, void __user *);
 extern int             dev_ethtool(struct net *net, struct ifreq *);
@@ -1650,7 +1868,7 @@ extern void netdev_run_todo(void);
  */
 static inline void dev_put(struct net_device *dev)
 {
-       atomic_dec(&dev->refcnt);
+       irqsafe_cpu_dec(*dev->pcpu_refcnt);
 }
 
 /**
@@ -1661,7 +1879,7 @@ static inline void dev_put(struct net_device *dev)
  */
 static inline void dev_hold(struct net_device *dev)
 {
-       atomic_inc(&dev->refcnt);
+       irqsafe_cpu_inc(*dev->pcpu_refcnt);
 }
 
 /* Carrier loss detection, dial on demand. The functions netif_carrier_on
@@ -1695,6 +1913,8 @@ extern void netif_carrier_on(struct net_device *dev);
 
 extern void netif_carrier_off(struct net_device *dev);
 
+extern void netif_notify_peers(struct net_device *dev);
+
 /**
  *     netif_dormant_on - mark device as dormant.
  *     @dev: network device
@@ -1971,14 +2191,34 @@ static inline void netif_addr_unlock_bh(struct net_device *dev)
 extern void            ether_setup(struct net_device *dev);
 
 /* Support for loadable net-drivers */
-extern struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
+extern struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
                                       void (*setup)(struct net_device *),
-                                      unsigned int queue_count);
+                                      unsigned int txqs, unsigned int rxqs);
 #define alloc_netdev(sizeof_priv, name, setup) \
-       alloc_netdev_mq(sizeof_priv, name, setup, 1)
+       alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1)
+
+#define alloc_netdev_mq(sizeof_priv, name, setup, count) \
+       alloc_netdev_mqs(sizeof_priv, name, setup, count, count)
+
 extern int             register_netdev(struct net_device *dev);
 extern void            unregister_netdev(struct net_device *dev);
 
+/* General hardware address lists handling functions */
+extern int __hw_addr_add_multiple(struct netdev_hw_addr_list *to_list,
+                                 struct netdev_hw_addr_list *from_list,
+                                 int addr_len, unsigned char addr_type);
+extern void __hw_addr_del_multiple(struct netdev_hw_addr_list *to_list,
+                                  struct netdev_hw_addr_list *from_list,
+                                  int addr_len, unsigned char addr_type);
+extern int __hw_addr_sync(struct netdev_hw_addr_list *to_list,
+                         struct netdev_hw_addr_list *from_list,
+                         int addr_len);
+extern void __hw_addr_unsync(struct netdev_hw_addr_list *to_list,
+                            struct netdev_hw_addr_list *from_list,
+                            int addr_len);
+extern void __hw_addr_flush(struct netdev_hw_addr_list *list);
+extern void __hw_addr_init(struct netdev_hw_addr_list *list);
+
 /* Functions used for device addresses handling */
 extern int dev_addr_add(struct net_device *dev, unsigned char *addr,
                        unsigned char addr_type);
@@ -1990,24 +2230,30 @@ extern int dev_addr_add_multiple(struct net_device *to_dev,
 extern int dev_addr_del_multiple(struct net_device *to_dev,
                                 struct net_device *from_dev,
                                 unsigned char addr_type);
+extern void dev_addr_flush(struct net_device *dev);
+extern int dev_addr_init(struct net_device *dev);
+
+/* Functions used for unicast addresses handling */
+extern int dev_uc_add(struct net_device *dev, unsigned char *addr);
+extern int dev_uc_del(struct net_device *dev, unsigned char *addr);
+extern int dev_uc_sync(struct net_device *to, struct net_device *from);
+extern void dev_uc_unsync(struct net_device *to, struct net_device *from);
+extern void dev_uc_flush(struct net_device *dev);
+extern void dev_uc_init(struct net_device *dev);
+
+/* Functions used for multicast addresses handling */
+extern int dev_mc_add(struct net_device *dev, unsigned char *addr);
+extern int dev_mc_add_global(struct net_device *dev, unsigned char *addr);
+extern int dev_mc_del(struct net_device *dev, unsigned char *addr);
+extern int dev_mc_del_global(struct net_device *dev, unsigned char *addr);
+extern int dev_mc_sync(struct net_device *to, struct net_device *from);
+extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
+extern void dev_mc_flush(struct net_device *dev);
+extern void dev_mc_init(struct net_device *dev);
 
 /* Functions used for secondary unicast and multicast support */
 extern void            dev_set_rx_mode(struct net_device *dev);
 extern void            __dev_set_rx_mode(struct net_device *dev);
-extern int             dev_unicast_delete(struct net_device *dev, void *addr);
-extern int             dev_unicast_add(struct net_device *dev, void *addr);
-extern int             dev_unicast_sync(struct net_device *to, struct net_device *from);
-extern void            dev_unicast_unsync(struct net_device *to, struct net_device *from);
-extern void            dev_unicast_flush(struct net_device *dev);
-extern int             dev_mc_delete(struct net_device *dev, void *addr, int alen, int all);
-extern int             dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly);
-extern int             dev_mc_sync(struct net_device *to, struct net_device *from);
-extern void            dev_mc_unsync(struct net_device *to, struct net_device *from);
-extern void            dev_addr_discard(struct net_device *dev);
-extern int             __dev_addr_delete(struct dev_addr_list **list, int *count, void *addr, int alen, int all);
-extern int             __dev_addr_add(struct dev_addr_list **list, int *count, void *addr, int alen, int newonly);
-extern int             __dev_addr_sync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
-extern void            __dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
 extern int             dev_set_promiscuity(struct net_device *dev, int inc);
 extern int             dev_set_allmulti(struct net_device *dev, int inc);
 extern void            netdev_state_change(struct net_device *dev);
@@ -2017,10 +2263,11 @@ extern void             netdev_features_change(struct net_device *dev);
 /* Load a device via the kmod */
 extern void            dev_load(struct net *net, const char *name);
 extern void            dev_mcast_init(void);
-extern const struct net_device_stats *dev_get_stats(struct net_device *dev);
-extern void            dev_txq_stats_fold(const struct net_device *dev, struct net_device_stats *stats);
+extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
+                                              struct rtnl_link_stats64 *storage);
 
 extern int             netdev_max_backlog;
+extern int             netdev_tstamp_prequeue;
 extern int             weight_p;
 extern int             netdev_set_master(struct net_device *dev, struct net_device *master);
 extern int skb_checksum_help(struct sk_buff *skb);
@@ -2045,6 +2292,8 @@ extern void dev_seq_stop(struct seq_file *seq, void *v);
 extern int netdev_class_create_file(struct class_attribute *class_attr);
 extern void netdev_class_remove_file(struct class_attribute *class_attr);
 
+extern struct kobj_ns_type_operations net_ns_type_operations;
+
 extern char *netdev_drivername(const struct net_device *dev, char *buffer, int len);
 
 extern void linkwatch_run_queue(void);
@@ -2056,6 +2305,8 @@ unsigned long netdev_fix_features(unsigned long features, const char *name);
 void netif_stacked_transfer_operstate(const struct net_device *rootdev,
                                        struct net_device *dev);
 
+int netif_skb_features(struct sk_buff *skb);
+
 static inline int net_gso_ok(int features, int gso_type)
 {
        int feature = gso_type << NETIF_F_GSO_SHIFT;
@@ -2065,13 +2316,12 @@ static inline int net_gso_ok(int features, int gso_type)
 static inline int skb_gso_ok(struct sk_buff *skb, int features)
 {
        return net_gso_ok(features, skb_shinfo(skb)->gso_type) &&
-              (!skb_has_frags(skb) || (features & NETIF_F_FRAGLIST));
+              (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST));
 }
 
-static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
+static inline int netif_needs_gso(struct sk_buff *skb, int features)
 {
-       return skb_is_gso(skb) &&
-              (!skb_gso_ok(skb, dev->features) ||
+       return skb_is_gso(skb) && (!skb_gso_ok(skb, features) ||
                unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
 }
 
@@ -2081,54 +2331,14 @@ static inline void netif_set_gso_max_size(struct net_device *dev,
        dev->gso_max_size = size;
 }
 
-static inline void skb_bond_set_mac_by_master(struct sk_buff *skb,
-                                             struct net_device *master)
-{
-       if (skb->pkt_type == PACKET_HOST) {
-               u16 *dest = (u16 *) eth_hdr(skb)->h_dest;
+extern int __skb_bond_should_drop(struct sk_buff *skb,
+                                 struct net_device *master);
 
-               memcpy(dest, master->dev_addr, ETH_ALEN);
-       }
-}
-
-/* On bonding slaves other than the currently active slave, suppress
- * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and
- * ARP on active-backup slaves with arp_validate enabled.
- */
 static inline int skb_bond_should_drop(struct sk_buff *skb,
                                       struct net_device *master)
 {
-       if (master) {
-               struct net_device *dev = skb->dev;
-
-               if (master->priv_flags & IFF_MASTER_ARPMON)
-                       dev->last_rx = jiffies;
-
-               if ((master->priv_flags & IFF_MASTER_ALB) && master->br_port) {
-                       /* Do address unmangle. The local destination address
-                        * will be always the one master has. Provides the right
-                        * functionality in a bridge.
-                        */
-                       skb_bond_set_mac_by_master(skb, master);
-               }
-
-               if (dev->priv_flags & IFF_SLAVE_INACTIVE) {
-                       if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
-                           skb->protocol == __cpu_to_be16(ETH_P_ARP))
-                               return 0;
-
-                       if (master->priv_flags & IFF_MASTER_ALB) {
-                               if (skb->pkt_type != PACKET_BROADCAST &&
-                                   skb->pkt_type != PACKET_MULTICAST)
-                                       return 0;
-                       }
-                       if (master->priv_flags & IFF_MASTER_8023AD &&
-                           skb->protocol == __cpu_to_be16(ETH_P_SLOW))
-                               return 0;
-
-                       return 1;
-               }
-       }
+       if (master)
+               return __skb_bond_should_drop(skb, master);
        return 0;
 }
 
@@ -2167,25 +2377,26 @@ static inline const char *netdev_name(const struct net_device *dev)
        return dev->name;
 }
 
-#define netdev_printk(level, netdev, format, args...)          \
-       dev_printk(level, (netdev)->dev.parent,                 \
-                  "%s: " format,                               \
-                  netdev_name(netdev), ##args)
-
-#define netdev_emerg(dev, format, args...)                     \
-       netdev_printk(KERN_EMERG, dev, format, ##args)
-#define netdev_alert(dev, format, args...)                     \
-       netdev_printk(KERN_ALERT, dev, format, ##args)
-#define netdev_crit(dev, format, args...)                      \
-       netdev_printk(KERN_CRIT, dev, format, ##args)
-#define netdev_err(dev, format, args...)                       \
-       netdev_printk(KERN_ERR, dev, format, ##args)
-#define netdev_warn(dev, format, args...)                      \
-       netdev_printk(KERN_WARNING, dev, format, ##args)
-#define netdev_notice(dev, format, args...)                    \
-       netdev_printk(KERN_NOTICE, dev, format, ##args)
-#define netdev_info(dev, format, args...)                      \
-       netdev_printk(KERN_INFO, dev, format, ##args)
+extern int netdev_printk(const char *level, const struct net_device *dev,
+                        const char *format, ...)
+       __attribute__ ((format (printf, 3, 4)));
+extern int netdev_emerg(const struct net_device *dev, const char *format, ...)
+       __attribute__ ((format (printf, 2, 3)));
+extern int netdev_alert(const struct net_device *dev, const char *format, ...)
+       __attribute__ ((format (printf, 2, 3)));
+extern int netdev_crit(const struct net_device *dev, const char *format, ...)
+       __attribute__ ((format (printf, 2, 3)));
+extern int netdev_err(const struct net_device *dev, const char *format, ...)
+       __attribute__ ((format (printf, 2, 3)));
+extern int netdev_warn(const struct net_device *dev, const char *format, ...)
+       __attribute__ ((format (printf, 2, 3)));
+extern int netdev_notice(const struct net_device *dev, const char *format, ...)
+       __attribute__ ((format (printf, 2, 3)));
+extern int netdev_info(const struct net_device *dev, const char *format, ...)
+       __attribute__ ((format (printf, 2, 3)));
+
+#define MODULE_ALIAS_NETDEV(device) \
+       MODULE_ALIAS("netdev-" device)
 
 #if defined(DEBUG)
 #define netdev_dbg(__dev, format, args...)                     \
@@ -2233,20 +2444,26 @@ do {                                                            \
                netdev_printk(level, (dev), fmt, ##args);       \
 } while (0)
 
+#define netif_level(level, priv, type, dev, fmt, args...)      \
+do {                                                           \
+       if (netif_msg_##type(priv))                             \
+               netdev_##level(dev, fmt, ##args);               \
+} while (0)
+
 #define netif_emerg(priv, type, dev, fmt, args...)             \
-       netif_printk(priv, type, KERN_EMERG, dev, fmt, ##args)
+       netif_level(emerg, priv, type, dev, fmt, ##args)
 #define netif_alert(priv, type, dev, fmt, args...)             \
-       netif_printk(priv, type, KERN_ALERT, dev, fmt, ##args)
+       netif_level(alert, priv, type, dev, fmt, ##args)
 #define netif_crit(priv, type, dev, fmt, args...)              \
-       netif_printk(priv, type, KERN_CRIT, dev, fmt, ##args)
+       netif_level(crit, priv, type, dev, fmt, ##args)
 #define netif_err(priv, type, dev, fmt, args...)               \
-       netif_printk(priv, type, KERN_ERR, dev, fmt, ##args)
+       netif_level(err, priv, type, dev, fmt, ##args)
 #define netif_warn(priv, type, dev, fmt, args...)              \
-       netif_printk(priv, type, KERN_WARNING, dev, fmt, ##args)
+       netif_level(warn, priv, type, dev, fmt, ##args)
 #define netif_notice(priv, type, dev, fmt, args...)            \
-       netif_printk(priv, type, KERN_NOTICE, dev, fmt, ##args)
+       netif_level(notice, priv, type, dev, fmt, ##args)
 #define netif_info(priv, type, dev, fmt, args...)              \
-       netif_printk(priv, type, KERN_INFO, (dev), fmt, ##args)
+       netif_level(info, priv, type, dev, fmt, ##args)
 
 #if defined(DEBUG)
 #define netif_dbg(priv, type, dev, format, args...)            \
@@ -2269,12 +2486,12 @@ do {                                                            \
 #endif
 
 #if defined(VERBOSE_DEBUG)
-#define netif_vdbg     netdev_dbg
+#define netif_vdbg     netif_dbg
 #else
 #define netif_vdbg(priv, type, dev, format, args...)           \
 ({                                                             \
        if (0)                                                  \
-               netif_printk(KERN_DEBUG, dev, format, ##args);  \
+               netif_printk(priv, type, KERN_DEBUG, dev, format, ##args); \
        0;                                                      \
 })
 #endif