Skip to content

Commit

Permalink
net/sched: Add separate check for skip_hw flag
Browse files Browse the repository at this point in the history
Creating a difference between two possible cases:
1. Not offloading tc rule since the user sets 'skip_hw' flag.
2. Not offloading tc rule since the device doesn't support offloading.

This patch doesn't add any new functionality.

Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Hadar Hen Zion authored and David S. Miller committed Dec 2, 2016
1 parent 25429d7 commit 55330f0
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions include/net/pkt_cls.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,16 +425,14 @@ struct tc_cls_u32_offload {
};
};

static inline bool tc_should_offload(const struct net_device *dev,
const struct tcf_proto *tp, u32 flags)
static inline bool tc_can_offload(const struct net_device *dev,
const struct tcf_proto *tp)
{
const struct Qdisc *sch = tp->q;
const struct Qdisc_class_ops *cops = sch->ops->cl_ops;

if (!(dev->features & NETIF_F_HW_TC))
return false;
if (flags & TCA_CLS_FLAGS_SKIP_HW)
return false;
if (!dev->netdev_ops->ndo_setup_tc)
return false;
if (cops && cops->tcf_cl_offload)
Expand All @@ -443,6 +441,19 @@ static inline bool tc_should_offload(const struct net_device *dev,
return true;
}

static inline bool tc_skip_hw(u32 flags)
{
return (flags & TCA_CLS_FLAGS_SKIP_HW) ? true : false;
}

static inline bool tc_should_offload(const struct net_device *dev,
const struct tcf_proto *tp, u32 flags)
{
if (tc_skip_hw(flags))
return false;
return tc_can_offload(dev, tp);
}

static inline bool tc_skip_sw(u32 flags)
{
return (flags & TCA_CLS_FLAGS_SKIP_SW) ? true : false;
Expand Down

0 comments on commit 55330f0

Please sign in to comment.