net: Embed hh_cache inside of struct neighbour.
[deliverable/linux.git] / include / linux / netdevice.h
index 0249fe7e38721c7eb302a4a42affe34c28ace95f..5ccc0cb8352b1e95a5f25aa7197ee96eb29ddd6f 100644 (file)
@@ -34,7 +34,6 @@
 #include <linux/pm_qos_params.h>
 #include <linux/timer.h>
 #include <linux/delay.h>
-#include <linux/mm.h>
 #include <asm/atomic.h>
 #include <asm/cache.h>
 #include <asm/byteorder.h>
@@ -61,11 +60,6 @@ struct wireless_dev;
 #define SET_ETHTOOL_OPS(netdev,ops) \
        ( (netdev)->ethtool_ops = (ops) )
 
-#define HAVE_ALLOC_NETDEV              /* feature macro: alloc_xxxdev
-                                          functions are available. */
-#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 */
@@ -258,20 +252,8 @@ struct netdev_hw_addr_list {
        netdev_hw_addr_list_for_each(ha, &(dev)->mc)
 
 struct hh_cache {
-       struct hh_cache *hh_next;       /* Next entry                        */
-       atomic_t        hh_refcnt;      /* number of users                   */
-/*
- * We want hh_output, hh_len, hh_lock and hh_data be a in a separate
- * cache line on SMP.
- * They are mostly read, but hh_refcnt may be changed quite frequently,
- * incurring cache line ping pongs.
- */
-       __be16          hh_type ____cacheline_aligned_in_smp;
-                                       /* protocol identifier, f.e ETH_P_IP
-                                         *  NOTE:  For VLANs, this will be the
-                                         *  encapuslated type. --BLG
-                                         */
-       u16             hh_len;         /* length of header */
+       u16             hh_len;
+       u16             __pad;
        int             (*hh_output)(struct sk_buff *skb);
        seqlock_t       hh_lock;
 
@@ -284,12 +266,6 @@ 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 +
@@ -314,8 +290,7 @@ struct header_ops {
                           const void *saddr, unsigned len);
        int     (*parse)(const struct sk_buff *skb, unsigned char *haddr);
        int     (*rebuild)(struct sk_buff *skb);
-#define HAVE_HEADER_CACHE
-       int     (*cache)(const struct neighbour *neigh, struct hh_cache *hh);
+       int     (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type);
        void    (*cache_update)(struct hh_cache *hh,
                                const struct net_device *dev,
                                const unsigned char *haddr);
@@ -888,7 +863,6 @@ struct netdev_tc_txq {
  *     Must return >0 or -errno if it changed dev->features itself.
  *
  */
-#define HAVE_NET_DEVICE_OPS
 struct net_device_ops {
        int                     (*ndo_init)(struct net_device *dev);
        void                    (*ndo_uninit)(struct net_device *dev);
@@ -1020,9 +994,6 @@ struct net_device {
         *      part of the usual set specified in Space.c.
         */
 
-       unsigned char           if_port;        /* Selectable AUI, TP,..*/
-       unsigned char           dma;            /* DMA channel          */
-
        unsigned long           state;
 
        struct list_head        dev_list;
@@ -1035,7 +1006,7 @@ struct net_device {
        u32                     hw_features;
        /* user-requested features */
        u32                     wanted_features;
-       /* VLAN feature mask */
+       /* mask of features inheritable by VLAN devices */
        u32                     vlan_features;
 
        /* Net device feature bits; if you change something,
@@ -1066,6 +1037,8 @@ struct net_device {
 #define NETIF_F_NTUPLE         (1 << 27) /* N-tuple filters supported */
 #define NETIF_F_RXHASH         (1 << 28) /* Receive hashing offload */
 #define NETIF_F_RXCSUM         (1 << 29) /* Receive checksumming offload */
+#define NETIF_F_NOCACHE_COPY   (1 << 30) /* Use no-cache copyfromuser */
+#define NETIF_F_LOOPBACK       (1 << 31) /* Enable loopback */
 
        /* Segmentation offload features */
 #define NETIF_F_GSO_SHIFT      16
@@ -1079,9 +1052,9 @@ struct net_device {
 
        /* Features valid for ethtool to change */
        /* = all defined minus driver/device-class-related */
-#define NETIF_F_NEVER_CHANGE   (NETIF_F_HIGHDMA | NETIF_F_VLAN_CHALLENGED | \
+#define NETIF_F_NEVER_CHANGE   (NETIF_F_VLAN_CHALLENGED | \
                                  NETIF_F_LLTX | NETIF_F_NETNS_LOCAL)
-#define NETIF_F_ETHTOOL_BITS   (0x3f3fffff & ~NETIF_F_NEVER_CHANGE)
+#define NETIF_F_ETHTOOL_BITS   (0xff3fffff & ~NETIF_F_NEVER_CHANGE)
 
        /* List of features with software fallbacks. */
 #define NETIF_F_GSO_SOFTWARE   (NETIF_F_TSO | NETIF_F_TSO_ECN | \
@@ -1095,9 +1068,14 @@ struct net_device {
 
 #define NETIF_F_ALL_TSO        (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
 
+#define NETIF_F_ALL_FCOE       (NETIF_F_FCOE_CRC | NETIF_F_FCOE_MTU | \
+                                NETIF_F_FSO)
+
 #define NETIF_F_ALL_TX_OFFLOADS        (NETIF_F_ALL_CSUM | NETIF_F_SG | \
                                 NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \
-                                NETIF_F_SCTP_CSUM | NETIF_F_FCOE_CRC)
+                                NETIF_F_HIGHDMA | \
+                                NETIF_F_SCTP_CSUM | \
+                                NETIF_F_ALL_FCOE)
 
        /*
         * If one device supports one of these features, then enable them
@@ -1105,7 +1083,12 @@ struct net_device {
         */
 #define NETIF_F_ONE_FOR_ALL    (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \
                                 NETIF_F_SG | NETIF_F_HIGHDMA |         \
-                                NETIF_F_FRAGLIST)
+                                NETIF_F_FRAGLIST | NETIF_F_VLAN_CHALLENGED)
+       /*
+        * If one device doesn't support one of these features, then disable it
+        * for all in netdev_increment_features.
+        */
+#define NETIF_F_ALL_FOR_ALL    (NETIF_F_NOCACHE_COPY | NETIF_F_FSO)
 
        /* changeable features with no special hardware requirements */
 #define NETIF_F_SOFT_FEATURES  (NETIF_F_GSO | NETIF_F_GRO)
@@ -1134,13 +1117,16 @@ struct net_device {
        const struct header_ops *header_ops;
 
        unsigned int            flags;  /* interface flags (a la BSD)   */
+       unsigned int            priv_flags; /* Like 'flags' but invisible to userspace. */
        unsigned short          gflags;
-        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 char           if_port;        /* Selectable AUI, TP,..*/
+       unsigned char           dma;            /* DMA channel          */
+
        unsigned int            mtu;    /* interface MTU value          */
        unsigned short          type;   /* interface hardware type      */
        unsigned short          hard_header_len;        /* hardware hdr length  */
@@ -1281,7 +1267,9 @@ struct net_device {
               NETREG_UNREGISTERED,     /* completed unregister todo */
               NETREG_RELEASED,         /* called free_netdev */
               NETREG_DUMMY,            /* dummy device for NAPI poll */
-       } reg_state:16;
+       } reg_state:8;
+
+       bool dismantle; /* device is going do be freed */
 
        enum {
                RTNL_LINK_INITIALIZED,
@@ -1334,9 +1322,6 @@ struct net_device {
        /* max exchange id for FCoE LRO by ddp */
        unsigned int            fcoe_ddp_xid;
 #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;
 
@@ -1549,7 +1534,6 @@ struct packet_type {
        struct list_head        list;
 };
 
-#include <linux/interrupt.h>
 #include <linux/notifier.h>
 
 extern rwlock_t                                dev_base_lock;          /* Device list lock */
@@ -1772,8 +1756,6 @@ static inline void input_queue_tail_incr_save(struct softnet_data *sd,
 
 DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data);
 
-#define HAVE_NETIF_QUEUE
-
 extern void __netif_schedule(struct Qdisc *q);
 
 static inline void netif_schedule_queue(struct netdev_queue *txq)
@@ -2049,10 +2031,8 @@ extern void dev_kfree_skb_irq(struct sk_buff *skb);
  */
 extern void dev_kfree_skb_any(struct sk_buff *skb);
 
-#define HAVE_NETIF_RX 1
 extern int             netif_rx(struct sk_buff *skb);
 extern int             netif_rx_ni(struct sk_buff *skb);
-#define HAVE_NETIF_RECEIVE_SKB 1
 extern int             netif_receive_skb(struct sk_buff *skb);
 extern gro_result_t    dev_gro_receive(struct napi_struct *napi,
                                        struct sk_buff *skb);
@@ -2232,7 +2212,6 @@ extern void netif_device_attach(struct net_device *dev);
 /*
  * Network interface message level settings
  */
-#define HAVE_NETIF_MSG 1
 
 enum {
        NETIF_MSG_DRV           = 0x0001,
@@ -2513,6 +2492,7 @@ extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
 extern int             netdev_max_backlog;
 extern int             netdev_tstamp_prequeue;
 extern int             weight_p;
+extern int             bpf_jit_enable;
 extern int             netdev_set_master(struct net_device *dev, struct net_device *master);
 extern int netdev_set_bond_master(struct net_device *dev,
                                  struct net_device *master);
@@ -2540,7 +2520,7 @@ 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 const char *netdev_drivername(const struct net_device *dev);
 
 extern void linkwatch_run_queue(void);
 
@@ -2550,7 +2530,9 @@ static inline u32 netdev_get_wanted_features(struct net_device *dev)
 }
 u32 netdev_increment_features(u32 all, u32 one, u32 mask);
 u32 netdev_fix_features(struct net_device *dev, u32 features);
+int __netdev_update_features(struct net_device *dev);
 void netdev_update_features(struct net_device *dev);
+void netdev_change_features(struct net_device *dev);
 
 void netif_stacked_transfer_operstate(const struct net_device *rootdev,
                                        struct net_device *dev);
@@ -2588,13 +2570,8 @@ static inline int netif_is_bond_slave(struct net_device *dev)
 
 extern struct pernet_operations __net_initdata loopback_net_ops;
 
-static inline int dev_ethtool_get_settings(struct net_device *dev,
-                                          struct ethtool_cmd *cmd)
-{
-       if (!dev->ethtool_ops || !dev->ethtool_ops->get_settings)
-               return -EOPNOTSUPP;
-       return dev->ethtool_ops->get_settings(dev, cmd);
-}
+int dev_ethtool_get_settings(struct net_device *dev,
+                            struct ethtool_cmd *cmd);
 
 static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev)
 {
This page took 0.055055 seconds and 5 git commands to generate.