Skip to content

Commit fe1c5ca

Browse files
Michal Swiatkowskidavem330
authored andcommitted
ice: implement num_msix field per VF
Store the amount of MSI-X per VF instead of storing it in pf struct. It is used to calculate number of q_vectors (and queues) for VF VSI. This is necessary because with follow up changes the number of MSI-X can be different between VFs. Use it instead of using pf->vf_msix value in all cases. Signed-off-by: Michal Swiatkowski <[email protected]> Reviewed-by: Przemek Kitszel <[email protected]> Tested-by: Rafal Romanowski <[email protected]> Signed-off-by: Jacob Keller <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 31642d2 commit fe1c5ca

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi)
229229
* of queues vectors, subtract 1 (ICE_NONQ_VECS_VF) from the
230230
* original vector count
231231
*/
232-
vsi->num_q_vectors = pf->vfs.num_msix_per - ICE_NONQ_VECS_VF;
232+
vsi->num_q_vectors = vf->num_msix - ICE_NONQ_VECS_VF;
233233
break;
234234
case ICE_VSI_CTRL:
235235
vsi->alloc_txq = 1;

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static void ice_free_vf_res(struct ice_vf *vf)
6464
vf->num_mac = 0;
6565
}
6666

67-
last_vector_idx = vf->first_vector_idx + pf->vfs.num_msix_per - 1;
67+
last_vector_idx = vf->first_vector_idx + vf->num_msix - 1;
6868

6969
/* clear VF MDD event information */
7070
memset(&vf->mdd_tx_events, 0, sizeof(vf->mdd_tx_events));
@@ -102,7 +102,7 @@ static void ice_dis_vf_mappings(struct ice_vf *vf)
102102
wr32(hw, VPINT_ALLOC_PCI(vf->vf_id), 0);
103103

104104
first = vf->first_vector_idx;
105-
last = first + pf->vfs.num_msix_per - 1;
105+
last = first + vf->num_msix - 1;
106106
for (v = first; v <= last; v++) {
107107
u32 reg;
108108

@@ -280,12 +280,12 @@ static void ice_ena_vf_msix_mappings(struct ice_vf *vf)
280280

281281
hw = &pf->hw;
282282
pf_based_first_msix = vf->first_vector_idx;
283-
pf_based_last_msix = (pf_based_first_msix + pf->vfs.num_msix_per) - 1;
283+
pf_based_last_msix = (pf_based_first_msix + vf->num_msix) - 1;
284284

285285
device_based_first_msix = pf_based_first_msix +
286286
pf->hw.func_caps.common_cap.msix_vector_first_id;
287287
device_based_last_msix =
288-
(device_based_first_msix + pf->vfs.num_msix_per) - 1;
288+
(device_based_first_msix + vf->num_msix) - 1;
289289
device_based_vf_id = vf->vf_id + hw->func_caps.vf_base_id;
290290

291291
reg = (((device_based_first_msix << VPINT_ALLOC_FIRST_S) &
@@ -825,6 +825,11 @@ static int ice_create_vf_entries(struct ice_pf *pf, u16 num_vfs)
825825

826826
pci_dev_get(vfdev);
827827

828+
/* set default number of MSI-X */
829+
vf->num_msix = pf->vfs.num_msix_per;
830+
vf->num_vf_qs = pf->vfs.num_qps_per;
831+
ice_vc_set_default_allowlist(vf);
832+
828833
hash_add_rcu(vfs->table, &vf->entry, vf_id);
829834
}
830835

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ struct ice_vfs {
7272
struct mutex table_lock; /* Lock for protecting the hash table */
7373
u16 num_supported; /* max supported VFs on this PF */
7474
u16 num_qps_per; /* number of queue pairs per VF */
75-
u16 num_msix_per; /* number of MSI-X vectors per VF */
75+
u16 num_msix_per; /* default MSI-X vectors per VF */
7676
unsigned long last_printed_mdd_jiffies; /* MDD message rate limit */
7777
};
7878

@@ -136,6 +136,8 @@ struct ice_vf {
136136

137137
/* devlink port data */
138138
struct devlink_port devlink_port;
139+
140+
u16 num_msix; /* num of MSI-X configured on this VF */
139141
};
140142

141143
/* Flags for controlling behavior of ice_reset_vf */

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ static int ice_vc_get_vf_res_msg(struct ice_vf *vf, u8 *msg)
501501
vfres->num_vsis = 1;
502502
/* Tx and Rx queue are equal for VF */
503503
vfres->num_queue_pairs = vsi->num_txq;
504-
vfres->max_vectors = vf->pf->vfs.num_msix_per;
504+
vfres->max_vectors = vf->num_msix;
505505
vfres->rss_key_size = ICE_VSIQF_HKEY_ARRAY_SIZE;
506506
vfres->rss_lut_size = ICE_LUT_VSI_SIZE;
507507
vfres->max_mtu = ice_vc_get_max_frame_size(vf);

0 commit comments

Comments
 (0)