[dpdk-dev] [PATCH v2] net: introduce IPv4 ihl and version fields
Olivier Matz
olivier.matz at 6wind.com
Mon Oct 4 09:49:50 CEST 2021
On Fri, Sep 03, 2021 at 10:30:03AM +0300, getelson wrote:
> From: Gregory Etelson <getelson at nvidia.com>
>
> 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 <getelson at nvidia.com>
>
> Depends-on: f7383e7c7ec1 ("net: announce changes in IPv4 header access")
Acked-by: Olivier Matz <olivier.matz at 6wind.com>
> --- 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.
More information about the dev
mailing list