diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2008-09-01 07:47:48 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-09-03 09:53:46 -0400 |
commit | 8831da7b6c4b15c0be0ba849be4aea5eed3999c6 (patch) | |
tree | 6bdfd5433f9eb4358a67504d85fb903fe17fd9d9 /drivers/net/sfc/efx.c | |
parent | 64ee3120f73b9e904d97ba66386b1e8e93b81385 (diff) |
sfc: Cleanup RX queue information
Rename efx_nic::rss_queues to the more obvious n_rx_queues
Remove efx_rx_queue::used and other stuff that's redundant with it.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/sfc/efx.c')
-rw-r--r-- | drivers/net/sfc/efx.c | 43 |
1 files changed, 14 insertions, 29 deletions
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c index 2deac7b04282..ba4369c8a834 100644 --- a/drivers/net/sfc/efx.c +++ b/drivers/net/sfc/efx.c | |||
@@ -859,20 +859,20 @@ static void efx_probe_interrupts(struct efx_nic *efx) | |||
859 | * We will need one channel per interrupt. | 859 | * We will need one channel per interrupt. |
860 | */ | 860 | */ |
861 | wanted_ints = rss_cpus ? rss_cpus : efx_wanted_rx_queues(); | 861 | wanted_ints = rss_cpus ? rss_cpus : efx_wanted_rx_queues(); |
862 | efx->rss_queues = min(wanted_ints, max_channels); | 862 | efx->n_rx_queues = min(wanted_ints, max_channels); |
863 | 863 | ||
864 | for (i = 0; i < efx->rss_queues; i++) | 864 | for (i = 0; i < efx->n_rx_queues; i++) |
865 | xentries[i].entry = i; | 865 | xentries[i].entry = i; |
866 | rc = pci_enable_msix(efx->pci_dev, xentries, efx->rss_queues); | 866 | rc = pci_enable_msix(efx->pci_dev, xentries, efx->n_rx_queues); |
867 | if (rc > 0) { | 867 | if (rc > 0) { |
868 | EFX_BUG_ON_PARANOID(rc >= efx->rss_queues); | 868 | EFX_BUG_ON_PARANOID(rc >= efx->n_rx_queues); |
869 | efx->rss_queues = rc; | 869 | efx->n_rx_queues = rc; |
870 | rc = pci_enable_msix(efx->pci_dev, xentries, | 870 | rc = pci_enable_msix(efx->pci_dev, xentries, |
871 | efx->rss_queues); | 871 | efx->n_rx_queues); |
872 | } | 872 | } |
873 | 873 | ||
874 | if (rc == 0) { | 874 | if (rc == 0) { |
875 | for (i = 0; i < efx->rss_queues; i++) | 875 | for (i = 0; i < efx->n_rx_queues; i++) |
876 | efx->channel[i].irq = xentries[i].vector; | 876 | efx->channel[i].irq = xentries[i].vector; |
877 | } else { | 877 | } else { |
878 | /* Fall back to single channel MSI */ | 878 | /* Fall back to single channel MSI */ |
@@ -883,7 +883,7 @@ static void efx_probe_interrupts(struct efx_nic *efx) | |||
883 | 883 | ||
884 | /* Try single interrupt MSI */ | 884 | /* Try single interrupt MSI */ |
885 | if (efx->interrupt_mode == EFX_INT_MODE_MSI) { | 885 | if (efx->interrupt_mode == EFX_INT_MODE_MSI) { |
886 | efx->rss_queues = 1; | 886 | efx->n_rx_queues = 1; |
887 | rc = pci_enable_msi(efx->pci_dev); | 887 | rc = pci_enable_msi(efx->pci_dev); |
888 | if (rc == 0) { | 888 | if (rc == 0) { |
889 | efx->channel[0].irq = efx->pci_dev->irq; | 889 | efx->channel[0].irq = efx->pci_dev->irq; |
@@ -895,7 +895,7 @@ static void efx_probe_interrupts(struct efx_nic *efx) | |||
895 | 895 | ||
896 | /* Assume legacy interrupts */ | 896 | /* Assume legacy interrupts */ |
897 | if (efx->interrupt_mode == EFX_INT_MODE_LEGACY) { | 897 | if (efx->interrupt_mode == EFX_INT_MODE_LEGACY) { |
898 | efx->rss_queues = 1; | 898 | efx->n_rx_queues = 1; |
899 | efx->legacy_irq = efx->pci_dev->irq; | 899 | efx->legacy_irq = efx->pci_dev->irq; |
900 | } | 900 | } |
901 | } | 901 | } |
@@ -914,14 +914,10 @@ static void efx_remove_interrupts(struct efx_nic *efx) | |||
914 | efx->legacy_irq = 0; | 914 | efx->legacy_irq = 0; |
915 | } | 915 | } |
916 | 916 | ||
917 | /* Select number of used resources | 917 | static void efx_set_channels(struct efx_nic *efx) |
918 | * Should be called after probe_interrupts() | ||
919 | */ | ||
920 | static void efx_select_used(struct efx_nic *efx) | ||
921 | { | 918 | { |
922 | struct efx_tx_queue *tx_queue; | 919 | struct efx_tx_queue *tx_queue; |
923 | struct efx_rx_queue *rx_queue; | 920 | struct efx_rx_queue *rx_queue; |
924 | int i; | ||
925 | 921 | ||
926 | efx_for_each_tx_queue(tx_queue, efx) { | 922 | efx_for_each_tx_queue(tx_queue, efx) { |
927 | if (!EFX_INT_MODE_USE_MSI(efx) && separate_tx_and_rx_channels) | 923 | if (!EFX_INT_MODE_USE_MSI(efx) && separate_tx_and_rx_channels) |
@@ -931,19 +927,9 @@ static void efx_select_used(struct efx_nic *efx) | |||
931 | tx_queue->channel->used_flags |= EFX_USED_BY_TX; | 927 | tx_queue->channel->used_flags |= EFX_USED_BY_TX; |
932 | } | 928 | } |
933 | 929 | ||
934 | /* RX queues. Each has a dedicated channel. */ | 930 | efx_for_each_rx_queue(rx_queue, efx) { |
935 | for (i = 0; i < EFX_MAX_RX_QUEUES; i++) { | 931 | rx_queue->channel = &efx->channel[rx_queue->queue]; |
936 | rx_queue = &efx->rx_queue[i]; | 932 | rx_queue->channel->used_flags |= EFX_USED_BY_RX; |
937 | |||
938 | if (i < efx->rss_queues) { | ||
939 | rx_queue->used = true; | ||
940 | /* If we allow multiple RX queues per channel | ||
941 | * we need to decide that here | ||
942 | */ | ||
943 | rx_queue->channel = &efx->channel[rx_queue->queue]; | ||
944 | rx_queue->channel->used_flags |= EFX_USED_BY_RX; | ||
945 | rx_queue++; | ||
946 | } | ||
947 | } | 933 | } |
948 | } | 934 | } |
949 | 935 | ||
@@ -962,8 +948,7 @@ static int efx_probe_nic(struct efx_nic *efx) | |||
962 | * in MSI-X interrupts. */ | 948 | * in MSI-X interrupts. */ |
963 | efx_probe_interrupts(efx); | 949 | efx_probe_interrupts(efx); |
964 | 950 | ||
965 | /* Determine number of RX queues and TX queues */ | 951 | efx_set_channels(efx); |
966 | efx_select_used(efx); | ||
967 | 952 | ||
968 | /* Initialise the interrupt moderation settings */ | 953 | /* Initialise the interrupt moderation settings */ |
969 | efx_init_irq_moderation(efx, tx_irq_mod_usec, rx_irq_mod_usec); | 954 | efx_init_irq_moderation(efx, tx_irq_mod_usec, rx_irq_mod_usec); |