Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp501449lqt; Thu, 6 Jun 2024 09:32:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVUOBHg99D0+dL/b2bGWYD4m5RCVkyqWBbRzb4qsiXU3c8CO5m/UDBO3h8P5E9aFMbCQ7tm7A5lsp6frwtdA/dqD69nL7CI8v2/kbhImA== X-Google-Smtp-Source: AGHT+IFJFFK5Hxhu+jWsZ2gPwBTlekhhyfeivK1y3b8FeJSju/ukuDB2F+kvaBi5nYNj5JfV+Vn9 X-Received: by 2002:a05:6a20:244b:b0:1af:d044:1395 with SMTP id adf61e73a8af0-1b2f9a54b9cmr59019637.20.1717691455350; Thu, 06 Jun 2024 09:30:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717691455; cv=pass; d=google.com; s=arc-20160816; b=XeoSKfE5v65YmPGQZZjhNXy2eXIYOa7YpaAQ4uXqJeqkqGICU4v5gxfIGo4pr0LBhh Ti2S4ODltJfJnlIFOphLdnii9se1gJPUSqNwf4MXSpf4EwpbsfElK2ryl1gbARyuAdU3 Sf6mV6JZCrXbayQ7ieXkPrLIoxtuOPYYYYmygYx3BThMhoG/rbd7lwpTp4cXQlPKUFDO PJFmsBG5ZWIQLhyZldLPagzL5NFaLcXM9LRpS5ru6UCY5jpG6+eXh1PGO/RXmOrzF6GT JeE3ZZe2jhjdC7iCvJ3AvXrTXRPjhWpVEcLTfRpl2FEaq+zCYnmUEfnqpP+3wcwbQxIM LA4g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:to:from :dkim-signature; bh=pcye0rJiyy34ptRIzGkdbWCJ6FryA9ij26/cfVA8Jh4=; fh=4lGQI6056MBa4/oovMyIYaKLn+Wz/24RGvUivMmQP8E=; b=Tc2449+YHtS6ZENoBmD5s0bWKuL5cNxUkQxQHF6gOh3lbrdmfCtXrrnKbCVtPXOFur wMppPvyLOTH/8t26WQFrouhOiYBv52uhhaj++vsrb0+4n1U99ytoNOvNRLMPVQIOdxmw q6s3L/29uag/Fmi5a7RccaVOtI1Zv+gTbPzAsj0pHTKlOrB1+PqgEEXVptMYonE4AXnm T6QyiCKI46KNednLbr7EUgZEjRr4RWy/fxzsuVf6Hb61ST6bsupLKpZyub3OSq3t3zKS dhgL1UMSd5ogPKPZXudLdmuXKKu9ZkmCiksX1IJP+9w6E6NBKTKpfeycf6kTjRsft+a8 g4fA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=d5QgfRuC; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-5172-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-5172-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de2885fd52si292089a12.572.2024.06.06.09.30.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 09:30:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-5172-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=d5QgfRuC; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-5172-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-5172-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DF6EB2892F1 for ; Thu, 6 Jun 2024 16:29:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5C7DD19750B; Thu, 6 Jun 2024 16:29:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="d5QgfRuC" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail-vs1-f48.google.com (mail-vs1-f48.google.com [209.85.217.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 623DD10E9 for ; Thu, 6 Jun 2024 16:29:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717691348; cv=none; b=s6bCZI7wnpTqrUhSntgXqEtMxCZtxYmGRdJLITyQUnKJY1B5+2WyeO11UJ2F/nKbvX4QRfASZkXwNt4QObZHJju5VZmg4/lx7Kc9eKoJ0sLpczUOBkmAvjfNKaLI9AsdxKhphvBZujlkfP0qD0OXjNIMMkzzpO0y32SZ2ACnFcE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717691348; c=relaxed/simple; bh=rSlArMrLfKQHTJRyHkwEgeykINTVTWlWE5nyU8Yg7BI=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=N7JJtpyXJe1EfMWFlQ3kDwqZll0xmKxPPAitlPGQXno5bhsyBbI4JGQJ/FuJlHLgaBVvtWElJ9xP+ownbF1mh/ZVTjrIOCZXsndLlsqnQto1+DGrjvMObHV0YfRJbz1vkE8wuMYzSee1EpTqTjxnGeC+lCyNA2UkjD+fgn/IAF0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=d5QgfRuC; arc=none smtp.client-ip=209.85.217.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-vs1-f48.google.com with SMTP id ada2fe7eead31-48bdbaab67aso370369137.2 for ; Thu, 06 Jun 2024 09:29:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717691345; x=1718296145; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=pcye0rJiyy34ptRIzGkdbWCJ6FryA9ij26/cfVA8Jh4=; b=d5QgfRuCrj7WX1ixxJB1KwMUxczIdtbW1Kb8SwoF/WVFOBMIFnOVL8lqgcZYZPsui+ flAWKPOf+xYwIA9Q+sYv7MeELe3zD/TpToxGNeMBNtQn2rZSNgLSn2g6sE9tYISdUMNJ BsnGYlaFzjsGGD5igY+IR0zf3PR2krcdwx6S32xQKBG/yo2E6q7RfqmF+stArZ6ek61l r5w70wFIPK+eFC0CyjJ1IycLEkERUSCj00QGvMa4cV13t2EtDcbfgOoTGnCyof8LxuTR r/qO1DoEgmLORplMDhetkkcvxRLV63aXG0TNAUFYYD72dIV2r0rqVrL2Xg384kv1sKoP 4O5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717691345; x=1718296145; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pcye0rJiyy34ptRIzGkdbWCJ6FryA9ij26/cfVA8Jh4=; b=PUHL630g9GyUCf97Fo2mVwIUumFkztgRO2Ie20HxWU+j4kfyj78+uII0Xqf43smseM uvNT081WPqNmz6hGw7VpYWv8kBlqo8vXjU8HNjU4Cobu5FxufC67MV+3LqFFNWUyS4d3 QAiDsrebIVrM/MppGkIx7O+0Dlx6LCquwOHLZoLCImdz0I2FM24B1O6DRw/a7f8nDh40 UBmXmsogv4209BXLiOfghw4lQlY2AtwFunnptww5zxA2zw3aYkkjryI71TVY44RcVasY 4jNm6Pk7MqDYoW8ktE6E0baxh41w1HdCCbPe4LKo+WYvSWro+xfl26pWm5uT+Z0JDq4B 21KA== X-Gm-Message-State: AOJu0YxwzVkd67mUVj66cpvxyHcTkqSmd5PGjK/P4uTvQUsg0vb7SiiH FBM8eyMjnKMoZYDbzjp4c8FnOMf2kwuGRmC6Y82zWUcni89/BBa8GtVOag== X-Received: by 2002:a67:e2d5:0:b0:48b:bcbc:fc3b with SMTP id ada2fe7eead31-48c04a86669mr4902282137.35.1717691345422; Thu, 06 Jun 2024 09:29:05 -0700 (PDT) Received: from lvondent-mobl4.. (syn-107-146-107-067.res.spectrum.com. [107.146.107.67]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-48c19f09735sm315126137.12.2024.06.06.09.29.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 09:29:04 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ v1] isotest: Fix ISO send data rate Date: Thu, 6 Jun 2024 12:29:03 -0400 Message-ID: <20240606162903.620906-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.45.1 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Luiz Augusto von Dentz We are sending data to controller at wrong average rate not equal to 1 packet / SDU interval, if Transport_Latency is not an integer multiple of SDU_Interval. The calculation currently may also give zero, so no data gets sent. --- tools/isotest.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/isotest.c b/tools/isotest.c index 68154b19caa4..c1bb6abd29aa 100644 --- a/tools/isotest.c +++ b/tools/isotest.c @@ -46,6 +46,7 @@ #define NSEC_USEC(_t) (_t / 1000L) #define SEC_USEC(_t) (_t * 1000000L) #define TS_USEC(_ts) (SEC_USEC((_ts)->tv_sec) + NSEC_USEC((_ts)->tv_nsec)) +#define ROUND_CLOSEST(_x, _y) (((_x) + (_y / 2)) / (_y)) #define DEFAULT_BIG_ID 0x01 #define DEFAULT_BIS_ID 0x01 @@ -834,7 +835,9 @@ static void do_send(int sk, int fd, char *peer, bool repeat) } /* num of packets = latency (ms) / interval (us) */ - num = (out->latency * 1000 / out->interval); + num = ROUND_CLOSEST(out->latency * 1000, out->interval); + if (!num) + num = 1; syslog(LOG_INFO, "Number of packets: %d", num); @@ -843,8 +846,7 @@ static void do_send(int sk, int fd, char *peer, bool repeat) * latency: * jitter buffer = 2 * (SDU * subevents) */ - sndbuf = 2 * ((out->latency * 1000 / out->interval) * - out->sdu); + sndbuf = 2 * (num * out->sdu); len = sizeof(sndbuf); if (setsockopt(sk, SOL_SOCKET, SO_SNDBUF, &sndbuf, len) < 0) { -- 2.45.1