summaryrefslogtreecommitdiff
path: root/include/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-05-16 13:30:57 -0400
committerDavid S. Miller <davem@davemloft.net>2016-05-16 13:30:57 -0400
commit1ca467343240be738c8e61edd4b421ca9ebe2d77 (patch)
tree79482667c26a1d1dcc54fc8147a27ddb92be5cea /include/net
parent860d7ef64da14b642a2b0dc15381b69b7263fc44 (diff)
parentd34e3e181395192d6d1f50dd97bd7854e04e33a4 (diff)
downloadlinux-1ca467343240be738c8e61edd4b421ca9ebe2d77.tar.gz
linux-1ca467343240be738c8e61edd4b421ca9ebe2d77.tar.xz
Merge branch 'cls_u32_hw_sw'
Sridhar Samudrala says: ==================== Enable SW only or HW only offloads with u32 classifier This set of patches export TCA_CLS_FLAGS_SKIP_HW to userspace and also introduces another flag TCA_CLS_FLAGS_SKIP_SW. These flags enable offloading u32 filters to either SW or HW only. The default semantics with no flags is to add the filter to HW if possible and also into SW. With SKIP_HW flag, the filter is only added to SW. With SKIP_SW flag, the filter is added to HW and an error is returned to user on failure. These flags are mutually exclusive. There was an earlier discussion on these semantics in the following email thread. http://thread.gmane.org/gmane.linux.network/401733 ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/pkt_cls.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index caa5e18636df..8b4893878cf4 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -392,9 +392,6 @@ struct tc_cls_u32_offload {
};
};
-/* tca flags definitions */
-#define TCA_CLS_FLAGS_SKIP_HW 1
-
static inline bool tc_should_offload(struct net_device *dev, u32 flags)
{
if (!(dev->features & NETIF_F_HW_TC))
@@ -409,6 +406,23 @@ static inline bool tc_should_offload(struct net_device *dev, u32 flags)
return true;
}
+static inline bool tc_skip_sw(u32 flags)
+{
+ return (flags & TCA_CLS_FLAGS_SKIP_SW) ? true : false;
+}
+
+/* SKIP_HW and SKIP_SW are mutually exclusive flags. */
+static inline bool tc_flags_valid(u32 flags)
+{
+ if (flags & ~(TCA_CLS_FLAGS_SKIP_HW | TCA_CLS_FLAGS_SKIP_SW))
+ return false;
+
+ if (!(flags ^ (TCA_CLS_FLAGS_SKIP_HW | TCA_CLS_FLAGS_SKIP_SW)))
+ return false;
+
+ return true;
+}
+
enum tc_fl_command {
TC_CLSFLOWER_REPLACE,
TC_CLSFLOWER_DESTROY,