From nobody Sun Jun 28 10:35:43 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C391C433F5 for ; Wed, 9 Feb 2022 04:09:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244040AbiBIEJ4 (ORCPT ); Tue, 8 Feb 2022 23:09:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347528AbiBIDvJ (ORCPT ); Tue, 8 Feb 2022 22:51:09 -0500 Received: from m12-17.163.com (m12-17.163.com [220.181.12.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 81305C061578 for ; Tue, 8 Feb 2022 19:51:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=YvOhP o6ymYclh5k4417PVKOkRi78cNnblip3oZXJi9w=; b=TL8XBCK3BGYJiAdN6Udlr gZrIrYQuYZjx/21TRxoG1hfP0raAc0tF/M+/OPmQEYdezM5KFR7UciDeDIbEm+Qk iYMrmBySD2iAWoSt7ovcDjfzLo1HOK7mcj54G11++6EgodVel6HVYg0p2JUZLsbU sHkB2Uf6ZxFV5C3pwUZn2A= Received: from sysgbj8.hosso.cc (unknown [42.62.85.2]) by smtp13 (Coremail) with SMTP id EcCowAC3LJ5zNgNinKhICA--.44272S2; Wed, 09 Feb 2022 11:35:16 +0800 (CST) From: chengchaohang@163.com To: leon@kernel.org, maorg@nvidia.com, jgg@ziepe.ca, logang@deltatee.com, thunder.leizhen@huawei.com Cc: linux-kernel@vger.kernel.org, "chaohang.cheng" Subject: [PATCH] lib/scatterlist: Provide scatterlist hexdump. Date: Wed, 9 Feb 2022 11:34:44 +0800 Message-Id: <20220209033444.56433-1-chengchaohang@163.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: EcCowAC3LJ5zNgNinKhICA--.44272S2 X-Coremail-Antispam: 1Uf129KBjvdXoWruF18ZF4xJF48AF48WFWkXrb_yoWkCrb_Ca 47Jw45Gr4fGF4IqFW3WFWftFy8WFZ8ZF1I9F1Igr93W3s8urs8X34vqr9rAF45Way8Ca1D Gasaqas7XF1UXjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU5wo7tUUUUU== X-Originating-IP: [42.62.85.2] X-CM-SenderInfo: xfkh0wpfkd0xxdqjqiywtou0bp/1tbishyivFUMUYHo9gACsl Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: "chaohang.cheng" A scatterlist hexdump is essential during debug, sometimes. Signed-off-by: chaohang.cheng --- include/linux/scatterlist.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 7ff9d6386c12..ef8ecaac0016 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h @@ -563,4 +563,21 @@ bool sg_miter_skip(struct sg_mapping_iter *miter, off_= t offset); bool sg_miter_next(struct sg_mapping_iter *miter); void sg_miter_stop(struct sg_mapping_iter *miter); =20 +/* + * Hexdump scatterlist + * + * @sg: struct scatterlist* . + * it stands for the head of a scatterlist . + * + * note: print_hex_dump_debug is a dynamic debug . + * + */ +#define SG_HEXDUMP(sg) \ +do { \ + struct scatterlist *sg_tmp =3D NULL; \ + for (sg_tmp =3D sg; sg_tmp; sg_tmp =3D sg_next(sg_tmp)) \ + print_hex_dump_debug("", DUMP_PREFIX_OFFSET, \ + 16, 1, sg_virt(sg_tmp), sg_tmp->length, true); \ +} while (0) + #endif /* _LINUX_SCATTERLIST_H */ --=20 2.25.1