aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/ip_vs.h
diff options
context:
space:
mode:
authorJesper Dangaard Brouer <brouer@redhat.com>2012-09-26 08:07:17 -0400
committerSimon Horman <horms@verge.net.au>2012-09-27 22:34:33 -0400
commitd4383f04d145cce8b855c463f40020639ef83ea0 (patch)
tree7807b2b3114fc25c03eb3d3741f9b6d1b17aedfe /include/net/ip_vs.h
parent2f74713d1436b7d2d0506ba1bc5f10915a73bbec (diff)
ipvs: API change to avoid rescan of IPv6 exthdr
Reduce the number of times we scan/skip the IPv6 exthdrs. This patch contains a lot of API changes. This is done, to avoid repeating the scan of finding the IPv6 headers, via ipv6_find_hdr(), which is called by ip_vs_fill_iph_skb(). Finding the IPv6 headers is done as early as possible, and passed on as a pointer "struct ip_vs_iphdr *" to the affected functions. This patch reduce/removes 19 calls to ip_vs_fill_iph_skb(). Notice, I have choosen, not to change the API of function pointer "(*schedule)" (in struct ip_vs_scheduler) as it can be used by external schedulers, via {un,}register_ip_vs_scheduler. Only 4 out of 10 schedulers use info from ip_vs_iphdr*, and when they do, they are only interested in iph->{s,d}addr. Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com> Acked-by: Julian Anastasov <ja@ssi.bg> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'include/net/ip_vs.h')
-rw-r--r--include/net/ip_vs.h81
1 files changed, 41 insertions, 40 deletions
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 98806b64bef3..a681ad65b735 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -487,27 +487,26 @@ struct ip_vs_protocol {
487 487
488 int (*conn_schedule)(int af, struct sk_buff *skb, 488 int (*conn_schedule)(int af, struct sk_buff *skb,
489 struct ip_vs_proto_data *pd, 489 struct ip_vs_proto_data *pd,
490 int *verdict, struct ip_vs_conn **cpp); 490 int *verdict, struct ip_vs_conn **cpp,
491 struct ip_vs_iphdr *iph);
491 492
492 struct ip_vs_conn * 493 struct ip_vs_conn *
493 (*conn_in_get)(int af, 494 (*conn_in_get)(int af,
494 const struct sk_buff *skb, 495 const struct sk_buff *skb,
495 const struct ip_vs_iphdr *iph, 496 const struct ip_vs_iphdr *iph,
496 unsigned int proto_off,
497 int inverse); 497 int inverse);
498 498
499 struct ip_vs_conn * 499 struct ip_vs_conn *
500 (*conn_out_get)(int af, 500 (*conn_out_get)(int af,
501 const struct sk_buff *skb, 501 const struct sk_buff *skb,
502 const struct ip_vs_iphdr *iph, 502 const struct ip_vs_iphdr *iph,
503 unsigned int proto_off,
504 int inverse); 503 int inverse);
505 504
506 int (*snat_handler)(struct sk_buff *skb, 505 int (*snat_handler)(struct sk_buff *skb, struct ip_vs_protocol *pp,
507 struct ip_vs_protocol *pp, struct ip_vs_conn *cp); 506 struct ip_vs_conn *cp, struct ip_vs_iphdr *iph);
508 507
509 int (*dnat_handler)(struct sk_buff *skb, 508 int (*dnat_handler)(struct sk_buff *skb, struct ip_vs_protocol *pp,
510 struct ip_vs_protocol *pp, struct ip_vs_conn *cp); 509 struct ip_vs_conn *cp, struct ip_vs_iphdr *iph);
511 510
512 int (*csum_check)(int af, struct sk_buff *skb, 511 int (*csum_check)(int af, struct sk_buff *skb,
513 struct ip_vs_protocol *pp); 512 struct ip_vs_protocol *pp);
@@ -607,7 +606,7 @@ struct ip_vs_conn {
607 NF_ACCEPT can be returned when destination is local. 606 NF_ACCEPT can be returned when destination is local.
608 */ 607 */
609 int (*packet_xmit)(struct sk_buff *skb, struct ip_vs_conn *cp, 608 int (*packet_xmit)(struct sk_buff *skb, struct ip_vs_conn *cp,
610 struct ip_vs_protocol *pp); 609 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
611 610
612 /* Note: we can group the following members into a structure, 611 /* Note: we can group the following members into a structure,
613 in order to save more space, and the following members are 612 in order to save more space, and the following members are
@@ -858,13 +857,11 @@ struct ip_vs_app {
858 857
859 struct ip_vs_conn * 858 struct ip_vs_conn *
860 (*conn_in_get)(const struct sk_buff *skb, struct ip_vs_app *app, 859 (*conn_in_get)(const struct sk_buff *skb, struct ip_vs_app *app,
861 const struct iphdr *iph, unsigned int proto_off, 860 const struct iphdr *iph, int inverse);
862 int inverse);
863 861
864 struct ip_vs_conn * 862 struct ip_vs_conn *
865 (*conn_out_get)(const struct sk_buff *skb, struct ip_vs_app *app, 863 (*conn_out_get)(const struct sk_buff *skb, struct ip_vs_app *app,
866 const struct iphdr *iph, unsigned int proto_off, 864 const struct iphdr *iph, int inverse);
867 int inverse);
868 865
869 int (*state_transition)(struct ip_vs_conn *cp, int direction, 866 int (*state_transition)(struct ip_vs_conn *cp, int direction,
870 const struct sk_buff *skb, 867 const struct sk_buff *skb,
@@ -1163,14 +1160,12 @@ struct ip_vs_conn *ip_vs_ct_in_get(const struct ip_vs_conn_param *p);
1163 1160
1164struct ip_vs_conn * ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb, 1161struct ip_vs_conn * ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb,
1165 const struct ip_vs_iphdr *iph, 1162 const struct ip_vs_iphdr *iph,
1166 unsigned int proto_off,
1167 int inverse); 1163 int inverse);
1168 1164
1169struct ip_vs_conn *ip_vs_conn_out_get(const struct ip_vs_conn_param *p); 1165struct ip_vs_conn *ip_vs_conn_out_get(const struct ip_vs_conn_param *p);
1170 1166
1171struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb, 1167struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb,
1172 const struct ip_vs_iphdr *iph, 1168 const struct ip_vs_iphdr *iph,
1173 unsigned int proto_off,
1174 int inverse); 1169 int inverse);
1175 1170
1176/* put back the conn without restarting its timer */ 1171/* put back the conn without restarting its timer */
@@ -1343,9 +1338,10 @@ extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name);
1343extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler); 1338extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler);
1344extern struct ip_vs_conn * 1339extern struct ip_vs_conn *
1345ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb, 1340ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb,
1346 struct ip_vs_proto_data *pd, int *ignored); 1341 struct ip_vs_proto_data *pd, int *ignored,
1342 struct ip_vs_iphdr *iph);
1347extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, 1343extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
1348 struct ip_vs_proto_data *pd); 1344 struct ip_vs_proto_data *pd, struct ip_vs_iphdr *iph);
1349 1345
1350extern void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg); 1346extern void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg);
1351 1347
@@ -1404,33 +1400,38 @@ extern void ip_vs_read_estimator(struct ip_vs_stats_user *dst,
1404/* 1400/*
1405 * Various IPVS packet transmitters (from ip_vs_xmit.c) 1401 * Various IPVS packet transmitters (from ip_vs_xmit.c)
1406 */ 1402 */
1407extern int ip_vs_null_xmit 1403extern int ip_vs_null_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1408(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1404 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1409extern int ip_vs_bypass_xmit 1405extern int ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1410(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1406 struct ip_vs_protocol *pp,
1411extern int ip_vs_nat_xmit 1407 struct ip_vs_iphdr *iph);
1412(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1408extern int ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1413extern int ip_vs_tunnel_xmit 1409 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1414(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1410extern int ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1415extern int ip_vs_dr_xmit 1411 struct ip_vs_protocol *pp,
1416(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1412 struct ip_vs_iphdr *iph);
1417extern int ip_vs_icmp_xmit 1413extern int ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1418(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp, 1414 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1419 int offset, unsigned int hooknum); 1415extern int ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1416 struct ip_vs_protocol *pp, int offset,
1417 unsigned int hooknum, struct ip_vs_iphdr *iph);
1420extern void ip_vs_dst_reset(struct ip_vs_dest *dest); 1418extern void ip_vs_dst_reset(struct ip_vs_dest *dest);
1421 1419
1422#ifdef CONFIG_IP_VS_IPV6 1420#ifdef CONFIG_IP_VS_IPV6
1423extern int ip_vs_bypass_xmit_v6 1421extern int ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1424(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1422 struct ip_vs_protocol *pp,
1425extern int ip_vs_nat_xmit_v6 1423 struct ip_vs_iphdr *iph);
1426(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1424extern int ip_vs_nat_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1427extern int ip_vs_tunnel_xmit_v6 1425 struct ip_vs_protocol *pp,
1428(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1426 struct ip_vs_iphdr *iph);
1429extern int ip_vs_dr_xmit_v6 1427extern int ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1430(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1428 struct ip_vs_protocol *pp,
1431extern int ip_vs_icmp_xmit_v6 1429 struct ip_vs_iphdr *iph);
1432(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp, 1430extern int ip_vs_dr_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1433 int offset, unsigned int hooknum); 1431 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1432extern int ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1433 struct ip_vs_protocol *pp, int offset,
1434 unsigned int hooknum, struct ip_vs_iphdr *iph);
1434#endif 1435#endif
1435 1436
1436#ifdef CONFIG_SYSCTL 1437#ifdef CONFIG_SYSCTL