Thread (181 messages) 181 messages, 6 authors, 2022-01-27

[RFCv2 net-next 045/167] net: sched: use netdev feature helpers

From: Jian Shen <shenjian15@huawei.com>
Date: 2021-09-29 16:00:22
Subsystem: cake qdisc, cbs/etf/taprio qdiscs, netem network emulator, networking [general], tc subsystem, the rest · Maintainers: Toke Høiland-Jørgensen, Vinicius Costa Gomes, Stephen Hemminger, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Jamal Hadi Salim, Jiri Pirko, Linus Torvalds

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   | 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help