From nobody Fri Dec 19 18:46:10 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4531D1426C for ; Mon, 22 May 2023 13:56:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684763815; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mi6SkL+VFXAxLhRY/iwA6moEYBCJ64Xp3XKn3aOVv34=; b=UegI2WhxvvmwuHj2Lkf+iYTl1hKOHPZoaenFvX2VoQqO7Y/s9l2VwlGsrz0MXQTVhBYbz8 2mqPARp9xhcWiadPcn3nmovvOgXzHeCvf9HgISzdMesVSoDFEazTj4hRAKQVgLNxqwpk/N gaBzJgL8RVpu4WRc+YZDHQ3Xq1zrU1E= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-673-kKycMA_KON2M23lk-mEvdA-1; Mon, 22 May 2023 09:56:53 -0400 X-MC-Unique: kKycMA_KON2M23lk-mEvdA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 535371C08DA8 for ; Mon, 22 May 2023 13:56:53 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.194.191]) by smtp.corp.redhat.com (Postfix) with ESMTP id CD653492B0B for ; Mon, 22 May 2023 13:56:52 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH mptcp-next v2 5/6] selftests: mptcp: explicitly tests aggregate counters Date: Mon, 22 May 2023 15:56:31 +0200 Message-Id: <7e32265ebe2ed650df1373c3774656c1b62f04d4.1684763197.git.pabeni@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8"; x-default="true" Update the existing sockopt test-case to do some some basic checks on the newly added counters. Signed-off-by: Paolo Abeni --- .../selftests/net/mptcp/mptcp_sockopt.c | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c b/tools/test= ing/selftests/net/mptcp/mptcp_sockopt.c index ae61f39556ca..869c041c34f3 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c +++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c @@ -51,6 +51,11 @@ struct mptcp_info { __u8 mptcpi_local_addr_used; __u8 mptcpi_local_addr_max; __u8 mptcpi_csum_enabled; + __u32 mptcpi_retransmits; + __u64 mptcpi_bytes_retrans; + __u64 mptcpi_bytes_sent; + __u64 mptcpi_bytes_received; + __u64 mptcpi_bytes_acked; }; =20 struct mptcp_subflow_data { @@ -83,8 +88,10 @@ struct mptcp_subflow_addrs { =20 struct so_state { struct mptcp_info mi; + struct mptcp_info last_sample; uint64_t mptcpi_rcv_delta; uint64_t tcpi_rcv_delta; + bool pkt_stats_avail; }; =20 static void die_perror(const char *msg) @@ -320,6 +327,9 @@ static void do_getsockopt_mptcp_info(struct so_state *s= , int fd, size_t w) =20 assert(olen =3D=3D sizeof(i)); =20 + s->pkt_stats_avail =3D olen =3D=3D sizeof(i); + + s->last_sample =3D i; if (s->mi.mptcpi_write_seq =3D=3D 0) s->mi =3D i; =20 @@ -556,6 +566,23 @@ static void process_one_client(int fd, int pipefd) do_getsockopts(&s, fd, ret, ret2); if (s.mptcpi_rcv_delta !=3D (uint64_t)ret + 1) xerror("mptcpi_rcv_delta %" PRIu64 ", expect %" PRIu64, s.mptcpi_rcv_del= ta, ret + 1, s.mptcpi_rcv_delta - ret); + + /* be nice when running on top of older kernel */ + if (s.pkt_stats_avail) { + if (s.last_sample.mptcpi_bytes_sent !=3D ret2) + xerror("mptcpi_bytes_sent %" PRIu64 ", expect %" PRIu64, + s.last_sample.mptcpi_bytes_sent, ret2, + s.last_sample.mptcpi_bytes_sent - ret2); + if (s.last_sample.mptcpi_bytes_received !=3D ret) + xerror("mptcpi_bytes_received %" PRIu64 ", expect %" PRIu64, + s.last_sample.mptcpi_bytes_received, ret, + s.last_sample.mptcpi_bytes_received - ret); + if (s.last_sample.mptcpi_bytes_acked !=3D ret) + xerror("mptcpi_bytes_acked %" PRIu64 ", expect %" PRIu64, + s.last_sample.mptcpi_bytes_acked, ret2, + s.last_sample.mptcpi_bytes_acked - ret2); + } + close(fd); } =20 --=20 2.40.1