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 7CF31A0524; Wed, 5 May 2021 11:52:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0A26841148; Wed, 5 May 2021 11:50:58 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on2083.outbound.protection.outlook.com [40.107.100.83]) by mails.dpdk.org (Postfix) with ESMTP id 2921B41148 for ; Wed, 5 May 2021 11:50:57 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VmGIqkKU6r2JxqntoSXBVA8dJb9c1u/OQN5P7m7AXjyrH7ttWyLaUcfiDXSxyh3jGJt+ElxzmHZQ7TVcS0LUHpNuPy/lm+QHh7n/2m5KrJ8JazGsAtnxJ5Gl6lBSckGugr7NARieed7r219jl/j+lLh4uLBwQ+yV6NdE42xxoNByXTcfaPdjnQyDHHw9/bd59NsixTuLf49LdZkgQvtKUukRveR9prVlTAlKQVFjxSO2dGf4Paia3wdWM+UC5IqYJYbXUG4OIM6zwXCgWIyHc/8uM67SYIt82DGlxTGWOqYyIkFC3xWgZw4u5+GQdtzBS9s15SNewn8rs6HbvdLk5g== 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=B8JYS/hle6GMv+MilXtdqoillDcNhKV+me4rJ1sWrNI=; b=kO1EFYaxtix84mpm+JfGK55XLhyu19EsTOUoqdRPPi9HIwdKnSc7UKv/KujF0kNGOFNzdncPFVRG9tChoG356oZx5kFRYur6sepKJZRPMPGpg5EERL4NnOthuahZDT50srFONkUMuW0DCazxhfN/gSqGzB3ydKQle3L0KI7InxMSKN276VDOPeilpWlk69bQjGiuWsnEyiKMNA+1ziMehKjcK1tKZNIQBS/RnPAvhJPmWlGjLGGDaga6RvjzYJY6G0TTzVBu0KNmvHNYP8gASTHD4A2BW3s+aDZdolrwDkBacvGcVv1jdR5G4nUQYU7deLj/0EPgL7EkRCfS1SVxeA== 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=B8JYS/hle6GMv+MilXtdqoillDcNhKV+me4rJ1sWrNI=; b=OpnQY1YMfsjPKA9CVeUoOIyxQQBN4G341e8oBckDDgcSFWUeJOY/+uXewg1IrKncZqAEObPU1eZcj7L2sj2AbmTGZjziKRgEQXXAAsPvja00MlYSd7Is2SlEw6HK59bySqvFVRRJxhzsdLnM4X4GfjNgN4Ko7wtACjny4iz2yIczmbd3cw2NIIRihp9naVDOa3EiIjgJg2RJALariIRBiYiCycF+bpvdP5+7un1DWgrnwz+aKaz7xq0ZTsZn4yXL6xwSv8vCwJEnu/q3dQY22E7wJ3aBG5EJv5fka4CXTYDZph5dem64qg2/dm5Fn8Kwrv+6V+ML90Fll+P8E5Ky7g== Received: from BN9PR03CA0964.namprd03.prod.outlook.com (2603:10b6:408:109::9) by SN6PR12MB2831.namprd12.prod.outlook.com (2603:10b6:805:ec::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.25; Wed, 5 May 2021 09:50:53 +0000 Received: from BN8NAM11FT018.eop-nam11.prod.protection.outlook.com (2603:10b6:408:109:cafe::fb) by BN9PR03CA0964.outlook.office365.com (2603:10b6:408:109::9) 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, 5 May 2021 09:50:53 +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 BN8NAM11FT018.mail.protection.outlook.com (10.13.176.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 5 May 2021 09:50:52 +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, 5 May 2021 09:50:50 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 12:50:05 +0300 Message-ID: <20210505095009.40250-14-bingz@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210505095009.40250-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505095009.40250-1-bingz@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a4e0d720-52c4-4dd3-9760-08d90fab459b X-MS-TrafficTypeDiagnostic: SN6PR12MB2831: 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-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PN36C/GI40mhkDXYE3jP5c2Z6eEfm7DlDXVhkoXLgFb35YpzpH23L+Cj6YBomUA1EdYYxin+/xWvrRi3ixCQQ3Xxi3pVXWQgB7hA+R7ZvXsRHGhXeGdqLMd+pz8KFi28Jjy50Oc8t2o0K40j5c/zewzMgWvgEetLrlcO21Aopv5fvXrPe7aw2QZ2Ie0V+VOxijLE/ZEVGKDcGEdW2iXhafkAiqXR2hqsTySg90ii0dl1sn6ZOZ7HdRulySqcMglW8M8oU6MGvYlEook9fodBUAGokpYNC6rUo9KvGZP7yCC+fDXp+2Uoc5Pu230jXmvuPk2sX3+0/S7BQmX08FICStt8h8iQocPw6ZduQb1kISqMgOjvHoKJV/uA2HWU1uQig/jHMBG5qDQa3XSBzX+mW2kxl5BK1jiwlQfAokbA4izvuSoWhNq1ALf5/uojvTkAUWV+GRey4Ag2CyqrNjneougl5kjTnrOif84wXVLEavYlXb8uWPlO4GV2QK9Z9G7dbyD2rPnJVAeg4XrPFjUjk12P1takPQ+ns5NKFlyWmnmvrw5ycshpDebdr+5nxtdMJsuDBpOiuZAxEIMj/Em9g07brsF8zFuDU32ZPZOvSVlUf+ZzlEezMYUXK9wdAOdkqGNi3VBbLLnI/l+CjZMYrDaxTZ3w5ZNIJ2jnJLKppCJ+88SkIuX7RaDAQ0HQ34JZ 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)(39860400002)(346002)(136003)(396003)(36840700001)(46966006)(6666004)(2616005)(4326008)(110136005)(54906003)(8936002)(36906005)(6286002)(8676002)(47076005)(107886003)(26005)(5660300002)(426003)(82740400003)(15650500001)(70586007)(2906002)(478600001)(36860700001)(36756003)(83380400001)(1076003)(82310400003)(7696005)(70206006)(356005)(7636003)(55016002)(316002)(86362001)(336012)(186003)(16526019)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 09:50:52.9535 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a4e0d720-52c4-4dd3-9760-08d90fab459b 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: BN8NAM11FT018.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2831 Subject: [dpdk-dev] [PATCH v6 13/17] net/mlx5: add CT context update 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 updating a connection tracking context, two separate parts could be updated. First, the direction. This will only update the traffic direction recorded in the software for flow creation. Second, the TCP parameters. The hardware context will be updated via the WQE. This update will be blocked until the hardware status is updated and ready for the next flow creation. Signed-off-by: Bing Zhao --- drivers/net/mlx5/mlx5_flow_dv.c | 56 +++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 7dcf27d239..5233aa972f 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -14255,6 +14255,60 @@ __flow_dv_action_rss_update(struct rte_eth_dev *dev, uint32_t idx, return ret; } +/* + * Updates in place conntrack context or direction. + * Context update should be synchronized. + * + * @param[in] dev + * Pointer to the Ethernet device structure. + * @param[in] idx + * The conntrack object ID to be updated. + * @param[in] update + * Pointer to the structure of information to update. + * @param[out] error + * Perform verbose error reporting if not NULL. Initialized in case of + * error only. + * + * @return + * 0 on success, otherwise negative errno value. + */ +static int +__flow_dv_action_ct_update(struct rte_eth_dev *dev, uint32_t idx, + const struct rte_flow_modify_conntrack *update, + struct rte_flow_error *error) +{ + struct mlx5_priv *priv = dev->data->dev_private; + struct mlx5_aso_ct_action *ct; + const struct rte_flow_action_conntrack *new_prf; + int ret = 0; + + ct = flow_aso_ct_get_by_idx(dev, idx); + if (!ct->refcnt) + return rte_flow_error_set(error, ENOMEM, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, + "CT object is inactive"); + new_prf = &update->new_ct; + if (update->direction) + ct->is_original = !!new_prf->is_original_dir; + if (update->state) { + ret = mlx5_aso_ct_update_by_wqe(priv->sh, ct, new_prf); + if (ret) + return rte_flow_error_set(error, EIO, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, + "Failed to send CT context update WQE"); + /* Block until ready or a failure. */ + ret = mlx5_aso_ct_available(priv->sh, ct); + if (ret) + rte_flow_error_set(error, rte_errno, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, + NULL, + "Timeout to get the CT update"); + } + return ret; +} + /** * Updates in place shared action configuration, lock free, * (mutex should be acquired by caller). @@ -14290,6 +14344,8 @@ flow_dv_action_update(struct rte_eth_dev *dev, case MLX5_INDIRECT_ACTION_TYPE_RSS: action_conf = ((const struct rte_flow_action *)update)->conf; return __flow_dv_action_rss_update(dev, idx, action_conf, err); + case MLX5_INDIRECT_ACTION_TYPE_CT: + return __flow_dv_action_ct_update(dev, idx, update, err); default: return rte_flow_error_set(err, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, -- 2.27.0