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 2FCA0A0C55 for ; Wed, 3 Nov 2021 14:08:29 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 10BC041C26; Wed, 3 Nov 2021 14:08:29 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2045.outbound.protection.outlook.com [40.107.220.45]) by mails.dpdk.org (Postfix) with ESMTP id 04B1140E5A; Wed, 3 Nov 2021 14:08:26 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XBGZXO+xqeszdNx2FRlkLc0NTzZiA098Hk7YC7pjev4Bn5Fk/mbjzE9yHXTYyIc8MNBsrpKyZRklHA3EqxidEfkVL3FXk6PlJ7j+xhDbMDsaUduJWqgE5TMWf7JQWEpvoUp9esbbaCYfV8WaPcOqjAIQb5Q3XZfDyu3VHDu4hbIe/Fbo36g4AHR70Om55os9yWSLBtT0ABYRQBREgLM+mPpdDfzglF2bEbgMQNTxN7acUq63N95OSeD57E/vkzHCZ6j/zV2QGhTwjPJK+JJNWlQXeMb/JpYl9mj6wLJrLUr0DsOM9x666dssJxcvEI0xzT14UeuLvfrniQH+6S6vXA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UUKYM4cqRo4c3grfBmfIqLGhhJ5+jH9pgw069M/KjsY=; b=Zu2yhDHVQgfnM7rDNTn1dEDmdud3gw8fuCQ9+7Sy78HdnsT/Lyny4YhscngboqeWH++WUS9bwk00FGbsFiX0eFogLsHFNiZawbcmzF/WV09ueQcjVS04BOQ/Y/aj/bCJfje3wn74CAR2e3fWeqegdTVi7Mb53iCW68oVqOQiy3DGVbsJdtJMNJOk6Rr15BKwA/15fQxQE8L55v+KsgHGiwpE9D2QXHlJ/3oE36xmpmPZ8zLROPLy8RxqxDtVTXX5frffh01rHH2sVWm3Ls8x1R1DLQ5eSEAoIlUxoFJj9I8UcWpryvASmYKFeVX1Do+zyMyMAUcYtNm0s4AIJVTUOw== 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=quarantine sp=quarantine 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=UUKYM4cqRo4c3grfBmfIqLGhhJ5+jH9pgw069M/KjsY=; b=Dgr0OBnsqjDwhdxfGD3clsYph+F5fVRRoJrIE/zWZQ9GrKut14M65bSUd89A1MUXd0Tf+J81kiF5lYl/uSSSryssKPprkca8DPLyc/BKKK1NHSRNgNaWgbVq3Ze7GWQmGCwkA6rFBuiNeUJK/36KqD6iRgXM7a1QzPocLwofJaT24yNmm+aVb3YzpwiC30/A5QvEE7FZ9KgPFGfszOVKBVW/n2TuPNCSI2/3BPQUmzS8CBUwz+K0hwOFLzF9EMvr05+yJxzIneb9IecaoQ+Abj8iSeKeMemHChyzgv2tlDtZRuNPeXcNpUIAZf4WEtWMpJPVESGcB/7Nmo4ErQsjDw== Received: from MWHPR04CA0047.namprd04.prod.outlook.com (2603:10b6:300:ee::33) by MN2PR12MB4126.namprd12.prod.outlook.com (2603:10b6:208:199::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.15; Wed, 3 Nov 2021 13:08:24 +0000 Received: from CO1NAM11FT050.eop-nam11.prod.protection.outlook.com (2603:10b6:300:ee:cafe::f5) by MWHPR04CA0047.outlook.office365.com (2603:10b6:300:ee::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10 via Frontend Transport; Wed, 3 Nov 2021 13:08:24 +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 CO1NAM11FT050.mail.protection.outlook.com (10.13.174.79) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4669.10 via Frontend Transport; Wed, 3 Nov 2021 13:08:24 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 3 Nov 2021 13:08:19 +0000 From: Jiawei Wang To: , , CC: , , Date: Wed, 3 Nov 2021 15:07:59 +0200 Message-ID: <20211103130759.44457-1-jiaweiw@nvidia.com> X-Mailer: git-send-email 2.18.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.20.187.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: 5bbcae0a-3aa7-4fcf-f515-08d99ecb0499 X-MS-TrafficTypeDiagnostic: MN2PR12MB4126: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TpcDcchfNFCl34Ttf4Q7o8QDP8ftfxZFiUT+MiNnJ8ktEcaKSZSh9D9TwGIEpYh4oeoAmQN5grMapUevb4WzxtOMfU2hroHV1/up6CdI9bZ7Lmf/7ZCkhhGnEsYjdEtTjGuQe1aOBHF+Hqnf0hqENmQ1fJpSM+QC134gTXNovpozFwaj2qMkrsMKzJ3tK5XyDIMVeixS2yTdf9JILV12/yc5mS4JKal+HhxoJfTtDrVdflv0rJyATqUjk+B2ZzaPMDTekRVmYxRftyW1kcFDBAYZqXdfrU7BRLHRdnOKmRBhj6g7RrJoa/Qwk+3j7qFPvUzvlX8h5TrIEigdsITTl17WiKjj56lOSfWcUcV1UIN3d+GPb1hLWMwuz9hbo06pndHhexy2TcuAVeqzJuSMuZ2ehtVn4iNtoILaJSlTumF3cKwMk9zCdmCyUhg0qeNhVLtZbMyYpGMVrnqFYeltZoMWpUJDIpIiYR/WHv9HN7mC1RmtJEAmldZSJtpVrj2K82LdqtrbXAR9jQ8tkqVQEA/W8K+nVpNPo38nPgS9IkNKX3VZMoQPr1qYBc/UwVf2PQE+pPK+61pFFKZB5iUBqfXMsMUeeHCgNBG0m5dAmPjxLDL86VFDv4Oy4/Lfl63GX1dlvyCfECZBxQ3va7tIZfX6wVzkNB08J+B5TT9Wz+XrClJ22zL0YJs+HEnyA5mhlQzUIbtPC4a0tPe17ehTjQ== 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)(36840700001)(46966006)(86362001)(70206006)(26005)(54906003)(7636003)(6666004)(450100002)(16526019)(70586007)(6636002)(2906002)(186003)(8676002)(55016002)(8936002)(356005)(316002)(4326008)(110136005)(6286002)(508600001)(82310400003)(426003)(36860700001)(336012)(83380400001)(2616005)(36756003)(36906005)(1076003)(7696005)(5660300002)(47076005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2021 13:08:24.0685 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5bbcae0a-3aa7-4fcf-f515-08d99ecb0499 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: CO1NAM11FT050.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4126 Subject: [dpdk-stable] [PATCH] net/mlx5: fix tag ID conflict with sample action X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" For the flows containing sample action, the tag action was added implicitly to store the unique flow index into metadata register in the split prefix subflow, and then match on this index in the split suffix subflow. The metadata register for flow index of sample split subflows was also used to store application metadata TAG 0 item, this might cause TAG 0 corruption in the flows with sample actions. This patch uses the same metadata register C index as used for ASO action since it's reserved and not used directly by the application, and adds the checking in validation to make sure not to conflict with ASO CT in the same flow. Fixes: b4c0ddb ("net/mlx5: split sample flow into two sub-flows") Cc: stable@dpdk.org Signed-off-by: Jiawei Wang Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_flow.c | 3 ++- drivers/net/mlx5/mlx5_flow.h | 1 + drivers/net/mlx5/mlx5_flow_dv.c | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 2385a0b550..5f869c0867 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -897,6 +897,7 @@ mlx5_flow_get_reg_id(struct rte_eth_dev *dev, case MLX5_MTR_COLOR: case MLX5_ASO_FLOW_HIT: case MLX5_ASO_CONNTRACK: + case MLX5_SAMPLE_ID: /* All features use the same REG_C. */ MLX5_ASSERT(priv->mtr_color_reg != REG_NON); return priv->mtr_color_reg; @@ -5532,7 +5533,7 @@ flow_sample_split_prep(struct rte_eth_dev *dev, /* Prepare the prefix tag action. */ append_index++; set_tag = (void *)(actions_pre + actions_n + append_index); - ret = mlx5_flow_get_reg_id(dev, MLX5_APP_TAG, 0, error); + ret = mlx5_flow_get_reg_id(dev, MLX5_SAMPLE_ID, 0, error); if (ret < 0) return ret; mlx5_ipool_malloc(priv->sh->ipool diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 5509c28f01..198b1db2e6 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -109,6 +109,7 @@ enum mlx5_feature_name { MLX5_MTR_ID, MLX5_ASO_FLOW_HIT, MLX5_ASO_CONNTRACK, + MLX5_SAMPLE_ID, }; /* Default queue number. */ diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 8962d26c75..8197553b27 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -5574,6 +5574,10 @@ flow_dv_validate_action_sample(uint64_t *action_flags, RTE_FLOW_ERROR_TYPE_ACTION, action, "wrong action order, jump should " "be after sample action"); + if (*action_flags & MLX5_FLOW_ACTION_CT) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, action, + "Sample after CT not supported"); act = sample->actions; for (; act->type != RTE_FLOW_ACTION_TYPE_END; act++) { if (actions_n == MLX5_DV_MAX_NUMBER_OF_ACTIONS) -- 2.18.1