Skip to content

Commit b265725

Browse files
Michal Swiatkowskianguy11
authored andcommitted
ice: devlink PF MSI-X max and min parameter
Use generic devlink PF MSI-X parameter to allow user to change MSI-X range. Add notes about this parameters into ice devlink documentation. Tested-by: Pucha Himasekhar Reddy <[email protected]> Signed-off-by: Michal Swiatkowski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent c3a392b commit b265725

File tree

4 files changed

+106
-0
lines changed

4 files changed

+106
-0
lines changed

Documentation/networking/devlink/ice.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ Parameters
6969

7070
To verify that value has been set:
7171
$ devlink dev param show pci/0000:16:00.0 name tx_scheduling_layers
72+
* - ``msix_vec_per_pf_max``
73+
- driverinit
74+
- Set the max MSI-X that can be used by the PF, rest can be utilized for
75+
SRIOV. The range is from min value set in msix_vec_per_pf_min to
76+
2k/number of ports.
77+
* - ``msix_vec_per_pf_min``
78+
- driverinit
79+
- Set the min MSI-X that will be used by the PF. This value inform how many
80+
MSI-X will be allocated statically. The range is from 2 to value set
81+
in msix_vec_per_pf_max.
82+
7283
.. list-table:: Driver specific parameters implemented
7384
:widths: 5 5 90
7485

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

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,25 @@ static int ice_devlink_set_parent(struct devlink_rate *devlink_rate,
12021202
return status;
12031203
}
12041204

1205+
static void ice_set_min_max_msix(struct ice_pf *pf)
1206+
{
1207+
struct devlink *devlink = priv_to_devlink(pf);
1208+
union devlink_param_value val;
1209+
int err;
1210+
1211+
err = devl_param_driverinit_value_get(devlink,
1212+
DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MIN,
1213+
&val);
1214+
if (!err)
1215+
pf->msix.min = val.vu32;
1216+
1217+
err = devl_param_driverinit_value_get(devlink,
1218+
DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MAX,
1219+
&val);
1220+
if (!err)
1221+
pf->msix.max = val.vu32;
1222+
}
1223+
12051224
/**
12061225
* ice_devlink_reinit_up - do reinit of the given PF
12071226
* @pf: pointer to the PF struct
@@ -1217,6 +1236,9 @@ static int ice_devlink_reinit_up(struct ice_pf *pf)
12171236
return err;
12181237
}
12191238

1239+
/* load MSI-X values */
1240+
ice_set_min_max_msix(pf);
1241+
12201242
err = ice_init_dev(pf);
12211243
if (err)
12221244
goto unroll_hw_init;
@@ -1530,6 +1552,30 @@ static int ice_devlink_local_fwd_validate(struct devlink *devlink, u32 id,
15301552
return 0;
15311553
}
15321554

1555+
static int
1556+
ice_devlink_msix_max_pf_validate(struct devlink *devlink, u32 id,
1557+
union devlink_param_value val,
1558+
struct netlink_ext_ack *extack)
1559+
{
1560+
struct ice_pf *pf = devlink_priv(devlink);
1561+
1562+
if (val.vu32 > pf->hw.func_caps.common_cap.num_msix_vectors)
1563+
return -EINVAL;
1564+
1565+
return 0;
1566+
}
1567+
1568+
static int
1569+
ice_devlink_msix_min_pf_validate(struct devlink *devlink, u32 id,
1570+
union devlink_param_value val,
1571+
struct netlink_ext_ack *extack)
1572+
{
1573+
if (val.vu32 < ICE_MIN_MSIX)
1574+
return -EINVAL;
1575+
1576+
return 0;
1577+
}
1578+
15331579
enum ice_param_id {
15341580
ICE_DEVLINK_PARAM_ID_BASE = DEVLINK_PARAM_GENERIC_ID_MAX,
15351581
ICE_DEVLINK_PARAM_ID_TX_SCHED_LAYERS,
@@ -1547,6 +1593,15 @@ static const struct devlink_param ice_dvl_rdma_params[] = {
15471593
ice_devlink_enable_iw_validate),
15481594
};
15491595

