aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2010-12-06 17:53:15 -0500
committerBen Hutchings <bhutchings@solarflare.com>2010-12-06 17:53:42 -0500
commitab28c12a8e6fea875b6757052e211772f62fa771 (patch)
tree69f71631156cd9bc40b7c3ed20547fbe8e7fc458 /drivers/net/sfc
parent289700dbc40c78741f17e2304ed4ac0db3c3afd3 (diff)
sfc: Reorder struct efx_nic to separate fields by volatility
Place the regularly updated fields (locks, MAC stats, etc.) on a separate cache-line from fields which are mostly constant. This should reduce cache misses for access to the latter on the data path. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers/net/sfc')
-rw-r--r--drivers/net/sfc/net_driver.h41
1 files changed, 23 insertions, 18 deletions
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h
index 0d19fbfc5c2c..60d63711d43f 100644
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -625,10 +625,8 @@ struct efx_filter_state;
625 * Work items do not hold and must not acquire RTNL. 625 * Work items do not hold and must not acquire RTNL.
626 * @workqueue_name: Name of workqueue 626 * @workqueue_name: Name of workqueue
627 * @reset_work: Scheduled reset workitem 627 * @reset_work: Scheduled reset workitem
628 * @monitor_work: Hardware monitor workitem
629 * @membase_phys: Memory BAR value as physical address 628 * @membase_phys: Memory BAR value as physical address
630 * @membase: Memory BAR value 629 * @membase: Memory BAR value
631 * @biu_lock: BIU (bus interface unit) lock
632 * @interrupt_mode: Interrupt mode 630 * @interrupt_mode: Interrupt mode
633 * @irq_rx_adaptive: Adaptive IRQ moderation enabled for RX event queues 631 * @irq_rx_adaptive: Adaptive IRQ moderation enabled for RX event queues
634 * @irq_rx_moderation: IRQ moderation time for RX event queues 632 * @irq_rx_moderation: IRQ moderation time for RX event queues
@@ -652,14 +650,9 @@ struct efx_filter_state;
652 * @int_error_count: Number of internal errors seen recently 650 * @int_error_count: Number of internal errors seen recently
653 * @int_error_expire: Time at which error count will be expired 651 * @int_error_expire: Time at which error count will be expired
654 * @irq_status: Interrupt status buffer 652 * @irq_status: Interrupt status buffer
655 * @last_irq_cpu: Last CPU to handle interrupt.
656 * This register is written with the SMP processor ID whenever an
657 * interrupt is handled. It is used by efx_nic_test_interrupt()
658 * to verify that an interrupt has occurred.
659 * @irq_zero_count: Number of legacy IRQs seen with queue flags == 0 653 * @irq_zero_count: Number of legacy IRQs seen with queue flags == 0
660 * @fatal_irq_level: IRQ level (bit number) used for serious errors 654 * @fatal_irq_level: IRQ level (bit number) used for serious errors
661 * @mtd_list: List of MTDs attached to the NIC 655 * @mtd_list: List of MTDs attached to the NIC
662 * @n_rx_nodesc_drop_cnt: RX no descriptor drop count
663 * @nic_data: Hardware dependant state 656 * @nic_data: Hardware dependant state
664 * @mac_lock: MAC access lock. Protects @port_enabled, @phy_mode, 657 * @mac_lock: MAC access lock. Protects @port_enabled, @phy_mode,
665 * @port_inhibited, efx_monitor() and efx_reconfigure_port() 658 * @port_inhibited, efx_monitor() and efx_reconfigure_port()
@@ -672,11 +665,7 @@ struct efx_filter_state;
672 * @port_initialized: Port initialized? 665 * @port_initialized: Port initialized?
673 * @net_dev: Operating system network device. Consider holding the rtnl lock 666 * @net_dev: Operating system network device. Consider holding the rtnl lock
674 * @rx_checksum_enabled: RX checksumming enabled 667 * @rx_checksum_enabled: RX checksumming enabled
675 * @mac_stats: MAC statistics. These include all statistics the MACs
676 * can provide. Generic code converts these into a standard
677 * &struct net_device_stats.
678 * @stats_buffer: DMA buffer for statistics 668 * @stats_buffer: DMA buffer for statistics
679 * @stats_lock: Statistics update lock. Serialises statistics fetches
680 * @mac_op: MAC interface 669 * @mac_op: MAC interface
681 * @phy_type: PHY type 670 * @phy_type: PHY type
682 * @phy_op: PHY interface 671 * @phy_op: PHY interface
@@ -694,10 +683,23 @@ struct efx_filter_state;
694 * @loopback_mode: Loopback status 683 * @loopback_mode: Loopback status
695 * @loopback_modes: Supported loopback mode bitmask 684 * @loopback_modes: Supported loopback mode bitmask
696 * @loopback_selftest: Offline self-test private state 685 * @loopback_selftest: Offline self-test private state
686 * @monitor_work: Hardware monitor workitem
687 * @biu_lock: BIU (bus interface unit) lock
688 * @last_irq_cpu: Last CPU to handle interrupt.
689 * This register is written with the SMP processor ID whenever an
690 * interrupt is handled. It is used by efx_nic_test_interrupt()
691 * to verify that an interrupt has occurred.
692 * @n_rx_nodesc_drop_cnt: RX no descriptor drop count
693 * @mac_stats: MAC statistics. These include all statistics the MACs
694 * can provide. Generic code converts these into a standard
695 * &struct net_device_stats.
696 * @stats_lock: Statistics update lock. Serialises statistics fetches
697 * 697 *
698 * This is stored in the private area of the &struct net_device. 698 * This is stored in the private area of the &struct net_device.
699 */ 699 */
700struct efx_nic { 700struct efx_nic {
701 /* The following fields should be written very rarely */
702
701 char name[IFNAMSIZ]; 703 char name[IFNAMSIZ];
702 struct pci_dev *pci_dev; 704 struct pci_dev *pci_dev;
703 const struct efx_nic_type *type; 705 const struct efx_nic_type *type;
@@ -705,10 +707,9 @@ struct efx_nic {
705 struct workqueue_struct *workqueue; 707 struct workqueue_struct *workqueue;
706 char workqueue_name[16]; 708 char workqueue_name[16];
707 struct work_struct reset_work; 709 struct work_struct reset_work;
708 struct delayed_work monitor_work;
709 resource_size_t membase_phys; 710 resource_size_t membase_phys;
710 void __iomem *membase; 711 void __iomem *membase;
711 spinlock_t biu_lock; 712
712 enum efx_int_mode interrupt_mode; 713 enum efx_int_mode interrupt_mode;
713 bool irq_rx_adaptive; 714 bool irq_rx_adaptive;
714 unsigned int irq_rx_moderation; 715 unsigned int irq_rx_moderation;
@@ -735,7 +736,6 @@ struct efx_nic {
735 unsigned long int_error_expire; 736 unsigned long int_error_expire;
736 737
737 struct efx_buffer irq_status; 738 struct efx_buffer irq_status;
738 volatile signed int last_irq_cpu;
739 unsigned irq_zero_count; 739 unsigned irq_zero_count;
740 unsigned fatal_irq_level; 740 unsigned fatal_irq_level;
741 741
@@ -743,8 +743,6 @@ struct efx_nic {
743 struct list_head mtd_list; 743 struct list_head mtd_list;
744#endif 744#endif
745 745
746 unsigned n_rx_nodesc_drop_cnt;
747
748 void *nic_data; 746 void *nic_data;
749 747
750 struct mutex mac_lock; 748 struct mutex mac_lock;
@@ -756,9 +754,7 @@ struct efx_nic {
756 struct net_device *net_dev; 754 struct net_device *net_dev;
757 bool rx_checksum_enabled; 755 bool rx_checksum_enabled;
758 756
759 struct efx_mac_stats mac_stats;
760 struct efx_buffer stats_buffer; 757 struct efx_buffer stats_buffer;
761 spinlock_t stats_lock;
762 758
763 struct efx_mac_operations *mac_op; 759 struct efx_mac_operations *mac_op;
764 760
@@ -784,6 +780,15 @@ struct efx_nic {
784 void *loopback_selftest; 780 void *loopback_selftest;
785 781
786 struct efx_filter_state *filter_state; 782 struct efx_filter_state *filter_state;
783
784 /* The following fields may be written more often */
785
786 struct delayed_work monitor_work ____cacheline_aligned_in_smp;
787 spinlock_t biu_lock;
788 volatile signed int last_irq_cpu;
789 unsigned n_rx_nodesc_drop_cnt;
790 struct efx_mac_stats mac_stats;
791 spinlock_t stats_lock;
787}; 792};
788 793
789static inline int efx_dev_registered(struct efx_nic *efx) 794static inline int efx_dev_registered(struct efx_nic *efx)