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 CA7EF45BA3; Tue, 22 Oct 2024 18:56:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DD46740684; Tue, 22 Oct 2024 18:56:08 +0200 (CEST) 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 732DA4029B for ; Tue, 22 Oct 2024 18:56:06 +0200 (CEST) Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03lp2106.outbound.protection.outlook.com [104.47.30.106]) by mx-outbound40-26.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 22 Oct 2024 16:56:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HkLHNMeEJdK7BI/McfymJw0czc0JAODSgvV98SpGcQS4xCEvdZYYjc44zuG5I/l4Llkbhboc50clNcIak52x/AWkIxwevgbvvoL/ky8fj1a06rHO0MPaCGZAxvfhypUDaOtbWcuI3J9stJiYIK5p065eFxRttAlDdVl4whp8RpBDt/oWMU6IFD2e7Nb8eFI7Yx8fVpC8Ag5nJJjOwjGXlSPcxcgRI8pchUbvkPsx6kZGXjr6VBSrLzcye9+wrmYI4VLXJdkAHSr4uBJu+oZM5DjNJ8qr6RB92rA9S1D3szlMApRxqIgnaPvdXBy0JFEdNJJjQwj3VvGMeCOaR+Srkw== 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=K5D/X7SXwiJ1s0nj/0CiLfStJoXpqrZLFz6eT0KvLkk=; b=HJp9puHH2wsPb3PNXtwexQQuxwcfh+zPdpn5RdH9NRTeTU6QfvhxcFjlLynbHrPPyv6iEd68xSpWgO5wI9AjO7R2hFUfXCJPZc9rrKm0ScqyeXmqlNdq+N5RJv/Tfubr0qQv5EMNRZ86pkO+tb5l4aJscz6vm/TykjHwkhPf/qaUNfm+GSN6BtTYKA+UOrQJwCOBFjMBkEUaUE7yTucXDhlORaa3aEm0CfSA7KqpyyS+QHqJKJAKmR8PE2f1p1nBb+S1RaKq8gkWYB3ioeW/cBcESpeAf5q9OZMSImVCbJiIp5k9aBBbr8tzwL7r+GVvnIqGeJyaODYCbi2TWf5AqA== 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=K5D/X7SXwiJ1s0nj/0CiLfStJoXpqrZLFz6eT0KvLkk=; b=n78kPaJR79gka7G5T4Tx3csTUMhsC5K8m+VrEsQ1miDAWQ04aOXY8AaJ8mTcHHDcXpWZSeZkOQf6np/uP4UZiJI/08fatULuBNzTKZMf0i7wYdAz1lcXwwgRWPB8AJVSQ2xUJ5q9il/+KXMsKqjVcPSVsUUhZcqgLDNls0V0ktM= Received: from DB9PR06CA0005.eurprd06.prod.outlook.com (2603:10a6:10:1db::10) by AM7P190MB0790.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:113::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Tue, 22 Oct 2024 16:56:03 +0000 Received: from DU2PEPF0001E9C2.eurprd03.prod.outlook.com (2603:10a6:10:1db:cafe::50) by DB9PR06CA0005.outlook.office365.com (2603:10a6:10:1db::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29 via Frontend Transport; Tue, 22 Oct 2024 16:56:03 +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 DU2PEPF0001E9C2.mail.protection.outlook.com (10.167.8.71) with Microsoft SMTP Server id 15.20.8093.14 via Frontend Transport; Tue, 22 Oct 2024 16:56:03 +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 Subject: [PATCH v2 06/73] net/ntnic: add management API for NT flow profile Date: Tue, 22 Oct 2024 18:54:23 +0200 Message-ID: <20241022165541.3186140-7-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241022165541.3186140-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241022165541.3186140-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF0001E9C2:EE_|AM7P190MB0790:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 792d1dae-8fec-4597-4fc1-08dcf2ba69dd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?j5Dt2MZeaAVv2Dt2N1Nkq8Uxzg6c0O3rWJzrSLYPRwjhyyhOLY69G6QLYZdy?= =?us-ascii?Q?t/uMnyjb37eb80b2VU+fiS9zpf93onQcA4WIJscSA8/8bDTLdE7+f+q9VlrA?= =?us-ascii?Q?jFKulTjFrYIijpLVZ8C9zda4AndDHMb07iBJeiP6aOGTSk6SBjIKOylLc3I3?= =?us-ascii?Q?eUo5XUy9aFlGt15RLvfUrJgjB/cjZRwKW9Q3GkHEf8PDZV2W4TwdSSpEzyKW?= =?us-ascii?Q?QpaDhK2OXaEDmiae+9zINIUYwtrhkg8fH9CGAM+enFZCaXA1JcojXpotrnbx?= =?us-ascii?Q?7Rd6IHlJDkF0hV5dsPkIMbj4p4SUkKphmDCGG/MBPK7tU3kyV/cUbeyX5fpF?= =?us-ascii?Q?rTUl5ZdnFZ+ggAsljXib/Pabwcxe9hzaL0tRQqsxncLuyXAMPWcw2vyCbQ/c?= =?us-ascii?Q?yy298yg17a7cKOGjz1mJGcDn59G6AqSNS3z1/ong6J25ObGpmUALa5CUIAUD?= =?us-ascii?Q?OkdjImr0e2IaS5IxzAxK5FFUOQYipSIsUlKv/7sU58PDiQxYLf/wxb0EJzLS?= =?us-ascii?Q?WvXbMaAZa1nJ+v2AtsKXPHCTVqFVumkTaQYM4UX58VQh43JZbntNySoflqqo?= =?us-ascii?Q?JppwnuUwNRKl9tvPG2nx96jVP7d4Z/lSE/G2Le285wyXUmWHRHQdsGLESgWb?= =?us-ascii?Q?S+l603Owm750VWCChkm2yebsgoh/OZKEq9nMN6l2k+30o2AKqadxtQQVwbz0?= =?us-ascii?Q?M4VUSVpATrjZCuas/R1QHt6vfkjBI+bdGVa5/F/HRHBeG43Ya0icVf9zoTL5?= =?us-ascii?Q?f/OgQycTVO2TW+DlCHyhkuwP4M8C9S4QDkXEyxKlAOfSWXXguKJ0lAnEGo3c?= =?us-ascii?Q?YKz3qa6+U01WN8alSqHD0T8sHUmnpkh7zVOAkJvY0jUekj60i6qi+PtSR1uU?= =?us-ascii?Q?X/F0TB9C+/kWHkrLTdG+4W7juR0dRNel1XNSw4mXWXLLjPO953ZdWQxPvLV6?= =?us-ascii?Q?dxplYMna+NanUjyrtMwFTpCeXV9vL+1TOkckT6X3v9t1gOSfgYW11JYsdqG7?= =?us-ascii?Q?OB8dC4QeLHBEl3RSnb1LhOQxYXHxl9CznK2TjVBBNh584bgnwQeZMYBxIcA4?= =?us-ascii?Q?vJkEfcP/O8pNxxoi39goNDKggT6jV1cyeOghMwL0VHmTU3hMrQI7zOqP8oRR?= =?us-ascii?Q?kyvJXpz4nO8FoK85AmpWUV28hgZYqPkcuwYPEJAiBx1/o6VrUx+xJ3E/ftVz?= =?us-ascii?Q?DIlhH6fPvRpwvX7Jh+rNRR6JkM+Av0Z3hcpAkC7oEji0CHqNgzPw8iWVfA55?= =?us-ascii?Q?59+sfyzmT6PNWAP6uuB2eE1dSdSMEXQKQ0efErpd0sAyjD6LGxZbSjrtQ+Pt?= =?us-ascii?Q?mqFYlR+00lfRQ5B6mD+0fi6n+vAfAFHl+CHWRqk3+ZVkQpqvOB61mT0SA/dT?= =?us-ascii?Q?5I5PK9t3Q7TcMH4xKqKuxknrzMAhDPmAJ03q3rOoe0rJdASdSQ=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)(36860700013)(376014)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: AOnOouqiBq2eCpe3tuAruiMxAdnGDgMk3nXujAVJ1YcMNJINsqO+DpccQ7EC6sts0BpCUN2VooV80yC+ge1SrStw8GjTWFSeiaifMHEUFuhXjQhBJvMSrR3S7kL3ia0L8PDVAhMWi3KFYNbkY+gVWtf8iLAxZW3hxLvplpuwW+gaQTTwZYG3vZcKbbMCjThsgJ0LkCwpQSfsRIckbnZi0dFQ46ugc8cLEbQPPsbX795hA5OtM9+T+w7mQaKMwOa5PD2LrvExi5Xw8C71KeyYjgZuW66sWCF+u28dQEuuGgnuM4Y8xiCQsgB+0DZKWIOVZC0y+cOWE30lHWk8BaFQnmsdunDlvntAoAl3iNfF2jLw2gFdMrirFwWJy2+sixRveIeYtIC0Rd1VNIuFRLA6rFEaQjtNcPHJa6mmde19q9u+9P7Z3H0zrqKDRI+ujQ4gyoS4N8c1L+pBLvbRHGf5nPi1eG56SnsUzk2JhmBqBE837SEzZ5IjJzHr4nSo2aErQS21esXpZV4WaMKHaJK+e0hVjJjwz4e+r/WsIXvo8CCgwQ0xktRxnVPVXwOY4QtiKIJSXVHUgGzFkYWWn3DhGSZcK6KNsLsVNXmuUfZ2pTl2rGOKqW9lQDBZkSNuAK18XJBlRBITZXFVBpeAYocvZQCKvzkveS7PUQvd3Mwz5zM= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 16:56:03.1061 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 792d1dae-8fec-4597-4fc1-08dcf2ba69dd 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: DU2PEPF0001E9C2.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7P190MB0790 X-BESS-ID: 1729616165-310266-12676-12975-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.30.106 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVuZG5hZAVgZQMDUtxdTUwCjVxC TVJDXRLDUlxdLMKM3ANNXczDDVItVcqTYWAI3s5aNBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259901 [from cloudscan12-68.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 Management API implements (re)setting of the NT flow dev Signed-off-by: Serhii Iliushyk --- drivers/net/ntnic/include/flow_api.h | 1 + drivers/net/ntnic/include/flow_api_engine.h | 5 ++ drivers/net/ntnic/nthw/flow_api/flow_api.c | 60 +++++++++++++++++++ .../profile_inline/flow_api_profile_inline.c | 20 +++++++ .../profile_inline/flow_api_profile_inline.h | 8 +++ drivers/net/ntnic/ntnic_mod_reg.h | 8 +++ 6 files changed, 102 insertions(+) diff --git a/drivers/net/ntnic/include/flow_api.h b/drivers/net/ntnic/include/flow_api.h index 3bdfdd4f94..790b2f6b03 100644 --- a/drivers/net/ntnic/include/flow_api.h +++ b/drivers/net/ntnic/include/flow_api.h @@ -55,6 +55,7 @@ struct flow_nic_dev { uint16_t ports; /* number of in-ports addressable on this NIC */ /* flow profile this NIC is initially prepared for */ enum flow_eth_dev_profile flow_profile; + int flow_mgnt_prepared; struct hw_mod_resource_s res[RES_COUNT];/* raw NIC resource allocation table */ void *km_res_handle; diff --git a/drivers/net/ntnic/include/flow_api_engine.h b/drivers/net/ntnic/include/flow_api_engine.h index d025677e25..52ff3cb865 100644 --- a/drivers/net/ntnic/include/flow_api_engine.h +++ b/drivers/net/ntnic/include/flow_api_engine.h @@ -46,6 +46,11 @@ enum res_type_e { */ #define MAX_OUTPUT_DEST (128) +struct flow_handle { + struct flow_eth_dev *dev; + struct flow_handle *next; +}; + void km_free_ndev_resource_management(void **handle); void kcc_free_ndev_resource_management(void **handle); diff --git a/drivers/net/ntnic/nthw/flow_api/flow_api.c b/drivers/net/ntnic/nthw/flow_api/flow_api.c index d0dad8e8f8..6800a8d834 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -10,6 +10,8 @@ #include "flow_api.h" #include "flow_filter.h" +#define SCATTER_GATHER + const char *dbg_res_descr[] = { /* RES_QUEUE */ "RES_QUEUE", /* RES_CAT_CFN */ "RES_CAT_CFN", @@ -210,10 +212,29 @@ static int nic_remove_eth_port_dev(struct flow_nic_dev *ndev, struct flow_eth_de static void flow_ndev_reset(struct flow_nic_dev *ndev) { + const struct profile_inline_ops *profile_inline_ops = get_profile_inline_ops(); + + if (profile_inline_ops == NULL) { + NT_LOG(ERR, FILTER, "%s: profile_inline module uninitialized", __func__); + return; + } + /* Delete all eth-port devices created on this NIC device */ while (ndev->eth_base) flow_delete_eth_dev(ndev->eth_base); + /* Error check */ + while (ndev->flow_base) { + NT_LOG(ERR, FILTER, + "ERROR : Flows still defined but all eth-ports deleted. Flow %p", + ndev->flow_base); + + profile_inline_ops->flow_destroy_profile_inline(ndev->flow_base->dev, + ndev->flow_base, NULL); + } + + profile_inline_ops->done_flow_management_of_ndev_profile_inline(ndev); + km_free_ndev_resource_management(&ndev->km_res_handle); kcc_free_ndev_resource_management(&ndev->kcc_res_handle); @@ -255,6 +276,13 @@ static void flow_ndev_reset(struct flow_nic_dev *ndev) int flow_delete_eth_dev(struct flow_eth_dev *eth_dev) { + const struct profile_inline_ops *profile_inline_ops = get_profile_inline_ops(); + + if (profile_inline_ops == NULL) { + NT_LOG(ERR, FILTER, "%s: profile_inline module uninitialized", __func__); + return -1; + } + struct flow_nic_dev *ndev = eth_dev->ndev; if (!ndev) { @@ -271,6 +299,20 @@ int flow_delete_eth_dev(struct flow_eth_dev *eth_dev) /* delete all created flows from this device */ pthread_mutex_lock(&ndev->mtx); + struct flow_handle *flow = ndev->flow_base; + + while (flow) { + if (flow->dev == eth_dev) { + struct flow_handle *flow_next = flow->next; + profile_inline_ops->flow_destroy_locked_profile_inline(eth_dev, flow, + NULL); + flow = flow_next; + + } else { + flow = flow->next; + } + } + /* * remove unmatched queue if setup in QSL * remove exception queue setting in QSL UNM @@ -445,6 +487,24 @@ static struct flow_eth_dev *flow_get_eth_dev(uint8_t adapter_no, uint8_t port_no eth_dev->port = port_no; eth_dev->port_id = port_id; + /* First time then NIC is initialized */ + if (!ndev->flow_mgnt_prepared) { + ndev->flow_profile = flow_profile; + + /* Initialize modules if needed - recipe 0 is used as no-match and must be setup */ + if (profile_inline_ops != NULL && + profile_inline_ops->initialize_flow_management_of_ndev_profile_inline(ndev)) + goto err_exit0; + + } else { + /* check if same flow type is requested, otherwise fail */ + if (ndev->flow_profile != flow_profile) { + NT_LOG(ERR, FILTER, + "ERROR: Different flow types requested on same NIC device. Not supported."); + goto err_exit0; + } + } + /* Allocate the requested queues in HW for this dev */ for (i = 0; i < alloc_rx_queues; i++) { 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 a6293f5f82..c9e4008b7e 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 @@ -8,6 +8,20 @@ #include "flow_api_profile_inline.h" #include "ntnic_mod_reg.h" +/* + * Public functions + */ + +int initialize_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev) +{ + return -1; +} + +int done_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev) +{ + return 0; +} + struct flow_handle *flow_create_profile_inline(struct flow_eth_dev *dev, const struct rte_flow_attr *attr, uint16_t forced_vlan_vid, @@ -51,6 +65,12 @@ int flow_destroy_profile_inline(struct flow_eth_dev *dev, struct flow_handle *fl } static const struct profile_inline_ops ops = { + /* + * Management + */ + .done_flow_management_of_ndev_profile_inline = done_flow_management_of_ndev_profile_inline, + .initialize_flow_management_of_ndev_profile_inline = + initialize_flow_management_of_ndev_profile_inline, /* * Flow functionality */ diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h index a83cc299b4..b87f8542ac 100644 --- a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h @@ -11,6 +11,14 @@ #include "flow_api.h" #include "stream_binary_flow_api.h" +/* + * Management + */ + +int done_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev); + +int initialize_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev); + /* * Flow functionality */ diff --git a/drivers/net/ntnic/ntnic_mod_reg.h b/drivers/net/ntnic/ntnic_mod_reg.h index d133336fad..149c549112 100644 --- a/drivers/net/ntnic/ntnic_mod_reg.h +++ b/drivers/net/ntnic/ntnic_mod_reg.h @@ -226,6 +226,14 @@ const struct flow_backend_ops *get_flow_backend_ops(void); void flow_backend_init(void); struct profile_inline_ops { + /* + * Management + */ + + int (*done_flow_management_of_ndev_profile_inline)(struct flow_nic_dev *ndev); + + int (*initialize_flow_management_of_ndev_profile_inline)(struct flow_nic_dev *ndev); + /* * Flow functionality */ -- 2.45.0