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 8C4A045BC0; Tue, 29 Oct 2024 17:46:14 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 043D342F5F; Tue, 29 Oct 2024 17:43:45 +0100 (CET) Received: from egress-ip42b.ess.de.barracuda.com (egress-ip42b.ess.de.barracuda.com [18.185.115.246]) by mails.dpdk.org (Postfix) with ESMTP id C0D4242EF1 for ; Tue, 29 Oct 2024 17:43:19 +0100 (CET) Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02lp2048.outbound.protection.outlook.com [104.47.11.48]) by mx-outbound17-86.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 29 Oct 2024 16:43:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dPg6suLWdQS47E9gGL8icM05F4KeP0xvnGK/0jLGDwzcdO17WT7CKkc/GLIZU6ZoTJaPQHKjA7FwC3nmF/KDJCfHMpfy9EG/rqvdNalJNNUoydcTslgEHXXk9fGgeehRKRguJszjqGW1YLo08QJAX7ZkGF/VD8Y5q8HriYBJIXMKy4TTrVOF5gmlLPCyNTxUza7gUEC7XNXeMcL/rWXQszVODw0kLyTFq/vburIEsmWxYSRiGTRotgaFHJihvS7UzxV+p/1HVrqj/vJU0IBx10Gb2G7dlRwxFBFoNvtKuHZHVz6BcEqHpqPMcYej8M628lJ35J5d0E/G99o8ge1JHg== 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=EFEih29THi4eKokwkiVkQfZljDUf1jpwVOI94jwHP4k=; b=v6f0RPt9ZkyoSiakoMXhBzu4vkePh0DYCIRRUXpLvYSdoQE8KhAsloMWaFZc79iNfCkIHKAaOuFx1LzqQ8DWG0i0ZnlB6qY7Jz8wtoNUXxNzQx9iIGAC3e3cCHA0eJNCM/tcyDaLoYLwEUt3rXuaavHTmiLzlFKxvPKzjUZcIQO+3nF1wKsfK6aaI1iuzhzummv4cD8as6a5Bf1Nge116zZkiOyaC/yWFR3/NOgtQ9rCowxCVPZf8Lv3ZKyG6LU29YwhcQqZ/Lq/wdFGtYrXyWBlpUxcn0wumQthq1Ehk4PnhvRZR5qZUQbtEjm56s4VSMUGnPLaqvnTXxK4D2YMAg== 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=EFEih29THi4eKokwkiVkQfZljDUf1jpwVOI94jwHP4k=; b=VZxw1Jyv6PhITFZkpQ0Isx9CRUKqPLavwrqGS/MAqICSn/LR9APLlOobCx9OgVjXVFUzyXa+FI3xDF2Bo7+cCBXP8xS51X9DlZvHh959Kpm841iNGrc3VXywVjQ6D8OaziUtHh77ej0yl4G/qKsFo3xS5ghwMJtFV2jM1eN5DU4= Received: from DUZPR01CA0208.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b6::6) by AM8P190MB0916.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:1da::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.24; Tue, 29 Oct 2024 16:43:13 +0000 Received: from DU2PEPF00028D06.eurprd03.prod.outlook.com (2603:10a6:10:4b6:cafe::e2) by DUZPR01CA0208.outlook.office365.com (2603:10a6:10:4b6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.17 via Frontend Transport; Tue, 29 Oct 2024 16:43:13 +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 DU2PEPF00028D06.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server id 15.20.8114.16 via Frontend Transport; Tue, 29 Oct 2024 16:43:13 +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 v4 24/86] net/ntnic: add action modify filed Date: Tue, 29 Oct 2024 17:41:28 +0100 Message-ID: <20241029164243.1648775-25-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241029164243.1648775-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241029164243.1648775-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028D06:EE_|AM8P190MB0916:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 82467c7f-4da7-4084-5bc3-08dcf838c7ca X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ED0N7KMbNjeeQzFlqvTTsTGcbG4HE7KxNXDX7GFMncNNevqhiQDi4cgOG5HY?= =?us-ascii?Q?dHLiNvYUaFY/ogCCP4K5xho9XNnGlSIqHyt3snHRwOICB+qQVENiy9DxnWnl?= =?us-ascii?Q?CpcXw8/0NMfcn6vEUsMLT7NmLWhaHIG8lI7qeGKF7zWf//BXYh9p5vb/PkuH?= =?us-ascii?Q?SuMXii6W5y8uFWDRjCcamIy4+pljufYKSBNKIiwX77bEVUGhPGh6NF1ttUyB?= =?us-ascii?Q?s7yyAisaI7il6njUqbFLK8bxnhZ3hPNsO8BntnvS1RMt1lfYOnFt749Vmuue?= =?us-ascii?Q?cxll4ngjPoKa00KXbY8keW6i/iX7mcIQyvjUpsl/tHlzjbbuel4Q55FTUpbO?= =?us-ascii?Q?a+Vwo5C4yVYtu3IOdjLle/ZeFwqmx2DYXEQgkHDsrvQW22mzzrpjIoCX/MlW?= =?us-ascii?Q?Ht6wTUu26fUfylGaTAFlIgqwsKeYWZdu4Qu65A4lZIlbvK6mu5lrim5nsWgI?= =?us-ascii?Q?IHWOz2wS+EUieCju8JNXg200LIM8/9auGZIVXquA0ylYtPTWTchyH9vGEFX2?= =?us-ascii?Q?nuVKf25tgnDq7K3ZTD7CUWpx6aabv3awWZqTKMR8mdSubo2dDZY7/jEfggix?= =?us-ascii?Q?m+v6VwREJmxdDccp3MGH32nmrRN4TBfRZ5sedhsD1fpAj7du5pq7Xz4sh8hx?= =?us-ascii?Q?AOmaJXemdQ0zmB03oL+ju8ukYsjhymYXqXQk+EtXgKP+SXY7XDvGWomCZ7JO?= =?us-ascii?Q?+D1YNhM2xwpuCsdwczhvAfoyxo8qooa4GKW/8xkoVSthTtPNy9rmG/b1u2KO?= =?us-ascii?Q?2CgnPnm/TqGFlECKx+AB/ETtaO1R6VtPWQllFZ3tw/J21TwP90lMNO52ecoo?= =?us-ascii?Q?3+8psfsEsrmZSqXzuxaWARCLKEvst0375NXiI2+GF78ZZn8rCx7Od/MPvf+6?= =?us-ascii?Q?qSmlIHkL/4SHtt8qRZv+ZaTu38pa9W0DEgJUzDvo3Yk8K57wndrshBLa9Hve?= =?us-ascii?Q?mnM8wJypNSZ7EAWl/lZkQjjPWI0UKYEnJl6nfEMCDYr8uPqdMkn/X6wPe553?= =?us-ascii?Q?dCYWjvxCns4qoeqixcx2u9x4RfV+V25eXRxZRrWom/7C6MEckHRMDUxzLKvo?= =?us-ascii?Q?5uDR8XSLI7or4jN+KGqwMEdeujDKtsei86VuxzqOSd80rbiZf1CpWMzXhLqV?= =?us-ascii?Q?dRUtQ6AaVr+NBu+PsxSctiMq1lXJeytMEWiIpIjtZCCrf+rk7dCI1zB28jzo?= =?us-ascii?Q?bk5kLeVpZ8XQ4JMkS8mAYnr9HB2xhfXCpMInWGicWiFGGSn+ZYooMe1WiI11?= =?us-ascii?Q?yor2zBU+f0MFD0F1hMVYZh94HAjcdagz0boGjbEscNnEJngBIWx5Jp5BVaCN?= =?us-ascii?Q?7goIP9qCJ4o2QVcmCFlJ4M2vh5Eh/4A9ZVNAQZHXQ+j9TuRuYaOJ2bfRS9U/?= =?us-ascii?Q?CGCezjXTjZ2fEf2iJVSv9ZNtVXI/iKt6WNnWosrSerQvwSdhow=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)(1800799024)(82310400026)(36860700013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 9zsI6mbAU48KIv6H4Z29MtwP/FVNskauvlr+gwvdKRb72FXi3MvmaULOTE8kA3y9jG6UCEfS2oojethfH/sJ0YNHs28PMmMDe4ZWWj14AdtHQus5FiDsyUapQhAzpOWeOnviykPZEA8h8ieioJzOJBHCP5oxTf86svzdzkQ5TX3dUjq33+3/cGHR/yDaKtUzOGTuD2hVX8iQxPbo5K06Z6kF5g0JdBjeqeEao02O5EFwH3niTecrxlk3MNV6w4N4f958+Ccbv4P2XqWSlb713MSHMPZQYaTZ+GQkdcv5gpslzi5+6OyRb2UENNBv5KScviAk69NpNmMpOXhu8maVVOUPENfWqszqTAXqcuCjG2xkRieex05/l9CzWBH36J/kw2l/eL5C58lEicn4J4HM53eWfAiAcIpLI5UbUYxWO1/N6wdIamNhpQ95iaJ9GQEcK4PCML4mDD+7gaLbxLrG+3zage7ffed5ourjgfuN0KazxwAq24AWUULfoNd17q0jHjxNOmVEej1Lc8FY10cwyDVFi2honudEh2cWlPpbWo5uedYxa10xAOOR5F4zdDy/r5MpG7NPCjY+hUnVY3+W6T85SXbPcpZT+61+T/eaCMptNWDqKCsaOWh0YHcTGbCHEaI7wg9y1YiM68Kb3agO4Xk0j1W84m4ZuJlHwaDxh2I= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 16:43:13.0583 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 82467c7f-4da7-4084-5bc3-08dcf838c7ca 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: DU2PEPF00028D06.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8P190MB0916 X-BESS-ID: 1730220197-304438-12706-30027-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.11.48 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVhaWpkZAVgZQ0NDIzNLczNw01T LZ3MLQMtnUMsUyydjEMjXV3NLY0sRCqTYWANERcLJBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260063 [from cloudscan10-180.eu-central-1a.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 12cbfa97a8..1c6404b542 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