Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp24185lqr; Tue, 4 Jun 2024 19:21:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUNalzH0W3Kco7zu16RHB0Kfc97NL1oZPabxyPHFH5AqVRVgyA7li/gxZwgQe0jvoLNvXIOasAa0x9vLVBqdVtth61Ps+mDndzRAxjIFg== X-Google-Smtp-Source: AGHT+IE7FqpQQS15nvLQX6QrZ217YufBmbNs9dsbr5tXfW7osp6mU3A1k1qZYV/YuOIuuNyJE5Co X-Received: by 2002:a05:6830:314f:b0:6f0:e4ee:51c with SMTP id 46e09a7af769-6f94345d16amr1434721a34.21.1717554069723; Tue, 04 Jun 2024 19:21:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717554069; cv=pass; d=google.com; s=arc-20160816; b=Zmgj2lY34EFXzl3k6weAvc0yVyUeaPYVezE9zfMm9NRdhOMoTjZ34g0E5lBMdf3t08 o/SBdXgPnaKzCGvDcyNnCDUMDfn5Uq+w9p90EgB2w0N8WryrYEmik50JKVGhHiWsh5jC Ow8ZnoEtjDbVdIo2DCSIEN995WPa0UXBgCd8u7vaco0sIZyyTOJzA12sQSlchjyoedRv yuMQf+pqCrtM+1tc/l6hBXzCafyuwACkeeW1JEinFZ1DNF42P5pz3fSNpKf8oNVLsvIs o63TcaiLJpGGzRhCFGzfyTlrFdqiUYw/caeK8/5KhEgeXJa6fji9L1hNv+ju5QkW2KL8 gtpw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=reply-to:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:date:from:dkim-signature; bh=6+xAC73j1CM4YxjLJWY8wPWBl15uqloFE0GtKuQ3ED4=; fh=Nedj/Vrt7g720fea/k+6nmkVAb0uLutxfpisOQ2NqiQ=; b=eRsqI5TU79GPGwiE4vBN5hpXlOkUSekgCQdqnj+s2lOs6MeDUn35lAxlYifTrz+Q1G kDYNHP9Bw769mnbOYg+u4N9ma+GHlxVHV/D6t8PnNZBadvDzfH5fLPCeypSpCPrHCo8w mVEewdefM7iW+MuSvNR79vO0BKBUKN3+fimp9n7zTCrxtR7ui2AnUYZArs/hQ9n/7cOR Gi24ZFB9MB6A+Z2eMeKmA2Uj+haj1RSwOxuWTyROYWGIRftDE4HwUjZ+DPwNoGV3YhtL dz6KDbTs/2yiVqqIWT6+Ak9i0wIGIlJ+igPkLn4N2iULruoP9jWrXPFvd6kU3g8Xndl2 eJHw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=n3faQiGw; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-201679-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201679-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43ff23ae92esi41296181cf.81.2024.06.04.19.21.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 19:21:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201679-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=n3faQiGw; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-201679-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201679-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 72CDF1C23216 for ; Wed, 5 Jun 2024 02:21:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 114877CF33; Wed, 5 Jun 2024 02:20:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="n3faQiGw" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2136E2AE75; Wed, 5 Jun 2024 02:20:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717554032; cv=none; b=kfwJjn+32IinvQ64Lm7zXvvAe9KdCa0F0zlFrZAzUmbcqcq2NGtwho7pEheG0FMCQw3k5wahAM0RMUpPABLDmbA9iaJYsyKJSXZsRjehOm2GwzoKC/6nQw+ztMNIE5k3RGLTCl8wuKiQpLRI5IWq4GQuvM7iTJrMB3SqclFPlbQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717554032; c=relaxed/simple; bh=m1ODjAZVIal9y8K9wO0qbhWp8y4HHguHQ1q4lW0dScU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=T8qm7c5pspmskBB0306WvtnvX+FrWRjxgQH8+WK3Wo0PUwVCJpJkYkoutC0ZNDkzZHLKpxLd1ljNtBadcCezQcksvZxNKs+HWcXipHSmb3qM6JqDey/Mh0dcoLgXiCvepiGzcss5ufAF1dnPT713N8yn1onpulYRcy7YC9WXzbU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=n3faQiGw; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id B081CC32782; Wed, 5 Jun 2024 02:20:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717554031; bh=m1ODjAZVIal9y8K9wO0qbhWp8y4HHguHQ1q4lW0dScU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=n3faQiGwgBW/++s6SMprvsUfOdVMYwc/ZAuQ5oMO5TKxNnmV3PGuM6Dd1nofOA+VR o9IBkYTQ21HGzfKm/yIjt79MSDcXaF3/bO1wROzNlkoYWgbk2NYm9z6UdZmgSsFpb+ vwfOSD0+IIvMtxI3H3CnnXXgjAEDIZ5q7ZP8yCanOF8V9lnXM+aOE/tahuZkTZedC7 0amDLozA2JpA+92yA1W9NcqVXCc4kz8i9ZO55Dyn+lV3PttecroOL1Fvf7zqo8nUsZ Zny+XyEJgDrkJWmRQTalJfT4c77JxQS9CYgY1DpmTBRBiCncqBF15nf2i1Xan9R/mm mRbluyojS31GQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EF1AC27C55; Wed, 5 Jun 2024 02:20:31 +0000 (UTC) From: Dmitry Safonov via B4 Relay Date: Wed, 05 Jun 2024 03:20:03 +0100 Subject: [PATCH net-next v2 2/6] net/tcp: Add a helper tcp_ao_hdr_maclen() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240605-tcp_ao-tracepoints-v2-2-e91e161282ef@gmail.com> References: <20240605-tcp_ao-tracepoints-v2-0-e91e161282ef@gmail.com> In-Reply-To: <20240605-tcp_ao-tracepoints-v2-0-e91e161282ef@gmail.com> To: Eric Dumazet , "David S. Miller" , Jakub Kicinski , Paolo Abeni , David Ahern , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Jonathan Corbet Cc: Mohammad Nassiri , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Dmitry Safonov <0x7f454c46@gmail.com> X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1717554029; l=1228; i=0x7f454c46@gmail.com; s=20240410; h=from:subject:message-id; bh=3r0GUti1sbRL2DmiJwhtJuQ4wZfREpceQasirqqFZEo=; b=MEGR6XCVzVRWO/uGY5lE2aO868zcFl5U76lbEK0RzyZW3Ds+SdZ8SO9E1SK8p+ck86QnEfIv1JSp 6oENjJQOAZIOsCK5WtyCVIf3NGYWHwz9qU3i43r2ztS/0lUlSzxz X-Developer-Key: i=0x7f454c46@gmail.com; a=ed25519; pk=cFSWovqtkx0HrT5O9jFCEC/Cef4DY8a2FPeqP4THeZQ= X-Endpoint-Received: by B4 Relay for 0x7f454c46@gmail.com/20240410 with auth_id=152 X-Original-From: Dmitry Safonov <0x7f454c46@gmail.com> Reply-To: 0x7f454c46@gmail.com From: Dmitry Safonov <0x7f454c46@gmail.com> It's going to be used more in TCP-AO tracepoints. Signed-off-by: Dmitry Safonov <0x7f454c46@gmail.com> --- include/net/tcp_ao.h | 5 +++++ net/ipv4/tcp_ao.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/net/tcp_ao.h b/include/net/tcp_ao.h index 471e177362b4..6501ed1dfa1e 100644 --- a/include/net/tcp_ao.h +++ b/include/net/tcp_ao.h @@ -19,6 +19,11 @@ struct tcp_ao_hdr { u8 rnext_keyid; }; +static inline u8 tcp_ao_hdr_maclen(const struct tcp_ao_hdr *aoh) +{ + return aoh->length - sizeof(struct tcp_ao_hdr); +} + struct tcp_ao_counters { atomic64_t pkt_good; atomic64_t pkt_bad; diff --git a/net/ipv4/tcp_ao.c b/net/ipv4/tcp_ao.c index 781b67a52571..7c9e90e531e3 100644 --- a/net/ipv4/tcp_ao.c +++ b/net/ipv4/tcp_ao.c @@ -884,8 +884,8 @@ tcp_ao_verify_hash(const struct sock *sk, const struct sk_buff *skb, const struct tcp_ao_hdr *aoh, struct tcp_ao_key *key, u8 *traffic_key, u8 *phash, u32 sne, int l3index) { - u8 maclen = aoh->length - sizeof(struct tcp_ao_hdr); const struct tcphdr *th = tcp_hdr(skb); + u8 maclen = tcp_ao_hdr_maclen(aoh); void *hash_buf = NULL; if (maclen != tcp_ao_maclen(key)) { -- 2.42.0