1596+
static const struct devlink_param ice_dvl_msix_params[] = {
1597+
DEVLINK_PARAM_GENERIC(MSIX_VEC_PER_PF_MAX,
1598+
BIT(DEVLINK_PARAM_CMODE_DRIVERINIT),
1599+
NULL, NULL, ice_devlink_msix_max_pf_validate),
1600+
DEVLINK_PARAM_GENERIC(MSIX_VEC_PER_PF_MIN,
1601+
BIT(DEVLINK_PARAM_CMODE_DRIVERINIT),
1602+
NULL, NULL, ice_devlink_msix_min_pf_validate),
1603+
};
1604+
15501605
static const struct devlink_param ice_dvl_sched_params[] = {
15511606
DEVLINK_PARAM_DRIVER(ICE_DEVLINK_PARAM_ID_TX_SCHED_LAYERS,
15521607
"tx_scheduling_layers",
@@ -1648,6 +1703,7 @@ void ice_devlink_unregister(struct ice_pf *pf)
16481703
int ice_devlink_register_params(struct ice_pf *pf)
16491704
{
16501705
struct devlink *devlink = priv_to_devlink(pf);
1706+
union devlink_param_value value;
16511707
struct ice_hw *hw = &pf->hw;
16521708
int status;
16531709

@@ -1656,10 +1712,33 @@ int ice_devlink_register_params(struct ice_pf *pf)
16561712
if (status)
16571713
return status;
16581714

1715+
status = devl_params_register(devlink, ice_dvl_msix_params,
1716+
ARRAY_SIZE(ice_dvl_msix_params));
1717+
if (status)
1718+
goto unregister_rdma_params;
1719+
16591720
if (hw->func_caps.common_cap.tx_sched_topo_comp_mode_en)
16601721
status = devl_params_register(devlink, ice_dvl_sched_params,
16611722
ARRAY_SIZE(ice_dvl_sched_params));
1723+
if (status)
1724+
goto unregister_msix_params;
1725+
1726+
value.vu32 = pf->msix.max;
1727+
devl_param_driverinit_value_set(devlink,
1728+
DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MAX,
1729+
value);
1730+
value.vu32 = pf->msix.min;
1731+
devl_param_driverinit_value_set(devlink,
1732+
DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MIN,
1733+
value);
1734+
return 0;
16621735

1736+
unregister_msix_params:
1737+
devl_params_unregister(devlink, ice_dvl_msix_params,
1738+
ARRAY_SIZE(ice_dvl_msix_params));
1739+
unregister_rdma_params:
1740+
devl_params_unregister(devlink, ice_dvl_rdma_params,
1741+
ARRAY_SIZE(ice_dvl_rdma_params));
16631742
return status;
16641743
}
16651744

@@ -1670,6 +1749,8 @@ void ice_devlink_unregister_params(struct ice_pf *pf)
16701749

16711750
devl_params_unregister(devlink, ice_dvl_rdma_params,
16721751
ARRAY_SIZE(ice_dvl_rdma_params));
1752+
devl_params_unregister(devlink, ice_dvl_msix_params,
1753+
ARRAY_SIZE(ice_dvl_msix_params));
16731754

16741755
if (hw->func_caps.common_cap.tx_sched_topo_comp_mode_en)
16751756
devl_params_unregister(devlink, ice_dvl_sched_params,

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,12 @@ struct ice_agg_node {
542542
u8 valid;
543543
};
544544

545+
struct ice_pf_msix {
546+
u32 cur;
547+
u32 min;
548+
u32 max;
549+
};
550+
545551
struct ice_pf {
546552
struct pci_dev *pdev;
547553
struct ice_adapter *adapter;
@@ -612,6 +618,7 @@ struct ice_pf {
612618
struct msi_map ll_ts_irq; /* LL_TS interrupt MSIX vector */
613619
u16 max_pf_txqs; /* Total Tx queues PF wide */
614620
u16 max_pf_rxqs; /* Total Rx queues PF wide */
621+
struct ice_pf_msix msix;
615622
u16 num_lan_msix; /* Total MSIX vectors for base driver */
616623
u16 num_lan_tx; /* num LAN Tx queues setup */
617624
u16 num_lan_rx; /* num LAN Rx queues setup */

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,13 @@ int ice_init_interrupt_scheme(struct ice_pf *pf)
254254
int total_vectors = pf->hw.func_caps.common_cap.num_msix_vectors;
255255
int vectors, max_vectors;
256256

257+
/* load default PF MSI-X range */
258+
if (!pf->msix.min)
259+
pf->msix.min = ICE_MIN_MSIX;
260+
261+
if (!pf->msix.max)
262+
pf->msix.max = total_vectors / 2;
263+
257264
vectors = ice_ena_msix_range(pf);
258265

259266
if (vectors < 0)

0 commit comments

Comments
 (0)