tx_channel_offset is calculated in efx_allocate_msix_channels, but it is also calculated again in efx_set_channels because it was originally done there, and when efx_allocate_msix_channels was introduced it was forgotten to be removed from efx_set_channels. Moreover, the old calculation is wrong when using efx_separate_tx_channels because now we can have XDP channels after the TX channels, so n_channels - n_tx_channels doesn't point to the first TX channel. Remove the old calculation from efx_set_channels, and add the initialization of this variable if MSI or legacy interrupts are used, next to the initialization of the rest of the related variables, where it was missing.
Unified · Split
| @@ -298,6 +298,7 @@ int efx_probe_interrupts(struct efx_nic *efx) · 297 unmodified lines | |||
| 298 | efx->n_channels = 1; | 298 | efx->n_channels = 1; |
| 299 | efx->n_rx_channels = 1; | 299 | efx->n_rx_channels = 1; |
| 300 | efx->n_tx_channels = 1; | 300 | efx->n_tx_channels = 1; |
| 301 | efx->tx_channel_offset = 0; | ||
| 301 | efx->n_xdp_channels = 0; | 302 | efx->n_xdp_channels = 0; |
| 302 | efx->xdp_channel_offset = efx->n_channels; | 303 | efx->xdp_channel_offset = efx->n_channels; |
| 303 | rc = pci_enable_msi(efx->pci_dev); | 304 | rc = pci_enable_msi(efx->pci_dev); |
| @@ -318,6 +319,7 @@ int efx_probe_interrupts(struct efx_nic *efx) · 14 unmodified lines | |||
| 318 | efx->n_channels = 1 + (efx_separate_tx_channels ? 1 : 0); | 319 | efx->n_channels = 1 + (efx_separate_tx_channels ? 1 : 0); |
| 319 | efx->n_rx_channels = 1; | 320 | efx->n_rx_channels = 1; |
| 320 | efx->n_tx_channels = 1; | 321 | efx->n_tx_channels = 1; |
| 322 | efx->tx_channel_offset = 1; | ||
| 321 | efx->n_xdp_channels = 0; | 323 | efx->n_xdp_channels = 0; |
| 322 | efx->xdp_channel_offset = efx->n_channels; | 324 | efx->xdp_channel_offset = efx->n_channels; |
| 323 | efx->legacy_irq = efx->pci_dev->irq; | 325 | efx->legacy_irq = efx->pci_dev->irq; |
| @@ -954,10 +956,6 @@ int efx_set_channels(struct efx_nic *efx) · 630 unmodified lines | |||
| 954 | struct efx_channel *channel; | 956 | struct efx_channel *channel; |
| 955 | int rc; | 957 | int rc; |
| 956 | 958 | ||
| 957 | efx->tx_channel_offset = | ||
| 958 | efx_separate_tx_channels ? | ||
| 959 | efx->n_channels - efx->n_tx_channels : 0; | ||
| 960 | |||
| 961 | if (efx->xdp_tx_queue_count) { | 959 | if (efx->xdp_tx_queue_count) { |
| 962 | EFX_WARN_ON_PARANOID(efx->xdp_tx_queues); | 960 | EFX_WARN_ON_PARANOID(efx->xdp_tx_queues); |
| 963 | 961 | ||