[ovs-dev,RFC,v3,3/4] lib/tc: add set ipv4 dscp and ecn action offload via pedit

Message ID 1548678550-6661-4-git-send-email-pieter.jansenvanvuuren@netronome.com
State New
Headers show
Series
  • extend ovs-tc offload for more pedit action
Related show

Commit Message

Pieter Jansen van Vuuren Jan. 28, 2019, 12:29 p.m.
Add setting of ipv4 dscp and ecn fields in tc offload using pedit.

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

Patch

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 953fffd01..78905e1e9 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;