From nobody Wed Nov 22 01:52:00 2023 X-Original-To: dev-commits-src-branches@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 4SZkkn0Q9Sz51W0c; Wed, 22 Nov 2023 01:52:01 +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 4SZkkm6zpYz3HqH; Wed, 22 Nov 2023 01:52:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700617921; 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=MPPW4yFGIMOk016Ju+lmfs+s4LVfpPIVTrOyvTG6ZX0=; b=PYxeRelkPTOtjpGoSHRxZllunNaFQJqjUKREIA9BXrS36QDG7XC+e2p90x7PupqvIOiXi2 0KcP+WTAKSJPzEg+3gJ5o57PUaEbnCBfVUTfZvEV6oLPX1bGa6Gik6pscL+qjQLbZRVbx4 oCqS0qd5jZgLyBx+B4PORPO9Ufkg1haa3o//sbRv/oODT/L/1tRYrCPDfSUpm5OqxDY2Up u13SVwMcvAAXUAo+kTuqevica/H7uGP88Plm5N2B8aHN+KR23mZLJPJJePppXxTmQKvzd8 6+laP2uaF+vXYK5geBRqtjE21neYGk1qXkOBJh7N0gjVwXzp2yFn3LMWS5ksjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700617921; 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=MPPW4yFGIMOk016Ju+lmfs+s4LVfpPIVTrOyvTG6ZX0=; b=OIEM7EDHEqo6H9YCgWX7Ryf+AEhUMUoTcZXLAGx3Ykd/1Osd3J/is2SXKeMBZmsHkVvY5Z +5O4D0tsCHZEMNic+lxaZo45EjqnzCsOfHWe3yO8YVCFyUwPqTpCBvudmxjEo3FIGJikSC lsv//l75ZiFiARuvf69uZ2LGjeJdew8ifExNc/2AzytpNxUf/VUgAsjw8ihfmgZ39Z5vHR XeWl1j4AyhZ5UeS5bKyqbMzO2pfV93tTeiAqkaseV5BrDYSYhxjrLF7YhBA1Ofty08dTSl JsFro78aKwE6FgvnT/Hv7TAL/AclEGpWsiDVOSc1E0HlK5hBpuT/wCUmOe0E8Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700617921; a=rsa-sha256; cv=none; b=hFTml9sw2L+6kGSp3CYqEj+fWXID+/XZ3S8VWn3PWWXxhTQRnjptBFNd1kAy4WgeetmQqO DLfPS3LD4X9BOMfhKE5hC+JZqg8oDuAvQnYUMAwuPW36T6fBkq1nXCCd2KZhW8YXEU1CRK aAMkBMJPNy+6fcqQI3GELKgr7XALtfDfmueVPqY0HMemiobvqn/SVrQfoY4k44aeO2+LMt 4RzW7d4n+n2z+2DzBXc5wn68uRcYIUK7OIDsM0Kkd7cvRv72KIvozgMVQRX46Tlfi9H61E 92iqVu+sTP/ce5UZJZLnOXl0lKjC5zsgPUexJUz/mJM2Q3L1nIo3gHnAG6hMkQ== 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 4SZkkm65qGz10Dp; Wed, 22 Nov 2023 01:52:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3AM1q0Tr079317; Wed, 22 Nov 2023 01:52:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3AM1q0Yk079303; Wed, 22 Nov 2023 01:52:00 GMT (envelope-from git) Date: Wed, 22 Nov 2023 01:52:00 GMT Message-Id: <202311220152.3AM1q0Yk079303@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: e073fccf1456 - stable/14 - mlx5: add ability to attach flow counter to steering rule List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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: e073fccf14569f61b312078d0cee9a6f6eb17a37 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e073fccf14569f61b312078d0cee9a6f6eb17a37 commit e073fccf14569f61b312078d0cee9a6f6eb17a37 Author: Mark Bloch AuthorDate: 2023-02-22 05:44:56 +0000 Commit: Konstantin Belousov CommitDate: 2023-11-22 01:40:28 +0000 mlx5: add ability to attach flow counter to steering rule (cherry picked from commit ad744541311bfddd74ea3c5d49d52a4c366b9762) --- sys/dev/mlx5/fs.h | 2 ++ sys/dev/mlx5/mlx5_core/mlx5_fs_cmd.c | 19 +++++++++++++++++-- sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c | 3 +++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/fs.h b/sys/dev/mlx5/fs.h index 65d38b9ee67a..8aaa0e201f4a 100644 --- a/sys/dev/mlx5/fs.h +++ b/sys/dev/mlx5/fs.h @@ -94,6 +94,7 @@ enum mlx5_flow_act_actions { MLX5_FLOW_ACT_ACTIONS_FLOW_TAG = 1 << 0, MLX5_FLOW_ACT_ACTIONS_MODIFY_HDR = 1 << 1, MLX5_FLOW_ACT_ACTIONS_PACKET_REFORMAT = 1 << 2, + MLX5_FLOW_ACT_ACTIONS_COUNT = 1 << 3, }; enum MLX5_FLOW_ACT_FLAGS { @@ -106,6 +107,7 @@ struct mlx5_flow_act { u32 flow_tag; struct mlx5_modify_hdr *modify_hdr; struct mlx5_pkt_reformat *pkt_reformat; + struct mlx5_fc *counter; }; #define FT_NAME_STR_SZ 20 diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fs_cmd.c b/sys/dev/mlx5/mlx5_core/mlx5_fs_cmd.c index 8032d1a632e5..0f827f0e69d3 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_fs_cmd.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_fs_cmd.c @@ -182,6 +182,7 @@ int mlx5_cmd_fs_set_fte(struct mlx5_core_dev *dev, int modify_mask = 0; int atomic_mod_cap; u32 prm_action = 0; + int count_list = 0; if (sw_action != MLX5_FLOW_RULE_FWD_ACTION_DEST) dest_size = 0; @@ -195,8 +196,13 @@ int mlx5_cmd_fs_set_fte(struct mlx5_core_dev *dev, if (sw_action & MLX5_FLOW_RULE_FWD_ACTION_DEST) prm_action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; + if (flow_act->actions & MLX5_FLOW_ACT_ACTIONS_COUNT) { + prm_action |= MLX5_FLOW_CONTEXT_ACTION_COUNT; + count_list = 1; + } + inlen = MLX5_ST_SZ_BYTES(set_fte_in) + - dest_size * MLX5_ST_SZ_BYTES(dest_format_struct); + (dest_size + count_list) * MLX5_ST_SZ_BYTES(dest_format_struct); if (!dev) return -EINVAL; @@ -248,8 +254,10 @@ int mlx5_cmd_fs_set_fte(struct mlx5_core_dev *dev, in_match_value = MLX5_ADDR_OF(flow_context, in_flow_context, match_value); memcpy(in_match_value, match_val, MLX5_ST_SZ_BYTES(fte_match_param)); + + in_dests = MLX5_ADDR_OF(flow_context, in_flow_context, destination); + if (dest_size) { - in_dests = MLX5_ADDR_OF(flow_context, in_flow_context, destination); list_for_each_entry(dst, dests, base.list) { unsigned int id; @@ -265,6 +273,13 @@ int mlx5_cmd_fs_set_fte(struct mlx5_core_dev *dev, } } + if (flow_act->actions & MLX5_FLOW_ACT_ACTIONS_COUNT) { + MLX5_SET(dest_format_struct, in_dests, destination_id, + mlx5_fc_id(flow_act->counter)); + in_dests += MLX5_ST_SZ_BYTES(dest_format_struct); + MLX5_SET(flow_context, in_flow_context, flow_counter_list_size, 1); + } + MLX5_SET(flow_context, in_flow_context, action, prm_action); err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); if (!err) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c b/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c index 91543d3878ef..5966a73c58d1 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c @@ -1788,6 +1788,9 @@ static bool check_conflicting_actions(const struct mlx5_flow_act *act1, if (action1 & MLX5_FLOW_ACT_ACTIONS_PACKET_REFORMAT) return true; + if (action1 & MLX5_FLOW_ACT_ACTIONS_COUNT) + return true; + return false; }