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 0518D45BCC; Wed, 30 Oct 2024 22:42:34 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 75007434D0; Wed, 30 Oct 2024 22:40:35 +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 1C08A43386 for ; Wed, 30 Oct 2024 22:40:17 +0100 (CET) Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02lp2040.outbound.protection.outlook.com [104.47.11.40]) by mx-outbound11-85.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 30 Oct 2024 21:40:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lRyPJCUhJHhCyGAl//vjY7OaZg1ejXgBQlI88O18KcB5a0YjUZnmPG8BSCBObYkN3cjp7UG9O9PmQDn/cRMZzx1PDb2A7s9sXp5uEse07AC9guIwxIlUniXYotNqNswK5fcI3glTz30YhliDBN/OFStxHClInjk6Bgf2iJEMZF9bHgA1S8EwDKPbthrwmCvUTrfwqZhjpioZRYnuX3N/10vcAz+uVheAqaPpKAtusd7LswGy+D4nrCA2DSClC2vF5xP3ScyKK2YcC6tG21pQEdsD1WR904sLEvfdqLWN7/F0Q+lafhbCDG6W4Qc+27fsr/HKnVdqk8gwlRgCBtc5iA== 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=XwKOs9MpnvaTsuvkpW2hLvd8myHvQdcPA8rTnU25W18=; b=KsOB7GhV5NOvaP2ighL/Pw+EMakwt0iaRPKd8rHgK6xMpqmLjN6eipVt4hnqY/q5hnbE3AMiqt72lfwO2JoRmqOPjbx/bl9ZWpboeGaU59AnBQLi0b8r6tHZLVpz/L1czyqjLTtHDbLDvBTxdRUIJD2DxUxdWzqO3cySGzEf7edm0k/oQZeYW1eoM09WwBzd+KxWl0YcZqoVVG33MyQyFF+33dZrJgKhOJqiw4hGCD5BuDWrp5bgJVhq6JN5lxFhY5KdYixnkIdK+zjqQfxZC+gPtraNpOwIHM7/8gXua4JDcfS1PPrI812Nuh4NqoMPxRIMVtBRa+4hMmwFNxVuNA== 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=XwKOs9MpnvaTsuvkpW2hLvd8myHvQdcPA8rTnU25W18=; b=pYE+fyl9suiSx2hBRBmP6jNjy31KrCcreRxoKIRxJC2iImfoW52nc5HfIQe8Tlg/YbcnTLk3qVkR1miqM6eL8u6uNO1JoahCUb0gDPkw537GdfswGxDbQJt6aZYScdw2pZGkYkMx3P36egy8Dtto7Z6aQY5ohJMEyNDPOezWcyU= Received: from DUZPR01CA0012.eurprd01.prod.exchangelabs.com (2603:10a6:10:3c3::14) by AS8P190MB1095.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:2ec::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.27; Wed, 30 Oct 2024 21:40:12 +0000 Received: from DU2PEPF00028D13.eurprd03.prod.outlook.com (2603:10a6:10:3c3:cafe::9) by DUZPR01CA0012.outlook.office365.com (2603:10a6:10:3c3::14) 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:12 +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:12 +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 22/80] net/ntnic: add item SCTP Date: Wed, 30 Oct 2024 22:38:29 +0100 Message-ID: <20241030213940.3470062-23-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_|AS8P190MB1095:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 6180813d-5d1c-4b8c-6ee7-08dcf92b6f37 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|82310400026|36860700013|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z5oHcf93EiVl6e2HFOBpuSYPiG/1Et+ujjKHNL9YT91MCcDfyJG0E7bosZ?= =?us-ascii?Q?mXv7zU35Q2Cmr1OqfsiScwCUU83xjXouV/7G8IukgODkX5EmcnNhZLAiqq9Y?= =?us-ascii?Q?M+T6mXa7EuvA8yMtiTjlQrOVEglJxMj6uGKnkFkvTI1rt1163Kf0uC0JJkZU?= =?us-ascii?Q?ars969qKjUiip9SBt0N9yZlS15U3P4JNTN8GuOxVZUiM9yppgv4ajAqICmWx?= =?us-ascii?Q?G8ueszciXiDayMx0/ZLYiRkAbkQLYJrpou6mwP6Ll0Z5hD7xyF1sgdKYzJU+?= =?us-ascii?Q?KJttUBhvAlMgdHL6z+gCY/+A4gQvMMn5bVJNphveGBb2ws5UD57O2lYhupNr?= =?us-ascii?Q?W28nptYL1mzs3cwkYNbdBFM0BjzuvCskfhWY7BuUnXp12TbIdyEC6rntXXyO?= =?us-ascii?Q?xsqzznO6LSdhQyPCKnhR2nEQpDbtBkfqjq8u/qPxBMz3Ywuwg+cg0RBIKOHu?= =?us-ascii?Q?/cMjVMduMNEFAz+z0vanXbHrM4bc0/MDcuCkmv1RM5B3UmjN5fOG0gk0w5Ol?= =?us-ascii?Q?FPaw2dk81RqSXN11dL/6GYP81Czh2Vr3nxt8H6zNanK1FAyZzg=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)(82310400026)(36860700013)(376014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Gb3VgeXpvZdq1R7TBqUJj6E49GvOcMIYHyOntC8wXfHEkLF72wBM6x2S+FdugiIeqkxTp3zM0Oo0CBSKmjzRPhGscYy3ui1muUFWwK/ogQqto+BfHLa8gebCOMG65DeMF8xdGB6qvofhqjDm3I/E1nAjfNC/4DlSPZOKLX1CbfT/FAOZIYZeDnMgSBFZXiiasqCFCDxxrTY/Td49/qanxO0i29Q6brkXF7mi1zfvN7pWiUBUy9YOVx4AkhxcuFg0CPNi0GIfvYGxteTZupPy8YQfn8bNfEH6AHV4gXW2SjMfgjYrCbaonuYoyWZERVsBxrCxFS3BX/6dJfYCO9BMDNvlK+1coLNyjFGKaTu8RiYKrBuy3Ig9WUFDOVb/Azy3uet/1+hIhWYQqm4S92yiRrtXYdcGjxGOzApGRu27/C9/xqTLY4MW4E337RcqQ9OJZn+8G2kUUE3ZftWhnf8ibUMwU3+Oim6wy2/t2aNDe03uNeQhWP+MtiMIJSq/RPXj0nC6g2vJw1lmvjHuQbimLiDBVYlw9FTKpOYhCW8PLhpuwIGlZLwswa5gLHThUA1SRTnLA1q8eXzRkI92XOkCJ/NtyR/iDV5NRj4H3Hgso9p2uNTgXCC7mkLrBQnif0cwnGd2if2+hdAMCQF+Ir5H2NynTaYlOB3oUzkpF2ckyzw= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 21:40:12.1612 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6180813d-5d1c-4b8c-6ee7-08dcf92b6f37 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: AS8P190MB1095 X-BESS-ID: 1730324414-302901-12794-43459-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.11.40 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqbGJoZAVgZQ0NQkOcUk0dwwxc zCxNzYJNEsxcLI2MTU2NDYwtIiKdVYqTYWAEKSz/1BAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260091 [from cloudscan15-95.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 627d32047b..26e6ee430c 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