Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp700316lqp; Fri, 5 Apr 2024 06:30:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUH+VrhiNtRpddNWPpq1608km107QvseKiHoVArzZZgX6Ne6kzRDkT2PaKY3coI5o+3owo8HdixNcDN1ljt+Dz8EkACbvLBi9O5GoQbug== X-Google-Smtp-Source: AGHT+IF9q0r6nPXan5P+h18oNYVgshIGhmUn6EArBkcRV2j/9M+fy/qedn0fCqEBm5tRYw4gcC3O X-Received: by 2002:a17:902:e552:b0:1e0:e14:b19d with SMTP id n18-20020a170902e55200b001e00e14b19dmr1959908plf.18.1712323818280; Fri, 05 Apr 2024 06:30:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712323818; cv=pass; d=google.com; s=arc-20160816; b=FUZuHgdINNXHGUaZ/7x+Mx40r/aD/JRWlKTcwQxeG8Va1p8JoLxbIt9bLDeWVNxNX7 G/bUKbnnoRezdiyZdZeJZUgwSf1RBoEdGoWKaANmPWE9zvvMkmf/Bn2PoBt6zCCxJQbL yVAJSXmmJ2AZ5CM38skxjum5KxSqH6Xi5oANsTRbHCg8qcmFEpK03WOOfW9+MPhnjEdZ yzufeqMPMp2ighKe9oWmCFo/AevsLVAlJzP3AP3EWRNPMq2JpC7znbdHcBkz4FeEIp1X AVcdQQ5nY1LcJiInv7ej/kvQtn6ve82a+wVGlrvyF4to1dL6q8V57mF5Abzj9NnOvIcQ 6YYA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=udhYzo9d/0PPqGVdd4D3LGjxi+bDzO7RIJlIIFERmQE=; fh=tNcO38dmKVPcS+nrLwZ+syzUzy4fDofAWQH9RZuEQB4=; b=fYOaljYj1nQCYQUUBDRSNt22DOr0QpbaN7FDkBKknvJgrAOSTPAUNg1Z/duxBK57Td ZeUAFhZe/bdjQC5ywkjpqHisdkG756cLu3rONf6+oHOoppQnVdKQui+Ha73mo4RpTc8A gGPyKct/EEiPOi73zYH3ce7KZrd3WJMwpS0oJKMe62hd63WtObdRZhZxKxBgLp3aPoMp hr+/6CZOs+YZXqopHK5fgyVcJdgHFvYQUmH0x+0GINTkqY2nSl3NrqcjKS9LLih2Q+4k ybejgoDlDVCgfOVxceW2SIoioQlJjX9osz/jHy96QopSaQhvjxA+BKTGpc6bVwUSP6hU U7wA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=h0dpdXlM; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-133064-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-133064-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id u1-20020a1709026e0100b001e2881eed3fsi1337908plk.138.2024.04.05.06.30.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 06:30:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-133064-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=h0dpdXlM; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-133064-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-133064-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 D0B89286B55 for ; Fri, 5 Apr 2024 13:30:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5692C16D4FD; Fri, 5 Apr 2024 13:30:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="h0dpdXlM" Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (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 B27E816D4E1 for ; Fri, 5 Apr 2024 13:30:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712323808; cv=none; b=sNwnOS3iiAG+ORekoz9WW9tmQ6M0/isgrWaAbgeui3cxVCDB7Pf92MSvfYrMZHtIjEqhkzFp+DjtCQmAA57LYYOAw7gtItVV0Sr43utmqisfSmHdkYUGnG9n/izjhJxdYrALKRlhLadOURZAMowX3WQudNprqOHIIvNTWxG87UA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712323808; c=relaxed/simple; bh=wSswXutQJ+wCZIDOdh13zZfPNpNOZaTJPxJxnSQYIrs=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=ntnYOs50vyB6uQ6VsRDocC9dcD20tzRCubiBYakuV0JwGcmuVbbmevpRiZPUvrkhKJxxZBmpt5EhgDkMc6GCd80+UKJC0dNPrwsIAxbYyW/foRx/VILCGUpu/g57VHr0oSKoUVB1sgU1+s5/Y0h8I8M53tBAve4PtBIWgQEDz74= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=h0dpdXlM; arc=none smtp.client-ip=209.85.208.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-56e0430f714so10435a12.1 for ; Fri, 05 Apr 2024 06:30:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712323805; x=1712928605; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=udhYzo9d/0PPqGVdd4D3LGjxi+bDzO7RIJlIIFERmQE=; b=h0dpdXlMP0f9BdNCgI3z2niKFXY9IYX0Nco1p7nyhoLd2RFtzrVsqFiIjztlGdKcx7 wcyCekVug7fXUGKUXGx5ORzxP1flB2jj7auYgifZZ5v5fInbkVYHYRKdln0OP6jYD3pi Xrv6ggpi8FVSsputPRghJWQWJ4s4eEaDTdjH+Rlq4RVRJIs/Rx5AlZgSVKEi3h9MbmGa gQtPAikTtw1tQDjJxSxH/JL0aOakrB+KFbmYjCdKmLPE1EyobbmSLJnyMPbrkoTqX5k1 CUjKDAqTaF/mn3kknxmnVsUo4HaIa30jD9yu2vX5fUmOMLvVRCtdIOHp7FG2/lBbYGJN ORxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712323805; x=1712928605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=udhYzo9d/0PPqGVdd4D3LGjxi+bDzO7RIJlIIFERmQE=; b=r7nFC/3jwrA9yK67mSOeguqla57x3oxlppigQJEoRbjl97sJqefl/jkI0wsvvyiDDX 7kP7RMDMHbtSEKHSh5HS2wqNqS2dXy/JsYMnLYAwUkaQRxbrnfH+6VDZHsOmGh1XiBZq 140qNyip1UAdn7c+4sakATy8G1c0NIPA/j0TBGoCgorkvUjxS7lWqcVKAyjkaHBfSpLo AlHEg0xFzQ/pna6wmgQRg9XrBCxk8li0hJVttzwNvaSOs95XKS+BP4276nAGlBiUfRVy 8EZfoEXsPPOVE2pgoFPprH75cMzLbuaHdrP43lM85BDAPf8YrXS3GjhZ+HepfZmqBD4d Vl4w== X-Forwarded-Encrypted: i=1; AJvYcCW2OBjxSagFIJta1Hrx1EA5ivBZAWbUgmrEzHVXV9KKIaNU2FicZHQIWxuFR4hd/U8BHg5IA+zfvghbV6KuAkxoYCX31jhJd9KUfjLW X-Gm-Message-State: AOJu0Ywoi8v9VxusSRfgyyhwAkcYdttPU+un0N4qAhHGPP+IB103Px0F xNi9HL4G1S9qGxQI38eLxOVYgymIMFiBfqfXyZMy+7if1Wxyv81pwwpItaxsUqil580C4kwitx6 zg1mwyXyGbKIoIA+I0ADvKyCHJULjTTn7CBX4 X-Received: by 2002:a05:6402:26c4:b0:56e:22b4:fa72 with SMTP id x4-20020a05640226c400b0056e22b4fa72mr347542edd.3.1712323804808; Fri, 05 Apr 2024 06:30:04 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240405-upstream-net-next-20240405-mptcp-last-time-info-v1-0-52dc49453649@kernel.org> <20240405-upstream-net-next-20240405-mptcp-last-time-info-v1-1-52dc49453649@kernel.org> In-Reply-To: <20240405-upstream-net-next-20240405-mptcp-last-time-info-v1-1-52dc49453649@kernel.org> From: Eric Dumazet Date: Fri, 5 Apr 2024 15:29:53 +0200 Message-ID: Subject: Re: [PATCH net-next 1/2] mptcp: add last time fields in mptcp_info To: "Matthieu Baerts (NGI0)" Cc: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Shuah Khan , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Geliang Tang Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Apr 5, 2024 at 3:06=E2=80=AFPM Matthieu Baerts (NGI0) wrote: > > From: Geliang Tang > > This patch adds "last time" fields last_data_sent, last_data_recv and > last_ack_recv in struct mptcp_sock to record the last time data_sent, > data_recv and ack_recv happened. They all are initialized as > tcp_jiffies32 in __mptcp_init_sock(), and updated as tcp_jiffies32 too > when data is sent in __subflow_push_pending(), data is received in > __mptcp_move_skbs_from_subflow(), and ack is received in ack_update_msk()= . > > Similar to tcpi_last_data_sent, tcpi_last_data_recv and tcpi_last_ack_rec= v > exposed with TCP, this patch exposes the last time "an action happened" f= or > MPTCP in mptcp_info, named mptcpi_last_data_sent, mptcpi_last_data_recv a= nd > mptcpi_last_ack_recv, calculated in mptcp_diag_fill_info() as the time > deltas between now and the newly added last time fields in mptcp_sock. > > Also add three reserved bytes in struct mptcp_info not to have holes in > this structure exposed to userspace. > > Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/446 > Signed-off-by: Geliang Tang > Reviewed-by: Mat Martineau > Signed-off-by: Matthieu Baerts (NGI0) > --- > include/uapi/linux/mptcp.h | 4 ++++ > diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c > index 73fdf423de44..2ec2fdf9f4af 100644 > --- a/net/mptcp/sockopt.c > +++ b/net/mptcp/sockopt.c > @@ -896,6 +896,7 @@ static int mptcp_getsockopt_first_sf_only(struct mptc= p_sock *msk, int level, int > void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *inf= o) > { > struct sock *sk =3D (struct sock *)msk; > + u32 now =3D tcp_jiffies32; > u32 flags =3D 0; > bool slow; > > @@ -930,6 +931,7 @@ void mptcp_diag_fill_info(struct mptcp_sock *msk, str= uct mptcp_info *info) > info->mptcpi_snd_una =3D msk->snd_una; > info->mptcpi_rcv_nxt =3D msk->ack_seq; > info->mptcpi_bytes_acked =3D msk->bytes_acked; > + info->mptcpi_last_ack_recv =3D jiffies_to_msecs(now - msk->last_a= ck_recv); > mptcp_data_unlock(sk); > > slow =3D lock_sock_fast(sk); lock_sock_fast(sk) can sleep and be quite slow... I suggest you reload now =3D jiffies32; > @@ -942,6 +944,8 @@ void mptcp_diag_fill_info(struct mptcp_sock *msk, str= uct mptcp_info *info) > info->mptcpi_bytes_retrans =3D msk->bytes_retrans; > info->mptcpi_subflows_total =3D info->mptcpi_subflows + > __mptcp_has_initial_subflow(msk); > + info->mptcpi_last_data_sent =3D jiffies_to_msecs(now - msk->last_= data_sent); > + info->mptcpi_last_data_recv =3D jiffies_to_msecs(now - msk->last_= data_recv); > unlock_sock_fast(sk, slow); > } > EXPORT_SYMBOL_GPL(mptcp_diag_fill_info); > > -- > 2.43.0 >