From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 38631A0093 for ; Tue, 19 May 2020 15:10:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 30F5D1D6A4; Tue, 19 May 2020 15:10:32 +0200 (CEST) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by dpdk.org (Postfix) with ESMTP id DD6AA1D6DF for ; Tue, 19 May 2020 15:10:30 +0200 (CEST) Received: by mail-wm1-f67.google.com with SMTP id w64so3483778wmg.4 for ; Tue, 19 May 2020 06:10:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FkV6OJDIqLyTAWgDnUuLu9NSHMIy5wGttRisLo5Xjoo=; b=Q9ZrpmpPV2Hsl56EBfkSBKlCMPcJI95SijMawZ240SPGm1c3MqN4iD/KbWQ2Owa8zX PJPYHbVQ3A0TeYk+I8zhMH8oCjXSAxHM5N39L/STQpPUvP+q4CFodvjLIfkNEJoXd/Aw JT2FLEm4R1ZDLnVHldGXCL6L7CYr5wML9Syxsw0+rTsXRcOzDeJazs0q5aaK1SznYFyf po5U4t8N9oZYaBFo41T5bKppXntPfmI0ruQzWRyKus3nvtRUBISkKrpuZV7+uydDSsU7 ey73X23gq4eWiugB37x83U6e7nVRpZdEZ7zb/Uv/Dc5RFlA5pqYt5mNjOd/DKcPDX/HV BrlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FkV6OJDIqLyTAWgDnUuLu9NSHMIy5wGttRisLo5Xjoo=; b=XdocpLnqxiaKq8+XQ3wv76EJmKTwvIBgH8hzV8o58tSoO9ce1v8CDYX89F/JFBFQyt JepKb05v4nUlGF3Vl56yKCl+WfCp5x+HALB/rq2XVIn3NcomxFvX21v0E41jZgng69hz ubXMVoK+PA1zr8uf9bcCUv3EUO8rtTcEleWTpEtEdo+fZ+VHKGKPkXTqv1ZzOYKfIJI8 blvA6Z1DzeMEuIfJW564uOgR8J6rDj08JLJk+H2COAdsLLhXX+YJJGgi5ANOKQ8j+VrN m0R+Dna/FZ7M91nGfdo+DiDOcPVIg5qR06tpCxaYlFXo6aucqCrDy6mDoK7aPXQaoNMu F5pQ== X-Gm-Message-State: AOAM5338ljsk9bVDOpJPY6zajcHO3F0TkLxb0tBNHzC8SDivx2a1jeoR w1nHekbZ4BazULxVvlwICH4= X-Google-Smtp-Source: ABdhPJw6igpdH5G1+xvebZe5OPD9qhKrPTWTjQZt6NEtJkPAeueV8nR7EY2AX4utOb0IxE6fc5FDYA== X-Received: by 2002:a1c:29c4:: with SMTP id p187mr5419000wmp.73.1589893830509; Tue, 19 May 2020 06:10:30 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id z11sm20850643wro.48.2020.05.19.06.10.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 06:10:29 -0700 (PDT) From: luca.boccassi@gmail.com To: Suanming Mou Cc: Viacheslav Ovsiienko , dpdk stable Date: Tue, 19 May 2020 14:03:43 +0100 Message-Id: <20200519130549.112823-88-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200519130549.112823-1-luca.boccassi@gmail.com> References: <20200519125804.104349-1-luca.boccassi@gmail.com> <20200519130549.112823-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/mlx5: fix meter suffix table leak' has been queued to stable release 19.11.3 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/21/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From 652a21028a466bceadffb6a26484292206b0c0c0 Mon Sep 17 00:00:00 2001 From: Suanming Mou Date: Mon, 13 Apr 2020 21:29:12 +0800 Subject: [PATCH] net/mlx5: fix meter suffix table leak [ upstream commit 9dbaf7eef6e17113f5c681c3c4fcee6bcda4b5f0 ] Currently, the meter suffix table is created and saved in the mlx5 shared struct. It causes the suffix table will never be released even without any meter rules. Move the suffix table to meter domain struct to help the suffix table be released when all the meter rules are destroyed. Fixes: 46a5e6bc6a85 ("net/mlx5: prepare meter flow tables") Signed-off-by: Suanming Mou Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5.h | 6 ----- drivers/net/mlx5/mlx5_flow.h | 2 ++ drivers/net/mlx5/mlx5_flow_dv.c | 48 +++++++++++++++------------------ 3 files changed, 23 insertions(+), 33 deletions(-) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index a3f42995f2..73142085f7 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -667,14 +667,8 @@ struct mlx5_ibv_shared { uint32_t dv_regc0_mask; /* available bits of metatada reg_c[0]. */ uint32_t dv_refcnt; /* DV/DR data reference counter. */ void *fdb_domain; /* FDB Direct Rules name space handle. */ - struct mlx5_flow_tbl_resource *fdb_mtr_sfx_tbl; - /* FDB meter suffix rules table. */ void *rx_domain; /* RX Direct Rules name space handle. */ - struct mlx5_flow_tbl_resource *rx_mtr_sfx_tbl; - /* RX meter suffix rules table. */ void *tx_domain; /* TX Direct Rules name space handle. */ - struct mlx5_flow_tbl_resource *tx_mtr_sfx_tbl; - /* TX meter suffix rules table. */ struct mlx5_hlist *flow_tbls; /* Direct Rules tables for FDB, NIC TX+RX */ void *esw_drop_action; /* Pointer to DR E-Switch drop action. */ diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 2353e182d1..6d278c63d8 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -572,6 +572,8 @@ struct mlx5_flow_policer_stats { struct mlx5_meter_domain_info { struct mlx5_flow_tbl_resource *tbl; /**< Meter table. */ + struct mlx5_flow_tbl_resource *sfx_tbl; + /**< Meter suffix table. */ void *any_matcher; /**< Meter color not match default criteria. */ void *color_matcher; diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 88793eb7a7..1f53aad40f 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -8108,6 +8108,9 @@ flow_dv_destroy_mtr_tbl(struct rte_eth_dev *dev, if (mtd->egress.tbl) claim_zero(flow_dv_tbl_resource_release(dev, mtd->egress.tbl)); + if (mtd->egress.sfx_tbl) + claim_zero(flow_dv_tbl_resource_release(dev, + mtd->egress.sfx_tbl)); if (mtd->ingress.color_matcher) claim_zero(mlx5_glue->dv_destroy_flow_matcher (mtd->ingress.color_matcher)); @@ -8117,6 +8120,9 @@ flow_dv_destroy_mtr_tbl(struct rte_eth_dev *dev, if (mtd->ingress.tbl) claim_zero(flow_dv_tbl_resource_release(dev, mtd->ingress.tbl)); + if (mtd->ingress.sfx_tbl) + claim_zero(flow_dv_tbl_resource_release(dev, + mtd->ingress.sfx_tbl)); if (mtd->transfer.color_matcher) claim_zero(mlx5_glue->dv_destroy_flow_matcher (mtd->transfer.color_matcher)); @@ -8126,6 +8132,9 @@ flow_dv_destroy_mtr_tbl(struct rte_eth_dev *dev, if (mtd->transfer.tbl) claim_zero(flow_dv_tbl_resource_release(dev, mtd->transfer.tbl)); + if (mtd->transfer.sfx_tbl) + claim_zero(flow_dv_tbl_resource_release(dev, + mtd->transfer.sfx_tbl)); if (mtd->drop_actn) claim_zero(mlx5_glue->destroy_flow_action(mtd->drop_actn)); rte_free(mtd); @@ -8173,31 +8182,16 @@ flow_dv_prepare_mtr_tables(struct rte_eth_dev *dev, .match_mask = (void *)&mask, }; void *actions[METER_ACTIONS]; - struct mlx5_flow_tbl_resource **sfx_tbl; struct mlx5_meter_domain_info *dtb; struct rte_flow_error error; int i = 0; - if (transfer) { - sfx_tbl = &sh->fdb_mtr_sfx_tbl; + if (transfer) dtb = &mtb->transfer; - } else if (egress) { - sfx_tbl = &sh->tx_mtr_sfx_tbl; + else if (egress) dtb = &mtb->egress; - } else { - sfx_tbl = &sh->rx_mtr_sfx_tbl; + else dtb = &mtb->ingress; - } - /* If the suffix table in missing, create it. */ - if (!(*sfx_tbl)) { - *sfx_tbl = flow_dv_tbl_resource_get(dev, - MLX5_FLOW_TABLE_LEVEL_SUFFIX, - egress, transfer, &error); - if (!(*sfx_tbl)) { - DRV_LOG(ERR, "Failed to create meter suffix table."); - return -1; - } - } /* Create the meter table with METER level. */ dtb->tbl = flow_dv_tbl_resource_get(dev, MLX5_FLOW_TABLE_LEVEL_METER, egress, transfer, &error); @@ -8205,6 +8199,14 @@ flow_dv_prepare_mtr_tables(struct rte_eth_dev *dev, DRV_LOG(ERR, "Failed to create meter policer table."); return -1; } + /* Create the meter suffix table with SUFFIX level. */ + dtb->sfx_tbl = flow_dv_tbl_resource_get(dev, + MLX5_FLOW_TABLE_LEVEL_SUFFIX, + egress, transfer, &error); + if (!dtb->sfx_tbl) { + DRV_LOG(ERR, "Failed to create meter suffix table."); + return -1; + } /* Create matchers, Any and Color. */ dv_attr.priority = 3; dv_attr.match_criteria_enable = 0; @@ -8375,8 +8377,6 @@ flow_dv_destroy_policer_rules(struct rte_eth_dev *dev __rte_unused, * Pointer to flow meter structure. * @param[in] mtb * Pointer to DV meter table set. - * @param[in] sfx_tb - * Pointer to suffix table. * @param[in] mtr_reg_c * Color match REG_C. * @@ -8386,7 +8386,6 @@ flow_dv_destroy_policer_rules(struct rte_eth_dev *dev __rte_unused, static int flow_dv_create_policer_forward_rule(struct mlx5_flow_meter *fm, struct mlx5_meter_domain_info *dtb, - struct mlx5_flow_tbl_resource *sfx_tb, uint8_t mtr_reg_c) { struct mlx5_flow_dv_match_params matcher = { @@ -8400,12 +8399,10 @@ flow_dv_create_policer_forward_rule(struct mlx5_flow_meter *fm, int i; /* Create jump action. */ - if (!sfx_tb) - return -1; if (!dtb->jump_actn) dtb->jump_actn = mlx5_glue->dr_create_flow_action_dest_flow_tbl - (sfx_tb->obj); + (dtb->sfx_tbl->obj); if (!dtb->jump_actn) { DRV_LOG(ERR, "Failed to create policer jump action."); goto error; @@ -8460,7 +8457,6 @@ flow_dv_create_policer_rules(struct rte_eth_dev *dev, if (attr->egress) { ret = flow_dv_create_policer_forward_rule(fm, &mtb->egress, - priv->sh->tx_mtr_sfx_tbl, priv->mtr_color_reg); if (ret) { DRV_LOG(ERR, "Failed to create egress policer."); @@ -8469,7 +8465,6 @@ flow_dv_create_policer_rules(struct rte_eth_dev *dev, } if (attr->ingress) { ret = flow_dv_create_policer_forward_rule(fm, &mtb->ingress, - priv->sh->rx_mtr_sfx_tbl, priv->mtr_color_reg); if (ret) { DRV_LOG(ERR, "Failed to create ingress policer."); @@ -8478,7 +8473,6 @@ flow_dv_create_policer_rules(struct rte_eth_dev *dev, } if (attr->transfer) { ret = flow_dv_create_policer_forward_rule(fm, &mtb->transfer, - priv->sh->fdb_mtr_sfx_tbl, priv->mtr_color_reg); if (ret) { DRV_LOG(ERR, "Failed to create transfer policer."); -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-05-19 14:04:48.045265010 +0100 +++ 0088-net-mlx5-fix-meter-suffix-table-leak.patch 2020-05-19 14:04:44.280649533 +0100 @@ -1,8 +1,10 @@ -From 9dbaf7eef6e17113f5c681c3c4fcee6bcda4b5f0 Mon Sep 17 00:00:00 2001 +From 652a21028a466bceadffb6a26484292206b0c0c0 Mon Sep 17 00:00:00 2001 From: Suanming Mou Date: Mon, 13 Apr 2020 21:29:12 +0800 Subject: [PATCH] net/mlx5: fix meter suffix table leak +[ upstream commit 9dbaf7eef6e17113f5c681c3c4fcee6bcda4b5f0 ] + Currently, the meter suffix table is created and saved in the mlx5 shared struct. It causes the suffix table will never be released even without any meter rules. @@ -11,7 +13,6 @@ be released when all the meter rules are destroyed. Fixes: 46a5e6bc6a85 ("net/mlx5: prepare meter flow tables") -Cc: stable@dpdk.org Signed-off-by: Suanming Mou Acked-by: Viacheslav Ovsiienko @@ -22,10 +23,10 @@ 3 files changed, 23 insertions(+), 33 deletions(-) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h -index 94178e7ae7..1850cf94ab 100644 +index a3f42995f2..73142085f7 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h -@@ -455,14 +455,8 @@ struct mlx5_ibv_shared { +@@ -667,14 +667,8 @@ struct mlx5_ibv_shared { uint32_t dv_regc0_mask; /* available bits of metatada reg_c[0]. */ uint32_t dv_refcnt; /* DV/DR data reference counter. */ void *fdb_domain; /* FDB Direct Rules name space handle. */ @@ -41,10 +42,10 @@ /* Direct Rules tables for FDB, NIC TX+RX */ void *esw_drop_action; /* Pointer to DR E-Switch drop action. */ diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h -index daa1f84145..df09d0bb6f 100644 +index 2353e182d1..6d278c63d8 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h -@@ -642,6 +642,8 @@ struct mlx5_flow_policer_stats { +@@ -572,6 +572,8 @@ struct mlx5_flow_policer_stats { struct mlx5_meter_domain_info { struct mlx5_flow_tbl_resource *tbl; /**< Meter table. */ @@ -54,10 +55,10 @@ /**< Meter color not match default criteria. */ void *color_matcher; diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c -index 18ea577f8c..0676b6f203 100644 +index 88793eb7a7..1f53aad40f 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c -@@ -8516,6 +8516,9 @@ flow_dv_destroy_mtr_tbl(struct rte_eth_dev *dev, +@@ -8108,6 +8108,9 @@ flow_dv_destroy_mtr_tbl(struct rte_eth_dev *dev, if (mtd->egress.tbl) claim_zero(flow_dv_tbl_resource_release(dev, mtd->egress.tbl)); @@ -67,7 +68,7 @@ if (mtd->ingress.color_matcher) claim_zero(mlx5_glue->dv_destroy_flow_matcher (mtd->ingress.color_matcher)); -@@ -8525,6 +8528,9 @@ flow_dv_destroy_mtr_tbl(struct rte_eth_dev *dev, +@@ -8117,6 +8120,9 @@ flow_dv_destroy_mtr_tbl(struct rte_eth_dev *dev, if (mtd->ingress.tbl) claim_zero(flow_dv_tbl_resource_release(dev, mtd->ingress.tbl)); @@ -77,7 +78,7 @@ if (mtd->transfer.color_matcher) claim_zero(mlx5_glue->dv_destroy_flow_matcher (mtd->transfer.color_matcher)); -@@ -8534,6 +8540,9 @@ flow_dv_destroy_mtr_tbl(struct rte_eth_dev *dev, +@@ -8126,6 +8132,9 @@ flow_dv_destroy_mtr_tbl(struct rte_eth_dev *dev, if (mtd->transfer.tbl) claim_zero(flow_dv_tbl_resource_release(dev, mtd->transfer.tbl)); @@ -87,7 +88,7 @@ if (mtd->drop_actn) claim_zero(mlx5_glue->destroy_flow_action(mtd->drop_actn)); rte_free(mtd); -@@ -8581,31 +8590,16 @@ flow_dv_prepare_mtr_tables(struct rte_eth_dev *dev, +@@ -8173,31 +8182,16 @@ flow_dv_prepare_mtr_tables(struct rte_eth_dev *dev, .match_mask = (void *)&mask, }; void *actions[METER_ACTIONS]; @@ -122,7 +123,7 @@ /* Create the meter table with METER level. */ dtb->tbl = flow_dv_tbl_resource_get(dev, MLX5_FLOW_TABLE_LEVEL_METER, egress, transfer, &error); -@@ -8613,6 +8607,14 @@ flow_dv_prepare_mtr_tables(struct rte_eth_dev *dev, +@@ -8205,6 +8199,14 @@ flow_dv_prepare_mtr_tables(struct rte_eth_dev *dev, DRV_LOG(ERR, "Failed to create meter policer table."); return -1; } @@ -137,7 +138,7 @@ /* Create matchers, Any and Color. */ dv_attr.priority = 3; dv_attr.match_criteria_enable = 0; -@@ -8786,8 +8788,6 @@ flow_dv_destroy_policer_rules(struct rte_eth_dev *dev __rte_unused, +@@ -8375,8 +8377,6 @@ flow_dv_destroy_policer_rules(struct rte_eth_dev *dev __rte_unused, * Pointer to flow meter structure. * @param[in] mtb * Pointer to DV meter table set. @@ -146,7 +147,7 @@ * @param[in] mtr_reg_c * Color match REG_C. * -@@ -8797,7 +8797,6 @@ flow_dv_destroy_policer_rules(struct rte_eth_dev *dev __rte_unused, +@@ -8386,7 +8386,6 @@ flow_dv_destroy_policer_rules(struct rte_eth_dev *dev __rte_unused, static int flow_dv_create_policer_forward_rule(struct mlx5_flow_meter *fm, struct mlx5_meter_domain_info *dtb, @@ -154,7 +155,7 @@ uint8_t mtr_reg_c) { struct mlx5_flow_dv_match_params matcher = { -@@ -8811,12 +8810,10 @@ flow_dv_create_policer_forward_rule(struct mlx5_flow_meter *fm, +@@ -8400,12 +8399,10 @@ flow_dv_create_policer_forward_rule(struct mlx5_flow_meter *fm, int i; /* Create jump action. */ @@ -168,7 +169,7 @@ if (!dtb->jump_actn) { DRV_LOG(ERR, "Failed to create policer jump action."); goto error; -@@ -8871,7 +8868,6 @@ flow_dv_create_policer_rules(struct rte_eth_dev *dev, +@@ -8460,7 +8457,6 @@ flow_dv_create_policer_rules(struct rte_eth_dev *dev, if (attr->egress) { ret = flow_dv_create_policer_forward_rule(fm, &mtb->egress, @@ -176,7 +177,7 @@ priv->mtr_color_reg); if (ret) { DRV_LOG(ERR, "Failed to create egress policer."); -@@ -8880,7 +8876,6 @@ flow_dv_create_policer_rules(struct rte_eth_dev *dev, +@@ -8469,7 +8465,6 @@ flow_dv_create_policer_rules(struct rte_eth_dev *dev, } if (attr->ingress) { ret = flow_dv_create_policer_forward_rule(fm, &mtb->ingress, @@ -184,7 +185,7 @@ priv->mtr_color_reg); if (ret) { DRV_LOG(ERR, "Failed to create ingress policer."); -@@ -8889,7 +8884,6 @@ flow_dv_create_policer_rules(struct rte_eth_dev *dev, +@@ -8478,7 +8473,6 @@ flow_dv_create_policer_rules(struct rte_eth_dev *dev, } if (attr->transfer) { ret = flow_dv_create_policer_forward_rule(fm, &mtb->transfer,