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 EEB3FA09EC; Wed, 19 Oct 2022 20:41:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3320842C3A; Wed, 19 Oct 2022 20:41:34 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2049.outbound.protection.outlook.com [40.107.244.49]) by mails.dpdk.org (Postfix) with ESMTP id 6935F42C3A for ; Wed, 19 Oct 2022 20:41:33 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H1dnwD2HbVqbmw2DhlWa9bz/rXTZUjVLf1xR/agPPQSV1i6wmd3qwy3gOFGEMLAnIzqxTWT50nxW9sb5bl3MXkRCa7CEmi3ENUkCKUwSBQxRiUSGuvAzjId6wJKW+n0Lg2pwJK4HSI0OPIpJFM66E01R8fQ3/5TpH1AXLjM/LdadFC6nl+fRHAv4j/usL/xkMlIbEezRYqbqDuh+jxxHxc/o9+kqWpHPYiqTNz2KrvL9qbeHkrw25CFYT+L2AzeiiVpudkGJVuR/EXHkLVGQFQHivN0v8XqSI8+D0v6MFv+5hq3n7/c3yWwSpsf475FQ0BIJzaCwAcIi2TMRG5BtYQ== 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=dHiSJIS/L79E5hP4ukOV4HNRll7oSsUSn874RISD3Es=; b=nDm4b9F7xWlYUJNhhAIJmAaEs+PVv+T3sgwVeLyj5r59v/xP9K+mXdn/WVqB1xDWfx/p71baN+ViWKzJ6euQcP4PggmGDfL0Zb/tKJwcQZYJQIcIU3i/3GB8PSDqFinvjD1KKLj9Tqm4EwJtFoMQUZPBut/Ep+moZfxeIyTgC7/GBZxqyL7Qudh/MNQi0id4AX294mJ5IVeP/cqK/eOrSNodiXSwYLDmjmLxO8daSmeSyxiAmk2cMj4z4Z6yUlb9GrpSKSyQVK+5rV6ppOFUBEEYC1m8l0uJ/JFVmUm6LvtAobyS+IM5omIzPJGWDRuCGBWwP5zWqXXnQUfjVG8EXw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 216.228.117.160) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=nvidia.com; dkim=none (message not signed); arc=none 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=dHiSJIS/L79E5hP4ukOV4HNRll7oSsUSn874RISD3Es=; b=qyx4s4VpKQCdI3qqLfFIz6l98N7W9C46dXoD818frOfRBP3IVjr9PF9St4eYX2IE98xwGyUJhHV5fzpAYZfeRO9NJ1KRh6mchvil58KiPpFKaU+WdVwqDTCaUfiwwhI6FPZLGsp0sMLEQIr/ed9m3ATupY25PqcPAGSSvxlo0mD1ZQ6cScRAgNsisqflzZ41XgGQi2BTpqhI8gCbtEZirSRTUpQRMy/ntzvtKQha9gyGYoKAp8D7l9Za+PMvDcGjLU+ZKoD3VxZ3SCKmQI6lKpeC0R/6l3COZd/p0IcBsPrXDAx3X9qctnYoN2LRI8pw4YX7suY4krCDy+h9T6L5DA== Received: from DS7PR05CA0063.namprd05.prod.outlook.com (2603:10b6:8:57::19) by MN2PR12MB4255.namprd12.prod.outlook.com (2603:10b6:208:198::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Wed, 19 Oct 2022 18:41:31 +0000 Received: from DM6NAM11FT081.eop-nam11.prod.protection.outlook.com (2603:10b6:8:57:cafe::d3) by DS7PR05CA0063.outlook.office365.com (2603:10b6:8:57::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.11 via Frontend Transport; Wed, 19 Oct 2022 18:41:31 +0000 X-MS-Exchange-Authentication-Results: spf=none (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=nvidia.com; Received-SPF: None (protection.outlook.com: nvidia.com does not designate permitted sender hosts) Received: from mail.nvidia.com (216.228.117.160) by DM6NAM11FT081.mail.protection.outlook.com (10.13.172.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.16 via Frontend Transport; Wed, 19 Oct 2022 18:41:31 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Wed, 19 Oct 2022 11:41:17 -0700 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Wed, 19 Oct 2022 11:41:15 -0700 From: Michael Savisko To: CC: , , , , Matan Azrad Subject: [PATCH v2 3/4] net/mlx5: add send to kernel action resource holder Date: Wed, 19 Oct 2022 21:40:06 +0300 Message-ID: <20221019184007.1032874-4-michaelsav@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20221019184007.1032874-1-michaelsav@nvidia.com> References: <20221019184007.1032874-1-michaelsav@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT081:EE_|MN2PR12MB4255:EE_ X-MS-Office365-Filtering-Correlation-Id: a290c0c0-0eee-4d8d-25fc-08dab2018a7a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sHco2ZMGBa6+DXuvb060fj01pVoLjkC/KR9RINN8r/b4yd4PckDeLtDpQW5Hgw6d0Hwm+ZfrHFppHOS6HymWzDTGuNT6Wgwctw/ck+NHcTTFBXYs8xNc5butE0293ab4/GLVn/E2RgguTSNreRunGiGB0TcznYM0OKGKuBYAbeSCStT8Xerd8zhfRWo/Nhm1LKDdloTc16SsbpAOMAH/87p9XArDhhzQbb1iCbhAq5ISLhFgSDhvYK/nvNgwLPReb4i79UE93FqN0YN3oSNwE9BPFtb+z9V/DqlOx8RlOmhtMfEQKCtTgeHC4zp7Rad+sB1BGzeYrxruUEZ15+MI/fvCdpa6uhdsjTnIz1FGKh6CX+Ttro0W1RPydkpqfEU1KVjRvV3GJXXn8V/AI9CmwllmFFu3G/ZVrgFeUNP879lKK5U29U/G6tsf7bfG6FyymFztqbt9Tk84QagU4TJJ4hS+YgaYTUSBr3Xh28B8EHlQIQkfzwgBeRc3jq2gpnNGlbpwuBYc+59N+/MGSJ7nlKldF34rJB+kQUOadK38JfYnrAiZI/kNcIf3V4I7Eac8eWL384QfK0rNNRkToCIiuXpafQVNolSXKKBAizoEa67dc9dAZGLplP5QRCVAq2wapQCJd+S3mXSRRpl7O8jbvFos2PNLHMI+h3v8UyOIZOukSdqo34JJMoR5Z9zz/OplP7MYrrwPOr2cs0NM8Az/mwA812GjLxiZXo2oxmXixJujMTruhOvlAbBopElHZSjZbdb0WFdW29FfU+kkrGbmAQ== X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230022)(4636009)(346002)(396003)(376002)(39860400002)(136003)(451199015)(40470700004)(46966006)(36840700001)(1076003)(16526019)(186003)(83380400001)(47076005)(7636003)(356005)(426003)(36860700001)(86362001)(336012)(2616005)(82740400003)(5660300002)(2906002)(478600001)(8936002)(82310400005)(8676002)(4326008)(55016003)(40480700001)(107886003)(40460700003)(6286002)(26005)(70586007)(6916009)(7696005)(316002)(41300700001)(70206006)(6666004)(54906003)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2022 18:41:31.2912 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a290c0c0-0eee-4d8d-25fc-08dab2018a7a X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT081.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4255 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 Add new structure mlx5_send_to_kernel_action which will hold together allocated action resource and a reference to used table. A new structure member of this type added to struct mlx5_dev_ctx_shared. The member will be initialized upon first created send_to_kernel action and will be reused for all future actions of this type. Release of these resources will be done when all shared DR resources are being released in mlx5_os_free_shared_dr(). Change function flow_dv_tbl_resource_release() from static to external. Signed-off-by: Michael Savisko Acked-by: Matan Azrad --- drivers/net/mlx5/linux/mlx5_os.c | 13 +++++++++++++ drivers/net/mlx5/mlx5.h | 6 ++++++ drivers/net/mlx5/mlx5_flow.h | 2 ++ drivers/net/mlx5/mlx5_flow_dv.c | 6 +----- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 60677eb8d7..3e505d8f4c 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -700,6 +700,19 @@ mlx5_os_free_shared_dr(struct mlx5_priv *priv) mlx5_glue->destroy_flow_action(sh->pop_vlan_action); sh->pop_vlan_action = NULL; } + if (sh->send_to_kernel_action.action) { + void *action = sh->send_to_kernel_action.action; + + mlx5_glue->destroy_flow_action(action); + sh->send_to_kernel_action.action = NULL; + } + if (sh->send_to_kernel_action.tbl) { + struct mlx5_flow_tbl_resource *tbl = + sh->send_to_kernel_action.tbl; + + flow_dv_tbl_resource_release(sh, tbl); + sh->send_to_kernel_action.tbl = NULL; + } #endif /* HAVE_MLX5DV_DR */ if (sh->default_miss_action) mlx5_glue->destroy_flow_action diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 3c9e6bad53..c2c3ed81fa 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -1180,6 +1180,11 @@ struct mlx5_flex_item { struct mlx5_flex_pattern_field map[MLX5_FLEX_ITEM_MAPPING_NUM]; }; +struct mlx5_send_to_kernel_action { + void *action; + void *tbl; +}; + /* * Shared Infiniband device context for Master/Representors * which belong to same IB device with multiple IB ports. @@ -1231,6 +1236,7 @@ struct mlx5_dev_ctx_shared { /* Direct Rules tables for FDB, NIC TX+RX */ void *dr_drop_action; /* Pointer to DR drop action, any domain. */ void *pop_vlan_action; /* Pointer to DR pop VLAN action. */ + struct mlx5_send_to_kernel_action send_to_kernel_action; struct mlx5_hlist *encaps_decaps; /* Encap/decap action hash list. */ struct mlx5_hlist *modify_cmds; struct mlx5_hlist *tag_table; diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 18a77ec619..525db05969 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -1918,6 +1918,8 @@ struct mlx5_flow_tbl_resource *flow_dv_tbl_resource_get(struct rte_eth_dev *dev, bool external, const struct mlx5_flow_tunnel *tunnel, uint32_t group_id, uint8_t dummy, uint32_t table_id, struct rte_flow_error *error); +int flow_dv_tbl_resource_release(struct mlx5_dev_ctx_shared *sh, + struct mlx5_flow_tbl_resource *tbl); struct mlx5_list_entry *flow_dv_tag_create_cb(void *tool_ctx, void *cb_ctx); int flow_dv_tag_match_cb(void *tool_ctx, struct mlx5_list_entry *entry, diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 6c355efed7..bcd9926b81 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -75,10 +75,6 @@ union flow_dv_attr { uint32_t attr; }; -static int -flow_dv_tbl_resource_release(struct mlx5_dev_ctx_shared *sh, - struct mlx5_flow_tbl_resource *tbl); - static int flow_dv_encap_decap_resource_release(struct rte_eth_dev *dev, uint32_t encap_decap_idx); @@ -10928,7 +10924,7 @@ flow_dv_tbl_remove_cb(void *tool_ctx, struct mlx5_list_entry *entry) * @return * Returns 0 if table was released, else return 1; */ -static int +int flow_dv_tbl_resource_release(struct mlx5_dev_ctx_shared *sh, struct mlx5_flow_tbl_resource *tbl) { -- 2.27.0