From nobody Tue Apr 18 13:02:05 2023 X-Original-To: dev-commits-src-main@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 4Q13wZ5vFkz454gM; Tue, 18 Apr 2023 13:02:06 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Q13wY732Yz4Kng; Tue, 18 Apr 2023 13:02:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681822926; 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=aGUhrghGGXdhgO+ByR7Sg+X9uRCbwz3Iky7SkLEukxc=; b=ffiZS4Rr55ilfpXcaYssqg6ivOaC0tqb1JrQgLCpPzXEkJlR5Hg6a2JbYDtjcfLcZR81+L icajYP7Ilr6rn5KFrt0IU93JETgxzMet7vRsxUeSYSCfPhX5WwQsmJTyNm60RHc1zEoVTr ByllpXBjOi1K7LSkxgPnowjmr6wk6gfpLzL1PgtT0j1TjtY+7qU2SAzXTr7WLgXoydgi/E dbgIZw7mrZ2/sHKSHEJXYN/Uux/NCAldP3ylWg1V2gnmL4DKDNQWcMwQrrpf4d0ZfdEKUL Al7y8BWaZgHHY0jGQjfj8dI+UfAgsaO9G+/8pWE9didzCLwQ28enNiqoKC/05Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681822926; 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=aGUhrghGGXdhgO+ByR7Sg+X9uRCbwz3Iky7SkLEukxc=; b=YL13xDqag521qscLWNwrsEgrZ2lu9NZjoYgHBE5TFLyAdyUGSHKBMZ1mQKDYkn2wM5SLyz pYht8ZW7MdWpIjTmz3hGSUBVQLvc9BttdTDzU4NVs/DuHRj4qMZuVZRF3wi1lsZNZuF8IP pp4Zw39Q3F7W1UziiBM1TU50C/ieMGGbpdkIQL4vPqSABBK37nC8X6vpM8qjLi/xlvLLR+ FsmUhJDuFskh6KWX8pYIs7JdhXkbJBRz05rBftH6WUsDk/gl3UVhMInq0DehqFYZNpwrLF mkszSc6xsaH9VGccII+ZYqVEbgAO0DPHGxWldKlRBp8tTkeI4y5BL9DpMYp/nQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1681822926; a=rsa-sha256; cv=none; b=h8RP4KecoQ/JNdf0g5PCqmB4YRydGBJY/Ru75lYOKbto4ZsPksyBrVIRpJ2yWCtCHBTg+H Hqxj2RvToJXH+2POr1JMi2I5vkm02IIuZ2T0znU4+UST1QrTk6H/Yl/geqACa1hrwyoy2E gcM6NC5ylMkqh7aedO3XAGlffC5LIhE00JxIRvNN1Oc1w16Lut3uh4atjBldJymNq1SrGC y8NflNH/MrgNOSgdc1JzykzpAjP/dHdwo6AzazfMHUJKsLcRpyRODlIo23D5hnOKIitbJC rLikLfmyD03L5I60lkIcSMZgPa+S+63Rm2gUgJ53qLKGl/0hHylYhxVhYDDn9Q== 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 4Q13wY5gv1z1Bm6; Tue, 18 Apr 2023 13:02:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 33ID25I8079047; Tue, 18 Apr 2023 13:02:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33ID25Wv079046; Tue, 18 Apr 2023 13:02:05 GMT (envelope-from git) Date: Tue, 18 Apr 2023 13:02:05 GMT Message-Id: <202304181302.33ID25Wv079046@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 273bfac08ff8 - main - mlx5: Implement mlx5_core_modify_cq_by_mask(). List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 273bfac08ff838786c8b48bc7d3d7180b5f6a3be Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=273bfac08ff838786c8b48bc7d3d7180b5f6a3be commit 273bfac08ff838786c8b48bc7d3d7180b5f6a3be Author: Hans Petter Selasky AuthorDate: 2023-04-18 11:21:28 +0000 Commit: Hans Petter Selasky CommitDate: 2023-04-18 13:01:06 +0000 mlx5: Implement mlx5_core_modify_cq_by_mask(). Implement one CQ modify function supporting all firmware versions, instead of having more variants of CQ modify. MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/dev/mlx5/cq.h | 5 +++++ sys/dev/mlx5/mlx5_core/mlx5_cq.c | 44 +++++++++++++++++++++++----------------- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/sys/dev/mlx5/cq.h b/sys/dev/mlx5/cq.h index d5e167498fd2..ffa98c38bee9 100644 --- a/sys/dev/mlx5/cq.h +++ b/sys/dev/mlx5/cq.h @@ -86,6 +86,7 @@ enum { MLX5_CQ_MODIFY_PERIOD = 1 << 0, MLX5_CQ_MODIFY_COUNT = 1 << 1, MLX5_CQ_MODIFY_OVERRUN = 1 << 2, + MLX5_CQ_MODIFY_EQN = 1 << 3, MLX5_CQ_MODIFY_PERIOD_MODE = 1 << 4, }; @@ -169,6 +170,10 @@ int mlx5_core_modify_cq_moderation_mode(struct mlx5_core_dev *dev, u16 cq_period, u16 cq_max_count, u8 cq_mode); +int mlx5_core_modify_cq_by_mask(struct mlx5_core_dev *, + struct mlx5_core_cq *, u32 mask, + u16 cq_period, u16 cq_max_count, + u8 cq_mode, u8 cq_eqn); int mlx5_debug_cq_add(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq); void mlx5_debug_cq_remove(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq); diff --git a/sys/dev/mlx5/mlx5_core/mlx5_cq.c b/sys/dev/mlx5/mlx5_core/mlx5_cq.c index 8f873bde6073..e849663528b2 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_cq.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_cq.c @@ -219,18 +219,9 @@ int mlx5_core_modify_cq_moderation(struct mlx5_core_dev *dev, u16 cq_period, u16 cq_max_count) { - u32 in[MLX5_ST_SZ_DW(modify_cq_in)] = {0}; - void *cqc; - - MLX5_SET(modify_cq_in, in, cqn, cq->cqn); - cqc = MLX5_ADDR_OF(modify_cq_in, in, cq_context); - MLX5_SET(cqc, cqc, cq_period, cq_period); - MLX5_SET(cqc, cqc, cq_max_count, cq_max_count); - MLX5_SET(modify_cq_in, in, - modify_field_select_resize_field_select.modify_field_select.modify_field_select, - MLX5_CQ_MODIFY_PERIOD | MLX5_CQ_MODIFY_COUNT); - - return mlx5_core_modify_cq(dev, cq, in, sizeof(in)); + return (mlx5_core_modify_cq_by_mask(dev, cq, + MLX5_CQ_MODIFY_PERIOD | MLX5_CQ_MODIFY_COUNT, + cq_period, cq_max_count, 0, 0)); } int mlx5_core_modify_cq_moderation_mode(struct mlx5_core_dev *dev, @@ -239,19 +230,34 @@ int mlx5_core_modify_cq_moderation_mode(struct mlx5_core_dev *dev, u16 cq_max_count, u8 cq_mode) { - u32 in[MLX5_ST_SZ_DW(modify_cq_in)] = {0}; + return (mlx5_core_modify_cq_by_mask(dev, cq, + MLX5_CQ_MODIFY_PERIOD | MLX5_CQ_MODIFY_COUNT | MLX5_CQ_MODIFY_PERIOD_MODE, + cq_period, cq_max_count, cq_mode, 0)); +} + +int +mlx5_core_modify_cq_by_mask(struct mlx5_core_dev *dev, + struct mlx5_core_cq *cq, u32 mask, + u16 cq_period, u16 cq_max_count, u8 cq_mode, u8 cq_eqn) +{ + u32 in[MLX5_ST_SZ_DW(modify_cq_in)] = {}; void *cqc; MLX5_SET(modify_cq_in, in, cqn, cq->cqn); cqc = MLX5_ADDR_OF(modify_cq_in, in, cq_context); - MLX5_SET(cqc, cqc, cq_period, cq_period); - MLX5_SET(cqc, cqc, cq_max_count, cq_max_count); - MLX5_SET(cqc, cqc, cq_period_mode, cq_mode); + if (mask & MLX5_CQ_MODIFY_PERIOD) + MLX5_SET(cqc, cqc, cq_period, cq_period); + if (mask & MLX5_CQ_MODIFY_COUNT) + MLX5_SET(cqc, cqc, cq_max_count, cq_max_count); + if (mask & MLX5_CQ_MODIFY_PERIOD_MODE) + MLX5_SET(cqc, cqc, cq_period_mode, cq_mode); + if (mask & MLX5_CQ_MODIFY_EQN) + MLX5_SET(cqc, cqc, c_eqn, cq_eqn); + MLX5_SET(modify_cq_in, in, - modify_field_select_resize_field_select.modify_field_select.modify_field_select, - MLX5_CQ_MODIFY_PERIOD | MLX5_CQ_MODIFY_COUNT | MLX5_CQ_MODIFY_PERIOD_MODE); + modify_field_select_resize_field_select.modify_field_select.modify_field_select, mask); - return mlx5_core_modify_cq(dev, cq, in, sizeof(in)); + return (mlx5_core_modify_cq(dev, cq, in, sizeof(in))); } int mlx5_init_cq_table(struct mlx5_core_dev *dev)