ar71xx: use global timestamp for hang check
[openwrt/staging/lynxis.git] / target / linux / ar71xx / files / drivers / net / ethernet / atheros / ag71xx / ag71xx.h
index 7b1cc1e1032f7b87430a9be1507ddb3e3faa26bc..38dcc915f938aa4acd285a0b65053a2bd14a2381 100644 (file)
 #define AG71XX_DRV_NAME                "ag71xx"
 #define AG71XX_DRV_VERSION     "0.5.35"
 
+/*
+ * For our NAPI weight bigger does *NOT* mean better - it means more
+ * D-cache misses and lots more wasted cycles than we'll ever
+ * possibly gain from saving instructions.
+ */
+#define AG71XX_NAPI_WEIGHT     32
 #define AG71XX_OOM_REFILL      (1 + HZ/10)
 
 #define AG71XX_INT_ERR (AG71XX_INT_RX_BE | AG71XX_INT_TX_BE)
@@ -94,9 +100,8 @@ struct ag71xx_buf {
        };
        union {
                dma_addr_t      dma_addr;
-               unsigned long   timestamp;
+               unsigned int            len;
        };
-       unsigned int            len;
 };
 
 struct ag71xx_ring {
@@ -135,8 +140,8 @@ struct ag71xx_napi_stats {
        unsigned long           tx_packets;
        unsigned long           tx_packets_max;
 
-       unsigned long           rx[NAPI_POLL_WEIGHT + 1];
-       unsigned long           tx[NAPI_POLL_WEIGHT + 1];
+       unsigned long           rx[AG71XX_NAPI_WEIGHT + 1];
+       unsigned long           tx[AG71XX_NAPI_WEIGHT + 1];
 };
 
 struct ag71xx_debug {
@@ -147,20 +152,33 @@ struct ag71xx_debug {
 };
 
 struct ag71xx {
-       void __iomem            *mac_base;
+       /*
+        * Critical data related to the per-packet data path are clustered
+        * early in this structure to help improve the D-cache footprint.
+        */
+       struct ag71xx_ring      rx_ring ____cacheline_aligned;
+       struct ag71xx_ring      tx_ring ____cacheline_aligned;
+
+       unsigned int            max_frame_len;
+       unsigned int            desc_pktlen_mask;
+       unsigned int            rx_buf_size;
 
-       spinlock_t              lock;
-       struct platform_device  *pdev;
        struct net_device       *dev;
+       struct platform_device  *pdev;
+       spinlock_t              lock;
        struct napi_struct      napi;
        u32                     msg_enable;
 
+       unsigned long   timestamp;
+
+       /*
+        * From this point onwards we're not looking at per-packet fields.
+        */
+       void __iomem            *mac_base;
+
        struct ag71xx_desc      *stop_desc;
        dma_addr_t              stop_desc_dma;
 
-       struct ag71xx_ring      rx_ring;
-       struct ag71xx_ring      tx_ring;
-
        struct mii_bus          *mii_bus;
        struct phy_device       *phy_dev;
        void                    *phy_priv;
@@ -169,10 +187,6 @@ struct ag71xx {
        unsigned int            speed;
        int                     duplex;
 
-       unsigned int            max_frame_len;
-       unsigned int            desc_pktlen_mask;
-       unsigned int            rx_buf_size;
-
        struct delayed_work     restart_work;
        struct delayed_work     link_work;
        struct timer_list       oom_timer;