Skip to content

Commit ad61cd9

Browse files
Michal Swiatkowskianguy11
authored andcommitted
ice: get rid of num_lan_msix field
Remove the field to allow having more queues than MSI-X on VSI. As default the number will be the same, but if there won't be more MSI-X available VSI can run with at least one MSI-X. Reviewed-by: Jacob Keller <[email protected]> Reviewed-by: Wojciech Drewek <[email protected]> Tested-by: Pucha Himasekhar Reddy <[email protected]> Signed-off-by: Michal Swiatkowski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 79d97b8 commit ad61cd9

File tree

5 files changed

+24
-29
lines changed

5 files changed

+24
-29
lines changed

drivers/net/ethernet/intel/ice/ice.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,6 @@ struct ice_pf {
617617
u16 max_pf_txqs; /* Total Tx queues PF wide */
618618
u16 max_pf_rxqs; /* Total Rx queues PF wide */
619619
struct ice_pf_msix msix;
620-
u16 num_lan_msix; /* Total MSIX vectors for base driver */
621620
u16 num_lan_tx; /* num LAN Tx queues setup */
622621
u16 num_lan_rx; /* num LAN Rx queues setup */
623622
u16 next_vsi; /* Next free slot in pf->vsi[] - 0-based! */

drivers/net/ethernet/intel/ice/ice_base.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -801,13 +801,11 @@ int ice_vsi_alloc_q_vectors(struct ice_vsi *vsi)
801801
return 0;
802802

803803
err_out:
804-
while (v_idx--)
805-
ice_free_q_vector(vsi, v_idx);
806804

807-
dev_err(dev, "Failed to allocate %d q_vector for VSI %d, ret=%d\n",
808-
vsi->num_q_vectors, vsi->vsi_num, err);
809-
vsi->num_q_vectors = 0;
810-
return err;
805+
dev_info(dev, "Failed to allocate %d q_vectors for VSI %d, new value %d",
806+
vsi->num_q_vectors, vsi->vsi_num, v_idx);
807+
vsi->num_q_vectors = v_idx;
808+
return v_idx ? 0 : err;
811809
}
812810

813811
/**

drivers/net/ethernet/intel/ice/ice_ethtool.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3788,8 +3788,7 @@ ice_get_ts_info(struct net_device *dev, struct kernel_ethtool_ts_info *info)
37883788
*/
37893789
static int ice_get_max_txq(struct ice_pf *pf)
37903790
{
3791-
return min3(pf->num_lan_msix, (u16)num_online_cpus(),
3792-
(u16)pf->hw.func_caps.common_cap.num_txq);
3791+
return min(num_online_cpus(), pf->hw.func_caps.common_cap.num_txq);
37933792
}
37943793

37953794
/**
@@ -3798,8 +3797,7 @@ static int ice_get_max_txq(struct ice_pf *pf)
37983797
*/
37993798
static int ice_get_max_rxq(struct ice_pf *pf)
38003799
{
3801-
return min3(pf->num_lan_msix, (u16)num_online_cpus(),
3802-
(u16)pf->hw.func_caps.common_cap.num_rxq);
3800+
return min(num_online_cpus(), pf->hw.func_caps.common_cap.num_rxq);
38033801
}
38043802

38053803
/**

drivers/net/ethernet/intel/ice/ice_irq.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void ice_clear_interrupt_scheme(struct ice_pf *pf)
108108
int ice_init_interrupt_scheme(struct ice_pf *pf)
109109
{
110110
int total_vectors = pf->hw.func_caps.common_cap.num_msix_vectors;
111-
int vectors, max_vectors;
111+
int vectors;
112112

113113
/* load default PF MSI-X range */
114114
if (!pf->msix.min)
@@ -118,20 +118,17 @@ int ice_init_interrupt_scheme(struct ice_pf *pf)
118118
pf->msix.max = min(total_vectors,
119119
ice_get_default_msix_amount(pf));
120120

121-
if (pci_msix_can_alloc_dyn(pf->pdev)) {
121+
if (pci_msix_can_alloc_dyn(pf->pdev))
122122
vectors = pf->msix.min;
123-
max_vectors = total_vectors;
124-
} else {
123+
else
125124
vectors = pf->msix.max;
126-
max_vectors = vectors;
127-
}
128125

129126
vectors = pci_alloc_irq_vectors(pf->pdev, pf->msix.min, vectors,
130127
PCI_IRQ_MSIX);
131128
if (vectors < pf->msix.min)
132129
return -ENOMEM;
133130

134-
ice_init_irq_tracker(pf, max_vectors, vectors);
131+
ice_init_irq_tracker(pf, pf->msix.max, vectors);
135132

136133
return 0;
137134
}

drivers/net/ethernet/intel/ice/ice_lib.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,16 @@ static void ice_vsi_set_num_desc(struct ice_vsi *vsi)
157157
}
158158
}
159159

160+
static u16 ice_get_rxq_count(struct ice_pf *pf)
161+
{
162+
return min(ice_get_avail_rxq_count(pf), num_online_cpus());
163+
}
164+
165+
static u16 ice_get_txq_count(struct ice_pf *pf)
166+
{
167+
return min(ice_get_avail_txq_count(pf), num_online_cpus());
168+
}
169+
160170
/**
161171
* ice_vsi_set_num_qs - Set number of queues, descriptors and vectors for a VSI
162172
* @vsi: the VSI being configured
@@ -178,9 +188,7 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi)
178188
vsi->alloc_txq = vsi->req_txq;
179189
vsi->num_txq = vsi->req_txq;
180190
} else {
181-
vsi->alloc_txq = min3(pf->num_lan_msix,
182-
ice_get_avail_txq_count(pf),
183-
(u16)num_online_cpus());
191+
vsi->alloc_txq = ice_get_txq_count(pf);
184192
}
185193

186194
pf->num_lan_tx = vsi->alloc_txq;
@@ -193,17 +201,13 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi)
193201
vsi->alloc_rxq = vsi->req_rxq;
194202
vsi->num_rxq = vsi->req_rxq;
195203
} else {
196-
vsi->alloc_rxq = min3(pf->num_lan_msix,
197-
ice_get_avail_rxq_count(pf),
198-
(u16)num_online_cpus());
204+
vsi->alloc_rxq = ice_get_rxq_count(pf);
199205
}
200206
}
201207

202208
pf->num_lan_rx = vsi->alloc_rxq;
203209

204-
vsi->num_q_vectors = min_t(int, pf->num_lan_msix,
205-
max_t(int, vsi->alloc_rxq,
206-
vsi->alloc_txq));
210+
vsi->num_q_vectors = max(vsi->alloc_rxq, vsi->alloc_txq);
207211
break;
208212
case ICE_VSI_SF:
209213
vsi->alloc_txq = 1;
@@ -1173,12 +1177,11 @@ static void ice_set_rss_vsi_ctx(struct ice_vsi_ctx *ctxt, struct ice_vsi *vsi)
11731177
static void
11741178
ice_chnl_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt)
11751179
{
1176-
struct ice_pf *pf = vsi->back;
11771180
u16 qcount, qmap;
11781181
u8 offset = 0;
11791182
int pow;
11801183

1181-
qcount = min_t(int, vsi->num_rxq, pf->num_lan_msix);
1184+
qcount = vsi->num_rxq;
11821185

11831186
pow = order_base_2(qcount);
11841187
qmap = FIELD_PREP(ICE_AQ_VSI_TC_Q_OFFSET_M, offset);

0 commit comments

Comments
 (0)