Messages in this thread Patch in this message | ![/](/images/icornerl.gif) | | Date | Sun, 18 Feb 2024 08:35:51 -0500 | From | Oliver Crumrine <> | Subject | [PATCH net-next] net: copy routing table more efficiently in rt_dst_clone |
| |
Instead of copying field-by-field, copy the entire struct at once. This should lead to a performance improvment in rt_dst_clone.
Signed-off-by: Oliver Crumrine <ozlinuxc@gmail.com> --- net/ipv4/route.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 16615d107cf0..ebb17c3a0dec 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -1664,22 +1664,8 @@ struct rtable *rt_dst_clone(struct net_device *dev, struct rtable *rt) rt->dst.flags); if (new_rt) { + *new_rt = *rt; new_rt->rt_genid = rt_genid_ipv4(dev_net(dev)); - new_rt->rt_flags = rt->rt_flags; - new_rt->rt_type = rt->rt_type; - new_rt->rt_is_input = rt->rt_is_input; - new_rt->rt_iif = rt->rt_iif; - new_rt->rt_pmtu = rt->rt_pmtu; - new_rt->rt_mtu_locked = rt->rt_mtu_locked; - new_rt->rt_gw_family = rt->rt_gw_family; - if (rt->rt_gw_family == AF_INET) - new_rt->rt_gw4 = rt->rt_gw4; - else if (rt->rt_gw_family == AF_INET6) - new_rt->rt_gw6 = rt->rt_gw6; - - new_rt->dst.input = rt->dst.input; - new_rt->dst.output = rt->dst.output; - new_rt->dst.error = rt->dst.error; new_rt->dst.lastuse = jiffies; new_rt->dst.lwtstate = lwtstate_get(rt->dst.lwtstate); } -- 2.43.0
| ![\](/images/icornerr.gif) |