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 121CB45BC0; Tue, 29 Oct 2024 17:45:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C485B42F3F; Tue, 29 Oct 2024 17:43:40 +0100 (CET) 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 C1D4E42F06 for ; Tue, 29 Oct 2024 17:43:13 +0100 (CET) Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02lp2109.outbound.protection.outlook.com [104.47.11.109]) by mx-outbound12-25.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 29 Oct 2024 16:43:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MQUaUPUYwfPzDczieRggPfuTX5k8SDuoQCTr4sQCAlpdLsqevWlqAlCyB1Jqit5Cz3D7XFXyt014AC/mUdBuqkIXYyB3iGk6B5eoTDRaWjz8N8V6a5s+ToAWrAVl399d/sBOxkd79PkMysCQLdOfLpNzJ2ZiEwKsNbD1aGOHiqpNLYvVwPK55HH78O8AWK/VvVoNiZUePxNYZzLIvtOmpppW/v6l4/hwfQ7LGa8UmBaj86AzhsZ5WybyKlI57/6CjipJ/rYo/vunyPuIRTHcVzsUkqsWXj8u75NyetIlT+DX9MbKP0LY+H/vZ20BOZwwDwxiaETDkVNGKu+5Al20Xg== 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=JJIdf/LYGhq0RVdw60J+lgDUNJKvu+99I1b1z6V6mMM=; b=ZoQmg+6cnjxmI1O6C5TALFd5VU/DTV+wt4mf+h8fCryPYiwAUERFuvZkXf1bgSOl6OzzXnJRtyGrKRWfp9bjTRq/JtG+6qRn3Iv+hmqA+Euy73ovtmIYyLjQP4n3EH5GfaBDeHt+h7U1TYYIk0Wvp60RDjwmQAmauiTEClRM2a3FkkeJqDwDS+RgKP52N8JMOLr8EO3r/STh8wEf4LyGEkuJgp4xnOT70NtZLRFfnQv3babfD6yl3zDArXGhXpn317GVxngnTiDE2IDXsQKDV4JVlLrPJVZQUSiqcBdgWLhjbIf5VTyUUyld+xdk6x5X1rP0Eb2CH7yN51v18qZf5g== 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=JJIdf/LYGhq0RVdw60J+lgDUNJKvu+99I1b1z6V6mMM=; b=jEiKlnII2rW1ta0DUrlBjeW9tsnrEYrI3FkqWVvbg7Supm5Uu8idJQZwfgL+CB4xIzKj0gTGdVJVgvvqHvjbceAbO3nCdoA5YWtXWyJuLBBcGMVRh5LyMnqMcuBOPH8lzlDZZohCU8LIbhEpsVFbYHFVYDzzWV7v0IIQTGwazw4= Received: from DUZPR01CA0198.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b6::29) by AM0P190MB0689.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:198::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Tue, 29 Oct 2024 16:43:08 +0000 Received: from DU2PEPF00028D06.eurprd03.prod.outlook.com (2603:10a6:10:4b6:cafe::68) by DUZPR01CA0198.outlook.office365.com (2603:10a6:10:4b6::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.29 via Frontend Transport; Tue, 29 Oct 2024 16:43:07 +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:07 +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 20/86] net/ntnic: add action TCP Date: Tue, 29 Oct 2024 17:41:24 +0100 Message-ID: <20241029164243.1648775-21-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_|AM0P190MB0689:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 2f19146b-a6fb-4b6b-d036-08dcf838c493 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?0WK8c1E8BxvtWLLBRN3/d26I8i9K6KIi5chlUuZ0slgPkc3q8cx8WNSXipHr?= =?us-ascii?Q?mo6iafd2cx7pNcctN6jX+g3xtyq3tpPyXhsHdl/EeSJYfv//56YX4tZBtt4R?= =?us-ascii?Q?yFPC5Zicqic5DV7Uv/ChjNSufKtqPimr1IhEfIRgiSpg1BQ1WASsDxrYi7E5?= =?us-ascii?Q?CKX5bE3DgOF3iUvdmGYYV1W5HCFeyzv6M2vBpdL7ksuqXo8mDEX+I1G3hYid?= =?us-ascii?Q?N7R030F8g2OfGHQS9vz+kEO96Ea4wZDovc0oVsmB9FtPHYoTOHDJLrrQFRVT?= =?us-ascii?Q?CJh7fwd+PJKwj1GM4bCRIHi2vE7pL88LQedhZP5StgXcKcwirtNXzyGZoSfd?= =?us-ascii?Q?K+e3SUwHFa9rSQoRgIIWbbCRbjUwo+C4Nn1+WUJzVS4ehGNn+S+eoE/0zpFE?= =?us-ascii?Q?pFw4zwgf2rj6C+Xq4Knj6LXBFy1elu968py5V8YjWZYFBcgJHl+7l4CWRFDm?= =?us-ascii?Q?6qGcKupUpnWEfHGblx5TNuT7THY4cCShzIl5R+MIJB0Y3XFs4hPPj7tXOfpL?= =?us-ascii?Q?UdQ8SGv9g/LybBrFtDT4n62Jl7kHeuq1BlX3JRbAuXa2XCS7BZZI5j59UJCG?= =?us-ascii?Q?p0nT//cUoTLP19O7A6jIYWWRTHtZncxXTEWTqgtrWPhv+Pta79YQNXHZ9bTi?= =?us-ascii?Q?9ZIQlwnKmYAHq8uUd0IIsmGaUOngbFC5mZcpTCgE+bnc1f8bqwxDYHLE5nu2?= =?us-ascii?Q?h8hp1xjrXXNlQV/T0zMuhNLYXht/vY2US1DMcZ+280Lu3ONPIqj2K+umE0TG?= =?us-ascii?Q?sfxIV1jOjQIFjxH+VkV6LU24t1H7qlnqhq+jOy+wgsXo0AwjYLuTC/KFLP2M?= =?us-ascii?Q?bBZOCB2tAO9X2RpXC8xqKtfocn5D4p4dgTi8YgsIioP0egi8M45Pw6uyBYsT?= =?us-ascii?Q?/qTF3tqZ30wxjiIXBW4NFZU2W9kfeR9FvIn+HhJkmtszXBNW9WwOcQyK48dn?= =?us-ascii?Q?8v0HCo02iNXYY4BaDO9I8xsuPTlU3D+oUlXOxKW0XcPWR7Yce/BdfGNxvSUR?= =?us-ascii?Q?ewdFkSVfL24jZ9Z4GGSDdZBBw1PzI5zt/Z9rT5ZIV29R7kL7wxfV2aMgnSXY?= =?us-ascii?Q?dxDFBPmVXQPaUtXlbI/GZ3cnrTl1FAcuDv2XhcLG7CgP4WsykEN9t1dpuypK?= =?us-ascii?Q?9vWyQuPMp4pC5N0LZ5Wecn6rtxyWb3MacWzICLTwYZE9dMSvrVvxChEnEpV+?= =?us-ascii?Q?a8ZTWYMwkkXcGfllGWvp1tsw+5xTW2uFECPELL49Ht71bvw+iUu3dwaUyB52?= =?us-ascii?Q?/Imoqn03ADE2qbJGuQxdi3NwKpP3i+3XmmXBIYoL6Q6cwdJy73Od0M+craD+?= =?us-ascii?Q?YOGbxm5AZ+SOr7MojR+TmR+q5BZt+Afiz9dgW6GbbySHrP0zexX/i2+1zm4C?= =?us-ascii?Q?eKhQuyRnV0t08ekQ3rTuaEpwbNbjtJBmHOTWgCGl5/+hXqOivA=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)(1800799024)(36860700013)(376014)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: EYMs4K/IObtulp4LllURAoPGecUQ26fzdNGryLrkN93hAe7n51NsaqzqXJCZ0FSr+H5gwPyNcOu3kr+5vIVhqh5oQl/4mI1PHPT0ijVxErShYDmscH+i48FRyQcg8Aj4tmcpJIEA/02hVLFzgH+AXcYfSdF+IOSZg9oTJ5lEQRsj6oTHY4SJwf5Am/dHAx8m8huSexbeRnFnMo2UqBAzaxIvku+/3pruC05V89P9HPvu/Lx3b9WSjEfAHmxVcbMTUuaJnEV6DErwVZ8IIyIaulF3ssdHoBfm9L1xyjl1/i0BZpcitGGSe80G454szxj3NaONImayNFyXKSkevm+c5pw4hPS09jVRPjbc05bt8g+yorE5SRu0n+pi3bM7lSKYC8V82iwXGbqFrRq5WoY5GK/q208Z3HRGQXa759MH6UHKdo2kkhL/lIEnAGRzNCJWrepAgTqn72iRUWn+IYAqs3fpaf6ybcPAU1tzd2t8t3cOiIqcdwgA5RuBPu8mLtnZMZXMa4f1jq5Vx88U1yE/Qzsg3dZyphbKIPvkFcqdXrjcgcHmOwl9jkIH97I5ukBpawhIw+XAu71W/IEQQzxPAtr/dJjKe8Z5qwcZMKLkG4orK5d351VSuzT32BYdPEOJDKVnPokHGRq2sFIKAcEHaha89CgY/Yi6Hr0V3pM9+os= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 16:43:07.6677 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2f19146b-a6fb-4b6b-d036-08dcf838c493 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: AM0P190MB0689 X-BESS-ID: 1730220190-303097-12763-29332-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.11.109 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqYmlpZAVgZQ0DTV0MAwJcXcwt DSwsw4xdDMJC01xcIwycQiOcky0TBFqTYWABfBaW9BAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260063 [from cloudscan18-12.eu-central-1b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=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_ITEM_TYPE_TCP Signed-off-by: Danylo Vodopianov --- doc/guides/nics/features/ntnic.ini | 1 + drivers/net/ntnic/include/hw_mod_backend.h | 2 + .../profile_inline/flow_api_profile_inline.c | 108 ++++++++++++++++++ 3 files changed, 111 insertions(+) diff --git a/doc/guides/nics/features/ntnic.ini b/doc/guides/nics/features/ntnic.ini index 61a3d87909..e3c3982895 100644 --- a/doc/guides/nics/features/ntnic.ini +++ b/doc/guides/nics/features/ntnic.ini @@ -19,6 +19,7 @@ eth = Y icmp = Y ipv4 = Y port_id = Y +tcp = Y udp = Y [rte_flow actions] diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h index a95fb69870..a1aa74caf5 100644 --- a/drivers/net/ntnic/include/hw_mod_backend.h +++ b/drivers/net/ntnic/include/hw_mod_backend.h @@ -166,6 +166,7 @@ enum { }; enum { + PROT_L4_TCP = 1, PROT_L4_UDP = 2, PROT_L4_ICMP = 4 }; @@ -177,6 +178,7 @@ enum { enum { PROT_TUN_L4_OTHER = 0, + PROT_TUN_L4_TCP = 1, PROT_TUN_L4_UDP = 2, PROT_TUN_L4_ICMP = 4 }; 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 3d4bb6e1eb..f24178a164 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 @@ -1024,6 +1024,106 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, break; + case RTE_FLOW_ITEM_TYPE_TCP: + NT_LOG(DBG, FILTER, "Adap %i, Port %i: RTE_FLOW_ITEM_TYPE_TCP", + dev->ndev->adapter_no, dev->port); + { + const struct rte_flow_item_tcp *tcp_spec = + (const struct rte_flow_item_tcp *)elem[eidx].spec; + const struct rte_flow_item_tcp *tcp_mask = + (const struct rte_flow_item_tcp *)elem[eidx].mask; + + if (tcp_spec == NULL || tcp_mask == NULL) { + if (any_count > 0 || fd->l4_prot != -1) { + fd->tunnel_l4_prot = PROT_TUN_L4_TCP; + key_def->inner_proto = 1; + } else { + fd->l4_prot = PROT_L4_TCP; + key_def->outer_proto = 1; + } + break; + } + + if (tcp_mask->hdr.sent_seq != 0 || + tcp_mask->hdr.recv_ack != 0 || + tcp_mask->hdr.data_off != 0 || + tcp_mask->hdr.tcp_flags != 0 || + tcp_mask->hdr.rx_win != 0 || + tcp_mask->hdr.cksum != 0 || + tcp_mask->hdr.tcp_urp != 0) { + NT_LOG(ERR, FILTER, + "Requested TCP field not support by running SW version"); + flow_nic_set_error(ERR_FAILED, error); + return -1; + } + + if (tcp_mask->hdr.src_port || tcp_mask->hdr.dst_port) { + if (sw_counter < 2) { + uint32_t *sw_data = &packet_data[1 - sw_counter]; + uint32_t *sw_mask = &packet_mask[1 - sw_counter]; + + sw_mask[0] = (ntohs(tcp_mask->hdr.src_port) + << 16) | ntohs(tcp_mask->hdr.dst_port); + sw_data[0] = + ((ntohs(tcp_spec->hdr.src_port) << 16) | + ntohs(tcp_spec->hdr.dst_port)) & sw_mask[0]; + + km_add_match_elem(&fd->km, &sw_data[0], &sw_mask[0], + 1, any_count > 0 ? DYN_TUN_L4 : DYN_L4, 0); + set_key_def_sw(key_def, sw_counter, any_count > 0 + ? DYN_TUN_L4 : DYN_L4, 0); + sw_counter += 1; + + } else if (qw_counter < 2 && qw_free > 0) { + uint32_t *qw_data = + &packet_data[2 + 4 - qw_counter * 4]; + uint32_t *qw_mask = + &packet_mask[2 + 4 - qw_counter * 4]; + + qw_data[0] = (ntohs(tcp_spec->hdr.src_port) + << 16) | ntohs(tcp_spec->hdr.dst_port); + qw_data[1] = 0; + qw_data[2] = 0; + qw_data[3] = 0; + + qw_mask[0] = (ntohs(tcp_mask->hdr.src_port) + << 16) | ntohs(tcp_mask->hdr.dst_port); + qw_mask[1] = 0; + qw_mask[2] = 0; + qw_mask[3] = 0; + + qw_data[0] &= qw_mask[0]; + qw_data[1] &= qw_mask[1]; + qw_data[2] &= qw_mask[2]; + qw_data[3] &= qw_mask[3]; + + km_add_match_elem(&fd->km, &qw_data[0], &qw_mask[0], + 4, any_count > 0 ? DYN_TUN_L4 : DYN_L4, 0); + set_key_def_qw(key_def, qw_counter, any_count > 0 + ? DYN_TUN_L4 : DYN_L4, 0); + qw_counter += 1; + qw_free -= 1; + + } else { + NT_LOG(ERR, FILTER, + "Key size too big. Out of SW-QW resources."); + flow_nic_set_error(ERR_FAILED, error); + return -1; + } + } + + if (any_count > 0 || fd->l4_prot != -1) { + fd->tunnel_l4_prot = PROT_TUN_L4_TCP; + key_def->inner_proto = 1; + + } else { + fd->l4_prot = PROT_L4_TCP; + key_def->outer_proto = 1; + } + } + + break; + case RTE_FLOW_ITEM_TYPE_PORT_ID: NT_LOG(DBG, FILTER, "Adap %i, Port %i: RTE_FLOW_ITEM_TYPE_PORT_ID", dev->ndev->adapter_no, dev->port); @@ -1056,6 +1156,10 @@ static void copy_fd_to_fh_flm(struct flow_handle *fh, const struct nic_flow_def uint16_t rpl_ext_ptr, uint32_t flm_scrub __rte_unused, uint32_t priority) { switch (fd->l4_prot) { + case PROT_L4_TCP: + fh->flm_prot = 6; + break; + case PROT_L4_UDP: fh->flm_prot = 17; break; @@ -1066,6 +1170,10 @@ static void copy_fd_to_fh_flm(struct flow_handle *fh, const struct nic_flow_def default: switch (fd->tunnel_l4_prot) { + case PROT_TUN_L4_TCP: + fh->flm_prot = 6; + break; + case PROT_TUN_L4_UDP: fh->flm_prot = 17; break; -- 2.45.0