From patchwork Thu Jan 26 13:14:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zaslonko Mikhail X-Patchwork-Id: 48632 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp264719wrn; Thu, 26 Jan 2023 05:17:29 -0800 (PST) X-Google-Smtp-Source: AMrXdXta7fv73wz4AA5fybt9BWNvaLOAPBwtkJxxM6UbH/Wg3iqRbNvrc5wTRW2BkjuAvqYC6VGL X-Received: by 2002:a05:6402:5110:b0:499:8849:5fb3 with SMTP id m16-20020a056402511000b0049988495fb3mr48307358edd.31.1674739048998; Thu, 26 Jan 2023 05:17:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674739048; cv=none; d=google.com; s=arc-20160816; b=HKZAckIT53BibdLqHv4cXxydzixFkgsyi2rByUYfpdB+KPYX58ZBMwfOPbyLqnJbTr jMnkpZx9PuH1gEUW7zUTsZIJ6I2WCnIzwTZy9s/OD5/+1PWEK2raqRkvGBH4sI/PbY5b XQ1Vg7cHrJn5RZFEzl3Y+ZbBBt/KNn/CQPlsFH0xuUmjsnxnRW/o/IomUq/yYhBQfyOH Y8+4iCc8qo9Ko0CfMIvhSs71FBfbwNCEIbTNKBofy6ucAc/rpOboaT1M7tx0EGIMQSMt XafCTaESYdZ5kJ2Y7gj37BqqsATFjwWWgLMtnp9apatkL6UeV3XCgRvObF5WXWUtXDD0 yJrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7r2mDRtDMM+WwBgVFZDwhKhdqARVKa701LAzYRRKgZw=; b=g3AzLn0uJ4RXaB/r7xEfokbt5rFYrQDbIjbNuc+VFbW9r3JgyiO8xe1f+ZVs44xY13 WemB7m1H+2RU7+0xqT15vV2Tl8LG59gLqJqqFBh72qhQr7Ji81UM4AWn7YW/YXf3MfR0 DT71LMK3qppR684cunN2Gq7XpxLIDLUOVnLyfOaC9qq0srCyZAURjxNhwQm8LuUAd+yc gYM2VfUvUVnzucEepOGJD/Gl49FW/smBW9WK0nnLWSRRMTLMN7xk/1/E/cpKHBImgXo/ iU2hXHu+WhXpt+Wh3zs2hp+M1YkzzxPZ3C6f88wgL/otfrsmFO7OFVYC0kQakBOSOCId YQKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=qo34bdf4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h10-20020a056402280a00b004a0a8a35237si2382111ede.217.2023.01.26.05.17.04; Thu, 26 Jan 2023 05:17:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=qo34bdf4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236748AbjAZNPa (ORCPT + 99 others); Thu, 26 Jan 2023 08:15:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236656AbjAZNOx (ORCPT ); Thu, 26 Jan 2023 08:14:53 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65B8C69532 for ; Thu, 26 Jan 2023 05:14:38 -0800 (PST) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30QCQbss005037; Thu, 26 Jan 2023 13:14:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : mime-version; s=pp1; bh=7r2mDRtDMM+WwBgVFZDwhKhdqARVKa701LAzYRRKgZw=; b=qo34bdf4FTrHDe9NgWhHP0uhlt1bHmcE27uwBdl4Zbalx2j1HlFWSiVOFKsZ4Zm2exwc vxB0gqlIHHN+J8JkKLTGwYRvfQjOxrYlSkTxneKg9WSX5iybalJJq2BkG8XfOfHv6v4w 4S2Rpmra8qPDVBDVTMywQyhTAM+129he45IDyY7kV8JFJQsdX6tEgYPqO/7yZVA6xLlU XR6snQbZuDXeMOQt7Kn7eoB/k3blyT8E5QDKdme24SkhK/rb8aqNmVJc9KKnwS38T6oj cKVOVI6/nG+jHjISm09SPzUgPukSlMvHTFv7hO3NMs1FDIgK4zaEM36RIhD04jzptMO9 rw== Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3nbshdh6wb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Jan 2023 13:14:37 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 30Q3rEOb027380; Thu, 26 Jan 2023 13:14:35 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma05fra.de.ibm.com (PPS) with ESMTPS id 3n87p64kas-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Jan 2023 13:14:34 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 30QDEVia36700586 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Jan 2023 13:14:31 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 371AA20040; Thu, 26 Jan 2023 13:14:31 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 042402004B; Thu, 26 Jan 2023 13:14:31 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 26 Jan 2023 13:14:30 +0000 (GMT) From: Mikhail Zaslonko To: Andrew Morton Cc: LKML , Heiko Carstens , Vasily Gorbik , Ilya Leoshkevich , Mikhail Zaslonko Subject: [PATCH 7/8] lib/zlib: DFLTCC support inflate with small window Date: Thu, 26 Jan 2023 14:14:27 +0100 Message-Id: <20230126131428.1222214-8-zaslonko@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230126131428.1222214-1-zaslonko@linux.ibm.com> References: <20230126131428.1222214-1-zaslonko@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: qDRetewmgAVgNF7wKmpCBy68e0naAze1 X-Proofpoint-GUID: qDRetewmgAVgNF7wKmpCBy68e0naAze1 X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-26_05,2023-01-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 adultscore=0 lowpriorityscore=0 mlxscore=0 spamscore=0 bulkscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 suspectscore=0 priorityscore=1501 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301260126 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756091173529816885?= X-GMAIL-MSGID: =?utf-8?q?1756091173529816885?= There is no hardware control for DFLTCC window size. After this change, software and hardware window formats no longer match: the software will use wbits and wsize, and the hardware will use HB_BITS and HB_SIZE. Since neither dictionary manipulation nor internal allocation functions are relevant to kernel zlib and zlib_inflate_workspacesize() always use MAX_WBITS for window size calculation, only dfltcc_can_inflate() and dfltcc_inflate() functions are affected by this patch. This commit is based on: https://github.com/zlib-ng/zlib-ng/commit/3eab317 Signed-off-by: Mikhail Zaslonko Acked-by: Ilya Leoshkevich --- lib/zlib_dfltcc/dfltcc_inflate.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lib/zlib_dfltcc/dfltcc_inflate.c b/lib/zlib_dfltcc/dfltcc_inflate.c index a16f416c8811..5786030c6dc2 100644 --- a/lib/zlib_dfltcc/dfltcc_inflate.c +++ b/lib/zlib_dfltcc/dfltcc_inflate.c @@ -22,10 +22,6 @@ int dfltcc_can_inflate( zlib_dfltcc_support == ZLIB_DFLTCC_DEFLATE_ONLY) return 0; - /* Unsupported compression settings */ - if (state->wbits != HB_BITS) - return 0; - /* Unsupported hardware */ return is_bit_set(dfltcc_state->af.fns, DFLTCC_XPND) && is_bit_set(dfltcc_state->af.fmts, DFLTCC_FMT0); @@ -129,8 +125,6 @@ dfltcc_inflate_action dfltcc_inflate( /* Translate stream to parameter block */ param->cvt = CVT_ADLER32; param->sbb = state->bits; - param->hl = state->whave; /* Software and hardware history formats match */ - param->ho = (state->write - state->whave) & ((1 << HB_BITS) - 1); if (param->hl) param->nt = 0; /* Honor history for the first block */ param->cv = state->check; @@ -144,8 +138,6 @@ dfltcc_inflate_action dfltcc_inflate( strm->msg = oesc_msg(dfltcc_state->msg, param->oesc); state->last = cc == DFLTCC_CC_OK; state->bits = param->sbb; - state->whave = param->hl; - state->write = (param->ho + param->hl) & ((1 << HB_BITS) - 1); state->check = param->cv; if (cc == DFLTCC_CC_OP2_CORRUPT && param->oesc != 0) { /* Report an error if stream is corrupted */