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 D2A8B45B96; Mon, 21 Oct 2024 23:08:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 367AC40E18; Mon, 21 Oct 2024 23:06:12 +0200 (CEST) Received: from egress-ip11b.ess.de.barracuda.com (egress-ip11b.ess.de.barracuda.com [18.185.115.215]) by mails.dpdk.org (Postfix) with ESMTP id 01ADB40BA5 for ; Mon, 21 Oct 2024 23:05:53 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2110.outbound.protection.outlook.com [104.47.17.110]) by mx-outbound19-70.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 21 Oct 2024 21:05:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jYyJ+BBeDeOIt0TnZJwGP3cEzr4iAN2qHOsOo/jAVVkB+wMXdtWiOaspnkJdRu9kuUzuOkJl7QInGtDPji8FDNJ5CO2XpGEhlnTdqRwU3Nrhy2dsif7/S1Lny2DSHVLQigXeICiLty7AHSdOORt9XZejK7VVNQnQGILuj9M/KlL61+MaIeoOvltBiKK6bUE0SzhyRKIsEZkHR/o7k84ASnUo2FGN2kHNtqjNSzRKyaQvj6WDSWD5y44OcK8OH/UUegM4WKpMCemuTphguHjBfETImFH3rYThIWD08IIUwiN72GTmICaqbm/xKyr4TUptR2nlz9W9FYcYOWP4om+8CQ== 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=fIWMWqYPNg/eoe+/leGkbtO2+oKWo+7MQ9PT41HCynU=; b=ESfRgC7T3k14U4SjOjM7ZFl0NQR9H2lH9dJvNw8rivbnGnezMT+CyIoDD1y+t4uzEzHJZ6YRf12qQHnSuMpZ2jD4H3ABAv3ZhRqR/qvFESSsUq/dqJh+e2A1UQzXHPq34gbZxQ6ugHC/xwP+fwkIe8n3t2LYWeiQeLHgmCM/XMCFjAVGxyHcLTzB/5WRtABxCR5VW0pBfOownKAqE0zjmuu6pliQbMubdqetjDfpqcc9rcoX7XFvugDaEfjhQRmV+jch2ixbNPyfe0OjmeLQn1hYet6TluiSCGw4iQ+mYtBU8hsZnngUQ300Zxa8P7XxL297cmxaY6WcQsqJnxaopg== 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=fIWMWqYPNg/eoe+/leGkbtO2+oKWo+7MQ9PT41HCynU=; b=CgMxsFeZEDEB1tbZpg7LJTOUhTalaTQymBtWgJIb/RF7yYTmIxDQjPC8NbmIhixySpusT0HXtS6bQ3qWT+zsQ3La2s9+NZhyjA27Yccebig1dMK24JzHRElg8r/3VI0dBCd1yloA3rFmbsZ+HEShbS+RKk4MuFQkq65vngpgZns= Received: from AS9PR04CA0145.eurprd04.prod.outlook.com (2603:10a6:20b:48a::15) by VE1P190MB0942.EURP190.PROD.OUTLOOK.COM (2603:10a6:800:1ac::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 21 Oct 2024 21:05:47 +0000 Received: from AMS0EPF000001A8.eurprd05.prod.outlook.com (2603:10a6:20b:48a:cafe::36) by AS9PR04CA0145.outlook.office365.com (2603:10a6:20b:48a::15) 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:47 +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:47 +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 20/73] net/ntnic: add action TCP Date: Mon, 21 Oct 2024 23:04:22 +0200 Message-ID: <20241021210527.2075431-21-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_|VE1P190MB0942:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 8c29183d-16d5-4a87-14ba-08dcf21422ac X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?kHpL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= =?us-ascii?Q?CusQR1AYu6tyX69awXCki4bGeKVK/vjucThxIRA43jY9No/cyHD++IvbosYP?= =?us-ascii?Q?gEP+suDInGEBtboZviHJCiEhjNZGvXQckV8EfBXB++DMpsNyzuS0dgbxU+AP?= =?us-ascii?Q?KieO30RRkQ66UkepumeZ4umkbRX1/ok7RwKDpgc1/euh4cpYqTLK7hKcOonm?= =?us-ascii?Q?1ENt9Wuj0OLHEl2+XiRDTKT21XU2J/CXbpHHfKr4qYf/U/FRvY5rSRltrhFj?= =?us-ascii?Q?aEmJXU8a8hPHfpHo1bGMKnmL/1/b/Zt3tEAESMPlGk17IKORjLHnwWQcERaM?= =?us-ascii?Q?GPpvGoxK9J6cqdh9Pa5Z6PcSiBu7Uc4IjIsOaXZ2m+p4StLysPQwwIhiItYj?= =?us-ascii?Q?fE2X2rdWIqY4gZOJl+dzQf+bnt8LmVwOrDEyX+VOz1TpUiPMiAzje1Ne+dKV?= =?us-ascii?Q?7bKbOw+BopaUEckHy3SmRu6pQy3rScKB9wh//V+xjGck+p8lzkTOoep3w6o1?= =?us-ascii?Q?OyzrmoATQlVyKpDcpUmxzqOsTgf2TLWBSdsAzGs2P+aYdYWl9A=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)(36860700013)(1800799024)(376014)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: miWd3LNnw4H+xBJLf69ysH0YOFeGGyanr3rEQd06fLvgwKW9VQrxlbxmIqD2Mr96v5t9FYRzO5MhXrJBQSIbSjM0cMMvQFUt91GiqQPepXyexmOBB1rLYfyQgDXJPtqPay7nWXfbZbEjHOyRCygOgJCivV0iMiE/PY6wc9lVcjVou5Cci6+x9ILUQ9szPSCji2A30pIEGggk6J6dbb1e2dA1IbvzB1h9Yxr8fgtTruxJFQfRSFDtFk1gNdFQEJ8mHwhx8JYN09fd4p1vh+5pSFDuvGTBzXK94BaHk1b97mnRgXMmbpjd/Qz4mz1asWOoxNEhz8Q+6HU0KW/ENy6Zk8Pmh8jkWAyf0tilaTdREIBHX9NnJbgI8Wl0QUbr5bkObquC9wzrrPUvEIvrF/8TfSLJvJ3luDyult4a+wwZ+FTej6AzCgfNxOu50VmumuxeOL1kjvvHZXDGMKlQFbnKAGKTeO6kKm5JZaJOhemFhTRyuLOfsZPwEvG1gftrHZopi0MYGe2nP1pWx5f883ztCvwd440udLqOnI3uRyDx6b//CuwoVxbEFQT48FbO0RS1trJyAmScstqVIvmR5R/gy28NlKVg/PlBDAj3G2/yheLKE2zbeVwe1yrfx2iC8RUniIvWHvN7Q8yBtXVm1kC/MIpyRKlytX1dCBVpa/6MrMw= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 21:05:47.3175 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8c29183d-16d5-4a87-14ba-08dcf21422ac 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: VE1P190MB0942 X-BESS-ID: 1729544750-304934-12650-45452-2 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.110 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqYmJkZAVgZQ0DA12dTQOMks0d LM3MjQwtIw2cTUwCwp1cAs1cgkyTJVqTYWAMqoNmVBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259883 [from cloudscan9-212.eu-central-1a.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 60f5ac92aa..1f076af959 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 @@ -1026,6 +1026,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); @@ -1059,6 +1159,10 @@ static void copy_fd_to_fh_flm(struct flow_handle *fh, const struct nic_flow_def { (void)flm_scrub; switch (fd->l4_prot) { + case PROT_L4_TCP: + fh->flm_prot = 6; + break; + case PROT_L4_UDP: fh->flm_prot = 17; break; @@ -1069,6 +1173,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