From nobody Tue Dec 03 00:51:31 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y2MXz2wlSz5fGpN; Tue, 03 Dec 2024 00:51:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y2MXz1bLlz4Tm2; Tue, 3 Dec 2024 00:51:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733187091; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Fo482mTaC94HkYW0AMLXXQPmzXrwp2hdXy9YxHLJuoM=; b=HEZ1OaznJTkVA7YrtoPNyFvNpsysjDxtVrYMig2GMWaXzRjUK22I8Geiut+wzXwKxpSCVr HLXrVX/jEVvLODY+bu6K6Ww2b6suy6KLMcsBD0+rLiNY2kFiUdVX8yv3kKtiyyaXLip2Vt ae+bQ+8luIFR5A1qchPHTTrHQMfzwEavOMIf6WUQzCScRjWGkE3ZyDs4G6RCEuZjrzDFVx 6YI2/XZcvxjHcvVf0ZVOFkZOt22J5o2Z8Ch17WLjc5FBN1Kyif6wkxZUFQzghYVj2TwSr7 iqtyDZfjE7AdiwEZhTChJTw4AeuiZ6TQBhzfe1lxCZtVz50z5KEWIw37i2oo9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733187091; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Fo482mTaC94HkYW0AMLXXQPmzXrwp2hdXy9YxHLJuoM=; b=RvTXe/srPeOXzEY9V9+51td3ruEjK4R1W75Z47A4fWzNjs18UICMxWEsrPLFCJWn/Cda7h Hrq+So3SJ1B1e/RHZzD3Z5eKV16X1PD34MlG8t/FxCFrxeSSeBA45A51Orll8hHCj3g5/W uGfiV+dmhxucMtNl1YsOssrQLp2YC3A5xdKoJ1u5dgeUiwF8mXAtuMVh39wPbCCG/uIFqS oK0EBzdvnyzENUcuyeFTOdx43zqWeiY0/YHomI9yApfT4hTMvhkvHT9fcFshh4U8LDGFhx VdUqjM5fveaDpoN6Y0wYWo0jd6i4YZEJgXpOT2m8UJuJ+4og9Qqje6fY8z9zJA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733187091; a=rsa-sha256; cv=none; b=rw9+lMEmGyPrwBouGCyx3cjp8FuR/XasWKPlRU9mGxgYJJDcy5MtMDeINQvqPtI5PQMeEY 7OSXk3NXzmBjyuQEU+/X3xlosEIrfKPXelPGo8hmdGrUFqMs1d9CPZncQ6961hOOnRNeHD fcsEwtOSjaKRpK7ZDESeWhVEva4EXqzCTmVAeU3cwmLruaegxQJBHzHASW1p+vOIBCLEGH iSeVb/CUyAxr20dgAlKm7Lw3ols4jI/CkO/DPGJbE0f83tUR3qAgVTTzImm+YK44C58o9j iO7iArusu/QraEMrC7xCKpPaIeKi+Z4NV9j0OMqfMmVnIZiMYUoZH865kI8E3Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Y2MXz0b2Xz11MF; Tue, 3 Dec 2024 00:51:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B30pVOd017235; Tue, 3 Dec 2024 00:51:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B30pV9u017217; Tue, 3 Dec 2024 00:51:31 GMT (envelope-from git) Date: Tue, 3 Dec 2024 00:51:31 GMT Message-Id: <202412030051.4B30pV9u017217@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 2657d38625cf - stable/14 - mlx5en: move runtime capabilities checks into helper functions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 2657d38625cff8c16dfbb7e8ca80d895f988d840 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2657d38625cff8c16dfbb7e8ca80d895f988d840 commit 2657d38625cff8c16dfbb7e8ca80d895f988d840 Author: Konstantin Belousov AuthorDate: 2024-11-21 05:51:18 +0000 Commit: Konstantin Belousov CommitDate: 2024-12-03 00:39:23 +0000 mlx5en: move runtime capabilities checks into helper functions (cherry picked from commit cca0dc49e0ca66f7696920266ea6340b05e3e455) --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 56 +++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index 4399af43b93b..58d305dd43f3 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -3399,6 +3399,41 @@ mlx5e_set_rx_mode(if_t ifp) queue_work(priv->wq, &priv->set_rx_mode_work); } +static bool +mlx5e_is_ratelimit_capable(struct mlx5_core_dev *mdev) +{ +#ifdef RATELIMIT + if (MLX5_CAP_GEN(mdev, qos) && + MLX5_CAP_QOS(mdev, packet_pacing)) + return (true); +#endif + return (false); +} + +static bool +mlx5e_is_tlstx_capable(struct mlx5_core_dev *mdev) +{ +#ifdef KERN_TLS + if (MLX5_CAP_GEN(mdev, tls_tx) != 0 && + MLX5_CAP_GEN(mdev, log_max_dek) != 0) + return (true); +#endif + return (false); +} + +static bool +mlx5e_is_tlsrx_capable(struct mlx5_core_dev *mdev) +{ +#ifdef KERN_TLS + if (MLX5_CAP_GEN(mdev, tls_rx) != 0 && + MLX5_CAP_GEN(mdev, log_max_dek) != 0 && + MLX5_CAP_FLOWTABLE_NIC_RX(mdev, + ft_field_support.outer_ip_version) != 0) + return (true); +#endif + return (false); +} + static int mlx5e_ioctl(if_t ifp, u_long command, caddr_t data) { @@ -4518,23 +4553,16 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) if_setcapabilitiesbit(ifp, IFCAP_TSO | IFCAP_VLAN_HWTSO, 0); if_setcapabilitiesbit(ifp, IFCAP_HWSTATS | IFCAP_HWRXTSTMP, 0); if_setcapabilitiesbit(ifp, IFCAP_MEXTPG, 0); -#ifdef KERN_TLS - if (MLX5_CAP_GEN(mdev, tls_tx) != 0 && - MLX5_CAP_GEN(mdev, log_max_dek) != 0) + if (mlx5e_is_tlstx_capable(mdev)) if_setcapabilitiesbit(ifp, IFCAP_TXTLS4 | IFCAP_TXTLS6, 0); - if (MLX5_CAP_GEN(mdev, tls_rx) != 0 && - MLX5_CAP_GEN(mdev, log_max_dek) != 0 && - MLX5_CAP_FLOWTABLE_NIC_RX(mdev, - ft_field_support.outer_ip_version) != 0) + if (mlx5e_is_tlsrx_capable(mdev)) if_setcapabilities2bit(ifp, IFCAP2_BIT(IFCAP2_RXTLS4) | IFCAP2_BIT(IFCAP2_RXTLS6), 0); -#endif -#ifdef RATELIMIT - if (MLX5_CAP_GEN(mdev, qos) && - MLX5_CAP_QOS(mdev, packet_pacing)) - if_setcapabilitiesbit(ifp, IFCAP_TXRTLMT | IFCAP_TXTLS_RTLMT, - 0); -#endif + if (mlx5e_is_ratelimit_capable(mdev)) { + if_setcapabilitiesbit(ifp, IFCAP_TXRTLMT, 0); + if (mlx5e_is_tlstx_capable(mdev)) + if_setcapabilitiesbit(ifp, IFCAP_TXTLS_RTLMT, 0); + } if_setcapabilitiesbit(ifp, IFCAP_VXLAN_HWCSUM | IFCAP_VXLAN_HWTSO, 0); if_setsndtagallocfn(ifp, mlx5e_snd_tag_alloc);