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 8D280A0524; Wed, 5 May 2021 14:25:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AD5D341106; Wed, 5 May 2021 14:24:18 +0200 (CEST) Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-eopbgr760072.outbound.protection.outlook.com [40.107.76.72]) by mails.dpdk.org (Postfix) with ESMTP id 8D51241157 for ; Wed, 5 May 2021 14:24:16 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XpTi4QxxDlc1xB6Cjgwt36IvLB9O1PSo/kwLaxXzMwJ18q2JO28UeRS2OuMFzsTy9vJzVBtnjdgVXbD3lAajv2CQEfGCAKsyZUQitxbDrvcizF+phewhXN7pI2Imau4bqWuCkyX7DrIqGF/frx7ONdndx9lNN9OsCnmOvIfcCO5cg3DtzrjlOkAFBT19UKZvUJTkFwjEBFj3XaI7Sj/UyJ6ukBCwFm60qiUqInxDns/wfUq7N3LlrHrKlhR6HIBPog7FjvZ7OFDzvnI1rqY6alvRTBrNFAWIzfolNxxwnAanxXoj7CPvz2P5XHh/nrzer5pFd6IJUva90Bu+HAVbdQ== 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=zjG4uVmWyYX8dDpGlLwvHZOp9IaHFXlIpqV9CFtPPQM=; b=hjdqS3txMQJ7tUDQHecMPQEiUwfomi6zmd3dr+N5Ah5WdDn7PWyz2kIhGDcne+b01w/E7slxajiZ/QTFnEFymqrtpvlHHfc31jsn4CUdnO09fR7y7hzhJa5QS4k/Uvyb7T77iD+j3RDz1OaZXD9tO+EhQ0qNn4N3/mAuFLvkU68++hBV9WHnYov3e2qiAvZUEz3LXd4de1DA4it3k1JnKSn9dlMcRicutUE2m9Nwmpq+Go7B8gl0X8ArZ89UGwHOM0oIpL9T7DBO7a4p6MO+Q9S3IRzUpkTLGzNS+63GVyqeroGMYHUbaxbXjtR6Pw1Tvx9JiUXbJtQipFcrdXak5g== 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=zjG4uVmWyYX8dDpGlLwvHZOp9IaHFXlIpqV9CFtPPQM=; b=b2OAci6cMti9rQPfn5Wny2Q4u0tpiK8OFyojrZWLr8OJpcs3zMTzNWk57kXocqGQ07xkibhqvxVXRCI38LXPB3TRErOzinSh2ih5hyyc+x2sC9J7GG98o7T4qYtUdFvqlCSvJ9lxyj2ZVYdWegwjsfrGq+ovmqw2ZBQEVKJKbdaINi0RdePr8e5GzC6TK+Q99oRq59KjVqY42YyzFC5rgX+fdXErpT4ro8O4HMKCqZm0yYg3OJ5/DenVjDSExkT38JhMZva0sEuY5qpnadxCP24dKg5Pi1/HQD5ufWjSOU1zdcmR3R6CY0HzpaQ8w+98LfKZRV9l7d+3gCiE9+VVLA== Received: from DM6PR02CA0117.namprd02.prod.outlook.com (2603:10b6:5:1b4::19) by CY4PR1201MB2518.namprd12.prod.outlook.com (2603:10b6:903:d6::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.24; Wed, 5 May 2021 12:24:14 +0000 Received: from DM6NAM11FT061.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1b4:cafe::41) by DM6PR02CA0117.outlook.office365.com (2603:10b6:5:1b4::19) 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 12:24:14 +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 DM6NAM11FT061.mail.protection.outlook.com (10.13.173.138) 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 12:24:13 +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 12:24:12 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 15:23:24 +0300 Message-ID: <20210505122328.51129-14-bingz@nvidia.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210505122328.51129-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505122328.51129-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: 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: 2f97c283-3296-48c0-c6ea-08d90fc0b1d0 X-MS-TrafficTypeDiagnostic: CY4PR1201MB2518: 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: QCMpj8o0v6GpOpHrf1vTdAg1DVufQ5lBgi+CRCwAg9+Zv2/Vr4RUk0ZBC6mTJv4pso890wVV/udJOpi1vY6PMCbKb61cG0QaOUtN6n93lp12MvGFHJxxyG96qEIekb+RGMYLAwPX2o/eS/fyHGNuZERq6mCVQsPxNBYpaC7Vv6728uqUmmgmFq+RBRcWWedKavRlLW38sunNmGlCpifHa8qNep47awCMD1daWtz62DBQrUyqIpy0eNamlfL+KAVdhpW2QAb0+d+npHNUAPMAmTj5qn2sTuCpFehhtskJcaLOkfLZvTociq5QfW+K0a4DEOq7/63Wp0SGs0abKwTSeb56ZN0rGONmmaFjjzwnrzjnzkATrz3plBBqF+nJdnTYgkeO5Rc2HI9MUXajM5ffk48u3XUqpWSgh1c2QljrWuem580v+a8IXv4/4vYinv4thwqJ276qSMiFYMNBnV4or7jI5paADRL+idYyd66ESYbwLROqqdQY8nF2gOj68+3To6se/0steTvfEbKLWvO9Se1pp0gzFu2BEwviE5WzrRMl6uXNEAFh7WwmijFbEFKaHfFqUaWWd3GNRknfz57+X4R9rpeBQ7+wHKEwBJ7sbur4acm83Uw9B8Jf3CHsvPLMB/3bptBCTgJTS2zrFrZ2jHLtJ4Q1Yc6bjsWsgxFDJiFoHQjYKH45Ig7STrBESlcF 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)(136003)(376002)(39860400002)(346002)(396003)(36840700001)(46966006)(36906005)(1076003)(15650500001)(26005)(47076005)(2906002)(316002)(5660300002)(54906003)(478600001)(7696005)(6286002)(107886003)(110136005)(83380400001)(86362001)(7636003)(55016002)(4326008)(36756003)(336012)(186003)(82310400003)(16526019)(6666004)(2616005)(356005)(426003)(8676002)(70206006)(70586007)(8936002)(82740400003)(36860700001)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 12:24:13.9933 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2f97c283-3296-48c0-c6ea-08d90fc0b1d0 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: DM6NAM11FT061.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB2518 Subject: [dpdk-dev] [PATCH v7 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 Acked-by: Viacheslav Ovsiienko --- 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 4a58b01da7..f7eeca20ab 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -14254,6 +14254,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). @@ -14289,6 +14343,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.26.2