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 1A74145B96; Mon, 21 Oct 2024 23:05:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A0CF94065F; Mon, 21 Oct 2024 23:05:44 +0200 (CEST) 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 36543402E9 for ; Mon, 21 Oct 2024 23:05:38 +0200 (CEST) Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02lp2104.outbound.protection.outlook.com [104.47.11.104]) by mx-outbound46-162.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 21 Oct 2024 21:05:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GTJy2A1vL1+9bO1CUcU4lzlsYAS3eMyXBU0I+QqzfvbjR0jj0FLTdhTSRMnA+IbP7PwlthkkceoGgH11J0IsAINSEYsKZiiJMezmpTg/5aTuj8DJQ6uemfJrPrmqECRn+zSdG34bF4PaMJH+YRT7e3GjlD+8hnOgN0t/mm6cob3wtPbda1Fv4P9uuUCygloJg2RmmchtVB8n77X+yTo5g3p6XoMZjJDZ5biQ0NPVE+wh/rlIzw56OEZrO3YXCpL3q3FXGoO2iJCbpHtadPqCJi/Ss7XoP3bXxm/xsc1eBn1o6Da3E9aI8gAVG/hFbshZQ3BKfaV//pPW9+PoTRlCeQ== 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=Ttt/hRFX9innLkl/ckuDFIgrnffoe7K6VqAwfbUIbzc=; b=e/J31DkHavGYAx9JGJoZ+NQyzfPKdp6ord/HXoOSf+m21pWcdnnxFyV5azaLFc3UYJM7CKTK+k2IXg1jxO4H0+QRihGi3bWc3rjXwfo3B9Y9Oc7wrI1GNPAZA+nDwGZVU6yDQQzMFXqAYPHIvN00n1M31B3NrDTMpZK1iuQ0YNH1zBI/JIF/muJLIVyoCv071S+r4rAN/5bmPWIv9m8TSXJwT56lH4zIyRse/CDSkBy6ACUQm+VWbHsAJBGeuKV4j+xawg1OnwMzzZW4gyw+GIFPpQegb1Zj1NUM/xguW0iQHO949KWD/gt9ETNjDZTox6w2tLbEdaLp+kgpwVVycA== 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=Ttt/hRFX9innLkl/ckuDFIgrnffoe7K6VqAwfbUIbzc=; b=fX0m24QZchTYFQQhMeGZOuYQeWAC+0XUi50u/7vxPMnKPidfrQEdhTquiUCcJUCL+M4o1HuNH8SDlt7Hlf0VC0pMn31m8/PcubiADOxxMegs0qhoJHikZB1LSGCsiAw03QlXVYp+tdqV/STDzT7pkuRUKUpY58psVdOhJ99a4qs= Received: from AS9PR04CA0152.eurprd04.prod.outlook.com (2603:10a6:20b:48a::26) by DU0P190MB1858.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:3a6::5) 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:35 +0000 Received: from AMS0EPF000001A8.eurprd05.prod.outlook.com (2603:10a6:20b:48a:cafe::b2) by AS9PR04CA0152.outlook.office365.com (2603:10a6:20b:48a::26) 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:35 +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:35 +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 Subject: [PATCH v1 06/73] net/ntnic: add management API for NT flow profile Date: Mon, 21 Oct 2024 23:04:08 +0200 Message-ID: <20241021210527.2075431-7-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_|DU0P190MB1858:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 38a07c4d-57e7-4334-efde-08dcf2141b90 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?VpwAp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Plv/IoopaDrEpo?= =?us-ascii?Q?Df6/YOYB60g18xo2Ja42KiHH0JEu12L9zx27NYVuF0ywSfMrqI/JER4xPA86?= =?us-ascii?Q?XEKdapfKvzOg68xWx58H1TSbsMIWBUCOUYmwHXNmIUrYRzUBYqWldVrC7Y+x?= =?us-ascii?Q?eHbts/v9c3tF8Ok+iGlISRQ3htTDlUbxNOEzB5oM9UrMaPzyQVvs3sQ5U6Rd?= =?us-ascii?Q?3dRewf1psoj31P3Dm+d0eCPcLRPdzRHHMDkA1CeZAzKLKiT//L5MfIWSUPyY?= =?us-ascii?Q?ahDknuCYZ6ZMp/L5Uq03u4wpipQRwGANiGjXCffalH5US5bttWJbgGjCUqRe?= =?us-ascii?Q?gULsmoIqZnxLl228J2e9cYDs1DTzM5fy3JHvv3PDMUjXfjvS1jLgpeOGFCM8?= =?us-ascii?Q?OP/wwmOd7IREaeKDn37xxIwVeg0IVrSrFlX2zqvXiIeg9AiLP5vgBIH/cxhs?= =?us-ascii?Q?lqh9FDafZfjqCBFb2OSooepSEcvX1zDsRb4Il4JfLnUHsF1V7kaC3VWg2lq9?= =?us-ascii?Q?y2yrZLkE5llQezJTa8TWv53vkM3D4/jgoSXoz2xstVbsDDAO2Q=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: Se6rf6IU+3T1MF7aeDgjhd5xFBbXqfYlV6RBDQsfXHV9t9urD6/KMBtbksvjljgR0gVyJuUKW44pJRr9wEMrMllz8URCg1KlBLjSBQc/TyWirtYbLw8sA1dIbs8m9G5v5y30XBcuKraGwI1OP/RpIeyL4iZ8tO1F+aPNr+WQ+NHklD0TXKolvOxBypPzLz8+rWh8H71uWRQmUxxqKf4pW0uEWAb6ELh40LuI7UaMsCuJjSvS2+uFblD+Dmo2Rq2tvNuB2pxUiXrGj1kZo/ZvyD1Pkd4ZuJbZ92oIh4yUF4IqgmypolIK1c7Sa7yIzJydJKBymYlr1Ctq7JIglNg7wqs9NwCFZQi9WQFSZnE8mEHTroBcBNx7SUZJwtSgzRyf3dzXJm7ENT20AeAQrku/2StHe523Wxh7li+ecXsA92XYdyWsNhfFjXDhAJRYMRjpRgBixruiCbQdd8Ssr2y1jG1kVexlBYg3a/hMxF+TYDBP6UtPS/A+jPLqpFEI3B4Dw+ksJJW6HaIOiJ8SgcoTLsEEOqWLL64+OfmoW7WEM4ZBgdvgjwWv+O7k1ScaE8Ta2W/yv6n6hXT9SDYgC9lOYXYsBUrU7Z/XEcc/WVNzcKFiQyRXD+g8I1ItzbhJBN3j2UFkbTWBk+wI0JT0QPokMpxbylMMEpuQVGKRSlgvwjI= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 21:05:35.4112 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 38a07c4d-57e7-4334-efde-08dcf2141b90 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: DU0P190MB1858 X-BESS-ID: 1729544737-311938-597-22868-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.11.104 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVuZG5hZAVgZQ0MQoxcIg2SDNzM zS1NDIyMg40TTJPNXQ2NzczMTEIiVNqTYWADZ4sPpBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259883 [from cloudscan9-212.eu-central-1a.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 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 75825eb40c..4139d42c8c 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", @@ -220,10 +222,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); @@ -265,6 +286,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) { @@ -281,6 +309,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 @@ -455,6 +497,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