Skip to content

Commit c317e23

Browse files
committed
openvswitch: delete the unncessary skb_pull_rcsum call in ovs_ct_nat_execute
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2163374 Upstream Status: linux.git commit bf14f49 Author: Xin Long <lucien.xin@gmail.com> Date: Thu Dec 8 11:56:08 2022 -0500 openvswitch: delete the unncessary skb_pull_rcsum call in ovs_ct_nat_execute The calls to ovs_ct_nat_execute() are as below: ovs_ct_execute() ovs_ct_lookup() __ovs_ct_lookup() ovs_ct_nat() ovs_ct_nat_execute() ovs_ct_commit() __ovs_ct_lookup() ovs_ct_nat() ovs_ct_nat_execute() and since skb_pull_rcsum() and skb_push_rcsum() are already called in ovs_ct_execute(), there's no need to do it again in ovs_ct_nat_execute(). Reviewed-by: Saeed Mahameed <saeed@kernel.org> Acked-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Antoine Tenart <atenart@redhat.com>
1 parent 0b18164 commit c317e23

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

net/openvswitch/conntrack.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -794,10 +794,7 @@ static int ovs_ct_nat_execute(struct sk_buff *skb, struct nf_conn *ct,
794794
const struct nf_nat_range2 *range,
795795
enum nf_nat_manip_type maniptype, struct sw_flow_key *key)
796796
{
797-
int hooknum, nh_off, err = NF_ACCEPT;
798-
799-
nh_off = skb_network_offset(skb);
800-
skb_pull_rcsum(skb, nh_off);
797+
int hooknum, err = NF_ACCEPT;
801798

802799
/* See HOOK2MANIP(). */
803800
if (maniptype == NF_NAT_MANIP_SRC)
@@ -814,7 +811,7 @@ static int ovs_ct_nat_execute(struct sk_buff *skb, struct nf_conn *ct,
814811
if (!nf_nat_icmp_reply_translation(skb, ct, ctinfo,
815812
hooknum))
816813
err = NF_DROP;
817-
goto push;
814+
goto out;
818815
} else if (IS_ENABLED(CONFIG_IPV6) &&
819816
skb->protocol == htons(ETH_P_IPV6)) {
820817
__be16 frag_off;
@@ -829,7 +826,7 @@ static int ovs_ct_nat_execute(struct sk_buff *skb, struct nf_conn *ct,
829826
hooknum,
830827
hdrlen))
831828
err = NF_DROP;
832-
goto push;
829+
goto out;
833830
}
834831
}
835832
/* Non-ICMP, fall thru to initialize if needed. */
@@ -847,7 +844,7 @@ static int ovs_ct_nat_execute(struct sk_buff *skb, struct nf_conn *ct,
847844
? nf_nat_setup_info(ct, range, maniptype)
848845
: nf_nat_alloc_null_binding(ct, hooknum);
849846
if (err != NF_ACCEPT)
850-
goto push;
847+
goto out;
851848
}
852849
break;
853850

@@ -857,13 +854,11 @@ static int ovs_ct_nat_execute(struct sk_buff *skb, struct nf_conn *ct,
857854

858855
default:
859856
err = NF_DROP;
860-
goto push;
857+
goto out;
861858
}
862859

863860
err = nf_nat_packet(ct, ctinfo, hooknum, skb);
864-
push:
865-
skb_push_rcsum(skb, nh_off);
866-
861+
out:
867862
/* Update the flow key if NAT successful. */
868863
if (err == NF_ACCEPT)
869864
ovs_nat_update_key(key, skb, maniptype);

0 commit comments

Comments
 (0)