net: cls_u32: move TC offload feature bit into cls_u32 offload logic
authorJohn Fastabend <john.fastabend@gmail.com>
Fri, 26 Feb 2016 15:54:13 +0000 (07:54 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 1 Mar 2016 21:05:39 +0000 (16:05 -0500)
In the original series drivers would get offload requests for cls_u32
rules even if the feature bit is disabled. This meant the driver had
to do a boiler plate check on the feature bit before adding/deleting
the rule.

This patch lifts the check into the core code and removes it from the
driver specific case.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
include/net/pkt_cls.h

index cf4b729c92d7655d5928da9eefbebd56af85e645..b893ff8e65f598e580bf618a39c639c4088b925d 100644 (file)
@@ -8400,9 +8400,6 @@ int __ixgbe_setup_tc(struct net_device *dev, u32 handle, __be16 proto,
 
        if (TC_H_MAJ(handle) == TC_H_MAJ(TC_H_INGRESS) &&
            tc->type == TC_SETUP_CLSU32) {
-               if (!(dev->features & NETIF_F_HW_TC))
-                       return -EINVAL;
-
                switch (tc->cls_u32->command) {
                case TC_CLSU32_NEW_KNODE:
                case TC_CLSU32_REPLACE_KNODE:
index e64d20b81047ea8343fafb2385ee830b5d51c612..6096e96fb78bbc19ff12725eba80b4defdbe9555 100644 (file)
@@ -394,6 +394,9 @@ struct tc_cls_u32_offload {
 
 static inline bool tc_should_offload(struct net_device *dev)
 {
+       if (!(dev->features & NETIF_F_HW_TC))
+               return false;
+
        return dev->netdev_ops->ndo_setup_tc;
 }