All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: Jiri Pirko <jiri@resnulli.us>
Cc: wojciech.drewek@intel.com, marcin.szycik@intel.com,
	netdev@vger.kernel.org, konrad.knitter@intel.com,
	pawel.chmielewski@intel.com, intel-wired-lan@lists.osuosl.org,
	nex.sw.ncis.nat.hpm.dev@intel.com, pio.raczynski@gmail.com,
	sridhar.samudrala@intel.com, jacob.e.keller@intel.com,
	przemyslaw.kitszel@intel.com
Subject: Re: [Intel-wired-lan] [iwl-next v1 1/7] ice: devlink PF MSI-X max and min parameter
Date: Tue, 13 Feb 2024 11:01:08 +0100	[thread overview]
Message-ID: <Zcs95HiZz5g4QUwt@mev-dev> (raw)
In-Reply-To: <ZcswSYA5GqtOb3ll@nanopsycho>

On Tue, Feb 13, 2024 at 10:03:05AM +0100, Jiri Pirko wrote:
> Tue, Feb 13, 2024 at 08:35:03AM CET, michal.swiatkowski@linux.intel.com wrote:
> >Use generic devlink PF MSI-X parameter to allow user to change MSI-X
> >range.
> >
> >Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
> >Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> >---
> > drivers/net/ethernet/intel/ice/ice.h         |  8 ++
> > drivers/net/ethernet/intel/ice/ice_devlink.c | 82 ++++++++++++++++++++
> > drivers/net/ethernet/intel/ice/ice_irq.c     |  6 ++
> > 3 files changed, 96 insertions(+)
> >
> >diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h
> >index c4127d5f2be3..24085f3c0966 100644
> >--- a/drivers/net/ethernet/intel/ice/ice.h
> >+++ b/drivers/net/ethernet/intel/ice/ice.h
> >@@ -94,6 +94,7 @@
> > #define ICE_MIN_LAN_TXRX_MSIX	1
> > #define ICE_MIN_LAN_OICR_MSIX	1
> > #define ICE_MIN_MSIX		(ICE_MIN_LAN_TXRX_MSIX + ICE_MIN_LAN_OICR_MSIX)
> >+#define ICE_MAX_MSIX		256
> > #define ICE_FDIR_MSIX		2
> > #define ICE_RDMA_NUM_AEQ_MSIX	4
> > #define ICE_MIN_RDMA_MSIX	2
> >@@ -535,6 +536,12 @@ struct ice_agg_node {
> > 	u8 valid;
> > };
> > 
> >+struct ice_pf_msix {
> >+	u16 cur;
> >+	u16 min;
> >+	u16 max;
> >+};
> >+
> > struct ice_pf {
> > 	struct pci_dev *pdev;
> > 
> >@@ -604,6 +611,7 @@ struct ice_pf {
> > 	struct msi_map ll_ts_irq;	/* LL_TS interrupt MSIX vector */
> > 	u16 max_pf_txqs;	/* Total Tx queues PF wide */
> > 	u16 max_pf_rxqs;	/* Total Rx queues PF wide */
> >+	struct ice_pf_msix msix;
> > 	u16 num_lan_msix;	/* Total MSIX vectors for base driver */
> > 	u16 num_lan_tx;		/* num LAN Tx queues setup */
> > 	u16 num_lan_rx;		/* num LAN Rx queues setup */
> >diff --git a/drivers/net/ethernet/intel/ice/ice_devlink.c b/drivers/net/ethernet/intel/ice/ice_devlink.c
> >index cc717175178b..b82ff9556a4b 100644
> >--- a/drivers/net/ethernet/intel/ice/ice_devlink.c
> >+++ b/drivers/net/ethernet/intel/ice/ice_devlink.c
> >@@ -1603,6 +1603,78 @@ enum ice_param_id {
> > 	ICE_DEVLINK_PARAM_ID_LOOPBACK,
> > };
> > 
> >+static int
> >+ice_devlink_msix_max_pf_get(struct devlink *devlink, u32 id,
> >+			    struct devlink_param_gset_ctx *ctx)
> >+{
> >+	struct ice_pf *pf = devlink_priv(devlink);
> >+
> >+	ctx->val.vu16 = pf->msix.max;
> >+
> >+	return 0;
> >+}
> >+
> >+static int
> >+ice_devlink_msix_max_pf_set(struct devlink *devlink, u32 id,
> >+			    struct devlink_param_gset_ctx *ctx)
> >+{
> >+	struct ice_pf *pf = devlink_priv(devlink);
> >+	u16 max = ctx->val.vu16;
> >+
> >+	pf->msix.max = max;
> 
> What's permanent about this exactly?
> 

I want to store the value here after driver reinit. Isn't it enough to
use this parameter type? Which one should be used for this purpose?

> 
> >+
> >+	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)
> >+{
> >+	if (val.vu16 > ICE_MAX_MSIX) {
> >+		NL_SET_ERR_MSG_MOD(extack, "PF max MSI-X is too high");
> >+		return -EINVAL;
> >+	}
> >+
> >+	return 0;
> >+}
> >+
> >+static int
> >+ice_devlink_msix_min_pf_get(struct devlink *devlink, u32 id,
> >+			    struct devlink_param_gset_ctx *ctx)
> >+{
> >+	struct ice_pf *pf = devlink_priv(devlink);
> >+
> >+	ctx->val.vu16 = pf->msix.min;
> >+
> >+	return 0;
> >+}
> >+
> >+static int
> >+ice_devlink_msix_min_pf_set(struct devlink *devlink, u32 id,
> >+			    struct devlink_param_gset_ctx *ctx)
> >+{
> >+	struct ice_pf *pf = devlink_priv(devlink);
> >+	u16 min = ctx->val.vu16;
> >+
> >+	pf->msix.min = min;
> 
> What's permanent about this exactly?
>

The same as with max.

> 
> >+
> >+	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)
> >+{
> >+	if (val.vu16 <= ICE_MIN_MSIX) {
> >+		NL_SET_ERR_MSG_MOD(extack, "PF min MSI-X is too low");
> >+		return -EINVAL;
> >+	}
> >+
> >+	return 0;
> >+}
> >+
> > static const struct devlink_param ice_devlink_params[] = {
> > 	DEVLINK_PARAM_GENERIC(ENABLE_ROCE, BIT(DEVLINK_PARAM_CMODE_RUNTIME),
> > 			      ice_devlink_enable_roce_get,
> >@@ -1618,6 +1690,16 @@ static const struct devlink_param ice_devlink_params[] = {
> > 			     ice_devlink_loopback_get,
> > 			     ice_devlink_loopback_set,
> > 			     ice_devlink_loopback_validate),
> >+	DEVLINK_PARAM_GENERIC(MSIX_VEC_PER_PF_MAX,
> >+			      BIT(DEVLINK_PARAM_CMODE_PERMANENT),
> >+			      ice_devlink_msix_max_pf_get,
> >+			      ice_devlink_msix_max_pf_set,
> >+			      ice_devlink_msix_max_pf_validate),
> >+	DEVLINK_PARAM_GENERIC(MSIX_VEC_PER_PF_MIN,
> >+			      BIT(DEVLINK_PARAM_CMODE_PERMANENT),
> 
> ....
> 
> 
> pw-bot: cr
> 
> 
> >+			      ice_devlink_msix_min_pf_get,
> >+			      ice_devlink_msix_min_pf_set,
> >+			      ice_devlink_msix_min_pf_validate),
> > };
> > 
> > static void ice_devlink_free(void *devlink_ptr)
> >diff --git a/drivers/net/ethernet/intel/ice/ice_irq.c b/drivers/net/ethernet/intel/ice/ice_irq.c
> >index ad82ff7d1995..fa7178a68b94 100644
> >--- a/drivers/net/ethernet/intel/ice/ice_irq.c
> >+++ b/drivers/net/ethernet/intel/ice/ice_irq.c
> >@@ -254,6 +254,12 @@ int ice_init_interrupt_scheme(struct ice_pf *pf)
> > 	int total_vectors = pf->hw.func_caps.common_cap.num_msix_vectors;
> > 	int vectors, max_vectors;
> > 
> >+	/* load default PF MSI-X range */
> >+	if (!pf->msix.min)
> >+		pf->msix.min = ICE_MIN_MSIX;
> >+	if (!pf->msix.max)
> >+		pf->msix.max = total_vectors / 2;
> >+
> > 	vectors = ice_ena_msix_range(pf);
> > 
> > 	if (vectors < 0)
> >-- 
> >2.42.0
> >
> >

WARNING: multiple messages have this Message-ID (diff)
From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: Jiri Pirko <jiri@resnulli.us>
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
Subject: Re: [iwl-next v1 1/7] ice: devlink PF MSI-X max and min parameter
Date: Tue, 13 Feb 2024 11:01:08 +0100	[thread overview]
Message-ID: <Zcs95HiZz5g4QUwt@mev-dev> (raw)
In-Reply-To: <ZcswSYA5GqtOb3ll@nanopsycho>

On Tue, Feb 13, 2024 at 10:03:05AM +0100, Jiri Pirko wrote:
> Tue, Feb 13, 2024 at 08:35:03AM CET, michal.swiatkowski@linux.intel.com wrote:
> >Use generic devlink PF MSI-X parameter to allow user to change MSI-X
> >range.
> >
> >Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
> >Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> >---
> > drivers/net/ethernet/intel/ice/ice.h         |  8 ++
> > drivers/net/ethernet/intel/ice/ice_devlink.c | 82 ++++++++++++++++++++
> > drivers/net/ethernet/intel/ice/ice_irq.c     |  6 ++
> > 3 files changed, 96 insertions(+)
> >
> >diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h
> >index c4127d5f2be3..24085f3c0966 100644
> >--- a/drivers/net/ethernet/intel/ice/ice.h
> >+++ b/drivers/net/ethernet/intel/ice/ice.h
> >@@ -94,6 +94,7 @@
> > #define ICE_MIN_LAN_TXRX_MSIX	1
> > #define ICE_MIN_LAN_OICR_MSIX	1
> > #define ICE_MIN_MSIX		(ICE_MIN_LAN_TXRX_MSIX + ICE_MIN_LAN_OICR_MSIX)
> >+#define ICE_MAX_MSIX		256
> > #define ICE_FDIR_MSIX		2
> > #define ICE_RDMA_NUM_AEQ_MSIX	4
> > #define ICE_MIN_RDMA_MSIX	2
> >@@ -535,6 +536,12 @@ struct ice_agg_node {
> > 	u8 valid;
> > };
> > 
> >+struct ice_pf_msix {
> >+	u16 cur;
> >+	u16 min;
> >+	u16 max;
> >+};
> >+
> > struct ice_pf {
> > 	struct pci_dev *pdev;
> > 
> >@@ -604,6 +611,7 @@ struct ice_pf {
> > 	struct msi_map ll_ts_irq;	/* LL_TS interrupt MSIX vector */
> > 	u16 max_pf_txqs;	/* Total Tx queues PF wide */
> > 	u16 max_pf_rxqs;	/* Total Rx queues PF wide */
> >+	struct ice_pf_msix msix;
> > 	u16 num_lan_msix;	/* Total MSIX vectors for base driver */
> > 	u16 num_lan_tx;		/* num LAN Tx queues setup */
> > 	u16 num_lan_rx;		/* num LAN Rx queues setup */
> >diff --git a/drivers/net/ethernet/intel/ice/ice_devlink.c b/drivers/net/ethernet/intel/ice/ice_devlink.c
> >index cc717175178b..b82ff9556a4b 100644
> >--- a/drivers/net/ethernet/intel/ice/ice_devlink.c
> >+++ b/drivers/net/ethernet/intel/ice/ice_devlink.c
> >@@ -1603,6 +1603,78 @@ enum ice_param_id {
> > 	ICE_DEVLINK_PARAM_ID_LOOPBACK,
> > };
> > 
> >+static int
> >+ice_devlink_msix_max_pf_get(struct devlink *devlink, u32 id,
> >+			    struct devlink_param_gset_ctx *ctx)
> >+{
> >+	struct ice_pf *pf = devlink_priv(devlink);
> >+
> >+	ctx->val.vu16 = pf->msix.max;
> >+
> >+	return 0;
> >+}
> >+
> >+static int
> >+ice_devlink_msix_max_pf_set(struct devlink *devlink, u32 id,
> >+			    struct devlink_param_gset_ctx *ctx)
> >+{
> >+	struct ice_pf *pf = devlink_priv(devlink);
> >+	u16 max = ctx->val.vu16;
> >+
> >+	pf->msix.max = max;
> 
> What's permanent about this exactly?
> 

I want to store the value here after driver reinit. Isn't it enough to
use this parameter type? Which one should be used for this purpose?

> 
> >+
> >+	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)
> >+{
> >+	if (val.vu16 > ICE_MAX_MSIX) {
> >+		NL_SET_ERR_MSG_MOD(extack, "PF max MSI-X is too high");
> >+		return -EINVAL;
> >+	}
> >+
> >+	return 0;
> >+}
> >+
> >+static int
> >+ice_devlink_msix_min_pf_get(struct devlink *devlink, u32 id,
> >+			    struct devlink_param_gset_ctx *ctx)
> >+{
> >+	struct ice_pf *pf = devlink_priv(devlink);
> >+
> >+	ctx->val.vu16 = pf->msix.min;
> >+
> >+	return 0;
> >+}
> >+
> >+static int
> >+ice_devlink_msix_min_pf_set(struct devlink *devlink, u32 id,
> >+			    struct devlink_param_gset_ctx *ctx)
> >+{
> >+	struct ice_pf *pf = devlink_priv(devlink);
> >+	u16 min = ctx->val.vu16;
> >+
> >+	pf->msix.min = min;
> 
> What's permanent about this exactly?
>

The same as with max.

> 
> >+
> >+	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)
> >+{
> >+	if (val.vu16 <= ICE_MIN_MSIX) {
> >+		NL_SET_ERR_MSG_MOD(extack, "PF min MSI-X is too low");
> >+		return -EINVAL;
> >+	}
> >+
> >+	return 0;
> >+}
> >+
> > static const struct devlink_param ice_devlink_params[] = {
> > 	DEVLINK_PARAM_GENERIC(ENABLE_ROCE, BIT(DEVLINK_PARAM_CMODE_RUNTIME),
> > 			      ice_devlink_enable_roce_get,
> >@@ -1618,6 +1690,16 @@ static const struct devlink_param ice_devlink_params[] = {
> > 			     ice_devlink_loopback_get,
> > 			     ice_devlink_loopback_set,
> > 			     ice_devlink_loopback_validate),
> >+	DEVLINK_PARAM_GENERIC(MSIX_VEC_PER_PF_MAX,
> >+			      BIT(DEVLINK_PARAM_CMODE_PERMANENT),
> >+			      ice_devlink_msix_max_pf_get,
> >+			      ice_devlink_msix_max_pf_set,
> >+			      ice_devlink_msix_max_pf_validate),
> >+	DEVLINK_PARAM_GENERIC(MSIX_VEC_PER_PF_MIN,
> >+			      BIT(DEVLINK_PARAM_CMODE_PERMANENT),
> 
> ....
> 
> 
> pw-bot: cr
> 
> 
> >+			      ice_devlink_msix_min_pf_get,
> >+			      ice_devlink_msix_min_pf_set,
> >+			      ice_devlink_msix_min_pf_validate),
> > };
> > 
> > static void ice_devlink_free(void *devlink_ptr)
> >diff --git a/drivers/net/ethernet/intel/ice/ice_irq.c b/drivers/net/ethernet/intel/ice/ice_irq.c
> >index ad82ff7d1995..fa7178a68b94 100644
> >--- a/drivers/net/ethernet/intel/ice/ice_irq.c
> >+++ b/drivers/net/ethernet/intel/ice/ice_irq.c
> >@@ -254,6 +254,12 @@ int ice_init_interrupt_scheme(struct ice_pf *pf)
> > 	int total_vectors = pf->hw.func_caps.common_cap.num_msix_vectors;
> > 	int vectors, max_vectors;
> > 
> >+	/* load default PF MSI-X range */
> >+	if (!pf->msix.min)
> >+		pf->msix.min = ICE_MIN_MSIX;
> >+	if (!pf->msix.max)
> >+		pf->msix.max = total_vectors / 2;
> >+
> > 	vectors = ice_ena_msix_range(pf);
> > 
> > 	if (vectors < 0)
> >-- 
> >2.42.0
> >
> >

  reply	other threads:[~2024-02-13 10:01 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13  7:35 [Intel-wired-lan] [iwl-next v1 0/7] ice: managing MSI-X in driver Michal Swiatkowski
2024-02-13  7:35 ` Michal Swiatkowski
2024-02-13  7:35 ` [Intel-wired-lan] [iwl-next v1 1/7] ice: devlink PF MSI-X max and min parameter Michal Swiatkowski
2024-02-13  7:35   ` Michal Swiatkowski
2024-02-13  9:03   ` [Intel-wired-lan] " Jiri Pirko
2024-02-13  9:03     ` Jiri Pirko
2024-02-13 10:01     ` Michal Swiatkowski [this message]
2024-02-13 10:01       ` Michal Swiatkowski
2024-02-13 11:31       ` [Intel-wired-lan] " Jiri Pirko
2024-02-13 11:31         ` Jiri Pirko
2024-02-13 11:51         ` [Intel-wired-lan] " Michal Swiatkowski
2024-02-13 11:51           ` Michal Swiatkowski
2024-02-13  7:35 ` [Intel-wired-lan] [iwl-next v1 2/7] ice: remove splitting MSI-X between features Michal Swiatkowski
2024-02-13  7:35   ` Michal Swiatkowski
2024-02-13  7:35 ` [Intel-wired-lan] [iwl-next v1 3/7] ice: get rid of num_lan_msix field Michal Swiatkowski
2024-02-13  7:35   ` Michal Swiatkowski
2024-02-13  7:35 ` [Intel-wired-lan] [iwl-next v1 4/7] ice, irdma: move interrupts code to irdma Michal Swiatkowski
2024-02-13  7:35   ` Michal Swiatkowski
2024-02-13  7:35 ` [Intel-wired-lan] [iwl-next v1 5/7] ice: treat dyn_allowed only as suggestion Michal Swiatkowski
2024-02-13  7:35   ` Michal Swiatkowski
2024-02-13  7:35 ` [Intel-wired-lan] [iwl-next v1 6/7] ice: enable_rdma devlink param Michal Swiatkowski
2024-02-13  7:35   ` Michal Swiatkowski
2024-02-13  9:07   ` [Intel-wired-lan] " Jiri Pirko
2024-02-13  9:07     ` Jiri Pirko
2024-02-13  9:58     ` [Intel-wired-lan] " Michal Swiatkowski
2024-02-13  9:58       ` Michal Swiatkowski
2024-02-13 10:19       ` [Intel-wired-lan] " Wojciech Drewek
2024-02-13 10:19         ` Wojciech Drewek
2024-02-13 10:48         ` [Intel-wired-lan] " Michal Swiatkowski
2024-02-13 10:48           ` Michal Swiatkowski
2024-02-13 11:35         ` [Intel-wired-lan] " Jiri Pirko
2024-02-13 11:35           ` Jiri Pirko
2024-02-13  7:35 ` [Intel-wired-lan] [iwl-next v1 7/7] ice: simplify VF MSI-X managing Michal Swiatkowski
2024-02-13  7:35   ` Michal Swiatkowski

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=Zcs95HiZz5g4QUwt@mev-dev \
    --to=michal.swiatkowski@linux.intel.com \
    --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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.