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 A47F0A0C4B; Mon, 4 Oct 2021 09:49:53 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2F9D6412D6; Mon, 4 Oct 2021 09:49:53 +0200 (CEST) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by mails.dpdk.org (Postfix) with ESMTP id 12088412CA for ; Mon, 4 Oct 2021 09:49:52 +0200 (CEST) Received: by mail-wr1-f47.google.com with SMTP id u18so29145142wrg.5 for ; Mon, 04 Oct 2021 00:49:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=q9Dd+xYDzkDYq9OrgG8XiaYC9lLCvIAlyrhr2HIgypc=; b=fNy/lzKkJLZJacJvNlDKfu01XpnXYekqUpS//EEnNwvfGo3BWYSsHoaKedZU9XN4yK lymunAtWI/3vevFd+/kXWdAP7rivkwyCynxhg1dptMEtaVskufMYYkcA6BfOqr9hiLNz KMOi4rQWqU/bsg/pj/aJEumNIxd+m2TVxU91/R9jQwCaZd93O/PRLZ5VelfMqgPnOujQ UovU/ZtlAPl3lN2snH4ersb6M67GtCXvhT07hh04PEcr8v4wkwsriaV68+eBK4uneuVb IrnnTYFP8/+s/AusF1jQvziAIaegswpXhjEDVaCmh4dm/7V8T/eUv4DrFXi0iPlI7dkd bCuQ== 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:references :mime-version:content-disposition:in-reply-to; bh=q9Dd+xYDzkDYq9OrgG8XiaYC9lLCvIAlyrhr2HIgypc=; b=iT7TZRGKcWvoha8wIfnrhQnnyRcgArCfduBkcHJyfbh6vJQ0HBKyOD62DIsUkK6np+ hmpnz8nGIohk0mfg77xC4t++FGE5vunHMSZ3dzKHsbvoHahV/fOmCbQjaMiLekRw6Mzs QHg/W/6uJaWgCTN+ANXW4w6M7K8ZjrjDL/i7np98xElFpwU7RsWJuXIBiHd9EL3Y3sfj IXI4By96j3RYDlmho4Q9Xytuxg/luuhqGQ9H0xxz+l2Pjeb32fTW9y73rTr6XxzzT8sG YPyo4cf87WrkV5oK1n9k0OeKAoF7QmVJf5EPE6vwkvMvhrFPmWKRWHjmuyC/fbTy8afQ YkBg== X-Gm-Message-State: AOAM533WlbJU2V47keVLiQe/1GIizzgKkdpT2elu2jg3obfCfoBfC0mz BuKP5O5OfoO9iN+IwEeLubSLNQ== X-Google-Smtp-Source: ABdhPJy7dF943KKUj/3DVWg/vv02IEzroUMW6fy7O97NtSaecwLj9ficunrnw5whKe0KxAIjQoUJRQ== X-Received: by 2002:adf:9d47:: with SMTP id o7mr12540254wre.50.1633333791731; Mon, 04 Oct 2021 00:49:51 -0700 (PDT) Received: from 6wind.com ([2a01:e0a:5ac:6460:c065:401d:87eb:9b25]) by smtp.gmail.com with ESMTPSA id y15sm6952918wrp.44.2021.10.04.00.49.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Oct 2021 00:49:50 -0700 (PDT) Date: Mon, 4 Oct 2021 09:49:50 +0200 From: Olivier Matz To: getelson Cc: dev@dpdk.org, thomas@monjalon.net, bernard.iremonger@intel.com, rasland@nvidia.com, matan@nvidia.com Message-ID: References: <20210527152858.13312-1-getelson@nvidia.com> <20210903073003.31400-1-getelson@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210903073003.31400-1-getelson@nvidia.com> Subject: Re: [dpdk-dev] [PATCH v2] net: introduce IPv4 ihl and version fields 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 Sender: "dev" On Fri, Sep 03, 2021 at 10:30:03AM +0300, getelson wrote: > From: Gregory Etelson > > RTE IPv4 header definition combines the `version' and `ihl' fields > into a single structure member. > This patch introduces dedicated structure members for both `version' > and `ihl' IPv4 fields. Separated header fields definitions allow to > create simplified code to match on the IHL value in a flow rule. > The original `version_ihl' structure member is kept for backward > compatibility. > > Signed-off-by: Gregory Etelson > > Depends-on: f7383e7c7ec1 ("net: announce changes in IPv4 header access") Acked-by: Olivier Matz > --- a/lib/net/rte_ip.h > +++ b/lib/net/rte_ip.h > @@ -38,7 +38,21 @@ extern "C" { > * IPv4 Header > */ > struct rte_ipv4_hdr { > - uint8_t version_ihl; /**< version and header length */ > + __extension__ > + union { > + uint8_t version_ihl; /**< version and header length */ > + struct { > +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN > + uint8_t ihl:4; > + uint8_t version:4; > +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN > + uint8_t version:4; > + uint8_t ihl:4; nit: although it's obvious, we may want to add /**< IP version */ and /**< header length */ for these new fields, for consistency with the rest of the structure.