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 6D62B44145; Mon, 3 Jun 2024 12:53:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 82AA642E7B; Mon, 3 Jun 2024 12:53:24 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2043.outbound.protection.outlook.com [40.107.244.43]) by mails.dpdk.org (Postfix) with ESMTP id 0289042E73 for ; Mon, 3 Jun 2024 12:53:22 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JHNkuuD5gBFYOLsVDsRMMJ5JKp38mlF6UULL9GFtFBjBD00Phrg5GBJrtU7Ak5ig24ixrkfDnwKgG4acDq81+HB4ncy97plZRVPv5/TpnWWftbzbUO/n0uRZem4ytq/OyQOYGkNPMNSxRrMI/woBlUGazo9TV2EDmHyLrs09bas3SF1LFE1wiUPA61MXop7mRs1/g8ghcyv3aVcu57EpwidZ3EojIo9JtpMZ/CfNncXUlF8A81dJGm5XdKa7cf6oSIsCo09/7mXZpt3Cjh/lfw4IMJ8C7tpCO6XLsTKoO+nTdgBqpvd3Zp/8dRTzz1CkOkQR56gVUGDjjG59r40zrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=dU/i3B0SAUx2ppLFvhDbehWX5lnsoXb7M/XP139T+yo=; b=Vd+1lApDVcg9ETZjeUVKkW6HvdCUUzbGn8Z4lgC7qQ/hMIUHVTMXmhsqWIGuzDpDC3mjRY2o/MbyF/MxVGoq/aeIZvvrbFnbHubIEr8Pa9dXok7Nn30CJRnOH77cFyOPOD2sZwcYp176JlVPy7tSpZBc/VRZiDK6JhicokfrSV3C5U+scVtLn/FrKDW+4Nz08b7wzGkMS2IMbmyeCTrNjT5foF3ESC35aafQcPoEh3enod/fBE/Ule2yoV8ThY6IGwr5vzk/W8d8IK7VkBHd01ElcXI9RWdIe2AdZhWVbtK12yXthQBiXiGOsdvmQLy8zuKo69k8p2AtujmFxwX7ZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dU/i3B0SAUx2ppLFvhDbehWX5lnsoXb7M/XP139T+yo=; b=KN/NYsUe9bf0GI86UyfJQTiNRX9ETmTVv6JllLKrD1oP+aBVUWK2jui4gieJ2vPC1GJV+7OisJq0xm5TaXWwjRIGzKyUq/NDAxCmIwiuj23FbUVZNiu9qkR/YF2ZBh+Bmc+xi9DZNmP//R6RxL7FccAwoZLyuaU6A68WrQougb2afAzxa3vs3weeTrMu7arAASPd8yKoKnUSUzRiREJghzQ91QMxpJOErfMJkoroGXqA6nMQoidDCsDX+E2FH2e5j/cpAW+FUEAeQgQ31FGg1h2+DxRb+ttmtGXCJeuhzai/6N9lfg07TxmTMvli8WGUYaYoL1Rfd3zNMVcUNxDUUA== Received: from PH3PEPF0000409F.namprd05.prod.outlook.com (2603:10b6:518:1::4f) by LV2PR12MB5725.namprd12.prod.outlook.com (2603:10b6:408:14c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.17; Mon, 3 Jun 2024 10:53:20 +0000 Received: from MWH0EPF000A6732.namprd04.prod.outlook.com (2a01:111:f403:c91d::) by PH3PEPF0000409F.outlook.office365.com (2603:1036:903:49::3) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7656.13 via Frontend Transport; Mon, 3 Jun 2024 10:53:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by MWH0EPF000A6732.mail.protection.outlook.com (10.167.249.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.15 via Frontend Transport; Mon, 3 Jun 2024 10:53:19 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 3 Jun 2024 03:53:09 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 3 Jun 2024 03:53:08 -0700 Received: from nvidia.com (10.127.8.14) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4 via Frontend Transport; Mon, 3 Jun 2024 03:53:06 -0700 From: Maayan Kashani To: CC: , , , Gregory Etelson , Viacheslav Ovsiienko , Ori Kam , Suanming Mou , Matan Azrad Subject: [PATCH v3 6/6] net/mlx5: support FDB in non-template mode Date: Mon, 3 Jun 2024 13:52:41 +0300 Message-ID: <20240603105241.10482-6-mkashani@nvidia.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20240603105241.10482-1-mkashani@nvidia.com> References: <20240602102841.196990-1-mkashani@nvidia.com> <20240603105241.10482-1-mkashani@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000A6732:EE_|LV2PR12MB5725:EE_ X-MS-Office365-Filtering-Correlation-Id: 3ce0c641-df3a-4407-9a05-08dc83bb6175 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|36860700004|376005|1800799015|82310400017; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?i2JhQUNogkqkklsRLx4cc9OT0r8RpudId3CZ9G8ss9jSVtTU+DQSG+8caFZ2?= =?us-ascii?Q?ebVE5Y3JtlVQq/YgyD1B+biRxgMAvo3Fmki6qzU26i20u14hbqY7moqNEip+?= =?us-ascii?Q?/EQn/chPqlENceewpZVdzBcertYYv9a3PVcP8aG04SdhXiPk7W+cl+0iOTTX?= =?us-ascii?Q?vkVezMZTAKu1NX0FE5xY53s+rWmBac49/BLzp+xsZqVJdB9cdOI3ohyZAE/S?= =?us-ascii?Q?ZMLzbNWW2ZoKXjpJpXcJeVfZQtbiFXa5n6R5hwYBEmwDtdatKwjP1YrOp8sl?= =?us-ascii?Q?cV5ZFkRha5Da1e4aI8hpXhsuGXks4Pu+iO7Xyd9NYNbk/i1vg07LuqA0LNCD?= =?us-ascii?Q?+faTsIIHvfwLie73WwcxxHtTLO+2gD8NnZjJVvQwfPKSLGRRdRxANC1RtcGq?= =?us-ascii?Q?R1cn16y+3TvellW445jpqW8HLCxYmQwOtNRxbRJlXK0DO7vnYuplPwjP+jxM?= =?us-ascii?Q?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G3qUMsO46myXQnlAA2LQ?= =?us-ascii?Q?0V+/vVY=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.233; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge2.nvidia.com; CAT:NONE; SFS:(13230031)(36860700004)(376005)(1800799015)(82310400017); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2024 10:53:19.6050 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3ce0c641-df3a-4407-9a05-08dc83bb6175 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.233]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000A6732.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5725 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: Gregory Etelson Support non-template flows API in FDB mode: dpdk-testpmd -a $PCI,dv_flow_en=2,representor=vf0-1 -- -i testpmd> flow create 0 group 0 transfer \ pattern eth / end \ actions count / drop / end Signed-off-by: Gregory Etelson --- drivers/net/mlx5/mlx5_flow_hw.c | 46 +++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 66e0b46f9b..43bcaab592 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -12614,6 +12614,28 @@ flow_hw_translate_flow_actions(struct rte_eth_dev *dev, return ret; } +static int +flow_hw_unregister_matcher(struct rte_eth_dev *dev, + struct mlx5_flow_dv_matcher *matcher) +{ + int ret; + struct mlx5_priv *priv = dev->data->dev_private; + + if (matcher->matcher_object) { + ret = mlx5_hlist_unregister(priv->sh->groups, &matcher->group->entry); + if (ret) + goto error; + if (matcher->group) { + ret = mlx5_list_unregister(matcher->group->matchers, &matcher->entry); + if (ret) + goto error; + } + } + return 0; +error: + return -EINVAL; +} + static int flow_hw_register_matcher(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, const struct rte_flow_item items[], @@ -12640,24 +12662,23 @@ static int flow_hw_register_matcher(struct rte_eth_dev *dev, .data = matcher, .data2 = items_ptr, }; - struct mlx5_list_entry *group_entry; - struct mlx5_list_entry *matcher_entry; + struct mlx5_list_entry *group_entry = NULL; + struct mlx5_list_entry *matcher_entry = NULL; struct mlx5_flow_dv_matcher *resource; struct mlx5_list *matchers_list; struct mlx5_flow_group *flow_group; - uint32_t group = 0; int ret; matcher->crc = rte_raw_cksum((const void *)matcher->mask.buf, matcher->mask.size); matcher->priority = attr->priority; - ret = __translate_group(dev, attr, external, attr->group, &group, error); + ret = __translate_group(dev, attr, external, attr->group, &flow_attr.group, error); if (ret) return ret; /* Register the flow group. */ - group_entry = mlx5_hlist_register(priv->sh->groups, group, &ctx); + group_entry = mlx5_hlist_register(priv->sh->groups, flow_attr.group, &ctx); if (!group_entry) goto error; flow_group = container_of(group_entry, struct mlx5_flow_group, entry); @@ -12668,15 +12689,16 @@ static int flow_hw_register_matcher(struct rte_eth_dev *dev, if (!matcher_entry) goto error; resource = container_of(matcher_entry, typeof(*resource), entry); - if (!resource) - goto error; flow->nt2hws->matcher = resource; return 0; error: - if (error) + if (group_entry) + mlx5_hlist_unregister(priv->sh->groups, group_entry); + if (error) { if (sub_error.type != RTE_FLOW_ERROR_TYPE_NONE) rte_memcpy(error, &sub_error, sizeof(sub_error)); + } return rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, "fail to register matcher"); @@ -12899,6 +12921,12 @@ flow_hw_create_flow(struct rte_eth_dev *dev, enum mlx5_flow_type type, mlx5_free(hw_act.push_remove); if (hw_act.mhdr) mlx5_free(hw_act.mhdr); + if (ret) { + /* release after actual error */ + if ((*flow)->nt2hws && (*flow)->nt2hws->matcher) + flow_hw_unregister_matcher(dev, + (*flow)->nt2hws->matcher); + } return ret; } #endif @@ -12945,6 +12973,8 @@ flow_hw_destroy(struct rte_eth_dev *dev, struct rte_flow_hw *flow) if (ret) DRV_LOG(ERR, "failed to release modify action."); } + if (flow->nt2hws->matcher) + flow_hw_unregister_matcher(dev, flow->nt2hws->matcher); } #ifdef HAVE_MLX5_HWS_SUPPORT -- 2.25.1