Add setting of ipv4 dscp and ecn fields in tc offload using pedit.

Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuu...@netronome.com>
Signed-off-by: Louis Peens <louis.pe...@netronome.com>
Reviewed-by: Simon Horman <simon.hor...@netronome.com>
---
 lib/netdev-tc-offloads.c | 6 +++++-
 lib/tc.c                 | 5 +++++
 lib/tc.h                 | 1 +
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/lib/netdev-tc-offloads.c b/lib/netdev-tc-offloads.c
index 73ce7b952..90bd3c585 100644
--- a/lib/netdev-tc-offloads.c
+++ b/lib/netdev-tc-offloads.c
@@ -52,7 +52,7 @@ struct netlink_field {
     int size;
 };
 
-static struct netlink_field set_flower_map[][3] = {
+static struct netlink_field set_flower_map[][4] = {
     [OVS_KEY_ATTR_IPV4] = {
         { offsetof(struct ovs_key_ipv4, ipv4_src),
           offsetof(struct tc_flower_key, ipv4.ipv4_src),
@@ -66,6 +66,10 @@ static struct netlink_field set_flower_map[][3] = {
           offsetof(struct tc_flower_key, ipv4.rewrite_ttl),
           MEMBER_SIZEOF(struct tc_flower_key, ipv4.rewrite_ttl)
         },
+        { offsetof(struct ovs_key_ipv4, ipv4_tos),
+          offsetof(struct tc_flower_key, ipv4.rewrite_tos),
+          MEMBER_SIZEOF(struct tc_flower_key, ipv4.rewrite_tos)
+        },
     },
     [OVS_KEY_ATTR_IPV6] = {
         { offsetof(struct ovs_key_ipv6, ipv6_src),
diff --git a/lib/tc.c b/lib/tc.c
index b19f075f2..1696c9836 100644
--- a/lib/tc.c
+++ b/lib/tc.c
@@ -91,6 +91,11 @@ static struct flower_key_to_pedit flower_pedit_map[] = {
         8,
         offsetof(struct tc_flower_key, ipv4.rewrite_ttl),
         MEMBER_SIZEOF(struct tc_flower_key, ipv4.rewrite_ttl)
+    }, {
+        TCA_PEDIT_KEY_EX_HDR_TYPE_IP4,
+        1,
+        offsetof(struct tc_flower_key, ipv4.rewrite_tos),
+        MEMBER_SIZEOF(struct tc_flower_key, ipv4.rewrite_tos)
     }, {
         TCA_PEDIT_KEY_EX_HDR_TYPE_IP6,
         7,
diff --git a/lib/tc.h b/lib/tc.h
index 7196a32d7..04b08e298 100644
--- a/lib/tc.h
+++ b/lib/tc.h
@@ -103,6 +103,7 @@ struct tc_flower_key {
         ovs_be32 ipv4_src;
         ovs_be32 ipv4_dst;
         uint8_t rewrite_ttl;
+        uint8_t rewrite_tos;
     } ipv4;
     struct {
         struct in6_addr ipv6_src;
-- 
2.17.0

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to