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 3C16E45B96; Mon, 21 Oct 2024 23:08:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B449E40B91; Mon, 21 Oct 2024 23:06:09 +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 BECD940B90 for ; Mon, 21 Oct 2024 23:05:52 +0200 (CEST) Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03lp2112.outbound.protection.outlook.com [104.47.30.112]) 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:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FOZrnryP1R7bxiFUfmYRVZ+onEjCT2e6a41KySoJl/M7TfwKtFU7uL207Nhnd3JxKr7blWdk3/hvNkbOvwtnwXvQLKn7JVzTJskwGTpO9twDvj/BpUEdKtPe0HePEU4ozA836YpuPzmWdJlN+rqyaqsUhf/ogcgIq1X6fJdriZqt1c78Vd6jo2pQdbKscZ/HHdmLN49iNp+nQf2yxdsO1OlZGS/98rY+0D/Dwi2grZaRZK1KbuyC01bIIsXe65hwfCvhjoi//6gbn077FCWqLW5UqHEpWDSh0w4fpYXVRd3Jbby65q1ZlC+QybivpekMqcsj1KE7dSc7oxMohLSXUg== 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=xCMTpaVP4wAZWjDyokFfkmmou4yrENmcOj+rWIwohsU=; b=c8KY0a7Z6Y3Rmyt7IESxyzL723Wi8A1PeIy6wvV4pdDzD3zxnU2ntmhlbG67Nb6OpQwapK8pjETyoQVrSnznp6kcp5bneos+ESOHA63Yy0KP4qIdQT5clVA8Wt4EG22y0RPwrGmgJpItDBMCsva3buphfSk7CMvxOjtIvLi+Hrkw1i+RFFvPOMjo8vvGvqc4+T1ITAOh79Gsu5BMNEhvIXJ5GoAgAqd1kkexoatumcntHLZdw+wcO7Yrb+ETvpIeSrYlTBV3YU65lEg5Jk1+U1OP3ETVQBLZP5XrzPvtvTlky33Hi2iWMDzm2YCixRmQ8qCsndDa+PE7SOdg2Yuc7A== 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=xCMTpaVP4wAZWjDyokFfkmmou4yrENmcOj+rWIwohsU=; b=LjZz7GMyq7Qq4EcwBNZKk2wT21umpK8LaL/3p4+U46n53uVuTBxfU0h0dl2pJ3z+USny7SqVJRJHf6yeBH41QfuTwiMZitILvvxWJrkNy3s+h4P+8p1055Tvg0egNVXXXSwKv2o5lQi9RFysMOR2mCvesX1Aj/oTrSrsCg2/gcs= Received: from AS9PR04CA0149.eurprd04.prod.outlook.com (2603:10a6:20b:48a::22) 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; Mon, 21 Oct 2024 21:05:46 +0000 Received: from AMS0EPF000001A8.eurprd05.prod.outlook.com (2603:10a6:20b:48a:cafe::a) by AS9PR04CA0149.outlook.office365.com (2603:10a6:20b:48a::22) 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:46 +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:46 +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 19/73] net/ntnic: add item UDP Date: Mon, 21 Oct 2024 23:04:21 +0200 Message-ID: <20241021210527.2075431-20-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_|PA4P190MB1264:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: adc56016-2cd0-457f-f1b7-08dcf2142247 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?g2eSVs9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XGyVZs8mkQ+UI/?= =?us-ascii?Q?5PWLxeeLW0M2C5Yxt9Mi1AJcovN4mWT4+h7VBeoz/BaqOHY4bNdatHIWsVsd?= =?us-ascii?Q?5R5pzGmxoR6AqO+w81j97mkIhTVbVvr/e7G9ixCmPOZfSK4TZP0+tqdGjUHB?= =?us-ascii?Q?UzASkuRJbSclJBnADygjwhOnkv8jEa0uNM1F7bUj7JTtFtX0MzTijToh0nAT?= =?us-ascii?Q?9ZQUT1fmpXmYP3LkVjSxhYWvVl6LjH3IioVYYVkmalJgZdCQ0AY2YzQI476Y?= =?us-ascii?Q?QmKvBYcehnr9s27wRGTl2Ynsn3ZfBBkHCQuWz09W7njYYqa4hJgze2wgUpOP?= =?us-ascii?Q?r0gnV/2XTJfKEgR6SmFq5D2J510PdHYtdhAHaTHJuTvK3SxPV2iXg5hEwN96?= =?us-ascii?Q?9TiYYR44uB3IxUchxFzCFIJyzk56A0IYXNvzMtj99J+7bVzOH52V33NRl+4X?= =?us-ascii?Q?4Q1xHyLXQk3bhIrL0Uni53ENE4XU9OBcjq+TGgJ6hyGgFLQGnMBuH6v0Jdph?= =?us-ascii?Q?XNBBcS1vb0aiWkwy5Jr7CMYVw9Rndb/Wx2JKYlS3Fp0H2bKJ0Q=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: PAWAZKyDptz+2qpoN9aBIcptMfg1yNUgLcu7tSOmyOk+UyVrUOzdsFSvwbC1TkE+fTEWqAp0xOYfTGtgLtF+emKB92ElA84BHfDc9/mZkBPZY1KTy+7pfPAoC80Up+iCPKUu4btQi6IKWvYtOUh8hOytvXrjBbLb/XQU2Het0adusluDcRfq/lBTcLXvZwK9a7CQrcz7oj/Klf2JlKdlJl3b013j5v65a0tc4hXXikwIq7sBmKu3nk6YfUuW5qSXB6bAxDC1rrs+s4df0M3c0h+rrS+TSbZo0X+gm3zDcXfrq1Fe2fxJXo5MEapMlJb+T1oPCLy/itIusSEL/w9JTKRAaeu7tNpdM+xKuEhuyI64teVyeiogMic3PZHB+runQBq0ReEtxWvYX3ulq8TP4xvHH31MeH8JUiWneIHhIAHFU9z+Gfe3iY6gDFVU1+8vnStr1zWB/y6PGOBaDEvbeFIKAvUksjpWga1bOcu9LqpUm/k3k+N+TyMMWHPnQsIdorKaQ4beh7DYHQkE+B67toMW/+2QLNW8OdBmnpodhRXIY+rjk5Qiljhd4lfZ3WoshwTenBHOUl8ErzD1g4ocaNlxUu8kM8kocA0BWdkTN4+4J1RBLQ6bshNSx/Eezw28h+SyXx+TOQgbONmEDUfwz4WXYBI7ePRjGLkVLs+O88I= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 21:05:46.6457 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: adc56016-2cd0-457f-f1b7-08dcf2142247 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: PA4P190MB1264 X-BESS-ID: 1729544748-304934-12655-45447-2 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.30.112 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqaGJmZAVgZQMMkw1czIzMDSLD HJMsUi1dzI3MI82cLA1DjZ1DwpzTJVqTYWAC+1ylNBAAAA X-BESS-Outbound-Spam-Score: 0.00 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.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_UDP 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 | 103 ++++++++++++++++++ 3 files changed, 106 insertions(+) diff --git a/doc/guides/nics/features/ntnic.ini b/doc/guides/nics/features/ntnic.ini index cdf119c4ae..61a3d87909 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 +udp = Y [rte_flow actions] drop = Y diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h index 0c22129fb4..a95fb69870 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_UDP = 2, PROT_L4_ICMP = 4 }; @@ -176,6 +177,7 @@ enum { enum { PROT_TUN_L4_OTHER = 0, + 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 4681b1b176..60f5ac92aa 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 @@ -830,6 +830,101 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, break; + case RTE_FLOW_ITEM_TYPE_UDP: + NT_LOG(DBG, FILTER, "Adap %i, Port %i: RTE_FLOW_ITEM_TYPE_UDP", + dev->ndev->adapter_no, dev->port); + { + const struct rte_flow_item_udp *udp_spec = + (const struct rte_flow_item_udp *)elem[eidx].spec; + const struct rte_flow_item_udp *udp_mask = + (const struct rte_flow_item_udp *)elem[eidx].mask; + + if (udp_spec == NULL || udp_mask == NULL) { + if (any_count > 0 || fd->l4_prot != -1) { + fd->tunnel_l4_prot = PROT_TUN_L4_UDP; + key_def->inner_proto = 1; + } else { + fd->l4_prot = PROT_L4_UDP; + key_def->outer_proto = 1; + } + break; + } + + if (udp_mask->hdr.dgram_len != 0 || + udp_mask->hdr.dgram_cksum != 0) { + NT_LOG(ERR, FILTER, + "Requested UDP field not support by running SW version"); + flow_nic_set_error(ERR_FAILED, error); + return -1; + } + + if (udp_mask->hdr.src_port || udp_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(udp_mask->hdr.src_port) << 16) | + ntohs(udp_mask->hdr.dst_port); + sw_data[0] = ((ntohs(udp_spec->hdr.src_port) + << 16) | ntohs(udp_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(udp_spec->hdr.src_port) + << 16) | ntohs(udp_spec->hdr.dst_port); + qw_data[1] = 0; + qw_data[2] = 0; + qw_data[3] = 0; + + qw_mask[0] = (ntohs(udp_mask->hdr.src_port) + << 16) | ntohs(udp_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_UDP; + key_def->inner_proto = 1; + + } else { + fd->l4_prot = PROT_L4_UDP; + 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); @@ -964,12 +1059,20 @@ static void copy_fd_to_fh_flm(struct flow_handle *fh, const struct nic_flow_def { (void)flm_scrub; switch (fd->l4_prot) { + case PROT_L4_UDP: + fh->flm_prot = 17; + break; + case PROT_L4_ICMP: fh->flm_prot = fd->ip_prot; break; default: switch (fd->tunnel_l4_prot) { + case PROT_TUN_L4_UDP: + fh->flm_prot = 17; + break; + case PROT_TUN_L4_ICMP: fh->flm_prot = fd->tunnel_ip_prot; break; -- 2.45.0