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 A35E545BA3; Tue, 22 Oct 2024 18:58:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9B4FE40DDD; Tue, 22 Oct 2024 18:56:35 +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 3DDCD40A73 for ; Tue, 22 Oct 2024 18:56:24 +0200 (CEST) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03lp2173.outbound.protection.outlook.com [104.47.51.173]) by mx-outbound19-119.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 22 Oct 2024 16:56:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hKgbEMPJOxVFOGo8HhFWXsszIp4+1iONEInakNpqDjW8sB9uQLCmmmseiBFxxQTV1JWFy01MA79W8LUJvopQfNoE+3OEtchnQEK5F35G8WTUVqyAqix95M6hYI6kGk/fKxxdgAg6x6UgJeOIFtY5KyNPENWoqu8sjdx2I9SZn3a3JjTMz6YHUk/WxmbiicTDdwtnKEbO8RA63qJjf5wbPNZDM/98uGYU+v/sfVincWtxtbpPRynRAgvXTHfn6zGrs7Yr/Ay27iJpfUcuilCTUxyLZ2Pl3DxSKUht2/4Hcezm1zOzTLoGUmB62GfKBGA/NPW/pKGXP8yvsShvl3mwqg== 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=ap2pYLlQrE2kbELYjIit7ycb7kuq/YAT11pcrxI74yeMkRddcd7iuQxzzw/1b4KASyP2XmXnmjev2N7EUaWQ2lv1+EasPCxXSYQpFfJn+ixmV5seuwiZ6AmL1NVEU4ZjmTO4BkTSPWif1uuY2ktbB0E79U/foismntXIPl2c+r3y18sj4LuDe7y/Gqn8VqgWuk9OTwaDeknYc3mvYs+BzMKZucdhhZrVdolctY61pcQJpYGWyyW8p/v45sMgQ7+dpMSXDZ/8W8RRTB/mONfs19VhzhxGysFCgBngzBBRrXUT8IbFFgH8L/zo+Ws2RWNqJWenn63ewExIc28OG1s8UA== 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=ByaREARbhwNeLFIRU0sS7slqU85o4vZEtVlTu5soesi800wuxNVa5ZVgFAJQN5itPMmtqVPQI7ICTzZLbeA4UNvKH+yGV1eoeXFaJbksBI8yRg/ZkvRw2T1lWKMRElcGJSvmRARYG2Up9IHkaJmfp69lAcHsgdjFJQPYj9MYccM= Received: from DB9PR06CA0007.eurprd06.prod.outlook.com (2603:10a6:10:1db::12) by AM7P190MB0693.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:118::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Tue, 22 Oct 2024 16:56:21 +0000 Received: from DU2PEPF0001E9C2.eurprd03.prod.outlook.com (2603:10a6:10:1db:cafe::c1) by DB9PR06CA0007.outlook.office365.com (2603:10a6:10:1db::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29 via Frontend Transport; Tue, 22 Oct 2024 16:56:20 +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 DU2PEPF0001E9C2.mail.protection.outlook.com (10.167.8.71) with Microsoft SMTP Server id 15.20.8093.14 via Frontend Transport; Tue, 22 Oct 2024 16:56:20 +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 v2 20/73] net/ntnic: add action TCP Date: Tue, 22 Oct 2024 18:54:37 +0200 Message-ID: <20241022165541.3186140-21-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241022165541.3186140-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241022165541.3186140-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF0001E9C2:EE_|AM7P190MB0693:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: ec4e0f06-cd16-425b-c765-08dcf2ba7452 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?BGdFc5ddix1AS9W5AZVYeb8B+kOgd3708By4GYXUY0cpBQErDBs+52b97whB?= =?us-ascii?Q?YSO67+YCBujM+iDEwhTXzuBwpq534zFOyHaucFGxLM+mXJ3NmJbUllGe0zEn?= =?us-ascii?Q?W9ix9jrV/DeY3ehCol7kCD3tMrvCElrliz0MKU8LjXGadb+j9lJebhV7c+Z+?= =?us-ascii?Q?AJzvviEQWE0fbmnxgmjXRE5VjaP7KqAq878aRiDYteJvDMCo6Nri/vvE1Z0Z?= =?us-ascii?Q?PI7CSL72xU3UvAL9mT5egh0EgqZ0/NcGowo5ieSVvsa0YuwfHeAbbxcYbTZX?= =?us-ascii?Q?rNzeiXpcKWpFYR9KPyzG2r7og4BTvnrjcFd/PksObCK+ptBFR8ep9VRZfwSB?= =?us-ascii?Q?efy0BPBAFzC1oekrIHy6wSG3d7gv0J0B4+vQLZfUdYb0L7SI7Br6vzeX+mK9?= =?us-ascii?Q?SdM9fRqcbh9MdGlrYVtb+jNS1kreXguX1Aost+s+7NXYEZttaB3nK3Nb4Lx1?= =?us-ascii?Q?iLH21lfLrBmusyCCM8XuNzAC67fq4VbULjHH3lUDRo3Zt28lpKZFVBOoOT+/?= =?us-ascii?Q?etMuYPSA+tkuG2popAArkJwsmZ29whxDyEnmuzc7amXtOQtxikUf3jjxiVaY?= =?us-ascii?Q?hWqm6zqm0XY7QSJJ6z0KMclv1NPsKX8I9qM1XQZ6owRm0lUBe+B4NQKhpmJn?= =?us-ascii?Q?45SOII4E4QidLaII4wqRW/6MupWseXFH86RkvnE6OnrvC6BO9oFuuLzWn2vL?= =?us-ascii?Q?Bz+wXIlwklUcyUy66XfFLhYKWJXhmTDtwAGns9dSQTlPbcwXnyagKOkL1+MW?= =?us-ascii?Q?sxNGbhXD8aOT0wCRXKRPzPw3wgRVdcwYVlretadBGknngRyLidsVTwzxj27E?= =?us-ascii?Q?VOdYaMz0+B7arCKhyxO4iwTyUXZyeWkWQXOpK5B9letbftPqER6LiX+rnGy4?= =?us-ascii?Q?10wSPHvDx2h4pWLUGozRQgPXjH+D1TGuV1lXcWvp3pRfAPxkwadmz+r/YKBC?= =?us-ascii?Q?T8ZZZY1RIZ73WYvEX/pGZTE4Iy0DpEvj256wrcQCyShR87bPStzdR0yqQzGe?= =?us-ascii?Q?fFGCRjdTNroTPlX7Kokzk7MwW3WgnqzgIye2io8TP/gn6bKvizI/CgYDOtYz?= =?us-ascii?Q?xxAC43mXi50u0vuG23L7pn3YhTSJpSzh8NUKJZo5/qtSH1IhxVCGDtAK0Aqd?= =?us-ascii?Q?R5G4Tzo+7WWNErBBB4mawQO+h42An4LIOHlhhZjENba1ocEK/kOfmETO7obb?= =?us-ascii?Q?GpekJFbVg9JsWphStwmypvUz6spr7Y0+d/3S6KqeY0LnyR8q7BwJo9BSihf1?= =?us-ascii?Q?npmnMm+IlAP+4U9488c31bUj6PgMrjKvJCUWa+DyBCKK+jW7WwErc53YnDw7?= =?us-ascii?Q?6G3RfXwY3MFUR8H77sNXNkKctU70c/XgZG+cyzObI90uR0qaCbPCv/WWqF/b?= =?us-ascii?Q?8dd0lvc2bA6JR6PCYiFh/2rQp7j4/P2GhUeHd5Jl7Ges4NS6Mw=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)(376014)(82310400026)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: tmbyFruOK/dVKrGPDbCpaLAyvsIPXu4NbzREWFNgkeAWAZM1gxRf8R87KmF9GtjUvaCjUnbhAl2NJK2idWgFwSFnN1pM2ErQs7nCm5NyeOwFacFHqGk9Dm4vomlKiAo8GZatKuyC0LF5Zal8yEIvPEvvFfy5YbFhNTBh3LJutZ/IodqDx71I8enFGSondvs/VkMnRXlBWfx9P0WZjc8DRk8O1LMHKDRK/Bi/V9gaqhq+gnXVeV6+vhC6QQJbw1Yj3SJ7fabnP838kjpwDVTC84CzV0g7VEzUciGOtHUAuB6GVPD5T1u85jgOCoC29RW/chpT7Cnk3D5O0MZPqixkF773p/Dzc9+5S4KlBzNQm0AyunF3zg4QWdlrjOlQt+mVfgKM5Zj8puPylLySR1Nfe1Ua/UfTbfWKAw4mxlCbvIQj52We39f/S6wqQIUBMYFFjJCPnlR0TD+T8jPkrmLf3DFpoLgfdlt4lCSZSjkxFeViZwip+uMmupxY4sGhm18tWx4UelWxcN3ka3ggtf4R+0tGLeEaCdBbS5w0el5LbQ4wO1lHXi1HL3XomjwRmmRTiub3X0MW1syPeNQpF1OHhyoQC/0COmtZ/WHorDYZ124jDUZflvQFT80JA19Cl4Tu4Ss78SoGXhGJyZsE6SLb5P9X+1+mhEiOdoi2nT/d3F8= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 16:56:20.6219 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ec4e0f06-cd16-425b-c765-08dcf2ba7452 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: DU2PEPF0001E9C2.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7P190MB0693 X-BESS-ID: 1729616183-304983-12653-14370-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.51.173 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.259901 [from cloudscan20-3.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