Skip to content

Commit 210ffe4

Browse files
hormsummakynes
authored andcommitted
ipvs: Remove {Enter,Leave}Function
Remove EnterFunction and LeaveFunction. These debugging macros seem well past their use-by date. And seem to have little value these days. Removing them allows some trivial cleanup of some exit paths for some functions. These are also included in this patch. There is likely scope for further cleanup of both debugging and unwind paths. But let's leave that for another day. Only intended to change debug output, and only when CONFIG_IP_VS_DEBUG is enabled. Compile tested only. Signed-off-by: Simon Horman <[email protected]> Reviewed-by: Horatiu Vultur <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 2806549 commit 210ffe4

File tree

5 files changed

+9
-112
lines changed

5 files changed

+9
-112
lines changed

include/net/ip_vs.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -265,26 +265,6 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
265265
pr_err(msg, ##__VA_ARGS__); \
266266
} while (0)
267267

268-
#ifdef CONFIG_IP_VS_DEBUG
269-
#define EnterFunction(level) \
270-
do { \
271-
if (level <= ip_vs_get_debug_level()) \
272-
printk(KERN_DEBUG \
273-
pr_fmt("Enter: %s, %s line %i\n"), \
274-
__func__, __FILE__, __LINE__); \
275-
} while (0)
276-
#define LeaveFunction(level) \
277-
do { \
278-
if (level <= ip_vs_get_debug_level()) \
279-
printk(KERN_DEBUG \
280-
pr_fmt("Leave: %s, %s line %i\n"), \
281-
__func__, __FILE__, __LINE__); \
282-
} while (0)
283-
#else
284-
#define EnterFunction(level) do {} while (0)
285-
#define LeaveFunction(level) do {} while (0)
286-
#endif
287-
288268
/* The port number of FTP service (in network order). */
289269
#define FTPPORT cpu_to_be16(21)
290270
#define FTPDATA cpu_to_be16(20)

net/netfilter/ipvs/ip_vs_core.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,6 @@ struct ip_vs_conn *ip_vs_new_conn_out(struct ip_vs_service *svc,
11401140
__be16 vport;
11411141
unsigned int flags;
11421142

1143-
EnterFunction(12);
11441143
vaddr = &svc->addr;
11451144
vport = svc->port;
11461145
daddr = &iph->saddr;
@@ -1208,7 +1207,6 @@ struct ip_vs_conn *ip_vs_new_conn_out(struct ip_vs_service *svc,
12081207
IP_VS_DBG_ADDR(cp->af, &cp->vaddr), ntohs(cp->vport),
12091208
IP_VS_DBG_ADDR(cp->af, &cp->daddr), ntohs(cp->dport),
12101209
cp->flags, refcount_read(&cp->refcnt));
1211-
LeaveFunction(12);
12121210
return cp;
12131211
}
12141212

@@ -1316,13 +1314,11 @@ handle_response(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
13161314
ip_vs_update_conntrack(skb, cp, 0);
13171315
ip_vs_conn_put(cp);
13181316

1319-
LeaveFunction(11);
13201317
return NF_ACCEPT;
13211318

13221319
drop:
13231320
ip_vs_conn_put(cp);
13241321
kfree_skb(skb);
1325-
LeaveFunction(11);
13261322
return NF_STOLEN;
13271323
}
13281324

@@ -1341,8 +1337,6 @@ ip_vs_out_hook(void *priv, struct sk_buff *skb, const struct nf_hook_state *stat
13411337
int af = state->pf;
13421338
struct sock *sk;
13431339

1344-
EnterFunction(11);
1345-
13461340
/* Already marked as IPVS request or reply? */
13471341
if (skb->ipvs_property)
13481342
return NF_ACCEPT;
@@ -2365,7 +2359,6 @@ static void __net_exit __ip_vs_dev_cleanup_batch(struct list_head *net_list)
23652359
struct netns_ipvs *ipvs;
23662360
struct net *net;
23672361

2368-
EnterFunction(2);
23692362
list_for_each_entry(net, net_list, exit_list) {
23702363
ipvs = net_ipvs(net);
23712364
ip_vs_unregister_hooks(ipvs, AF_INET);
@@ -2374,7 +2367,6 @@ static void __net_exit __ip_vs_dev_cleanup_batch(struct list_head *net_list)
23742367
smp_wmb();
23752368
ip_vs_sync_net_cleanup(ipvs);
23762369
}
2377-
LeaveFunction(2);
23782370
}
23792371

23802372
static struct pernet_operations ipvs_core_ops = {

net/netfilter/ipvs/ip_vs_ctl.c

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,8 +1061,6 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest)
10611061
unsigned int atype;
10621062
int ret;
10631063

1064-
EnterFunction(2);
1065-
10661064
#ifdef CONFIG_IP_VS_IPV6
10671065
if (udest->af == AF_INET6) {
10681066
atype = ipv6_addr_type(&udest->addr.in6);
@@ -1111,7 +1109,6 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest)
11111109
spin_lock_init(&dest->dst_lock);
11121110
__ip_vs_update_dest(svc, dest, udest, 1);
11131111

1114-
LeaveFunction(2);
11151112
return 0;
11161113

11171114
err_stats:
@@ -1134,8 +1131,6 @@ ip_vs_add_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest)
11341131
__be16 dport = udest->port;
11351132
int ret;
11361133

1137-
EnterFunction(2);
1138-
11391134
if (udest->weight < 0) {
11401135
pr_err("%s(): server weight less than zero\n", __func__);
11411136
return -ERANGE;
@@ -1183,7 +1178,7 @@ ip_vs_add_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest)
11831178

