Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp701884lqt; Thu, 6 Jun 2024 16:26:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXHsfZFHZYls9vuQy43jlQqpKUBwBoAOjH85kQmazSmitpPx17EisqQ88mSy5r36w9VkS5RVnG0J13GvmclCTK1eGzZUG1/Iw2iWfL7JA== X-Google-Smtp-Source: AGHT+IE8pZeu+DinnV6XkglRq687+YBx8AaRGK8s55kVk8Op8KgL5x4Lj7pKxUxnVuc4d3JDc+wW X-Received: by 2002:a17:906:a45:b0:a62:cf3b:77af with SMTP id a640c23a62f3a-a6cdaa0f8dcmr70665866b.52.1717716417799; Thu, 06 Jun 2024 16:26:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717716417; cv=pass; d=google.com; s=arc-20160816; b=liEp2vSrdES7FKPKym1KZKtmZOfOkYqyFMPFM/PpshWWJXq5M0A/FqAtZxI6O7iFA/ PnVyY9Kiy5UgQI8Pg+QKPNCZjwNhbUn3TN9eHQu+WxPyveD7tQJ7l0uFWv1vKuI7NWZ3 xs5L9CYeDlj3LGJOSeP67HlEaw9LqTGqC1dxxK9ffV69YFvlU9ObwN0bJwiDm4iSkEI0 1Et85ccdTQU3inEFX9sN1OO02ub45izaDKnasvsRbHQxHgFbLO/j/EVr3eAdPlIzY4Ic C7v0DFyy5fJBQqcZ94Eqn8TQlcaTX79b4FLRoAvyfb0mqj6V7dIFnb5SU4kuzx1wofk9 agVw== 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=qlsXn/H0SJmn47A68FQ+WUlPUcq83GF0Ogu/5yJuixs=; fh=Nedj/Vrt7g720fea/k+6nmkVAb0uLutxfpisOQ2NqiQ=; b=nKF4S/bEKth8u1WXmItrUF2k9z2B1LOUqGpstgFq+RUIfM/4CR2KPbBdC5wYysTxku ujsRtYjQeBkp7j3K+HBvlvAOZdkykB896q2h0XnXqyPo6Zwm6rX9Gnbadz6hwSrIRWpl ew7+M3cLJAFNFcUQBFDiRW0dl/CeRxt2CXugRdGDUkGu8K9URCWy6nNMB84AB52vzvfq qxqi9eTaigkiU1p+65Giv3H7/lGah2jqu8gior4LNO1L7NNfE7Tte8NWS5PCaUao3pwX N/XYnQS8eAIkclKhbiQKZOHkFiSLJ1a4L32iehdLFTgXtbKBQVEQdN+sTomzyjnp9/Ad +2Dg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tGEvQTPo; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-205153-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205153-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6c8058e68dsi114716666b.24.2024.06.06.16.26.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 16:26:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-205153-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tGEvQTPo; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-205153-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205153-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 84BD71F26349 for ; Thu, 6 Jun 2024 23:26:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 84D01145B1A; Thu, 6 Jun 2024 23:26:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tGEvQTPo" 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 8D02671B25; Thu, 6 Jun 2024 23:26:14 +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=1717716374; cv=none; b=qaRRP46Cvf7buSwKkf1JjkoqNY3ROEU44gddN4MloIz8ih19YAgGudKEOzRx9Cm2HFJeSEABWFbAJm2Bxo9hmpxaOKfAggqBad2xl8uYvrHcUaBIP/H2rVTEnifJK+Fo9C43NFwrSwA/DcQLck8qzpDkvsyS40Wp08LWmYPxIZI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717716374; c=relaxed/simple; bh=Suh6vh4De8t6noECYiiHMgjNhg4kfPCiUIe38Nj49cM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LOzuDoI7RLINLjy0pZ6MgLOQSoAGWwOOhh1xELDuu0n95Gwpp9ZiQNQ/RjilYdHsV36xWwEHoNRxNWSBUDTysCFVQFK1zv0wQFSkQEW34lwj8watuVPQXJ6wyv7fQ7jLpyUhQfqZT5ku1Yg5ENlD/i+bipjiGyCe9ERN5TsdI1E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tGEvQTPo; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id 2AE21C4AF0B; Thu, 6 Jun 2024 23:26:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717716374; bh=Suh6vh4De8t6noECYiiHMgjNhg4kfPCiUIe38Nj49cM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=tGEvQTPoLV6gWNn1aKKeJevVNz87ihB9WYyQPbCloAsCd/Yi6mTYkzPvgZBcjMv1K mkUruXaSCdZry4cnDIYkFSujYfWu4BOVbiz8qL/ha25LrUSVGGTw3f6g0/5+D0CBvI er9aAQcLLgXrfIioXm0sfRJ+UAe62D7o1v/FMGr3fV1O45QrHeOccj5x2mLCnaNw8U TVAgMUAu1/2o6Rc5G/k4uEa7VXkv8XoInip4CHvZXZfD7JY7QY+9PLog+qVm1Ilu5d arsRlyo0wvpKmdGOfNTmgIU4wq6s+QAP4F75KD3LlYBQpNJxcaECf1krsNSzjRlMcB G+oCpZDnWV9Hw== 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 135F5C27C5E; Thu, 6 Jun 2024 23:26:14 +0000 (UTC) From: Dmitry Safonov via B4 Relay Date: Fri, 07 Jun 2024 00:25:56 +0100 Subject: [PATCH net-next v4 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: <20240607-tcp_ao-tracepoints-v4-2-88dc245c1f39@gmail.com> References: <20240607-tcp_ao-tracepoints-v4-0-88dc245c1f39@gmail.com> In-Reply-To: <20240607-tcp_ao-tracepoints-v4-0-88dc245c1f39@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=1717716372; l=1277; i=0x7f454c46@gmail.com; s=20240410; h=from:subject:message-id; bh=8zWgzne0He/W4ZZY8QmdH5dUQ9sOzaX2Zm9ECgB6gSs=; b=gFzS11h+sf3CTMo5EpzoNFS1QqejFHgMpocvav2A9GSNoVQyR2NEZ4YwuvWVHsUEEQZXItSUVXcJ oart4dY2C8lHNuQ54A2TS5PWolgQTOTp7jcIgmAmzAphEjwE2B3+ 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. Reviewed-by: Eric Dumazet 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 5d8e9ed2c005..198e02004ad2 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 37c42b63ff99..50ae43c92829 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