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 F16B245BB4; Wed, 23 Oct 2024 19:04:21 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CEE4442FAF; Wed, 23 Oct 2024 19:01:36 +0200 (CEST) Received: from egress-ip11a.ess.de.barracuda.com (egress-ip11a.ess.de.barracuda.com [18.184.203.234]) by mails.dpdk.org (Postfix) with ESMTP id A345F42F23 for ; Wed, 23 Oct 2024 19:01:09 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05lp2104.outbound.protection.outlook.com [104.47.18.104]) by mx-outbound42-14.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 23 Oct 2024 17:01:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Lf9MNsrV1S6gD23aew1KdicXsWNXiAartOHd2YnpH5SqB8NMlrtIieijCABjLaNNHip1cx3QGYeMIIpKY2hFcn5yF+oYwFAaAzxqX5fms9G2UGCRbQf5BbcTRAnKPwlOwgZ6sgpJFI1R9DrU19wJs3usXH9jNGfw8y5t0xpp7cU/gntROuFi6PW4swC2SZ0I5bDQaob5NylnriMGNsAz7N+Eu/7X/HxWnPDNqRMMRyGTKPCNDLVJoCJJfGj+0ktH9g34aiHq5XIdNO8298nxaYl/rJJzYpAPp+hSsphyrte9YdvL64EfFoeUmcO32uyFYee0UObGyAI2UKyLx9EQow== 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=jdFye+vdaBqQ/PFJJq6JQMfKi14HD40kG1q+swfGci2Q/p5UKMb1UE0WQS21QtaOw1xPWQWfaFx47EEAGPZv9OIKQ5lCyGRGH5ffFi5LSmOGGoR/8dtVBZ4LWbLUPQKNkw0vhTGmXVefl5jdrTNdUHUFjkknUOWqPrnEbQ1X0BwnWOLGJOZQEm76D/L+Xd/eTGI7MFt9SM1RoqBpFRS13LFEyn2PRz459ml+a0BHimvP7WSZBeyFK81QqSY1RzSlm+ueBlzuwUCs3tOY7LOzVK3snlgmQQLrAWr7ohx3DvUxIi38DMSfuWWOg6GtHXptEnEGOEAMtkWkPZSvN0ix7Q== 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=lXlSTkPK8HDkjfBCm+Um6hN1FM5VjfjZ9ixal4+CBqsLHNeOtMgEkh1wPjrZWtbVIHOpdy13n7BFVdJB8x4e/HiYYcz1Q+kHGLfMi5Gi3t5bHKspt5GrQ3CD5IM60QbNdBgJr1mJHj+eLoPNtiUoEG51SYniTpNyYAaaGMNYnqE= Received: from DU7PR01CA0001.eurprd01.prod.exchangelabs.com (2603:10a6:10:50f::16) by VI0P190MB2105.EURP190.PROD.OUTLOOK.COM (2603:10a6:800:24a::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Wed, 23 Oct 2024 17:01:03 +0000 Received: from DB5PEPF00014B9E.eurprd02.prod.outlook.com (2603:10a6:10:50f:cafe::b4) by DU7PR01CA0001.outlook.office365.com (2603:10a6:10:50f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17 via Frontend Transport; Wed, 23 Oct 2024 17:01:02 +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 DB5PEPF00014B9E.mail.protection.outlook.com (10.167.8.171) with Microsoft SMTP Server id 15.20.8093.14 via Frontend Transport; Wed, 23 Oct 2024 17:01:02 +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 v3 24/73] net/ntnic: add action modify filed Date: Wed, 23 Oct 2024 18:59:32 +0200 Message-ID: <20241023170032.314155-25-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241023170032.314155-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241023170032.314155-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB5PEPF00014B9E:EE_|VI0P190MB2105:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 533c33fd-52e2-4d2f-dcad-08dcf38446cc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?iwyS2O71VSbAlBp7wF2Pe4gTAQuLqqrRxhCg8ga/V+QEYn9wISoJBiR52XJl?= =?us-ascii?Q?uYJtoRjPFyzfwkk53LjCtjnnHvUVkOgBMtQFdJHnYCjLHeaScQSkg8lPHkb1?= =?us-ascii?Q?aK3fii81rNsqgZTwKCGpnPXc+Q74soTXskZg2s3iNP/VGclRLgz4ASIRu4Pq?= =?us-ascii?Q?g/md8Wfu3BfliiYFdJJP2tpKmqPBNgNdlf3QnvQwHJuSMIfB0pCXiVXaiJH7?= =?us-ascii?Q?P51vHyJxF9LL6HqYc+X1lYj0BPkKXmS/Z9lbcutFcx4YY8ba549wwRxuO1pN?= =?us-ascii?Q?2RtqfUpWuyTaedHPSZEQ36B/QT563yJ6dmb4S5Hj7nSQxuCSGXs0sFFhe6UU?= =?us-ascii?Q?X9gmXh1PVlAK9BIDRamt4MpwTx4hcPcQxXz7YDRBIXXeMaqi8fE5wgx++O2F?= =?us-ascii?Q?uxmXaty2LrxM4UZIb5KfzEakXpZNRjoWSz0oU2rjqZNJyOPNlvOQcgmyZ+Ab?= =?us-ascii?Q?em2+ohYb8ZISSzX9oh9S7aNfJJounAjLXXkANBxIpJpy8OnJujeKnpmP2HKn?= =?us-ascii?Q?k3xzLdmQWTzJ74G/pZoCWWR6EiFe99ZE6PmeKgOMu7bQYVxkKIMKqtu3cE3H?= =?us-ascii?Q?vBrtpijFdeAyyWog8sZTnQjC0FAIpks0XBZ0s4D1oERVrQlQZ/OjFiD/SPUK?= =?us-ascii?Q?LfK0Sza3qIlm7a1eecu+nQOQKqQH8L7odGfE8WG1LF77wyAIHWs6IIq3lZMP?= =?us-ascii?Q?atRBmEE+SXKg8ryN+Y0lFijN3DzO2hUJWFGNXb+gl+y2BrIT1A8Q21aL0PSY?= =?us-ascii?Q?/+mzg/EVZ+sQHbY1Ta/6EUwxT5yH6AtGYJE97IgAQecSQJ2KgUSDkHHAQdhb?= =?us-ascii?Q?+dlZkfGT4YgLVW7eVkCmb+JRxWhiE67XDeVc+Iav3xK8YN6gcqXveZjrFN6t?= =?us-ascii?Q?JzdVVjBy2XgwPaZw9C0VSVwmq6q6SwcAnknfvixjHzIgtgC460vX2t+uCw0b?= =?us-ascii?Q?NSDMyXXsXHbI0UALxb9ifvdM3m+4LOPk/gbyBTkoaSz6fhzD1CLDJd0XQo83?= =?us-ascii?Q?WiBi8tVwtxQQwqm5qksU8kxpyCCKECHrwcvhTMPPNBAyJqGQBLdNPgH0qqPX?= =?us-ascii?Q?HgcFu0w9zQGB7oZA5Uj0LpVQqaSNJ1kmQ7fO932rpaSVoAhorr+uAppdPMDR?= =?us-ascii?Q?y5ZE8pQIbu/Bzcn08wt2YA2p0n2pmEFvPu1ffdxEcqVusfLqfUM6G6tDBuoO?= =?us-ascii?Q?thm1PGZhoEUNWAdh2tV9pxe0uslemvJUN4dkj0BeoWa7gaSIlRlV4OaiIPYe?= =?us-ascii?Q?cbgtPaSO/7RIxDzt0HyuNj2y2Z8Xn+GBL5brfy0+l7uWP2yy4DHa9+9ktj9Q?= =?us-ascii?Q?yRsW6QOZOFDL5sixHDJlPy0THUNDOy73X1/EYdI6Zq5HoljM1xFsH3UlZQy5?= =?us-ascii?Q?cRNLvVkRwoJdREOYs4ezf4YedCIfsDpx2J3Hzkhzm6hGTWN9og=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)(36860700013)(1800799024)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: oSsrlmoXtWedGekaGp4exkp8Tn+dZVmo5KG0iCGPpVUai/EkcPxW1sYW1xTTeUx04A+b48cWWX03NHduuv6aXUn9upU9vUgFADG6uZp1yJ7Bi9aQ7sR6rsf9bs1VQ96fj1iaB3NzR3F0CmqHSZZjZEvSL9XWVT9qvxmJkq3WGCLfex9O3Wt2jK7u6zoE2v1LTZA22jzS5djzRGue+uq2x1IZ8c/PGOdg+jhxwwzD+XRxao1ECIy6IVTuXAA4X8xKNigRkazsNdRzfr/RiGg72iaAnCA9RIQkCiQ7m3OX56rshtk/2lPR9e9EAPId6qBx6DKdPQgtKgQm8cau5ccvwag/ex79gUSECCuQi/QLFjRDFv8+lK7TjsjL6Ew07JyHl2GVSa0LX9D9o0kGHBqQgGFpNCeIMbGG6MErIMuM9xPG5K77KEMMkE9fo8AmmH8TvIXDvkn+l2mglLbfC79BWmCheJLl7kThf1OBIZjeItx6K4FvxY/1PhmorQjAhin0FPJKLQ1PETiUo0fq/E1t/yw896jw+kEv43qYMJONm8+HlRPmdRTm2XVUA7qSawipyY8XgLqlreRKE8ltybCqkDQPoBF9qZe5+Tx8MO9M39YP4PkTsxkYOQMFXO7r3Ir5G2IUpGqQjrjby/09zz8L8lvTTywmsYQBkwMDMvefeRs= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 17:01:02.5081 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 533c33fd-52e2-4d2f-dcad-08dcf38446cc 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: DB5PEPF00014B9E.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0P190MB2105 X-BESS-ID: 1729702866-310766-12797-42101-2 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.18.104 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.259925 [from cloudscan19-83.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