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 B6B8145B96; Mon, 21 Oct 2024 23:08:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E737440E20; Mon, 21 Oct 2024 23:06:10 +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 38FE340B9E for ; Mon, 21 Oct 2024 23:05:53 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2173.outbound.protection.outlook.com [104.47.17.173]) by mx-outbound46-162.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 21 Oct 2024 21:05:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Rn3h5mw32jzd8sHkFlhJ6Dve/eeGy+xXvcgIAtYs/ZaKTGdF66Gd/CyOvdT9Y+pIZCBywT/TR3LAGMAmdFkcD9+VC4p7M7b8NP6X9nIc43VopA+eEcZfgwkvlBWtsqEct4IvE3/yqjFydlcinKf724in2iJmFIpxjsRo9A4PUK8Hb9zyWTnvgmoOIJ4WJvFIcLDp4A9eTqwVmp0ezuUPoWAqDKYa1jb9G4id04L2oGu6tw3V0cnZdAJJ80a24n/0rtv4okSWgdNfTojdzWqekQ5BmF2nEmscpSOr2iB68Q1FUHLANEU0NJIEj9cVIaci+DZ4jzLClNan14xs4jmxDQ== 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=kUDWF12L/joHXWPJDAxm8Gun1g9ZaE2p5bn1M4EtCsY=; b=NKAGag9lAbFmjDSKAEHDIRb22Ijtp82LRuAOhGUxz1X/6cVFj8PhK7yKE5HsAp5cPxkY8xG91Yceexd74ROKqOTmC6IWQk5tvrWeZhECCjL5L8WvwXHhnnYlqQTvKLkD3jSKmg6tTKRSE+N2BvB0o+kMS1LQtM/TmbnsI+pxoDjPdV80cqxGQgUBT79LSS/7iKf5ndDNxRQnlnxKJVNlc7Puyiu8wG3rX7otYWkWSus+gvL4rnDJiIS4qY93AhkacPzSoGB5Q1LbTO5aeCrWaKTsebHozuDHY4DM5LeTjAtyz+hFCFRnDJEGTFcS3mIBEg49lcPkA2imCVgUT9cqXw== 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=kUDWF12L/joHXWPJDAxm8Gun1g9ZaE2p5bn1M4EtCsY=; b=gA9DTPvMYlMHMs1u0ebPa8s6KuAoYql89Z+iNosH+ye5WFJ/IzbXQ5pMmI+iCG5LCM+J62qZP/AUkAHRg0LnPt5VrMzi+Q1zJkIWUo2Nvs4fVDF0A4+Zok5muDb7c3poIx0um82/VxPxLqe8gZRGk3+JLSh27aIlnBVCYo7F3ow= Received: from AS9PR04CA0155.eurprd04.prod.outlook.com (2603:10a6:20b:48a::29) by GV1P190MB1995.EURP190.PROD.OUTLOOK.COM (2603:10a6:150:5a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.27; Mon, 21 Oct 2024 21:05:50 +0000 Received: from AMS0EPF000001A8.eurprd05.prod.outlook.com (2603:10a6:20b:48a:cafe::d3) by AS9PR04CA0155.outlook.office365.com (2603:10a6:20b:48a::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29 via Frontend Transport; Mon, 21 Oct 2024 21:05:50 +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 AMS0EPF000001A8.mail.protection.outlook.com (10.167.16.148) with Microsoft SMTP Server id 15.20.8093.14 via Frontend Transport; Mon, 21 Oct 2024 21:05:49 +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, Danylo Vodopianov Subject: [PATCH v1 24/73] net/ntnic: add action modify filed Date: Mon, 21 Oct 2024 23:04:26 +0200 Message-ID: <20241021210527.2075431-25-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241021210527.2075431-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF000001A8:EE_|GV1P190MB1995:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 192f25a2-9a6e-4f5d-3ddf-08dcf214243a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|376014|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?JbgiMujg8tATtHEEiA6HBdBArEtYL7g2UQgiHSgN6Xa9eGcMyqCCoLZEmme8?= =?us-ascii?Q?Nafxk1MaNQEyEOHAVklGq7XParMIHh+2h54u6tAJoXvKtKQRIdoAYs0LfZSY?= =?us-ascii?Q?owZvJQtSgzDkZF+mal7K3L+Kj79NMjhweJR0JNnJThHIzrgbyIUtGNx4AuIC?= =?us-ascii?Q?mK6eoqnPJN56zMhovAWhqa6xy+0YHXWGzDnfgHDNFUZpo7DkeTW30DPvwbsz?= =?us-ascii?Q?hx/EWyaDx8hJ+muddOuIA9gMtvIcf6ZmSIrs0zadXTbKAlLyGoFJxWnJiIxE?= =?us-ascii?Q?lc+jqmnaBQ47BtEANfpB5MpUCUCQY6NvZfD2cH/YhIzAQU0dooFX3KzbJ+VN?= =?us-ascii?Q?L3kAg9GyFRlSB5Ai5hJmRS9LBgnQ34vVL9TGYXN6ATldr5xHpTrsjV2ApeHQ?= =?us-ascii?Q?B5wHIRPfy4dSP2ezIev36k/ErwvcqKVQIRKvOmALrWBNLBNrwMVZXICiLkaW?= =?us-ascii?Q?mgCGOe78Nz9naOcpMPtz8XgJRDSEaFHqALfm3JsbcUI2IHmkYyqq/Jq2wLL9?= =?us-ascii?Q?Vnh5Z8nf5a8f2Pt18SYpezPMubKgIIrhsnZHY2Oqzbv9PjL/RNzBzU1UZpTd?= =?us-ascii?Q?x8AGsUO0v31hhPvJKCN4x5Ye9Jk5+kAdXaVZ8PRx1S7LpSZa7UPAc6tA/mCT?= =?us-ascii?Q?5TkAvvRNbOMBdf79EFIjoI7cS43p4kDzEnzeVzoLiU8Yx21Iv79RFqQQsRA6?= =?us-ascii?Q?L2UVcYGkl2jG+e7Mx5YHBfxO9MS/OHJbmmsMO6UeA0KJvOyzgpMmKDz1RXjY?= =?us-ascii?Q?HEvBvzKygj1naeAdkpmR76koHdXC0uryu8uQwntdcNgyKXu38r1KzTLnj8r/?= =?us-ascii?Q?0jFv4WGoDEEt7sqAGl2ovUHYTU8bhCMTCC/v+vTZ4ZCQTZLs9HrrYgGfufKH?= =?us-ascii?Q?biD17iB69P5PZePiO8lyVG5VJKA4VvE/yP8aLybGVYj/ZB8gD7RHtqulk4BF?= =?us-ascii?Q?tLz4TmtVxZjbzy3wQtR2snaI6REyPm9DB2GD4q8XC4i+PgkStD+Wg8hueWaT?= =?us-ascii?Q?Ub5ANlsSoErR30x8quWZA+Z5TLQmowKesdNs4Y4TcIo4FYEb+aWgn0ckHAaU?= =?us-ascii?Q?80Q9d4uHQmLzoeu+8pG22Xz4FStBQQdjcb5dc6boWPFgm+kXCQQkVz+GMN31?= =?us-ascii?Q?dJ0hQAiT49rWDK6l5tBchPOipjGdGpxJq/JC6MNGm8oyCDwUK9gvoaUudDvR?= =?us-ascii?Q?mtxwO1yfiTEmT+oWLryOBwJbJFPbFko8s1dnGWqfdS4+5BlNpTSmnL/6AupW?= =?us-ascii?Q?/KZK7kDzb9d4Z4AqOExL77mkz7BDAX4b2howQuAofF99HtabS+U1R1hTfXTL?= =?us-ascii?Q?N1B25id/blOY+v2/AJ3egbq1CK/k3wNYLNvJp9Ym9A+LakKKMm/dUoYq+zfA?= =?us-ascii?Q?+mV9JiG6v85efDOD37Ye8SWPc3AkpGbGKdchiZgjOMTjw+pReA=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)(82310400026)(1800799024)(376014)(36860700013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Mn/otEg3BkBCx0Vno9FAf0r0LXzd48gChmk5DsYSFRuPVwl5yi/sIrfDieuFAUN+U66c0qkfOyJUuB/ZhnotwdqykkV/4YY/PTlSlxRyCLQNM4G8QQqyumh9KAHsoDCEdGow/UDZ3uwMmkpVqkRzHBKmcNsBmBR9Nom3liZW+wIfGY/zkasz4A1CHaPkP7lsjuyTlDzYhQQET5usw9yfXD2iRuGaimGrmvMHEmDzlU2Dz1hXP/Cw3SfBiPtUuVCSE7lXeMdy9WUO80QjiZEtJ1Ss4h/sUbCfenQ8/KuprDEFKMv7Ms0JFeF1deOs7MWy7YXWjKU8l3pGVEOHLPfc7+mt9D7Oh5sORid1Q5qv2vBDB2dk0Ke7p26p6QZSlRfKJ3iEtjAknAhDJ0mkyyafmkyugl/r2FniOiBlKT+eod1fdEtvh97XaxM6RMSHPgGN9DoGaixFN1iKwAXvPBrUSDUkqgbeEHJgsyg0MiEy9HOQ70GmeuO8ueErLqIclGOQB3haXFbw5evCvecJzwv9Wz1OXvJzA2lT8Uvl2PmEYom1F51NcMKsPjn/jkMFkHsKGr4Z7qxzJNEYXJieq+MRoe47/EGPPefmabcRZPeg30QiWzpGj52BmxpfpQJIo4fj7r1Ha+Cka34lijcHmQpBnotebAVSIR+hStX+MMZJ26I= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 21:05:49.9269 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 192f25a2-9a6e-4f5d-3ddf-08dcf214243a 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: AMS0EPF000001A8.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1P190MB1995 X-BESS-ID: 1729544751-311938-13027-41083-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.173 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVhaWpkZAVgZQMCnZwDTVNM3ExD DR3CjFLMkoOSUt2cDEwszCNNXAJClZqTYWAMbe38NBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259883 [from cloudscan17-111.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 5041b28f14..24476df817 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 @@ -322,6 +322,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; @@ -460,6 +462,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