]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - include/linux/netdevice.h
net: add a core netdev->rx_dropped counter
[net-next-2.6.git] / include / linux / netdevice.h
index 01bd4c82d982a525fc0e8de915e668c975ce9560..6abcef67b1784e2309394976ac41133c5bbd337f 100644 (file)
@@ -884,6 +884,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).
@@ -976,14 +979,17 @@ 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
 
        rx_handler_func_t       *rx_handler;
        void                    *rx_handler_data;
 
-       struct netdev_queue     rx_queue; /* use two cache lines */
+       struct netdev_queue __rcu *ingress_queue;
 
 /*
  * Cache lines mostly used on transmit path
@@ -1053,6 +1059,8 @@ struct net_device {
        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;
@@ -1684,6 +1692,29 @@ static inline int netif_is_multiqueue(const struct net_device *dev)
 extern void 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
  * is executing from hardware interrupt context or with hardware interrupts
  * disabled.