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 D511145BB4; Wed, 23 Oct 2024 19:05:21 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 488F742F35; Wed, 23 Oct 2024 19:01:59 +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 EBC2A42F29 for ; Wed, 23 Oct 2024 19:01:19 +0200 (CEST) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03lp2168.outbound.protection.outlook.com [104.47.51.168]) by mx-outbound15-83.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 23 Oct 2024 17:01:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=q3bzNIKs5JSvBtbSOq6iN/8OnRT8XufEoYHp8L7keAX1nDy3TRpzCrdwvTSq2hgTKLvOzF5ZChpp2OxQ2aGXiAA1tAXCoGwRIqc6bYTGtKcN6BIDVn5K/FNqPfnKuccpBWXWTal+R58YCmGZNuKEOMmsl0JZHgOkmfQl3WZiAGh5x5q9EfxfNytfYcQTuC66ghTJl0wh4tY7c9YjYIY4hsOnafrVMBerdG4lsgXqb9AbXGYJdVuarl3fmDscmxj6yrEpHTc96WpdwwgAqSORYDvRGTeNM/kI912zGpBjFwht/HbVLSo9fKxmkyfYR1t7KTGBug4bkPut8JNSBMSDgQ== 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=TWoEUiR+fKAogAETL+XW7p5Fj5jcqBmARY8aQ6ZuvkQ=; b=GB2GtDBFHQC1j5t44ibKAq9x9IrS+olfuF9PtBUj1S0j0AglYCJBvI2NIDsaVrwXZ9OVr896lG6Tf3wuklUIInjFZgU8VDT47R0/tDaTr8fLbzjdgN02OFEfmzO3o85WK2swumn7O3RJU6NUut5Bt3Oy1hZA76es6LSIYZY+2PNb+erQ6nQVYuJZNSsZ5UDTqv+8wlioIRQC/rJxRGnvBBAmnTImebE55A5wq6baJ0xV0PgZo3g11z7CEP/ov+Ot9Q2TBcX3odGTgwpN/KjF++T0Yqns5NxadEDq7aIjcemN04lSX1PFTPF+MJ1SOFgVkEqgHsg2gyFupmNIgup16A== 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=TWoEUiR+fKAogAETL+XW7p5Fj5jcqBmARY8aQ6ZuvkQ=; b=Lc9ArnfFGnOLxGWXIdghHYueazeGf6wcO0e5RivwJu8s3E0Saxcxog9Y4c7+Etv8WLOfkuTmh1eJ9i2Uk4pBQlWXVak/TjDxj7Mh2uxeevfWLksozQbD3yWGZ+sla+km0DpE2HsTaxPtR1Ysd7wCj/f64W4A5e8UUgwiiKsZVho= Received: from DU7PR01CA0005.eurprd01.prod.exchangelabs.com (2603:10a6:10:50f::28) by AM8P190MB0865.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:1d6::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Wed, 23 Oct 2024 17:01:16 +0000 Received: from DB5PEPF00014B9E.eurprd02.prod.outlook.com (2603:10a6:10:50f:cafe::28) by DU7PR01CA0005.outlook.office365.com (2603:10a6:10:50f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17 via Frontend Transport; Wed, 23 Oct 2024 17:01:15 +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 DB5PEPF00014B9E.mail.protection.outlook.com (10.167.8.171) with Microsoft SMTP Server id 15.20.8093.14 via Frontend Transport; Wed, 23 Oct 2024 17:01:15 +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, Oleksandr Kolomeiets Subject: [PATCH v3 38/73] net/ntnic: add flow flush Date: Wed, 23 Oct 2024 18:59:46 +0200 Message-ID: <20241023170032.314155-39-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241023170032.314155-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241023170032.314155-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB5PEPF00014B9E:EE_|AM8P190MB0865:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: c357bc9b-6ee3-4d74-aba8-08dcf3844e93 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|82310400026|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?BVtFBkRZaT9cxNkXkn/mBdZ93Cn1Pjl5v0RwJbcbNOGRFQdRWUNNKnh4DWT2?= =?us-ascii?Q?LCWZdgLeufOPyfR4MGhIqFcEb4TDMJ8nnrg6rwtZ4BTQ1f6EHpOjXjopJcT5?= =?us-ascii?Q?f/q1nAuJIWz+p2pvOF6fZ6NDT1jbjsplQVhO165IiNYQf868MGs8G5JJlI95?= =?us-ascii?Q?4eN1tsOttUXj9HEfGVJ4Su5PKOD/KVSnUe+bv69ISFpgkpudP1bAEtGNBbrF?= =?us-ascii?Q?lvPLSkqFOvKvqus66IwqsgpNFASlYWYj81MptCI2e/zIiBnFOjKToh4yGklK?= =?us-ascii?Q?s7ptBcS0jNGOYyLpW/STH4d6OaCTv8xtTG6vewBXGJhKF8rORYNC+d/3RBRc?= =?us-ascii?Q?6iliwnwPlDJESjxCwgk5jUuiHndymtYfJvOWdWC0U5HGYjc5KH0LMbPonen1?= =?us-ascii?Q?9iq09YJ1Yx0upgIGCU/clv7F+lAvJNVDIzzg6X0vs3fGJ+ZovJTK5M4scWDu?= =?us-ascii?Q?Y0YpJX+Y15Qt5ZgR2Y0p9vhVnhWsTMTjah22AbXixBi+KQMsMD+9EWuZFRkF?= =?us-ascii?Q?GsGvyNoqHn3zwZzCcnJLCmgmD4kGTOkdSBIqL0A+J73CueypiFBqsBYRqucD?= =?us-ascii?Q?EFyEaEtnPQaeXHKgYGxrFGw0xABwP/OgoIyysxFZUC5GBPjjIECgFY3huSov?= =?us-ascii?Q?sP0lhPekFuYjfF9S4HpjKfIQpXDumTIJt7Dmqc8ODeXE3vpypf/zfoyP4w+D?= =?us-ascii?Q?6G6A7IbNuPB99ljntDAi34ohBR5x7cBS7qgDPwLeVcS3MK4awY2V8PlUPaNm?= =?us-ascii?Q?mPWVT/w7zyQDjmyyl6HWWf43ktotgFta4OvBh0dXjfnnM+8+vuK71t7Sw88q?= =?us-ascii?Q?ytc0K7YRPpIyGzr4ERcDK7SbB6okwQrnbnsAzlkqkJecUzpvDBEReWmwk0If?= =?us-ascii?Q?ERygb/v1ENILVe7PXAGs06ne7a8/Lpin4tPCVV0so1ZCK2ZFRDym0dnbA5GN?= =?us-ascii?Q?OZ5iuzTqyZwXeL/bRIBShI7XlttGEQw7ZWVX8zSwR0WhzppsqccdrrMN8iPc?= =?us-ascii?Q?lFK/8ignqvYOMeflM+fZ2p9a1q/xquPlDpZlL+krPcLR672YXINQKjwwaZDV?= =?us-ascii?Q?eSWHeg90nBXwtPKgtC9p5vID/qZu8PU+stfdGpfOkIDIHGLExeUI3i3NtbIk?= =?us-ascii?Q?0BedWOAnvsI6+LN4EFEWxhONXnbHYFQFsd04W86AHVt/c69jF3Nb64oE/V/5?= =?us-ascii?Q?trMeEa0w4/C5GeU5sqoqJ+HglUWJGS5BRRkMzDknDtv958KzNbq8YtciOBX9?= =?us-ascii?Q?Hy14O70XhGtRpZcdqeop3T0nxsD87daqFjKPbFMnKKnODy7lKmjjHVugBWQa?= =?us-ascii?Q?5+OFdA4mqpaoCCWfM2CE3RJ1fc4mXsVximeLUSfIFvi+SFFLDvuSMjwhDKll?= =?us-ascii?Q?zOTyMg/s0WUUIG//axeZX8Xq3GvvlYai7P0TSxzc+A/fsDuUig=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)(82310400026)(36860700013)(376014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ig7yvO1zOkXgPXFw9IzfiiUU8/05sMLAsT3BiBXST+Rl+pyw15q2XXR/0O7GMudAp5UsNqVMLN3qvlL+NJKGNcAIZ5eB2kiMHt3byuN+CAjiVvjDBw6QkCcb2Xo11EVDvpmXrz+qzWn/J7C8Cc7mMx7bHK+CcsD3yOXgDEpOj7MR71KAibBq1sKtcrcb7wmol6p8oQj0oprs2abcV3aLWwzyLWXAfJaIM4ihEx82KARwDi8LZ9+R0CXgRCH2j11CFXezCSZ+RrCQuCdjtOrL631urXJKJ6V/NU1hyM8zlPxIWvfhMd4wqUS718+Y5EcuyWipRK11jcqGd2tcK6nvq3JRZ3GxdfqBryXcUbdoFMA3e41ewH/P7ju2kOmUpGUdPQ0yvTZOBLSR3WDeTddpxQ8axYFh2y/0LDMD+DHOhG9JW0pbsYxbiXtiAfIqFYA4gwxd+w68HhLtnmWkPSlPs1nKle2eZLJ4qDN4XzQ6sGq171lDswY1lWbC7VevEF7CS70hUL6VQrnLuGuGXNFYfw3zu99DV4xchVoQOA59WK8eLVLO07yB1jzy0hdHj/uFOVpwITYO1UXGpNOs0gTGxkE2al+PIJSBgZLLfbFZRK1UtDGsvYg6gvirdpKXxYj9BExXNT67kAsb/6Y4eqCziRhFqZ8J1TW8ueN8aTP3OQ8= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 17:01:15.6644 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c357bc9b-6ee3-4d74-aba8-08dcf3844e93 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: DB5PEPF00014B9E.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8P190MB0865 X-BESS-ID: 1729702878-303923-12645-44314-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.51.168 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVmaWliZAVgZQ0NAwLdHIyCI1xc AkyTjZ0DQl0cQwzdQyxSIt2cwyKdFAqTYWAJKqLbhBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259925 [from cloudscan21-4.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: Oleksandr Kolomeiets Implements flow flush API Signed-off-by: Oleksandr Kolomeiets --- drivers/net/ntnic/nthw/flow_api/flow_api.c | 13 ++++++ .../profile_inline/flow_api_profile_inline.c | 43 +++++++++++++++++++ .../profile_inline/flow_api_profile_inline.h | 4 ++ drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 38 ++++++++++++++++ drivers/net/ntnic/ntnic_mod_reg.h | 7 +++ 5 files changed, 105 insertions(+) diff --git a/drivers/net/ntnic/nthw/flow_api/flow_api.c b/drivers/net/ntnic/nthw/flow_api/flow_api.c index 7f1e311988..34f2cad2cd 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -253,6 +253,18 @@ static int flow_destroy(struct flow_eth_dev *dev __rte_unused, return profile_inline_ops->flow_destroy_profile_inline(dev, flow, error); } +static int flow_flush(struct flow_eth_dev *dev, uint16_t caller_id, struct rte_flow_error *error) +{ + const struct profile_inline_ops *profile_inline_ops = get_profile_inline_ops(); + + if (profile_inline_ops == NULL) { + NT_LOG_DBGX(ERR, FILTER, "profile_inline module uninitialized"); + return -1; + } + + return profile_inline_ops->flow_flush_profile_inline(dev, caller_id, error); +} + /* * Device Management API */ @@ -1047,6 +1059,7 @@ static const struct flow_filter_ops ops = { */ .flow_create = flow_create, .flow_destroy = flow_destroy, + .flow_flush = flow_flush, .flow_dev_dump = flow_dev_dump, }; 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 e47ef37c6b..1dfd96eaac 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 @@ -3636,6 +3636,48 @@ int flow_destroy_profile_inline(struct flow_eth_dev *dev, struct flow_handle *fl return err; } +int flow_flush_profile_inline(struct flow_eth_dev *dev, + uint16_t caller_id, + struct rte_flow_error *error) +{ + int err = 0; + + flow_nic_set_error(ERR_SUCCESS, error); + + /* + * Delete all created FLM flows from this eth device. + * FLM flows must be deleted first because normal flows are their parents. + */ + struct flow_handle *flow = dev->ndev->flow_base_flm; + + while (flow && !err) { + if (flow->dev == dev && flow->caller_id == caller_id) { + struct flow_handle *flow_next = flow->next; + err = flow_destroy_profile_inline(dev, flow, error); + flow = flow_next; + + } else { + flow = flow->next; + } + } + + /* Delete all created flows from this eth device */ + flow = dev->ndev->flow_base; + + while (flow && !err) { + if (flow->dev == dev && flow->caller_id == caller_id) { + struct flow_handle *flow_next = flow->next; + err = flow_destroy_profile_inline(dev, flow, error); + flow = flow_next; + + } else { + flow = flow->next; + } + } + + return err; +} + static __rte_always_inline bool all_bits_enabled(uint64_t hash_mask, uint64_t hash_bits) { return (hash_mask & hash_bits) == hash_bits; @@ -4396,6 +4438,7 @@ static const struct profile_inline_ops ops = { .flow_destroy_locked_profile_inline = flow_destroy_locked_profile_inline, .flow_create_profile_inline = flow_create_profile_inline, .flow_destroy_profile_inline = flow_destroy_profile_inline, + .flow_flush_profile_inline = flow_flush_profile_inline, .flow_nic_set_hasher_fields_inline = flow_nic_set_hasher_fields_inline, /* * NT Flow FLM Meter API 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 2c76a2c023..c695842077 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 @@ -38,6 +38,10 @@ int flow_destroy_profile_inline(struct flow_eth_dev *dev, struct flow_handle *flow, struct rte_flow_error *error); +int flow_flush_profile_inline(struct flow_eth_dev *dev, + uint16_t caller_id, + struct rte_flow_error *error); + int flow_dev_dump_profile_inline(struct flow_eth_dev *dev, struct flow_handle *flow, uint16_t caller_id, diff --git a/drivers/net/ntnic/ntnic_filter/ntnic_filter.c b/drivers/net/ntnic/ntnic_filter/ntnic_filter.c index 5505198148..87b26bd315 100644 --- a/drivers/net/ntnic/ntnic_filter/ntnic_filter.c +++ b/drivers/net/ntnic/ntnic_filter/ntnic_filter.c @@ -569,6 +569,43 @@ static struct rte_flow *eth_flow_create(struct rte_eth_dev *eth_dev, return flow; } +static int eth_flow_flush(struct rte_eth_dev *eth_dev, struct rte_flow_error *error) +{ + const struct flow_filter_ops *flow_filter_ops = get_flow_filter_ops(); + + if (flow_filter_ops == NULL) { + NT_LOG_DBGX(ERR, FILTER, "flow_filter module uninitialized"); + return -1; + } + + struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; + + static struct rte_flow_error flow_error = { + .type = RTE_FLOW_ERROR_TYPE_NONE, .message = "none" }; + int res = 0; + /* Main application caller_id is port_id shifted above VDPA ports */ + uint16_t caller_id = get_caller_id(eth_dev->data->port_id); + + if (internals->flw_dev) { + res = flow_filter_ops->flow_flush(internals->flw_dev, caller_id, &flow_error); + rte_spinlock_lock(&flow_lock); + + for (int flow = 0; flow < MAX_RTE_FLOWS; flow++) { + if (nt_flows[flow].used && nt_flows[flow].caller_id == caller_id) { + /* Cleanup recorded flows */ + nt_flows[flow].used = 0; + nt_flows[flow].caller_id = 0; + } + } + + rte_spinlock_unlock(&flow_lock); + } + + convert_error(error, &flow_error); + + return res; +} + static int eth_flow_dev_dump(struct rte_eth_dev *eth_dev, struct rte_flow *flow, FILE *file, @@ -600,6 +637,7 @@ static int eth_flow_dev_dump(struct rte_eth_dev *eth_dev, static const struct rte_flow_ops dev_flow_ops = { .create = eth_flow_create, .destroy = eth_flow_destroy, + .flush = eth_flow_flush, .dev_dump = eth_flow_dev_dump, }; diff --git a/drivers/net/ntnic/ntnic_mod_reg.h b/drivers/net/ntnic/ntnic_mod_reg.h index cef655c5e0..12baa13800 100644 --- a/drivers/net/ntnic/ntnic_mod_reg.h +++ b/drivers/net/ntnic/ntnic_mod_reg.h @@ -253,6 +253,10 @@ struct profile_inline_ops { struct flow_handle *flow, struct rte_flow_error *error); + int (*flow_flush_profile_inline)(struct flow_eth_dev *dev, + uint16_t caller_id, + struct rte_flow_error *error); + int (*flow_dev_dump_profile_inline)(struct flow_eth_dev *dev, struct flow_handle *flow, uint16_t caller_id, @@ -309,6 +313,9 @@ struct flow_filter_ops { int (*flow_destroy)(struct flow_eth_dev *dev, struct flow_handle *flow, struct rte_flow_error *error); + + int (*flow_flush)(struct flow_eth_dev *dev, uint16_t caller_id, + struct rte_flow_error *error); }; void register_dev_flow_ops(const struct rte_flow_ops *ops); -- 2.45.0