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 3019C45BCC; Wed, 30 Oct 2024 22:40:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AF9CD43429; Wed, 30 Oct 2024 22:40:15 +0100 (CET) Received: from egress-ip11b.ess.de.barracuda.com (egress-ip11b.ess.de.barracuda.com [18.185.115.215]) by mails.dpdk.org (Postfix) with ESMTP id C17C54327C for ; Wed, 30 Oct 2024 22:40:03 +0100 (CET) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2112.outbound.protection.outlook.com [104.47.17.112]) by mx-outbound17-81.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 30 Oct 2024 21:40:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HK/y8BF7gORDDl/Q6vT3Ajn4abG/Z9AGG5T7WcdYNM49iPKitZ7Oq1eh8zQ2CeV3GnPhdT7FLwm3MefoobuNvPXCo4BBw7qVHnXlgxckokkhM3qw7ydeh3XkIFZx40oEKEaX67e42fIWhuQDrr9aIxESZYNmMlnRLtV58PqOVuxBtBd18C6H17XndrOUpBHLsdQmvuQHHnDhKf0n0Z9NXVR2+54R1NZJaZrGUMP4fwpj4xUTS/vVVgZ+BPzUFkkDb/r6J/l6yH4WNM/qkdGGAkWYq/bw9/9iZOcYj5r/hKYdGW6xd3bH2fE2uLBlMsiqMbpo0fEanlR5iT+QplF/kw== 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=9ZLuChKy0VSRpzDxAtkDnyFlquFsYEFb8XaeK+CnoHc=; b=Nkn/JYIN1qi/PzeaWX3GB54GFS2sVDTNoMLF9ibuCahDwQ71aPC7CznQpC24t4BPowzDH18Moe/fkqsk1nBxx3v2YHCRDFF6aYUp0VN/lg+RVU2RhvVunKcVyKYFdCj7HqsOlOftkLYR/+tLZ6iH62IJheKOm0eo9pjTdmxp/TavBHQZ4sOYM/p3Zsuv+MWTXZNGj1Jb038471Xct+IgRRbsp+EQZtQ1vMNd1xIcnTDZU/K2w2w+ZD4DyTCSyiyMg2eejkNeSmOaaCkSxB2D3CCp41UZxllbg+Ajwe64sMjBUwhr8+uUkPbSakdQbw2JQWOPCv32gb1WFxlCJLFBfg== 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=9ZLuChKy0VSRpzDxAtkDnyFlquFsYEFb8XaeK+CnoHc=; b=dJLnsBApOOiVy9eTWc3E1H+D5leOhwJcVlC5ZMYdXi7dckkT/3TQBv+v/KtwmI5U9BiZhYZFxc/8HPoBE5RNmAFhaoPLEkFoh0hRRbzJ+W4n1bttvz4Y6ZfDFofoTVB/FoDfLSM7OUbk3z7dwy5K0AQgOjcHtI9XPoJA+zhkvmw= Received: from DUZPR01CA0015.eurprd01.prod.exchangelabs.com (2603:10a6:10:3c3::18) by FRZP190MB2213.EURP190.PROD.OUTLOOK.COM (2603:10a6:d10:13d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23; Wed, 30 Oct 2024 21:39:58 +0000 Received: from DU2PEPF00028D13.eurprd03.prod.outlook.com (2603:10a6:10:3c3:cafe::ea) by DUZPR01CA0015.outlook.office365.com (2603:10a6:10:3c3::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20 via Frontend Transport; Wed, 30 Oct 2024 21:39:58 +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 DU2PEPF00028D13.mail.protection.outlook.com (10.167.242.27) with Microsoft SMTP Server id 15.20.8114.16 via Frontend Transport; Wed, 30 Oct 2024 21:39:57 +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 v5 06/80] net/ntnic: add management functions for NT flow profile Date: Wed, 30 Oct 2024 22:38:13 +0100 Message-ID: <20241030213940.3470062-7-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241030213940.3470062-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241030213940.3470062-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028D13:EE_|FRZP190MB2213:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 9c713d92-7cd1-420d-31ac-08dcf92b66c0 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-Message-Info: =?us-ascii?Q?V+2I9kooYRwCHv8ecXQduBwgXlQS8xTludrFeVWeHXQwIUo8OZ4uZ6UZRxEu?= =?us-ascii?Q?M6Wg0E395LqKX/e34R4dqg9FwYhB4roP426Fb4PLr217l7dU34ByLdug+DBs?= =?us-ascii?Q?Q/7JdCffQk2hQF3MPkOjCJyyJiFIoe2NRVnFkHdLagCg3BXeQiIQKxg2JW+G?= =?us-ascii?Q?r6T9+55BYCficnwUO8Gv4T9zMSYof45iWcqTKsCutVUGnuAJceKFVDAuvcIr?= =?us-ascii?Q?YY4OYBk9e872CwZSog/5Vo6PE8azjNsZGJ5jvSpTc6QLp8f2+Ac37kjAvC+O?= =?us-ascii?Q?lyJbmQ/SgkauEky0EnFhMEyQ9OYmkuxl6iY5kUaYdb5iCXkQYMgBAYPbyf+g?= =?us-ascii?Q?N2HSOBq9dOVMb4KbYZV1zMNkNiIswrHtbpfKwZlnyVZBarC9mTBvX89lG09v?= =?us-ascii?Q?/4cVTqiGvceziKNPwj19Qx3Sr0FD/x4TM6w4vXW/Te5mKXuxFR8COJnPVD/p?= =?us-ascii?Q?1okpdOZ5I9/JKfveQKIUzQSB2oIW/6Wqxr/l02gayzO5mA57Pc56uX1x6vv+?= =?us-ascii?Q?ukXkRDTX9JE7K9Jnl8KWzqRYOPi0VBY1aMysDFiaWLOk3eWAAPiZJQ4yGcyC?= =?us-ascii?Q?Wz2AclKXfPvnHVsHImZU56PaSS59Sbzg88gG2noB80wBOlvJaUdvnz6E0Q2Q?= =?us-ascii?Q?Q/cWSvwM4qeQN2Z01ugEhz9q3bi4NP+zjDwlg4F6P+EbGNHJ7OWvqZ+XuQMB?= =?us-ascii?Q?onblGhaJ09K1CWg3CUzbvWC+tZxkPyH7fslW4sH930vRUGkgvu77AjSi63N+?= =?us-ascii?Q?9UgPJAhz6m42KuuHqa8pOH+lFeRYO1Xct+1hXsGhRiXfk7xqPaSrhXpRonj4?= =?us-ascii?Q?I6HnHK9MPKrp27xdoxet30RgBGCx2nmpT5dMbzPaojYPCa4EH2d29vFWEJ2x?= =?us-ascii?Q?8ae+Y1st/sYjAsxRwe96TrNeAYIKAUXGEsHsfHcQdeaHm4mZaK7VMI1nzb3W?= =?us-ascii?Q?g4vHDwLc2pxbKz9dKm4TVRoi8109c1+gMOuIbqS7tlHNlcNQGPgtzzBk/grX?= =?us-ascii?Q?TQu3+pqIET2Lh44Tn3+3nuobt2nmMPeXjEq8EA5rWwbSd9udTyNcRAqbV4hi?= =?us-ascii?Q?L+Gr2yMAJLg+yarfi0MbdQnmC2+eTwwBRXBUdhMVuhA04aHgi6yAUDFtpwjX?= =?us-ascii?Q?0fQQdoUFK6cHBhpPnurUNskExjeLElhNbU20aAz2ExbTlmd63K6URtsRkTBQ?= =?us-ascii?Q?0gl5GETNMA274e0A/Ge4mxTCeoGEwcIY7z184F0j6V2QcZlwNJc9/3XmW7ph?= =?us-ascii?Q?lnRMVn1T4JCwyo6Whu9BoSUpko4ccDsBduJHfQSwjk0l5kGzALJPVO0yMUVa?= =?us-ascii?Q?OjHXGGd48pXnu/B9lO+toHSdd8Ebq1HRCfkOBAO0llRQD6pUYMtBE7N2b+kl?= =?us-ascii?Q?Wct7UIOJyyXACh+JEWtTrU8N8z1Q5VfdKCt1qOgyifXspTgFPg=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: 7Q/xUYYkviqCoQzqjI8hwGwyOPW9FvkNWk/dHl5WvlncnrqiPNJanktuPiOLcHJjBSrFOF8Fmf2VeDhK0jEdKkfKdWaUUBswisyTM+k/lR8gS22k7oalSSN/wBRexrQ5qNpEa/N9Jp2AEUkE3vnXFrYVaO7woaJdrrPBCX1Vj2R5jU5m8oYWQlkNzoBD1xq+wVWPQOAgxdbZv6eDv1HJSfbqpntYtf3OV4GBOExOdXxki2WrO5pftpF8iaQc1gDEb/b+Zd74If3Tgv2kI1ZhTs02aEtGi5irWNCVm4KA5vJJTd0lqea8pd/DqqJAfNA1SNFuZKrgY1SBLjwPVIIsQuplrytE+PeEBj1AycGziV5ZRIJWAEhTQO9SJBn3LGuc4neBThEUDVmRAsO7dqSo9o8q35QBguQXAtjeHKY95n2vpwXTBAAFpsG1I0FiFOh448crUC3SiJsUQWUozedHTCWP3Wz+lB3wJe6Op8KE+jhaQzvN87sxCdr36lzVgDoVYBIIoYzC/L00ZDDpL7Uf7xSmfCO07L8wP4v3iJLy5YAjoLctNQKeDjhKPhcboolk1cKf7rhMCtKMv4DZH2JESK/8ANQeVQnl8X2Cto6A5kqxxv6urba+9qhW4Akxl5KuhZAFnDKNcBqouqzbECXgIjFtTcbrz332bonZG4a2Mic= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 21:39:57.9893 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9c713d92-7cd1-420d-31ac-08dcf92b66c0 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: DU2PEPF00028D13.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: FRZP190MB2213 X-BESS-ID: 1730324400-304433-12636-44608-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.112 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVuZGhgZAVgZQ0Mgi2cAkJcU0xT DVNMXINMnAzDA1NdHQxMzEKM0y1TxVqTYWAPUTtDZBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260091 [from cloudscan16-249.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 Management functions implements (re)setting of the NT flow dev. Signed-off-by: Serhii Iliushyk --- v5 * Remove unnecessaty SCATTER_GATHER definition --- 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 | 58 +++++++++++++++++++ .../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, 100 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 5c5bd147d1..a9016238d0 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -210,10 +210,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 +274,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 +297,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 @@ -435,6 +475,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 34e01c5839..0400527197 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 __rte_unused) +{ + return -1; +} + +int done_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev __rte_unused) +{ + return 0; +} + struct flow_handle *flow_create_profile_inline(struct flow_eth_dev *dev __rte_unused, const struct rte_flow_attr *attr __rte_unused, uint16_t forced_vlan_vid __rte_unused, @@ -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