在 2021/8/11 22:45, Jian Shen 写道:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen shenjian15@huawei.com
include/net/pkt_cls.h | 2 +- net/sched/sch_cake.c | 1 + net/sched/sch_netem.c | 3 ++- net/sched/sch_taprio.c | 3 ++- net/sched/sch_tbf.c | 3 ++- 5 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index 8fb47fc..bf9787e 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h @@ -636,7 +636,7 @@ struct tc_cls_u32_offload {
static inline bool tc_can_offload(const struct net_device *dev) {
- return dev->features & NETIF_F_HW_TC;
return netdev_feature_test_bit(NETIF_F_HW_TC_BIT, dev->features); }
static inline bool tc_can_offload_extack(const struct net_device *dev,
diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c index 0808569..2324b5a 100644 --- a/net/sched/sch_cake.c +++ b/net/sched/sch_cake.c @@ -1744,6 +1744,7 @@ static s32 cake_enqueue(struct sk_buff *skb, struct Qdisc *sch, unsigned int slen = 0, numsegs = 0;
netif_skb_features(skb, &features);
segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK);netdev_feature_clear_bits(NETIF_F_GSO_MASK, &features);
it should be "segs = skb_gso_segment(skb, features);" ,will fix it in next version
if (IS_ERR_OR_NULL(segs)) return qdisc_drop(skb, sch, to_free);
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 414d57e..4aabeb20 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c @@ -416,7 +416,8 @@ static struct sk_buff *netem_segment(struct sk_buff *skb, struct Qdisc *sch, netdev_features_t features;
netif_skb_features(skb, &features);
- segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK);
netdev_feature_clear_bits(NETIF_F_GSO_MASK, &features);
segs = skb_gso_segment(skb, features);
if (IS_ERR_OR_NULL(segs)) { qdisc_drop(skb, sch, to_free);
diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index a4073c4..c5114a7 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -458,7 +458,8 @@ static int taprio_enqueue(struct sk_buff *skb, struct Qdisc *sch, int ret;
netif_skb_features(skb, &features);
segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK);
netdev_feature_clear_bits(NETIF_F_GSO_MASK, &features);
if (IS_ERR_OR_NULL(segs)) return qdisc_drop(skb, sch, to_free);segs = skb_gso_segment(skb, features);
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c index 99e6d726..8ac786f 100644 --- a/net/sched/sch_tbf.c +++ b/net/sched/sch_tbf.c @@ -197,7 +197,8 @@ static int tbf_segment(struct sk_buff *skb, struct Qdisc *sch, int ret, nb;
netif_skb_features(skb, &features);
- segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK);
netdev_feature_clear_bits(NETIF_F_GSO_MASK, &features);
segs = skb_gso_segment(skb, features);
if (IS_ERR_OR_NULL(segs)) return qdisc_drop(skb, sch, to_free);