diff options
Diffstat (limited to 'drivers/net/sfc/net_driver.h')
-rw-r--r-- | drivers/net/sfc/net_driver.h | 144 |
1 files changed, 75 insertions, 69 deletions
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h index 219c74a772c..cdb11fad605 100644 --- a/drivers/net/sfc/net_driver.h +++ b/drivers/net/sfc/net_driver.h | |||
@@ -88,9 +88,12 @@ do {if (net_ratelimit()) EFX_LOG(efx, fmt, ##args); } while (0) | |||
88 | **************************************************************************/ | 88 | **************************************************************************/ |
89 | 89 | ||
90 | #define EFX_MAX_CHANNELS 32 | 90 | #define EFX_MAX_CHANNELS 32 |
91 | #define EFX_MAX_TX_QUEUES 1 | ||
92 | #define EFX_MAX_RX_QUEUES EFX_MAX_CHANNELS | 91 | #define EFX_MAX_RX_QUEUES EFX_MAX_CHANNELS |
93 | 92 | ||
93 | #define EFX_TX_QUEUE_OFFLOAD_CSUM 0 | ||
94 | #define EFX_TX_QUEUE_NO_CSUM 1 | ||
95 | #define EFX_TX_QUEUE_COUNT 2 | ||
96 | |||
94 | /** | 97 | /** |
95 | * struct efx_special_buffer - An Efx special buffer | 98 | * struct efx_special_buffer - An Efx special buffer |
96 | * @addr: CPU base address of the buffer | 99 | * @addr: CPU base address of the buffer |
@@ -127,7 +130,6 @@ struct efx_special_buffer { | |||
127 | * This field is zero when the queue slot is empty. | 130 | * This field is zero when the queue slot is empty. |
128 | * @continuation: True if this fragment is not the end of a packet. | 131 | * @continuation: True if this fragment is not the end of a packet. |
129 | * @unmap_single: True if pci_unmap_single should be used. | 132 | * @unmap_single: True if pci_unmap_single should be used. |
130 | * @unmap_addr: DMA address to unmap | ||
131 | * @unmap_len: Length of this fragment to unmap | 133 | * @unmap_len: Length of this fragment to unmap |
132 | */ | 134 | */ |
133 | struct efx_tx_buffer { | 135 | struct efx_tx_buffer { |
@@ -135,9 +137,8 @@ struct efx_tx_buffer { | |||
135 | struct efx_tso_header *tsoh; | 137 | struct efx_tso_header *tsoh; |
136 | dma_addr_t dma_addr; | 138 | dma_addr_t dma_addr; |
137 | unsigned short len; | 139 | unsigned short len; |
138 | unsigned char continuation; | 140 | bool continuation; |
139 | unsigned char unmap_single; | 141 | bool unmap_single; |
140 | dma_addr_t unmap_addr; | ||
141 | unsigned short unmap_len; | 142 | unsigned short unmap_len; |
142 | }; | 143 | }; |
143 | 144 | ||
@@ -156,13 +157,13 @@ struct efx_tx_buffer { | |||
156 | * | 157 | * |
157 | * @efx: The associated Efx NIC | 158 | * @efx: The associated Efx NIC |
158 | * @queue: DMA queue number | 159 | * @queue: DMA queue number |
159 | * @used: Queue is used by net driver | ||
160 | * @channel: The associated channel | 160 | * @channel: The associated channel |
161 | * @buffer: The software buffer ring | 161 | * @buffer: The software buffer ring |
162 | * @txd: The hardware descriptor ring | 162 | * @txd: The hardware descriptor ring |
163 | * @flushed: Used when handling queue flushing | ||
163 | * @read_count: Current read pointer. | 164 | * @read_count: Current read pointer. |
164 | * This is the number of buffers that have been removed from both rings. | 165 | * This is the number of buffers that have been removed from both rings. |
165 | * @stopped: Stopped flag. | 166 | * @stopped: Stopped count. |
166 | * Set if this TX queue is currently stopping its port. | 167 | * Set if this TX queue is currently stopping its port. |
167 | * @insert_count: Current insert pointer | 168 | * @insert_count: Current insert pointer |
168 | * This is the number of buffers that have been added to the | 169 | * This is the number of buffers that have been added to the |
@@ -188,11 +189,11 @@ struct efx_tx_queue { | |||
188 | /* Members which don't change on the fast path */ | 189 | /* Members which don't change on the fast path */ |
189 | struct efx_nic *efx ____cacheline_aligned_in_smp; | 190 | struct efx_nic *efx ____cacheline_aligned_in_smp; |
190 | int queue; | 191 | int queue; |
191 | int used; | ||
192 | struct efx_channel *channel; | 192 | struct efx_channel *channel; |
193 | struct efx_nic *nic; | 193 | struct efx_nic *nic; |
194 | struct efx_tx_buffer *buffer; | 194 | struct efx_tx_buffer *buffer; |
195 | struct efx_special_buffer txd; | 195 | struct efx_special_buffer txd; |
196 | bool flushed; | ||
196 | 197 | ||
197 | /* Members used mainly on the completion path */ | 198 | /* Members used mainly on the completion path */ |
198 | unsigned int read_count ____cacheline_aligned_in_smp; | 199 | unsigned int read_count ____cacheline_aligned_in_smp; |
@@ -232,7 +233,6 @@ struct efx_rx_buffer { | |||
232 | * struct efx_rx_queue - An Efx RX queue | 233 | * struct efx_rx_queue - An Efx RX queue |
233 | * @efx: The associated Efx NIC | 234 | * @efx: The associated Efx NIC |
234 | * @queue: DMA queue number | 235 | * @queue: DMA queue number |
235 | * @used: Queue is used by net driver | ||
236 | * @channel: The associated channel | 236 | * @channel: The associated channel |
237 | * @buffer: The software buffer ring | 237 | * @buffer: The software buffer ring |
238 | * @rxd: The hardware descriptor ring | 238 | * @rxd: The hardware descriptor ring |
@@ -262,11 +262,11 @@ struct efx_rx_buffer { | |||
262 | * the remaining space in the allocation. | 262 | * the remaining space in the allocation. |
263 | * @buf_dma_addr: Page's DMA address. | 263 | * @buf_dma_addr: Page's DMA address. |
264 | * @buf_data: Page's host address. | 264 | * @buf_data: Page's host address. |
265 | * @flushed: Use when handling queue flushing | ||
265 | */ | 266 | */ |
266 | struct efx_rx_queue { | 267 | struct efx_rx_queue { |
267 | struct efx_nic *efx; | 268 | struct efx_nic *efx; |
268 | int queue; | 269 | int queue; |
269 | int used; | ||
270 | struct efx_channel *channel; | 270 | struct efx_channel *channel; |
271 | struct efx_rx_buffer *buffer; | 271 | struct efx_rx_buffer *buffer; |
272 | struct efx_special_buffer rxd; | 272 | struct efx_special_buffer rxd; |
@@ -288,6 +288,7 @@ struct efx_rx_queue { | |||
288 | struct page *buf_page; | 288 | struct page *buf_page; |
289 | dma_addr_t buf_dma_addr; | 289 | dma_addr_t buf_dma_addr; |
290 | char *buf_data; | 290 | char *buf_data; |
291 | bool flushed; | ||
291 | }; | 292 | }; |
292 | 293 | ||
293 | /** | 294 | /** |
@@ -325,12 +326,10 @@ enum efx_rx_alloc_method { | |||
325 | * queue. | 326 | * queue. |
326 | * | 327 | * |
327 | * @efx: Associated Efx NIC | 328 | * @efx: Associated Efx NIC |
328 | * @evqnum: Event queue number | ||
329 | * @channel: Channel instance number | 329 | * @channel: Channel instance number |
330 | * @used_flags: Channel is used by net driver | 330 | * @used_flags: Channel is used by net driver |
331 | * @enabled: Channel enabled indicator | 331 | * @enabled: Channel enabled indicator |
332 | * @irq: IRQ number (MSI and MSI-X only) | 332 | * @irq: IRQ number (MSI and MSI-X only) |
333 | * @has_interrupt: Channel has an interrupt | ||
334 | * @irq_moderation: IRQ moderation value (in us) | 333 | * @irq_moderation: IRQ moderation value (in us) |
335 | * @napi_dev: Net device used with NAPI | 334 | * @napi_dev: Net device used with NAPI |
336 | * @napi_str: NAPI control structure | 335 | * @napi_str: NAPI control structure |
@@ -357,17 +356,14 @@ enum efx_rx_alloc_method { | |||
357 | */ | 356 | */ |
358 | struct efx_channel { | 357 | struct efx_channel { |
359 | struct efx_nic *efx; | 358 | struct efx_nic *efx; |
360 | int evqnum; | ||
361 | int channel; | 359 | int channel; |
362 | int used_flags; | 360 | int used_flags; |
363 | int enabled; | 361 | bool enabled; |
364 | int irq; | 362 | int irq; |
365 | unsigned int has_interrupt; | ||
366 | unsigned int irq_moderation; | 363 | unsigned int irq_moderation; |
367 | struct net_device *napi_dev; | 364 | struct net_device *napi_dev; |
368 | struct napi_struct napi_str; | 365 | struct napi_struct napi_str; |
369 | struct work_struct reset_work; | 366 | bool work_pending; |
370 | int work_pending; | ||
371 | struct efx_special_buffer eventq; | 367 | struct efx_special_buffer eventq; |
372 | unsigned int eventq_read_ptr; | 368 | unsigned int eventq_read_ptr; |
373 | unsigned int last_eventq_read_ptr; | 369 | unsigned int last_eventq_read_ptr; |
@@ -390,7 +386,7 @@ struct efx_channel { | |||
390 | * access with prefetches. | 386 | * access with prefetches. |
391 | */ | 387 | */ |
392 | struct efx_rx_buffer *rx_pkt; | 388 | struct efx_rx_buffer *rx_pkt; |
393 | int rx_pkt_csummed; | 389 | bool rx_pkt_csummed; |
394 | 390 | ||
395 | }; | 391 | }; |
396 | 392 | ||
@@ -403,8 +399,8 @@ struct efx_channel { | |||
403 | */ | 399 | */ |
404 | struct efx_blinker { | 400 | struct efx_blinker { |
405 | int led_num; | 401 | int led_num; |
406 | int state; | 402 | bool state; |
407 | int resubmit; | 403 | bool resubmit; |
408 | struct timer_list timer; | 404 | struct timer_list timer; |
409 | }; | 405 | }; |
410 | 406 | ||
@@ -432,8 +428,8 @@ struct efx_board { | |||
432 | * have a separate init callback that happens later than | 428 | * have a separate init callback that happens later than |
433 | * board init. */ | 429 | * board init. */ |
434 | int (*init_leds)(struct efx_nic *efx); | 430 | int (*init_leds)(struct efx_nic *efx); |
435 | void (*set_fault_led) (struct efx_nic *efx, int state); | 431 | void (*set_fault_led) (struct efx_nic *efx, bool state); |
436 | void (*blink) (struct efx_nic *efx, int start); | 432 | void (*blink) (struct efx_nic *efx, bool start); |
437 | void (*fini) (struct efx_nic *nic); | 433 | void (*fini) (struct efx_nic *nic); |
438 | struct efx_blinker blinker; | 434 | struct efx_blinker blinker; |
439 | struct i2c_client *hwmon_client, *ioexp_client; | 435 | struct i2c_client *hwmon_client, *ioexp_client; |
@@ -467,8 +463,7 @@ enum nic_state { | |||
467 | STATE_INIT = 0, | 463 | STATE_INIT = 0, |
468 | STATE_RUNNING = 1, | 464 | STATE_RUNNING = 1, |
469 | STATE_FINI = 2, | 465 | STATE_FINI = 2, |
470 | STATE_RESETTING = 3, /* rtnl_lock always held */ | 466 | STATE_DISABLED = 3, |
471 | STATE_DISABLED = 4, | ||
472 | STATE_MAX, | 467 | STATE_MAX, |
473 | }; | 468 | }; |
474 | 469 | ||
@@ -479,7 +474,7 @@ enum nic_state { | |||
479 | * This is the equivalent of NET_IP_ALIGN [which controls the alignment | 474 | * This is the equivalent of NET_IP_ALIGN [which controls the alignment |
480 | * of the skb->head for hardware DMA]. | 475 | * of the skb->head for hardware DMA]. |
481 | */ | 476 | */ |
482 | #if defined(__i386__) || defined(__x86_64__) | 477 | #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS |
483 | #define EFX_PAGE_IP_ALIGN 0 | 478 | #define EFX_PAGE_IP_ALIGN 0 |
484 | #else | 479 | #else |
485 | #define EFX_PAGE_IP_ALIGN NET_IP_ALIGN | 480 | #define EFX_PAGE_IP_ALIGN NET_IP_ALIGN |
@@ -512,7 +507,6 @@ enum efx_fc_type { | |||
512 | * @clear_interrupt: Clear down interrupt | 507 | * @clear_interrupt: Clear down interrupt |
513 | * @blink: Blink LEDs | 508 | * @blink: Blink LEDs |
514 | * @check_hw: Check hardware | 509 | * @check_hw: Check hardware |
515 | * @reset_xaui: Reset XAUI side of PHY for (software sequenced reset) | ||
516 | * @mmds: MMD presence mask | 510 | * @mmds: MMD presence mask |
517 | * @loopbacks: Supported loopback modes mask | 511 | * @loopbacks: Supported loopback modes mask |
518 | */ | 512 | */ |
@@ -522,11 +516,28 @@ struct efx_phy_operations { | |||
522 | void (*reconfigure) (struct efx_nic *efx); | 516 | void (*reconfigure) (struct efx_nic *efx); |
523 | void (*clear_interrupt) (struct efx_nic *efx); | 517 | void (*clear_interrupt) (struct efx_nic *efx); |
524 | int (*check_hw) (struct efx_nic *efx); | 518 | int (*check_hw) (struct efx_nic *efx); |
525 | void (*reset_xaui) (struct efx_nic *efx); | 519 | int (*test) (struct efx_nic *efx); |
526 | int mmds; | 520 | int mmds; |
527 | unsigned loopbacks; | 521 | unsigned loopbacks; |
528 | }; | 522 | }; |
529 | 523 | ||
524 | /** | ||
525 | * @enum efx_phy_mode - PHY operating mode flags | ||
526 | * @PHY_MODE_NORMAL: on and should pass traffic | ||
527 | * @PHY_MODE_TX_DISABLED: on with TX disabled | ||
528 | * @PHY_MODE_SPECIAL: on but will not pass traffic | ||
529 | */ | ||
530 | enum efx_phy_mode { | ||
531 | PHY_MODE_NORMAL = 0, | ||
532 | PHY_MODE_TX_DISABLED = 1, | ||
533 | PHY_MODE_SPECIAL = 8, | ||
534 | }; | ||
535 | |||
536 | static inline bool efx_phy_mode_disabled(enum efx_phy_mode mode) | ||
537 | { | ||
538 | return !!(mode & ~PHY_MODE_TX_DISABLED); | ||
539 | } | ||
540 | |||
530 | /* | 541 | /* |
531 | * Efx extended statistics | 542 | * Efx extended statistics |
532 | * | 543 | * |
@@ -632,7 +643,7 @@ union efx_multicast_hash { | |||
632 | * @tx_queue: TX DMA queues | 643 | * @tx_queue: TX DMA queues |
633 | * @rx_queue: RX DMA queues | 644 | * @rx_queue: RX DMA queues |
634 | * @channel: Channels | 645 | * @channel: Channels |
635 | * @rss_queues: Number of RSS queues | 646 | * @n_rx_queues: Number of RX queues |
636 | * @rx_buffer_len: RX buffer length | 647 | * @rx_buffer_len: RX buffer length |
637 | * @rx_buffer_order: Order (log2) of number of pages for each RX buffer | 648 | * @rx_buffer_order: Order (log2) of number of pages for each RX buffer |
638 | * @irq_status: Interrupt status buffer | 649 | * @irq_status: Interrupt status buffer |
@@ -640,15 +651,20 @@ union efx_multicast_hash { | |||
640 | * This register is written with the SMP processor ID whenever an | 651 | * This register is written with the SMP processor ID whenever an |
641 | * interrupt is handled. It is used by falcon_test_interrupt() | 652 | * interrupt is handled. It is used by falcon_test_interrupt() |
642 | * to verify that an interrupt has occurred. | 653 | * to verify that an interrupt has occurred. |
654 | * @spi_flash: SPI flash device | ||
655 | * This field will be %NULL if no flash device is present. | ||
656 | * @spi_eeprom: SPI EEPROM device | ||
657 | * This field will be %NULL if no EEPROM device is present. | ||
643 | * @n_rx_nodesc_drop_cnt: RX no descriptor drop count | 658 | * @n_rx_nodesc_drop_cnt: RX no descriptor drop count |
644 | * @nic_data: Hardware dependant state | 659 | * @nic_data: Hardware dependant state |
645 | * @mac_lock: MAC access lock. Protects @port_enabled, efx_monitor() and | 660 | * @mac_lock: MAC access lock. Protects @port_enabled, @phy_mode, |
646 | * efx_reconfigure_port() | 661 | * @port_inhibited, efx_monitor() and efx_reconfigure_port() |
647 | * @port_enabled: Port enabled indicator. | 662 | * @port_enabled: Port enabled indicator. |
648 | * Serialises efx_stop_all(), efx_start_all() and efx_monitor() and | 663 | * Serialises efx_stop_all(), efx_start_all() and efx_monitor() and |
649 | * efx_reconfigure_work with kernel interfaces. Safe to read under any | 664 | * efx_reconfigure_work with kernel interfaces. Safe to read under any |
650 | * one of the rtnl_lock, mac_lock, or netif_tx_lock, but all three must | 665 | * one of the rtnl_lock, mac_lock, or netif_tx_lock, but all three must |
651 | * be held to modify it. | 666 | * be held to modify it. |
667 | * @port_inhibited: If set, the netif_carrier is always off. Hold the mac_lock | ||
652 | * @port_initialized: Port initialized? | 668 | * @port_initialized: Port initialized? |
653 | * @net_dev: Operating system network device. Consider holding the rtnl lock | 669 | * @net_dev: Operating system network device. Consider holding the rtnl lock |
654 | * @rx_checksum_enabled: RX checksumming enabled | 670 | * @rx_checksum_enabled: RX checksumming enabled |
@@ -658,14 +674,16 @@ union efx_multicast_hash { | |||
658 | * can provide. Generic code converts these into a standard | 674 | * can provide. Generic code converts these into a standard |
659 | * &struct net_device_stats. | 675 | * &struct net_device_stats. |
660 | * @stats_buffer: DMA buffer for statistics | 676 | * @stats_buffer: DMA buffer for statistics |
661 | * @stats_lock: Statistics update lock | 677 | * @stats_lock: Statistics update lock. Serialises statistics fetches |
678 | * @stats_enabled: Temporarily disable statistics fetches. | ||
679 | * Serialised by @stats_lock | ||
662 | * @mac_address: Permanent MAC address | 680 | * @mac_address: Permanent MAC address |
663 | * @phy_type: PHY type | 681 | * @phy_type: PHY type |
664 | * @phy_lock: PHY access lock | 682 | * @phy_lock: PHY access lock |
665 | * @phy_op: PHY interface | 683 | * @phy_op: PHY interface |
666 | * @phy_data: PHY private data (including PHY-specific stats) | 684 | * @phy_data: PHY private data (including PHY-specific stats) |
667 | * @mii: PHY interface | 685 | * @mii: PHY interface |
668 | * @tx_disabled: PHY transmitter turned off | 686 | * @phy_mode: PHY operating mode. Serialised by @mac_lock. |
669 | * @link_up: Link status | 687 | * @link_up: Link status |
670 | * @link_options: Link options (MII/GMII format) | 688 | * @link_options: Link options (MII/GMII format) |
671 | * @n_link_state_changes: Number of times the link has changed state | 689 | * @n_link_state_changes: Number of times the link has changed state |
@@ -700,27 +718,31 @@ struct efx_nic { | |||
700 | enum nic_state state; | 718 | enum nic_state state; |
701 | enum reset_type reset_pending; | 719 | enum reset_type reset_pending; |
702 | 720 | ||
703 | struct efx_tx_queue tx_queue[EFX_MAX_TX_QUEUES]; | 721 | struct efx_tx_queue tx_queue[EFX_TX_QUEUE_COUNT]; |
704 | struct efx_rx_queue rx_queue[EFX_MAX_RX_QUEUES]; | 722 | struct efx_rx_queue rx_queue[EFX_MAX_RX_QUEUES]; |
705 | struct efx_channel channel[EFX_MAX_CHANNELS]; | 723 | struct efx_channel channel[EFX_MAX_CHANNELS]; |
706 | 724 | ||
707 | int rss_queues; | 725 | int n_rx_queues; |
708 | unsigned int rx_buffer_len; | 726 | unsigned int rx_buffer_len; |
709 | unsigned int rx_buffer_order; | 727 | unsigned int rx_buffer_order; |
710 | 728 | ||
711 | struct efx_buffer irq_status; | 729 | struct efx_buffer irq_status; |
712 | volatile signed int last_irq_cpu; | 730 | volatile signed int last_irq_cpu; |
713 | 731 | ||
732 | struct efx_spi_device *spi_flash; | ||
733 | struct efx_spi_device *spi_eeprom; | ||
734 | |||
714 | unsigned n_rx_nodesc_drop_cnt; | 735 | unsigned n_rx_nodesc_drop_cnt; |
715 | 736 | ||
716 | struct falcon_nic_data *nic_data; | 737 | struct falcon_nic_data *nic_data; |
717 | 738 | ||
718 | struct mutex mac_lock; | 739 | struct mutex mac_lock; |
719 | int port_enabled; | 740 | bool port_enabled; |
741 | bool port_inhibited; | ||
720 | 742 | ||
721 | int port_initialized; | 743 | bool port_initialized; |
722 | struct net_device *net_dev; | 744 | struct net_device *net_dev; |
723 | int rx_checksum_enabled; | 745 | bool rx_checksum_enabled; |
724 | 746 | ||
725 | atomic_t netif_stop_count; | 747 | atomic_t netif_stop_count; |
726 | spinlock_t netif_stop_lock; | 748 | spinlock_t netif_stop_lock; |
@@ -728,6 +750,7 @@ struct efx_nic { | |||
728 | struct efx_mac_stats mac_stats; | 750 | struct efx_mac_stats mac_stats; |
729 | struct efx_buffer stats_buffer; | 751 | struct efx_buffer stats_buffer; |
730 | spinlock_t stats_lock; | 752 | spinlock_t stats_lock; |
753 | bool stats_enabled; | ||
731 | 754 | ||
732 | unsigned char mac_address[ETH_ALEN]; | 755 | unsigned char mac_address[ETH_ALEN]; |
733 | 756 | ||
@@ -736,13 +759,13 @@ struct efx_nic { | |||
736 | struct efx_phy_operations *phy_op; | 759 | struct efx_phy_operations *phy_op; |
737 | void *phy_data; | 760 | void *phy_data; |
738 | struct mii_if_info mii; | 761 | struct mii_if_info mii; |
739 | unsigned tx_disabled; | 762 | enum efx_phy_mode phy_mode; |
740 | 763 | ||
741 | int link_up; | 764 | bool link_up; |
742 | unsigned int link_options; | 765 | unsigned int link_options; |
743 | unsigned int n_link_state_changes; | 766 | unsigned int n_link_state_changes; |
744 | 767 | ||
745 | int promiscuous; | 768 | bool promiscuous; |
746 | union efx_multicast_hash multicast_hash; | 769 | union efx_multicast_hash multicast_hash; |
747 | enum efx_fc_type flow_control; | 770 | enum efx_fc_type flow_control; |
748 | struct work_struct reconfigure_work; | 771 | struct work_struct reconfigure_work; |
@@ -829,50 +852,33 @@ struct efx_nic_type { | |||
829 | continue; \ | 852 | continue; \ |
830 | else | 853 | else |
831 | 854 | ||
832 | /* Iterate over all used channels with interrupts */ | ||
833 | #define efx_for_each_channel_with_interrupt(_channel, _efx) \ | ||
834 | for (_channel = &_efx->channel[0]; \ | ||
835 | _channel < &_efx->channel[EFX_MAX_CHANNELS]; \ | ||
836 | _channel++) \ | ||
837 | if (!(_channel->used_flags && _channel->has_interrupt)) \ | ||
838 | continue; \ | ||
839 | else | ||
840 | |||
841 | /* Iterate over all used TX queues */ | 855 | /* Iterate over all used TX queues */ |
842 | #define efx_for_each_tx_queue(_tx_queue, _efx) \ | 856 | #define efx_for_each_tx_queue(_tx_queue, _efx) \ |
843 | for (_tx_queue = &_efx->tx_queue[0]; \ | 857 | for (_tx_queue = &_efx->tx_queue[0]; \ |
844 | _tx_queue < &_efx->tx_queue[EFX_MAX_TX_QUEUES]; \ | 858 | _tx_queue < &_efx->tx_queue[EFX_TX_QUEUE_COUNT]; \ |
845 | _tx_queue++) \ | 859 | _tx_queue++) |
846 | if (!_tx_queue->used) \ | ||
847 | continue; \ | ||
848 | else | ||
849 | 860 | ||
850 | /* Iterate over all TX queues belonging to a channel */ | 861 | /* Iterate over all TX queues belonging to a channel */ |
851 | #define efx_for_each_channel_tx_queue(_tx_queue, _channel) \ | 862 | #define efx_for_each_channel_tx_queue(_tx_queue, _channel) \ |
852 | for (_tx_queue = &_channel->efx->tx_queue[0]; \ | 863 | for (_tx_queue = &_channel->efx->tx_queue[0]; \ |
853 | _tx_queue < &_channel->efx->tx_queue[EFX_MAX_TX_QUEUES]; \ | 864 | _tx_queue < &_channel->efx->tx_queue[EFX_TX_QUEUE_COUNT]; \ |
854 | _tx_queue++) \ | 865 | _tx_queue++) \ |
855 | if ((!_tx_queue->used) || \ | 866 | if (_tx_queue->channel != _channel) \ |
856 | (_tx_queue->channel != _channel)) \ | ||
857 | continue; \ | 867 | continue; \ |
858 | else | 868 | else |
859 | 869 | ||
860 | /* Iterate over all used RX queues */ | 870 | /* Iterate over all used RX queues */ |
861 | #define efx_for_each_rx_queue(_rx_queue, _efx) \ | 871 | #define efx_for_each_rx_queue(_rx_queue, _efx) \ |
862 | for (_rx_queue = &_efx->rx_queue[0]; \ | 872 | for (_rx_queue = &_efx->rx_queue[0]; \ |
863 | _rx_queue < &_efx->rx_queue[EFX_MAX_RX_QUEUES]; \ | 873 | _rx_queue < &_efx->rx_queue[_efx->n_rx_queues]; \ |
864 | _rx_queue++) \ | 874 | _rx_queue++) |
865 | if (!_rx_queue->used) \ | ||
866 | continue; \ | ||
867 | else | ||
868 | 875 | ||
869 | /* Iterate over all RX queues belonging to a channel */ | 876 | /* Iterate over all RX queues belonging to a channel */ |
870 | #define efx_for_each_channel_rx_queue(_rx_queue, _channel) \ | 877 | #define efx_for_each_channel_rx_queue(_rx_queue, _channel) \ |
871 | for (_rx_queue = &_channel->efx->rx_queue[0]; \ | 878 | for (_rx_queue = &_channel->efx->rx_queue[_channel->channel]; \ |
872 | _rx_queue < &_channel->efx->rx_queue[EFX_MAX_RX_QUEUES]; \ | 879 | _rx_queue; \ |
873 | _rx_queue++) \ | 880 | _rx_queue = NULL) \ |
874 | if ((!_rx_queue->used) || \ | 881 | if (_rx_queue->channel != _channel) \ |
875 | (_rx_queue->channel != _channel)) \ | ||
876 | continue; \ | 882 | continue; \ |
877 | else | 883 | else |
878 | 884 | ||
@@ -886,13 +892,13 @@ static inline struct efx_rx_buffer *efx_rx_buffer(struct efx_rx_queue *rx_queue, | |||
886 | } | 892 | } |
887 | 893 | ||
888 | /* Set bit in a little-endian bitfield */ | 894 | /* Set bit in a little-endian bitfield */ |
889 | static inline void set_bit_le(int nr, unsigned char *addr) | 895 | static inline void set_bit_le(unsigned nr, unsigned char *addr) |
890 | { | 896 | { |
891 | addr[nr / 8] |= (1 << (nr % 8)); | 897 | addr[nr / 8] |= (1 << (nr % 8)); |
892 | } | 898 | } |
893 | 899 | ||
894 | /* Clear bit in a little-endian bitfield */ | 900 | /* Clear bit in a little-endian bitfield */ |
895 | static inline void clear_bit_le(int nr, unsigned char *addr) | 901 | static inline void clear_bit_le(unsigned nr, unsigned char *addr) |
896 | { | 902 | { |
897 | addr[nr / 8] &= ~(1 << (nr % 8)); | 903 | addr[nr / 8] &= ~(1 << (nr % 8)); |
898 | } | 904 | } |