Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: remove unnecessary input parameter 'how' in ifdown function

When the ifdown function in the dst_ops structure is referenced, the input
parameter 'how' is always true. In the current implementation of the
ifdown interface, ip6_dst_ifdown does not use the input parameter 'how',
xfrm6_dst_ifdown and xfrm4_dst_ifdown functions use the input parameter
'unregister'. But false judgment on 'unregister' in xfrm6_dst_ifdown and
xfrm4_dst_ifdown is false, so remove the input parameter 'how' in ifdown
function.

Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230821084104.3812233-1-shaozhengchao@huawei.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Zhengchao Shao and committed by
Paolo Abeni
43c28172 3a198c95

+6 -20
+1 -1
include/net/dst_ops.h
··· 23 23 u32 * (*cow_metrics)(struct dst_entry *, unsigned long); 24 24 void (*destroy)(struct dst_entry *); 25 25 void (*ifdown)(struct dst_entry *, 26 - struct net_device *dev, int how); 26 + struct net_device *dev); 27 27 struct dst_entry * (*negative_advice)(struct dst_entry *); 28 28 void (*link_failure)(struct sk_buff *); 29 29 void (*update_pmtu)(struct dst_entry *dst, struct sock *sk,
+1 -1
net/core/dst.c
··· 152 152 153 153 dst->obsolete = DST_OBSOLETE_DEAD; 154 154 if (dst->ops->ifdown) 155 - dst->ops->ifdown(dst, dev, true); 155 + dst->ops->ifdown(dst, dev); 156 156 dst->input = dst_discard; 157 157 dst->output = dst_discard_out; 158 158 dst->dev = blackhole_netdev;
+1 -10
net/ipv4/xfrm4_policy.c
··· 124 124 xfrm_dst_destroy(xdst); 125 125 } 126 126 127 - static void xfrm4_dst_ifdown(struct dst_entry *dst, struct net_device *dev, 128 - int unregister) 129 - { 130 - if (!unregister) 131 - return; 132 - 133 - xfrm_dst_ifdown(dst, dev); 134 - } 135 - 136 127 static struct dst_ops xfrm4_dst_ops_template = { 137 128 .family = AF_INET, 138 129 .update_pmtu = xfrm4_update_pmtu, 139 130 .redirect = xfrm4_redirect, 140 131 .cow_metrics = dst_cow_metrics_generic, 141 132 .destroy = xfrm4_dst_destroy, 142 - .ifdown = xfrm4_dst_ifdown, 133 + .ifdown = xfrm_dst_ifdown, 143 134 .local_out = __ip_local_out, 144 135 .gc_thresh = 32768, 145 136 };
+2 -3
net/ipv6/route.c
··· 90 90 static struct dst_entry *ip6_negative_advice(struct dst_entry *); 91 91 static void ip6_dst_destroy(struct dst_entry *); 92 92 static void ip6_dst_ifdown(struct dst_entry *, 93 - struct net_device *dev, int how); 93 + struct net_device *dev); 94 94 static void ip6_dst_gc(struct dst_ops *ops); 95 95 96 96 static int ip6_pkt_discard(struct sk_buff *skb); ··· 371 371 fib6_info_release(from); 372 372 } 373 373 374 - static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev, 375 - int how) 374 + static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev) 376 375 { 377 376 struct rt6_info *rt = (struct rt6_info *)dst; 378 377 struct inet6_dev *idev = rt->rt6i_idev;
+1 -5
net/ipv6/xfrm6_policy.c
··· 124 124 xfrm_dst_destroy(xdst); 125 125 } 126 126 127 - static void xfrm6_dst_ifdown(struct dst_entry *dst, struct net_device *dev, 128 - int unregister) 127 + static void xfrm6_dst_ifdown(struct dst_entry *dst, struct net_device *dev) 129 128 { 130 129 struct xfrm_dst *xdst; 131 - 132 - if (!unregister) 133 - return; 134 130 135 131 xdst = (struct xfrm_dst *)dst; 136 132 if (xdst->u.rt6.rt6i_idev->dev == dev) {