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 78FA245BC0; Tue, 29 Oct 2024 17:46:07 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1031142F55; Tue, 29 Oct 2024 17:43:44 +0100 (CET) Received: from egress-ip11a.ess.de.barracuda.com (egress-ip11a.ess.de.barracuda.com [18.184.203.234]) by mails.dpdk.org (Postfix) with ESMTP id BCD4D42EEA for ; Tue, 29 Oct 2024 17:43:18 +0100 (CET) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2174.outbound.protection.outlook.com [104.47.17.174]) by mx-outbound12-25.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 29 Oct 2024 16:43:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=zVzUQ+IZ1FqoyI2ReMa7Ty5hg2yXO3cvEsKw5/Xl7wqLtRdyUF3eV9jEjJkvyCLqg/Qd3JjAV9u634oW86fK9bfjSPhUWyaUOvS9qw109b7HQeuNsUueNbB0kMFh5kYG9NhrrzwJtPKZ+WpXYgcXAzi+lUU8dKEEcszbEC+duiIBYdfCi9O/n8KUQD4RJ+6/0N1NsXUI8pj3voduPfjnDh5xofzsJXCekPRPsfRPBEzyXdRPFa+lovZ65FbQjEBGn2brZvzcZxKTKZ/Pi+uEqYljtCJ76+fHOJzC3hIKrP2Vn/7OvLZyNcGXWFr6Kg0kcRpzFKVXrcAwMrRFGKum/A== 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=nRVm9urwzpxXv9kknRsGNJzNo2NS3KH/W3Q5xAquDZpkU6BKgc7KlzluQ5aPnMAX6cX86EpYxqPxqpBYIAX/kcrEjqAMSo2xkKMZIqxA4v0e4oWbxIm8951r62upeE0tjciKdOkVMRGxMH0QW2KlFlvXZRBzSip6bGIwBj4lBvA6Bcxw7XqJWDG0e73Zv5gsQev8YStFNBzznEhLxE0yckEjSAhahL6BoAzIvRwiyYMzSksuJVX0zj+9CRF94gPgPqYMyYfJDMVZjHZY0ysGfWYvPk7pWJlnZWtvRQd5VQbTOupUQcDc7Y4xgFeGlHHT9FV7ihDOQElAp0dfyFX3mw== 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=nJUOX4fxyxSf0Nh75S3hilH4slgfafoe8a5C3Ef/Adb8LpTPU49KlLrTB1GcI8KbY9W6jlFxbt2OKtPl9TLvE9sIJlNkOswBrZ5gDx2bu6IYTefBKukB1DTCLl8dprSH2gTLvdKj69YwqHxvgVSD+f8klNuz7qdacxtiIuPBPlM= Received: from DUZPR01CA0199.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b6::28) by GVXP190MB1941.EURP190.PROD.OUTLOOK.COM (2603:10a6:150:69::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.24; Tue, 29 Oct 2024 16:43:11 +0000 Received: from DU2PEPF00028D06.eurprd03.prod.outlook.com (2603:10a6:10:4b6:cafe::9a) by DUZPR01CA0199.outlook.office365.com (2603:10a6:10:4b6::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.29 via Frontend Transport; Tue, 29 Oct 2024 16:43:11 +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 DU2PEPF00028D06.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server id 15.20.8114.16 via Frontend Transport; Tue, 29 Oct 2024 16:43:10 +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 v4 22/86] net/ntnic: add item SCTP Date: Tue, 29 Oct 2024 17:41:26 +0100 Message-ID: <20241029164243.1648775-23-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241029164243.1648775-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241029164243.1648775-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028D06:EE_|GVXP190MB1941:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 2db6b220-99df-4584-1bba-08dcf838c686 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|82310400026|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?vZUHdABA6ZzEfoN8jieepsfoEXO92FmjOc8/rvOAKjMQrWrjj2tCVGUu23Tb?= =?us-ascii?Q?/17+Ebd5UM45mAmQQPErQfbKitY+SGMgU0MSHjXafOQbXxaC6Dribb9jtIp2?= =?us-ascii?Q?u5DIQVSC4H/pLEX5Lp/GI73jTQ13hdxT7ZPc+R+pjZ88bUqpevZwEBhijSSW?= =?us-ascii?Q?Y6AlNyu1OLne8v6ObKMvxD6/cI1YS/qGAZklaXgH7rSDMwc4JH98Ixn6JxwH?= =?us-ascii?Q?gSokdFpLYMD5D58ZTxh40+egqcs8dsFgf/z4Llump5nElXBeyGFZIdAeJD5k?= =?us-ascii?Q?BH6w1hZuThyb+xFCn9MNtRDLADN77kpSKcFB/ua14w1v+cBmh0XY08shmTGC?= =?us-ascii?Q?eVNK84UkBuBTOSJGIcv5rMQOPzGg9UuV0J/YnJm5qOCgETK9BUshbMca/3J1?= =?us-ascii?Q?ssL7/QkIjOa0g21Q27Khe/iavsVmr92Gmuz2lAJvFhMcwYd+dZwYngjKuw84?= =?us-ascii?Q?c897NhLuNfMXH5Gw2YmDLPbFJCZoOKNVorSEbzLmfODieZeYBBXAjHOmODBc?= =?us-ascii?Q?PQhJCvqcIeCAZGV0VSnsem31rdrG56Oen520JSFYawfUB9PobJCwTUXbHCWe?= =?us-ascii?Q?enRI3IPgAgZZHTKhj65sUJiajbgnqrNwglY94RdJpzT5T5RX+cr3JaXHv5gU?= =?us-ascii?Q?ABAQjEf9aaoieA9yo+6SJyKClyZ/f7KU+FE2khPPepZQFcptJkdUlydr96NL?= =?us-ascii?Q?CGZHOWSVIMoPCcWnJnsmoQD5TW6emAPsnz9aWMc7eKptgaQ3GomXj8BzGEhy?= =?us-ascii?Q?FQhFcLyXaYiSE/hF5mWdKYCc2+4e5thcZw4/jJp06h4S7b0sOBnxVkL8b9p6?= =?us-ascii?Q?Um1D5VZm3Nf/NHSbSR9bKEL5IUSSgSafzvRxTn3Zf25CEcnUvuOTZSW/St7Y?= =?us-ascii?Q?MkZk/+N5LrNi1WvjfNNLAfPdhfxl8nMczmxRdfLKcXLvyLg6K5tNuKgUbjT2?= =?us-ascii?Q?Z1gmj18RNWm9DA4Gi701lYz9uDaIUNtPHK27stp7FKydf3Cbjc98CwZ8U5KM?= =?us-ascii?Q?YgEP97QdvorbWU9OGzJ5UPnYEIJv8jiQey0xjcNPHxEM96MsgWfkKnW+x8QX?= =?us-ascii?Q?vZcyRTDKBtSnZC5YWvFQ8xHMqqN6G1fQoFKFlL7OFtPOLXCKB8UjtJUl07Sd?= =?us-ascii?Q?pdcEmPxoazNyEVMa6DZ0bgFbkP6xrFy82tIRdIO4+FVaW7Prn/4plbXVB88R?= =?us-ascii?Q?+6g0lM+IHQkPziWUkV5SqT7FmNHRU6Fcz+vTK+oCLfIALW+vFYI1H5cE6Lk5?= =?us-ascii?Q?fWO0114YU/HGU64hNytXUZofHRnSms5iCeB3RnfRw6nod4PH0KmIltED9qtf?= =?us-ascii?Q?vxX2bpHLuUfZoYKl4RPHcUn7ZKrtBShzs7dD58E6OjHCSEtFT9oXuALWBvlS?= =?us-ascii?Q?Ri71odZ2z48VZEXgEUdahAOR2eH14CDU1/tE623fJiYb3YmYyg=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: aMMDJAU/hfisskQsqwqlCFxVhxEfz9xZEm1ZoXqlntNtT5b6BeXvYPZumlhIccfPgTw/NNN61RIaRRR2lFg1MirDcsK3iUgtcLWwv03QlCQwsxuCggh/zMF4pqUSJ34l9ze7LHa8P/9d0oUDIM8Z/tH3KcxlRM+lIjheIWSNCB4WrNFMq19+fakXjhLnJ4j3yD/teyLWONIJKn1E1IrnXSLAJBPA046rU3qN4YchgQXzij3GiKzaPyXjLV9dL2HGtiJuPiMfMynlV4NrXhDsiebx+tgPYS95XCSmYIo62iRU2TIxrTfNn2QmAho7s1VWkR2x7YfWe548V4WYjkNcPLVo0wKI912w3FwQ1CFt0DVFWaIZLZFgtvwDsUS6Ptbe7FG5oJ8U3IGeX8e/rD6tSf+naZzOBnxv1+ONGSfz455CGCabffcRjbXL2Dgi06xQn3RW0v6BRuUVTFtCejLJ9Dqsf7OijMBT+L5fclHwMkOezZ3FlXuvSPYnMt5WvWojxm/xiEXOZALC4uPfOp224mlDrQvE8y6DcZFyyLkg2QNj728dL4S4BExajSR5Juc+6PYCrti5Dw3BR/qUNx279fOcDGlxEnzQijweI/47jpdS665P3Pn0lxcaRJc2Mq7hSUO61zS+VvhaLB94hjFkS4eKZy7cAUs3+LTvuQMuPTY= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 16:43:10.9333 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2db6b220-99df-4584-1bba-08dcf838c686 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: DU2PEPF00028D06.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXP190MB1941 X-BESS-ID: 1730220195-303097-12762-29338-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.174 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.260063 [from cloudscan18-73.eu-central-1b.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