History

sfc: fix wrong tx channel offset with efx_separate_tx_channels

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.

Íñigo Huguet committed 4 years ago

Commit c308dfd1 parent 2e102b51 file · +2 −4Browse files

Unified · Split

drivers/net/ethernet/sfc/efx_channels.c+2−4
@@ -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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t