IPv6 header TC field is 8 (not 4) bits, and also used as DSCP and ECN.
diff mbox series

Message ID 1561125938-4414-1-git-send-email-mb@smartsharesystems.com
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series
  • IPv6 header TC field is 8 (not 4) bits, and also used as DSCP and ECN.
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS
ci/Intel-compilation fail Compilation issues

Commit Message

Morten Brørup June 21, 2019, 2:05 p.m. UTC
IPv4 header TOS field is also used as DSCP and ECN fields.

Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
---
 lib/librte_net/rte_ip.h |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

Comments

Olivier Matz July 1, 2019, 1:10 p.m. UTC | #1
Hi Morten,

On Fri, Jun 21, 2019 at 04:05:38PM +0200, Morten Brørup wrote:
> IPv4 header TOS field is also used as DSCP and ECN fields.
> 
> Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
> ---
>  lib/librte_net/rte_ip.h |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
> index ae3b7e7..e69b863 100644
> --- a/lib/librte_net/rte_ip.h
> +++ b/lib/librte_net/rte_ip.h
> @@ -58,6 +58,10 @@ struct rte_ipv4_hdr {
>   */
>  #define RTE_IPV4_IHL_MULTIPLIER	(4)
>  
> +/* Type of Service fields */
> +#define RTE_IPV4_HDR_DSCP_MASK	(0xfc)
> +#define RTE_IPV4_HDR_ECN_MASK	(0x03)
> +
>  /* Fragment Offset * Flags. */
>  #define	RTE_IPV4_HDR_DF_SHIFT	14
>  #define	RTE_IPV4_HDR_MF_SHIFT	13
> @@ -354,8 +358,10 @@ struct rte_ipv6_hdr {
>  /* IPv6 vtc_flow: IPv / TC / flow_label */
>  #define RTE_IPV6_HDR_FL_SHIFT 0
>  #define RTE_IPV6_HDR_TC_SHIFT 20
> -#define RTE_IPV6_HDR_FL_MASK ((1u << RTE_IPV6_HDR_TC_SHIFT) - 1)
> -#define RTE_IPV6_HDR_TC_MASK (0xf << RTE_IPV6_HDR_TC_SHIFT)
> +#define RTE_IPV6_HDR_FL_MASK	((1u << RTE_IPV6_HDR_TC_SHIFT) - 1)
> +#define RTE_IPV6_HDR_TC_MASK	(0xff << RTE_IPV6_HDR_TC_SHIFT)
> +#define RTE_IPV6_HDR_DSCP_MASK	(0xfc << RTE_IPV6_HDR_TC_SHIFT)
> +#define RTE_IPV6_HDR_ECN_MASK	(0x03 << RTE_IPV6_HDR_TC_SHIFT)
>  
>  /**
>   * Process the pseudo-header checksum of an IPv6 header.

The changes look good to me. Can I however suggest to split the
patch in 2 as below?

- net: fix definition of ipv6 traffic class mask
- net: add definition for dscp and ecn masks

I see that you already CC'd mlx5 maintainers, as the driver uses the
RTE_IPV6_HDR_TC_MASK definition.

Also, it looks that it may conflict with this patch:
https://mails.dpdk.org/archives/dev/2019-July/136575.html
It is maybe preferable to integrate your patchset first, then rebase
Fan's patchset on top of it.

Thanks,
Olivier

Patch
diff mbox series

diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index ae3b7e7..e69b863 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -58,6 +58,10 @@  struct rte_ipv4_hdr {
  */
 #define RTE_IPV4_IHL_MULTIPLIER	(4)
 
+/* Type of Service fields */
+#define RTE_IPV4_HDR_DSCP_MASK	(0xfc)
+#define RTE_IPV4_HDR_ECN_MASK	(0x03)
+
 /* Fragment Offset * Flags. */
 #define	RTE_IPV4_HDR_DF_SHIFT	14
 #define	RTE_IPV4_HDR_MF_SHIFT	13
@@ -354,8 +358,10 @@  struct rte_ipv6_hdr {
 /* IPv6 vtc_flow: IPv / TC / flow_label */
 #define RTE_IPV6_HDR_FL_SHIFT 0
 #define RTE_IPV6_HDR_TC_SHIFT 20
-#define RTE_IPV6_HDR_FL_MASK ((1u << RTE_IPV6_HDR_TC_SHIFT) - 1)
-#define RTE_IPV6_HDR_TC_MASK (0xf << RTE_IPV6_HDR_TC_SHIFT)
+#define RTE_IPV6_HDR_FL_MASK	((1u << RTE_IPV6_HDR_TC_SHIFT) - 1)
+#define RTE_IPV6_HDR_TC_MASK	(0xff << RTE_IPV6_HDR_TC_SHIFT)
+#define RTE_IPV6_HDR_DSCP_MASK	(0xfc << RTE_IPV6_HDR_TC_SHIFT)
+#define RTE_IPV6_HDR_ECN_MASK	(0x03 << RTE_IPV6_HDR_TC_SHIFT)
 
 /**
  * Process the pseudo-header checksum of an IPv6 header.