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 ED799A00C4; Wed, 28 Sep 2022 14:52:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E28F741145; Wed, 28 Sep 2022 14:52:42 +0200 (CEST) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by mails.dpdk.org (Postfix) with ESMTP id 0C0D94113C for ; Wed, 28 Sep 2022 14:52:42 +0200 (CEST) Received: by mail-wr1-f43.google.com with SMTP id m4so5307444wrr.5 for ; Wed, 28 Sep 2022 05:52:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=k21gAiTptt2aqbrz5LNH9I3rEntLshncSqINfst1EHw=; b=XsTbvs7wd+XEBG7a6jdXPIgVI6N/sVSWI1ZzPZqKEK9FdROQuoMYaM7zZtYDUWOsWv nnhax61bNCgXi0aY3C7NZGb+RBhHnZvR0X5TY6StQh2t6q1sSvm41QCB9YZzzyIkpud4 6Q9C/4iz8L+AOBdKpfg84mbQYWkdAlNwVTKH08p/nAyA93ENsuEUHlts9NOx/yvbo6vg HwS1NR/5hH9baF8+4DeNyec40S+eX0Q2wyR0fUWg4nYTnZZ7dlkDmd9/FxublbrZGVq3 /oUOP7kEAfNh8DApU/9WHrtaiOQAI1xTKdYKHjCv4ZnDhVIGqgH85lFiFYzGCchw/A1o lj3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=k21gAiTptt2aqbrz5LNH9I3rEntLshncSqINfst1EHw=; b=pyXFeUDnd25RhKvVQQDHiEGJKpkLa8cxwkA/pSdwOXZtveJjvqEZX1/MulbEELFYAr +PkRifnx5ZbVKE9OBO/6WX/ngpW/poYhixi6Kk1i/GepCboeEf8qgNMNXO7YbHkKTojQ uZ0wHAVrEewj84fnXNv9UJaaBfrCykBdftHQ2GjwyM9ypQnUYQkFVYdCR+P556KB2v+U KnbgUS19WV+JZN7J6ck+myTKZvw23/cigaFUWX/7NaeY34Q6lLDmZyVxcQFElnzmv0bp hDI3LcnSEBYtY2IG493DWKeqp8En4LneqN2/IwqQTvk92cgttZ62sXEcWVKeU9LZmAJp 3HMw== X-Gm-Message-State: ACrzQf12Z3C8XCU2FyIZGNZRcYfh0XK/ajGgj74XXIt8fEZeaU5QxJEq R7egw1jbqBMAxzX8xZty6cqiZg== X-Google-Smtp-Source: AMsMyM7Xd29j4FkyrUVwTevJp086+6gMMyM7saeSYeghSWj2pL2cGsKnYO6b0ilJSsYmYvrIj9SmHA== X-Received: by 2002:a05:6000:1a45:b0:22c:bdbe:28e4 with SMTP id t5-20020a0560001a4500b0022cbdbe28e4mr5909381wry.1.1664369561628; Wed, 28 Sep 2022 05:52:41 -0700 (PDT) Received: from 6wind.com ([2a01:e0a:5ac:6460:c065:401d:87eb:9b25]) by smtp.gmail.com with ESMTPSA id p18-20020a05600c359200b003b47a99d928sm1724254wmq.18.2022.09.28.05.52.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Sep 2022 05:52:41 -0700 (PDT) Date: Wed, 28 Sep 2022 14:52:40 +0200 From: Olivier Matz To: Shijith Thotton Cc: dev@dpdk.org, pbhagavatula@marvell.com, Honnappa.Nagarahalli@arm.com, bruce.richardson@intel.com, jerinj@marvell.com, mb@smartsharesystems.com, stephen@networkplumber.org, thomas@monjalon.net, david.marchand@redhat.com Subject: Re: [PATCH v3 2/5] mbuf: add second dynamic field member for VA only build Message-ID: References: <20220907134340.3629224-1-sthotton@marvell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Hi, On Wed, Sep 21, 2022 at 07:26:18PM +0530, Shijith Thotton wrote: > mbuf physical address field is not used in builds which only uses VA. It > is used to expand the dynamic field area. > > Signed-off-by: Shijith Thotton > --- > lib/mbuf/rte_mbuf_core.h | 26 +++++++++++++++++--------- > lib/mbuf/rte_mbuf_dyn.c | 2 ++ > 2 files changed, 19 insertions(+), 9 deletions(-) > > diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h > index c6292e7252..94907f301d 100644 > --- a/lib/mbuf/rte_mbuf_core.h > +++ b/lib/mbuf/rte_mbuf_core.h > @@ -579,15 +579,23 @@ struct rte_mbuf { > RTE_MARKER cacheline0; > > void *buf_addr; /**< Virtual address of segment buffer. */ > - /** > - * Physical address of segment buffer. > - * This field is invalid if the build is configured to use only > - * virtual address as IOVA (i.e. RTE_IOVA_AS_VA is 1). > - * Force alignment to 8-bytes, so as to ensure we have the exact > - * same mbuf cacheline0 layout for 32-bit and 64-bit. This makes > - * working on vector drivers easier. > - */ > - rte_iova_t buf_iova __rte_aligned(sizeof(rte_iova_t)); > + RTE_STD_C11 > + union { > + /** > + * Physical address of segment buffer. > + * This field is invalid if the build is configured to use only > + * virtual address as IOVA (i.e. RTE_IOVA_AS_VA is 1). > + * Force alignment to 8-bytes, so as to ensure we have the exact > + * same mbuf cacheline0 layout for 32-bit and 64-bit. This makes > + * working on vector drivers easier. > + */ > + rte_iova_t buf_iova __rte_aligned(sizeof(rte_iova_t)); > + /** > + * Reserved for dynamic field in builds where physical address > + * field is invalid. > + */ > + uint64_t dynfield2; > + }; Same comment than on previous patch: using a #if instead of the union here looks better to me to ensure that we never use buf_iova when RTE_IOVA_AS_VA=1. > > /* next 8 bytes are initialised on RX descriptor rearm */ > RTE_MARKER64 rearm_data; > diff --git a/lib/mbuf/rte_mbuf_dyn.c b/lib/mbuf/rte_mbuf_dyn.c > index 4ae79383b5..6a4cf96897 100644 > --- a/lib/mbuf/rte_mbuf_dyn.c > +++ b/lib/mbuf/rte_mbuf_dyn.c > @@ -128,6 +128,8 @@ init_shared_mem(void) > */ > memset(shm, 0, sizeof(*shm)); > mark_free(dynfield1); > + if (RTE_IOVA_AS_VA) > + mark_free(dynfield2); In this case, it will have to be a #if here too. > > /* init free_flags */ > for (mask = RTE_MBUF_F_FIRST_FREE; mask <= RTE_MBUF_F_LAST_FREE; mask <<= 1) Also, I think we can add in the RTE_IOVA_AS_VA documentation that it replaces the buf_iova by 8 bytes of dynamic field.