11841179
ret = ip_vs_start_estimator(svc->ipvs, &dest->stats);
11851180
if (ret < 0)
1186-
goto err;
1181+
return ret;
11871182
__ip_vs_update_dest(svc, dest, udest, 1);
11881183
} else {
11891184
/*
@@ -1192,9 +1187,6 @@ ip_vs_add_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest)
11921187
ret = ip_vs_new_dest(svc, udest);
11931188
}
11941189

1195-
err:
1196-
LeaveFunction(2);
1197-
11981190
return ret;
11991191
}
12001192

@@ -1209,8 +1201,6 @@ ip_vs_edit_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest)
12091201
union nf_inet_addr daddr;
12101202
__be16 dport = udest->port;
12111203

1212-
EnterFunction(2);
1213-
12141204
if (udest->weight < 0) {
12151205
pr_err("%s(): server weight less than zero\n", __func__);
12161206
return -ERANGE;
@@ -1242,7 +1232,6 @@ ip_vs_edit_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest)
12421232
}
12431233

12441234
__ip_vs_update_dest(svc, dest, udest, 0);
1245-
LeaveFunction(2);
12461235

12471236
return 0;
12481237
}
@@ -1317,8 +1306,6 @@ ip_vs_del_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest)
13171306
struct ip_vs_dest *dest;
13181307
__be16 dport = udest->port;
13191308

1320-
EnterFunction(2);
1321-
13221309
/* We use function that requires RCU lock */
13231310
rcu_read_lock();
13241311
dest = ip_vs_lookup_dest(svc, udest->af, &udest->addr, dport);
@@ -1339,8 +1326,6 @@ ip_vs_del_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest)
13391326
*/
13401327
__ip_vs_del_dest(svc->ipvs, dest, false);
13411328

1342-
LeaveFunction(2);
1343-
13441329
return 0;
13451330
}
13461331

@@ -1746,15 +1731,13 @@ void ip_vs_service_nets_cleanup(struct list_head *net_list)
17461731
struct netns_ipvs *ipvs;
17471732
struct net *net;
17481733

1749-
EnterFunction(2);
17501734
/* Check for "full" addressed entries */
17511735
mutex_lock(&__ip_vs_mutex);
17521736
list_for_each_entry(net, net_list, exit_list) {
17531737
ipvs = net_ipvs(net);
17541738
ip_vs_flush(ipvs, true);
17551739
}
17561740
mutex_unlock(&__ip_vs_mutex);
1757-
LeaveFunction(2);
17581741
}
17591742

17601743
/* Put all references for device (dst_cache) */
@@ -1792,7 +1775,6 @@ static int ip_vs_dst_event(struct notifier_block *this, unsigned long event,
17921775
if (event != NETDEV_DOWN || !ipvs)
17931776
return NOTIFY_DONE;
17941777
IP_VS_DBG(3, "%s() dev=%s\n", __func__, dev->name);
1795-
EnterFunction(2);
17961778
mutex_lock(&__ip_vs_mutex);
17971779
for (idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) {
17981780
hlist_for_each_entry(svc, &ip_vs_svc_table[idx], s_list) {
@@ -1821,7 +1803,6 @@ static int ip_vs_dst_event(struct notifier_block *this, unsigned long event,
18211803
}
18221804
spin_unlock_bh(&ipvs->dest_trash_lock);
18231805
mutex_unlock(&__ip_vs_mutex);
1824-
LeaveFunction(2);
18251806
return NOTIFY_DONE;
18261807
}
18271808

@@ -4537,8 +4518,6 @@ int __init ip_vs_control_init(void)
45374518
int idx;
45384519
int ret;
45394520

4540-
EnterFunction(2);
4541-
45424521
/* Initialize svc_table, ip_vs_svc_fwm_table */
45434522
for (idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) {
45444523
INIT_HLIST_HEAD(&ip_vs_svc_table[idx]);
@@ -4551,15 +4530,12 @@ int __init ip_vs_control_init(void)
45514530
if (ret < 0)
45524531
return ret;
45534532

4554-
LeaveFunction(2);
45554533
return 0;
45564534
}
45574535

45584536

45594537
void ip_vs_control_cleanup(void)
45604538
{
4561-
EnterFunction(2);
45624539
unregister_netdevice_notifier(&ip_vs_dst_notifier);
45634540
/* relying on common rcu_barrier() in ip_vs_cleanup() */
4564-
LeaveFunction(2);
45654541
}

net/netfilter/ipvs/ip_vs_sync.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,13 +1582,11 @@ ip_vs_send_async(struct socket *sock, const char *buffer, const size_t length)
15821582
struct kvec iov;
15831583
int len;
15841584

1585-
EnterFunction(7);
15861585
iov.iov_base = (void *)buffer;
15871586
iov.iov_len = length;
15881587

15891588
len = kernel_sendmsg(sock, &msg, &iov, 1, (size_t)(length));
15901589

1591-
LeaveFunction(7);
15921590
return len;
15931591
}
15941592

@@ -1614,15 +1612,12 @@ ip_vs_receive(struct socket *sock, char *buffer, const size_t buflen)
16141612
struct kvec iov = {buffer, buflen};
16151613
int len;
16161614

1617-
EnterFunction(7);
1618-
16191615
/* Receive a packet */
16201616
iov_iter_kvec(&msg.msg_iter, ITER_DEST, &iov, 1, buflen);
16211617
len = sock_recvmsg(sock, &msg, MSG_DONTWAIT);
16221618
if (len < 0)
16231619
return len;
16241620

1625-
LeaveFunction(7);
16261621
return len;
16271622
}
16281623

0 commit comments

Comments
 (0)