From patchwork Sat Dec 8 01:55:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guedes, Andre" X-Patchwork-Id: 10719107 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E6E301731 for ; Sat, 8 Dec 2018 02:02:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5E512DBBF for ; Sat, 8 Dec 2018 02:02:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA70E2DC03; Sat, 8 Dec 2018 02:02:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BCF92DBBF for ; Sat, 8 Dec 2018 02:02:48 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id A8B9E267D34; Sat, 8 Dec 2018 03:02:35 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id D5435267D53; Sat, 8 Dec 2018 03:02:27 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by alsa0.perex.cz (Postfix) with ESMTP id 50CC2267D20 for ; Sat, 8 Dec 2018 03:02:21 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Dec 2018 18:02:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,328,1539673200"; d="scan'208";a="116977199" Received: from aguedesl-mac01.jf.intel.com ([10.24.12.59]) by FMSMGA003.fm.intel.com with ESMTP; 07 Dec 2018 18:02:19 -0800 From: Andre Guedes To: alsa-devel@alsa-project.org Date: Fri, 7 Dec 2018 17:55:43 -0800 Message-Id: <20181208015550.20268-1-andre.guedes@intel.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Cc: tiwai@suse.de, liam.r.girdwood@linux.intel.com, pierre-louis.bossart@linux.intel.com Subject: [alsa-devel] [PATCH - AAF PCM plugin 0/7] Follow-up improvements X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 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-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Hi all, This patch series provides some follow-up improvements to the AVTP Audio Format (AAF) plugin. The highlight of this series is the implementation of a transmission offload mechanism which improves the plugin performance considerably. Details are provided in the following paragraphs. Currently, the AVTPDU transmission interval is controlled by the AAF plugin, in software. At every timer expiration, the plugin transmits one AVTPDU. This has some implications in terms of task scheduling. For instance, in class A streams, AVTPDUs are transmitted at every 125 us which means the application task should be scheduled-in at every 125 us. In a general purpose Linux system, such scheduling interval can be hard to cope with in the long-run. To mitigate that issue, this series introduces a transmission offload mechanism that leverages the SO_TXTIME sockopt and ETF qdisc features recently introduced to kernel 4.19. Instead of sending one AVTPDU at every timer expiration, the plugin sends several AVTPDUs at once to the kernel, configuring their Tx time so the transmission interval is maintained. The kernel can then offload packet transmission to the hardware (if the network controller supports it), providing more transmission time accuracy. This offloading mechanism enables the application to sleep for longer times, easing on task scheduling. To illustrate the improvements provided by this series, I ran a before-after experiment. The experiment setup consisted in 2 PCs with Intel i210 card connected back-to-back running an up-to-date Archlinux with kernel 4.19.4. I ran 'aplay' for 5 minutes on one PC and captured the AVTPDUs on the other PC. The metric under evaluation is the transmission interval and it is measured by checking the 'time_delta' information from ethernet frames captured at the receiving side. If you're interested in reproducing the experiments, let me know and I can share my helper scripts. The table below shows the experiment outcome for a Class A, stereo, 16-bit sample, 48 kHz stream. The unit is nanoseconds. | Mean | Stdev | Min | Max | Range | -------+--------+---------+---------+---------+---------+ Before | 125000 | 1154 | 75311 | 172144 | 96833 | After | 125000 | 18 | 124960 | 125048 | 88 | Before this patchset, the transmission interval mean is equal to the optimal value (Class A stream -> 125 us interval), and it is kept the same after the patchset. However, the dispersion measurements had improved considerably, meaning the system is consistently transmitting AVTPDUs at the correct interval. Finally, to help the review process, here follows a quick summary of the patches within this series: * PATCH 1: fixes a type in the plugin documentation. * PATCH 2: enables the user to configure the presentation time tolerance. * PATCH 3-5: refactor the code in order to land the offload mechanism code smoothly. * PATCH 6-7: implement the transmission offload mechanism. This series can also be found in my alsa-plugins tree in github [1]. Regards, Andre [1] https://github.com/aguedes/alsa-plugins Andre Guedes (7): doc: Fix typo in AAF doc aaf: Add presentation time tolerance aaf: Refactor AVTPDU transmission routines aaf: Refactor AVTPDU reception routines aaf: Refactor timeout routines aaf: Tx multiple AVTPDUs per media clock tick aaf: AVTPDU transmission periodicity aaf/pcm_aaf.c | 600 +++++++++++++++++++++++++++++++++----------------- configure.ac | 2 +- doc/aaf.txt | 40 +++- 3 files changed, 429 insertions(+), 213 deletions(-)