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 C4A2EA0A0E for ; Tue, 11 May 2021 06:24:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BAE43406A3; Tue, 11 May 2021 06:24:31 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2059.outbound.protection.outlook.com [40.107.93.59]) by mails.dpdk.org (Postfix) with ESMTP id D54B5410ED; Tue, 11 May 2021 06:24:29 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jfeR82vHRdmS9Xel6ZOih4awpUm/KLS5gvTjVV5vhcti3JHpGTJa4qgWbvgY2Uy9gOqaYdGQSbe3lACfA5ILh2z4r1g34m/4wg+jDnQgCemP8mWYUTlBEuCF2FZzm7oJ56Aj7yNp+C5Z0uN9LngeF7TCGjpNZZxkJYEgnltvrE9wdNLRekBcQEHq3Fx/blxrL/0icxV/dIyxwcEWA8IjpQbqCwPmSxgpnJxsruBkIgDLod7+GkSUM9LQUulADh/jyPq/IdBDGYu3gNSRPVqCxCrWItUI9SDjynan9ULK0UEMm2b9SbM0Hq3bf9rHEBlv8GcD+eBd/KeC9pytY6hybQ== 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=vU298hPfOTB9ZCa0itRNaKPNQO2RHXFN9e9y3nuSdHA=; b=UuKzMPTwJ06lgSpG/3w0H/kIUtj3vfB1wfQ6zdf8vert889NH591n2zT5834mcesFnETRtVhJVgeOanlgp7k6NpCAU7I7KOK8bv18jHX/wPyhx4aI9aeDUFd3CK9VX5PL16VTdaXqeZMx7DeuyF68q6+rNz7rM4Ns4d6Fn+CtrQR1Wwru6Y3rWe4ar/aG2GcTKK6YaG0CHHp6T3XZQEYFjbUMtLZizIvTZsdSIqcKaB0JdhcFkG2n884yoP6XF4fRTRenrFebvj9RVIOwJcZTwA1Wbfa3IzLf4VUqDKGI/CZm+fSdAjFejUJp1V+2/5xC88NVngJAkRdCrYZX2WMbQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none 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=vU298hPfOTB9ZCa0itRNaKPNQO2RHXFN9e9y3nuSdHA=; b=dO6RzGa7TvG+opLWQ4l3lco1erGdjQ+CxSc01dy8HS7o8TUMB/w3n8SM3asb2Dh293k5xIgfAv2Wm/ZosnW+DQ/w9OblDm35kLkWicHsXscm1/aTUJWWt7B0SGioTPyipXzUvv2QW6yodnLbweAgXTK4pKzgOWQtdko7kAxLJQEO/flOqlZ3bttpON7vnYHHiLejn8zfBBBGC1LI2uW+lWIyNPMrVMminSridsAIKugiU2eGTZNxNolZ+IQYFHTOPjKlWwZyikVVwc1EoZa0tVqFhX3lI+v7tDJXHzqetuv+2GuetUe7pajBVAnsPWEdBZSNdoEln8Ud3ANLLYAeIA== Received: from DM6PR06CA0004.namprd06.prod.outlook.com (2603:10b6:5:120::17) by SN6PR12MB2703.namprd12.prod.outlook.com (2603:10b6:805:75::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.29; Tue, 11 May 2021 04:24:26 +0000 Received: from DM6NAM11FT065.eop-nam11.prod.protection.outlook.com (2603:10b6:5:120:cafe::26) by DM6PR06CA0004.outlook.office365.com (2603:10b6:5:120::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Tue, 11 May 2021 04:24:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) 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.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT065.mail.protection.outlook.com (10.13.172.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Tue, 11 May 2021 04:24:26 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 11 May 2021 04:24:23 +0000 From: Jiawei Wang To: , , , , Shahaf Shuler , Dekel Peled CC: , , Date: Tue, 11 May 2021 07:24:07 +0300 Message-ID: <20210511042407.5742-2-jiaweiw@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20210511042407.5742-1-jiaweiw@nvidia.com> References: <20210511042407.5742-1-jiaweiw@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c954687d-72ad-4c70-82b2-08d91434a98e X-MS-TrafficTypeDiagnostic: SN6PR12MB2703: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +e48xIqRmdFdpz8T/Q18zA9gTXwVJDI5+D049JHY6yN6mSO062EKs6tfHULsBN5uIMIr5oRU8S0HL1S8f/16oLM5cX3N71zXLAvjmANh0J+NyjfeGzI7Ohfoi6v7OaqvtzdpCHK4TCkT0oI0uaOZZIN3KxaVo30ad+19Eka/OcGXjHeCLuXNr3vL+FpcDW7qFFXUhw4AAUJvu+315Tb5/3/BcgPpvw7sNjusPNdff3jfhCB2k1/ewOAxdy8Lsl4/cLetC1Ey85gQWoklCvcktXsPjg0gsGHKB8IejldG91pRwOe/Wk4yiELXEejdegblgbSWYQrw15VZ0ucOjGNXK3NDNfdlk1s+fgfcl6R/buxRprSSNSS03GNfeot9Tx0dgWj1rdhXniTUMFe3kjcGLXUfu6wiQ4I9tdgvnhUB76xEDpbTX/ZcaIJG4RWFMvOPGvFCYinbRHWDybwl0HS/CPE60XfXt3A/PslSAT3U9OlXfkdBjGuOEYRD8GQlnHJXjkxaySdCnbYnWPvZR1dJI8TGRnYXiYJ5Mscuyk6AFukOFi4LQuWRSrz4E/xC4nwBECRlJAGB3kWHX0N6Kmkcbr2WiguPiQOb+vWixIgV7/twDHZYa4Ywd8dmEd1MPIhOgs06PN8FDB9TYrUo+fYC8Q== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(376002)(396003)(39860400002)(346002)(136003)(46966006)(36840700001)(2906002)(36906005)(26005)(5660300002)(70586007)(36860700001)(8936002)(82310400003)(4326008)(1076003)(6666004)(82740400003)(86362001)(6636002)(7696005)(316002)(356005)(36756003)(6286002)(478600001)(110136005)(83380400001)(47076005)(336012)(2616005)(54906003)(8676002)(426003)(70206006)(55016002)(16526019)(7636003)(186003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2021 04:24:26.4170 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c954687d-72ad-4c70-82b2-08d91434a98e 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.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT065.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2703 Subject: [dpdk-stable] [PATCH 2/2] net/mlx5: fix ASO age null context issue X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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" The flow context in the rte_flow_action_age structure was set by user, and reported by the MLX5 PMD while calling rte_flow_get_aged_flow API. If the flow context was NULL while create ASO age action, while flow aged, the PMD report the NULL context to user. This patch adds the checking if context is NULL then return rte_flow pointer to user, otherwise return the original flow context. Fixes: f9bc5274a6f9 ("net/mlx5: allow age modes combination") Cc: stable@dpdk.org Signed-off-by: Jiawei Wang --- drivers/net/mlx5/mlx5_flow_dv.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 8eddd850f2..72a180bc3f 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -11496,17 +11496,23 @@ flow_dv_aso_age_alloc(struct rte_eth_dev *dev, struct rte_flow_error *error) * * @param[in] dev * Pointer to rte_eth_dev structure. + * @param[in] dev_flow + * Pointer to the sub flow. * @param[in] age * Pointer to the aging action configuration. + * @param[in] shared_age_offset + * Shared age action offset. * @param[out] error * Pointer to the error structure. * * @return - * Index to flow counter on success, 0 otherwise. + * Index to flow ASO age on success, 0 otherwise. */ static uint32_t flow_dv_translate_create_aso_age(struct rte_eth_dev *dev, + struct mlx5_flow *dev_flow, const struct rte_flow_action_age *age, + uint32_t shared_age_offset, struct rte_flow_error *error) { uint32_t age_idx = 0; @@ -11516,7 +11522,12 @@ flow_dv_translate_create_aso_age(struct rte_eth_dev *dev, if (!age_idx) return 0; aso_age = flow_aso_age_get_by_idx(dev, age_idx); - aso_age->age_params.context = age->context; + if (shared_age_offset) + aso_age->age_params.context = + (void *)(uintptr_t)(shared_age_offset | age_idx); + else + aso_age->age_params.context = age->context ? age->context : + (void *)(uintptr_t)(dev_flow->flow_idx); aso_age->age_params.timeout = age->timeout; aso_age->age_params.port_id = dev->data->port_id; __atomic_store_n(&aso_age->age_params.sec_since_last_hit, 0, @@ -12637,8 +12648,9 @@ flow_dv_translate(struct rte_eth_dev *dev, dev_flow->dv.group) { flow->age = flow_dv_translate_create_aso_age - (dev, + (dev, dev_flow, non_shared_age, + 0, error); if (!flow->age) return rte_flow_error_set @@ -14220,17 +14232,12 @@ flow_dv_action_create(struct rte_eth_dev *dev, MLX5_INDIRECT_ACTION_TYPE_OFFSET) | ret; break; case RTE_FLOW_ACTION_TYPE_AGE: - ret = flow_dv_translate_create_aso_age(dev, action->conf, err); idx = (MLX5_INDIRECT_ACTION_TYPE_AGE << - MLX5_INDIRECT_ACTION_TYPE_OFFSET) | ret; - if (ret) { - struct mlx5_aso_age_action *aso_age = - flow_aso_age_get_by_idx(dev, ret); - - if (!aso_age->age_params.context) - aso_age->age_params.context = - (void *)(uintptr_t)idx; - } + MLX5_INDIRECT_ACTION_TYPE_OFFSET); + ret = flow_dv_translate_create_aso_age(dev, NULL, + action->conf, + idx, err); + idx |= ret; break; case RTE_FLOW_ACTION_TYPE_COUNT: ret = flow_dv_translate_create_counter(dev, NULL, NULL, NULL); -- 2.18.1