@@ -1472,6 +1472,12 @@ static int efx_allocate_msix_channels(struct efx_nic *efx,
1472
1472
n_xdp_tx = num_possible_cpus ();
1473
1473
n_xdp_ev = DIV_ROUND_UP (n_xdp_tx , EFX_TXQ_TYPES );
1474
1474
1475
+ vec_count = pci_msix_vec_count (efx -> pci_dev );
1476
+ if (vec_count < 0 )
1477
+ return vec_count ;
1478
+
1479
+ max_channels = min_t (unsigned int , vec_count , max_channels );
1480
+
1475
1481
/* Check resources.
1476
1482
* We need a channel per event queue, plus a VI per tx queue.
1477
1483
* This may be more pessimistic than it needs to be.
@@ -1493,11 +1499,6 @@ static int efx_allocate_msix_channels(struct efx_nic *efx,
1493
1499
n_xdp_tx , n_xdp_ev );
1494
1500
}
1495
1501
1496
- n_channels = min (n_channels , max_channels );
1497
-
1498
- vec_count = pci_msix_vec_count (efx -> pci_dev );
1499
- if (vec_count < 0 )
1500
- return vec_count ;
1501
1502
if (vec_count < n_channels ) {
1502
1503
netif_err (efx , drv , efx -> net_dev ,
1503
1504
"WARNING: Insufficient MSI-X vectors available (%d < %u).\n" ,
@@ -1507,11 +1508,9 @@ static int efx_allocate_msix_channels(struct efx_nic *efx,
1507
1508
n_channels = vec_count ;
1508
1509
}
1509
1510
1510
- efx -> n_channels = n_channels ;
1511
+ n_channels = min ( n_channels , max_channels ) ;
1511
1512
1512
- /* Do not create the PTP TX queue(s) if PTP uses the MC directly. */
1513
- if (extra_channels && !efx_ptp_use_mac_tx_timestamps (efx ))
1514
- n_channels -- ;
1513
+ efx -> n_channels = n_channels ;
1515
1514
1516
1515
/* Ignore XDP tx channels when creating rx channels. */
1517
1516
n_channels -= efx -> n_xdp_channels ;
@@ -1531,11 +1530,10 @@ static int efx_allocate_msix_channels(struct efx_nic *efx,
1531
1530
efx -> n_rx_channels = n_channels ;
1532
1531
}
1533
1532
1534
- if (efx -> n_xdp_channels )
1535
- efx -> xdp_channel_offset = efx -> tx_channel_offset +
1536
- efx -> n_tx_channels ;
1537
- else
1538
- efx -> xdp_channel_offset = efx -> n_channels ;
1533
+ efx -> n_rx_channels = min (efx -> n_rx_channels , parallelism );
1534
+ efx -> n_tx_channels = min (efx -> n_tx_channels , parallelism );
1535
+
1536
+ efx -> xdp_channel_offset = n_channels ;
1539
1537
1540
1538
netif_dbg (efx , drv , efx -> net_dev ,
1541
1539
"Allocating %u RX channels\n" ,
@@ -1550,6 +1548,7 @@ static int efx_allocate_msix_channels(struct efx_nic *efx,
1550
1548
static int efx_probe_interrupts (struct efx_nic * efx )
1551
1549
{
1552
1550
unsigned int extra_channels = 0 ;
1551
+ unsigned int rss_spread ;
1553
1552
unsigned int i , j ;
1554
1553
int rc ;
1555
1554
@@ -1631,8 +1630,7 @@ static int efx_probe_interrupts(struct efx_nic *efx)
1631
1630
for (i = 0 ; i < EFX_MAX_EXTRA_CHANNELS ; i ++ ) {
1632
1631
if (!efx -> extra_channel_type [i ])
1633
1632
continue ;
1634
- if (efx -> interrupt_mode != EFX_INT_MODE_MSIX ||
1635
- efx -> n_channels <= extra_channels ) {
1633
+ if (j <= efx -> tx_channel_offset + efx -> n_tx_channels ) {
1636
1634
efx -> extra_channel_type [i ]-> handle_no_channel (efx );
1637
1635
} else {
1638
1636
-- j ;
@@ -1643,16 +1641,17 @@ static int efx_probe_interrupts(struct efx_nic *efx)
1643
1641
}
1644
1642
}
1645
1643
1644
+ rss_spread = efx -> n_rx_channels ;
1646
1645
/* RSS might be usable on VFs even if it is disabled on the PF */
1647
1646
#ifdef CONFIG_SFC_SRIOV
1648
1647
if (efx -> type -> sriov_wanted ) {
1649
- efx -> rss_spread = ((efx -> n_rx_channels > 1 ||
1648
+ efx -> rss_spread = ((rss_spread > 1 ||
1650
1649
!efx -> type -> sriov_wanted (efx )) ?
1651
- efx -> n_rx_channels : efx_vf_size (efx ));
1650
+ rss_spread : efx_vf_size (efx ));
1652
1651
return 0 ;
1653
1652
}
1654
1653
#endif
1655
- efx -> rss_spread = efx -> n_rx_channels ;
1654
+ efx -> rss_spread = rss_spread ;
1656
1655
1657
1656
return 0 ;
1658
1657
}
0 commit comments