diff options
author | John Fastabend <john.fastabend@gmail.com> | 2016-02-26 10:54:13 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-03-01 16:05:39 -0500 |
commit | 2b6ab0d3aae6bf1e08118060b0c5565778cd6b21 (patch) | |
tree | 58a2208c1b403db5309020117e984a8c3c12fd12 | |
parent | 6843e7a2abe7cac10c19702ffec90018df6f040d (diff) |
net: cls_u32: move TC offload feature bit into cls_u32 offload logic
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>
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 | ||||
-rw-r--r-- | include/net/pkt_cls.h | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index cf4b729c92d7..b893ff8e65f5 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -8400,9 +8400,6 @@ int __ixgbe_setup_tc(struct net_device *dev, u32 handle, __be16 proto, | |||
8400 | 8400 | ||
8401 | if (TC_H_MAJ(handle) == TC_H_MAJ(TC_H_INGRESS) && | 8401 | if (TC_H_MAJ(handle) == TC_H_MAJ(TC_H_INGRESS) && |
8402 | tc->type == TC_SETUP_CLSU32) { | 8402 | tc->type == TC_SETUP_CLSU32) { |
8403 | if (!(dev->features & NETIF_F_HW_TC)) | ||
8404 | return -EINVAL; | ||
8405 | |||
8406 | switch (tc->cls_u32->command) { | 8403 | switch (tc->cls_u32->command) { |
8407 | case TC_CLSU32_NEW_KNODE: | 8404 | case TC_CLSU32_NEW_KNODE: |
8408 | case TC_CLSU32_REPLACE_KNODE: | 8405 | case TC_CLSU32_REPLACE_KNODE: |
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index e64d20b81047..6096e96fb78b 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h | |||
@@ -394,6 +394,9 @@ struct tc_cls_u32_offload { | |||
394 | 394 | ||
395 | static inline bool tc_should_offload(struct net_device *dev) | 395 | static inline bool tc_should_offload(struct net_device *dev) |
396 | { | 396 | { |
397 | if (!(dev->features & NETIF_F_HW_TC)) | ||
398 | return false; | ||
399 | |||
397 | return dev->netdev_ops->ndo_setup_tc; | 400 | return dev->netdev_ops->ndo_setup_tc; |
398 | } | 401 | } |
399 | 402 | ||