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 A7A9F45BB4; Wed, 23 Oct 2024 19:03:26 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 63EF242F6B; Wed, 23 Oct 2024 19:01:26 +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 3981042F06 for ; Wed, 23 Oct 2024 19:01:02 +0200 (CEST) Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03lp2113.outbound.protection.outlook.com [104.47.30.113]) by mx-outbound21-18.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 23 Oct 2024 17:01:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=r4IxqHRQ42a4ivn9TYpPmCxII62CHSnABDTq11uLn/XclYdHZSc5OuWP2X9nNQl1BOkvxbD5or7BGnBo9Gpk3/YFVr64R8IFYk8vnvZsFhE5L87YKMMEATbRS2Wshq+m7onCaCA7FMWEs/X99AhPIjKYxFYbyghHYN+YYvQFiU+a0p2+okyw++b0fRXcNNcM16fvz+megsl+YZksIUaO6NrNLyxkPSTAXSiwfuc5xMrJwxKual+WslpJX4ZAqVnWXZspy1gt9ocaixxWKH9CKIpdqk1GeTxogrfSD8NiufdxH2KkK0xYyrh7fIOrj7BpOUech2sWUshoOAv8SGw23w== 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=JJIdf/LYGhq0RVdw60J+lgDUNJKvu+99I1b1z6V6mMM=; b=w+ymGlf7JH8lnku7FZQS5MBiy24Ga9qpZXdzRwSUPMb0HJC7wBE0C0ykXdQbWEYnDP08gy6oibfIebgkLAUFdC1G6rj9fzR240260xiIPp/Amy48H0R+wXgI8uv0Z2VAOkR5Duy8OnKCvWYog0snQogHuQKY7Ey03t+nX0cU8YCTjhyQpZT9cQq5E2XLQ+h0/UvnJ5YghN5VXvfu2LQvc5ODwU1cUpSb7Ehjp//RVjf6OuU9axzqGFXZvqkm7U0Sl8KcS86OcsuCFRyaCR8evmYWRAURk0fil5El+z71iouWxRr3E6wyKkqFx16cvmHuaG//hsXBr6riMsdaRDsIuQ== 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=JJIdf/LYGhq0RVdw60J+lgDUNJKvu+99I1b1z6V6mMM=; b=XxMZaMJm6PNJIy7n9RjCEqpr8KuSelv0avF/jORqrHtiLUN/1iHJ4RhwvOw6q94PJNNWbKORkJVM019NjGgoN+rM9N9MUajQcL+7AyHROGDAMeAEL/LWLKKWHn6d4JrH/ZbYdM7q+m2+vNhHLPbCOU3L4cc9h3eDVkWveiyESuo= Received: from DU7PR01CA0005.eurprd01.prod.exchangelabs.com (2603:10a6:10:50f::28) by AM7P190MB0661.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:121::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Wed, 23 Oct 2024 17:00:59 +0000 Received: from DB5PEPF00014B9E.eurprd02.prod.outlook.com (2603:10a6:10:50f:cafe::eb) by DU7PR01CA0005.outlook.office365.com (2603:10a6:10:50f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17 via Frontend Transport; Wed, 23 Oct 2024 17:00:59 +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 DB5PEPF00014B9E.mail.protection.outlook.com (10.167.8.171) with Microsoft SMTP Server id 15.20.8093.14 via Frontend Transport; Wed, 23 Oct 2024 17:00:59 +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 v3 20/73] net/ntnic: add action TCP Date: Wed, 23 Oct 2024 18:59:28 +0200 Message-ID: <20241023170032.314155-21-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241023170032.314155-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241023170032.314155-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB5PEPF00014B9E:EE_|AM7P190MB0661:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: a75d1d7a-3744-4ac3-41f8-08dcf38444cc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-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6z7zQpoDgsjKkdC+VaEOZOnNSlfXjY6haRIxbHrEiL3R?= =?us-ascii?Q?rv74O9mNQqSGBifGDjjfY1wQ7UPHtXD4GIzd3948UtXvgOU/Yt/rr1H5d68Y?= =?us-ascii?Q?3rKDWI6guW+P6YMXAi0VZF6YisGzdJdmbq6CIk5EJ0OOZbeVeJfsIlT9r5cU?= =?us-ascii?Q?KBkNXwhlR8jLc9w8HJAHdsb8Mn0bcb0lYAAZUDcaD4UeM8yBl5Wg8dLdt6JP?= =?us-ascii?Q?Hnsd9/MrYVUHrIJCB2iLS2uN42wd2gHn8PJKEAT65dM1jraPqXztVY9HvLEk?= =?us-ascii?Q?7gWEGAB0kQ3CVvZihvg7EJ92pRGZP56te8BdcCv2YgujmKjXbZC8g7cFf16d?= =?us-ascii?Q?v6Si6La92L0N7bnhHvMBxk1b6Hj5TdrWcJrMRkCL//UlngH7pVEBlhT9UExe?= =?us-ascii?Q?L3ZZQwzyfLqOBurEDPok3VZfHv9xabVE7y0qOkjPYfDztBiCMctiUXP431jR?= =?us-ascii?Q?wSpuGwNLitX5z1cCAvPtgml0XgqrJnwjdOuqBs6jT4QhMBc3/0jq4Y42vCBL?= =?us-ascii?Q?aYYCCt66xG+4on3ErZ5J4X9WisJdOz4h1AWA+L7rrpnnuiDkAQ=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)(376014)(36860700013)(1800799024)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: weoxTHL4qdc7MZA6f0uVlmWbAIxJucN8ruOeGhEaMmityFmbQvVHFm/Vsq+cYo4VSG4lDysx8JBTp50XdTRyuWur9D7ONRvZ8Hq1gmS0jOvo/QvLits6eS1FTVRJkUi66Za1Ihi39UrOz/PCgfW/bZk7O+GZqsdfWb+6uP+5vw1LJ8Z9PE8WMZMpO1EvkpG0vm9AP9Ic3flhn4KAnQZsqMSkdb+HlA8DReh/UVRadUdBM1SSvOOPQwwwLskYnW0iu45boSAipRCaYOpZGvt41XZRNZxwT4l1QKpss8ABbPDv1mdMDDikWGoBx8JjAc0gowm/RQA5M/gFJGK2gcgs38k51FeGbudgl9gPhilTQVXKnwCVWnhZsUx3POU5HNLw6nXs79w06T+FiApfEQ3SpOQ70c2oH0DEKYDomsi2Ilw8Zf42I/IqJMyoIoGbLdqYknbWEeSWH/X2KZdctdLix2hZM8FGY+D3YpNWwJka3kxQ8qBCqAYVVLexI7WN9yaelr6XIQXRwrWMJcqd0UxEY+sUHJADpxlfUUkd14AKBZmbB+BZxgk9NmVjFcTi6O3z2RjUNix16vHMLNkOUHzO3ukReI4rOjdHg4+LgjzADLJzw2k3rs6dzC1uimTaif0Q+a7gHKP3g+7XjGQRuWf4Mv7531i57ZbFg38gvYjGWQc= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 17:00:59.1799 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a75d1d7a-3744-4ac3-41f8-08dcf38444cc 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: DB5PEPF00014B9E.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7P190MB0661 X-BESS-ID: 1729702861-305394-16204-13631-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.30.113 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqYmlpZAVgZQ0DTV0MAwJcXcwt DSwsw4xdDMJC01xcIwycQiOcky0TBFqTYWABfBaW9BAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259925 [from cloudscan21-4.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 3d4bb6e1eb..f24178a164 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 @@ -1024,6 +1024,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); @@ -1056,6 +1156,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; @@ -1066,6 +1170,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