Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3540724pxj; Mon, 24 May 2021 09:00:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlFUBI8PTvgUx+fuVDYAAoG5C0iXs/dZrJK9oJhO7vrJRDH7p0vxE/Vv1lnq2A7/cTLuWl X-Received: by 2002:a05:6e02:b2f:: with SMTP id e15mr16717720ilu.284.1621872012038; Mon, 24 May 2021 09:00:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621872012; cv=none; d=google.com; s=arc-20160816; b=qSp/KtLA7Y2sPUd1+ApIMRGTVuYlUERiuHUOiYxpIg2mpxCbwNwSjzaunG3II/dPI0 /fln69q9IRAsIQh3+fUoZvbnBiIsy2/KVcqDM66Lu4QJUMxjfZTUQ3L/xUfmyIISjsEq hU5iV+Ft6ue/AQoL8IMwasCXY1OK5F3k2YDGmOKgGK7Yp9SbOkhMEWM4mkrLyBJEr57Z a2y7b82EjA5v3M1lzrntaUPiIvd6kyJiTgecC0BPA5wkb6lntjhFxT6YYvbVnqVrPmQy 5UCn0k3kjaDC2aY/bwoA710TIu1ujLQKgh0zdBT4SurZ/yVzew7pHwFrnCqzofHTab1r FhuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=H3q//+enMur/9HGQzBQhix3USmarkjd4D/40jWS6z1Q=; b=VxkwjYEihrtAwCQ/OyVb3pQYvcO3fdO1Fq0wPzjqlolxbo7/wjGY/OC4jJ7e9uUUau osho06++PQvOnzD8GQi5wdCxqrc/som8/oQVlsdDc5TOCKFAXaR1YqjWVfEeJc3ebj3t Tfe2UOexXDXCRVx8bSdDTXKtWCRLXBXqmJGS30rsXDRa/aMugIIkYbKeeQZt4amdyaRF VbWEOltWumXBvW//e5UGgVG9ltpLHz5mRDCRtolHDyviaZVFLJORjKTb4BPz9UP7QVoB t7AAPpCavDK2A6xbt0DB+K17ZqnvZIJsbESl40HMXN1Weuxcnbr39hc7/bV6h+TwbJQr KUSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=waMAzDMk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p14si16809368ils.62.2021.05.24.08.59.58; Mon, 24 May 2021 09:00:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=waMAzDMk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235843AbhEXP7P (ORCPT + 99 others); Mon, 24 May 2021 11:59:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:40464 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234856AbhEXPyr (ORCPT ); Mon, 24 May 2021 11:54:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 347D461432; Mon, 24 May 2021 15:39:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621870790; bh=2DtR95kMMVrs0ObbwoJNHyN/T4f7yxNTruw2/V0yOGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=waMAzDMkgRPMV4Tl0LkzdYEdvvvlA+gJytyJWhUlAz7U14ZE+kZkNH6lJMIiMcnyu vfVi4e4IGQcInkKiDK9VRyPle5x3MR0kQ03LRSNpkGR6r0ZMh6SbIAye2Qb4wUY1no FIyHn1DJrY0uUN0p2pLXmKfS9o0VT2H8FfuR+glo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Sakamoto , Takashi Iwai Subject: [PATCH 5.10 036/104] ALSA: firewire-lib: fix amdtp_packet tracepoints event for packet_index field Date: Mon, 24 May 2021 17:25:31 +0200 Message-Id: <20210524152334.026614407@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152332.844251980@linuxfoundation.org> References: <20210524152332.844251980@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takashi Sakamoto commit 814b43127f4ac69332e809152e30773941438aff upstream. The snd_firewire_lib:amdtp_packet tracepoints event includes index of packet processed in a context handling. However in IR context, it is not calculated as expected. Cc: Fixes: 753e717986c2 ("ALSA: firewire-lib: use packet descriptor for IR context") Signed-off-by: Takashi Sakamoto Link: https://lore.kernel.org/r/20210513125652.110249-6-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/firewire/amdtp-stream-trace.h | 6 +++--- sound/firewire/amdtp-stream.c | 15 +++++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) --- a/sound/firewire/amdtp-stream-trace.h +++ b/sound/firewire/amdtp-stream-trace.h @@ -14,8 +14,8 @@ #include TRACE_EVENT(amdtp_packet, - TP_PROTO(const struct amdtp_stream *s, u32 cycles, const __be32 *cip_header, unsigned int payload_length, unsigned int data_blocks, unsigned int data_block_counter, unsigned int index), - TP_ARGS(s, cycles, cip_header, payload_length, data_blocks, data_block_counter, index), + TP_PROTO(const struct amdtp_stream *s, u32 cycles, const __be32 *cip_header, unsigned int payload_length, unsigned int data_blocks, unsigned int data_block_counter, unsigned int packet_index, unsigned int index), + TP_ARGS(s, cycles, cip_header, payload_length, data_blocks, data_block_counter, packet_index, index), TP_STRUCT__entry( __field(unsigned int, second) __field(unsigned int, cycle) @@ -48,7 +48,7 @@ TRACE_EVENT(amdtp_packet, __entry->payload_quadlets = payload_length / sizeof(__be32); __entry->data_blocks = data_blocks; __entry->data_block_counter = data_block_counter, - __entry->packet_index = s->packet_index; + __entry->packet_index = packet_index; __entry->irq = !!in_interrupt(); __entry->index = index; ), --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c @@ -526,7 +526,7 @@ static void build_it_pkt_header(struct a } trace_amdtp_packet(s, cycle, cip_header, payload_length, data_blocks, - data_block_counter, index); + data_block_counter, s->packet_index, index); } static int check_cip_header(struct amdtp_stream *s, const __be32 *buf, @@ -630,7 +630,7 @@ static int parse_ir_ctx_header(struct am unsigned int *payload_length, unsigned int *data_blocks, unsigned int *data_block_counter, - unsigned int *syt, unsigned int index) + unsigned int *syt, unsigned int packet_index, unsigned int index) { const __be32 *cip_header; int err; @@ -662,7 +662,7 @@ static int parse_ir_ctx_header(struct am } trace_amdtp_packet(s, cycle, cip_header, *payload_length, *data_blocks, - *data_block_counter, index); + *data_block_counter, packet_index, index); return err; } @@ -701,12 +701,13 @@ static int generate_device_pkt_descs(str unsigned int packets) { unsigned int dbc = s->data_block_counter; + unsigned int packet_index = s->packet_index; + unsigned int queue_size = s->queue_size; int i; int err; for (i = 0; i < packets; ++i) { struct pkt_desc *desc = descs + i; - unsigned int index = (s->packet_index + i) % s->queue_size; unsigned int cycle; unsigned int payload_length; unsigned int data_blocks; @@ -715,7 +716,7 @@ static int generate_device_pkt_descs(str cycle = compute_cycle_count(ctx_header[1]); err = parse_ir_ctx_header(s, cycle, ctx_header, &payload_length, - &data_blocks, &dbc, &syt, i); + &data_blocks, &dbc, &syt, packet_index, i); if (err < 0) return err; @@ -723,13 +724,15 @@ static int generate_device_pkt_descs(str desc->syt = syt; desc->data_blocks = data_blocks; desc->data_block_counter = dbc; - desc->ctx_payload = s->buffer.packets[index].buffer; + desc->ctx_payload = s->buffer.packets[packet_index].buffer; if (!(s->flags & CIP_DBC_IS_END_EVENT)) dbc = (dbc + desc->data_blocks) & 0xff; ctx_header += s->ctx_data.tx.ctx_header_size / sizeof(*ctx_header); + + packet_index = (packet_index + 1) % queue_size; } s->data_block_counter = dbc;