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 16219A0C40 for ; Thu, 29 Jul 2021 16:11:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EE549410EF; Thu, 29 Jul 2021 16:11:47 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2067.outbound.protection.outlook.com [40.107.223.67]) by mails.dpdk.org (Postfix) with ESMTP id 8EF4940687; Thu, 29 Jul 2021 16:11:46 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m+KoYkIIJkSsiq8HIwhpJzMb+4wdsM7+3VlfmrnvX/5cvApw5ZlmCS777926yf8tUJRtKrpQxjKuHgbmL0Caq0OC6tRdBdhZChWPiLJp2yzREOI2cdfDxevWpde7WMBhfobm/7Ryx0OkouzEputS7kLkigQDC7OfZIDlL+k3zSBLFFxnKQxSxqLjaVw2/vtkJwfJAVdIXZAZj1CxJ5WaI4D4UphDY5se4sHjclKQfuh5O3IITFFnXqqpvkkxZaqcMUWO8tzyACul4zfKkTbz6o7rKVtA3WU0rxMltEa8TXxB7exvSXmg2bvijSKM09oMs6IQa7P1gjdhelaEPBYEGA== 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=7rG+L/n0RCH19pwPM6ErmpTT1tKhCFOwp9KaWNvgnc8=; b=j+9fjyWC0fRxNYpzjtL9Q7hS9Ct+WfnTuQfpZRneXno1fy6V1bjNYKcRbGQfEogozvamwhxBEgrMV//PhBBH0c0wZFrA3PQmMOeRxkqbyTtmOXgf8nZwvhxR0qhujzMDuLJfgTU1AJ/wkFVlZTr75i4udLVJyKlItRs1p2+uUvjvB7QvJ6FDUNyhXYKFbk1+HPx8nc29nlPRuXnf2XII+v7kmN8W3eKj5wT1G/WJDMt8YTrAk8mZP4vIIWAPucpAgYiWmM+e/AniW3tRRikankAAh+CMaNeSo22U/4kGN1YkTtsrSHTvLCCTa1a/zD6S0Le206ZuhXDT1RJNJ5y0Ig== 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=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=7rG+L/n0RCH19pwPM6ErmpTT1tKhCFOwp9KaWNvgnc8=; b=eu8to/LcF34DnSUtSvYHmI2KC3zRmU9CUR5Xj7X/yJrH8mSI2vhOWMKmIbEAoXStOn3GFMtV7b2bW+R/RnrdJtM3T9AKMDlVNmRx5vQg5fxJd0HuX14qKpCzpqi/tq8dl8thUUdUmZTIK4J1cYWxXvKliMnP0Oj4ID3WVMcKyKpz6ge4w/ApggY3vj/jbpt01DzAPTf8eHtbx8ph67mNvmaIx8+5s9jjEc2oiBMqzhJW1ERB2V0yT5JS5xyD6q4K7T2+EpZj85cE5mPNdGRLMBwW6gJ6cyr4FJ0sXebXjl2v4lMWZOynv+1nkB2vtO9zAacLmvlRG7WRagVIfgmndQ== Received: from MW4PR04CA0288.namprd04.prod.outlook.com (2603:10b6:303:89::23) by DM5PR12MB1723.namprd12.prod.outlook.com (2603:10b6:3:111::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.29; Thu, 29 Jul 2021 14:11:45 +0000 Received: from CO1NAM11FT036.eop-nam11.prod.protection.outlook.com (2603:10b6:303:89:cafe::2b) by MW4PR04CA0288.outlook.office365.com (2603:10b6:303:89::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.20 via Frontend Transport; Thu, 29 Jul 2021 14:11:45 +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 CO1NAM11FT036.mail.protection.outlook.com (10.13.174.124) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4373.18 via Frontend Transport; Thu, 29 Jul 2021 14:11:44 +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.2; Thu, 29 Jul 2021 14:11:42 +0000 From: Raja Zidane To: CC: , Date: Thu, 29 Jul 2021 17:11:08 +0300 Message-ID: <20210729141108.20908-1-rzidane@nvidia.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.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: c6ed21de-1676-4b97-60d9-08d9529acbef X-MS-TrafficTypeDiagnostic: DM5PR12MB1723: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rIakFfcvdPTAbogk8E+Nxw5xRm3tszFAl77OuF2sqaptTpDJcFAYVbi3jurRdY6rV+M+bHuuf+EW5/V3mvUUMugfxxuWk5R8wVU8IfLozmN8l6wj3oMjv2LYLCNv2G7CgtTadwXkPok3zwl5n7OZHyYADE8CYqyL20QysfvxV4bJZHTxGU7O5EOJ6oaDbhUoT+7WHe4dGFZfCxcdYqktpX6Ybf38YDnZzee2E2RzWypwiJbiIvf73kVoLgnbQNutXbt2IcFCcMjmqnZJNqABQhlqWHvTYQxMfKETk160jAFry9ukqU1D5qJu3W8zKB853ikXwTtLAK/jdp2UdJHKR2hUoZz4GXXebArj8kboDrKIg0lpxOjxFwnMB2yM1mRnxh66k+3ez7bfU2ZyoYFZryEZ0593feL6hXMeiW6AG9SFmoFkiR0QXzOjC1IzXIKI/r4Zr69IZ53R156trj7/08zyhJxOFrH3DO9M/Uo5KvIgvWWU4MdlI/N0/X9VQ47XbJ0ej5DPGM03hvwbQ834asNMKOzAtklXqVFUk+oOsPaNosShvnTFDa2ihMJ0CsmF31UHuEflJ03GdVRkBI4d83fVc2TiJfiM0nKS1yKE7X0+/kGzXxQDyJ6kVD1ilrJ5k/mlHF5wI8UIXbGesUr7hO4fQ0gUYYDcohRKMhylJyildI5Zo3HdynaeaP7K3LpWIerEnlSL+jkiJdRvvBpDkQ== 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)(70206006)(2616005)(5660300002)(54906003)(7696005)(356005)(336012)(450100002)(16526019)(36756003)(2906002)(82310400003)(8676002)(55016002)(83380400001)(478600001)(7636003)(6286002)(6666004)(1076003)(8936002)(82740400003)(70586007)(316002)(186003)(47076005)(4326008)(36860700001)(426003)(36906005)(26005)(86362001)(6916009); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2021 14:11:44.8460 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c6ed21de-1676-4b97-60d9-08d9529acbef 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: CO1NAM11FT036.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1723 Subject: [dpdk-stable] [PATCH] compress/mlx5: fix level translation in xform API 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" Compression Level is interpreted by each PMD differently. However, lower numbers give faster compression at the expense of compression ratio, while higher numbers may give better compression ratios but are likely slower. The level affects the block size, which affects performance, the bigger the block, the faster the compression is. The problem was that higher levels caused bigger blocks: size = min_block_size - 1 + level. the solution is to reverse the above: size = max_block_size + 1 - level. Fixes: 39a2c8715f8f ("compress/mlx5: add transformation operations") Cc: matan@nvidia.com Cc: stable@dpdk.org Signed-off-by: Raja Zidane --- drivers/compress/mlx5/mlx5_compress.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/compress/mlx5/mlx5_compress.c b/drivers/compress/mlx5/mlx5_compress.c index 5c2b9dc859..883e720ec1 100644 --- a/drivers/compress/mlx5/mlx5_compress.c +++ b/drivers/compress/mlx5/mlx5_compress.c @@ -316,12 +316,19 @@ mlx5_compress_xform_create(struct rte_compressdev *dev, size /= MLX5_GGA_COMP_WIN_SIZE_UNITS; xfrm->gga_ctrl1 += RTE_MIN(rte_log2_u32(size), MLX5_COMP_MAX_WIN_SIZE_CONF) << - WQE_GGA_COMP_WIN_SIZE_OFFSET; - if (xform->compress.level == RTE_COMP_LEVEL_PMD_DEFAULT) + WQE_GGA_COMP_WIN_SIZE_OFFSET; + switch (xform->compress.level) { + case RTE_COMP_LEVEL_PMD_DEFAULT: size = MLX5_GGA_COMP_LOG_BLOCK_SIZE_MAX; - else - size = priv->min_block_size - 1 + - xform->compress.level; + break; + case RTE_COMP_LEVEL_MAX: + size = priv->min_block_size; + break; + default: + size = RTE_MAX(MLX5_GGA_COMP_LOG_BLOCK_SIZE_MAX + + 1 - xform->compress.level, + priv->min_block_size); + } xfrm->gga_ctrl1 += RTE_MIN(size, MLX5_GGA_COMP_LOG_BLOCK_SIZE_MAX) << WQE_GGA_COMP_BLOCK_SIZE_OFFSET; -- 2.27.0