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 84CCEA0C43; Wed, 12 May 2021 13:54:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BB2444110E; Wed, 12 May 2021 13:54:34 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on2045.outbound.protection.outlook.com [40.107.100.45]) by mails.dpdk.org (Postfix) with ESMTP id F1A8A410F8; Wed, 12 May 2021 13:54:32 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OAR4cPfuvDwmEgqp2GMzaP+5Bj9H7AKJBXCPmxJ1M7rL7OBmOlbxzXSugOBb3rgp4l3EsNVcv2hs6GqkDzYWhFzThMzbMnfsj8sqdsAlHdaHCkJoJrndEIB6BU+ke66qF+eTosBOHPjEDv5uAzKlgo7UyPqQQ/nzZO3lBpN84f6gpaubRxclni9xvTRN/+inCMxITWv4Ei5b3vHE61pVmpDD2+5vJTAm4vhOU/uKa73gFW6/uj3slfC1Cg1LE3ntepZSQnFxwyUyWGVSrsANLm4GW28jXOYB+WlMQsdsUURvgIQU9SqMUo5q0qSnV9pPjq/kR9ugewowrzi7ETAW8Q== 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=eyzAOGGlP4jC/SyV0kAQ0Y2kn76BvVodQVAZueFy52KobX47/2Bz9UME2IvaGIigydR7mvd9KXg46rgwWtIBneueW2tEhFdd8upqlPJeM5LUP6oXMpQshZsAmPmR/z6clHbsuCqk5z2l28+Mps1vegnqPTxbfHI0rMX+TGXOCR2W6THzJ8oyk4+xfb9qEbfjzbf/yNR9J2XxG+jWycOxrqS12MkNG1IT9/0iiUDbGNVs7uX6g9A/F/MWDx83xoaJE09K1d9mUO/eWUO5lZr+XhZCtkqgRR0OaabePDp+90fzziLWhWHYwjaDFnGzfPl4/N9pvn28LivYPLSWtOc5Qw== 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=BKgvAAJKtkPxC8zlhKJoj94arzRNWaXsXfLMpQ6sJxqPsYFDLJIRyzRCLFpv9VpX7LoOTJkuR2+P2HWda01fBktXtQRxBd0nlxURCHXq9dQazKotO8v3kJd4+Ch1ns7/C0RHEhAQfuiZSFOvpxH4g4Meeg7AhaQSs4DRdEPthmEgabgsdhVcvLz+c0Y0gXZcOBeLUvhswiwjSmL+jvffwBfem7xpXwxWyjlEboYgk2gUjZ46F0bi6C9MG7zIPCEr15qXUEhbUrw8A+GluFBpykc2xYlOFOmxZXjfs36GAdg4P9zaEoXNLvqpRAMZLGvLDfmPM8LfdTrLLDdwhvQXkw== Received: from BN6PR11CA0020.namprd11.prod.outlook.com (2603:10b6:405:2::30) by BYAPR12MB2871.namprd12.prod.outlook.com (2603:10b6:a03:13d::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.31; Wed, 12 May 2021 11:54:31 +0000 Received: from BN8NAM11FT059.eop-nam11.prod.protection.outlook.com (2603:10b6:405:2:cafe::cd) by BN6PR11CA0020.outlook.office365.com (2603:10b6:405:2::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 12 May 2021 11:54:31 +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 BN8NAM11FT059.mail.protection.outlook.com (10.13.177.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4129.25 via Frontend Transport; Wed, 12 May 2021 11:54:31 +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; Wed, 12 May 2021 11:54:27 +0000 From: Jiawei Wang To: , , , , , Shahaf Shuler , Dekel Peled CC: , , Date: Wed, 12 May 2021 14:52:38 +0300 Message-ID: <20210512115239.12783-3-jiaweiw@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20210512115239.12783-1-jiaweiw@nvidia.com> References: <20210511042407.5742-1-jiaweiw@nvidia.com> <20210512115239.12783-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: 5055fa4d-e158-4c07-f86a-08d9153cb415 X-MS-TrafficTypeDiagnostic: BYAPR12MB2871: 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: PxbBmcqTk+pm3bDG1pxV2eEDeTN/OluW4r/LDEeTZGZ2ueeW1invH3Ws1S0Rb6xyVqU/fukSI4gsWwYZElQIYfomTHrCxsTid0gO++/jWaLXoSdpSlf8quILvB/aK/Q3fEHoqU+OUd4HXfhaT+EokydTimU2XF3/Pc/zMZwBiTHaKx8Ng3hZ3DcUmPmfI5jol6jRdpCMlee82B2eNSKbe+UBGXm4hvkmxxg9xAjBCwVxMQOetwZL6FlT3aJauk3o5C0VLR9c/XrcyAmGiDDn+I8I++cc7orKtCrMxepK2zofO8bvhpqtHBk3DKuQ/KFJl8heoLgUc3K6xTwxt1wHs/CPqEQa5RSzUz3QSmviipc2Lm8eLVkDvd01kXJB3Fhz3YaPHBhtsAoTNbLUxJQDlL0aAJOABQMTKQHnqToxCRtJQ7aCznTzpq05lNctZzr2omHAPSaKLKe3RQBembyhPQ758nl30/qTZwJoeqXnUt72S16Vj5YR7nLGPU1Kf7aIuuF5p1oDi5WDH3Rn5E0QXSchczQWoL8n5dvy36IvZIEO6qY1klOuRfJcJB5iJtEAXzqEKlcZku9p/1Blef1mhBWZaofIqtb6FLAQXgHmN4ufOQRpItlczjrQyQZRtR0IkwxSXyWUHUgVpMS0r4wROQ== 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)(346002)(376002)(136003)(396003)(39860400002)(46966006)(36840700001)(82310400003)(6666004)(6286002)(7636003)(4326008)(8936002)(7696005)(26005)(6636002)(2616005)(426003)(336012)(54906003)(86362001)(36860700001)(36906005)(70206006)(316002)(70586007)(36756003)(478600001)(1076003)(2906002)(186003)(82740400003)(356005)(83380400001)(55016002)(47076005)(5660300002)(110136005)(16526019)(8676002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2021 11:54:31.1416 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5055fa4d-e158-4c07-f86a-08d9153cb415 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: BN8NAM11FT059.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2871 Subject: [dpdk-dev] [PATCH 2/2] net/mlx5: fix ASO age null context issue 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" 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