From patchwork Tue May 18 13:00:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 441271 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC72EC433B4 for ; Tue, 18 May 2021 13:02:52 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 016F061040 for ; Tue, 18 May 2021 13:02:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 016F061040 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 20B9516F0; Tue, 18 May 2021 15:01:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 20B9516F0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1621342969; bh=lKVKzjwGhMBl9qfsHW6Qp4jZjlHmFR9KFh9CFePBfM8=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=m2Zo/vGBTAMrFZtzml0eFikEv66EomASHz5B2qqRGsQQdCgy5Al0+7+spw9w+78nD g3X5YVTr7oYHZYC35X4sIgNeJXuA5GmF8Jli1lsQtR5SXAHNDk2d8AlM3BQ0/2sk14 EZAFAPrZk2n/UyTZKBaFvaanJHdCNQMvjdqnVfBs= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C56EFF80430; Tue, 18 May 2021 15:01:09 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 639EEF80430; Tue, 18 May 2021 15:01:08 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 58CF5F80217 for ; Tue, 18 May 2021 15:00:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 58CF5F80217 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="IzZgnLgu"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="O6haf/rC" Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 47B4E5C0036; Tue, 18 May 2021 09:00:55 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 18 May 2021 09:00:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=c3/WTsm5zzIZr KhzTUn6Q5t4wrHodywOq9IdX4OwGDI=; b=IzZgnLgujf1H5x0f9LBZ53TZwo3VN PdRpkD15MqipOcbCutG85OucjHhyP3p/fyr218tg15NSdLkRYxzLDdE3/bRgnSM9 Hf2cn2CKW/vLhaLLBQ9tMNPARRCJCg6eq5doTJyCwRSnh4D6QNiYvf7Rx/jKyodO aOdwN4JhduI/okf+expIjNmKG3pRA1mMZ23G7z8VoBqqxpnHew3FIRicRWG9QWch px/2iXFHv2sr9WE69+FeEYAAx5mhkihe1HJLCrn4GR2qeWwonGYSGyvCalzeHx/W 80L0jaLDZDHCXXsO7qP4MbhoXMSuIyR7Yg53xD1cFAzJq43Q7QNSx2Dgg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=c3/WTsm5zzIZrKhzTUn6Q5t4wrHodywOq9IdX4OwGDI=; b=O6haf/rC ceLF0wJTHmH1lm74Estl4+fs0TzJGJ1vqu+NpHZSj7g1sG//I0fjhNebNlNzL/FM YMH43IldRg/JYb1V9WKUe7Xz1vzoSTJkybXXVepJpqTz3A0Ny+rrtNNtAwhlr8au Jzypvrny7YYzzb1Ow9vuWDPdQOaqEKUEFNptQSQWU90ziUiL8Wb2gjrwPYaaeICK cYQ+HWNqigyieFKkeEQC16X/rCO0t9+vJ+JPYzF0WbS9LngdQ+9VWxL5nFVBCR0H obYq1rgLz0p3CYIqgSoQRA7dtLCguhbMbGIir4pxMcioIT1Aa3JZHpjySI3jh1cV Aqc8giDjBcZ++Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdeijedgheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfgrkhgrshhhihcuufgrkhgrmhhothhouceoohdqthgrkhgr shhhihesshgrkhgrmhhotggthhhirdhjpheqnecuggftrfgrthhtvghrnhepieevffdvhe eutdelffefgeeiudettddvjeefudetveeuleehuedvteevjeettdegnecuffhomhgrihhn pehrgidrvghvvghnthhsnecukfhppedugedrfedrieehrddujeehnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepohdqthgrkhgrshhhihesshgr khgrmhhotggthhhirdhjph X-ME-Proxy: Received: from workstation.flets-east.jp (ae065175.dynamic.ppp.asahi-net.or.jp [14.3.65.175]) by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 18 May 2021 09:00:53 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 1/8] ALSA: firewire-lib: code refactoring to refer the same frame count per period in domain structure Date: Tue, 18 May 2021 22:00:40 +0900 Message-Id: <20210518130048.146596-2-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210518130048.146596-1-o-takashi@sakamocchi.jp> References: <20210518130048.146596-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The number of PCM frame per period is common between PCM substreams handled in AMDTP stream in AMDTP domain. Signed-off-by: Takashi Sakamoto --- sound/firewire/amdtp-stream.c | 3 +-- sound/firewire/amdtp-stream.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c index 409274a532ed..ac37cd4c2b33 100644 --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c @@ -834,7 +834,7 @@ static void out_stream_callback(struct fw_iso_context *context, u32 tstamp, struct amdtp_stream *s = private_data; const struct amdtp_domain *d = s->domain; const __be32 *ctx_header = header; - unsigned int events_per_period = s->ctx_data.rx.events_per_period; + unsigned int events_per_period = d->events_per_period; unsigned int event_count = s->ctx_data.rx.event_count; unsigned int packets; int i; @@ -1490,7 +1490,6 @@ int amdtp_domain_start(struct amdtp_domain *d, unsigned int ir_delay_cycle) } s = d->irq_target; - s->ctx_data.rx.events_per_period = events_per_period; s->ctx_data.rx.event_count = 0; s->ctx_data.rx.seq_index = 0; diff --git a/sound/firewire/amdtp-stream.h b/sound/firewire/amdtp-stream.h index 0628b6e52fc1..c69042013245 100644 --- a/sound/firewire/amdtp-stream.h +++ b/sound/firewire/amdtp-stream.h @@ -147,7 +147,6 @@ struct amdtp_stream { // To generate constant hardware IRQ. unsigned int event_count; - unsigned int events_per_period; } rx; } ctx_data; From patchwork Tue May 18 13:00:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 442533 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3CC0C433B4 for ; Tue, 18 May 2021 13:02:55 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EE46A61040 for ; Tue, 18 May 2021 13:02:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EE46A61040 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8399B16F4; Tue, 18 May 2021 15:02:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8399B16F4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1621342973; bh=z+CvZjdBajX9m5+Z15+xFBzNbw/0ohx3UXffc0FcAW4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=A02HrM339MxRREXWD+oss6Dff0PGB3awuehGQ/T2ds1fPZNebKw4pxoVXMq9/bC7m sznBhWPU5i/2dfaMq0uUPXmeDM+Cs9d6KWQSiT1KZFKgyz3WPslyz0sbZ8pF23b75r g5WV35RUErQrEND7W5rulhMYWZ4+yizOBagLKmRA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E3BD1F80257; Tue, 18 May 2021 15:01:12 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 60F8EF80482; Tue, 18 May 2021 15:01:10 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 50ADCF8012C for ; Tue, 18 May 2021 15:00:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 50ADCF8012C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="h4qi1qtx"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="g4ifCJqd" Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id CD81A5C0217; Tue, 18 May 2021 09:00:56 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 18 May 2021 09:00:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=hW8aEP2R3GD5Z PM4D6zUZu+sNEI/6OiWu1LbEM9Pt+Q=; b=h4qi1qtxbszRm7RwJkkMkkqvPfG4f lf4DWKK9H6HtA4Cm67wc1P0sw06gLuefQDkhPL/H8kFNZCrHdt/H5K72N4wEQTyJ u7IPz2HnbmU3AhHdT5V5YSmqf5pgS1bB/F0g3wh+gNiBPfiY249Hb6VFGpgs4HjM Upyd8biEeXehP/jR04u3XWnO14Y0ZUDgiQkMkIs93vLHupTQPaYkYrso2iH458PO wj2Rl1dHMJJHex9h8P6xPmenSMI920hHu86fDfmMR5C8jl0A0VYjhBaxl5jNXKvL 42DlkXjMblGNt1UJoyIebxCVZDI4xb2y0v4PxNveqyXhBxz7gDbhAx58A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=hW8aEP2R3GD5ZPM4D6zUZu+sNEI/6OiWu1LbEM9Pt+Q=; b=g4ifCJqd 4GpbpiE+qU3Q1NW+m0N1JehhDJWeZzXEnbF2tsQyrD1z9ZV/2sUDl18BBWlm78jl e4cooiC/4+ScKeXnDKn/tue5Oq+1/fz1bNl5rAkTrU+phzyDt2gyspW8fiJnNUlv FkuOxQlKRXq2PKgNZqJhDXqF0QzqfZEsp2uMXpY8f2hP1qH+pZKk/LFsN2pyubyD TCCVtdKpRSOj/j4FxEUJdVMR+c5Cxgy7U5ZYH51Vl6cSUw71BOKu/SiSZuU1GNnH Dmkh8tV6eNSfcqkul9g6bYdA8x3wO+Ax9Gg426idpHUZUyr1odM0unEQEu0ubzMr 29SjxA2PHgu25w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdeijedgheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfgrkhgrshhhihcuufgrkhgrmhhothhouceoohdqthgrkhgr shhhihesshgrkhgrmhhotggthhhirdhjpheqnecuggftrfgrthhtvghrnhepveefffefke etgfevgeefleehfffhueejtdejveethfekveektdejjedvtdejhfejnecukfhppedugedr fedrieehrddujeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhirdhjph X-ME-Proxy: Received: from workstation.flets-east.jp (ae065175.dynamic.ppp.asahi-net.or.jp [14.3.65.175]) by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 18 May 2021 09:00:55 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 2/8] ALSA: firewire-lib: handle the case that empty isochronous packet payload for CIP Date: Tue, 18 May 2021 22:00:41 +0900 Message-Id: <20210518130048.146596-3-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210518130048.146596-1-o-takashi@sakamocchi.jp> References: <20210518130048.146596-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Two quadlets are at least included in isochronous packet payload for Common Isochronous Packet (CIP) format in IEC 61883-1. However, it's better to equip ALSA IEC 61883-1/6 packet streaming engine for contrary packet. This commit handles isochronous cycle to process such packet so that the cycle is skipped. Signed-off-by: Takashi Sakamoto --- sound/firewire/amdtp-stream.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c index ac37cd4c2b33..fcb70f349a2f 100644 --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c @@ -656,11 +656,18 @@ static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle, } if (cip_header_size > 0) { - cip_header = ctx_header + 2; - err = check_cip_header(s, cip_header, *payload_length, - data_blocks, data_block_counter, syt); - if (err < 0) - return err; + if (*payload_length >= cip_header_size) { + cip_header = ctx_header + 2; + err = check_cip_header(s, cip_header, *payload_length, data_blocks, + data_block_counter, syt); + if (err < 0) + return err; + } else { + // Handle the cycle so that empty packet arrives. + cip_header = NULL; + *data_blocks = 0; + *syt = 0; + } } else { cip_header = NULL; err = 0; From patchwork Tue May 18 13:00:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 442532 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A85F8C433B4 for ; Tue, 18 May 2021 13:03:43 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 27E5B60FF0 for ; Tue, 18 May 2021 13:03:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 27E5B60FF0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B2CCC1705; Tue, 18 May 2021 15:02:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B2CCC1705 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1621343021; bh=TrX2UVw7YNm57HDHe/j8twW2pLpMjB2kXU6ogLyrHBI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=T3hX84wHMOub/asuxVSbBjlS3ZzTX9Cs0P2PXXg5T/5W2/ngoeRs4ggikOvTZFnHH 7+Y9Wb8yj+BG65n7n1cfCxR4pZVZJGTeR5NIuStwxwmMkzWe+qnIpRroERIRCpx5kV tpc6OrK3WJNCrZFmohWEshNLVY+8aDP5vdQUGrlM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 97DB7F80217; Tue, 18 May 2021 15:01:15 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 266A6F80475; Tue, 18 May 2021 15:01:11 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 56D1CF80139 for ; Tue, 18 May 2021 15:00:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 56D1CF80139 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="frgbTqLV"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="t9ko1z0e" Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 57EF75C021B; Tue, 18 May 2021 09:00:58 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 18 May 2021 09:00:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=uoCkZcIcLbshY I2iHoNf00ZEZMYN7kDdyXVMmUq2v6k=; b=frgbTqLVu1iqcPAMTc0yPyejM9Egn gdRaGPLD+X9V5zhhBA4HT3/J8/5z/vpXWw6AuXj8I2yGcHLsSggG9HDVP7lJboqN pX/FY4MN1nWlKJTb3eDgH79n/bEj2kDkVE55+hyaenCnqigVLHKytvp0Tjonre1f bmPwoSGnFBLr7LU35qY2xnIZYn2U3hH0Frlm5PRcf5P/QAc/T2HFIf6mGUUDVOq+ qqyZBQWho7BsuTe1lrQqzWUJCQI92CKHkmMxt3dp/VhBlNYh+AlVTgSwp/+bFZYV ty+i84J+UIf99ysKPZh5AMdZmGxEL7qBDyyq57lXVoFf0IARcXJEcxvxQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=uoCkZcIcLbshYI2iHoNf00ZEZMYN7kDdyXVMmUq2v6k=; b=t9ko1z0e xHNOvwF9HtJ/u6SWqNU+y896xvrD6yPTaf+Mj4FQIcr6DNuL5K56Q3vMKbtgPzWy MrAT26s8Ne7FV4ZLp+/fOz3mY6Fqd2SB20bYRpE7EnXXnB07AOQr/iBrqygVyzVi Iuaytyi0QAvcRcVnPy9e/HwtAd21d2mXmhSOZ6EPLFl+GnRNPLJ6xscwy4Exc0ty g2SprwNJj+W9/8ATqgUBiOsQkMHApfiqtVmvPrWC8UP4Gi8bXCsbZFZZ+5H5H8R/ HXeEjA/I6tdmhVMIvVIsUqSeFkyRi6YeH/Bfdf2QXQppFaNvkJTW/oDIPLkNYrut 12sL0CMMMfQb9g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdeijedgheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfgrkhgrshhhihcuufgrkhgrmhhothhouceoohdqthgrkhgr shhhihesshgrkhgrmhhotggthhhirdhjpheqnecuggftrfgrthhtvghrnhepveefffefke etgfevgeefleehfffhueejtdejveethfekveektdejjedvtdejhfejnecukfhppedugedr fedrieehrddujeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhirdhjph X-ME-Proxy: Received: from workstation.flets-east.jp (ae065175.dynamic.ppp.asahi-net.or.jp [14.3.65.175]) by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 18 May 2021 09:00:57 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 3/8] ALSA: firewire-lib: code refactoring for sequence descriptor' Date: Tue, 18 May 2021 22:00:42 +0900 Message-Id: <20210518130048.146596-4-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210518130048.146596-1-o-takashi@sakamocchi.jp> References: <20210518130048.146596-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" A internal structure is used to gather parameters relevant to sequence descriptor. Signed-off-by: Takashi Sakamoto --- sound/firewire/amdtp-stream.c | 36 +++++++++++++++++------------------ sound/firewire/amdtp-stream.h | 8 +++++--- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c index fcb70f349a2f..739e73207fda 100644 --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c @@ -852,8 +852,8 @@ static void out_stream_callback(struct fw_iso_context *context, u32 tstamp, // Calculate the number of packets in buffer and check XRUN. packets = header_length / sizeof(*ctx_header); - generate_pkt_descs(s, s->pkt_descs, ctx_header, packets, d->seq_descs, - d->seq_size); + generate_pkt_descs(s, s->pkt_descs, ctx_header, packets, d->seq.descs, + d->seq.size); process_ctx_payloads(s, s->pkt_descs, packets); @@ -931,12 +931,12 @@ static void in_stream_callback(struct fw_iso_context *context, u32 tstamp, static void pool_ideal_seq_descs(struct amdtp_domain *d, unsigned int packets) { struct amdtp_stream *irq_target = d->irq_target; - unsigned int seq_tail = d->seq_tail; - unsigned int seq_size = d->seq_size; + unsigned int seq_tail = d->seq.tail; + unsigned int seq_size = d->seq.size; unsigned int min_avail; struct amdtp_stream *s; - min_avail = d->seq_size; + min_avail = d->seq.size; list_for_each_entry(s, &d->streams, list) { unsigned int seq_index; unsigned int avail; @@ -945,9 +945,9 @@ static void pool_ideal_seq_descs(struct amdtp_domain *d, unsigned int packets) continue; seq_index = s->ctx_data.rx.seq_index; - avail = d->seq_tail; + avail = d->seq.tail; if (seq_index > avail) - avail += d->seq_size; + avail += d->seq.size; avail -= seq_index; if (avail < min_avail) @@ -955,7 +955,7 @@ static void pool_ideal_seq_descs(struct amdtp_domain *d, unsigned int packets) } while (min_avail < packets) { - struct seq_desc *desc = d->seq_descs + seq_tail; + struct seq_desc *desc = d->seq.descs + seq_tail; desc->syt_offset = calculate_syt_offset(&d->last_syt_offset, &d->syt_offset_state, irq_target->sfc); @@ -970,7 +970,7 @@ static void pool_ideal_seq_descs(struct amdtp_domain *d, unsigned int packets) ++min_avail; } - d->seq_tail = seq_tail; + d->seq.tail = seq_tail; } static void irq_target_callback(struct fw_iso_context *context, u32 tstamp, @@ -1323,7 +1323,7 @@ int amdtp_domain_init(struct amdtp_domain *d) d->events_per_period = 0; - d->seq_descs = NULL; + d->seq.descs = NULL; return 0; } @@ -1438,11 +1438,11 @@ int amdtp_domain_start(struct amdtp_domain *d, unsigned int ir_delay_cycle) queue_size = DIV_ROUND_UP(CYCLES_PER_SECOND * events_per_buffer, amdtp_rate_table[d->irq_target->sfc]); - d->seq_descs = kcalloc(queue_size, sizeof(*d->seq_descs), GFP_KERNEL); - if (!d->seq_descs) + d->seq.descs = kcalloc(queue_size, sizeof(*d->seq.descs), GFP_KERNEL); + if (!d->seq.descs) return -ENOMEM; - d->seq_size = queue_size; - d->seq_tail = 0; + d->seq.size = queue_size; + d->seq.tail = 0; entry = &initial_state[s->sfc]; d->data_block_state = entry->data_block; @@ -1511,8 +1511,8 @@ int amdtp_domain_start(struct amdtp_domain *d, unsigned int ir_delay_cycle) error: list_for_each_entry(s, &d->streams, list) amdtp_stream_stop(s); - kfree(d->seq_descs); - d->seq_descs = NULL; + kfree(d->seq.descs); + d->seq.descs = NULL; return err; } EXPORT_SYMBOL_GPL(amdtp_domain_start); @@ -1538,7 +1538,7 @@ void amdtp_domain_stop(struct amdtp_domain *d) d->events_per_period = 0; d->irq_target = NULL; - kfree(d->seq_descs); - d->seq_descs = NULL; + kfree(d->seq.descs); + d->seq.descs = NULL; } EXPORT_SYMBOL_GPL(amdtp_domain_stop); diff --git a/sound/firewire/amdtp-stream.h b/sound/firewire/amdtp-stream.h index c69042013245..5f5e4d938a0d 100644 --- a/sound/firewire/amdtp-stream.h +++ b/sound/firewire/amdtp-stream.h @@ -287,9 +287,11 @@ struct amdtp_domain { struct amdtp_stream *irq_target; - struct seq_desc *seq_descs; - unsigned int seq_size; - unsigned int seq_tail; + struct { + struct seq_desc *descs; + unsigned int size; + unsigned int tail; + } seq; unsigned int data_block_state; unsigned int syt_offset_state; From patchwork Tue May 18 13:00:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 441270 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B18EC433ED for ; Tue, 18 May 2021 13:03:31 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DEC266112F for ; Tue, 18 May 2021 13:03:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DEC266112F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3BC5216FD; Tue, 18 May 2021 15:02:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3BC5216FD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1621343009; bh=EDofhnRvkprAQnFCxk7g6LWPPccnhOt5DFpM3SB42SI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Kz7ov47r3o92GAKKBpaBBb5+mDsZ6RMCwJzrBk8hPa9qP/1dLiQLpNDqHzLptZQIp ZdM96XnaFgyoKqvmDrj1Yjf+yiDjl+HNKpjPBZq/jfTvS88r2So9ptm28amQz8SMf2 QSNhGJ0NYCpmlViPNinw+qtl1AMFKmYRaZ84BX00= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 79188F80272; Tue, 18 May 2021 15:01:14 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6ACD5F802C8; Tue, 18 May 2021 15:01:10 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 56E89F80257 for ; Tue, 18 May 2021 15:01:00 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 56E89F80257 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="vrp52MZK"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="XjcsG23J" Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id B43D65C0218; Tue, 18 May 2021 09:00:59 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 18 May 2021 09:00:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=olMw+orqa0zaF +zrvN99aV5ejV31uDyid0u4Srw4hts=; b=vrp52MZKQHA0ukDflv5eDgLXza1K9 bFGIu2CLzKt39+r/78wFU3WGG+tsdA9/TriI+Vw2Og35Pe2pgTdVnvaZcr8Ck+4M zh6rzIUDuL4ssh9Btebl/9raYELjq54lR/Zh4TOfVjwAmFShzIhKcbA2wy7fBcYR D68bjXy/P7KbvIUQa0d43JqJzACXDsZ3Zaw0pRsJy+4DCkhAWuZOBuLchorljaPK b0poNqrPdf0uQ8VJJkjpnwaa6fQP+DoKX2hNYO9frOH8H56L34mtGlFQVBhD+n4u XnXzAy9Ugv4hsSOFgLI7RmCMStZ/LPvSpG+lz+ejJGdyxzPVGi02s5gbA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=olMw+orqa0zaF+zrvN99aV5ejV31uDyid0u4Srw4hts=; b=XjcsG23J AIOMCrjCXYLwrFZJ0JimmpQOcVuMh1uw6awpp+7RVIQCAFebXMefKQDiLgHnptOK gxvwzqKnblrQZk5uDDyCjkni1eT/u/IcyO1y/89s8/yE9qegQ5DVPu3bF5SAsZdi BCYTkjK6J+pAt7Qv9TKE7Z4NOnv0EHQR71jsnK7+DoSwcj7q8j3rWLj2+xLNeIq2 sUOfb736Pr8fStfwoct9M1TN/8xpbe2+DX93crVFkH2liaHuTS918PGfROQ/ft1c SdUBJV4iJvkEni/7P3og8xEmlGP9Y2VrcPBZA3NIMdTZjc8CafGgt1nBUaOEQ7wX UxGgyRhV3H3I9g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdeijedgheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfgrkhgrshhhihcuufgrkhgrmhhothhouceoohdqthgrkhgr shhhihesshgrkhgrmhhotggthhhirdhjpheqnecuggftrfgrthhtvghrnhepveefffefke etgfevgeefleehfffhueejtdejveethfekveektdejjedvtdejhfejnecukfhppedugedr fedrieehrddujeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhirdhjph X-ME-Proxy: Received: from workstation.flets-east.jp (ae065175.dynamic.ppp.asahi-net.or.jp [14.3.65.175]) by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 18 May 2021 09:00:58 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 4/8] ALSA: firewire-lib: code refactoring for helper function to compute OHCI 1394 cycle Date: Tue, 18 May 2021 22:00:43 +0900 Message-Id: <20210518130048.146596-5-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210518130048.146596-1-o-takashi@sakamocchi.jp> References: <20210518130048.146596-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Some macros and functions are renamed so that they compute isochronous cycle within maximum count of second in isochronous context of 1394 OHCI. Signed-off-by: Takashi Sakamoto --- sound/firewire/amdtp-stream.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c index 739e73207fda..ed8aea3cb1a1 100644 --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c @@ -20,7 +20,7 @@ #define CYCLES_PER_SECOND 8000 #define TICKS_PER_SECOND (TICKS_PER_CYCLE * CYCLES_PER_SECOND) -#define OHCI_MAX_SECOND 8 +#define OHCI_SECOND_MODULUS 8 /* Always support Linux tracing subsystem. */ #define CREATE_TRACE_POINTS @@ -688,17 +688,17 @@ static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle, // In CYCLE_TIMER register of IEEE 1394, 7 bits are used to represent second. On // the other hand, in DMA descriptors of 1394 OHCI, 3 bits are used to represent // it. Thus, via Linux firewire subsystem, we can get the 3 bits for second. -static inline u32 compute_cycle_count(__be32 ctx_header_tstamp) +static inline u32 compute_ohci_cycle_count(__be32 ctx_header_tstamp) { u32 tstamp = be32_to_cpu(ctx_header_tstamp) & HEADER_TSTAMP_MASK; return (((tstamp >> 13) & 0x07) * 8000) + (tstamp & 0x1fff); } -static inline u32 increment_cycle_count(u32 cycle, unsigned int addend) +static inline u32 increment_ohci_cycle_count(u32 cycle, unsigned int addend) { cycle += addend; - if (cycle >= OHCI_MAX_SECOND * CYCLES_PER_SECOND) - cycle -= OHCI_MAX_SECOND * CYCLES_PER_SECOND; + if (cycle >= OHCI_SECOND_MODULUS * CYCLES_PER_SECOND) + cycle -= OHCI_SECOND_MODULUS * CYCLES_PER_SECOND; return cycle; } @@ -706,11 +706,11 @@ static inline u32 increment_cycle_count(u32 cycle, unsigned int addend) // This module queued the same number of isochronous cycle as the size of queue // to kip isochronous cycle, therefore it's OK to just increment the cycle by // the size of queue for scheduled cycle. -static inline u32 compute_it_cycle(const __be32 ctx_header_tstamp, - unsigned int queue_size) +static inline u32 compute_ohci_it_cycle(const __be32 ctx_header_tstamp, + unsigned int queue_size) { - u32 cycle = compute_cycle_count(ctx_header_tstamp); - return increment_cycle_count(cycle, queue_size); + u32 cycle = compute_ohci_cycle_count(ctx_header_tstamp); + return increment_ohci_cycle_count(cycle, queue_size); } static int generate_device_pkt_descs(struct amdtp_stream *s, @@ -731,7 +731,7 @@ static int generate_device_pkt_descs(struct amdtp_stream *s, unsigned int data_blocks; unsigned int syt; - cycle = compute_cycle_count(ctx_header[1]); + cycle = compute_ohci_cycle_count(ctx_header[1]); err = parse_ir_ctx_header(s, cycle, ctx_header, &payload_length, &data_blocks, &dbc, &syt, packet_index, i); @@ -784,7 +784,7 @@ static void generate_pkt_descs(struct amdtp_stream *s, struct pkt_desc *descs, const struct seq_desc *seq = seq_descs + seq_index; unsigned int syt; - desc->cycle = compute_it_cycle(*ctx_header, s->queue_size); + desc->cycle = compute_ohci_it_cycle(*ctx_header, s->queue_size); syt = seq->syt_offset; if (syt != CIP_SYT_NO_INFO) { @@ -1025,11 +1025,11 @@ static void amdtp_stream_first_callback(struct fw_iso_context *context, wake_up(&s->callback_wait); if (s->direction == AMDTP_IN_STREAM) { - cycle = compute_cycle_count(ctx_header[1]); + cycle = compute_ohci_cycle_count(ctx_header[1]); context->callback.sc = in_stream_callback; } else { - cycle = compute_it_cycle(*ctx_header, s->queue_size); + cycle = compute_ohci_it_cycle(*ctx_header, s->queue_size); if (s == s->domain->irq_target) context->callback.sc = irq_target_callback; From patchwork Tue May 18 13:00:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 441268 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 975AAC433B4 for ; Tue, 18 May 2021 13:04:57 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 14A3C61040 for ; Tue, 18 May 2021 13:04:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 14A3C61040 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9E0BD1700; Tue, 18 May 2021 15:04:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9E0BD1700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1621343095; bh=aP6QAdoO9B5f2IVmNueno5MfG30V3TDARb5yXc2Q8Zw=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=cTOcgMSaKZhHBrqzIrDVrItowfV8y7nvpOiiXAXEkK4X2fQ6tKITB7/nkQnhDYOFE hruu48cmZSH4th9YWiHbXHeHnh5sT2bVmVlHqbaSkYyBiK6HvqklwgJCVaB01hReo1 7PKk/1vl/4WQS0VD8CK9sQQjNj/rA4dSMwOIADbk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 684B2F804BD; Tue, 18 May 2021 15:01:18 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C7E72F80475; Tue, 18 May 2021 15:01:13 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9609CF80272 for ; Tue, 18 May 2021 15:01:04 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9609CF80272 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="4A4ZO7NP"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="ejvnBjTh" Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id EB50C5C0219; Tue, 18 May 2021 09:01:01 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Tue, 18 May 2021 09:01:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=EO05u6KqPf/q1 3T7LEYaijNw5JMQxVVIZOU0w5sSPf8=; b=4A4ZO7NP4m01gCAuAED7SlpislFBe LMLuT1IloohlkAYdhbTM/Uf9ASC1Ed+rsLff4qC23wlGcsEzuYLs1ZczP/CH9A7X xlhuv1f0qUVkJ0ZL6lf6s4fUffWk/8y/4evL5ccYKtm1yATDD3Ols5S7nMYrkSD8 1d6KOcpKT+hAaEh/UfdlG9P7qyAKuyaVFjYZUS8PHEfyAYAjDTvhOUJ7f8heuoQf etyXNJMEpjI83fM/JBIG0+pPcoPQXiYybQ7eVqsXc1u1zWa48hFp0hFlAHCNeEWu hAkDxf0m2fLL5b8onaTccNNo2CYMf6Zl9FIdy5a+eXUUdQGiMFlL6CM7w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=EO05u6KqPf/q13T7LEYaijNw5JMQxVVIZOU0w5sSPf8=; b=ejvnBjTh JcTtbnDgqpURvlaS3IhkKEGDL9o/uJm9RoVX6GZE62xg9UVrmgmkmQOzEQBDmxFF 54RT6u6kRSYxrQsRYO8yGJ6i8MXGEvueC032wv8JlhUuzjppPg3vu+6VzHXjKZk9 FnEO//Ubcz1K7g+HBK2bWMc1Ob8F4mbGzc0VhaNOcY3jaD/G5vyW7Qu1pvN83xGt Oc9kb1JxbmTNYsPSI0PXtnJFzOXTo5HpLLOWxoeihUlFRpR/mAmuLYMVe+TpZBdQ 0kqRj9hFh+SaGiJehx9pSRSDYP+RJ3Rk5TQt7fzs0v5kXpkM1AFw3CYra2FcxM38 iGOQyylsSCtVHA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdeijedgheejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfgrkhgrshhhihcuufgrkhgrmhhothhouceoohdqthgrkhgr shhhihesshgrkhgrmhhotggthhhirdhjpheqnecuggftrfgrthhtvghrnhepveefffefke etgfevgeefleehfffhueejtdejveethfekveektdejjedvtdejhfejnecukfhppedugedr fedrieehrddujeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhirdhjph X-ME-Proxy: Received: from workstation.flets-east.jp (ae065175.dynamic.ppp.asahi-net.or.jp [14.3.65.175]) by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 18 May 2021 09:00:59 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 5/8] ALSA: firewire-lib: code refactoring for parser of IR context header Date: Tue, 18 May 2021 22:00:44 +0900 Message-Id: <20210518130048.146596-6-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210518130048.146596-1-o-takashi@sakamocchi.jp> References: <20210518130048.146596-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" This commit refactors regarding to function argument for the length of isochronous packet payload. Signed-off-by: Takashi Sakamoto --- sound/firewire/amdtp-stream.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c index ed8aea3cb1a1..1c530678e56a 100644 --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c @@ -632,33 +632,33 @@ static int check_cip_header(struct amdtp_stream *s, const __be32 *buf, static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle, const __be32 *ctx_header, - unsigned int *payload_length, unsigned int *data_blocks, unsigned int *data_block_counter, unsigned int *syt, unsigned int packet_index, unsigned int index) { + unsigned int payload_length; const __be32 *cip_header; unsigned int cip_header_size; int err; - *payload_length = be32_to_cpu(ctx_header[0]) >> ISO_DATA_LENGTH_SHIFT; + payload_length = be32_to_cpu(ctx_header[0]) >> ISO_DATA_LENGTH_SHIFT; if (!(s->flags & CIP_NO_HEADER)) cip_header_size = 8; else cip_header_size = 0; - if (*payload_length > cip_header_size + s->ctx_data.tx.max_ctx_payload_length) { + if (payload_length > cip_header_size + s->ctx_data.tx.max_ctx_payload_length) { dev_err(&s->unit->device, "Detect jumbo payload: %04x %04x\n", - *payload_length, cip_header_size + s->ctx_data.tx.max_ctx_payload_length); + payload_length, cip_header_size + s->ctx_data.tx.max_ctx_payload_length); return -EIO; } if (cip_header_size > 0) { - if (*payload_length >= cip_header_size) { + if (payload_length >= cip_header_size) { cip_header = ctx_header + 2; - err = check_cip_header(s, cip_header, *payload_length, data_blocks, + err = check_cip_header(s, cip_header, payload_length, data_blocks, data_block_counter, syt); if (err < 0) return err; @@ -671,15 +671,14 @@ static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle, } else { cip_header = NULL; err = 0; - *data_blocks = *payload_length / sizeof(__be32) / - s->data_block_quadlets; + *data_blocks = payload_length / sizeof(__be32) / s->data_block_quadlets; *syt = 0; if (*data_block_counter == UINT_MAX) *data_block_counter = 0; } - trace_amdtp_packet(s, cycle, cip_header, *payload_length, *data_blocks, + trace_amdtp_packet(s, cycle, cip_header, payload_length, *data_blocks, *data_block_counter, packet_index, index); return err; @@ -727,14 +726,13 @@ static int generate_device_pkt_descs(struct amdtp_stream *s, for (i = 0; i < packets; ++i) { struct pkt_desc *desc = descs + i; unsigned int cycle; - unsigned int payload_length; unsigned int data_blocks; unsigned int syt; cycle = compute_ohci_cycle_count(ctx_header[1]); - err = parse_ir_ctx_header(s, cycle, ctx_header, &payload_length, - &data_blocks, &dbc, &syt, packet_index, i); + err = parse_ir_ctx_header(s, cycle, ctx_header, &data_blocks, &dbc, &syt, + packet_index, i); if (err < 0) return err; From patchwork Tue May 18 13:00:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 441269 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9136EC433B4 for ; Tue, 18 May 2021 13:04:19 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B16D96112F for ; Tue, 18 May 2021 13:04:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B16D96112F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1C1A916FC; Tue, 18 May 2021 15:03:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1C1A916FC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1621343057; bh=4ZthGqZeKTaIjIG5CBCaIAbLmtMGABwrRUrG+YZheWM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ud3IzOCWfuXWJ70F3GwoC2+cXx9tk/Jjm9u2To1zaFFmfABGRXG6ZjdrBjMGbkxyu fBESx/Pj861nX6pmCnIktk8dAfgaRUbhr3wqdZR6TSZU8PDRLDjlO5L51mggeAnyq0 /AxMmU/j6q8fYu0N0FOWW+Kd5Dw77D5yNHqPui/Q= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 20897F804AC; Tue, 18 May 2021 15:01:17 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9C3C5F8042F; Tue, 18 May 2021 15:01:11 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 947BBF80229 for ; Tue, 18 May 2021 15:01:04 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 947BBF80229 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="qbX0Jit4"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="pqmtcYk6" Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id AF2015C0036; Tue, 18 May 2021 09:01:03 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 18 May 2021 09:01:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=KmvqkE0omOlH5 WFCl9vbPkS/ACyDpzuwKRVOiti1Hn0=; b=qbX0Jit48/b1DM3pOaFRyuhXEdbnW 62MyM4L4z/mzoJcqVnDVH42hTCEAYoR+XzTCvqsUYgWa3YxbtsQJUuVObmdpgiZh qROcyrkOFT/k1GFfebVvM6s5qAvsD2+xFpfDdGNxWqH1BlvXuVBmCeCS0HR23GTK eZ71IQCN8l7JolTyTT+qxbrMti0VmEL1CjOY7jMke8jZT0peEj3OPZwNamllO4Sx u0170/Z+RXSXEp99bzwdjRZ6yrTSXJzPK2opaXgrYZDOau91LXj2POI2MWX+2BX4 XfnOVtA3RZleTPv0MR3IXYlBE39sJ7Hi1sbN8LdzuUVJMGECtcQ+LPHSA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=KmvqkE0omOlH5WFCl9vbPkS/ACyDpzuwKRVOiti1Hn0=; b=pqmtcYk6 sqyLwAJ1T0+ZU4af2vI8jkv0nIS0hldW6dXD6lofNyMPgOza1e8DBO5OYr2mvKjm 8Q5OzYoU6E3FLBsyEIbMebWa/9xdvPISLSvNrTGN7N8y+eg4KKLqHsZinge+erNj 42KhaeNMmZykQYouF2zbdiN6eScmP5Noyc/TeKVtVB9+YJ7nDyeEu7Gzx34aM7QS QEkMcbNYbOIwdqtfMDEQyu4vq2snkXUBvQBlRa8PbY9hpoYHjRQuFOHRwIJI4ez1 Xw4oRhc7g0hWPKUBddwuFKmB5K9Xsk1aDmcrN8PaTWG4M7Zy/gHiiJKkUOuUVmJ/ DfjLkfvwjktweQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdeijedgheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfgrkhgrshhhihcuufgrkhgrmhhothhouceoohdqthgrkhgr shhhihesshgrkhgrmhhotggthhhirdhjpheqnecuggftrfgrthhtvghrnhepveefffefke etgfevgeefleehfffhueejtdejveethfekveektdejjedvtdejhfejnecukfhppedugedr fedrieehrddujeehnecuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmrghilh hfrhhomhepohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhirdhjph X-ME-Proxy: Received: from workstation.flets-east.jp (ae065175.dynamic.ppp.asahi-net.or.jp [14.3.65.175]) by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 18 May 2021 09:01:02 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 6/8] ALSA: firewire-lib: code refactoring for check of CIP header about payload size Date: Tue, 18 May 2021 22:00:45 +0900 Message-Id: <20210518130048.146596-7-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210518130048.146596-1-o-takashi@sakamocchi.jp> References: <20210518130048.146596-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The size of CIP payload is now passed to helper function to parse CIP header. Signed-off-by: Takashi Sakamoto --- sound/firewire/amdtp-stream.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c index 1c530678e56a..1ff25e6b0c78 100644 --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c @@ -574,8 +574,7 @@ static int check_cip_header(struct amdtp_stream *s, const __be32 *buf, /* Calculate data blocks */ fdf = (cip_header[1] & CIP_FDF_MASK) >> CIP_FDF_SHIFT; - if (payload_length < sizeof(__be32) * 2 || - (fmt == CIP_FMT_AM && fdf == AMDTP_FDF_NO_DATA)) { + if (payload_length == 0 || (fmt == CIP_FMT_AM && fdf == AMDTP_FDF_NO_DATA)) { *data_blocks = 0; } else { unsigned int data_block_quadlets = @@ -590,8 +589,7 @@ static int check_cip_header(struct amdtp_stream *s, const __be32 *buf, if (s->flags & CIP_WRONG_DBS) data_block_quadlets = s->data_block_quadlets; - *data_blocks = (payload_length / sizeof(__be32) - 2) / - data_block_quadlets; + *data_blocks = payload_length / sizeof(__be32) / data_block_quadlets; } /* Check data block counter continuity */ @@ -658,8 +656,8 @@ static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle, if (cip_header_size > 0) { if (payload_length >= cip_header_size) { cip_header = ctx_header + 2; - err = check_cip_header(s, cip_header, payload_length, data_blocks, - data_block_counter, syt); + err = check_cip_header(s, cip_header, payload_length - cip_header_size, + data_blocks, data_block_counter, syt); if (err < 0) return err; } else { From patchwork Tue May 18 13:00:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 442531 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86425C433ED for ; Tue, 18 May 2021 13:04:24 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F1B5F61040 for ; Tue, 18 May 2021 13:04:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F1B5F61040 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8ECD916F1; Tue, 18 May 2021 15:03:32 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8ECD916F1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1621343062; bh=OiZvZuSMEkvlY5X4jn+JHGle/mBwyHjeQtGF4iflrR4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=W5HQP6xdtnboIJTXsO7aYYCW1j0Nf6eweB5pFkHoZ9JWrux+hrYMZ2F+idJifhyWA B/pdZIBWDfyQ0UWtXHAsdlNss/5Tnb425KVlVMuwipcrmeH6GIrEDc6dVdEoJggB+u pWz2cyT+UiI/2tKTfW9czOs2L4XHvQt+GLZ2MsHg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C1830F804AD; Tue, 18 May 2021 15:01:17 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2C8F7F80475; Tue, 18 May 2021 15:01:13 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 08073F8027D for ; Tue, 18 May 2021 15:01:06 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 08073F8027D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="dIlb+2ue"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="t96ejH3m" Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 3FB755C01F9; Tue, 18 May 2021 09:01:05 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Tue, 18 May 2021 09:01:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=oWtVp8Z06GLgL pDoYN+KEbuOrnjsvwjcGcnHJoN+UDg=; b=dIlb+2uejYDWvtaHA/5PZg40MosqZ UQEFmumgJ22bqmh7Ay+J6U2kdZipfgi98k5WNAJe7QEQuprw/7ZHmo3g+FECeJ9q xextVThZSU619nrPDcKIQHf9sisJ63Lle7NgmmlTZBLtZWjC4/8+oOjO4RR7NOiQ sOTGuEE6HuKLcxKsCPZU4v+Z+lWDMqe8pLlCdHonnIb40kGR6pSNAsGivftmaBS2 UWLQajgi5hWp4u7ZYa39ttfVJNzt+ZjTJD6uLaV+PDafWrfrXcztuheualF6dG07 EbA+d9TH3ISAwAExRJ3Jv3YOJOaxmi6nRVKowVuWJyhfrOharb1N78u7Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=oWtVp8Z06GLgLpDoYN+KEbuOrnjsvwjcGcnHJoN+UDg=; b=t96ejH3m VUkFh9Llw6XFJmRWBeJP7A/QzSdbb9oB4gBNt5s0IZL8ZECUnIHvicwrslAaPwHa 2842e7mPhfnSdG2npxyO5PcwXgyJCaEEju45ig4vRpmWFq4n3ptjQZgj55hsqCSl elp69UIRsRCzEj9fEJc11MvWXnvcEAaLl93tDoF7QoC9uIke5kyJLInvTCc3mY++ x7RHHB7ltdrK7JSNfBdHi459ZWHUeqRNAfyYI2hmEtUgDv6piU+zUmvr+KcrWeCy XPEznYhAi+LpDWI+xk9S/+L8aKvC5o4/nDSp3OjHomauUFrcsUuP2I5DfJel5Eu7 UQkHYbY6nVOvaw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdeijedgheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfgrkhgrshhhihcuufgrkhgrmhhothhouceoohdqthgrkhgr shhhihesshgrkhgrmhhotggthhhirdhjpheqnecuggftrfgrthhtvghrnhepveefffefke etgfevgeefleehfffhueejtdejveethfekveektdejjedvtdejhfejnecukfhppedugedr fedrieehrddujeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhirdhjph X-ME-Proxy: Received: from workstation.flets-east.jp (ae065175.dynamic.ppp.asahi-net.or.jp [14.3.65.175]) by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 18 May 2021 09:01:03 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 7/8] ALSA: firewire-lib: check cycle continuity Date: Tue, 18 May 2021 22:00:46 +0900 Message-Id: <20210518130048.146596-8-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210518130048.146596-1-o-takashi@sakamocchi.jp> References: <20210518130048.146596-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Within devices supported by drivers in ALSA firewire stack, OXFW-based devices and Fireface devices are known to skip isochronous cycle for packet transmission. The former is due to the jumbo payload quirk. The latter is due to vendor protocol in which empty packet is not transferred in blocking mode. Although nothing to do just for handling events of the packet, packet continuity is necessarily for media clock recovery. This commit checks whether any cycle is continue or not. Signed-off-by: Takashi Sakamoto --- sound/firewire/amdtp-stream.c | 39 ++++++++++++++++++++++++++++++++--- sound/firewire/amdtp-stream.h | 1 + 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c index 1ff25e6b0c78..78b62a452d56 100644 --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c @@ -699,6 +699,16 @@ static inline u32 increment_ohci_cycle_count(u32 cycle, unsigned int addend) return cycle; } +static int compare_ohci_cycle_count(u32 lval, u32 rval) +{ + if (lval == rval) + return 0; + else if (lval < rval && rval - lval < OHCI_SECOND_MODULUS * CYCLES_PER_SECOND / 2) + return -1; + else + return 1; +} + // Align to actual cycle count for the packet which is going to be scheduled. // This module queued the same number of isochronous cycle as the size of queue // to kip isochronous cycle, therefore it's OK to just increment the cycle by @@ -715,6 +725,7 @@ static int generate_device_pkt_descs(struct amdtp_stream *s, const __be32 *ctx_header, unsigned int packets) { + unsigned int next_cycle = s->next_cycle; unsigned int dbc = s->data_block_counter; unsigned int packet_index = s->packet_index; unsigned int queue_size = s->queue_size; @@ -724,10 +735,31 @@ static int generate_device_pkt_descs(struct amdtp_stream *s, for (i = 0; i < packets; ++i) { struct pkt_desc *desc = descs + i; unsigned int cycle; + bool lost; unsigned int data_blocks; unsigned int syt; cycle = compute_ohci_cycle_count(ctx_header[1]); + lost = (next_cycle != cycle); + if (lost) { + if (s->flags & CIP_NO_HEADER) { + // Fireface skips transmission just for an isoc cycle corresponding + // to empty packet. + next_cycle = increment_ohci_cycle_count(next_cycle, 1); + lost = (next_cycle != cycle); + } else if (s->flags & CIP_JUMBO_PAYLOAD) { + // OXFW970 skips transmission for several isoc cycles during + // asynchronous transaction. + unsigned int safe_cycle = increment_ohci_cycle_count(next_cycle, + IR_JUMBO_PAYLOAD_MAX_SKIP_CYCLES); + lost = (compare_ohci_cycle_count(safe_cycle, cycle) > 0); + } + if (lost) { + dev_err(&s->unit->device, "Detect discontinuity of cycle: %d %d\n", + next_cycle, cycle); + return -EIO; + } + } err = parse_ir_ctx_header(s, cycle, ctx_header, &data_blocks, &dbc, &syt, packet_index, i); @@ -743,12 +775,12 @@ static int generate_device_pkt_descs(struct amdtp_stream *s, 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); - + next_cycle = increment_ohci_cycle_count(next_cycle, 1); + ctx_header += s->ctx_data.tx.ctx_header_size / sizeof(*ctx_header); packet_index = (packet_index + 1) % queue_size; } + s->next_cycle = next_cycle; s->data_block_counter = dbc; return 0; @@ -1022,6 +1054,7 @@ static void amdtp_stream_first_callback(struct fw_iso_context *context, if (s->direction == AMDTP_IN_STREAM) { cycle = compute_ohci_cycle_count(ctx_header[1]); + s->next_cycle = cycle; context->callback.sc = in_stream_callback; } else { diff --git a/sound/firewire/amdtp-stream.h b/sound/firewire/amdtp-stream.h index 5f5e4d938a0d..58769ca184a2 100644 --- a/sound/firewire/amdtp-stream.h +++ b/sound/firewire/amdtp-stream.h @@ -171,6 +171,7 @@ struct amdtp_stream { bool callbacked; wait_queue_head_t callback_wait; u32 start_cycle; + unsigned int next_cycle; /* For backends to process data blocks. */ void *protocol; From patchwork Tue May 18 13:00:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 442530 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1E87C433B4 for ; Tue, 18 May 2021 13:05:12 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 30CEF60FF0 for ; Tue, 18 May 2021 13:05:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 30CEF60FF0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B4FF8170D; Tue, 18 May 2021 15:04:20 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B4FF8170D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1621343110; bh=EZGwLAA5iXiYEHxfYtBjACPnABuAXlHX1DvsbI7UDcE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=u5s3YkxlwqrU0Ntc42ljonGpcZXN0mFW2Lynf3SHXqqFv9SXytq/L7+CIM2Cy3KZy 9UTALLsJhUd5E9qZrJ2zukgETD0mS25d5IGMri+8UxAtUOnsA8oCIiVRUUgd6h+Cm5 htOlzH4EOJvpdZUPQ4fTsci+MOzVUkX/j0pjhvKI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 43F5DF804D8; Tue, 18 May 2021 15:01:19 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3AB9AF804A9; Tue, 18 May 2021 15:01:15 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id BE35AF80217 for ; Tue, 18 May 2021 15:01:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BE35AF80217 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="zfE/kiYe"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="c9eUP4dY" Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id F28B45C021E; Tue, 18 May 2021 09:01:06 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 18 May 2021 09:01:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=mF3hpUrwrtAk1 Ie3OFRMN8X5OiZd7cmNLrl7DpxqZbY=; b=zfE/kiYeN0GOqc92d93hViatYptIV 6JDYF6j8BoimWvvZAQtllvldmLX8QSKHOc9DVLwSvEl5ALIGnn52nVHJM7OB5EgC m2KO74NXhO7u7e8gnLCLiSvTkLYWvMEVpQLrbMUI0XTQ6mBBJEVWUWoqajwR+leK qK8I3HmmYnenF/tO0SiaCFumSTbk2oyOhzBnGo9z4aSrYb1nwOsy52JlQNFRart3 z4rw7bFtExxS8ZnW81WWcHrccL0ECbVc+N6hT8ry1+ZRQWt81afEOC58pZpEtYRB 4xImFxDgy1pGi9zNQbFdtrH+UZDk4jX/azSQG7ndEk3JFbbgX36nCt8sQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=mF3hpUrwrtAk1Ie3OFRMN8X5OiZd7cmNLrl7DpxqZbY=; b=c9eUP4dY paX2NtDE5VPYchI8DuniKz+g2p+VXqrhSQHoDhcLidJBg4l6YrTHrKXMPQyoP4R8 u1A/x6qgOKHxMCsK5GyQSoQ3U9EhjsukJxmFyexGGWuPz47xpEp+2RrNvTCyKqvY S7jPRXzjf1PXlUKFES2BvdjyOBIdDykRa1c11P9K7K84DUtpJNly8fEVj+y9v05p z1tWDde5/lncMpeWFd+w7J10uKSNsYKIWXeXfgiXrN95LERvhdcHPn0o9JtyApTJ XXdQZxGBEnbJHHPDjSROCof2PCLwWd/bDcxFoqUnqTO2TEQ9OSbXC+h2iNJKDe9p OQ2exiBtoeDikg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdeijedgheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfgrkhgrshhhihcuufgrkhgrmhhothhouceoohdqthgrkhgr shhhihesshgrkhgrmhhotggthhhirdhjpheqnecuggftrfgrthhtvghrnhepveefffefke etgfevgeefleehfffhueejtdejveethfekveektdejjedvtdejhfejnecukfhppedugedr fedrieehrddujeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhirdhjph X-ME-Proxy: Received: from workstation.flets-east.jp (ae065175.dynamic.ppp.asahi-net.or.jp [14.3.65.175]) by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 18 May 2021 09:01:05 -0400 (EDT) From: Takashi Sakamoto To: tiwai@suse.de Subject: [PATCH 8/8] ALSA: firewire-lib: insert descriptor for skipped cycle Date: Tue, 18 May 2021 22:00:47 +0900 Message-Id: <20210518130048.146596-9-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210518130048.146596-1-o-takashi@sakamocchi.jp> References: <20210518130048.146596-1-o-takashi@sakamocchi.jp> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, clemens@ladisch.de X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" This commit fulfils sequence descriptors for skipped cycle when it's one cycle. This is preparation for future integration. Signed-off-by: Takashi Sakamoto --- sound/firewire/amdtp-stream.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c index 78b62a452d56..af5c3629f1ac 100644 --- a/sound/firewire/amdtp-stream.c +++ b/sound/firewire/amdtp-stream.c @@ -723,7 +723,8 @@ static inline u32 compute_ohci_it_cycle(const __be32 ctx_header_tstamp, static int generate_device_pkt_descs(struct amdtp_stream *s, struct pkt_desc *descs, const __be32 *ctx_header, - unsigned int packets) + unsigned int packets, + unsigned int *desc_count) { unsigned int next_cycle = s->next_cycle; unsigned int dbc = s->data_block_counter; @@ -732,8 +733,9 @@ static int generate_device_pkt_descs(struct amdtp_stream *s, int i; int err; + *desc_count = 0; for (i = 0; i < packets; ++i) { - struct pkt_desc *desc = descs + i; + struct pkt_desc *desc = descs + *desc_count; unsigned int cycle; bool lost; unsigned int data_blocks; @@ -745,11 +747,25 @@ static int generate_device_pkt_descs(struct amdtp_stream *s, if (s->flags & CIP_NO_HEADER) { // Fireface skips transmission just for an isoc cycle corresponding // to empty packet. + unsigned int prev_cycle = next_cycle; + next_cycle = increment_ohci_cycle_count(next_cycle, 1); lost = (next_cycle != cycle); + if (!lost) { + // Prepare a description for the skipped cycle for + // sequence replay. + desc->cycle = prev_cycle; + desc->syt = 0; + desc->data_blocks = 0; + desc->data_block_counter = dbc; + desc->ctx_payload = NULL; + ++desc; + ++(*desc_count); + } } else if (s->flags & CIP_JUMBO_PAYLOAD) { // OXFW970 skips transmission for several isoc cycles during - // asynchronous transaction. + // asynchronous transaction. The sequence replay is impossible due + // to the reason. unsigned int safe_cycle = increment_ohci_cycle_count(next_cycle, IR_JUMBO_PAYLOAD_MAX_SKIP_CYCLES); lost = (compare_ohci_cycle_count(safe_cycle, cycle) > 0); @@ -776,6 +792,7 @@ static int generate_device_pkt_descs(struct amdtp_stream *s, dbc = (dbc + desc->data_blocks) & 0xff; next_cycle = increment_ohci_cycle_count(next_cycle, 1); + ++(*desc_count); ctx_header += s->ctx_data.tx.ctx_header_size / sizeof(*ctx_header); packet_index = (packet_index + 1) % queue_size; } @@ -927,6 +944,7 @@ static void in_stream_callback(struct fw_iso_context *context, u32 tstamp, struct amdtp_stream *s = private_data; __be32 *ctx_header = header; unsigned int packets; + unsigned int desc_count; int i; int err; @@ -936,14 +954,15 @@ static void in_stream_callback(struct fw_iso_context *context, u32 tstamp, // Calculate the number of packets in buffer and check XRUN. packets = header_length / s->ctx_data.tx.ctx_header_size; - err = generate_device_pkt_descs(s, s->pkt_descs, ctx_header, packets); + desc_count = 0; + err = generate_device_pkt_descs(s, s->pkt_descs, ctx_header, packets, &desc_count); if (err < 0) { if (err != -EAGAIN) { cancel_stream(s); return; } } else { - process_ctx_payloads(s, s->pkt_descs, packets); + process_ctx_payloads(s, s->pkt_descs, desc_count); } for (i = 0; i < packets; ++i) {