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 5DF3445BC0; Tue, 29 Oct 2024 17:43:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C60AD42ED0; Tue, 29 Oct 2024 17:43:04 +0100 (CET) Received: from egress-ip42a.ess.de.barracuda.com (egress-ip42a.ess.de.barracuda.com [18.185.115.201]) by mails.dpdk.org (Postfix) with ESMTP id EB2C042EBA for ; Tue, 29 Oct 2024 17:42:56 +0100 (CET) Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03lp2235.outbound.protection.outlook.com [104.47.51.235]) 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:42:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JutMvprsw0raocsr4lR4P+UstNxrSiCTBb6c75B3cidmUXqe6GmfUTIVHVxmgrQE69Mzd2UOT6rRtO8TKkDkM7JYU8eoGo+w3iNn0XqDuMZI/NPrm3pvbBJvHXK62sZtLZB65Z/VFqEWsmHvE6gLif6MpXJvJ5asE9Z2TllOyCiO4wnv6AioBgTvF1bGBCUWX3ccqZhpXLOEUhFrBMp3s8kcNxWtH3TaaQroGCVshrQ8RtrlYIkiE5WEDkk4BrK+Kt55IBPl0ym5pCIei0LXVVr3gVS9zLpfYjsyXAuasfYa2jC9emmyPt8kwRxeEf4ItNWJny4l6+pJxbAncmhdFg== 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=o9ScWxWjth6lfmnq3q2nWgTfJjWjGYctOk/Gm/+BnJ16+Pb8naZ8kRV3R4B/qpafEMvRJX3j07d9JpQIhgSQs+LWR7Mtn0/jzyFxYyW6VY79hOA8Zj4sUyOwoaVF7trXEJC/P/gigtdHk55IAxcrWRmiq4IgwbGZDk6KPoSmyvmxc+zHKC1ZQmIwZ9gHHwCkNm937w0em60SvhjcW6h2xcuR1kgy1HnQ+8FcFRTbhpY6J5hksqNA45DjRP95iev9EjTb7JYryKGPhlNqbaeWNxAgV20b8NlflX4aN5XoZX9JzUDj2urVRTmubqqRNbhSFQ9kWt1kDAFpOYUVTKL/rg== 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=kevYXakTGiuksQao1ludFgISLbDFb/7b6803EXWa3fnuADGUP2gRvfLVjHHxl7i9ls16RqWCJ37CcGZW7gj7DfpWZ0S2pPj5zgffpwaDPreSnVp/rha7DoyKf+8Wrh2gBJBifXYGjSaj1ujRdACBi+D1IezMnHmLEFMVYAQStCQ= Received: from DUZPR01CA0194.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b6::19) by DBAP190MB1015.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:1a0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Tue, 29 Oct 2024 16:42:52 +0000 Received: from DU2PEPF00028D06.eurprd03.prod.outlook.com (2603:10a6:10:4b6:cafe::2) by DUZPR01CA0194.outlook.office365.com (2603:10a6:10:4b6::19) 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:42:52 +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:42:52 +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 v4 06/86] net/ntnic: add management API for NT flow profile Date: Tue, 29 Oct 2024 17:41:10 +0100 Message-ID: <20241029164243.1648775-7-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_|DBAP190MB1015:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 45a0a58d-23a6-44a5-d6f6-08dcf838bb9b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700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=?us-ascii?Q?V95mgcKL26hjXgdZvB9LQuwlclBOKe5aH5KNAWdilnVpJSGDFCVAdHVUAO4x?= =?us-ascii?Q?gq8Rp+dfxK++0LzNVFrmZG39GFsC4RnlWcM2yamlj07bdHUtIV3Oa53NGqD5?= =?us-ascii?Q?F5BQ1GLaXhOET1z6f7q/WXXYd/F8rw7XZ9qqj1snfIY4rYvu7eeGY/zH2nBn?= =?us-ascii?Q?tUBCGOmTQ/U6y3ffBx6cWSvOd5F0FYi4MXmOJ+HaHL1HKOmx9rrqkbWDU/T5?= =?us-ascii?Q?/R0CR7a1nVmG29c1NWBnV8QEhKrSU9+Fa/sCXdl2ouqsyrldG0USk2d9wV4m?= =?us-ascii?Q?KeRVdIaol3q+Y5s8mfhZr26TutyDu05W3XsIX1KiSlaAky1zDKotpn9bJ45y?= =?us-ascii?Q?LIpH1ci7ghFkxT/Axej3HFepvceGxEfyAl9NT60cqmULnnQ3B9Cj1ezG0Amx?= =?us-ascii?Q?jX4FmjlXVhjT9lx7sxYX0FMzXylF9QZTYW9I4T8wJxx4Kt2YGNB0lMPrd5FA?= =?us-ascii?Q?OUYvzId/QF60xjgTG/RpP+rFbbcAgqwIDJJLHaFLsDyFbb/ovwtHiQYArX4k?= =?us-ascii?Q?7VpCnu1YdO75kKup1f13+qhvqVJUi9DXTtLcl9ArnjIgGxVyNg=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: F4G06rI2UijtPYt5AlEETtrocZtrS+gCOPxIKOFAWwoc0qKa+qlbp2+vp8xdAQyafEAT05BU5Zm/DKlWSihA28RGEn9SNIta3pUAXzofVCSUK4px3qdZ39jC5+fP7o/vCIhxsb3ddzqP1L5ei7i906ld6JkSkOvMfDQpNLj33zWMks1Y/bTXs9/Z7X4Dm53NFBPjaNUjBQYAAatkMCAKWw2Vh/dlABlIX/zacAnb4c7MFZhOEZ2Z5X0h81T6wWtucNfaaeAOOyu2yiAe/hHbeVIFNhqAox4xdQoxkHoUoEX3Rp1P6Jtjc8UjCOkOOXFUf51KauqbjoY812uiO+CyLlTRL/9eDwDUy3OFHLX7sLhVEJCRfDaYyG3FTGSQdMczRt0sr5XC4yg3gfjUfK0bYvpr8Tr0kM1NMZwALYbUASdPWHo1A4NYzYWEFXBs6cYUbbVZtCGV23Y0E0XBMu3w7kSl/GAs1I+377r7W/s3oOIDviBXreJOSbq8wx576qVAIYDVJphtGemGTPKP3PJzh7X2VQ/eRTlJpnBp6zhIba5PkUbJbfgtyT0D0dyCRTFaZf/5nLx/rW9dnGQebkmFG2o9ShjOQ1mOE2+CRoZZohOE520IgJTuA4RN5tfmGQTSv6WUobmwnDeNcqdmj4+dNddPtstsoGjWrhjEtdxthUc= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 16:42:52.6521 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 45a0a58d-23a6-44a5-d6f6-08dcf838bb9b 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: DBAP190MB1015 X-BESS-ID: 1730220174-303097-12766-29317-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.51.235 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.260063 [from cloudscan22-120.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 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