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 1987345BA3; Tue, 22 Oct 2024 18:58:50 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C116F40E32; Tue, 22 Oct 2024 18:56:41 +0200 (CEST) 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 1E93B40DD8 for ; Tue, 22 Oct 2024 18:56:28 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2169.outbound.protection.outlook.com [104.47.17.169]) by mx-outbound40-26.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 22 Oct 2024 16:56:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WxmUeaK+azpchDBype5G1noAu+YAJmFweMAFcq1NcYR3DuBbMrmgaJwSwBEcfrq6Li1sEVJyEOlj5AzEK0FZNo3oFsqd6FYQV/NWy39GTSQ7NcLIVFxpKnVW9/TPwV8TMcLL60HWF8laYyARtiTLByVyj4JQ1B2Rn/4GNfIv2FfsmTFgWDvMVAmL90YY/PwRfkiehV5KxHMPWQ9yV3lwXu8ZNoFgcrkPd4Xf9/FpF2N+rWq04pTzND0amCm9b9XI5VYOZO8leNKFLXEiO6OAiGW6UnWZkArKqv1LNHUfHisHVmOVZSUdWE/bkWOgouVAt0mzEwC1rzJuQw1W7WC8tQ== 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=wZKzx16D0OTjHTSqAYb/tKA9hpA6o1aCSzM3D55atVg=; b=CbRbvDWsBtJG1YMEvo8eQysIM5rpNvKFyNez0fKdG6nL2T3bwK/4uexHXx0E/OMfuAwhwzOI4IFIWkGT+L52W52BruaE81pVIi1AuVmbK+ayfDCMFilAdimm3FxT24WW93lxNUCX4FGkrxswdQBaQ9I0n1FOBioyCGRO1WVkUhjXh9OdKB28JjpgmUNkGIWTcKfZyeu2gTqU/e2KWP3txKXEeLvsLzPipqDntCgjc6aYVveHDnC+6pisFgcFIQsRmOa8ePrH83GMgZtV26kTLpBB2p2GG4Geh2pNHPssioxXZtwwjdlwBWTztIRU+ngHzKFfPpvy/WK16verROfitA== 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=wZKzx16D0OTjHTSqAYb/tKA9hpA6o1aCSzM3D55atVg=; b=JYY+Ey91RkCKeymNb599ekB5sMxdh1cvADSBDPiBnGld+i8En3itpdqvokEVd9gKWJSBp5B0PEnnYk9gVvUhAoWaxQ2qL7NaZElYYiiBONHSdpmCs42IqwQODZ6PKc5MdEabdaD8tjvMxt8P9734jo2lvKiArVICI7sNzqTdITA= Received: from DB9PR06CA0016.eurprd06.prod.outlook.com (2603:10a6:10:1db::21) by PA4P190MB1264.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:10b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.27; Tue, 22 Oct 2024 16:56:25 +0000 Received: from DU2PEPF0001E9C2.eurprd03.prod.outlook.com (2603:10a6:10:1db:cafe::c1) by DB9PR06CA0016.outlook.office365.com (2603:10a6:10:1db::21) 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:22 +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:22 +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 22/73] net/ntnic: add item SCTP Date: Tue, 22 Oct 2024 18:54:39 +0200 Message-ID: <20241022165541.3186140-23-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_|PA4P190MB1264:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: b14151de-7478-407d-f692-08dcf2ba7564 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?urFOAEFSWmanc/As8YEper3lY43OrApyqCC3UQOS8+O6ww3Eyrqg687ArALj?= =?us-ascii?Q?wR0Q6sfempBYQAiZOzh00+B3VqISfsP00O0oAKXL3P7/nAvXU6lrIdP8NIMS?= =?us-ascii?Q?3llW6MXkLMO7wmKoXa73ybYegeNYK4JDFk9yv+VVKuJIURhX5W4GrNG6WChJ?= =?us-ascii?Q?L6FI6OsKxQtZim2UH/h93FlkVHQLolfsWQv/japzfm4/06CvqDkSDK+1parD?= =?us-ascii?Q?SQKfIzw3Dx1fhcYdpyLk0rYzpICCpwKmFMhFpoEXq7V3U1AGt2soMwHW6fmB?= =?us-ascii?Q?kV+be7v7VksLNn9ryQLQbW4j07tqDIQDvnFgQc0JI7x5CjoTq6C31a43KEXi?= =?us-ascii?Q?OaLkuBmU6PTI0m/PLbWxnKsTrEgh9sK2yRjS6S3fwJCDDt9hUHQ/8jo//oUu?= =?us-ascii?Q?hPAPQMT9pOLO3MjHHRqkUE8nnV0FNltoKQsoB1J7KvugJp9rgnydf0je1aQz?= =?us-ascii?Q?KWSjeHpy4p1pIcl6+kmYNxnk71Dpc2rWzsJhK1/zt1oZ/fZGfi7gJW+LfuFI?= =?us-ascii?Q?GgN9oWcFrHheC2k1UtNFC7Px84PjRvTTv2Q53ArtxjB0ACQamZhJwPUsxkPj?= =?us-ascii?Q?20ny6RG8HzcPkt97dkZ9uhCKmpjJKzDpYpxkF+ACSwANujiujWrOZEjxWlTD?= =?us-ascii?Q?+b15IM/XoT/PbbBzGU+1YBX43MoQzeRbhtMH5xsmjiF8zu05s0K+Lzu2WwCy?= =?us-ascii?Q?bZWEcGglzlCirwH0BpBP52sHyyZ9c8O1zbWAGo8ceffG+fqOwk2Hqnm/+JtT?= =?us-ascii?Q?O/4am3vYT5wYelDQpfeTb5OyKbHxBt64ActxFjhm+etl41j5DuU8xcslaT6b?= =?us-ascii?Q?sTClOiu2AiS+xIO7zvRv9+0NzACtRb31V3EapMRGD+XoyeCTKuI+REaFNbp/?= =?us-ascii?Q?qhQouf1MuOWBIMir5i2uyL7gkaiLtaN7z2c7cMuGuXFXqFuAfFIHOmoRYJNB?= =?us-ascii?Q?xwm9frmVesz/xI3V9Km9v5+QsTU+vsoTrQh4R6vF7Z5yuxaMTcez4VYpIK/F?= =?us-ascii?Q?9FiXj+fV07Oa4jSacRv5KdlBrA0zau8xmn1zuvDl8bKbh3vQSVvetLLf/HAD?= =?us-ascii?Q?qFNJz4jlo+DNzdT/st4KNsFIjEWIpeKbTSyWbQAPz1FFZggT2rjsJiIkUvMf?= =?us-ascii?Q?Ki0WTScC3S/Fbp0u/mYbN9KvMbNs+CcMkb/QNzNaBD8RbI8n/bNj51urSXl3?= =?us-ascii?Q?+sneZaqi17yOi030PsaN/n9Y8QHmhsmdR3c0C07jgC9ekloM5feDd92gP+Iy?= =?us-ascii?Q?dcq6MzxVCQUP8ERqHfzwqOq4jOldsmZe6UnA9PPTwWjydeE5YOWrE3w17zYa?= =?us-ascii?Q?PQ95eaYZXraGyOAsdBZLpx/eVyPUnL8POuhmRpP0USxhyLeBhxMMFvS9/wr+?= =?us-ascii?Q?sktFpkK1OnCseY/e3RHQf21J04H6C7b1mp8jGYMu2KBZV/JqJA=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: jsxfUETBNMXDu/3yOpQaRQ3WNrE9k/60sQieuPTsSz1l67d1r5EGwydSxDoULXLYarLaBlAm/QlGspvWHn+DhBDm/gA5OrEkZOBjJmos5SoK4IDQGa6i5coOS781IhkD0Li3zDnv4w0SqlKtKrdzvHr8GJIdv3HS2yiLOzBg5KEJpGfxluMpejF25QHGMrw5PuuwQUEBysfAf5H/AGXDD0PO2Gi3AUqEMtCuAgB3lBzDF+MKkA2BJF265d50ZzOorene31SP8JbZVue1FNbwB4KsH7TKMLB1YEofM1UHIgSg6No0vYim9I+k1Vy3098Ct93AE074DniBcJ54WMaoaEwp3xKFfRFW4V6QDow+0aARgsN6Dq9UZdUlg3ojuEIlw1SKdvsIt0jnW1FY/0+8/zvWWzuuwKG5sPT5hqNqe1L1yVRcYna8acLVkfHxwbgPTfvLRJ4WPbuw1abq/dkWm4nPUfK4Rzy413qN0rtE8lC/43HcKIR267DPEv7JDHSWb06ZWnWe1cVDRzYonnuV/NeHTJiizskcmhFIWaNRpbYOxbrvV78ZOw0gYCGi4AVtUMW921JbOwdLZBttnDrFfXPq87H/7YpOLx/JbxZJ7TyPb316pJ6SW+K4Cs2Uz/V7GrR+TvMuWM7+3bGgUUVEYeV5TZxJ1rZ3nte9eOGKtu4= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 16:56:22.4032 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b14151de-7478-407d-f692-08dcf2ba7564 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: PA4P190MB1264 X-BESS-ID: 1729616187-310266-12658-12988-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.169 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqbGJgZAVgZQMNHMwNjI0Cgtzc gyJdnYIMkk1cDcMjXVwtLczDLV3NxQqTYWAB8sb8ZBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259902 [from cloudscan15-77.eu-central-1a.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_ITEM_TYPE_SCTP 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 | 102 ++++++++++++++++++ 3 files changed, 105 insertions(+) diff --git a/doc/guides/nics/features/ntnic.ini b/doc/guides/nics/features/ntnic.ini index 8b4821d6d0..6691b6dce2 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 +sctp = Y tcp = Y udp = Y vlan = Y diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h index 82ac3d0ff3..f1c57fa9fc 100644 --- a/drivers/net/ntnic/include/hw_mod_backend.h +++ b/drivers/net/ntnic/include/hw_mod_backend.h @@ -169,6 +169,7 @@ enum { enum { PROT_L4_TCP = 1, PROT_L4_UDP = 2, + PROT_L4_SCTP = 3, PROT_L4_ICMP = 4 }; @@ -181,6 +182,7 @@ enum { PROT_TUN_L4_OTHER = 0, PROT_TUN_L4_TCP = 1, PROT_TUN_L4_UDP = 2, + PROT_TUN_L4_SCTP = 3, 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 7c1b632dc0..9460325cf6 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 @@ -1017,6 +1017,100 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, break; + case RTE_FLOW_ITEM_TYPE_SCTP: + NT_LOG(DBG, FILTER, "Adap %i,Port %i:RTE_FLOW_ITEM_TYPE_SCTP", + dev->ndev->adapter_no, dev->port); + { + const struct rte_flow_item_sctp *sctp_spec = + (const struct rte_flow_item_sctp *)elem[eidx].spec; + const struct rte_flow_item_sctp *sctp_mask = + (const struct rte_flow_item_sctp *)elem[eidx].mask; + + if (sctp_spec == NULL || sctp_mask == NULL) { + if (any_count > 0 || fd->l4_prot != -1) { + fd->tunnel_l4_prot = PROT_TUN_L4_SCTP; + key_def->inner_proto = 1; + } else { + fd->l4_prot = PROT_L4_SCTP; + key_def->outer_proto = 1; + } + break; + } + + if (sctp_mask->hdr.tag != 0 || sctp_mask->hdr.cksum != 0) { + NT_LOG(ERR, FILTER, + "Requested SCTP field not support by running SW version"); + flow_nic_set_error(ERR_FAILED, error); + return -1; + } + + if (sctp_mask->hdr.src_port || sctp_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(sctp_mask->hdr.src_port) + << 16) | ntohs(sctp_mask->hdr.dst_port); + sw_data[0] = ((ntohs(sctp_spec->hdr.src_port) + << 16) | ntohs(sctp_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(sctp_spec->hdr.src_port) + << 16) | ntohs(sctp_spec->hdr.dst_port); + qw_data[1] = 0; + qw_data[2] = 0; + qw_data[3] = 0; + + qw_mask[0] = (ntohs(sctp_mask->hdr.src_port) + << 16) | ntohs(sctp_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_SCTP; + key_def->inner_proto = 1; + + } else { + fd->l4_prot = PROT_L4_SCTP; + key_def->outer_proto = 1; + } + } + + break; + case RTE_FLOW_ITEM_TYPE_ICMP: NT_LOG(DBG, FILTER, "Adap %i, Port %i: RTE_FLOW_ITEM_TYPE_ICMP", dev->ndev->adapter_no, dev->port); @@ -1258,6 +1352,10 @@ static void copy_fd_to_fh_flm(struct flow_handle *fh, const struct nic_flow_def fh->flm_prot = 17; break; + case PROT_L4_SCTP: + fh->flm_prot = 132; + break; + case PROT_L4_ICMP: fh->flm_prot = fd->ip_prot; break; @@ -1272,6 +1370,10 @@ static void copy_fd_to_fh_flm(struct flow_handle *fh, const struct nic_flow_def fh->flm_prot = 17; break; + case PROT_TUN_L4_SCTP: + fh->flm_prot = 132; + break; + case PROT_TUN_L4_ICMP: fh->flm_prot = fd->tunnel_ip_prot; break; -- 2.45.0