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 C6DE445BCC; Wed, 30 Oct 2024 22:42:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DF8A84348A; Wed, 30 Oct 2024 22:40:32 +0100 (CET) Received: from egress-ip42b.ess.de.barracuda.com (egress-ip42b.ess.de.barracuda.com [18.185.115.246]) by mails.dpdk.org (Postfix) with ESMTP id 70C184340B for ; Wed, 30 Oct 2024 22:40:14 +0100 (CET) Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03lp2109.outbound.protection.outlook.com [104.47.30.109]) by mx-outbound17-81.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 30 Oct 2024 21:40:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NvMyC/R6iwOc019sZYxZiQb03UXyKd5XuKA8egHJBccvej7wf9M4rmEm5fo8aDqB9Ni7ySZlK7NtsNotQSxZ4uGXCxsC3EmhAKf2FsK68MPoEtFGiv1kChNx1WNscjHnMXNISIKONsCc7GS9R/CcTYy0yBgWNC+PWmotkjN/6/sPv8O2dN3yb3xYAccKRfDdQqkwCINNePb7NbzlNGWtumTVAsUrHiybwbsch+Ms/w87qn0PU+lPqrcEk+3rXheY8i0TgUEFAOjtF1+JT9wlfxgv0RZUytVyKU/5UDKtPkYqLr11PjQM1wNc/e30HEUnbEFY+eV+amQjntw20yGUHQ== 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=NeykQSfDni396lBLDy/Kt1CYB+Mm8YBjcxoHexhNkfs=; b=Dxowr9094h3xaSEmaU8NSIWbNsi0BL7IjEp2YQnV9tgbFCyNllek8Uy3/KqieTz9/CzjUGQ9kexG3pnHWdbQinZYaNSdkh1pK0X14KnLEVg0CqexZFtDuaup3LqveVUKfnYlR4ia54rfu5kNqAy8Fp0YRgSv096USr4UMf7YUQaKc9wDK84n6Tjh8AS3v2WHaWzXuXRmj4Yndf1DMn9/jb9oPrZWZdgF+R9g6Ud6UiHe21jickD18QXz8cFxtkW6MPe2X3C6aijKXZgGav7WvqlYtsxkw7dMUZTGmaXo2zNNbFd7K8yhdIbAWm/PDPMZdiyEADnCnNDazZSPKhnJdw== 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=NeykQSfDni396lBLDy/Kt1CYB+Mm8YBjcxoHexhNkfs=; b=YlBj6v37+zhT5kyigfE3Hd1pSuLFMUUiA7ik2LmkaEGkh9wsauTTeXLsDUt61MpZSXSooK9iBi0EskdekGfdBh8HQghuRi620ZvMR4y+VFYJFl/anlTwcJSasJcZtjqueL6uTtccp9BHa0Yesuw+EZaeAneeyboxpLqbrQlv0lU= Received: from DUZPR01CA0013.eurprd01.prod.exchangelabs.com (2603:10a6:10:3c3::6) by AM7P190MB0598.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:11c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Wed, 30 Oct 2024 21:40:10 +0000 Received: from DU2PEPF00028D13.eurprd03.prod.outlook.com (2603:10a6:10:3c3:cafe::2b) by DUZPR01CA0013.outlook.office365.com (2603:10a6:10:3c3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20 via Frontend Transport; Wed, 30 Oct 2024 21:40:10 +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 DU2PEPF00028D13.mail.protection.outlook.com (10.167.242.27) with Microsoft SMTP Server id 15.20.8114.16 via Frontend Transport; Wed, 30 Oct 2024 21:40:09 +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 v5 20/80] net/ntnic: add action TCP Date: Wed, 30 Oct 2024 22:38:27 +0100 Message-ID: <20241030213940.3470062-21-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241030213940.3470062-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241030213940.3470062-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028D13:EE_|AM7P190MB0598:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 7933f436-85f1-4263-e094-08dcf92b6de4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|36860700013|376014; X-Microsoft-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OQuUVzHAELVec7D03R1IV1im1m7bSlYgJsSH?= =?us-ascii?Q?THz6Ii0gxZOiHYmWPV+xEuI7bdBxWN1E1vIEolsDsZhoxpvTjmqubry/7iSp?= =?us-ascii?Q?bUTbqpHBK6ojNSFM0yuQ2MV1OsZOzNc6XoAUQm2HSuNJ5t4Q7E6rvWfqsO8Z?= =?us-ascii?Q?16wtNDBYiMASTeMcWcwaKJWoFcthL6IzdI2N1kfFe6NvDZeb2BOUOBpXa+ee?= =?us-ascii?Q?65OAGPXxralwwdpXtMotMjL/9vCJS/4MGTS69uYOO2HT0uARUptRuLW98l1/?= =?us-ascii?Q?sdQL9REW8t3JH9SWQlnhuYfi+3leN+qAgZOntB81U4BydnZW4sPKOwE1pc7L?= =?us-ascii?Q?3dbljKEaXrgnoSiAzQtQKrVD88v5YrCc0n4idfKBdtDIE+bB7+iXrG5o3F3R?= =?us-ascii?Q?l6dvUYVFZl7KxlRQtFpHIOb68Sebb+/vqZ7RA2t26saKhdoDnhBwZ60PmnoT?= =?us-ascii?Q?ltnwR8u/KbgH89CdiOxvT+pzIhU5uLOYr4KPKqE/np1pl7Rh3wjcArfuAV78?= =?us-ascii?Q?ehqpQoaeY3YU4EQTTVakLXb8bDWFe2MzYCItrZDLkF67bjGQ7g=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)(36860700013)(376014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: G+be+VayYEuJNVfwfNG+vWTLkmZjiB0WkFbmpiufTQ4cXd6qM1ECpVb2IfweF7zgXB4rMMrQVuLBDVhAjWc95SwMcdDSuyZ+NnseS+Z2DbbBxjy6+17o65jHzJwGsdz1gbF4lx+uAADx1ncfJX4HJjyEjKG+thYNsWj03LbITAKkfNMCAFNXSGNu6TV3wjAZwJC1ciI9SsFZp3N+1PE9BqjJHlQ17hzUxSO9zOr5WAgWhxkp4p8O7L9B6H25Auzl7nltbKa7LYBxN53QbeWWh0E+btWsFWTs+nGHWN/+nJbTnl5bh+/mpJIoAcEccHoSvdipaxxpmuBbqf73ooE6whQ0Dz4MyDBZn46ynUzMnAkVOyigh1mNh25u2bbj3TzWONoaAl/QBwi0irpZY02SMHPmyN6wLK/ulIwuFAYG3wVU6TJtUZ8uvdMpg38K2Y5I7Z0DP+yxYNCMHEB7sE45+RWTqATz5P+qY5i4kg984j+mJOfpzsjQzg4HBVHCcv+I7dTfmsTdpJq0sKca2Rlvm6MMbG8NCgMCCrXxKXTcZ1auMjtccdbW7vT9GpJQI579KsfxcCMsckBjiLj4X+P35z7zy5XWc+XOFnKQA5W5+myKedXRoRsD4T1FAlI3EGopPnzxzwF+S1b5pBWeBJd3Wpf9wWdPSYglJ7g7Esbbf+M= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 21:40:09.9425 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7933f436-85f1-4263-e094-08dcf92b6de4 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: DU2PEPF00028D13.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7P190MB0598 X-BESS-ID: 1730324411-304433-12636-44616-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.30.109 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqamBgZAVgZQMNnUODXR0NTMKC nZwszcJNHM0CjN2Ng41dzAzMgyyShZqTYWAOT5PRJBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260091 [from cloudscan20-80.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 1a92de92bc..4c3844e9b8 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 @@ -1023,6 +1023,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); @@ -1055,6 +1155,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; @@ -1065,6 +1169,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