From patchwork Fri Jul 12 00:33:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 13731196 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A59071396 for ; Fri, 12 Jul 2024 00:33:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720744406; cv=none; b=PZhuYRkkBkjIgXV73YQVhupAanJn4AirOYUzjgvU78fX2lxhJx8hK5OnuqwgIDFpTr9Z90OVqBrKimQ3jeBZJDhpXF3+2amwwo5YDGHlaO3SPEoQIeTbrIpokzX26IFdnQ6eg9qdTuiw9FZq9AwwYQHnNiVTbyUf9JzRqpLFIws= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720744406; c=relaxed/simple; bh=qKpMdWz6tE7fBzAUkJxNWrVWadwuxNoA3IqEeWuJVtA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cYSIi/VvdFqah/dEml905cVkjZh+znTPxjIzb6wD5kNmyXF9cr7VnCexH4txXJUvPNrXMsVBXd2lfYZqiYB/FM17oyvlv7BW5+Sui1oqu8l+pWQWbdPdDKJ7+v886pkvH0MSyTkM6dXnLbpt/Opp0X6/hRbcWU8C4PlkSdokMi4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DHPlwEtF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DHPlwEtF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79474C116B1; Fri, 12 Jul 2024 00:33:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720744406; bh=qKpMdWz6tE7fBzAUkJxNWrVWadwuxNoA3IqEeWuJVtA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DHPlwEtF6zGPt1Bxn1Cb4+0bcuWczKGZWuBT6K34qpc/d8/SWJA4rDSTZa2xSOfMK OuCzeRUn/dsBHVRNQsa8P8dpnDXJt4LBUIbydSgJ6ET865iFmp83xyGVQu1aCgy8KO beI5aVGDxYMn81tNuHs8dHHYoCIWdwarzsFpt6dGChoPbCwh/7vHLerPI9o3UNXFpS B5mTcyCxwPyOK0zAxkIseApBcoJygjbK2s4IA4PH1tOMaoVhnX01Fe92nNSXlShQwO fBPisMRW0rd5I14csHLqpZ68ov+14Q/fQl738XYGq+e7s7/kGJ2xnw5ejbqusSnJ0w PXJFWEtedAg9Q== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Gal Pressman , Leon Romanovsky , Daniel Jurgens , William Tu Subject: [PATCH net-next V3 1/4] net/mlx5: IFC updates for SF max IO EQs Date: Thu, 11 Jul 2024 17:33:07 -0700 Message-ID: <20240712003310.355106-2-saeed@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240712003310.355106-1-saeed@kernel.org> References: <20240712003310.355106-1-saeed@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Daniel Jurgens Expose a new cap sf_eq_usage. The vhca_resource_manager can write this cap, indicating the SF driver should use max_num_eqs_24b to determine how many EQs to use. Will be used in the next patch, to indicate to the SF driver from the PF that the user has set the max io eqs via devlink. So the SF driver can later query the proper max eq value from the new cap. devlink port function set pci/0000:08:00.0/32768 max_io_eqs 32 Signed-off-by: Daniel Jurgens Reviewed-by: William Tu Signed-off-by: Tariq Toukan Signed-off-by: Saeed Mahameed --- include/linux/mlx5/mlx5_ifc.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index fdad0071d599..360d42f041b0 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h @@ -1994,7 +1994,9 @@ struct mlx5_ifc_cmd_hca_cap_2_bits { u8 migration_tracking_state[0x1]; u8 reserved_at_ca[0x6]; u8 migration_in_chunks[0x1]; - u8 reserved_at_d1[0xf]; + u8 reserved_at_d1[0x1]; + u8 sf_eq_usage[0x1]; + u8 reserved_at_d3[0xd]; u8 cross_vhca_object_to_object_supported[0x20]; From patchwork Fri Jul 12 00:33:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 13731197 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 85FEC441D for ; Fri, 12 Jul 2024 00:33:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720744407; cv=none; b=koplIkfsffyKyZwRdqBebnx6E2eEFiUsjtRUlPpQKyDtF4ryNSS1SWfU0oM2Miu013GBhzeJ46THACCi2v36kON0b/G+696+jlBtxpwUykJlJjHYS9C7rZQf4JFT1S48VLXNczSwT/jsEmiDBot3mj4zsAq8xTldntIBL8pVymY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720744407; c=relaxed/simple; bh=vvEJwGnN6uyldzpKsS7JynTlHkGx4A9fSa8syNIOeLU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RC9rr29R2qzvdA3cyE+n8SSk2ouhO7a6tlMwEoDncqGrFQZaZSt3+ggHVa0Xjuk1IfF8ALUVyil/Q5Brbqr7zTrKjsMtRoyiEuezKyWRgwGGWlkKiEQI9c2g/qCASixriXxSf/IvOT9llEakDpgVMO64Mouk6x0VA+DBqjwfAjk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FuG2knB0; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FuG2knB0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 598D0C4AF09; Fri, 12 Jul 2024 00:33:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720744407; bh=vvEJwGnN6uyldzpKsS7JynTlHkGx4A9fSa8syNIOeLU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FuG2knB0tC28M6WuM5RxSRV8h9A8qaMUbRpJCK2+I9GPg4R254vqkVt9CF7EBzc3d Hoh+mDsOfibQ4J2k5msWbuKXUBsqShV2Q5v4gmOsZOe43cp9JCqQd50/Y631GN4wN8 xX5mO97Q82C7RI0kYB59xihjGSyREmQIjT8X+n5D/60raHOCxm/Fdi7y4cdv/3KGAE LCbqbZ7pT+YGp9RcAD8oVZSi9eejVAAszSLFmgqMM+8OYIYRMJZWqky6BCdToHnB1A fE4fFqKWw1g/1pPq0VulAKwlEvHqkNTxdODggdU3COsjqmFEU3GWeBbws49QcwurJC ZasLtHUx9xOFg== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Gal Pressman , Leon Romanovsky , Daniel Jurgens , William Tu Subject: [PATCH net-next V3 2/4] net/mlx5: Set sf_eq_usage for SF max EQs Date: Thu, 11 Jul 2024 17:33:08 -0700 Message-ID: <20240712003310.355106-3-saeed@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240712003310.355106-1-saeed@kernel.org> References: <20240712003310.355106-1-saeed@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Daniel Jurgens When setting max_io_eqs for an SF function also set the sf_eq_usage_cap. This is to indicate to the SF driver from the PF that the user has set the max io eqs via devlink. So the SF driver can later query the proper max eq value from the new cap. Signed-off-by: Daniel Jurgens Reviewed-by: William Tu Signed-off-by: Tariq Toukan Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index 72949cb85244..099a716f1784 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c @@ -4676,6 +4676,9 @@ mlx5_devlink_port_fn_max_io_eqs_set(struct devlink_port *port, u32 max_io_eqs, hca_caps = MLX5_ADDR_OF(query_hca_cap_out, query_ctx, capability); MLX5_SET(cmd_hca_cap_2, hca_caps, max_num_eqs_24b, max_eqs); + if (mlx5_esw_is_sf_vport(esw, vport_num)) + MLX5_SET(cmd_hca_cap_2, hca_caps, sf_eq_usage, 1); + err = mlx5_vport_set_other_func_cap(esw->dev, hca_caps, vport_num, MLX5_SET_HCA_CAP_OP_MOD_GENERAL_DEVICE2); if (err) From patchwork Fri Jul 12 00:33:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 13731198 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A64B44C97 for ; Fri, 12 Jul 2024 00:33:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720744408; cv=none; b=XwLBm83NkoEOHUZkXP27+AzMISYNHSGLgwmDXPWS4WyeEdGRpAcOjtrXpnTOx+RP6wfc3lfcuxoKaFwD6TTzGi+Bol/Pi9fw+jHMdLVbD+ZixdK3a8rBKzNKYaQKZQ+pkN7tF/Gpo5IyOtxz/6Lm9+npOTxf8trSoLq/7ECoJe0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720744408; c=relaxed/simple; bh=RD4UbqPP1RnaSCibgSxfet9vt1wWq1U0hDug3RgiRP0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K5Q6F6MLUsGd8L+pGoThtHgujRAqNqRhikWHX15leJMI9v6lkGAjFCryrgyfwrHYQT9UItIm2Izhy9lV+tSYVgbIQaRMGj7TNb5tPnNn0QXmxjHWg7k1pOHafz+ufGARpdZqhYcRL/mICpkrbpBBh9V5zev2Gb0k8gRLcHHd9Mc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HHV010fN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HHV010fN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33C94C116B1; Fri, 12 Jul 2024 00:33:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720744408; bh=RD4UbqPP1RnaSCibgSxfet9vt1wWq1U0hDug3RgiRP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HHV010fNBLyMuw6O2EQefdXBnODDCOlUCoJvPwE8jSgrcqrJeDovDVKQGFa1ytSe6 Ec29vRCfowFaeL0ZzqNKCT5MGdbYmp6ih1I7GIoG7W7au2I9zuva5CmsIINKq7WSXs Yah971zf4c9CnHSQd+qjcaaV/DgFmCBo4sm/Qd2GUUrJXlkAve5DRVv2Dc2mXUOXcu +gdnwYIWmD0elsf9J+4xenTW9KaOAIEKfaznqxVHiLPli0OKAhvrAy33lnWHCHqb7T ageN1N2J3D/ai0+xFsK/Zyg0rmumwyau9q7/nqyuG5Q0cbzrWrTBpCSBLF03L2srW4 XoalMJBbBFXbQ== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Gal Pressman , Leon Romanovsky , Daniel Jurgens , William Tu Subject: [PATCH net-next V3 3/4] net/mlx5: Set default max eqs for SFs Date: Thu, 11 Jul 2024 17:33:09 -0700 Message-ID: <20240712003310.355106-4-saeed@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240712003310.355106-1-saeed@kernel.org> References: <20240712003310.355106-1-saeed@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Daniel Jurgens If the user hasn't configured max_io_eqs set a low default. The SF driver shouldn't try to create more than this, but FW will enforce this limit. Signed-off-by: Daniel Jurgens Reviewed-by: William Tu Signed-off-by: Tariq Toukan Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/eswitch.h | 3 +++ .../ethernet/mellanox/mlx5/core/eswitch_offloads.c | 12 +++++++++++- drivers/net/ethernet/mellanox/mlx5/core/sf/devlink.c | 12 ++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h index 88745dc6aed5..578466d69f21 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h @@ -223,6 +223,7 @@ struct mlx5_vport { u16 vport; bool enabled; + bool max_eqs_set; enum mlx5_eswitch_vport_event enabled_events; int index; struct mlx5_devlink_port *dl_port; @@ -579,6 +580,8 @@ int mlx5_devlink_port_fn_max_io_eqs_get(struct devlink_port *port, int mlx5_devlink_port_fn_max_io_eqs_set(struct devlink_port *port, u32 max_io_eqs, struct netlink_ext_ack *extack); +int mlx5_devlink_port_fn_max_io_eqs_set_sf_default(struct devlink_port *port, + struct netlink_ext_ack *extack); void *mlx5_eswitch_get_uplink_priv(struct mlx5_eswitch *esw, u8 rep_type); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index 099a716f1784..768199d2255a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c @@ -68,6 +68,7 @@ #define MLX5_ESW_FT_OFFLOADS_DROP_RULE (1) #define MLX5_ESW_MAX_CTRL_EQS 4 +#define MLX5_ESW_DEFAULT_SF_COMP_EQS 8 static struct esw_vport_tbl_namespace mlx5_esw_vport_tbl_mirror_ns = { .max_fte = MLX5_ESW_VPORT_TBL_SIZE, @@ -4683,9 +4684,18 @@ mlx5_devlink_port_fn_max_io_eqs_set(struct devlink_port *port, u32 max_io_eqs, MLX5_SET_HCA_CAP_OP_MOD_GENERAL_DEVICE2); if (err) NL_SET_ERR_MSG_MOD(extack, "Failed setting HCA caps"); - + vport->max_eqs_set = true; out: mutex_unlock(&esw->state_lock); kfree(query_ctx); return err; } + +int +mlx5_devlink_port_fn_max_io_eqs_set_sf_default(struct devlink_port *port, + struct netlink_ext_ack *extack) +{ + return mlx5_devlink_port_fn_max_io_eqs_set(port, + MLX5_ESW_DEFAULT_SF_COMP_EQS, + extack); +} diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sf/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/sf/devlink.c index 6c11e075cab0..a96be98be032 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/sf/devlink.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/sf/devlink.c @@ -161,6 +161,7 @@ int mlx5_devlink_sf_port_fn_state_get(struct devlink_port *dl_port, static int mlx5_sf_activate(struct mlx5_core_dev *dev, struct mlx5_sf *sf, struct netlink_ext_ack *extack) { + struct mlx5_vport *vport; int err; if (mlx5_sf_is_active(sf)) @@ -170,6 +171,13 @@ static int mlx5_sf_activate(struct mlx5_core_dev *dev, struct mlx5_sf *sf, return -EBUSY; } + vport = mlx5_devlink_port_vport_get(&sf->dl_port.dl_port); + if (!vport->max_eqs_set && MLX5_CAP_GEN_2(dev, max_num_eqs_24b)) { + err = mlx5_devlink_port_fn_max_io_eqs_set_sf_default(&sf->dl_port.dl_port, + extack); + if (err) + return err; + } err = mlx5_cmd_sf_enable_hca(dev, sf->hw_fn_id); if (err) return err; @@ -318,7 +326,11 @@ int mlx5_devlink_sf_port_new(struct devlink *devlink, static void mlx5_sf_dealloc(struct mlx5_sf_table *table, struct mlx5_sf *sf) { + struct mlx5_vport *vport; + mutex_lock(&table->sf_state_lock); + vport = mlx5_devlink_port_vport_get(&sf->dl_port.dl_port); + vport->max_eqs_set = false; mlx5_sf_function_id_erase(table, sf); From patchwork Fri Jul 12 00:33:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 13731199 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 836F8567D for ; Fri, 12 Jul 2024 00:33:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720744409; cv=none; b=ZLCOruDFxaZmP8EAdVbinTOnQfa5M4Gel95yJUgcGIcEi2YtLJLUXYQqfAO8QOTUWKJcArMm7yGRfcN3GjcPohksMqxba89qxfuVI7hLPRvPQdRNzbzQkQMtTOAbbm2S5YFrO9YYh1eEhh9gLSr3cVNwmVflf44eFpmNROZLSAY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720744409; c=relaxed/simple; bh=ggqQkyQDos9wXOvPtlefHVRNH7Qn17AIOkcpI+38AC4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CFpV27nCm6wnBeP2CQyAczDGdtUWweELyI9cUVVIscxpihYN95XjKMS7T8RycDIccTek3SZfefVxsZjxg8CwzhK/BrHlBLtQ7ftq8GlD4eT90gVvPr1P1oOLKZNPVme+SvGcBnSe/20iqqSzn4PMA/5EPBFJ4RDbSkpINvwq7WA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AWv5ayp8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AWv5ayp8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F96DC4AF0C; Fri, 12 Jul 2024 00:33:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720744409; bh=ggqQkyQDos9wXOvPtlefHVRNH7Qn17AIOkcpI+38AC4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AWv5ayp8Q1Rc9vAvF8ahHkxV9iPSwP3eD6YIDQkt6MaAquae7U7JZnwrsZm7CDTLx 2VBAMKe3CHijMi7hxGT30e0jb9EVUMHxSW7h+rSIof+aP2ZPfPzghlBSuP0cU9P41Y tnZiRmYrqAT/kGk18CVAmNsDyBOP+/Ao0o+LUsBe/1gEvgJdvW829n8Yb5e53TfY+i 4vx+KaNfJtbmgaybzslmSlVc5XWWlhDMbhEmYIPPJIiFmZcHBPe1F5SCvxiyOKKTTF CnTdkGUpfX8MtMqfGxkU35lzcPJ6glP67S1OR0dgzo7Ah2TfbHF820kQFxRZ/ygadp VCMOm1ebFS1VA== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Gal Pressman , Leon Romanovsky , Daniel Jurgens , William Tu Subject: [PATCH net-next V3 4/4] net/mlx5: Use set number of max EQs Date: Thu, 11 Jul 2024 17:33:10 -0700 Message-ID: <20240712003310.355106-5-saeed@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240712003310.355106-1-saeed@kernel.org> References: <20240712003310.355106-1-saeed@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Daniel Jurgens If a maximum number of EQs has been set for an SF, use that amount. Signed-off-by: Daniel Jurgens Reviewed-by: William Tu Signed-off-by: Tariq Toukan Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 7 +++++-- drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c | 12 ++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c index ac1565c0c8af..4326aa42bf2d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c @@ -1187,7 +1187,6 @@ static int get_num_eqs(struct mlx5_core_dev *dev) { struct mlx5_eq_table *eq_table = dev->priv.eq_table; int max_dev_eqs; - int max_eqs_sf; int num_eqs; /* If ethernet is disabled we use just a single completion vector to @@ -1202,7 +1201,11 @@ static int get_num_eqs(struct mlx5_core_dev *dev) num_eqs = min_t(int, mlx5_irq_table_get_num_comp(eq_table->irq_table), max_dev_eqs - MLX5_MAX_ASYNC_EQS); if (mlx5_core_is_sf(dev)) { - max_eqs_sf = min_t(int, MLX5_COMP_EQS_PER_SF, + int max_eqs_sf = MLX5_CAP_GEN_2(dev, sf_eq_usage) ? + MLX5_CAP_GEN_2(dev, max_num_eqs_24b) : + MLX5_COMP_EQS_PER_SF; + + max_eqs_sf = min_t(int, max_eqs_sf, mlx5_irq_table_get_sfs_vec(eq_table->irq_table)); num_eqs = min_t(int, num_eqs, max_eqs_sf); } diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c b/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c index 401d39069680..86208b86eea8 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c @@ -16,6 +16,7 @@ #endif #define MLX5_SFS_PER_CTRL_IRQ 64 +#define MLX5_MAX_MSIX_PER_SF 256 #define MLX5_IRQ_CTRL_SF_MAX 8 /* min num of vectors for SFs to be enabled */ #define MLX5_IRQ_VEC_COMP_BASE_SF 2 @@ -589,8 +590,6 @@ static void irq_pool_free(struct mlx5_irq_pool *pool) static int irq_pools_init(struct mlx5_core_dev *dev, int sf_vec, int pcif_vec) { struct mlx5_irq_table *table = dev->priv.irq_table; - int num_sf_ctrl_by_msix; - int num_sf_ctrl_by_sfs; int num_sf_ctrl; int err; @@ -608,10 +607,8 @@ static int irq_pools_init(struct mlx5_core_dev *dev, int sf_vec, int pcif_vec) } /* init sf_ctrl_pool */ - num_sf_ctrl_by_msix = DIV_ROUND_UP(sf_vec, MLX5_COMP_EQS_PER_SF); - num_sf_ctrl_by_sfs = DIV_ROUND_UP(mlx5_sf_max_functions(dev), - MLX5_SFS_PER_CTRL_IRQ); - num_sf_ctrl = min_t(int, num_sf_ctrl_by_msix, num_sf_ctrl_by_sfs); + num_sf_ctrl = DIV_ROUND_UP(mlx5_sf_max_functions(dev), + MLX5_SFS_PER_CTRL_IRQ); num_sf_ctrl = min_t(int, MLX5_IRQ_CTRL_SF_MAX, num_sf_ctrl); table->sf_ctrl_pool = irq_pool_alloc(dev, pcif_vec, num_sf_ctrl, "mlx5_sf_ctrl", @@ -726,8 +723,7 @@ int mlx5_irq_table_create(struct mlx5_core_dev *dev) total_vec = pcif_vec; if (mlx5_sf_max_functions(dev)) - total_vec += MLX5_IRQ_CTRL_SF_MAX + - MLX5_COMP_EQS_PER_SF * mlx5_sf_max_functions(dev); + total_vec += MLX5_MAX_MSIX_PER_SF * mlx5_sf_max_functions(dev); total_vec = min_t(int, total_vec, pci_msix_vec_count(dev->pdev)); pcif_vec = min_t(int, pcif_vec, pci_msix_vec_count(dev->pdev));