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 9E22845BCC; Wed, 30 Oct 2024 22:44:15 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA2E6434F5; Wed, 30 Oct 2024 22:41:38 +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 75484434C7 for ; Wed, 30 Oct 2024 22:40:34 +0100 (CET) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03lp2174.outbound.protection.outlook.com [104.47.51.174]) by mx-outbound11-85.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 30 Oct 2024 21:40:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TwYAIYEuxARRugTQ7jIlZwnZJsitqtyZlOaet1mRTTX+lcSllgiaDpJBvb+pZI5L3unqPPBxoMfgQn5fDPS4bt+exRg3SY3dBLjSL1T3c9a9deAV0keoCSsM3WS3xMnuEKhDwRb3PfLvOrY6xm2Udk3lMmazt8eAPRJXazY+NKdP+xuNrqdkZqAAcOWdBrwEB68ZLYcmDc28Bek5ay8Pa+zKZpvSRJThNLrIp1ujQUJziqvlF+lcgNWI9TbBAjgHfuJjrz3HvmqAlFU2RREcYH+fxuQNHLljdQUj47OjpN4k9Hh8WNTUjLqKGbkzlepFfG8f1FS0UU+n56Oz6rBANA== 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=JCUzpVnKe9mKgZxUVvyIouAMvqyMqIRGX9biAUy4exk=; b=DDq92y/GpXzU2I/7XXu8JF7a0WhuyNASYo2JMvc37Y4kyqC97AUDbhNjpACXR+hdIFmyfMzZKTRckXmFYA13W6B1IlroHZKaNZXLeKZSv5a5+YQneZvNi7xjmwtz6iR41wchvWPRYiKtNnz8+J748J8IIH1RX1Lz1dtx+WZD/5lVbreHRZIjSJ7T4iEqzlDpLhNhFWamIEA+dXQCWMPZc7fCvmHSsKMMkk4m9tAZBXYginSTJgzyz/jdN92Qirll2+K8ugQTJGd4lYn+9TeI01RF0jV4/WJEi5ELpUP0YeU4bf9LAp7lCDbTEOjU1IaU0qPh7HmFbyxLwOb2ixgopQ== 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=JCUzpVnKe9mKgZxUVvyIouAMvqyMqIRGX9biAUy4exk=; b=DRrEnM59b+/sjrLEV82C/G3R+9ECwW6+6rEyFnAbo5XSBCVQDPMwafvwh8jj7PYMAZdswEJUj7TX4cKPEokqSWXnJgN/73+HBCLjM9xTyqm4ZDgq/Bl700W3CTBZ/zFrxCAbksRpQKVuoahOIK5hlNb7czzMoC13rVL1Tx+NGvs= Received: from DUZPR01CA0014.eurprd01.prod.exchangelabs.com (2603:10a6:10:3c3::7) by GVXP190MB1989.EURP190.PROD.OUTLOOK.COM (2603:10a6:150:5::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Wed, 30 Oct 2024 21:40:28 +0000 Received: from DU2PEPF00028D13.eurprd03.prod.outlook.com (2603:10a6:10:3c3:cafe::3c) by DUZPR01CA0014.outlook.office365.com (2603:10a6:10:3c3::7) 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:40:28 +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:40:27 +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, Oleksandr Kolomeiets Subject: [PATCH v5 38/80] net/ntnic: add flow flush Date: Wed, 30 Oct 2024 22:38:45 +0100 Message-ID: <20241030213940.3470062-39-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_|GVXP190MB1989:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: a58b637d-60f1-4dd7-0505-08dcf92b788a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?CMMHjNFJWJMGDvANl7d/Dv1XBmbHg4/DTo4lw9D9xJqwvSg2DtljtLLDpB5B?= =?us-ascii?Q?dfFATCgd1p9RoxSCSZS4ajtbEk7U45289/8lO2OcMaaYxsZ9vJCjZTz/lMsM?= =?us-ascii?Q?XKf64GfMvh85d/kGdCbK2ryW+CYDksgK366bx2tbwf5b+I4TwwKXl0u+Oam2?= =?us-ascii?Q?dlSP29kloUMYVJRLJ0NmSzqIc/EHU/6UHaevzQUcMRzI2vkObJW6S6iLYt2Z?= =?us-ascii?Q?4A7Db5kEMdroRvgndFCidYrT/bHl0/v3HtjirF9QchDOZoeAO+VpdtG77feX?= =?us-ascii?Q?UGnw9U6mu1XlgnRd2M84UVKy5GJx/RC7I7xrnIN1aqYnL7uXyw8TnEEMAErL?= =?us-ascii?Q?3GT/zXuIDQJ9Ej9qfV9fC/Mu47zJxLnj4naIDrdlVAxnfFXxZftXm2p0+q6z?= =?us-ascii?Q?fo95oiqKMqtQ5gO3cyoNkOWetRFLFHvMMeuvCbqMR9yllCWcLMPI4XX5Cgfg?= =?us-ascii?Q?nFFKorVafpacQH1MU+VDJ0IjpytMcq8GkJN8vJEuWFkH8PpMGJ/JyR4a9HxX?= =?us-ascii?Q?wib+cj6SparXvMj8mxGP946pFUZyfFuWMlUquNNEFFcY0A1jdPfx3MpXXOw3?= =?us-ascii?Q?iOmHIfuT9WpfxWHi4uVazwHTyUsz31V/+fLQ9a8cTVOOiEjhoLQstwEwP/aj?= =?us-ascii?Q?K7lIyj70zd0rwm0IE+BINGXshyO294l3GGvhiFZGPBwAQLODM5aQwk2PeYSX?= =?us-ascii?Q?xbZJVKPXqi6qG5sc7S5Edo95mSezpkZ5ahvls/VrOwdnkE4QEZrxeBrgKpxZ?= =?us-ascii?Q?SgziSQDlingeDAtsPbKt9ce7qauFQ3+jdbwHRQqGGunKMwPOKfAP9VBBY7FN?= =?us-ascii?Q?MuoW5y9BuK6JS1oAg+/GzzKsOBO8Cj+fbh22poGvzdtQZOMKOF35vsBhBRw4?= =?us-ascii?Q?flBxiTqFwt1rEy1T5bjF+bGeadnW/7u9hdk8fCKr2y7uATSJ3pHBsHFRz4xs?= =?us-ascii?Q?8suKigqtLSEp0b8vgyufJBA95kITqHu8DtoAecyb6JeYSWX1jr17ESskg63u?= =?us-ascii?Q?w4wmGAY9SHsgEiWFcRknzAC2zA1prQ9qs69ukYVBjqvob/WK1SnqCKeJyh3c?= =?us-ascii?Q?ml/6JdLTtDqamU+5WKymG505obtlKFX4bbR7PXyN93HxSr8+INzn91ZwB8II?= =?us-ascii?Q?N+linpHc1zE6fJwjkT2YJ1L2tUnS8qoIXUMwJTY3IFmuaEstTrR1eLxjQq6S?= =?us-ascii?Q?HNgwv0ilt3LeQGigaLzrWUuLYwlrndJsh2OzChWmghEkOk066ZFdS2skGf/I?= =?us-ascii?Q?dERUz4XjjIn50Z8/hV/eoZnlbIEjwnMX3ZbyHTgl9VIiNe11DjOHYvl0Aud8?= =?us-ascii?Q?A48nvqPgvA1/QvbqNz3mxzO0+osQSpiMfxD4YhAyRHmDpanL8R0eX+72lrrm?= =?us-ascii?Q?5nn9ItIBLZodQIvYM9R9A4mXChOZ5+CYWZjbU/nSj7nps+stmA=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)(376014)(36860700013)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: UzSBu5eAXKWu5KPal9tbfyNukIBhlljA/qMpGBgjLmkSiXYhQ30b3lqmoD6l/InR3mFTvukabps8ONd2r72jCWLeKpapMT5RULAnWPKvt1NCJewJtI1YkGQmtCYXWk+MfhLWM8f/K0xmKEMWIwpXNE4/H2Aw8tOHzKSZ+hjOPSaHgukXxuMzxgzVoLJ4OhHv/k9sigpnQLerOqnaaWJEatn/Im2P5bp0Sje7S7/8dcW6G09QnloZLS134YhMDG1V3FrHFCYHSpkp4T1sYVWz3czJdKRq/zjWY9dKnly63q3igVAStUVlFtiq1OWEltiMNElNAvVVisGc9jQeHMH1CFgsbtolpwmr/C3kyBZiCgTa96+OclVRQgvVkLEiu250F5QH8JU5NCUiw5xoLoQ4ogRbJd9dKyNYnVUZxoHfUrM8DooD6P9cCwy5u7aeflS2AgaaDKSDOHlgepjhMvbXI8x9NjKKv0E48y+r5xhkavvo8dnONPTLiUzhFVx+orPgWKd/vccqOHs82nFRlWoGEJ36dWeDp0LbSBT+2xjLYa+GSTUg1+CoF86pvJGG7DSAj1V9JEk+UIQuJu1r+roWJSmimjBQbhczc0BPMn3Ni7XfQt8AEw6F+g1T71N1PHt5nWU84Bo4c2ewJQmfc+NUjxYQhqqFBI2k88K2IXSc/gw= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 21:40:27.8020 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a58b637d-60f1-4dd7-0505-08dcf92b788a 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: GVXP190MB1989 X-BESS-ID: 1730324431-302901-12798-43472-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.51.174 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVmaWlhZAVgZQ0MDE1MI0zTzF1M zYwiI5ySTV0DTFItUYSJkYWVoYWSrVxgIAiT1A90EAAAA= X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260091 [from cloudscan15-95.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 From: Oleksandr Kolomeiets Implements flow flush support 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 ec91d08e27..fc9c68ed1a 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -251,6 +251,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 */ @@ -1013,6 +1025,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 2d3df62cda..0232954bec 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 @@ -3631,6 +3631,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; @@ -4391,6 +4433,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 67a24a00f1..93d89d59f3 100644 --- a/drivers/net/ntnic/ntnic_filter/ntnic_filter.c +++ b/drivers/net/ntnic/ntnic_filter/ntnic_filter.c @@ -582,6 +582,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, @@ -613,6 +650,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