
Review-by: Jie Wang <wangjie125@huawei.com> On 2021/9/22 22:56, Jian Shen wrote:
Use netdev_feature_xxx helpers to replace the logical operation for netdev features.
Signed-off-by: Jian Shen <shenjian15@huawei.com> --- net/core/pktgen.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index a3d74e2704c4..4a4a866ff97d 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -2961,7 +2961,8 @@ static struct sk_buff *fill_packet_ipv4(struct net_device *odev,
if (!(pkt_dev->flags & F_UDPCSUM)) { skb->ip_summed = CHECKSUM_NONE; - } else if (odev->features & (NETIF_F_HW_CSUM | NETIF_F_IP_CSUM)) { + } else if (netdev_feature_test_bits(NETIF_F_HW_CSUM | NETIF_F_IP_CSUM, + odev->features)) { skb->ip_summed = CHECKSUM_PARTIAL; skb->csum = 0; udp4_hwcsum(skb, iph->saddr, iph->daddr); @@ -3096,7 +3097,8 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
if (!(pkt_dev->flags & F_UDPCSUM)) { skb->ip_summed = CHECKSUM_NONE; - } else if (odev->features & (NETIF_F_HW_CSUM | NETIF_F_IPV6_CSUM)) { + } else if (netdev_feature_test_bits(NETIF_F_HW_CSUM | NETIF_F_IPV6_CSUM, + odev->features)) { skb->ip_summed = CHECKSUM_PARTIAL; skb->csum_start = skb_transport_header(skb) - skb->head; skb->csum_offset = offsetof(struct udphdr, check);