All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andre Guedes <andre.guedes@intel.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, liam.r.girdwood@linux.intel.com,
	pierre-louis.bossart@linux.intel.com
Subject: [PATCH - AAF PCM plugin 0/7] Follow-up improvements
Date: Fri,  7 Dec 2018 17:55:43 -0800	[thread overview]
Message-ID: <20181208015550.20268-1-andre.guedes@intel.com> (raw)

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(-)

-- 
2.19.1

             reply	other threads:[~2018-12-08  2:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-08  1:55 Andre Guedes [this message]
2018-12-08  1:55 ` [PATCH - AAF PCM plugin 1/7] doc: Fix typo in AAF doc Andre Guedes
2018-12-08  1:55 ` [PATCH - AAF PCM plugin 2/7] aaf: Add presentation time tolerance Andre Guedes
2018-12-08  1:55 ` [PATCH - AAF PCM plugin 3/7] aaf: Refactor AVTPDU transmission routines Andre Guedes
2018-12-08  1:55 ` [PATCH - AAF PCM plugin 4/7] aaf: Refactor AVTPDU reception routines Andre Guedes
2018-12-08  1:55 ` [PATCH - AAF PCM plugin 5/7] aaf: Refactor timeout routines Andre Guedes
2018-12-08  1:55 ` [PATCH - AAF PCM plugin 6/7] aaf: Tx multiple AVTPDUs per media clock tick Andre Guedes
2018-12-08  1:55 ` [PATCH - AAF PCM plugin 7/7] aaf: AVTPDU transmission periodicity Andre Guedes
2018-12-10 10:22 ` [PATCH - AAF PCM plugin 0/7] Follow-up improvements Takashi Iwai
2018-12-10 10:59   ` Takashi Iwai
2018-12-10 20:44     ` Guedes, Andre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181208015550.20268-1-andre.guedes@intel.com \
    --to=andre.guedes@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.