Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4787137rdh; Wed, 29 Nov 2023 10:34:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IGljzKhA2/5D61w6HXd8nnlkV7jY7CbXCtIndAfyZ1HnQMBQThPFhsfO+yZ90pKAdOpGeN4 X-Received: by 2002:a17:903:183:b0:1cf:55dd:9a0e with SMTP id z3-20020a170903018300b001cf55dd9a0emr22405800plg.15.1701282877584; Wed, 29 Nov 2023 10:34:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701282877; cv=none; d=google.com; s=arc-20160816; b=KpjdIz7NiVpX1OtgzJBbxAjgWyHDBaoYRfVcy+rJtZIt80qP5oNXoq7XMmMovNbdmn gHeXgH+olctHVSnrGV1m8MNX+xWPx1thoO4yq3+ZOCZ9RE+33xNNrL7fNKWfP83do6HV QIXzA3d4PTQqRGs/N9/4QcNg3xAL/W/iHBmfukGuXZa3ecFoocYem0h+xTXVwqWo99j0 2y4Mhec+QLUqLhgTQrdTE1OjH48u7v+pGEBYYugRHFQEpzKkYNgxcFOQf9aeqomg79Q6 2ZsCM2bymVI8rn6H8rsV6MCrDQIT1RR5bMOvoEQsP/6OzJZ0zeD5tM+wzS2M1WKymu5n UwFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=oj8iW5fqpjz7flGK5b84ePxv8TYliajWJz8n3Jo6wQE=; fh=X1lxrGLA7V3PBg9NtHG1M9vtBdBLI2mDk4lzNRfgcS0=; b=jrZodmMCrvpZQij4LJMbRGB/o/Sir84DxY5XLN/QkiTJHzkRUpxx+mTsgrnPExgc6v atQRBg9+u3Kf2zbhSx13gJbBwrk8RjR8EFtHNIobCQxfzlB/zSXdmvk0ZsVEfU3e5TIt cjry01tj/UchsbXkySuZ+5TLpyZrk2ZD2rUvX7bHx0utHz/jjB9sude/XaE8DOTJG/H8 KF9ekXcDJYaAmUd+Y8puSLbXaXopUfgQaTYtV8rxoL+pNhMTt6dPTGOslpiMyPcRVw9n tlj0bdLEKuexDe7Jv0c44udUwA6PL1T9wiJ4riBfLMjfVW9H5KwL3RK7ZB9SbxDYL/MR qhqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=t4VVgDLH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id c12-20020a170902c1cc00b001cfb7ef2badsi9348244plc.155.2023.11.29.10.34.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 10:34:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=t4VVgDLH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 180CD8072825; Wed, 29 Nov 2023 10:34:35 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230317AbjK2SeT (ORCPT + 99 others); Wed, 29 Nov 2023 13:34:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229741AbjK2SeS (ORCPT ); Wed, 29 Nov 2023 13:34:18 -0500 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFC6D122 for ; Wed, 29 Nov 2023 10:34:23 -0800 (PST) Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-548c6efc020so1387a12.0 for ; Wed, 29 Nov 2023 10:34:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701282862; x=1701887662; 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=oj8iW5fqpjz7flGK5b84ePxv8TYliajWJz8n3Jo6wQE=; b=t4VVgDLHJX3o2FaVZSBkf7xupe2fmCu0VY8eIM+aUhfpD2ddGdzmzfZTgU0TO624lD wORTvHvy+iIVWgEXWruaeAen+aYjaXrUf7BSilg8SwN+KxRxuOVSOzYZ70PGYk05/k2h +NVDJHz2FCs4yXw5NfuWa6mPeafM4hYnbDbEiG4MrcpY6+BPkETiJpb6V5M7XdC6B0SH 6A1QlPcY/VqBtLOZqdcf+RHsB0D/qu+U8DL+hS2sD5ezXTbTCGuBJ9JPq/VJVmHLgRoP NUy2o5+K8OTlQOKazZ0Y1v5kmJG0ljTHaCC9uVaogrvOjssfrpd9VuDm5eFbdCadrOCr VLKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701282862; x=1701887662; 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=oj8iW5fqpjz7flGK5b84ePxv8TYliajWJz8n3Jo6wQE=; b=ikjxMR9MGhH0hXjCrPkZ4q03Qn867jXqXdz0faJk5/PolLmwy6DBTlbOERNYOdB7gu OWYFkLbNpx/UtcLKJ/U3OsykJ/SzcoE48sfArgDTDZmXAvm+evZkY55oxa91CN29WIq/ sw9PUxIpkHvFx6l9kSphgduunXzQkK0Tlpm6gcKq08tJU/dsYbrcP+Q6tfqVoVsyi3TN eaxS6eEsSdvoIJOsraDrfFIPjK2jmSI3hlkAyxj9CxrBbt152WPL8nwUIU/WAfCFUUw9 A6hkqoSWJBsmnnIGAY2UgBboMw9zUquHmCE0Ix8LCQpq2QkGqQrk4NlL+eeiTQIcIzhQ wHsg== X-Gm-Message-State: AOJu0YwDSwpf+OzTaJ3hw59LPJHaFiwaeH963re3J1I81weMxTsLhm/d pFSo9H0r51Y4HALhfRQH4vX73l/khrwb3KpLXc0zxw== X-Received: by 2002:a05:6402:1cae:b0:54b:81ba:93b2 with SMTP id cz14-20020a0564021cae00b0054b81ba93b2mr386edb.2.1701282861955; Wed, 29 Nov 2023 10:34:21 -0800 (PST) MIME-Version: 1.0 References: <20231129165721.337302-1-dima@arista.com> <20231129165721.337302-7-dima@arista.com> In-Reply-To: From: Eric Dumazet Date: Wed, 29 Nov 2023 19:34:07 +0100 Message-ID: Subject: Re: [PATCH v4 6/7] net/tcp: Store SNEs + SEQs on ao_info To: Dmitry Safonov Cc: David Ahern , Paolo Abeni , Jakub Kicinski , "David S. Miller" , linux-kernel@vger.kernel.org, Dmitry Safonov <0x7f454c46@gmail.com>, Francesco Ruggeri , Salam Noureddine , Simon Horman , netdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 29 Nov 2023 10:34:35 -0800 (PST) On Wed, Nov 29, 2023 at 7:14=E2=80=AFPM Dmitry Safonov wr= ote: > > On 11/29/23 18:09, Eric Dumazet wrote: > > On Wed, Nov 29, 2023 at 5:57=E2=80=AFPM Dmitry Safonov wrote: > >> > >> RFC 5925 (6.2): > >>> TCP-AO emulates a 64-bit sequence number space by inferring when to > >>> increment the high-order 32-bit portion (the SNE) based on > >>> transitions in the low-order portion (the TCP sequence number). > >> > >> snd_sne and rcv_sne are the upper 4 bytes of extended SEQ number. > >> Unfortunately, reading two 4-bytes pointers can't be performed > >> atomically (without synchronization). > >> > >> In order to avoid locks on TCP fastpath, let's just double-account for > >> SEQ changes: snd_una/rcv_nxt will be lower 4 bytes of snd_sne/rcv_sne. > >> > > > > This will not work on 32bit kernels ? > > Yeah, unsure if there's someone who wants to run BGP on 32bit box, so at > this moment it's already limited: > > config TCP_AO > bool "TCP: Authentication Option (RFC5925)" > select CRYPTO > select TCP_SIGPOOL > depends on 64BIT && IPV6 !=3D m # seq-number extension needs WRIT= E_ONCE(u64) > Oh well, this seems quite strange to have such a limitation. > Probably, if there will be a person who is interested in this, it can > get a spinlock for !CONFIG_64BIT. > > > Unless ao->snd_sne and ao->rcv_sneare only read/written under the > > socket lock (and in this case no READ_ONCE()/WRITE_ONCE() should be > > necessary) > You have not commented on where these are read without the socket lock held= ? tcp_ao_get_repair() can lock the socket. In TW state, I guess these values can not be changed ? I think you can remove all these READ_ONCE()/WRITE_ONCE() which are not nee= ded, or please add a comment if they really are. Then, you might be able to remove the 64BIT dependency ...