netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: netdev@vger.kernel.org
Cc: Guillaume Nault <gnault@redhat.com>,
	Petr Machata <pmachata@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Roopa Prabhu <roopa@cumulusnetworks.com>,
	David Ahern <dsahern@kernel.org>,
	Eelco Chaudron <echaudro@redhat.com>,
	Hangbin Liu <liuhangbin@gmail.com>
Subject: [PATCH net-next 1/2] net: add IP_DSCP_MASK
Date: Mon,  3 Aug 2020 16:02:16 +0800	[thread overview]
Message-ID: <20200803080217.391850-2-liuhangbin@gmail.com> (raw)
In-Reply-To: <20200803080217.391850-1-liuhangbin@gmail.com>

In RFC1349 it defined TOS field like

       0     1     2     3     4     5     6     7
    +-----+-----+-----+-----+-----+-----+-----+-----+
    |   PRECEDENCE    |          TOS          | MBZ |
    +-----+-----+-----+-----+-----+-----+-----+-----+

But this has been obsoleted by RFC2474, and updated by RFC3168 later.
Now the DS Field should be like

       0     1     2     3     4     5     6     7
    +-----+-----+-----+-----+-----+-----+-----+-----+
    |          DS FIELD, DSCP           | ECN FIELD |
    +-----+-----+-----+-----+-----+-----+-----+-----+

      DSCP: differentiated services codepoint
      ECN:  Explicit Congestion Notification

So the old IPTOS_TOS_MASK 0x1E should be updated. But since
changed the value will break UAPI, let's add a new value
IP_DSCP_MASK 0xFC as a replacement.

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
 include/uapi/linux/in_route.h | 1 +
 include/uapi/linux/ip.h       | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/include/uapi/linux/in_route.h b/include/uapi/linux/in_route.h
index 0cc2c23b47f8..26ba4efb054d 100644
--- a/include/uapi/linux/in_route.h
+++ b/include/uapi/linux/in_route.h
@@ -29,5 +29,6 @@
 #define RTCF_NAT	(RTCF_DNAT|RTCF_SNAT)
 
 #define RT_TOS(tos)	((tos)&IPTOS_TOS_MASK)
+#define RT_DSCP(tos)	((tos)&IP_DSCP_MASK)
 
 #endif /* _LINUX_IN_ROUTE_H */
diff --git a/include/uapi/linux/ip.h b/include/uapi/linux/ip.h
index e42d13b55cf3..62e4169277eb 100644
--- a/include/uapi/linux/ip.h
+++ b/include/uapi/linux/ip.h
@@ -22,6 +22,8 @@
 
 #define IPTOS_TOS_MASK		0x1E
 #define IPTOS_TOS(tos)		((tos)&IPTOS_TOS_MASK)
+#define IP_DSCP_MASK		0xFC
+#define IP_DSCP(tos)		((tos)&IP_DSCP_MASK)
 #define	IPTOS_LOWDELAY		0x10
 #define	IPTOS_THROUGHPUT	0x08
 #define	IPTOS_RELIABILITY	0x04
-- 
2.25.4


  reply	other threads:[~2020-08-03  8:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-03  8:02 [PATCH net-next 0/2] Add IP_DSCP_MASK and fix vxlan tos value before xmit Hangbin Liu
2020-08-03  8:02 ` Hangbin Liu [this message]
2020-08-03  9:26   ` [PATCH net-next 1/2] net: add IP_DSCP_MASK Guillaume Nault
2020-08-03  8:02 ` [PATCH net-next 2/2] vxlan: fix getting tos value from DSCP field Hangbin Liu
2020-08-03  9:30   ` Guillaume Nault
2020-08-04  1:43 ` [PATCHv2 net 0/2] Add IP_DSCP_MASK and fix vxlan tos value before xmit Hangbin Liu
2020-08-04  1:43   ` [PATCHv2 net 1/2] net: add IP_DSCP_MASK Hangbin Liu
2020-08-04  1:43   ` [PATCHv2 net 2/2] vxlan: fix getting tos value from DSCP field Hangbin Liu
2020-08-04 19:47     ` David Miller
2020-08-05  2:20       ` Hangbin Liu
2020-08-04  7:47   ` [PATCHv2 net 0/2] Add IP_DSCP_MASK and fix vxlan tos value before xmit Guillaume Nault

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200803080217.391850-2-liuhangbin@gmail.com \
    --to=liuhangbin@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=echaudro@redhat.com \
    --cc=gnault@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pmachata@gmail.com \
    --cc=roopa@cumulusnetworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).