From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0D53F45BA3; Tue, 22 Oct 2024 18:58:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 08E5140E3F; Tue, 22 Oct 2024 18:56:43 +0200 (CEST) Received: from egress-ip42a.ess.de.barracuda.com (egress-ip42a.ess.de.barracuda.com [18.185.115.201]) by mails.dpdk.org (Postfix) with ESMTP id CDE7840DDE for ; Tue, 22 Oct 2024 18:56:29 +0200 (CEST) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03lp2174.outbound.protection.outlook.com [104.47.51.174]) by mx-outbound40-26.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 22 Oct 2024 16:56:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BOu8oRBNG8nxs7J0dNUTyeLWMpr56770Nnk2QappaGbRLNTBRGwx13Y0t9TXOLM5ouvrc6zxpAy2nAYoWzvzdH9PN9AYEB9/5on1OqOiF5wpJP9lQNAHVZRr58U1492uQVr7UmxejxqtUspVoy7HdZ6i7zIZKWw5wdonk5yhCFEhN89TLYT3FnQAtV4wEez20HFhAeEfa11JmickYdr5bURYxB5jPQA4r0poC2qPTjltKkJ/ahnXNGa/XlrJKgW47u3bIY5hLtljzMunKKTezzHltoblYko3DkitjGxew95ggR+86GufSymFI8V8e/+tkVezU+geHoHf2ZPoIHV9ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=sLO2gDSnp/Ll57+LLmC7ndir4hjqJiq7VRyp4utiHgc=; b=kOaokqUTRo8+PgaJE/4mrZ7+8DB1Q4QHTMg74PO+c/IkVrY3GzHs4bvahwggDcLyWOcy+thji1mR7Nv7tYnXN78eFWto8zpKgPHWX0dWcJGlZ1V3a/pk6lSsHhHWBVhbflg45CGYN1fYliGUJUYtKuXuxZhF8cz50H+ygZZaF/BS6o0FSHoQ1CwVjbLBtSUne3VFZkDm8PQaHFSs/y4f4S2S8Hne2rV+3YghNldP98cwegRfJa4zWMx6mccxV049xFPoFNRvGwsfJM1H/p+du80BU2zNFub2gWYtIl9I9T+GBccxli6I9s5fcGACSV3z+DsZu5sjWkqeHDCq2XEtIg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 178.72.21.4) smtp.rcpttodomain=dpdk.org smtp.mailfrom=napatech.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=napatech.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=napatech.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sLO2gDSnp/Ll57+LLmC7ndir4hjqJiq7VRyp4utiHgc=; b=MqN08RXjSRWeXKAuzXcU+M7wSgSre2Z5aG6wHZMvQXWGlX0eWNcODUAQqmRU+LkpkSgI1261naLSfYLEGx2tY9dZqLG1vockLWY7cLd1BUNKYiod0dm6ceWxOcnDcSNTG8GlU+gx1tsPZX+MRIj7sUCIWgyhDaVE2QX21zOyp3Q= Received: from DB9PR06CA0016.eurprd06.prod.outlook.com (2603:10a6:10:1db::21) by DB8P190MB0699.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:fd::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29; Tue, 22 Oct 2024 16:56:27 +0000 Received: from DU2PEPF0001E9C2.eurprd03.prod.outlook.com (2603:10a6:10:1db:cafe::df) by DB9PR06CA0016.outlook.office365.com (2603:10a6:10:1db::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29 via Frontend Transport; Tue, 22 Oct 2024 16:56:27 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 178.72.21.4) smtp.mailfrom=napatech.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=napatech.com; Received-SPF: Fail (protection.outlook.com: domain of napatech.com does not designate 178.72.21.4 as permitted sender) receiver=protection.outlook.com; client-ip=178.72.21.4; helo=localhost.localdomain; Received: from localhost.localdomain (178.72.21.4) by DU2PEPF0001E9C2.mail.protection.outlook.com (10.167.8.71) with Microsoft SMTP Server id 15.20.8093.14 via Frontend Transport; Tue, 22 Oct 2024 16:56:26 +0000 From: Serhii Iliushyk To: dev@dpdk.org Cc: mko-plv@napatech.com, sil-plv@napatech.com, ckm@napatech.com, andrew.rybchenko@oktetlabs.ru, ferruh.yigit@amd.com, stephen@networkplumber.org, Danylo Vodopianov Subject: [PATCH v2 24/73] net/ntnic: add action modify filed Date: Tue, 22 Oct 2024 18:54:41 +0200 Message-ID: <20241022165541.3186140-25-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241022165541.3186140-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241022165541.3186140-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF0001E9C2:EE_|DB8P190MB0699:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 5b716ca6-2f48-4ccd-63b7-08dcf2ba77f9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?OWPQkYDOrUfUDqtAGM0uD/5cWfJjU1QHTzjs4+o7fWCI0teHKiAVNIeNUA14?= =?us-ascii?Q?BqDl9RSnvVNG80X3oXs+dYbQHFtxJ78y7867iXscInq6C0AGOw3D6CmlyK0z?= =?us-ascii?Q?lhhAwEwu94IP8KkrEenod/E4liNjauSMEK92BRb7eUXGW7calC67FpWXwmsW?= =?us-ascii?Q?hxKbSt2lfVnVK3hKnspx6rVBRakq32gyeoFVaPIjkPwV/MuTvlVTecfa7+lj?= =?us-ascii?Q?oLtw0tRNAPNNGg4cwtVd4qaRy0df5uyDTI2XhEUa+oHLoUesf6IaINiYpPM6?= =?us-ascii?Q?xl/ySpEFFbVlK256Phx9kukQxzrg69cRuE4bx54rlPlWMwGcyTvTAtCQsGM8?= =?us-ascii?Q?iOWRup5lwGyj6DcRJyJLIa/D36+5a6xOQtfCZqKHxVUFhbPYS0laTEk2EFdv?= =?us-ascii?Q?ud6IsuyhVA++OzHcTB/WjuoXLklUuVWmahZ1qEo3evalbOjJ7G/8V+2nJGKJ?= =?us-ascii?Q?Xhz0f4bUWFrfr7hlH3tUBhXEjNTMwxPWdkCYLrBAvdDBgwzSed8JYa5cC3H/?= =?us-ascii?Q?3zKSKgCjpNQRoCGhEXNJrby91+1DCW/zqr6STunUUVA8D9N1O3AV+G3PZDhK?= =?us-ascii?Q?2CPt2JX4pkHJvSND+1RtLtO8ho5YYsmewUfw12vWYGIfFqi/Sr6Yp2sd0WXU?= =?us-ascii?Q?73T+72u0vFc4t6uKrzi/0iQkLAMX6zuJ7NLw9L0AALgw6RhfoAbgjAZivaEW?= =?us-ascii?Q?4Kyedd+yMZJX8Tyn2Rh6ZW83uLR2/0dK/uhFbfB/GAA/uWTdvrUViuMj4MUM?= =?us-ascii?Q?h3LrXdi8cCkh7HFQZNKyq3lPr4x6tEFxo/fGxNQHyUGK3CWRDQ+6jtyYnirY?= =?us-ascii?Q?E2JYUhb1bPQSC4gfBDzt2zbaBwaBZCfH9p4w+rJV+RoTwn8x8O2xwDW4cm8V?= =?us-ascii?Q?IbUifJbZigJYdxLGlyFoIuAExWrI0YXGgXfPO42Uu8I7OlqVTYqMOWbCh/+0?= =?us-ascii?Q?nmZOp3PuENUfq8xOQVstffJGcXRoDPx5pmLxPh4cIsAJh1btuP03cIZRKnUM?= =?us-ascii?Q?93AqHgQaHNYgi8rSiYsNh4rTjS0hLkbudbGRSeshBNGA9tvsk/IAAx5Nl/9x?= =?us-ascii?Q?aOOpOK/G5lYKjxN8FS9fD6IxExCUWs0pKt/Phi6ZFj104NbRYceq/rCwI/m1?= =?us-ascii?Q?hgPlaPgq0mwowK0tYAYphMaxfb0gGqbBZiYMn+mk/u/o4cB5Js0z4Jyx2dhd?= =?us-ascii?Q?2NHVSlEwMsNDasKUpROypwVRvSmiw51fB70ny2gsRTZkEGVQCbCgdzL53Hxs?= =?us-ascii?Q?wtET3i4STFdVLELfhHbjCxhxWrVd5T0cp1c1jN0lxJtAmg+HJeaLjLVANZWH?= =?us-ascii?Q?3nnGFIuSXYFiegHScwomSSVbULapOk5zUOhvJY7xxxSdlMyLLbw9iVhg5YIm?= =?us-ascii?Q?dPfeSS8dVAx0Sk0lXP/ZLoMfzTQ+OdLnLS1wyzMmNBmMeFHkng=3D=3D?= X-Forefront-Antispam-Report: CIP:178.72.21.4; CTRY:DK; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:localhost.localdomain; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(376014)(82310400026)(36860700013)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Jm48AXOk9m5j6PNQekcdAiI7cdcFMssdbnv0Gyq5sBuxv63ZgIqPfYGmXtxlyko6CL7PlfyVDIFpyktW4zieAEIOKdXYfAeiKylk/bdxe/sGz/gyY+h9SAZ8ZitzEkmfxfTOZmR4iIKy87qCNqcuGxI9nKQn3zilp/iI8eVM2JM9ZcrH4s673u2D3m6Z94foi380lEBZ/23Kd2b7IOaPLZWo//F2PAS0IHho6MZNYszTHY+bO4c1gguGuyvJ1MzRpME0+3ULTFol3IElIiQtxEEekn7ATwPEkbf8PxhlFceZlp3NCinxafHRgC0wZyVJ5AVjPAcbiFSVG/b+LLnE0LsY5aYYTQCoDe9UsUYPyRJVZi6aeZLnSqyOnA/hEpKWYCTjE1yNcFoTB04auwHR3+DiykHiVNkTh+O8X6Z2nnQrHzH0srmGzDnABuNGkfOt88soyb9fo9cmHklUuWmAIKSSzSYgR153xYpnHa7tRCC2T5PcCdOKTxKTPBRxT9Y2Va3eb2gfmeCjFY29il4Ds5V6m4FhYsSikuFpO7WzeG7YEBrS1yLN+DUHMvgiBZ17yL8zP+2wys//1fkUwmkVIPEDQIGkilAAmDr3OBG+LcHGgKAEWKKy9JDEVbPaI0OVFJEdlQqRQGxn7Quyga4zEJVzKEbC5Sv/TGF5YiBnE7U= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 16:56:26.7314 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5b716ca6-2f48-4ccd-63b7-08dcf2ba77f9 X-MS-Exchange-CrossTenant-Id: c4540d0b-728a-4233-9da5-9ea30c7ec3ed X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=c4540d0b-728a-4233-9da5-9ea30c7ec3ed; Ip=[178.72.21.4]; Helo=[localhost.localdomain] X-MS-Exchange-CrossTenant-AuthSource: DU2PEPF0001E9C2.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8P190MB0699 X-BESS-ID: 1729616188-310266-12660-12972-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.51.174 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVhaWpkZAVgZQMMkg2dzC0sTQzD gxzcDY3NjcyNLQJDXJ0jzVxCzFJNVEqTYWAJPhRidBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259902 [from cloudscan23-178.eu-central-1b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 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 From: Danylo Vodopianov Add possibility to use RTE_FLOW_ACTION_TYPE_MODIFY_FIELD Signed-off-by: Danylo Vodopianov --- doc/guides/nics/features/ntnic.ini | 1 + drivers/net/ntnic/include/flow_api_engine.h | 7 + drivers/net/ntnic/include/hw_mod_backend.h | 1 + .../profile_inline/flow_api_profile_inline.c | 181 ++++++++++++++++++ 4 files changed, 190 insertions(+) diff --git a/doc/guides/nics/features/ntnic.ini b/doc/guides/nics/features/ntnic.ini index 320d3c7e0b..4201c8e8b9 100644 --- a/doc/guides/nics/features/ntnic.ini +++ b/doc/guides/nics/features/ntnic.ini @@ -30,5 +30,6 @@ vlan = Y drop = Y jump = Y mark = Y +modify_field = Y port_id = Y queue = Y diff --git a/drivers/net/ntnic/include/flow_api_engine.h b/drivers/net/ntnic/include/flow_api_engine.h index 13fad2760a..f6557d0d20 100644 --- a/drivers/net/ntnic/include/flow_api_engine.h +++ b/drivers/net/ntnic/include/flow_api_engine.h @@ -129,6 +129,10 @@ struct nic_flow_def { */ struct { uint32_t select; + uint32_t dyn; + uint32_t ofs; + uint32_t len; + uint32_t level; union { uint8_t value8[16]; uint16_t value16[8]; @@ -137,6 +141,9 @@ struct nic_flow_def { } modify_field[MAX_CPY_WRITERS_SUPPORTED]; uint32_t modify_field_count; + uint8_t ttl_sub_enable; + uint8_t ttl_sub_ipv4; + uint8_t ttl_sub_outer; /* * Key Matcher flow definitions diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h index 4f381bc0ef..6a8a38636f 100644 --- a/drivers/net/ntnic/include/hw_mod_backend.h +++ b/drivers/net/ntnic/include/hw_mod_backend.h @@ -140,6 +140,7 @@ enum frame_offs_e { DYN_L4_PAYLOAD = 8, DYN_TUN_L3 = 13, DYN_TUN_L4 = 16, + DYN_TUN_L4_PAYLOAD = 17, }; /* Sideband info bit indicator */ diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c index 0b0b9f2033..2cda2e8b14 100644 --- a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c @@ -323,6 +323,8 @@ static int interpret_flow_actions(const struct flow_eth_dev *dev, { unsigned int encap_decap_order = 0; + uint64_t modify_field_use_flags = 0x0; + *num_dest_port = 0; *num_queues = 0; @@ -461,6 +463,185 @@ static int interpret_flow_actions(const struct flow_eth_dev *dev, break; + case RTE_FLOW_ACTION_TYPE_MODIFY_FIELD: + NT_LOG(DBG, FILTER, "Dev:%p: RTE_FLOW_ACTION_TYPE_MODIFY_FIELD", dev); + { + /* Note: This copy method will not work for FLOW_FIELD_POINTER */ + struct rte_flow_action_modify_field modify_field_tmp; + const struct rte_flow_action_modify_field *modify_field = + memcpy_mask_if(&modify_field_tmp, action[aidx].conf, + action_mask ? action_mask[aidx].conf : NULL, + sizeof(struct rte_flow_action_modify_field)); + + uint64_t modify_field_use_flag = 0; + + if (modify_field->src.field != RTE_FLOW_FIELD_VALUE) { + NT_LOG(ERR, FILTER, + "MODIFY_FIELD only src type VALUE is supported."); + flow_nic_set_error(ERR_ACTION_UNSUPPORTED, error); + return -1; + } + + if (modify_field->dst.level > 2) { + NT_LOG(ERR, FILTER, + "MODIFY_FIELD only dst level 0, 1, and 2 is supported."); + flow_nic_set_error(ERR_ACTION_UNSUPPORTED, error); + return -1; + } + + if (modify_field->dst.field == RTE_FLOW_FIELD_IPV4_TTL || + modify_field->dst.field == RTE_FLOW_FIELD_IPV6_HOPLIMIT) { + if (modify_field->operation != RTE_FLOW_MODIFY_SUB) { + NT_LOG(ERR, FILTER, + "MODIFY_FIELD only operation SUB is supported for TTL/HOPLIMIT."); + flow_nic_set_error(ERR_ACTION_UNSUPPORTED, error); + return -1; + } + + if (fd->ttl_sub_enable) { + NT_LOG(ERR, FILTER, + "MODIFY_FIELD TTL/HOPLIMIT resource already in use."); + flow_nic_set_error(ERR_ACTION_UNSUPPORTED, error); + return -1; + } + + fd->ttl_sub_enable = 1; + fd->ttl_sub_ipv4 = + (modify_field->dst.field == RTE_FLOW_FIELD_IPV4_TTL) + ? 1 + : 0; + fd->ttl_sub_outer = (modify_field->dst.level <= 1) ? 1 : 0; + + } else { + if (modify_field->operation != RTE_FLOW_MODIFY_SET) { + NT_LOG(ERR, FILTER, + "MODIFY_FIELD only operation SET is supported in general."); + flow_nic_set_error(ERR_ACTION_UNSUPPORTED, error); + return -1; + } + + if (fd->modify_field_count >= + dev->ndev->be.tpe.nb_cpy_writers) { + NT_LOG(ERR, FILTER, + "MODIFY_FIELD exceeded maximum of %u MODIFY_FIELD actions.", + dev->ndev->be.tpe.nb_cpy_writers); + flow_nic_set_error(ERR_ACTION_UNSUPPORTED, error); + return -1; + } + + int mod_outer = modify_field->dst.level <= 1; + + switch (modify_field->dst.field) { + case RTE_FLOW_FIELD_IPV4_DSCP: + fd->modify_field[fd->modify_field_count].select = + CPY_SELECT_DSCP_IPV4; + fd->modify_field[fd->modify_field_count].dyn = + mod_outer ? DYN_L3 : DYN_TUN_L3; + fd->modify_field[fd->modify_field_count].ofs = 1; + fd->modify_field[fd->modify_field_count].len = 1; + break; + + case RTE_FLOW_FIELD_IPV6_DSCP: + fd->modify_field[fd->modify_field_count].select = + CPY_SELECT_DSCP_IPV6; + fd->modify_field[fd->modify_field_count].dyn = + mod_outer ? DYN_L3 : DYN_TUN_L3; + fd->modify_field[fd->modify_field_count].ofs = 0; + /* + * len=2 is needed because + * IPv6 DSCP overlaps 2 bytes. + */ + fd->modify_field[fd->modify_field_count].len = 2; + break; + + case RTE_FLOW_FIELD_GTP_PSC_QFI: + fd->modify_field[fd->modify_field_count].select = + CPY_SELECT_RQI_QFI; + fd->modify_field[fd->modify_field_count].dyn = + mod_outer ? DYN_L4_PAYLOAD + : DYN_TUN_L4_PAYLOAD; + fd->modify_field[fd->modify_field_count].ofs = 14; + fd->modify_field[fd->modify_field_count].len = 1; + break; + + case RTE_FLOW_FIELD_IPV4_SRC: + fd->modify_field[fd->modify_field_count].select = + CPY_SELECT_IPV4; + fd->modify_field[fd->modify_field_count].dyn = + mod_outer ? DYN_L3 : DYN_TUN_L3; + fd->modify_field[fd->modify_field_count].ofs = 12; + fd->modify_field[fd->modify_field_count].len = 4; + break; + + case RTE_FLOW_FIELD_IPV4_DST: + fd->modify_field[fd->modify_field_count].select = + CPY_SELECT_IPV4; + fd->modify_field[fd->modify_field_count].dyn = + mod_outer ? DYN_L3 : DYN_TUN_L3; + fd->modify_field[fd->modify_field_count].ofs = 16; + fd->modify_field[fd->modify_field_count].len = 4; + break; + + case RTE_FLOW_FIELD_TCP_PORT_SRC: + case RTE_FLOW_FIELD_UDP_PORT_SRC: + fd->modify_field[fd->modify_field_count].select = + CPY_SELECT_PORT; + fd->modify_field[fd->modify_field_count].dyn = + mod_outer ? DYN_L4 : DYN_TUN_L4; + fd->modify_field[fd->modify_field_count].ofs = 0; + fd->modify_field[fd->modify_field_count].len = 2; + break; + + case RTE_FLOW_FIELD_TCP_PORT_DST: + case RTE_FLOW_FIELD_UDP_PORT_DST: + fd->modify_field[fd->modify_field_count].select = + CPY_SELECT_PORT; + fd->modify_field[fd->modify_field_count].dyn = + mod_outer ? DYN_L4 : DYN_TUN_L4; + fd->modify_field[fd->modify_field_count].ofs = 2; + fd->modify_field[fd->modify_field_count].len = 2; + break; + + case RTE_FLOW_FIELD_GTP_TEID: + fd->modify_field[fd->modify_field_count].select = + CPY_SELECT_TEID; + fd->modify_field[fd->modify_field_count].dyn = + mod_outer ? DYN_L4_PAYLOAD + : DYN_TUN_L4_PAYLOAD; + fd->modify_field[fd->modify_field_count].ofs = 4; + fd->modify_field[fd->modify_field_count].len = 4; + break; + + default: + NT_LOG(ERR, FILTER, + "MODIFY_FIELD dst type is not supported."); + flow_nic_set_error(ERR_ACTION_UNSUPPORTED, error); + return -1; + } + + modify_field_use_flag = 1 + << fd->modify_field[fd->modify_field_count].select; + + if (modify_field_use_flag & modify_field_use_flags) { + NT_LOG(ERR, FILTER, + "MODIFY_FIELD dst type hardware resource already used."); + flow_nic_set_error(ERR_ACTION_UNSUPPORTED, error); + return -1; + } + + memcpy(fd->modify_field[fd->modify_field_count].value8, + modify_field->src.value, 16); + + fd->modify_field[fd->modify_field_count].level = + modify_field->dst.level; + + modify_field_use_flags |= modify_field_use_flag; + fd->modify_field_count += 1; + } + } + + break; + default: NT_LOG(ERR, FILTER, "Invalid or unsupported flow action received - %i", action[aidx].type); -- 2.45.0