From patchwork Mon Oct 16 18:42:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Etelson X-Patchwork-Id: 132649 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CA85B43181; Mon, 16 Oct 2023 20:44:41 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 47B2440E8A; Mon, 16 Oct 2023 20:43:49 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2081.outbound.protection.outlook.com [40.107.93.81]) by mails.dpdk.org (Postfix) with ESMTP id CD18740DCD for ; Mon, 16 Oct 2023 20:43:47 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n3b21iq66CCkoTGyZbh0NL5r23k1GFoBZTjV+/3e4dN6aITV/0mzm8OBb2DkAJql8UyBr4cQguXCW417LJgqr2rXbXXw89T+2uFZw9qtR8vsLrkUwrengB2YOE7MMNMMl83CsXbb6Dwz7H/cfOglApOHU7/5qxRbBqCu+u3/kFQy4mru1Au/uSVTIjkAcQmYYLoEoMmAkoJmDLXTCVDc5A4cpbYW57fpkTozsbFQbm8sK06FYqwP1cdPQSH8O74t1mk/bZ76CpjVnJAa3MnllYjd6HA4x5ZIk8VI2Nx7XU/uIPgmy7doNCojWM3Cv2axpUAHQtAH+2PgHIaGpYInrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2lBZEUDjp4gNlo/DsKt4Kq1EnNVZZpzeM7SLWJoskAU=; b=VykwDeAEJ87FEnBXnmmvI81o+cokFuPwUcSRn+4ojaL8rTvzQOC2kK2YFtD/3JofbIFq3P9ig+XPf15SsK+0Qe4Qb0+G/ZV+5xckRF95G11TpUvdEf6hHqa/ZKBefrFeUn3cqqYdUf1DTXcYMwwQapSUjb4K2Owuik/8D7QbhH30lvry16Cgx4TC5feZGPqZGMmJoDpNPAeXPOWeUiLfUk0ZuWI4wY4D4A2DG46J2HeIuiH+HOW0tg3NeBkRcDtdbQcdUoJqh9fgD/owJbcxK8fd429AI3bEJggMSpckVGc9CZQyRftGq+eKEOds1XjjYuO4d1RKLroMLCYqAAKjqg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2lBZEUDjp4gNlo/DsKt4Kq1EnNVZZpzeM7SLWJoskAU=; b=ETDw95sNJHh9RRgmeMNThr+LHPZoHXwooei9Lkr91NXDFMdtjWgbZHkKcIx8x8eUSCfP8bjqBPPMD/oN+yQ8lY2ASHDiLAkxaA3GedxJcET5JeAP19D0KM3zdkpYMjkyByxRnWoyh4Hxi5HBK3nhsxrALia07mHgaTUsIc0OJsfHrMKz9sDjbQwnFvFzdzd4+BZTuYYvlNnYPgoqGGrBXuUCnxEwR0kk1iQqrHLnciYw05OjqucP9iz5/7BhWlo7Oe5f/sZ8mFkHNPCFqZNJvAz7dwMH+gzhYaICFE7MPDbsXzccNAabpHDIaS49uPvex7077YUVlMQJ4KJDtc4q/Q== Received: from MW2PR16CA0029.namprd16.prod.outlook.com (2603:10b6:907::42) by DS0PR12MB7702.namprd12.prod.outlook.com (2603:10b6:8:130::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35; Mon, 16 Oct 2023 18:43:45 +0000 Received: from MWH0EPF000989E6.namprd02.prod.outlook.com (2603:10b6:907:0:cafe::ec) by MW2PR16CA0029.outlook.office365.com (2603:10b6:907::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36 via Frontend Transport; Mon, 16 Oct 2023 18:43:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by MWH0EPF000989E6.mail.protection.outlook.com (10.167.241.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 18:43:45 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 11:43:31 -0700 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 11:43:28 -0700 From: Gregory Etelson To: CC: , =?utf-8?b?wqA=?= , =?utf-8?q?=C2=A0_=2E_=2E_/patches/upstream-pmd-indirect-actions-list/v2/v2-?= =?utf-8?q?0000-cover-letter_=2E_patch?= , Matan Azrad , Viacheslav Ovsiienko , Ori Kam , Suanming Mou , Bing Zhao Subject: [PATCH v2 13/16] net/mlx5: fix RTE action location tracking in a template Date: Mon, 16 Oct 2023 21:42:32 +0300 Message-ID: <20231016184235.200427-13-getelson@nvidia.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231016184235.200427-1-getelson@nvidia.com> References: <20230927191046.405282-1-getelson@nvidia.com> <20231016184235.200427-1-getelson@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989E6:EE_|DS0PR12MB7702:EE_ X-MS-Office365-Filtering-Correlation-Id: e93542dd-b070-4192-6375-08dbce77d40e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OP+aq/7nbDy6ukFjBh/Ko0owmUKszQ+VTK1CPGN/b3qP3Q0ekJzP2CrhANG8/iEcS2P0VgfZ1k2PlIvbKSKE+UZ16g2IXPbsy6vY/7CHC8ichL9pd5QE7dOykakEaW55IvK+ys3vZ7+JZ6c882YvlXvV4L0lPKr4tAkMNo1/+PuJN/cbGsObvLsYIMKmqlCywzt64HRiaclL7/6cv4J/9548lDL8vFwsPoGRDNvrrCBPuWT9Gs9YISrwmITnwwbkq5wuZjiBqJEyfvn1JJD7gI60PkEpAgSCSiO8mw4TiSe+5uylekzQVCUWyGvrEXdX9v6h1S1otLHk2gSEkYh6T9j24/GWvovjmNQAepv1GvVgtQPNzjaPsSUx2ZGjp8M2s48lL1jmvHQeVE0ymt34xD07ST4lq3INQPSlFcd6Mf+pqf7caEn37MsKEyNiU48XWfe7mfY8rqVnCJOJcgd5+VOgeHHV2BKH0PQ5vxcywl0x2lUKDNTEuv9iyzRO29y8INiAGooN+nvnEt3gIE61IZVJEURJ/HTuVgS0a3bd7gNTCClC5OfYYWx+MvdAi3evSjRyGU/LxSEck5PRnQNVH5dz3RjsZg+PBto0jMqh4n6q/fapBf7C/Uy6Od2eeJzUAJiQwOckeY9zfCxa4tEmFymrCLdifLL3xiUjTOY/6On17dmgh3ce0E/cX6JwIryWXZUghM6xWvZVMZcRMC54BsY7Zk879Vy5gFFM31XjDKVwt6yVsuqYprHuQM3kdWE4 X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230031)(4636009)(39860400002)(396003)(346002)(136003)(376002)(230922051799003)(64100799003)(1800799009)(82310400011)(451199024)(186009)(46966006)(40470700004)(36840700001)(478600001)(70586007)(70206006)(6916009)(54906003)(6666004)(26005)(16526019)(107886003)(426003)(41300700001)(6286002)(7696005)(1076003)(2616005)(336012)(316002)(30864003)(8676002)(8936002)(4326008)(2906002)(5660300002)(36756003)(7636003)(86362001)(47076005)(356005)(83380400001)(36860700001)(82740400003)(40460700003)(55016003)(40480700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 18:43:45.5792 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e93542dd-b070-4192-6375-08dbce77d40e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989E6.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7702 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org PMD can implicitly add flow actions to application actions template. If PMD added actions to a template is must track location of the original application actions in modified template. The patch adds tracking ability for the orignal acton in a template. Fixes: ddb68e4 ("net/mlx5: add extended metadata mode for HWS") Signed-off-by: Gregory Etelson --- drivers/net/mlx5/mlx5_flow.h | 2 +- drivers/net/mlx5/mlx5_flow_hw.c | 90 ++++++++++++++++----------------- 2 files changed, 45 insertions(+), 47 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index a31120cd78..19b26ad333 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -1332,10 +1332,10 @@ struct rte_flow_actions_template { uint16_t dr_actions_num; /* Amount of DR rules actions. */ uint16_t actions_num; /* Amount of flow actions */ uint16_t *dr_off; /* DR action offset for given rte action offset. */ + uint16_t *src_off; /* RTE action displacement from app. template */ uint16_t reformat_off; /* Offset of DR reformat action. */ uint16_t mhdr_off; /* Offset of DR modify header action. */ uint32_t refcnt; /* Reference counter. */ - uint16_t rx_cpy_pos; /* Action position of Rx metadata to be copied. */ uint8_t flex_item; /* flex item index. */ }; diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 53641ae2d5..213b0d5ae8 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -1015,11 +1015,11 @@ flow_hw_modify_field_init(struct mlx5_hw_modify_header_action *mhdr, static __rte_always_inline int flow_hw_modify_field_compile(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, - const struct rte_flow_action *action_start, /* Start of AT actions. */ const struct rte_flow_action *action, /* Current action from AT. */ const struct rte_flow_action *action_mask, /* Current mask from AT. */ struct mlx5_hw_actions *acts, struct mlx5_hw_modify_header_action *mhdr, + uint16_t src_pos, struct rte_flow_error *error) { struct mlx5_priv *priv = dev->data->dev_private; @@ -1122,7 +1122,7 @@ flow_hw_modify_field_compile(struct rte_eth_dev *dev, if (shared) return 0; ret = __flow_hw_act_data_hdr_modify_append(priv, acts, RTE_FLOW_ACTION_TYPE_MODIFY_FIELD, - action - action_start, mhdr->pos, + src_pos, mhdr->pos, cmds_start, cmds_end, shared, field, dcopy, mask); if (ret) @@ -1181,11 +1181,10 @@ flow_hw_validate_compiled_modify_field(struct rte_eth_dev *dev, static int flow_hw_represented_port_compile(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, - const struct rte_flow_action *action_start, const struct rte_flow_action *action, const struct rte_flow_action *action_mask, struct mlx5_hw_actions *acts, - uint16_t action_dst, + uint16_t action_src, uint16_t action_dst, struct rte_flow_error *error) { struct mlx5_priv *priv = dev->data->dev_private; @@ -1241,7 +1240,7 @@ flow_hw_represented_port_compile(struct rte_eth_dev *dev, } else { ret = __flow_hw_act_data_general_append (priv, acts, action->type, - action - action_start, action_dst); + action_src, action_dst); if (ret) return rte_flow_error_set (error, ENOMEM, @@ -1493,7 +1492,6 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, const struct rte_flow_template_table_attr *table_attr = &cfg->attr; const struct rte_flow_attr *attr = &table_attr->flow_attr; struct rte_flow_action *actions = at->actions; - struct rte_flow_action *action_start = actions; struct rte_flow_action *masks = at->masks; enum mlx5dr_action_type refmt_type = MLX5DR_ACTION_TYP_LAST; const struct rte_flow_action_raw_encap *raw_encap_data; @@ -1506,7 +1504,6 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, uint32_t type; bool reformat_used = false; unsigned int of_vlan_offset; - uint16_t dr_pos; uint16_t jump_pos; uint32_t ct_idx; int ret, err; @@ -1521,7 +1518,10 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, else type = MLX5DR_TABLE_TYPE_NIC_RX; for (; !actions_end; actions++, masks++) { - dr_pos = at->dr_off[actions - at->actions]; + uint64_t pos = actions - at->actions; + uint16_t src_pos = pos - at->src_off[pos]; + uint16_t dr_pos = at->dr_off[pos]; + switch ((int)actions->type) { case RTE_FLOW_ACTION_TYPE_INDIRECT_LIST: if (!attr->group) { @@ -1529,9 +1529,7 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, goto err; } ret = table_template_translate_indirect_list - (dev, actions, masks, acts, - actions - action_start, - dr_pos); + (dev, actions, masks, acts, src_pos, dr_pos); if (ret) goto err; break; @@ -1542,11 +1540,11 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, } if (actions->conf && masks->conf) { if (flow_hw_shared_action_translate - (dev, actions, acts, actions - action_start, dr_pos)) + (dev, actions, acts, src_pos, dr_pos)) goto err; } else if (__flow_hw_act_data_general_append (priv, acts, RTE_FLOW_ACTION_TYPE_INDIRECT, - actions - action_start, dr_pos)){ + src_pos, dr_pos)){ goto err; } break; @@ -1566,7 +1564,8 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, (((const struct rte_flow_action_mark *) (actions->conf))->id); else if (__flow_hw_act_data_general_append(priv, acts, - actions->type, actions - action_start, dr_pos)) + actions->type, + src_pos, dr_pos)) goto err; acts->rule_acts[dr_pos].action = priv->hw_tag[!!attr->group]; @@ -1581,7 +1580,7 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, vlan_hdr_to_be32(actions); else if (__flow_hw_act_data_general_append (priv, acts, actions->type, - actions - action_start, dr_pos)) + src_pos, dr_pos)) goto err; of_vlan_offset = is_of_vlan_pcp_present(actions) ? MLX5_HW_VLAN_PUSH_PCP_IDX : @@ -1609,7 +1608,7 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, acts->jump->root_action; } else if (__flow_hw_act_data_general_append (priv, acts, actions->type, - actions - action_start, dr_pos)){ + src_pos, dr_pos)){ goto err; } break; @@ -1627,7 +1626,7 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, acts->tir->action; } else if (__flow_hw_act_data_general_append (priv, acts, actions->type, - actions - action_start, dr_pos)) { + src_pos, dr_pos)) { goto err; } break; @@ -1643,7 +1642,7 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, acts->tir->action; } else if (__flow_hw_act_data_general_append (priv, acts, actions->type, - actions - action_start, dr_pos)) { + src_pos, dr_pos)) { goto err; } break; @@ -1655,7 +1654,7 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, enc_item_m = ((const struct rte_flow_action_vxlan_encap *) masks->conf)->definition; reformat_used = true; - reformat_src = actions - action_start; + reformat_src = src_pos; refmt_type = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2; break; case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP: @@ -1666,7 +1665,7 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, enc_item_m = ((const struct rte_flow_action_nvgre_encap *) masks->conf)->definition; reformat_used = true; - reformat_src = actions - action_start; + reformat_src = src_pos; refmt_type = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2; break; case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP: @@ -1696,7 +1695,7 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, refmt_type = MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L2; } - reformat_src = actions - action_start; + reformat_src = src_pos; break; case RTE_FLOW_ACTION_TYPE_RAW_DECAP: reformat_used = true; @@ -1718,26 +1717,16 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, acts->rule_acts[dr_pos].action = priv->hw_send_to_kernel[table_type]; break; case RTE_FLOW_ACTION_TYPE_MODIFY_FIELD: - err = flow_hw_modify_field_compile(dev, attr, action_start, - actions, masks, acts, &mhdr, - error); + err = flow_hw_modify_field_compile(dev, attr, actions, + masks, acts, &mhdr, + src_pos, error); if (err) goto err; - /* - * Adjust the action source position for the following. - * ... / MODIFY_FIELD: rx_cpy_pos / (QUEUE|RSS) / ... - * The next action will be Q/RSS, there will not be - * another adjustment and the real source position of - * the following actions will be decreased by 1. - * No change of the total actions in the new template. - */ - if ((actions - action_start) == at->rx_cpy_pos) - action_start += 1; break; case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT: if (flow_hw_represented_port_compile - (dev, attr, action_start, actions, - masks, acts, dr_pos, error)) + (dev, attr, actions, + masks, acts, src_pos, dr_pos, error)) goto err; break; case RTE_FLOW_ACTION_TYPE_METER: @@ -1756,7 +1745,7 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, goto err; } else if (__flow_hw_act_data_general_append(priv, acts, actions->type, - actions - action_start, + src_pos, dr_pos)) goto err; break; @@ -1772,7 +1761,7 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, } if (__flow_hw_act_data_general_append(priv, acts, actions->type, - actions - action_start, + src_pos, dr_pos)) goto err; break; @@ -1802,7 +1791,7 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, goto err; } else if (__flow_hw_act_data_general_append (priv, acts, actions->type, - actions - action_start, dr_pos)) { + src_pos, dr_pos)) { goto err; } break; @@ -1815,7 +1804,7 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, goto err; } else if (__flow_hw_act_data_general_append (priv, acts, actions->type, - actions - action_start, dr_pos)) { + src_pos, dr_pos)) { goto err; } break; @@ -1832,7 +1821,7 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, goto err; } else if (__flow_hw_act_data_general_append(priv, acts, actions->type, - actions - action_start, + src_pos, dr_pos)) goto err; break; @@ -1916,7 +1905,7 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev, if (shared_rfmt) acts->rule_acts[at->reformat_off].reformat.offset = 0; else if (__flow_hw_act_data_encap_append(priv, acts, - (action_start + reformat_src)->type, + (at->actions + reformat_src)->type, reformat_src, at->reformat_off, data_size)) goto err; acts->encap_decap->shared = shared_rfmt; @@ -4273,8 +4262,11 @@ flow_hw_validate_action_raw_encap(struct rte_eth_dev *dev __rte_unused, * The PMD handles the sequence as a single encap or decap reformat action, * depending on the raw_encap configuration. * - * The function assumes that the sequence location in actions template list - * complies with relative HWS actions order for the required reformat. + * The function assumes that the raw_decap / raw_encap location + * in actions template list complies with relative HWS actions order: + * for the required reformat configuration: + * ENCAP configuration must appear before [JUMP|DROP|PORT] + * DECAP configuration must appear at the template head. */ static uint64_t mlx5_decap_encap_reformat_type(const struct rte_flow_action *actions, @@ -4352,7 +4344,7 @@ flow_hw_template_expand_modify_field(struct rte_flow_action actions[], i++; goto insert; } - if (flags & MLX5_FLOW_ACTION_DECAP) + if (actions[i - 1].type == RTE_FLOW_ACTION_TYPE_RAW_DECAP) i--; break; default: @@ -5131,6 +5123,7 @@ flow_hw_actions_template_create(struct rte_eth_dev *dev, struct rte_flow_action mf_actions[MLX5_HW_MAX_ACTS]; struct rte_flow_action mf_masks[MLX5_HW_MAX_ACTS]; uint32_t expand_mf_num = 0; + uint16_t src_off[MLX5_HW_MAX_ACTS] = {0, }; if (mlx5_flow_hw_actions_validate(dev, attr, actions, masks, &action_flags, error)) @@ -5209,6 +5202,8 @@ flow_hw_actions_template_create(struct rte_eth_dev *dev, act_num, expand_mf_num); act_num += expand_mf_num; + for (i = pos + expand_mf_num; i < act_num; i++) + src_off[i] += expand_mf_num; action_flags |= MLX5_FLOW_ACTION_MODIFY_FIELD; } act_len = rte_flow_conv(RTE_FLOW_CONV_OP_ACTIONS, NULL, 0, ra, error); @@ -5220,6 +5215,7 @@ flow_hw_actions_template_create(struct rte_eth_dev *dev, return NULL; len += RTE_ALIGN(mask_len, 16); len += RTE_ALIGN(act_num * sizeof(*at->dr_off), 16); + len += RTE_ALIGN(act_num * sizeof(*at->src_off), 16); at = mlx5_malloc(MLX5_MEM_ZERO, len + sizeof(*at), RTE_CACHE_LINE_SIZE, rte_socket_id()); if (!at) { @@ -5244,12 +5240,14 @@ flow_hw_actions_template_create(struct rte_eth_dev *dev, goto error; /* DR actions offsets in the third part. */ at->dr_off = (uint16_t *)((uint8_t *)at->masks + mask_len); + at->src_off = RTE_PTR_ADD(at->dr_off, + RTE_ALIGN(act_num * sizeof(*at->dr_off), 16)); + memcpy(at->src_off, src_off, act_num * sizeof(at->src_off[0])); at->actions_num = act_num; for (i = 0; i < at->actions_num; ++i) at->dr_off[i] = UINT16_MAX; at->reformat_off = UINT16_MAX; at->mhdr_off = UINT16_MAX; - at->rx_cpy_pos = pos; for (i = 0; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++, masks++, i++) { const struct rte_flow_action_modify_field *info;