From nobody Wed Nov 22 01:51:53 2023 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 4SZkkd3srpz51WK9; Wed, 22 Nov 2023 01:51:53 +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 4SZkkd206qz3HCx; Wed, 22 Nov 2023 01:51:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700617913; 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=pBf6UAnQ6nnY9njT+ReoBrN+tnd0Zx6PX4VG8dDIKfg=; b=M2BZibz/3+PjsxO24QsxXWY6uUP25z98It5n0kJbiHgJ2IgxW1xVrWB9ugAvCz3t+ZltS0 cg/L8IpCtsCGZAjZGLnwbWRymuhpUCvznfMttmPfXvZJM74itLTTEfsUvXojFGnJF/JtWV Ob2ymp3A2vEgr/xZAJyXIfs6gJtN5Ae40tZjNzARuRH2C4IN693hmbsJHUpL0JQaSmDXQL 5hZYSX2Jb38tce7ThQOpf/dMPJV6McVDw7Py+jMhWyREUIMN16wE+RuKdDHLysefMlxWhS qXKtoTOYwb8QK99Tg4/jCXQ4sddsaawDcq2HaO0FwlI8IViRYw8NC0yFb562UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700617913; 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=pBf6UAnQ6nnY9njT+ReoBrN+tnd0Zx6PX4VG8dDIKfg=; b=APhySFJ8wutrCS9CkuObyy1lOTD/QCgAx7p0uh8KE8Z+g+mIZOP+gtbz80qorrq7zyxY09 H48TaC+QmiTGcYNIxmfcbsptkaz605uKF76vfXcgn1Frg9fZmEiZIAvuJXFEBWkeLbYasO Rw8GD+JavaYy+zE8UzQXH7W3q7EJ8iVJKahzc9PgynSwR7MIYm1VVc5ZLHhqx0MG8wYhPG Up9yojw09PkIEUqbmtdld9tjG9Lkwk609AG6WsvzDOiopkDludsPb+onLT/G9wGxnDyfzG u+V5ZR6LwESiaKO8JRzfJUZjGcZtCNQusyDYsce+lZspDowTDpD41G2urKeSvA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700617913; a=rsa-sha256; cv=none; b=OeFFbDmj5DIc+y3Agne2CTvHHfMIMS+gTz00twptRvC2iwn28b/bg74f0DQPqrNcU/F1m1 fJ5Kl+2+XCkVeW1Va/xHQ8O8mGudwqJ6HJBNBAgjMg8YGU8TVxQqFZDcG+UxxsXW6WAkDj 9xP5Rs40a0IGQ677NSFu7JZ+XGKZg4BM6ev60nD4YCogC4Sprz8catcA+nv96sRzp1ZtqE Uo3dktt4uYrzQN5PLV+9eyKZYxtZYQ0nrLowRgo0mIWjO/jVAeI0+ijDNeOOI3zA7fXzv1 aXjkqDa0tMrkm0SH6ge1t19y4ZhTVgwwtFhnEF4O2DDjNvi1LofaKxsGbBN+vw== 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 4SZkkd166Tz102x; Wed, 22 Nov 2023 01:51:53 +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 3AM1prgH076746; Wed, 22 Nov 2023 01:51:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3AM1pr1L076718; Wed, 22 Nov 2023 01:51:53 GMT (envelope-from git) Date: Wed, 22 Nov 2023 01:51:53 GMT Message-Id: <202311220151.3AM1pr1L076718@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: 8895a0509698 - stable/14 - mlx5: Add modify header support to flow rules 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: 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: 8895a0509698f29bb234a186590e3f08970a34d9 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8895a0509698f29bb234a186590e3f08970a34d9 commit 8895a0509698f29bb234a186590e3f08970a34d9 Author: Mark Bloch AuthorDate: 2023-02-19 11:15:00 +0000 Commit: Konstantin Belousov CommitDate: 2023-11-22 01:40:27 +0000 mlx5: Add modify header support to flow rules (cherry picked from commit 847542c60c2b3d922d636cc36ce51714032f9825) --- sys/dev/mlx5/fs.h | 2 ++ sys/dev/mlx5/mlx5_core/mlx5_fs_cmd.c | 9 ++++++++- sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c | 4 ++++ sys/dev/mlx5/mlx5_ifc.h | 1 + 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sys/dev/mlx5/fs.h b/sys/dev/mlx5/fs.h index 7ed7a5380cf1..bb087718d12f 100644 --- a/sys/dev/mlx5/fs.h +++ b/sys/dev/mlx5/fs.h @@ -84,11 +84,13 @@ struct mlx5_flow_destination { enum mlx5_flow_act_actions { MLX5_FLOW_ACT_ACTIONS_FLOW_TAG = 1 << 0, + MLX5_FLOW_ACT_ACTIONS_MODIFY_HDR = 1 << 1, }; struct mlx5_flow_act { u32 actions; /* See enum mlx5_flow_act_actions */ u32 flow_tag; + struct mlx5_modify_hdr *modify_hdr; }; #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 5ac0c95c7bca..22bc945a4b62 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_fs_cmd.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_fs_cmd.c @@ -179,10 +179,12 @@ int mlx5_cmd_fs_set_fte(struct mlx5_core_dev *dev, int opmod = 0; int modify_mask = 0; int atomic_mod_cap; + u32 prm_action = 0; if (action != MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) dest_size = 0; + prm_action = action; inlen = MLX5_ST_SZ_BYTES(set_fte_in) + dest_size * MLX5_ST_SZ_BYTES(dest_format_struct); @@ -221,7 +223,11 @@ int mlx5_cmd_fs_set_fte(struct mlx5_core_dev *dev, MLX5_SET(flow_context, in_flow_context, group_id, group_id); if (flow_act->actions & MLX5_FLOW_ACT_ACTIONS_FLOW_TAG) MLX5_SET(flow_context, in_flow_context, flow_tag, flow_act->flow_tag); - MLX5_SET(flow_context, in_flow_context, action, action); + if (flow_act->actions & MLX5_FLOW_ACT_ACTIONS_MODIFY_HDR) { + MLX5_SET(flow_context, in_flow_context, modify_header_id, + flow_act->modify_hdr->id); + prm_action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR; + } MLX5_SET(flow_context, in_flow_context, destination_list_size, dest_size); in_match_value = MLX5_ADDR_OF(flow_context, in_flow_context, @@ -244,6 +250,7 @@ int mlx5_cmd_fs_set_fte(struct mlx5_core_dev *dev, } } + MLX5_SET(flow_context, in_flow_context, action, prm_action); err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); if (!err) *fte_status |= FS_FTE_STATUS_EXISTING; diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c b/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c index 8e203a9662bb..7c3eb1e86d6d 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_fs_tree.c @@ -1760,6 +1760,10 @@ static bool check_conflicting_actions(const struct mlx5_flow_act *act1, act1->flow_tag != act2->flow_tag) return true; + /* Can even have complex actions in merged rules */ + if (action1 & MLX5_FLOW_ACT_ACTIONS_MODIFY_HDR) + return true; + return false; } diff --git a/sys/dev/mlx5/mlx5_ifc.h b/sys/dev/mlx5/mlx5_ifc.h index 340e3b2e2d03..9534ac3d1c94 100644 --- a/sys/dev/mlx5/mlx5_ifc.h +++ b/sys/dev/mlx5/mlx5_ifc.h @@ -2264,6 +2264,7 @@ enum { MLX5_FLOW_CONTEXT_ACTION_DROP = 0x2, MLX5_FLOW_CONTEXT_ACTION_FWD_DEST = 0x4, MLX5_FLOW_CONTEXT_ACTION_COUNT = 0x8, + MLX5_FLOW_CONTEXT_ACTION_MOD_HDR = 0x40, }; struct mlx5_ifc_flow_context_bits {