diff options
author | Eric Dumazet <edumazet@google.com> | 2013-03-30 02:31:03 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-30 17:31:24 -0400 |
commit | 4c3d5e7b41dda1b1372bfc2545ef092a1bc5ad33 (patch) | |
tree | 462060a03b25ae2ab4768c692804de1bca366389 /include/linux/netdevice.h | |
parent | 8f0923c17d34ac838b7f57709f87fe33f76ee219 (diff) |
net: reorder some fields of net_device
As time passed, some fields were added in net_device, and not
at sensible offsets.
Lets reorder some fields to reduce number of cache lines in RX path.
Fields not used in data path should be moved out of this critical cache
line.
In particular, move broadcast[] to the end of the rx section,
as it is less used, and ethernet uses only the beginning of the 32bytes
field.
Before patch :
offsetof(struct net_device,dev_addr)=0x258
offsetof(struct net_device,rx_handler)=0x2b8
offsetof(struct net_device,ingress_queue)=0x2c8
offsetof(struct net_device,broadcast)=0x278
After :
offsetof(struct net_device,dev_addr)=0x280
offsetof(struct net_device,rx_handler)=0x298
offsetof(struct net_device,ingress_queue)=0x2a8
offsetof(struct net_device,broadcast)=0x2b0
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r-- | include/linux/netdevice.h | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 1dbb02c98946..4491414a9218 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -1071,6 +1071,8 @@ struct net_device { | |||
1071 | struct list_head dev_list; | 1071 | struct list_head dev_list; |
1072 | struct list_head napi_list; | 1072 | struct list_head napi_list; |
1073 | struct list_head unreg_list; | 1073 | struct list_head unreg_list; |
1074 | struct list_head upper_dev_list; /* List of upper devices */ | ||
1075 | |||
1074 | 1076 | ||
1075 | /* currently active device features */ | 1077 | /* currently active device features */ |
1076 | netdev_features_t features; | 1078 | netdev_features_t features; |
@@ -1143,6 +1145,13 @@ struct net_device { | |||
1143 | spinlock_t addr_list_lock; | 1145 | spinlock_t addr_list_lock; |
1144 | struct netdev_hw_addr_list uc; /* Unicast mac addresses */ | 1146 | struct netdev_hw_addr_list uc; /* Unicast mac addresses */ |
1145 | struct netdev_hw_addr_list mc; /* Multicast mac addresses */ | 1147 | struct netdev_hw_addr_list mc; /* Multicast mac addresses */ |
1148 | struct netdev_hw_addr_list dev_addrs; /* list of device | ||
1149 | * hw addresses | ||
1150 | */ | ||
1151 | #ifdef CONFIG_SYSFS | ||
1152 | struct kset *queues_kset; | ||
1153 | #endif | ||
1154 | |||
1146 | bool uc_promisc; | 1155 | bool uc_promisc; |
1147 | unsigned int promiscuity; | 1156 | unsigned int promiscuity; |
1148 | unsigned int allmulti; | 1157 | unsigned int allmulti; |
@@ -1175,21 +1184,11 @@ struct net_device { | |||
1175 | * avoid dirtying this cache line. | 1184 | * avoid dirtying this cache line. |
1176 | */ | 1185 | */ |
1177 | 1186 | ||
1178 | struct list_head upper_dev_list; /* List of upper devices */ | ||
1179 | |||
1180 | /* Interface address info used in eth_type_trans() */ | 1187 | /* Interface address info used in eth_type_trans() */ |
1181 | unsigned char *dev_addr; /* hw address, (before bcast | 1188 | unsigned char *dev_addr; /* hw address, (before bcast |
1182 | because most packets are | 1189 | because most packets are |
1183 | unicast) */ | 1190 | unicast) */ |
1184 | 1191 | ||
1185 | struct netdev_hw_addr_list dev_addrs; /* list of device | ||
1186 | hw addresses */ | ||
1187 | |||
1188 | unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ | ||
1189 | |||
1190 | #ifdef CONFIG_SYSFS | ||
1191 | struct kset *queues_kset; | ||
1192 | #endif | ||
1193 | 1192 | ||
1194 | #ifdef CONFIG_RPS | 1193 | #ifdef CONFIG_RPS |
1195 | struct netdev_rx_queue *_rx; | 1194 | struct netdev_rx_queue *_rx; |
@@ -1200,18 +1199,14 @@ struct net_device { | |||
1200 | /* Number of RX queues currently active in device */ | 1199 | /* Number of RX queues currently active in device */ |
1201 | unsigned int real_num_rx_queues; | 1200 | unsigned int real_num_rx_queues; |
1202 | 1201 | ||
1203 | #ifdef CONFIG_RFS_ACCEL | ||
1204 | /* CPU reverse-mapping for RX completion interrupts, indexed | ||
1205 | * by RX queue number. Assigned by driver. This must only be | ||
1206 | * set if the ndo_rx_flow_steer operation is defined. */ | ||
1207 | struct cpu_rmap *rx_cpu_rmap; | ||
1208 | #endif | ||
1209 | #endif | 1202 | #endif |
1210 | 1203 | ||
1211 | rx_handler_func_t __rcu *rx_handler; | 1204 | rx_handler_func_t __rcu *rx_handler; |
1212 | void __rcu *rx_handler_data; | 1205 | void __rcu *rx_handler_data; |
1213 | 1206 | ||
1214 | struct netdev_queue __rcu *ingress_queue; | 1207 | struct netdev_queue __rcu *ingress_queue; |
1208 | unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ | ||
1209 | |||
1215 | 1210 | ||
1216 | /* | 1211 | /* |
1217 | * Cache lines mostly used on transmit path | 1212 | * Cache lines mostly used on transmit path |
@@ -1233,6 +1228,12 @@ struct net_device { | |||
1233 | #ifdef CONFIG_XPS | 1228 | #ifdef CONFIG_XPS |
1234 | struct xps_dev_maps __rcu *xps_maps; | 1229 | struct xps_dev_maps __rcu *xps_maps; |
1235 | #endif | 1230 | #endif |
1231 | #ifdef CONFIG_RFS_ACCEL | ||
1232 | /* CPU reverse-mapping for RX completion interrupts, indexed | ||
1233 | * by RX queue number. Assigned by driver. This must only be | ||
1234 | * set if the ndo_rx_flow_steer operation is defined. */ | ||
1235 | struct cpu_rmap *rx_cpu_rmap; | ||
1236 | #endif | ||
1236 | 1237 | ||
1237 | /* These may be needed for future network-power-down code. */ | 1238 | /* These may be needed for future network-power-down code. */ |
1238 | 1239 | ||