DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] IPv6 header TC field is 8 (not 4) bits, and also used as DSCP and ECN.
@ 2019-06-21 14:05 Morten Brørup
  2019-07-01 13:10 ` Olivier Matz
  0 siblings, 1 reply; 2+ messages in thread
From: Morten Brørup @ 2019-06-21 14:05 UTC (permalink / raw)
  To: olivier.matz, shahafs, yskoh; +Cc: dev, Morten Brørup

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.
-- 
1.5.6


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-07-01 13:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-21 14:05 [dpdk-dev] [PATCH] IPv6 header TC field is 8 (not 4) bits, and also used as DSCP and ECN Morten Brørup
2019-07-01 13:10 ` Olivier Matz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).