From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from canpmsgout11.his.huawei.com (canpmsgout11.his.huawei.com [113.46.200.226]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 587613E557F; Thu, 4 Jun 2026 07:50:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.226 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780559424; cv=none; b=EH0YQxoPo9yye83TFzN+l1ZM8VdxwEA2hPJULY/Lg7Sk3aDsi+kbek/pyvwEIYJh0SB2jbtJdirA81xYnM5eSFS/WGdzIBgAN7CWimmWnu1Yy1AXd6P9YGGujIw+UXp5XN57QyXtfHgzCXEGPgem8IpowAuEAONrsT0/FQ1VV8o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780559424; c=relaxed/simple; bh=eBl7APe5jVZi7hoPd7kvqsAHdY+d01qiMcr5hmb5kgE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GzqswCoMT4sdL3Y6lMEGmnTxcrbFJwlrpXllkQ3dcMB7igkPua+OUJ4cDsdWHcqYIZdLgmZi5NQVKpj2zSAG0fwPGPf49qCtGIhivrB/A0pXU/tgvUa5hdNdyjOM2J5N/fxa0MEUQdP8U+cBSVU5gyiyIyeIB939Sw667snXnuY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=fBAgDHAp; arc=none smtp.client-ip=113.46.200.226 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="fBAgDHAp" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=KCmlyUAoK/yHveusUi6OJxnEgjrVkZLbwQEppi6gKxM=; b=fBAgDHApSydyIm9IrNbVHVRassbBcy5cDEsGBBor5twX6mUu2BgcUTbf+dAisAqBMatksZCj6 T5Q8LaP+ikQqELdVxa5dD3javmt8Ua9x06oCTU5IpnmL/MJApzaVAvdVIgu8VbXxRT7x4KNMdGs utWEFfXKdP4WPVlJzhkVXW4= Received: from mail.maildlp.com (unknown [172.19.162.92]) by canpmsgout11.his.huawei.com (SkyGuard) with ESMTPS id 4gWGk416xVzKmTk; Thu, 4 Jun 2026 15:42:20 +0800 (CST) Received: from dggemv705-chm.china.huawei.com (unknown [10.3.19.32]) by mail.maildlp.com (Postfix) with ESMTPS id 26D1940565; Thu, 4 Jun 2026 15:50:13 +0800 (CST) Received: from kwepemn200012.china.huawei.com (7.202.194.135) by dggemv705-chm.china.huawei.com (10.3.19.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 4 Jun 2026 15:50:12 +0800 Received: from huawei.com (10.50.163.32) by kwepemn200012.china.huawei.com (7.202.194.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 4 Jun 2026 15:50:11 +0800 From: Sizhe Liu To: , , , , , , , , , , , , , , , , , , , , , , , , , , CC: , , , , , , , , , Subject: [PATCH 06/10] perf hisi-ptt: Extract the raw data printing part Date: Thu, 4 Jun 2026 15:50:01 +0800 Message-ID: <20260604075005.2219785-7-liusizhe5@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20260604075005.2219785-1-liusizhe5@huawei.com> References: <20260604075005.2219785-1-liusizhe5@huawei.com> Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To kwepemn200012.china.huawei.com (7.202.194.135) Extract the raw data printing part of the TLP header into hisi_ptt_print_raw_record() for reuse by subsequent patches that add field-level parsing of individual DW headers. Signed-off-by: Sizhe Liu --- .../hisi-ptt-decoder/hisi-ptt-pkt-decoder.c | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/tools/perf/util/hisi-ptt-decoder/hisi-ptt-pkt-decoder.c b/tools/perf/util/hisi-ptt-decoder/hisi-ptt-pkt-decoder.c index 33804bcd0642..a5b66e0f7827 100644 --- a/tools/perf/util/hisi-ptt-decoder/hisi-ptt-pkt-decoder.c +++ b/tools/perf/util/hisi-ptt-decoder/hisi-ptt-pkt-decoder.c @@ -93,23 +93,31 @@ union hisi_ptt_field_data { uint32_t value; }; -static void hisi_ptt_print_pkt(struct hisi_ptt_pkt_buf *pkt_buf, - const char *desc) +static void hisi_ptt_print_raw_record(size_t offset, uint32_t value) { const char *color = PERF_COLOR_BLUE; - uint32_t value; uint8_t byte; int i; - value = le32_to_cpu(*(__le32 *)(pkt_buf->buf + pkt_buf->pos)); printf("."); - color_fprintf(stdout, color, " %08zx: ", pkt_buf->pos); + color_fprintf(stdout, color, " %08zx: ", offset); for (i = 0; i < HISI_PTT_FIELD_LENGTH; i++) { byte = (value >> (24 - i * 8)) & 0xFF; color_fprintf(stdout, color, "%02x ", byte); } for (i = 0; i < HISI_PTT_MAX_SPACE_LEN; i++) color_fprintf(stdout, color, " "); +} + +static void hisi_ptt_print_pkt(struct hisi_ptt_pkt_buf *pkt_buf, + const char *desc) +{ + const char *color = PERF_COLOR_BLUE; + uint32_t value; + + value = le32_to_cpu(*(__le32 *)(pkt_buf->buf + pkt_buf->pos)); + hisi_ptt_print_raw_record(pkt_buf->pos, value); + color_fprintf(stdout, color, " %s\n", desc); pkt_buf->pos += HISI_PTT_FIELD_LENGTH; } @@ -135,18 +143,9 @@ static void hisi_ptt_4dw_print_dw0(struct hisi_ptt_pkt_buf *pkt_buf) { const char *color = PERF_COLOR_BLUE; union hisi_ptt_field_data dw; - uint8_t byte; - int i; dw.value = le32_to_cpu(*(__le32 *)(pkt_buf->buf + pkt_buf->pos)); - printf("."); - color_fprintf(stdout, color, " %08zx: ", pkt_buf->pos); - for (i = 0; i < HISI_PTT_FIELD_LENGTH; i++) { - byte = (dw.value >> (24 - i * 8)) & 0xFF; - color_fprintf(stdout, color, "%02x ", byte); - } - for (i = 0; i < HISI_PTT_MAX_SPACE_LEN; i++) - color_fprintf(stdout, color, " "); + hisi_ptt_print_raw_record(pkt_buf->pos, dw.value); color_fprintf(stdout, color, " %s %x %s %x %s %x %s %x %s %x %s %x %s %x %s %x\n", -- 2.33.0