From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B65DFA0509; Tue, 5 Apr 2022 22:16:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 61EE340F35; Tue, 5 Apr 2022 22:16:20 +0200 (CEST) Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by mails.dpdk.org (Postfix) with ESMTP id 05B1340DF6 for ; Tue, 5 Apr 2022 22:16:18 +0200 (CEST) Received: by mail-pf1-f169.google.com with SMTP id bo5so508911pfb.4 for ; Tue, 05 Apr 2022 13:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yj92WfKWRbd4kJrE3m0rhL+SCvA9IPzbwNE49sW2Anc=; b=hDG2rZEB3yW2B/SAcPOfU69YQ9wgvdKF+r8vbwaaTDraxqhE0KS8eXL6u07saicuhn Wc0VMItN6tq9rNwq6Mch91Z4r1aA6epwoI0z86JUiWBZI2fqH1+fWNZ2ErPnLQx0nAHS 5L/56bvfQbovUdhfUPw7pwsBfrbPCmFxFb5hcNvnJSzmcsWUOTR9u0IFI6KhXIf+CYRN lcYCDO3mLJwwovX8ck/EIOs/iFTJj4qhpcmLFnhxspXlwGNObe63/erfXm2XmAfqgzEd iP1pyGjzD1mG3wKTECRvhE8gj1tl4cTV0Gy4bDYsXpoctHGNi1IYrUOBBKOk+nBJtB4/ NWNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yj92WfKWRbd4kJrE3m0rhL+SCvA9IPzbwNE49sW2Anc=; b=q1AVZ8Jg56qECJBxs4hHnK/22uRT52fkTggCjpVePxu400W1CfpLLq9Gr+d1x6s2jk xGCJxatFtmddTxC6+JHjeRGIHQ9Drm+LSccAhrTYCC/it40yFW4XfefevYGZL5+fGP9S ppZSPd27M3qUoYT1y4e69HauKC2/57oC6/lSwZRMR4kwnN/Q5+QF5cnSFIrGbW4Hw8/J 0t9gzElfyb0MLpeNnN+ha8yX5ubPCVoxM51uGuX2cyYu9EGK/YsbGUsEliRYataK1Pcg 9wO4j8e6/376PjXvGCsLVy8q0BzH85DasRLL0RvhkNePAQxyKh9NA1kTIcb/1RVaRmAh CjZw== X-Gm-Message-State: AOAM532sWwr2VLRFfQhVV/dskwx4qIuk8T4il0MBNC9JRS97s138Obwj uZFi5j6jPPaeHhLanjbqokuJpQ== X-Google-Smtp-Source: ABdhPJywC8PYJhcgRcGXK8JIRVTHhy8SEKJUSpmjMRu1kPY9bSbXa7Q7/QqmRsTCaGuBBt5gO6A4aQ== X-Received: by 2002:a63:77ca:0:b0:386:25a5:5ed with SMTP id s193-20020a6377ca000000b0038625a505edmr4253763pgc.30.1649189778132; Tue, 05 Apr 2022 13:16:18 -0700 (PDT) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id i187-20020a62c1c4000000b004faafada2ffsm17103273pfg.204.2022.04.05.13.16.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 13:16:17 -0700 (PDT) Date: Tue, 5 Apr 2022 13:16:14 -0700 From: Stephen Hemminger To: Mattias =?UTF-8?B?UsO2bm5ibG9t?= Cc: , Thomas Monjalon , David Marchand , , , , , , "Ola Liljedahl" Subject: Re: [PATCH v2] eal: add seqlock Message-ID: <20220405131614.4e691adc@hermes.local> In-Reply-To: <20220330142602.108061-1-mattias.ronnblom@ericsson.com> References: <98CBD80474FA8B44BF855DF32C47DC35D86F84@smartserver.smartshare.dk> <20220330142602.108061-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Wed, 30 Mar 2022 16:26:02 +0200 Mattias R=C3=B6nnblom wrote: > +/** > + * A static seqlock initializer. > + */ > +#define RTE_SEQLOCK_INITIALIZER { 0, RTE_SPINLOCK_INITIALIZER } Used named field initializers here please. > +/** > + * Initialize the seqlock. > + * > + * This function initializes the seqlock, and leaves the writer-side > + * spinlock unlocked. > + * > + * @param seqlock > + * A pointer to the seqlock. > + */ > +__rte_experimental > +void > +rte_seqlock_init(rte_seqlock_t *seqlock); You need to add the standard experimental prefix to the comment so that doxygen marks the API as experimental in documentation. > +static inline bool > +rte_seqlock_read_retry(const rte_seqlock_t *seqlock, uint32_t begin_sn) > +{ > + uint32_t end_sn; > + > + /* make sure the data loads happens before the sn load */ > + rte_atomic_thread_fence(__ATOMIC_ACQUIRE); > + > + end_sn =3D __atomic_load_n(&seqlock->sn, __ATOMIC_RELAXED); > + > + return unlikely(begin_sn & 1 || begin_sn !=3D end_sn); Please add parenthesis around the and to test if odd. It would be good to document why if begin_sn is odd it returns false.