From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: Michal Schmidt <mschmidt@redhat.com>
Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
pawel.chmielewski@intel.com, sridhar.samudrala@intel.com,
jacob.e.keller@intel.com, pio.raczynski@gmail.com,
konrad.knitter@intel.com, marcin.szycik@intel.com,
wojciech.drewek@intel.com, nex.sw.ncis.nat.hpm.dev@intel.com,
przemyslaw.kitszel@intel.com, jiri@resnulli.us, horms@kernel.org,
David.Laight@aculab.com
Subject: Re: [Intel-wired-lan] [iwl-next v6 2/9] ice: devlink PF MSI-X max and min parameter
Date: Mon, 4 Nov 2024 08:02:51 +0100 [thread overview]
Message-ID: <ZyhxmxnxPcLk2ZcX@mev-dev.igk.intel.com> (raw)
In-Reply-To: <CADEbmW0=G8u7Y8L2fFTzan8S+Uz04nAMC+-dkj-rQb_izK88pg@mail.gmail.com>
On Thu, Oct 31, 2024 at 10:48:37PM +0100, Michal Schmidt wrote:
> On Mon, Oct 28, 2024 at 11:04 AM Michal Swiatkowski
> <michal.swiatkowski@linux.intel.com> wrote:
> >
> > Use generic devlink PF MSI-X parameter to allow user to change MSI-X
> > range.
> >
> > Add notes about this parameters into ice devlink documentation.
> >
> > Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
> > Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> > ---
> > Documentation/networking/devlink/ice.rst | 11 +++
> > .../net/ethernet/intel/ice/devlink/devlink.c | 83 ++++++++++++++++++-
> > drivers/net/ethernet/intel/ice/ice.h | 7 ++
> > drivers/net/ethernet/intel/ice/ice_irq.c | 7 ++
> > 4 files changed, 107 insertions(+), 1 deletion(-)
> >
> > diff --git a/Documentation/networking/devlink/ice.rst b/Documentation/networking/devlink/ice.rst
> > index e3972d03cea0..792e9f8c846a 100644
> > --- a/Documentation/networking/devlink/ice.rst
> > +++ b/Documentation/networking/devlink/ice.rst
> > @@ -69,6 +69,17 @@ Parameters
> >
> > To verify that value has been set:
> > $ devlink dev param show pci/0000:16:00.0 name tx_scheduling_layers
> > + * - ``msix_vec_per_pf_max``
> > + - driverinit
> > + - Set the max MSI-X that can be used by the PF, rest can be utilized for
> > + SRIOV. The range is from min value set in msix_vec_per_pf_min to
> > + 2k/number of ports.
> > + * - ``msix_vec_per_pf_min``
> > + - driverinit
> > + - Set the min MSI-X that will be used by the PF. This value inform how many
> > + MSI-X will be allocated statically. The range is from 2 to value set
> > + in msix_vec_per_pf_max.
> > +
> > .. list-table:: Driver specific parameters implemented
> > :widths: 5 5 90
> >
> > diff --git a/drivers/net/ethernet/intel/ice/devlink/devlink.c b/drivers/net/ethernet/intel/ice/devlink/devlink.c
> > index d1b9ccec5e05..29c1fec4fa93 100644
> > --- a/drivers/net/ethernet/intel/ice/devlink/devlink.c
> > +++ b/drivers/net/ethernet/intel/ice/devlink/devlink.c
> > @@ -1198,6 +1198,25 @@ static int ice_devlink_set_parent(struct devlink_rate *devlink_rate,
> > return status;
> > }
> >
> > +static void ice_set_min_max_msix(struct ice_pf *pf)
> > +{
> > + struct devlink *devlink = priv_to_devlink(pf);
> > + union devlink_param_value val;
> > + int err;
> > +
> > + err = devl_param_driverinit_value_get(devlink,
> > + DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MIN,
> > + &val);
> > + if (!err)
> > + pf->msix.min = val.vu16;
> > +
> > + err = devl_param_driverinit_value_get(devlink,
> > + DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MAX,
> > + &val);
> > + if (!err)
> > + pf->msix.max = val.vu16;
> > +}
> > +
> > /**
> > * ice_devlink_reinit_up - do reinit of the given PF
> > * @pf: pointer to the PF struct
> > @@ -1207,6 +1226,9 @@ static int ice_devlink_reinit_up(struct ice_pf *pf)
> > struct ice_vsi *vsi = ice_get_main_vsi(pf);
> > int err;
> >
> > + /* load MSI-X values */
> > + ice_set_min_max_msix(pf);
> > +
> > err = ice_init_hw(&pf->hw);
> > if (err) {
> > dev_err(ice_pf_to_dev(pf), "ice_init_hw failed: %d\n", err);
> > @@ -1526,6 +1548,37 @@ static int ice_devlink_local_fwd_validate(struct devlink *devlink, u32 id,
> > return 0;
> > }
> >
> > +static int
> > +ice_devlink_msix_max_pf_validate(struct devlink *devlink, u32 id,
> > + union devlink_param_value val,
> > + struct netlink_ext_ack *extack)
> > +{
> > + struct ice_pf *pf = devlink_priv(devlink);
> > +
> > + if (val.vu16 > pf->hw.func_caps.common_cap.num_msix_vectors ||
> > + val.vu16 < pf->msix.min) {
> > + NL_SET_ERR_MSG_MOD(extack, "Value is invalid");
> > + return -EINVAL;
> > + }
> > +
> > + return 0;
> > +}
> > +
> > +static int
> > +ice_devlink_msix_min_pf_validate(struct devlink *devlink, u32 id,
> > + union devlink_param_value val,
> > + struct netlink_ext_ack *extack)
> > +{
> > + struct ice_pf *pf = devlink_priv(devlink);
> > +
> > + if (val.vu16 <= ICE_MIN_MSIX || val.vu16 > pf->msix.max) {
> > + NL_SET_ERR_MSG_MOD(extack, "Value is invalid");
> > + return -EINVAL;
> > + }
> > +
> > + return 0;
> > +}
> > +
> > enum ice_param_id {
> > ICE_DEVLINK_PARAM_ID_BASE = DEVLINK_PARAM_GENERIC_ID_MAX,
> > ICE_DEVLINK_PARAM_ID_TX_SCHED_LAYERS,
> > @@ -1543,6 +1596,15 @@ static const struct devlink_param ice_dvl_rdma_params[] = {
> > ice_devlink_enable_iw_validate),
> > };
> >
> > +static const struct devlink_param ice_dvl_msix_params[] = {
> > + DEVLINK_PARAM_GENERIC(MSIX_VEC_PER_PF_MAX,
> > + BIT(DEVLINK_PARAM_CMODE_DRIVERINIT),
> > + NULL, NULL, ice_devlink_msix_max_pf_validate),
> > + DEVLINK_PARAM_GENERIC(MSIX_VEC_PER_PF_MIN,
> > + BIT(DEVLINK_PARAM_CMODE_DRIVERINIT),
> > + NULL, NULL, ice_devlink_msix_min_pf_validate),
> > +};
> > +
> > static const struct devlink_param ice_dvl_sched_params[] = {
> > DEVLINK_PARAM_DRIVER(ICE_DEVLINK_PARAM_ID_TX_SCHED_LAYERS,
> > "tx_scheduling_layers",
> > @@ -1644,6 +1706,7 @@ void ice_devlink_unregister(struct ice_pf *pf)
> > int ice_devlink_register_params(struct ice_pf *pf)
> > {
> > struct devlink *devlink = priv_to_devlink(pf);
> > + union devlink_param_value value;
> > struct ice_hw *hw = &pf->hw;
> > int status;
> >
> > @@ -1652,11 +1715,27 @@ int ice_devlink_register_params(struct ice_pf *pf)
> > if (status)
> > return status;
> >
> > + status = devl_params_register(devlink, ice_dvl_msix_params,
> > + ARRAY_SIZE(ice_dvl_msix_params));
> > + if (status)
> > + return status;
> > +
> > if (hw->func_caps.common_cap.tx_sched_topo_comp_mode_en)
> > status = devl_params_register(devlink, ice_dvl_sched_params,
> > ARRAY_SIZE(ice_dvl_sched_params));
> > + if (status)
> > + return status;
> >
> > - return status;
> > + value.vu16 = pf->msix.max;
> > + devl_param_driverinit_value_set(devlink,
> > + DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MAX,
> > + value);
> > + value.vu16 = pf->msix.min;
> > + devl_param_driverinit_value_set(devlink,
> > + DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MIN,
> > + value);
> > +
> > + return 0;
> > }
>
>
> The type of the devlink parameters msix_vec_per_pf_{min,max} is
> specified as u32, so you must use value.vu32 everywhere you work with
> them, not vu16.
>
I will change it.
> Michal
>
next prev parent reply other threads:[~2024-11-04 7:05 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-28 10:03 [iwl-next v6 0/9] ice: managing MSI-X in driver Michal Swiatkowski
2024-10-28 10:03 ` [iwl-next v6 1/9] ice: count combined queues using Rx/Tx count Michal Swiatkowski
2024-10-28 10:03 ` [iwl-next v6 2/9] ice: devlink PF MSI-X max and min parameter Michal Swiatkowski
2024-10-31 21:48 ` [Intel-wired-lan] " Michal Schmidt
2024-11-04 7:02 ` Michal Swiatkowski [this message]
2024-11-04 8:51 ` David Laight
2024-11-04 9:09 ` Small Integers: Big Penalty (was: [Intel-wired-lan] [iwl-next v6 2/9] ice: devlink PF MSI-X max and min parameter) Paul Menzel
2024-11-04 9:12 ` [Intel-wired-lan] Small Integers: Big Penalty Paul Menzel
2024-11-04 11:24 ` Michal Swiatkowski
2024-11-05 22:36 ` Keller, Jacob E
2024-10-31 21:58 ` [Intel-wired-lan] [iwl-next v6 2/9] ice: devlink PF MSI-X max and min parameter Michal Schmidt
2024-11-04 7:03 ` Michal Swiatkowski
2024-10-28 10:03 ` [iwl-next v6 3/9] ice: remove splitting MSI-X between features Michal Swiatkowski
2024-10-28 10:03 ` [iwl-next v6 4/9] ice: get rid of num_lan_msix field Michal Swiatkowski
2024-10-28 10:03 ` [iwl-next v6 5/9] ice, irdma: move interrupts code to irdma Michal Swiatkowski
2024-10-28 10:03 ` [iwl-next v6 6/9] ice: treat dyn_allowed only as suggestion Michal Swiatkowski
2024-10-28 10:03 ` [iwl-next v6 7/9] ice: enable_rdma devlink param Michal Swiatkowski
2024-10-28 10:03 ` [iwl-next v6 8/9] ice: simplify VF MSI-X managing Michal Swiatkowski
2024-10-28 10:03 ` [iwl-next v6 9/9] ice: init flow director before RDMA Michal Swiatkowski
2024-10-30 20:23 ` [iwl-next v6 0/9] ice: managing MSI-X in driver Jacob Keller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZyhxmxnxPcLk2ZcX@mev-dev.igk.intel.com \
--to=michal.swiatkowski@linux.intel.com \
--cc=David.Laight@aculab.com \
--cc=horms@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jacob.e.keller@intel.com \
--cc=jiri@resnulli.us \
--cc=konrad.knitter@intel.com \
--cc=marcin.szycik@intel.com \
--cc=mschmidt@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=nex.sw.ncis.nat.hpm.dev@intel.com \
--cc=pawel.chmielewski@intel.com \
--cc=pio.raczynski@gmail.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=sridhar.samudrala@intel.com \
--cc=wojciech.drewek@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).