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 7EF6BA0A02; Tue, 27 Apr 2021 17:40:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D35B1412A0; Tue, 27 Apr 2021 17:39:16 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2084.outbound.protection.outlook.com [40.107.244.84]) by mails.dpdk.org (Postfix) with ESMTP id 2F58D41269 for ; Tue, 27 Apr 2021 17:39:15 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jii5dT5UbPqOlWp1DB0jNZSJJ9F78LwwBZik5He7haRl5ZjvGxiS9LFmd3iWbjGV3C6HlH91ZAq39VYejFJR7hec0t5Ifi8y4LFgTm204umSt7/VMoP2dra5lvRhYGCLU8bTztUKaJHdbiOWG2YGrujB/tmcMYQG526rMuCyrJrZHLScNQoe27GClmq0X3VpcwQe2HK3k1/UziUa3yBzmEx3fQU9SlSVVUgIdTCsNNdrL+dcummez1Ez7VGDlZSWai/OK4eWv6v7H95ySa9v8z5UZvMouTKmagdLQnJVRq71L51d00Cc3dcl2PZJC27A+u3yQZgiuz+rOusG3lCRjw== 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=ZvvcZ41MQFSisVfMoIJ9y+0a8ewazsaw4XhHV1Kmkmw=; b=XVpv04+2JyYbXPgpJn+9tU7Lyc63drTnzqJCxzX+fr0b6QJmnuaVVACmeZcKZZuGYH/ywHmWjmeZr7OHbVAmwTQSjwpYr8eE7EMSeUsz3EHu5AEkXyZH5QlJQBJEVdqACOIJZvT7ZdQ+UPgAXQTZPmWBh1InP72z9BlIh8fxZyRfkG8te4yJ2/LzkfUbvuw8UOlurIFLmaRh6iyVHtkvE1d4FnFfZohV8+kj8gWcNUuYR6vlq1Tas1PCrmXkt97NK4e9jPLsiUFD7oo9+uHg9pKYFil9FmcI5Sao+havgCMGLCWEeNq1Ypzcm1gnLwq49wSqOfA/qFjak6rdh+NjZA== 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=ZvvcZ41MQFSisVfMoIJ9y+0a8ewazsaw4XhHV1Kmkmw=; b=GLMJpaikVTaoLbQc1K9GbOHu1se9zMqzcGllIZMvNro2qpm8jjE8FW0YLOFqFy28tiw1C0VhAjuOC6K96pJn1jcNXW5e96+CttDtoVeR65z3H2QjZGMuIaB+4WyJubaOoRot204tXKL02oISMbKcP4nZl2PA2K6ddn13cPd3yd/xWQBvKqx5TpbEjuhKWzgitMRxtW0u8kvhrdT5G1sNl7h8KEfBMD+3TyxHqsoZWBM1BBqVrUjQ1NwOIV5qcpIK4ckwK87d00uECYJDaTUyuf4jpQQMTslGR6BQjEW/lBn/NMgO/+WJDMPOGJ8hmjE4DaCZJ1rCGGNOzQJ3knujUw== Received: from MWHPR12CA0048.namprd12.prod.outlook.com (2603:10b6:301:2::34) by MN2PR12MB2925.namprd12.prod.outlook.com (2603:10b6:208:ad::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21; Tue, 27 Apr 2021 15:39:12 +0000 Received: from CO1NAM11FT067.eop-nam11.prod.protection.outlook.com (2603:10b6:301:2:cafe::9) by MWHPR12CA0048.outlook.office365.com (2603:10b6:301:2::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20 via Frontend Transport; Tue, 27 Apr 2021 15:39:12 +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 CO1NAM11FT067.mail.protection.outlook.com (10.13.174.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4065.21 via Frontend Transport; Tue, 27 Apr 2021 15:39:12 +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, 27 Apr 2021 15:39:10 +0000 From: Bing Zhao To: , CC: , , Date: Tue, 27 Apr 2021 18:38:07 +0300 Message-ID: <20210427153811.11554-14-bingz@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210427153811.11554-1-bingz@nvidia.com> References: <20210427153811.11554-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: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0c4952c3-2e7b-41a7-2f48-08d909929b24 X-MS-TrafficTypeDiagnostic: MN2PR12MB2925: 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: gnVu67fRMcAFDbO9nrE4NLCcZoXTas5Qj2e9WT+lLjWsS22si4YTz2DGywCnouodn8RJ8jeYpqRX0SU1M7785VwZ89WTFMl+rq6fp69sXDgMXj7HrtUib6dx9NYUg3J+3Ukcp9mRVoSQ4QWoQhX8yy1Evm05IAis6dJd+BHTjsdGgunDPQI1yzXBvBghz8STdN8pQ0QadpR32YJR865AIAqcgs26g7HUX8W2ZZGF1HFkf/wmSCekngJRkLkNotRacvU/wIdvjdRJzDt3bTCchlwnmd7oy1mXgy5XbkqHHjS6mvobNbof8OY6oEmSY0nPRAGQWY6ymnVhVLDrVM/xNJAjUWiMj/pPUxkrV81iTWg4OQkBDU1UnpWSxUYO4YA3kkJijs3QbhAknMrenXbSWlF8Yun6AqQ7s6ztf31kFRc76L/ZPdE666OFXa/3bnYj9OJmqWMNxmRcHYzy/p5m1kwYpjPFfVFwUQLBmZWL1jBhVsiVFh93+n+sA9QbsQ9OgqwUucRAz/rOztEq5lUUL8o6tY/QQgF47/+qRJBgAscyQztEMRvQWJsjHuWBbwt7O8CXrjD5kZ6i86YH5r11Cr+dGGo5zJ3DKapX9O6CT2SEObAnT4YWNQ+8q5y5F0vVXl91TarBcob0y1g8T9ONMbKarbJXWJlXqYJSG+yMq/bbRdgNbJBoGiECf9QpeWcu 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)(39860400002)(376002)(136003)(396003)(46966006)(36840700001)(36906005)(5660300002)(6666004)(47076005)(8936002)(186003)(86362001)(7636003)(4326008)(316002)(478600001)(107886003)(2906002)(16526019)(55016002)(82310400003)(1076003)(36756003)(70586007)(7696005)(6286002)(70206006)(8676002)(6636002)(356005)(15650500001)(83380400001)(336012)(426003)(2616005)(110136005)(36860700001)(54906003)(26005)(82740400003)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Apr 2021 15:39:12.1171 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0c4952c3-2e7b-41a7-2f48-08d909929b24 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: CO1NAM11FT067.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB2925 Subject: [dpdk-dev] [PATCH 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 | 47 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index eb24d5e..a27aff6 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -13801,6 +13801,51 @@ __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); + /* Block until ready or a failure. */ + if (!ret) + ret = mlx5_aso_ct_available(priv->sh, ct); + } + return ret; +} + /** * Updates in place shared action configuration, lock free, * (mutex should be acquired by caller). @@ -13836,6 +13881,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.5.5