[dpdk-dev] [PATCH 1/2] lib/net: add IPv6 header fields macros

Stephen Hemminger stephen at networkplumber.org
Sun Dec 31 18:37:54 CET 2017


On Sun, 31 Dec 2017 07:34:29 +0000
Shachar Beiser <shacharbe at mellanox.com> wrote:

> +/* IPv6 vtc_flow: IPv / TC / flow_label */
> +#define IPV6_HDR_FL_SHIFT (0)
> +#define IPV6_HDR_TC_SHIFT (20)

No parenthesis needed around simple numeric values.

> +#define IPV6_HDR_FL_MASK ((1 << IPV6_HDR_TC_SHIFT) - 1)

If you use ((1u << IPV6_HDR_TC_SHFIT - 1)
then the mask will be unsigned which probably what you want.

> +#define IPV6_HDR_TC_MASK (0xf << IPV6_HDR_TC_SHIFT)


More information about the dev mailing list