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 0D986A0C45; Wed, 4 Aug 2021 09:27:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E09E841211; Wed, 4 Aug 2021 09:27:40 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2067.outbound.protection.outlook.com [40.107.237.67]) by mails.dpdk.org (Postfix) with ESMTP id 557EB4014F; Wed, 4 Aug 2021 09:27:39 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BjbAZ0Sf2fyz5sdV/FnR1oyzH+LlNzqyO+g+pXNApeWyuM7G6NtSI7vCE+zFHfrnn6NEqxZww3tkIZfz0kPfQ+4DRGT/eqYy3hb6mH2FGzF1sTvzaxpKsAuuHblmDr+SpfBVyUI1n+t3PQvKDBBBO7eckifOJplZ7ts/vmOmM4pBY4XhTXgDiObqOqSdPE7XDl5Yb5SXyDqwGz2gyiNoKOvyfCI2SoiT/Sb/vPWDOKBGJqv8U/pnH1dLeCq38exV3+2JqzLi6/PzHjro/iU/TcKtMXZWN3GU6d29u8rTrwFWq8KnpMtkqOuK6svr+CKbHyghe9K0d5fP1qL20OolvQ== 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-SenderADCheck; bh=UMGCg/eYZlYkfHi55FxQ3o9n+qmLbqMal3JAPhn8PWk=; b=kKHA8Y3f8RA4fXjVjWLxYVnKoAeXbpFv7X/E1D2m/rEJxuZ55wMNrOrcXHNchfezSnmqE2E7+NuqL+gFolaYyHdYkiPpq/463t7d2Yqwwou8IMthRaC/2wFlqRMU/8ziOT2HBIAiL9CZXJnQ/65mO2lzI6xrpoeO5B+OuJZ+EG5QwtVLE4/sh4d+ybnvK8VUgF09wXx8MEx1awGGF/8M1euIffUXPXk8WucvscMBgPwVK9hcxdwqnUlhtOd+3FyB1/qPxYFPVcc82WYM1XxQdz8wryy024uuVGBn3sQ77w0wvJTHP/OHw7mXBoox0kLekd4/Ntf+WQVmCrpC21r6ww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.32) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none pct=100) action=none 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=UMGCg/eYZlYkfHi55FxQ3o9n+qmLbqMal3JAPhn8PWk=; b=gLVpdTGQMPDuEvRbDVimOK83xxtvUjWA76hhk9V9HqQrEJWXr4KRwvzWNCW7WFW1OkSgGLtz0YBWGyWlptVLvh5I9f6CcQP/HXbyCbLmmtK2hInJfahvTJU+E7mfsY/2Yf3EBdqY4/R8UsnQ+3VkzHm2YsJN2e7B8WLT2OGb/sjvA41i4ZtG37KY4W/jY3nZ5v7R76eU+rYR9p+7SkcMyTE5YfMwYMThzMj7wYBbGFnILKN1SvRhOi7sCBztnqeYH3B8XqRx8FZaQWpq7Tvkk8gkXoBzSWVnUyCehzr3gxFrMkrehV0Uz8k2L3/N2LeMZ2r/kxbbLPNOucwdJ3Ji1g== Received: from DM6PR02CA0041.namprd02.prod.outlook.com (2603:10b6:5:177::18) by BYAPR12MB4743.namprd12.prod.outlook.com (2603:10b6:a03:a5::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.26; Wed, 4 Aug 2021 07:27:37 +0000 Received: from DM6NAM11FT056.eop-nam11.prod.protection.outlook.com (2603:10b6:5:177:cafe::20) by DM6PR02CA0041.outlook.office365.com (2603:10b6:5:177::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.15 via Frontend Transport; Wed, 4 Aug 2021 07:27:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.32) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.32 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.32; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.32) by DM6NAM11FT056.mail.protection.outlook.com (10.13.173.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4373.18 via Frontend Transport; Wed, 4 Aug 2021 07:27:37 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 4 Aug 2021 00:27:36 -0700 Received: from nvidia.com (172.20.187.5) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 4 Aug 2021 07:27:34 +0000 From: Shun Hao To: , , , "Shahaf Shuler" , Michael Baum CC: , , , Date: Wed, 4 Aug 2021 10:26:46 +0300 Message-ID: <20210804072647.2077832-2-shunh@nvidia.com> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20210804072647.2077832-1-shunh@nvidia.com> References: <20210804072647.2077832-1-shunh@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7cc9529c-c687-48ad-1624-08d9571955fb X-MS-TrafficTypeDiagnostic: BYAPR12MB4743: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DBBGdd5Z+tLxMu9f9IJcjgmn/cW6aw6QHDEXMRdn3C3YGUW4gXOZPfHQCtMobz2tkhr+7fh/0EJ7YwXJUJ0lkIKxhzy3r6pZex/NlQJcsttt5JRAoHGhz5TFV1OOTHWcq2gH2C7QMNqbSh7JtwZkDC9oaI3UiFqcdjbhYq2wM3HL5qSBp6WU3IOLkhh5MT+qJO1v6BEEDid8/XusqpllS2SnuwPXHKDzYCvVB1lz5xHi6zWdTN3t/Wi5PihcxA0iFTjCl7aw7rf1eYpbq/Fc383xf5phEgycwKtcUfE16um6oNhTDTZ9tY39rpzjwoAeVNd6gRBU+xHxWDOyxl4oBRQBpwqwXKXgJKov8fRcsvnHlgMk6hwa4fR6VAeeClyzc2yoWEov7Q3XE8WATjj1S+Zfs47qGqYMA8CwFzCvyqHsaALMO6DGeMnr+glJlhcdLXUtkzE1VkM9Bwb7GRVDqUk6gsSzUQ6o9xvnFahWEi1AZq/Q5hofhRs5rDnzm0mJa+Bq5X+UNVQ/v03pPbWma/e4qYEAa/0QpSKOH33z2zUYT4XoRIlBM3Tw5ZVPIStSUZAtSyWzCPSA7cAjX+qwXeMcYgciUubXWjgL+bQI96we7abXfmTBE1W5ZV4Nw7KpPrsxfZ7DG/XPb5g62W66dQYcHggCJXveiMOvQ2F2lpajaQ4CKRR+EBG6m0wUgryWAHWOAD+bJcf2yvLJTN7zBQ== X-Forefront-Antispam-Report: CIP:216.228.112.32; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid01.nvidia.com; CAT:NONE; SFS:(4636009)(39860400002)(396003)(136003)(376002)(346002)(36840700001)(46966006)(5660300002)(36860700001)(336012)(2616005)(316002)(1076003)(36756003)(426003)(7636003)(110136005)(82740400003)(478600001)(356005)(8676002)(6666004)(6286002)(54906003)(6636002)(26005)(186003)(16526019)(70586007)(2906002)(86362001)(8936002)(70206006)(7696005)(82310400003)(83380400001)(4326008)(55016002)(47076005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2021 07:27:37.6833 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7cc9529c-c687-48ad-1624-08d9571955fb X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.32]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT056.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB4743 Subject: [dpdk-dev] [PATCH v1 1/2] net/mlx5: fix meter flow counter traslation 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 Sender: "dev" When an RTE flow uses a meter without any modify packet action, there will be an internal drop flow with meter counter created, matching the same 5-tuple as the original flow. In this case, the meter flow count action is wrongly reused as the original flow counter, leading to wrong flow statistics. Add a check in the count action translation to detect the meter case and use the meter drop dedicated counter in the meter 5-tuple flow only. Fixes: f3191849f2c2 ("net/mlx5: support flow count action handle") Cc: stable@dpdk.org Signed-off-by: Shun Hao Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow_dv.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 4644ae46bd..f54440c6f5 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -12824,13 +12824,26 @@ flow_dv_translate(struct rte_eth_dev *dev, action_flags |= MLX5_FLOW_ACTION_AGE; break; case MLX5_RTE_FLOW_ACTION_TYPE_COUNT: - flow->counter = (uint32_t)(uintptr_t)(action->conf); - cnt_act = flow_dv_counter_get_by_idx(dev, flow->counter, - NULL); - __atomic_fetch_add(&cnt_act->shared_info.refcnt, 1, - __ATOMIC_RELAXED); - /* Save information first, will apply later. */ - action_flags |= MLX5_FLOW_ACTION_COUNT; + cnt_act = flow_dv_counter_get_by_idx(dev, + (uint32_t)(uintptr_t)action->conf, + NULL); + MLX5_ASSERT(cnt_act != NULL); + /** + * When creating meter drop flow in drop table, the + * counter should not overwrite the rte flow counter. + */ + if (attr->group == MLX5_FLOW_TABLE_LEVEL_METER && + dev_flow->dv.table_id == MLX5_MTR_TABLE_ID_DROP) { + dev_flow->dv.actions[actions_n++] = + cnt_act->action; + } else { + flow->counter = + (uint32_t)(uintptr_t)(action->conf); + __atomic_fetch_add(&cnt_act->shared_info.refcnt, + 1, __ATOMIC_RELAXED); + /* Save information first, will apply later. */ + action_flags |= MLX5_FLOW_ACTION_COUNT; + } break; case RTE_FLOW_ACTION_TYPE_COUNT: if (!dev_conf->devx) { -- 2.20.0