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 | 298 | efx->n_channels = 1; |
| 299 | 299 | efx->n_rx_channels = 1; |
| 300 | 300 | efx->n_tx_channels = 1; |
| 301 | + efx->tx_channel_offset = 0; | |
| 301 | 302 | efx->n_xdp_channels = 0; |
| 302 | 303 | efx->xdp_channel_offset = efx->n_channels; |
| 303 | 304 | rc = pci_enable_msi(efx->pci_dev); |
| @@ -318,6 +319,7 @@ int efx_probe_interrupts(struct efx_nic *efx) · 14 unmodified lines | ||
| 318 | 319 | efx->n_channels = 1 + (efx_separate_tx_channels ? 1 : 0); |
| 319 | 320 | efx->n_rx_channels = 1; |
| 320 | 321 | efx->n_tx_channels = 1; |
| 322 | + efx->tx_channel_offset = 1; | |
| 321 | 323 | efx->n_xdp_channels = 0; |
| 322 | 324 | efx->xdp_channel_offset = efx->n_channels; |
| 323 | 325 | efx->legacy_irq = efx->pci_dev->irq; |
| @@ -954,10 +956,6 @@ int efx_set_channels(struct efx_nic *efx) · 630 unmodified lines | ||
| 954 | 956 | struct efx_channel *channel; |
| 955 | 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 | 959 | if (efx->xdp_tx_queue_count) { |
| 962 | 960 | EFX_WARN_ON_PARANOID(efx->xdp_tx_queues); |
| 963 | 961 | |