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 D333C45B96; Mon, 21 Oct 2024 23:09:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AEF1E40E4B; Mon, 21 Oct 2024 23:06:23 +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 F04EC40DDA for ; Mon, 21 Oct 2024 23:06:01 +0200 (CEST) Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02lp2110.outbound.protection.outlook.com [104.47.11.110]) 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:06:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=J/IxplWjLrx9y6bRzW1kz/CQDQJQaonv+k0ij6Y10wCzBbbYN+nPZjFWPH08Nh6epljDtMAD4Uu5gPLQUU8j6ScAHfU+Cul4xdpKsgGp2De/k2JyrWtau+oKhVoV+6UehKpC/66uSHuapNSLXQP3AEuXnD+16ZZ1XvWpVJyLyFug4TrLnI62pjlMZAjRRDET+2PG2PBDT24pZiZG/ZbygbP+2VkNkFsLVnazMrTosZ6ckzDisZtCcq/LD0+ZMD7E1Ntfreogpg0k5l20Tk3bpwZgCRmt9WvJBP/l0uJxA2IvfOS5XdbMBymKwArO+bedu/ZyBReTM/95tJvvbYzpHQ== 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=9cernDILbQFSDhj4aeOlI027GKls9muD8zM6ut8DiSs=; b=Bu1gI7HfrwFIfNiiz7/y7VH1xX1GHITuIkYZ5+qD7wGjMTIBHqJCA3z2oRf4la6/q4K03zlz1yWUYJboZ/2dk/Uq3YHHPdRglP66Ss762kSU22SWmCkaBNx6Vdcd1HgSQJXaw6qTaIahN1zmQP0OmjmtB8OWcybo9LpKuJnAiNjJRPvaeNZw7w3D/X7h3OZl7heo3QlQ+9XIjkGqSJAJba6h7UBNdTsK+BE3IzpyzeR5rqWuY6HCf71BUS/8Ndg1ZHidxrqIq+56wni5ApCeybANRf8yOb+o0ncXv2lV2lma1lIxd6uU+2XJb4ES34ekSz/sxFflOZG325dyXi4qPg== 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=9cernDILbQFSDhj4aeOlI027GKls9muD8zM6ut8DiSs=; b=DR+edrVy33bHtA9hylndpIcM7jMcEmJuztIKCvg4+2rPEdtQA9KcxQB3pmw9jicQaWnu4/yvbxoPRCi5jj1l0y5plSNwadWOGrJ7+foMewaoXoc4ixHvpeLSbEXDd4AHGZLR7eScHcAvEIV+9FssvlQmZso8RR4xiPTBR4bwNNg= Received: from AS9PR04CA0156.eurprd04.prod.outlook.com (2603:10a6:20b:48a::28) by DB8P190MB0779.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:123::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.23; Mon, 21 Oct 2024 21:05:59 +0000 Received: from AMS0EPF000001A8.eurprd05.prod.outlook.com (2603:10a6:20b:48a:cafe::ee) by AS9PR04CA0156.outlook.office365.com (2603:10a6:20b:48a::28) 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:59 +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:59 +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 v1 38/73] net/ntnic: add flow flush Date: Mon, 21 Oct 2024 23:04:40 +0200 Message-ID: <20241021210527.2075431-39-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_|DB8P190MB0779:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: a08c3151-602c-4829-7478-08dcf21429c2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700013|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?VgD81lxWHOED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QQVfRWZe4+yozxA?= =?us-ascii?Q?efIACeBaLzOOmBoDdSzNEprV0nVJuxJkf7HhzUNCaKqzJhyjqGvfPU55GJC4?= =?us-ascii?Q?R3TLOiJlugR9lEv/97Fj2pAZJj7lD5jAH0j4C8FB3iAFgyGkKSQSZlnz6fHw?= =?us-ascii?Q?p/LIHraorca66yqVpgpm0xQzv0OnM3kT+5W5BfWn2QsMqxlmGm+/QX6zL4Tx?= =?us-ascii?Q?/lhPeFd1VbxK+gmSxWUNGLP3sLnfn0DzTbRIB0QE0fsiwYTIIwfocX6QTAhE?= =?us-ascii?Q?0t2prdk+c1IYZ7zaM3tX5NOLzLZuH3RNgfpg9+nLN4T2cAud1oS34gAsCFzH?= =?us-ascii?Q?PTnhFz/pWqgC7++8pZ5+UFat16E8Ys10gzgRDjeUypY1IvcULX3pFY1+oytz?= =?us-ascii?Q?U+e1RP3noVPAb2UcqlKLSor08RtTGDwsCbvOWVpblPfCPia5Ks06GQ8uN5lJ?= =?us-ascii?Q?L+HiLT1cXonEekGYxLEOJjOIR4X0qkYvDnslS9fDXaKPUdKieXCWEfaiZrUH?= =?us-ascii?Q?dvI3/F6vB2gSxQPz+FhQyXV+kbu3BVetu+W2AYkYYjMblakxWQ=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)(36860700013)(1800799024)(376014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: q7kawiY9sve2O6Hgl5b1uSx2KsqBMe1UJjKB2myRRPtRsCdz4tycMywGRyle1HwNOo6+gMiRiVANIG41Wg/H6ZDCxCtLXmyU757qUsT6r9JGVnTLB1ZZFIIMQkIU8UOXNnWiVUI0QQJZhZyCKBX6wQN85iuhGOW/PIBfVbL0Mjc/7ikr9ecap4jUlnSJ9oy7Ci2gYetd+uKdov1fymH01rSZkQDsDk/5/d+97maPHedx8jKjGWb9v1SvLAi6qRtj/LvHYWTAVBMhP9w4Cm9bWGgqVkZ2nju6/egagPFQTpxrqUtrpCylY9H45/dpC6GOUr9p7MCJfApNSK0EDtI3AwPrhu/Wh8BkFRQAlWE+BCZCKckJ5ygqY8Frkm3364JcupDZmh5smJtegz/LbM3yRM6UrZDPV7O6+1d7JccEOrWSgSKvWKuJBrS3IUeJ3FUaDBFNpaRt7E919JmzhfyNVb75R2deF9cViFmzuDJXJ65FtQpzVxAple0tCT9R0CEBGqIJJAcar4Dlr3BnrBq+VdVVkcPIwLLeBP7jjBoR4nP2PgSyjmN7s2YiCxiY2uKlfwT8IIhJGsJ0TT38zHMFJukf7btyXG/J4HtvAx6yDIhg/DHXrUBgzS52HicLgy9Us1A28TCl0fJwqJF/XSedaRtBN07atmD2ANpXHZTYrBo= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 21:05:59.1926 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a08c3151-602c-4829-7478-08dcf21429c2 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: DB8P190MB0779 X-BESS-ID: 1729544760-311938-13021-41192-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.11.110 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVuYGBuZAVgZQ0MzA0jDVMC3FKN EkJTXJJNUixcTSNM3c0swsxTLVIM1AqTYWAJje9NJBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259883 [from cloudscan16-126.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 6266f722a1..a2cb9a68b4 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -263,6 +263,18 @@ static int flow_destroy(struct flow_eth_dev *dev, struct flow_handle *flow, 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 */ @@ -1057,6 +1069,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 39d0677402..0cb9451390 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 @@ -3640,6 +3640,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; @@ -4400,6 +4442,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