Blob Blame History Raw
From 9555891ed1fbd0e9a491b35499dabb75fd5d6782 Mon Sep 17 00:00:00 2001
From: Alaa Hleihel <ahleihel@redhat.com>
Date: Sun, 10 May 2020 15:04:12 -0400
Subject: [PATCH 094/312] [netdrv] net/mlx5e: Add ToS (DSCP) header rewrite
 support

Message-id: <20200510150452.10307-48-ahleihel@redhat.com>
Patchwork-id: 306671
Patchwork-instance: patchwork
O-Subject: [RHEL8.3 BZ 1789380 v2 47/87] net/mlx5e: Add ToS (DSCP) header rewrite support
Bugzilla: 1789380
RH-Acked-by: Kamal Heib <kheib@redhat.com>
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
RH-Acked-by: Jonathan Toppins <jtoppins@redhat.com>

Bugzilla: http://bugzilla.redhat.com/1789380
Upstream: v5.5-rc1

commit ab9341b54969a2d02dbb7819e2f17c2f0d9cf5b5
Author: Dmytro Linkin <dmitrolin@mellanox.com>
Date:   Mon Oct 7 10:48:00 2019 +0000

    net/mlx5e: Add ToS (DSCP) header rewrite support

    Add support for rewriting of DSCP part of ToS field.
    Next commands, for example, can be used to offload rewrite action:

    OVS:
     $ ovs-ofctl add-flow ovs-sriov "ip, in_port=REP, \
           actions=mod_nw_tos:68, output:NIC"

    iproute2 (used retain mask, as tc command rewrite whole ToS field):
     $ tc filter add dev REP ingress protocol ip prio 1 flower skip_sw \
           ip_proto icmp action pedit munge ip tos set 68 retain 0xfc pipe \
           action mirred egress redirect dev NIC

    Signed-off-by: Dmytro Linkin <dmitrolin@mellanox.com>
    Reviewed-by: Roi Dayan <roid@mellanox.com>
    Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>

Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index ab6d99d6ba14..1a4b8d995826 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -2296,6 +2296,7 @@ static struct mlx5_fields fields[] = {
 	OFFLOAD(ETHERTYPE,  16, U16_MAX, eth.h_proto, 0, ethertype),
 	OFFLOAD(FIRST_VID,  16, U16_MAX, vlan.h_vlan_TCI, 0, first_vid),
 
+	OFFLOAD(IP_DSCP, 8,    0xfc, ip4.tos,   0, ip_dscp),
 	OFFLOAD(IP_TTL,  8,  U8_MAX, ip4.ttl,   0, ttl_hoplimit),
 	OFFLOAD(SIPV4,  32, U32_MAX, ip4.saddr, 0, src_ipv4_src_ipv6.ipv4_layout.ipv4),
 	OFFLOAD(DIPV4,  32, U32_MAX, ip4.daddr, 0, dst_ipv4_dst_ipv6.ipv4_layout.ipv4),
-- 
2.13.6