diff options
author | Giuseppe CAVALLARO <peppe.cavallaro@st.com> | 2013-04-07 22:10:02 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-04-08 16:55:27 -0400 |
commit | 1bb6dea8cc208e6bac824fcdaa3dc63d38901ca7 (patch) | |
tree | 23e495b81b81d2dbaa0f3dd11ad3f700faf65a5a /drivers/net/ethernet/stmicro/stmmac | |
parent | ceb694997e1b5d45627553ac7b1f88ff16cb9507 (diff) |
stmmac: review private structure fields
recently many new supports have been added in the stmmac driver w/o taking care
about where each new field had to be placed inside the private structure for
guaranteeing the best cache usage.
This is what I wanted in the beginning, so this patch reorganizes all the fields
in order to keep adjacent fields for cache effect.
I have also tried to optimize them by using pahole.
V2: do not abuse with ____cacheline_aligned_in_smp and keep fields that
potentially could stay in the same cache-line for better usage in SMP systems.
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/stmicro/stmmac')
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac.h | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 77d534a0267b..c922fde929a1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h | |||
@@ -35,36 +35,45 @@ | |||
35 | 35 | ||
36 | struct stmmac_priv { | 36 | struct stmmac_priv { |
37 | /* Frequently used values are kept adjacent for cache effect */ | 37 | /* Frequently used values are kept adjacent for cache effect */ |
38 | struct dma_desc *dma_tx ____cacheline_aligned; /* Basic TX desc */ | 38 | struct dma_extended_desc *dma_etx ____cacheline_aligned_in_smp; |
39 | struct dma_extended_desc *dma_etx; /* Extended TX descriptor */ | 39 | struct dma_desc *dma_tx; |
40 | dma_addr_t dma_tx_phy; | ||
41 | struct sk_buff **tx_skbuff; | 40 | struct sk_buff **tx_skbuff; |
42 | dma_addr_t *tx_skbuff_dma; | ||
43 | unsigned int cur_tx; | 41 | unsigned int cur_tx; |
44 | unsigned int dirty_tx; | 42 | unsigned int dirty_tx; |
45 | unsigned int dma_tx_size; | 43 | unsigned int dma_tx_size; |
44 | u32 tx_count_frames; | ||
45 | u32 tx_coal_frames; | ||
46 | u32 tx_coal_timer; | ||
47 | dma_addr_t *tx_skbuff_dma; | ||
48 | dma_addr_t dma_tx_phy; | ||
46 | int tx_coalesce; | 49 | int tx_coalesce; |
50 | int hwts_tx_en; | ||
51 | spinlock_t tx_lock; | ||
52 | bool tx_path_in_lpi_mode; | ||
53 | struct timer_list txtimer; | ||
47 | 54 | ||
48 | struct dma_desc *dma_rx; /* Basic RX descriptor */ | 55 | struct dma_desc *dma_rx ____cacheline_aligned_in_smp; |
49 | struct dma_extended_desc *dma_erx; /* Extended RX descriptor */ | 56 | struct dma_extended_desc *dma_erx; |
57 | struct sk_buff **rx_skbuff; | ||
50 | unsigned int cur_rx; | 58 | unsigned int cur_rx; |
51 | unsigned int dirty_rx; | 59 | unsigned int dirty_rx; |
52 | struct sk_buff **rx_skbuff; | 60 | unsigned int dma_rx_size; |
61 | unsigned int dma_buf_sz; | ||
62 | u32 rx_riwt; | ||
63 | int hwts_rx_en; | ||
53 | dma_addr_t *rx_skbuff_dma; | 64 | dma_addr_t *rx_skbuff_dma; |
65 | dma_addr_t dma_rx_phy; | ||
54 | 66 | ||
67 | struct napi_struct napi ____cacheline_aligned_in_smp; | ||
68 | |||
69 | void __iomem *ioaddr; | ||
55 | struct net_device *dev; | 70 | struct net_device *dev; |
56 | dma_addr_t dma_rx_phy; | ||
57 | unsigned int dma_rx_size; | ||
58 | unsigned int dma_buf_sz; | ||
59 | struct device *device; | 71 | struct device *device; |
60 | struct mac_device_info *hw; | 72 | struct mac_device_info *hw; |
61 | void __iomem *ioaddr; | ||
62 | |||
63 | struct stmmac_extra_stats xstats; | ||
64 | struct napi_struct napi; | ||
65 | int no_csum_insertion; | 73 | int no_csum_insertion; |
74 | spinlock_t lock; | ||
66 | 75 | ||
67 | struct phy_device *phydev; | 76 | struct phy_device *phydev ____cacheline_aligned_in_smp; |
68 | int oldlink; | 77 | int oldlink; |
69 | int speed; | 78 | int speed; |
70 | int oldduplex; | 79 | int oldduplex; |
@@ -73,39 +82,30 @@ struct stmmac_priv { | |||
73 | struct mii_bus *mii; | 82 | struct mii_bus *mii; |
74 | int mii_irq[PHY_MAX_ADDR]; | 83 | int mii_irq[PHY_MAX_ADDR]; |
75 | 84 | ||
76 | u32 msg_enable; | 85 | struct stmmac_extra_stats xstats ____cacheline_aligned_in_smp; |
77 | spinlock_t lock; | ||
78 | spinlock_t tx_lock; | ||
79 | int wolopts; | ||
80 | int wol_irq; | ||
81 | struct plat_stmmacenet_data *plat; | 86 | struct plat_stmmacenet_data *plat; |
82 | struct stmmac_counters mmc; | ||
83 | struct dma_features dma_cap; | 87 | struct dma_features dma_cap; |
88 | struct stmmac_counters mmc; | ||
84 | int hw_cap_support; | 89 | int hw_cap_support; |
90 | int synopsys_id; | ||
91 | u32 msg_enable; | ||
92 | int wolopts; | ||
93 | int wol_irq; | ||
85 | struct clk *stmmac_clk; | 94 | struct clk *stmmac_clk; |
86 | int clk_csr; | 95 | int clk_csr; |
87 | int synopsys_id; | ||
88 | struct timer_list eee_ctrl_timer; | 96 | struct timer_list eee_ctrl_timer; |
89 | bool tx_path_in_lpi_mode; | ||
90 | int lpi_irq; | 97 | int lpi_irq; |
91 | int eee_enabled; | 98 | int eee_enabled; |
92 | int eee_active; | 99 | int eee_active; |
93 | int tx_lpi_timer; | 100 | int tx_lpi_timer; |
94 | struct timer_list txtimer; | 101 | int pcs; |
95 | u32 tx_count_frames; | ||
96 | u32 tx_coal_frames; | ||
97 | u32 tx_coal_timer; | ||
98 | int use_riwt; | ||
99 | u32 rx_riwt; | ||
100 | unsigned int mode; | 102 | unsigned int mode; |
101 | int extend_desc; | 103 | int extend_desc; |
102 | int pcs; | ||
103 | int hwts_tx_en; | ||
104 | int hwts_rx_en; | ||
105 | unsigned int default_addend; | ||
106 | u32 adv_ts; | ||
107 | struct ptp_clock *ptp_clock; | 104 | struct ptp_clock *ptp_clock; |
108 | struct ptp_clock_info ptp_clock_ops; | 105 | struct ptp_clock_info ptp_clock_ops; |
106 | unsigned int default_addend; | ||
107 | u32 adv_ts; | ||
108 | int use_riwt; | ||
109 | spinlock_t ptp_lock; | 109 | spinlock_t ptp_lock; |
110 | }; | 110 | }; |
111 | 111 | ||