diff mbox series

[net-next,04/10] net: extend tc_cls_can_offload_basic() to check HW stats type

Message ID 20200221095643.6642-5-jiri@resnulli.us
State Changes Requested
Delegated to: David Miller
Headers show
Series net: allow user specify TC filter HW stats type | expand

Commit Message

Jiri Pirko Feb. 21, 2020, 9:56 a.m. UTC
From: Jiri Pirko <jiri@mellanox.com>

As the default type of HW stats is "any", extend
tc_cls_can_offload_basic() helper to check for it and don't allow any
other type to be handled by the drivers.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
 include/net/pkt_cls.h | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index 779364ed080a..d3d90f714a66 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -594,6 +594,11 @@  tc_cls_can_offload_basic(const struct net_device *dev,
 			       "Driver supports only offload of chain 0");
 		return false;
 	}
+	if (common->hw_stats_type != FLOW_CLS_HW_STATS_TYPE_ANY) {
+		NL_SET_ERR_MSG(common->extack,
+			       "Driver supports only default HW stats type \"any\"");
+		return false;
+	}
 	return true;
 }