Skip to content

Commit 55330f0

Browse files
hadarhenziondavem330
authored andcommitted
net/sched: Add separate check for skip_hw flag
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>
1 parent 25429d7 commit 55330f0

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

include/net/pkt_cls.h

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,16 +425,14 @@ struct tc_cls_u32_offload {
425425
};
426426
};
427427

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

434434
if (!(dev->features & NETIF_F_HW_TC))
435435
return false;
436-
if (flags & TCA_CLS_FLAGS_SKIP_HW)
437-
return false;
438436
if (!dev->netdev_ops->ndo_setup_tc)
439437
return false;
440438
if (cops && cops->tcf_cl_offload)
@@ -443,6 +441,19 @@ static inline bool tc_should_offload(const struct net_device *dev,
443441
return true;
444442
}
445443

444+
static inline bool tc_skip_hw(u32 flags)
445+
{
446+
return (flags & TCA_CLS_FLAGS_SKIP_HW) ? true : false;
447+
}
448+
449+
static inline bool tc_should_offload(const struct net_device *dev,
450+
const struct tcf_proto *tp, u32 flags)
451+
{
452+
if (tc_skip_hw(flags))
453+
return false;
454+
return tc_can_offload(dev, tp);
455+
}
456+
446457
static inline bool tc_skip_sw(u32 flags)
447458
{
448459
return (flags & TCA_CLS_FLAGS_SKIP_SW) ? true : false;

0 commit comments

Comments
 (0)