hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
....@@ -832,32 +832,30 @@
832832 int xdp_count, int xdp_idx,
833833 int rxr_count, int rxr_idx)
834834 {
835
+ int node = dev_to_node(&adapter->pdev->dev);
835836 struct ixgbe_q_vector *q_vector;
836837 struct ixgbe_ring *ring;
837
- int node = NUMA_NO_NODE;
838838 int cpu = -1;
839
- int ring_count, size;
839
+ int ring_count;
840840 u8 tcs = adapter->hw_tcs;
841841
842842 ring_count = txr_count + rxr_count + xdp_count;
843
- size = sizeof(struct ixgbe_q_vector) +
844
- (sizeof(struct ixgbe_ring) * ring_count);
845843
846844 /* customize cpu for Flow Director mapping */
847845 if ((tcs <= 1) && !(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)) {
848846 u16 rss_i = adapter->ring_feature[RING_F_RSS].indices;
849847 if (rss_i > 1 && adapter->atr_sample_rate) {
850
- if (cpu_online(v_idx)) {
851
- cpu = v_idx;
852
- node = cpu_to_node(cpu);
853
- }
848
+ cpu = cpumask_local_spread(v_idx, node);
849
+ node = cpu_to_node(cpu);
854850 }
855851 }
856852
857853 /* allocate q_vector and rings */
858
- q_vector = kzalloc_node(size, GFP_KERNEL, node);
854
+ q_vector = kzalloc_node(struct_size(q_vector, ring, ring_count),
855
+ GFP_KERNEL, node);
859856 if (!q_vector)
860
- q_vector = kzalloc(size, GFP_KERNEL);
857
+ q_vector = kzalloc(struct_size(q_vector, ring, ring_count),
858
+ GFP_KERNEL);
861859 if (!q_vector)
862860 return -ENOMEM;
863861
....@@ -1031,10 +1029,10 @@
10311029 WRITE_ONCE(adapter->rx_ring[ring->queue_index], NULL);
10321030
10331031 adapter->q_vector[v_idx] = NULL;
1034
- napi_hash_del(&q_vector->napi);
1035
- netif_napi_del(&q_vector->napi);
1032
+ __netif_napi_del(&q_vector->napi);
10361033
10371034 /*
1035
+ * after a call to __netif_napi_del() napi may still be used and
10381036 * ixgbe_get_stats64() might access the rings on this vector,
10391037 * we must wait a grace period before freeing it.
10401038 */
....@@ -1055,7 +1053,7 @@
10551053 int txr_remaining = adapter->num_tx_queues;
10561054 int xdp_remaining = adapter->num_xdp_queues;
10571055 int rxr_idx = 0, txr_idx = 0, xdp_idx = 0, v_idx = 0;
1058
- int err;
1056
+ int err, i;
10591057
10601058 /* only one q_vector if MSI-X is disabled. */
10611059 if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED))
....@@ -1097,6 +1095,21 @@
10971095 xdp_idx += xqpv;
10981096 }
10991097
1098
+ for (i = 0; i < adapter->num_rx_queues; i++) {
1099
+ if (adapter->rx_ring[i])
1100
+ adapter->rx_ring[i]->ring_idx = i;
1101
+ }
1102
+
1103
+ for (i = 0; i < adapter->num_tx_queues; i++) {
1104
+ if (adapter->tx_ring[i])
1105
+ adapter->tx_ring[i]->ring_idx = i;
1106
+ }
1107
+
1108
+ for (i = 0; i < adapter->num_xdp_queues; i++) {
1109
+ if (adapter->xdp_ring[i])
1110
+ adapter->xdp_ring[i]->ring_idx = i;
1111
+ }
1112
+
11001113 return 0;
11011114
11021115 err_out: