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 AC02445B96; Mon, 21 Oct 2024 23:07:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BF17940DF8; Mon, 21 Oct 2024 23:06:03 +0200 (CEST) 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 1229140696 for ; Mon, 21 Oct 2024 23:05:51 +0200 (CEST) Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03lp2239.outbound.protection.outlook.com [104.47.51.239]) by mx-outbound19-70.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 21 Oct 2024 21:05:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WZqtriFWY5O9iebDZ9mgpcy+wSkbjtgPUJseVKORfeTYNPt1zQiIrpai6RarbRPC0MyfnzjIflm+XssOLZ8YH/AVsEBdG5JipG5xHwSfuykuAxxlCMpzJwZTKbl9yRcn94IUy6Vn6kcqH4FqY25GIdHuTDlMwrDTX3wasXgCn81E+442f4pzT2fJjDzrMZstN61T7GJ1X4kyC4eiaCnMeRO16t76/s+lmvqb+9ahcovDq6sOwo8MoiOVuonvgJwlBELv+DJJRBgR6bX//HewYQapCfQX+hvYulbEBOfStKCbUFgH2eXC/lZSJ3Pbe6jDbpbkvnw1nQIxXIRoBOILoQ== 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=yAgABWyt++haY1F7SfJT3OGK17kgi1CSQ5Cukbv1WH8=; b=eesBhsP37cOLEv/KcdcHI8zhGQ9NO21ykfCy6F9bMv5D9ar8zuIstyFv2Lbz1lA2f13DOz5hcg7xJBroHga1z5URkeAAIc8V2q4SDKAx4s2TWEdIIRGZj2WXopeIjj/Vq3hM1527MvyLJkBioYtV14Euj/mTEdbEDxiKrFUhC6ylAtok5nFtEpkadzzC4wFQ0f5UwAmDPzhx5BuXKujx0Pb46UsYyOZ9DM6A9ROML2jDePE9dzAs/5brUq3FERsuSQJrWPTSzE2hj1xs1IRHEaAB820HMJ1uJGTair52iKQPbrrDT1HhPSPJKWP9j0IiZWAYwYjNyFyvQKE9tbLEqw== 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=yAgABWyt++haY1F7SfJT3OGK17kgi1CSQ5Cukbv1WH8=; b=ABJpsBHjurwdf92JD0RfvLsWoI/sMc3QT/HCSAgWnHNY65ofvKRgXCH2a9kTiimaYEVZARadp/X6Bv/xenrWz1d7A1NzMuT0SyQP+4zhKDkJrUBu5Mc9vNF3P3qGbieSELK/VtxrxwiKMCkFHY9ray4vhe/Dua5DsOY+4NMNaWs= Received: from AS9PR04CA0142.eurprd04.prod.outlook.com (2603:10a6:20b:48a::16) by AM9P190MB1041.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:261::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 21 Oct 2024 21:05:48 +0000 Received: from AMS0EPF000001A8.eurprd05.prod.outlook.com (2603:10a6:20b:48a:cafe::9c) by AS9PR04CA0142.outlook.office365.com (2603:10a6:20b:48a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29 via Frontend Transport; Mon, 21 Oct 2024 21:05:48 +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 AMS0EPF000001A8.mail.protection.outlook.com (10.167.16.148) with Microsoft SMTP Server id 15.20.8093.14 via Frontend Transport; Mon, 21 Oct 2024 21:05:48 +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, Danylo Vodopianov Subject: [PATCH v1 22/73] net/ntnic: add item SCTP Date: Mon, 21 Oct 2024 23:04:24 +0200 Message-ID: <20241021210527.2075431-23-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241021210527.2075431-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF000001A8:EE_|AM9P190MB1041:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 441477e1-3c20-40a0-6d03-08dcf2142387 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?UPe/C4341C/BxF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cf?= =?us-ascii?Q?TQESAJbYQoZVQauslM11hK7zLPBfL8rn/4wACe3nj0MFupU6NvEWLfW3bb+L?= =?us-ascii?Q?gAzd9kgUpTg63Q50dNbCpn9L0uyhnm599GvARLCKmS7QMcVk/rB6Nfxe8gOx?= =?us-ascii?Q?B7lChQGsHVvZV/5wojmPp15ltUOTQuTGvMg9/hLAGydj68tojFJ6X9KEHqC7?= =?us-ascii?Q?uxLj29sYn+3U/Im+0ozR+LvqLxccv7HRq4EZHtG4GQbxaC8vt63cCZNCY6k1?= =?us-ascii?Q?zJ/NaMwF+ooZUslM64YRlQbhpdZur8OHVGQvDpe7MApfApFG8UINX153sKXu?= =?us-ascii?Q?mkdgUsn1ankAwn6hrHwEU026e4eFuEBshZMSmyQ4y5pZ88zOZEiwRfjnXBuA?= =?us-ascii?Q?yj+3J7DGEYgrpfRb7phtARAM9X2dkYaENlOYpiiAFMavDfdpmxttvfzHDS0u?= =?us-ascii?Q?EqidYfuVfzBvZstehBiRzfDOY5bvktsOGkzzR5v/NztWfvuffKLbfSDGRsiy?= =?us-ascii?Q?9SjF9wuRdaVr2d3NaPMEjY8v4H1Go13PyUzwBbS1eiz3wXtEbQ=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: twGYrlEz89oFUn4mNkblU79DXdNzayYy3aguaqctgF8fBVB+xpDXZklK6KvcpBynLE4KsA8GG1xcliCPfRs3ReljUBGCNv7LHAiQBAJiblerMcoUJYe+e3v6se7ndH3WW1GZZJLwqCv47c3Y6pOVQ1x5uyIOZkyj9CBt4UyQpZIHFqq1dbXx2k+RfW7uZi/mVWdEznt2d2Rme2PmeIo2ojrYvj45oLozaFWa9RBmSOrTbee0OpNum4+5metMjX+msfounx/thXzcIINi/BJmxUWmYFx/21jnn9AaVzZviiaAQsN/3OGeGupeK3SxKbznvcbdR83D4u4+prhXogzsTDdInsYSAfmTcvKYuY2fZHVPVwDTtqV1zODp2Cd2lkJNHHZ3DBREPAeOL1xqy6HADyyQMShW3gIjjGcw7mqLIrtP1LyosEe15vKXdFScKMyF+EHJsA8KQJaIXBjDH+HbYrbbE6tV66bvO7gXBTR/nVZozi6MuVvxPWWCgrwAiToQPoSP43FbaSV8wGbdLbGi5SBdKgbXUWHKCxn4JkEgWhpOTIIpE6rz+UkKXJ9LSke+3KIYcYvHNUJgdu/17Bd78J3J4R5D6tWWuqk9b4yo9hvzVfzxjJXU5RN0iezVY6smc192JlTwvN9CGWkFre5HKogRCx8PMSkXdFXHPqqiN/A= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 21:05:48.7550 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 441477e1-3c20-40a0-6d03-08dcf2142387 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: AMS0EPF000001A8.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9P190MB1041 X-BESS-ID: 1729544750-304934-12655-45448-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.51.239 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqbGJgZAVgZQ0Cg1xdzQ3MjQ0N DCyCLZMCXF0DjZKDE1zcTIOCUx1dhQqTYWAHGgbJ1BAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259883 [from cloudscan17-111.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 cd5917ec42..9e680f44e1 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); @@ -1259,6 +1353,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; @@ -1273,6 +1371,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