Re: [PATCH net-next] net: remove redundant variable in vxlan_xmit_one

From: David Miller
Date: Fri Aug 21 2020 - 14:41:22 EST


From: Jianlin Lv <Jianlin.Lv@xxxxxxx>
Date: Fri, 21 Aug 2020 13:56:36 +0800

> @@ -2614,8 +2613,8 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
> info = skb_tunnel_info(skb);
>
> if (rdst) {
> - dst = &rdst->remote_ip;
> - if (vxlan_addr_any(dst)) {
> + remote_ip = rdst->remote_ip;
> + if (vxlan_addr_any(&remote_ip)) {
> if (did_rsc) {

Now we are making a copy of the remote_ip object on the stack, and
passing a reference to the stack copy to the vxlan_addr_any()
function. The existing code is passing a reference to the
original object, no copies.

This is not an improvement.