summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudiu Manoil <claudiu.manoil@freescale.com>2013-02-14 00:00:03 -0500
committerDavid S. Miller <davem@davemloft.net>2013-02-14 13:32:24 -0500
commitb597d20d59b84f0fc3735de75c3efd6e6eb4365d (patch)
tree5ebb34d5ca07986434e233b0f7ecc842e4772917
parent369ec162b30e34c29bef8ec5ce32c40d5697fd64 (diff)
gianfar: Cleanup and optimize struct gfar_private
Group run-time critical fields within the 1st cacheline (32B) followed by the tx|rx_queue reference arrays and the interrupt group instances (gfargrp), all cacheline aligned. This has several benefits. Firstly comes the performance benefit by having the members required by the driver's hot path re-grouped in the structure's first cache lines, whereas the unimportant members were pushed towards the end of the struct. Another benefit comes from eliminating a 24 byte memory hole that was rendering gfar_priv's 2nd cacheline useless. The default gcc layout of gfar_private leaves an implicit 24 byte hole after the errata (enum) member. This patch fixes it. The uchar bitfields were pushed towards the end of the struct as these are not run-time performance critical (used for init time operations). Because there is no other 2 byte member around to couple the uchar bitfields memeber with, we will have an addititnal 2 byte hole after the bitfields. This is unsignificant however, and it doesn't influence gfar_priv's size, because the whole structure is padded to be a 32B multiple. Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/freescale/gianfar.h93
1 files changed, 48 insertions, 45 deletions
diff --git a/drivers/net/ethernet/freescale/gianfar.h b/drivers/net/ethernet/freescale/gianfar.h
index 8b27e5ff54c0..1e2ce8bfea83 100644
--- a/drivers/net/ethernet/freescale/gianfar.h
+++ b/drivers/net/ethernet/freescale/gianfar.h
@@ -1049,28 +1049,64 @@ enum gfar_errata {
1049 * the buffer descriptor determines the actual condition. 1049 * the buffer descriptor determines the actual condition.
1050 */ 1050 */
1051struct gfar_private { 1051struct gfar_private {
1052
1053 /* Indicates how many tx, rx queues are enabled */
1054 unsigned int num_tx_queues;
1055 unsigned int num_rx_queues; 1052 unsigned int num_rx_queues;
1056 unsigned int num_grps;
1057 unsigned int mode;
1058
1059 /* The total tx and rx ring size for the enabled queues */
1060 unsigned int total_tx_ring_size;
1061 unsigned int total_rx_ring_size;
1062 1053
1063 struct device *dev; 1054 struct device *dev;
1064 struct net_device *ndev; 1055 struct net_device *ndev;
1065 struct platform_device *ofdev;
1066 enum gfar_errata errata; 1056 enum gfar_errata errata;
1057 unsigned int rx_buffer_size;
1058
1059 u16 padding;
1060
1061 /* HW time stamping enabled flag */
1062 int hwts_rx_en;
1063 int hwts_tx_en;
1067 1064
1068 struct gfar_priv_grp gfargrp[MAXGROUPS];
1069 struct gfar_priv_tx_q *tx_queue[MAX_TX_QS]; 1065 struct gfar_priv_tx_q *tx_queue[MAX_TX_QS];
1070 struct gfar_priv_rx_q *rx_queue[MAX_RX_QS]; 1066 struct gfar_priv_rx_q *rx_queue[MAX_RX_QS];
1067 struct gfar_priv_grp gfargrp[MAXGROUPS];
1068
1069 u32 device_flags;
1070
1071 unsigned int mode;
1072 unsigned int num_tx_queues;
1073 unsigned int num_grps;
1074
1075 /* Network Statistics */
1076 struct gfar_extra_stats extra_stats;
1077
1078 /* PHY stuff */
1079 phy_interface_t interface;
1080 struct device_node *phy_node;
1081 struct device_node *tbi_node;
1082 struct phy_device *phydev;
1083 struct mii_bus *mii_bus;
1084 int oldspeed;
1085 int oldduplex;
1086 int oldlink;
1087
1088 /* Bitfield update lock */
1089 spinlock_t bflock;
1090
1091 uint32_t msg_enable;
1092
1093 struct work_struct reset_task;
1094
1095 struct platform_device *ofdev;
1096 unsigned char
1097 extended_hash:1,
1098 bd_stash_en:1,
1099 rx_filer_enable:1,
1100 /* Wake-on-LAN enabled */
1101 wol_en:1,
1102 /* Enable priorty based Tx scheduling in Hw */
1103 prio_sched_en:1;
1104
1105 /* The total tx and rx ring size for the enabled queues */
1106 unsigned int total_tx_ring_size;
1107 unsigned int total_rx_ring_size;
1071 1108
1072 /* RX per device parameters */ 1109 /* RX per device parameters */
1073 unsigned int rx_buffer_size;
1074 unsigned int rx_stash_size; 1110 unsigned int rx_stash_size;
1075 unsigned int rx_stash_index; 1111 unsigned int rx_stash_index;
1076 1112
@@ -1089,39 +1125,6 @@ struct gfar_private {
1089 unsigned int fifo_starve; 1125 unsigned int fifo_starve;
1090 unsigned int fifo_starve_off; 1126 unsigned int fifo_starve_off;
1091 1127
1092 /* Bitfield update lock */
1093 spinlock_t bflock;
1094
1095 phy_interface_t interface;
1096 struct device_node *phy_node;
1097 struct device_node *tbi_node;
1098 u32 device_flags;
1099 unsigned char
1100 extended_hash:1,
1101 bd_stash_en:1,
1102 rx_filer_enable:1,
1103 wol_en:1, /* Wake-on-LAN enabled */
1104 prio_sched_en:1; /* Enable priorty based Tx scheduling in Hw */
1105 unsigned short padding;
1106
1107 /* PHY stuff */
1108 struct phy_device *phydev;
1109 struct mii_bus *mii_bus;
1110 int oldspeed;
1111 int oldduplex;
1112 int oldlink;
1113
1114 uint32_t msg_enable;
1115
1116 struct work_struct reset_task;
1117
1118 /* Network Statistics */
1119 struct gfar_extra_stats extra_stats;
1120
1121 /* HW time stamping enabled flag */
1122 int hwts_rx_en;
1123 int hwts_tx_en;
1124
1125 /*Filer table*/ 1128 /*Filer table*/
1126 unsigned int ftp_rqfpr[MAX_FILER_IDX + 1]; 1129 unsigned int ftp_rqfpr[MAX_FILER_IDX + 1];
1127 unsigned int ftp_rqfcr[MAX_FILER_IDX + 1]; 1130 unsigned int ftp_rqfcr[MAX_FILER_IDX + 1];