OSDN Git Service

net: openvswitch: Use 'skb_push_rcsum()' instead of hand coding it
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 4 Apr 2021 07:11:03 +0000 (09:11 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 4 Apr 2021 08:43:02 +0000 (01:43 -0700)
'skb_push()'/'skb_postpush_rcsum()' can be replaced by an equivalent
'skb_push_rcsum()' which is less verbose.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/openvswitch/conntrack.c
net/openvswitch/vport-netdev.c

index 71cec03..c29b0ef 100644 (file)
@@ -809,8 +809,7 @@ static int ovs_ct_nat_execute(struct sk_buff *skb, struct nf_conn *ct,
 
        err = nf_nat_packet(ct, ctinfo, hooknum, skb);
 push:
-       skb_push(skb, nh_off);
-       skb_postpush_rcsum(skb, skb->data, nh_off);
+       skb_push_rcsum(skb, nh_off);
 
        return err;
 }
@@ -1322,8 +1321,7 @@ int ovs_ct_execute(struct net *net, struct sk_buff *skb,
        else
                err = ovs_ct_lookup(net, key, info, skb);
 
-       skb_push(skb, nh_ofs);
-       skb_postpush_rcsum(skb, skb->data, nh_ofs);
+       skb_push_rcsum(skb, nh_ofs);
        if (err)
                kfree_skb(skb);
        return err;
index 57d6436..8e1a88f 100644 (file)
@@ -44,10 +44,9 @@ static void netdev_port_receive(struct sk_buff *skb)
        if (unlikely(!skb))
                return;
 
-       if (skb->dev->type == ARPHRD_ETHER) {
-               skb_push(skb, ETH_HLEN);
-               skb_postpush_rcsum(skb, skb->data, ETH_HLEN);
-       }
+       if (skb->dev->type == ARPHRD_ETHER)
+               skb_push_rcsum(skb, ETH_HLEN);
+
        ovs_vport_receive(vport, skb, skb_tunnel_info(skb));
        return;
 error: