diff options
Diffstat (limited to 'drivers/net/sfc/net_driver.h')
-rw-r--r-- | drivers/net/sfc/net_driver.h | 57 |
1 files changed, 39 insertions, 18 deletions
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h index 4c12332434b7..76f2fb197f0a 100644 --- a/drivers/net/sfc/net_driver.h +++ b/drivers/net/sfc/net_driver.h | |||
@@ -142,6 +142,12 @@ struct efx_tx_buffer { | |||
142 | * @flushed: Used when handling queue flushing | 142 | * @flushed: Used when handling queue flushing |
143 | * @read_count: Current read pointer. | 143 | * @read_count: Current read pointer. |
144 | * This is the number of buffers that have been removed from both rings. | 144 | * This is the number of buffers that have been removed from both rings. |
145 | * @old_write_count: The value of @write_count when last checked. | ||
146 | * This is here for performance reasons. The xmit path will | ||
147 | * only get the up-to-date value of @write_count if this | ||
148 | * variable indicates that the queue is empty. This is to | ||
149 | * avoid cache-line ping-pong between the xmit path and the | ||
150 | * completion path. | ||
145 | * @stopped: Stopped count. | 151 | * @stopped: Stopped count. |
146 | * Set if this TX queue is currently stopping its port. | 152 | * Set if this TX queue is currently stopping its port. |
147 | * @insert_count: Current insert pointer | 153 | * @insert_count: Current insert pointer |
@@ -163,6 +169,10 @@ struct efx_tx_buffer { | |||
163 | * @tso_long_headers: Number of packets with headers too long for standard | 169 | * @tso_long_headers: Number of packets with headers too long for standard |
164 | * blocks | 170 | * blocks |
165 | * @tso_packets: Number of packets via the TSO xmit path | 171 | * @tso_packets: Number of packets via the TSO xmit path |
172 | * @pushes: Number of times the TX push feature has been used | ||
173 | * @empty_read_count: If the completion path has seen the queue as empty | ||
174 | * and the transmission path has not yet checked this, the value of | ||
175 | * @read_count bitwise-added to %EFX_EMPTY_COUNT_VALID; otherwise 0. | ||
166 | */ | 176 | */ |
167 | struct efx_tx_queue { | 177 | struct efx_tx_queue { |
168 | /* Members which don't change on the fast path */ | 178 | /* Members which don't change on the fast path */ |
@@ -177,6 +187,7 @@ struct efx_tx_queue { | |||
177 | 187 | ||
178 | /* Members used mainly on the completion path */ | 188 | /* Members used mainly on the completion path */ |
179 | unsigned int read_count ____cacheline_aligned_in_smp; | 189 | unsigned int read_count ____cacheline_aligned_in_smp; |
190 | unsigned int old_write_count; | ||
180 | int stopped; | 191 | int stopped; |
181 | 192 | ||
182 | /* Members used only on the xmit path */ | 193 | /* Members used only on the xmit path */ |
@@ -187,6 +198,11 @@ struct efx_tx_queue { | |||
187 | unsigned int tso_bursts; | 198 | unsigned int tso_bursts; |
188 | unsigned int tso_long_headers; | 199 | unsigned int tso_long_headers; |
189 | unsigned int tso_packets; | 200 | unsigned int tso_packets; |
201 | unsigned int pushes; | ||
202 | |||
203 | /* Members shared between paths and sometimes updated */ | ||
204 | unsigned int empty_read_count ____cacheline_aligned_in_smp; | ||
205 | #define EFX_EMPTY_COUNT_VALID 0x80000000 | ||
190 | }; | 206 | }; |
191 | 207 | ||
192 | /** | 208 | /** |
@@ -626,10 +642,8 @@ struct efx_filter_state; | |||
626 | * Work items do not hold and must not acquire RTNL. | 642 | * Work items do not hold and must not acquire RTNL. |
627 | * @workqueue_name: Name of workqueue | 643 | * @workqueue_name: Name of workqueue |
628 | * @reset_work: Scheduled reset workitem | 644 | * @reset_work: Scheduled reset workitem |
629 | * @monitor_work: Hardware monitor workitem | ||
630 | * @membase_phys: Memory BAR value as physical address | 645 | * @membase_phys: Memory BAR value as physical address |
631 | * @membase: Memory BAR value | 646 | * @membase: Memory BAR value |
632 | * @biu_lock: BIU (bus interface unit) lock | ||
633 | * @interrupt_mode: Interrupt mode | 647 | * @interrupt_mode: Interrupt mode |
634 | * @irq_rx_adaptive: Adaptive IRQ moderation enabled for RX event queues | 648 | * @irq_rx_adaptive: Adaptive IRQ moderation enabled for RX event queues |
635 | * @irq_rx_moderation: IRQ moderation time for RX event queues | 649 | * @irq_rx_moderation: IRQ moderation time for RX event queues |
@@ -653,14 +667,9 @@ struct efx_filter_state; | |||
653 | * @int_error_count: Number of internal errors seen recently | 667 | * @int_error_count: Number of internal errors seen recently |
654 | * @int_error_expire: Time at which error count will be expired | 668 | * @int_error_expire: Time at which error count will be expired |
655 | * @irq_status: Interrupt status buffer | 669 | * @irq_status: Interrupt status buffer |
656 | * @last_irq_cpu: Last CPU to handle interrupt. | ||
657 | * This register is written with the SMP processor ID whenever an | ||
658 | * interrupt is handled. It is used by efx_nic_test_interrupt() | ||
659 | * to verify that an interrupt has occurred. | ||
660 | * @irq_zero_count: Number of legacy IRQs seen with queue flags == 0 | 670 | * @irq_zero_count: Number of legacy IRQs seen with queue flags == 0 |
661 | * @fatal_irq_level: IRQ level (bit number) used for serious errors | 671 | * @fatal_irq_level: IRQ level (bit number) used for serious errors |
662 | * @mtd_list: List of MTDs attached to the NIC | 672 | * @mtd_list: List of MTDs attached to the NIC |
663 | * @n_rx_nodesc_drop_cnt: RX no descriptor drop count | ||
664 | * @nic_data: Hardware dependant state | 673 | * @nic_data: Hardware dependant state |
665 | * @mac_lock: MAC access lock. Protects @port_enabled, @phy_mode, | 674 | * @mac_lock: MAC access lock. Protects @port_enabled, @phy_mode, |
666 | * @port_inhibited, efx_monitor() and efx_reconfigure_port() | 675 | * @port_inhibited, efx_monitor() and efx_reconfigure_port() |
@@ -673,11 +682,7 @@ struct efx_filter_state; | |||
673 | * @port_initialized: Port initialized? | 682 | * @port_initialized: Port initialized? |
674 | * @net_dev: Operating system network device. Consider holding the rtnl lock | 683 | * @net_dev: Operating system network device. Consider holding the rtnl lock |
675 | * @rx_checksum_enabled: RX checksumming enabled | 684 | * @rx_checksum_enabled: RX checksumming enabled |
676 | * @mac_stats: MAC statistics. These include all statistics the MACs | ||
677 | * can provide. Generic code converts these into a standard | ||
678 | * &struct net_device_stats. | ||
679 | * @stats_buffer: DMA buffer for statistics | 685 | * @stats_buffer: DMA buffer for statistics |
680 | * @stats_lock: Statistics update lock. Serialises statistics fetches | ||
681 | * @mac_op: MAC interface | 686 | * @mac_op: MAC interface |
682 | * @phy_type: PHY type | 687 | * @phy_type: PHY type |
683 | * @phy_op: PHY interface | 688 | * @phy_op: PHY interface |
@@ -695,10 +700,23 @@ struct efx_filter_state; | |||
695 | * @loopback_mode: Loopback status | 700 | * @loopback_mode: Loopback status |
696 | * @loopback_modes: Supported loopback mode bitmask | 701 | * @loopback_modes: Supported loopback mode bitmask |
697 | * @loopback_selftest: Offline self-test private state | 702 | * @loopback_selftest: Offline self-test private state |
703 | * @monitor_work: Hardware monitor workitem | ||
704 | * @biu_lock: BIU (bus interface unit) lock | ||
705 | * @last_irq_cpu: Last CPU to handle interrupt. | ||
706 | * This register is written with the SMP processor ID whenever an | ||
707 | * interrupt is handled. It is used by efx_nic_test_interrupt() | ||
708 | * to verify that an interrupt has occurred. | ||
709 | * @n_rx_nodesc_drop_cnt: RX no descriptor drop count | ||
710 | * @mac_stats: MAC statistics. These include all statistics the MACs | ||
711 | * can provide. Generic code converts these into a standard | ||
712 | * &struct net_device_stats. | ||
713 | * @stats_lock: Statistics update lock. Serialises statistics fetches | ||
698 | * | 714 | * |
699 | * This is stored in the private area of the &struct net_device. | 715 | * This is stored in the private area of the &struct net_device. |
700 | */ | 716 | */ |
701 | struct efx_nic { | 717 | struct efx_nic { |
718 | /* The following fields should be written very rarely */ | ||
719 | |||
702 | char name[IFNAMSIZ]; | 720 | char name[IFNAMSIZ]; |
703 | struct pci_dev *pci_dev; | 721 | struct pci_dev *pci_dev; |
704 | const struct efx_nic_type *type; | 722 | const struct efx_nic_type *type; |
@@ -707,10 +725,9 @@ struct efx_nic { | |||
707 | struct workqueue_struct *workqueue; | 725 | struct workqueue_struct *workqueue; |
708 | char workqueue_name[16]; | 726 | char workqueue_name[16]; |
709 | struct work_struct reset_work; | 727 | struct work_struct reset_work; |
710 | struct delayed_work monitor_work; | ||
711 | resource_size_t membase_phys; | 728 | resource_size_t membase_phys; |
712 | void __iomem *membase; | 729 | void __iomem *membase; |
713 | spinlock_t biu_lock; | 730 | |
714 | enum efx_int_mode interrupt_mode; | 731 | enum efx_int_mode interrupt_mode; |
715 | bool irq_rx_adaptive; | 732 | bool irq_rx_adaptive; |
716 | unsigned int irq_rx_moderation; | 733 | unsigned int irq_rx_moderation; |
@@ -737,7 +754,6 @@ struct efx_nic { | |||
737 | unsigned long int_error_expire; | 754 | unsigned long int_error_expire; |
738 | 755 | ||
739 | struct efx_buffer irq_status; | 756 | struct efx_buffer irq_status; |
740 | volatile signed int last_irq_cpu; | ||
741 | unsigned irq_zero_count; | 757 | unsigned irq_zero_count; |
742 | unsigned fatal_irq_level; | 758 | unsigned fatal_irq_level; |
743 | 759 | ||
@@ -745,8 +761,6 @@ struct efx_nic { | |||
745 | struct list_head mtd_list; | 761 | struct list_head mtd_list; |
746 | #endif | 762 | #endif |
747 | 763 | ||
748 | unsigned n_rx_nodesc_drop_cnt; | ||
749 | |||
750 | void *nic_data; | 764 | void *nic_data; |
751 | 765 | ||
752 | struct mutex mac_lock; | 766 | struct mutex mac_lock; |
@@ -758,9 +772,7 @@ struct efx_nic { | |||
758 | struct net_device *net_dev; | 772 | struct net_device *net_dev; |
759 | bool rx_checksum_enabled; | 773 | bool rx_checksum_enabled; |
760 | 774 | ||
761 | struct efx_mac_stats mac_stats; | ||
762 | struct efx_buffer stats_buffer; | 775 | struct efx_buffer stats_buffer; |
763 | spinlock_t stats_lock; | ||
764 | 776 | ||
765 | struct efx_mac_operations *mac_op; | 777 | struct efx_mac_operations *mac_op; |
766 | 778 | ||
@@ -786,6 +798,15 @@ struct efx_nic { | |||
786 | void *loopback_selftest; | 798 | void *loopback_selftest; |
787 | 799 | ||
788 | struct efx_filter_state *filter_state; | 800 | struct efx_filter_state *filter_state; |
801 | |||
802 | /* The following fields may be written more often */ | ||
803 | |||
804 | struct delayed_work monitor_work ____cacheline_aligned_in_smp; | ||
805 | spinlock_t biu_lock; | ||
806 | volatile signed int last_irq_cpu; | ||
807 | unsigned n_rx_nodesc_drop_cnt; | ||
808 | struct efx_mac_stats mac_stats; | ||
809 | spinlock_t stats_lock; | ||
789 | }; | 810 | }; |
790 | 811 | ||
791 | static inline int efx_dev_registered(struct efx_nic *efx) | 812 | static inline int efx_dev_registered(struct efx_nic *efx) |