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 2CC80A0524; Wed, 5 May 2021 08:52:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 08A704112D; Wed, 5 May 2021 08:51:33 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2080.outbound.protection.outlook.com [40.107.93.80]) by mails.dpdk.org (Postfix) with ESMTP id 553EE41148 for ; Wed, 5 May 2021 08:51:30 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pnce6bfclYbJPDmf4q9nDo3LixeY2L9rnpmtzWQP80NFpqWlmaW7leBCFpICQt4aQZJdrqM90it5Zw9jU5enUesClMpqSthd5XrQ5SsNu8eAYoFE738cuoYL3fUazJMpibyR4NmadUFGjmuwdD4gnl36rSVnkP0g0RwmQ+/Ex6lRTMgj9BzFpmmNjOLhEJQwbSJSd8x92Iqj/csdo7ZtvMrIPSBA5CL1R97nrKj0S7gvPBf3Umpt4Zw7AxsCI0k69yo0wf0oyxtFiHli0HUv1TnQahM7pkdiqZOogzDPpfqBo11QGYHfsGkloV1rtvXdWk71jXb5557bIwTfRmDMyQ== 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=MiapB1OOlt9lbk0GR9JIMTYCCTRFED+eNwQtPrDHfiQ=; b=D+xb6CH8Ta3VhF8biNRCd6RCJwBy2ysy1JC07pfDdsWaTy/p9f7aDO9moIIzwYQycVWe7dU7iqEEAQAwhURVziDnPbTqetsbroFr6lyKkX7ePgzZhzKqqV9yFRhsWKAvCzKG2xK3DhnWqZypVuBGNiAaRdqPo29xs5uXiA3Dokq0l2JUMhpYWo785kgmx93TJvA5PEEmEw3XbnOXcerpREuGfTrcbrShTzZF9zGoeHldJwq6snJncNSyIDzRMsNFrg6ZNjh6Q9xZMapDLTiiGzoj7DdvPhLCv/FBuMl111KKBJha8ObF1YSP76dchtJqjfdkBVlSs51TiQQCTh2IOA== 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=MiapB1OOlt9lbk0GR9JIMTYCCTRFED+eNwQtPrDHfiQ=; b=QqgRSPByXqqo7P4FcH0jNCJJD69h0/3h6FxBB7UDYQKNsY9PHeqyjs60jL2PIa5nRp8ysEB0qMFVqNqPuusYDSVJ/Q2TLlhC/8jP/+G+HKuaXDUN5RbEp4y0IZADSBsKG+zSKpuUNzX/6PiVxg/DDTiJwq7CdrK/j5ueQDSeS0MnLUJMiVusuW/68bg+MVebYETtnRnTsGc6q+YQRmaJAwljDLaJLXtzcDrHr/VbCWyuFMUR6tP22qXw34gVVFOLHWXGht2bD64j4e6xbTptWs3WJ7ODrTE8uLvYC+q04LJAsRmXTsWZd0mncEflbDzQFtEuLSZulLMohRoaWiyKXw== Received: from BN8PR15CA0028.namprd15.prod.outlook.com (2603:10b6:408:c0::41) by DM6PR12MB3338.namprd12.prod.outlook.com (2603:10b6:5:11f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.35; Wed, 5 May 2021 06:51:29 +0000 Received: from BN8NAM11FT044.eop-nam11.prod.protection.outlook.com (2603:10b6:408:c0::4) by BN8PR15CA0028.outlook.office365.com (2603:10b6:408:c0::41) 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 06:51:29 +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 BN8NAM11FT044.mail.protection.outlook.com (10.13.177.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4087.32 via Frontend Transport; Wed, 5 May 2021 06:51:29 +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 06:51:24 +0000 From: Bing Zhao To: , , CC: , , Date: Wed, 5 May 2021 09:50:04 +0300 Message-ID: <20210505065008.30680-14-bingz@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210505065008.30680-1-bingz@nvidia.com> References: <20210427153811.11554-1-bingz@nvidia.com> <20210505065008.30680-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: 54c8ea9d-ccdb-4620-cea3-08d90f9235e0 X-MS-TrafficTypeDiagnostic: DM6PR12MB3338: 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: 7raBtCe/xe9qNCxHU5bkcSCgK9mOIyv2JW/LN/9jX8JpZOm1aRb/jBzmRvoTtN58wZ+6JGiQ0KAl6WXisXAHVhruYSNHgbZeJ7oO8mXQUZMcQycaxuKoRcFYGhQK2wTSxqc67MrjIhw5uIb6jMdEkBCsn3lCZOGL9Puj56dhtMA9dOFKLzQrQmdJ/mdt92HN/DTIeC9fFg6j7GBHxBkFEJKF3gZ+1lLaoC7yOiOSvUmzM+Nth/fMo6dcDgzXWT/Fj3LH5FDSIImfZ/EefstB4ipjNh0ufbUhVJJv9LmryIC3fPNcCl/v+kKWF0wLkVIzPQieR4Ga9uz/bzDb9v7Oby+50qISQvuX5sDV3NAFHPEXZCqY6ZCfPj5xghT+JHHFaNCw6SgIhaaU/Gv9EQwBKuB5iIofBruZ7Sfq/PKxPTWVZZaCTbJSAPbHHt4l3/jZlV4wTVZhxKez1PooUCPw0xwtBqDE0fzCQdl+mxm/1O20YsHAy4av12cLCyl0xku15FmVZxLQjss2+mKuRDMJdh4bcSFnfBfTf7uECjsFCwFnOmpyWZ1+q1KqupKVC53ebpfFmlS4rNuzdeWXmBqgIadJM/UcLCmMotmC6X1FMIbHR5zuflKIpg3mygkL2IGHK9UTE7mbA3RjpMh3L08Io7X7XMI0lb+sbsTtQp6/k9VZudlsOz60eF2HienV7C7k 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)(39860400002)(346002)(396003)(376002)(136003)(46966006)(36840700001)(107886003)(6286002)(83380400001)(47076005)(316002)(55016002)(4326008)(36860700001)(15650500001)(16526019)(1076003)(186003)(70586007)(7696005)(5660300002)(82740400003)(2906002)(36906005)(356005)(86362001)(6666004)(478600001)(36756003)(2616005)(7636003)(336012)(8936002)(70206006)(82310400003)(54906003)(8676002)(26005)(426003)(110136005)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2021 06:51:29.1464 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 54c8ea9d-ccdb-4620-cea3-08d90f9235e0 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: BN8NAM11FT044.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3338 Subject: [dpdk-dev] [PATCH v3 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 b0858e3df8..6afbbbc4bb 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -13824,6 +13824,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). @@ -13859,6 +13913,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