[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210929155334.12454-46-shenjian15@huawei.com>
Date: Wed, 29 Sep 2021 23:51:32 +0800
From: Jian Shen <shenjian15@...wei.com>
To: <davem@...emloft.net>, <kuba@...nel.org>, <andrew@...n.ch>,
<hkallweit1@...il.com>
CC: <netdev@...r.kernel.org>, <linuxarm@...neuler.org>
Subject: [RFCv2 net-next 045/167] net: sched: use netdev feature helpers
Use netdev_feature_xxx helpers to replace the logical operation
for netdev features.
Signed-off-by: Jian Shen <shenjian15@...wei.com>
---
include/net/pkt_cls.h | 2 +-
net/sched/sch_cake.c | 3 ++-
net/sched/sch_netem.c | 3 ++-
net/sched/sch_taprio.c | 3 ++-
net/sched/sch_tbf.c | 3 ++-
5 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index 83a6d0792180..228881d40dd8 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 e650ec5dc791..5d783cd72290 100644
--- a/net/sched/sch_cake.c
+++ b/net/sched/sch_cake.c
@@ -1744,7 +1744,8 @@ 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);
+ segs = skb_gso_segment(skb, features);
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 414d57e017b9..4aabeb206777 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 d7fe4a2cc14f..e42deaf723b1 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);
+ segs = skb_gso_segment(skb, features);
if (IS_ERR_OR_NULL(segs))
return qdisc_drop(skb, sch, to_free);
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index 99e6d7265e7f..8ac786f467a0 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);
--
2.33.0
Powered by blists - more mailing lists