Commit 129fa44785a399248ae2466b6cb5c655e96668f7
Committed by
David S. Miller
1 parent
e5fd56ca4e
Exists in
master
and in
4 other branches
dccp: Integrate the TFRC library with DCCP
This patch integrates the TFRC library, which is a dependency of CCID-3 (and CCID-4), with the new use of CCIDs in the DCCP module. Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 12 changed files with 27 additions and 52 deletions Side-by-side Diff
net/dccp/Makefile
... | ... | @@ -8,6 +8,10 @@ |
8 | 8 | # CCID-2 is default (RFC 4340, p. 77) and has Ack Vectors as dependency |
9 | 9 | dccp-y += ccids/ccid2.o ackvec.o |
10 | 10 | dccp-$(CONFIG_IP_DCCP_CCID3) += ccids/ccid3.o |
11 | +dccp-$(CONFIG_IP_DCCP_TFRC_LIB) += ccids/lib/tfrc.o \ | |
12 | + ccids/lib/tfrc_equation.o \ | |
13 | + ccids/lib/packet_history.o \ | |
14 | + ccids/lib/loss_interval.o | |
11 | 15 | |
12 | 16 | dccp_ipv4-y := ipv4.o |
13 | 17 | |
... | ... | @@ -22,6 +26,4 @@ |
22 | 26 | |
23 | 27 | dccp_diag-y := diag.o |
24 | 28 | dccp_probe-y := probe.o |
25 | - | |
26 | -obj-y += ccids/ |
net/dccp/ccid.c
... | ... | @@ -12,6 +12,7 @@ |
12 | 12 | */ |
13 | 13 | |
14 | 14 | #include "ccid.h" |
15 | +#include "ccids/lib/tfrc.h" | |
15 | 16 | |
16 | 17 | static struct ccid_operations *ccids[] = { |
17 | 18 | &ccid2_ops, |
18 | 19 | |
... | ... | @@ -199,8 +200,11 @@ |
199 | 200 | |
200 | 201 | int __init ccid_initialize_builtins(void) |
201 | 202 | { |
202 | - int i, err; | |
203 | + int i, err = tfrc_lib_init(); | |
203 | 204 | |
205 | + if (err) | |
206 | + return err; | |
207 | + | |
204 | 208 | for (i = 0; i < ARRAY_SIZE(ccids); i++) { |
205 | 209 | err = ccid_activate(ccids[i]); |
206 | 210 | if (err) |
... | ... | @@ -211,6 +215,7 @@ |
211 | 215 | unwind_registrations: |
212 | 216 | while(--i >= 0) |
213 | 217 | ccid_deactivate(ccids[i]); |
218 | + tfrc_lib_exit(); | |
214 | 219 | return err; |
215 | 220 | } |
216 | 221 | |
... | ... | @@ -220,5 +225,6 @@ |
220 | 225 | |
221 | 226 | for (i = 0; i < ARRAY_SIZE(ccids); i++) |
222 | 227 | ccid_deactivate(ccids[i]); |
228 | + tfrc_lib_exit(); | |
223 | 229 | } |
net/dccp/ccids/Kconfig
... | ... | @@ -14,7 +14,6 @@ |
14 | 14 | config IP_DCCP_CCID3 |
15 | 15 | bool "CCID-3 (TCP-Friendly) (EXPERIMENTAL)" |
16 | 16 | def_bool y if (IP_DCCP = y || IP_DCCP = m) |
17 | - select IP_DCCP_TFRC_LIB | |
18 | 17 | ---help--- |
19 | 18 | CCID-3 denotes TCP-Friendly Rate Control (TFRC), an equation-based |
20 | 19 | rate-controlled congestion control mechanism. TFRC is designed to |
21 | 20 | |
... | ... | @@ -80,13 +79,9 @@ |
80 | 79 | therefore not be performed on WANs. |
81 | 80 | |
82 | 81 | config IP_DCCP_TFRC_LIB |
83 | - tristate | |
84 | - default n | |
82 | + def_bool y if IP_DCCP_CCID3 | |
85 | 83 | |
86 | 84 | config IP_DCCP_TFRC_DEBUG |
87 | - bool | |
88 | - depends on IP_DCCP_TFRC_LIB | |
89 | - default y if IP_DCCP_CCID3_DEBUG | |
90 | - | |
85 | + def_bool y if IP_DCCP_CCID3_DEBUG | |
91 | 86 | endmenu |
net/dccp/ccids/Makefile
1 | -obj-y += lib/ |
net/dccp/ccids/lib/Makefile
net/dccp/ccids/lib/loss_interval.c
... | ... | @@ -60,7 +60,6 @@ |
60 | 60 | lh->ring[LIH_INDEX(lh->counter)] = NULL; |
61 | 61 | } |
62 | 62 | } |
63 | -EXPORT_SYMBOL_GPL(tfrc_lh_cleanup); | |
64 | 63 | |
65 | 64 | static void tfrc_lh_calc_i_mean(struct tfrc_loss_hist *lh) |
66 | 65 | { |
... | ... | @@ -121,7 +120,6 @@ |
121 | 120 | |
122 | 121 | return (lh->i_mean < old_i_mean); |
123 | 122 | } |
124 | -EXPORT_SYMBOL_GPL(tfrc_lh_update_i_mean); | |
125 | 123 | |
126 | 124 | /* Determine if `new_loss' does begin a new loss interval [RFC 4342, 10.2] */ |
127 | 125 | static inline u8 tfrc_lh_is_new_loss(struct tfrc_loss_interval *cur, |
... | ... | @@ -169,7 +167,6 @@ |
169 | 167 | } |
170 | 168 | return 1; |
171 | 169 | } |
172 | -EXPORT_SYMBOL_GPL(tfrc_lh_interval_add); | |
173 | 170 | |
174 | 171 | int __init tfrc_li_init(void) |
175 | 172 | { |
net/dccp/ccids/lib/packet_history.c
... | ... | @@ -94,7 +94,6 @@ |
94 | 94 | *headp = entry; |
95 | 95 | return 0; |
96 | 96 | } |
97 | -EXPORT_SYMBOL_GPL(tfrc_tx_hist_add); | |
98 | 97 | |
99 | 98 | void tfrc_tx_hist_purge(struct tfrc_tx_hist_entry **headp) |
100 | 99 | { |
... | ... | @@ -109,7 +108,6 @@ |
109 | 108 | |
110 | 109 | *headp = NULL; |
111 | 110 | } |
112 | -EXPORT_SYMBOL_GPL(tfrc_tx_hist_purge); | |
113 | 111 | |
114 | 112 | u32 tfrc_tx_hist_rtt(struct tfrc_tx_hist_entry *head, const u64 seqno, |
115 | 113 | const ktime_t now) |
... | ... | @@ -127,7 +125,6 @@ |
127 | 125 | |
128 | 126 | return rtt; |
129 | 127 | } |
130 | -EXPORT_SYMBOL_GPL(tfrc_tx_hist_rtt); | |
131 | 128 | |
132 | 129 | |
133 | 130 | /* |
... | ... | @@ -172,7 +169,6 @@ |
172 | 169 | |
173 | 170 | tfrc_rx_hist_entry_from_skb(entry, skb, ndp); |
174 | 171 | } |
175 | -EXPORT_SYMBOL_GPL(tfrc_rx_hist_add_packet); | |
176 | 172 | |
177 | 173 | /* has the packet contained in skb been seen before? */ |
178 | 174 | int tfrc_rx_hist_duplicate(struct tfrc_rx_hist *h, struct sk_buff *skb) |
... | ... | @@ -189,7 +185,6 @@ |
189 | 185 | |
190 | 186 | return 0; |
191 | 187 | } |
192 | -EXPORT_SYMBOL_GPL(tfrc_rx_hist_duplicate); | |
193 | 188 | |
194 | 189 | static void tfrc_rx_hist_swap(struct tfrc_rx_hist *h, const u8 a, const u8 b) |
195 | 190 | { |
... | ... | @@ -390,7 +385,6 @@ |
390 | 385 | } |
391 | 386 | return is_new_loss; |
392 | 387 | } |
393 | -EXPORT_SYMBOL_GPL(tfrc_rx_handle_loss); | |
394 | 388 | |
395 | 389 | int tfrc_rx_hist_alloc(struct tfrc_rx_hist *h) |
396 | 390 | { |
... | ... | @@ -412,7 +406,6 @@ |
412 | 406 | } |
413 | 407 | return -ENOBUFS; |
414 | 408 | } |
415 | -EXPORT_SYMBOL_GPL(tfrc_rx_hist_alloc); | |
416 | 409 | |
417 | 410 | void tfrc_rx_hist_purge(struct tfrc_rx_hist *h) |
418 | 411 | { |
... | ... | @@ -424,7 +417,6 @@ |
424 | 417 | h->ring[i] = NULL; |
425 | 418 | } |
426 | 419 | } |
427 | -EXPORT_SYMBOL_GPL(tfrc_rx_hist_purge); | |
428 | 420 | |
429 | 421 | /** |
430 | 422 | * tfrc_rx_hist_rtt_last_s - reference entry to compute RTT samples against |
... | ... | @@ -495,5 +487,4 @@ |
495 | 487 | |
496 | 488 | return sample; |
497 | 489 | } |
498 | -EXPORT_SYMBOL_GPL(tfrc_rx_hist_sample_rtt); |
net/dccp/ccids/lib/tfrc.c
1 | 1 | /* |
2 | - * TFRC: main module holding the pieces of the TFRC library together | |
2 | + * TFRC library initialisation | |
3 | 3 | * |
4 | 4 | * Copyright (c) 2007 The University of Aberdeen, Scotland, UK |
5 | 5 | * Copyright (c) 2007 Arnaldo Carvalho de Melo <acme@redhat.com> |
6 | 6 | */ |
7 | -#include <linux/module.h> | |
8 | -#include <linux/moduleparam.h> | |
9 | 7 | #include "tfrc.h" |
10 | 8 | |
11 | 9 | #ifdef CONFIG_IP_DCCP_TFRC_DEBUG |
12 | 10 | int tfrc_debug; |
13 | 11 | module_param(tfrc_debug, bool, 0644); |
14 | -MODULE_PARM_DESC(tfrc_debug, "Enable debug messages"); | |
12 | +MODULE_PARM_DESC(tfrc_debug, "Enable TFRC debug messages"); | |
15 | 13 | #endif |
16 | 14 | |
17 | -static int __init tfrc_module_init(void) | |
15 | +int __init tfrc_lib_init(void) | |
18 | 16 | { |
19 | 17 | int rc = tfrc_li_init(); |
20 | 18 | |
21 | 19 | |
... | ... | @@ -38,19 +36,10 @@ |
38 | 36 | return rc; |
39 | 37 | } |
40 | 38 | |
41 | -static void __exit tfrc_module_exit(void) | |
39 | +void __exit tfrc_lib_exit(void) | |
42 | 40 | { |
43 | 41 | tfrc_rx_packet_history_exit(); |
44 | 42 | tfrc_tx_packet_history_exit(); |
45 | 43 | tfrc_li_exit(); |
46 | 44 | } |
47 | - | |
48 | -module_init(tfrc_module_init); | |
49 | -module_exit(tfrc_module_exit); | |
50 | - | |
51 | -MODULE_AUTHOR("Gerrit Renker <gerrit@erg.abdn.ac.uk>, " | |
52 | - "Ian McDonald <ian.mcdonald@jandi.co.nz>, " | |
53 | - "Arnaldo Carvalho de Melo <acme@redhat.com>"); | |
54 | -MODULE_DESCRIPTION("DCCP TFRC library"); | |
55 | -MODULE_LICENSE("GPL"); |
net/dccp/ccids/lib/tfrc.h
... | ... | @@ -17,7 +17,8 @@ |
17 | 17 | #include <linux/types.h> |
18 | 18 | #include <linux/math64.h> |
19 | 19 | #include "../../dccp.h" |
20 | -/* internal includes that this module exports: */ | |
20 | + | |
21 | +/* internal includes that this library exports: */ | |
21 | 22 | #include "loss_interval.h" |
22 | 23 | #include "packet_history.h" |
23 | 24 | |
... | ... | @@ -66,5 +67,13 @@ |
66 | 67 | |
67 | 68 | extern int tfrc_li_init(void); |
68 | 69 | extern void tfrc_li_exit(void); |
70 | + | |
71 | +#ifdef CONFIG_IP_DCCP_TFRC_LIB | |
72 | +extern int tfrc_lib_init(void); | |
73 | +extern void tfrc_lib_exit(void); | |
74 | +#else | |
75 | +#define tfrc_lib_init() (0) | |
76 | +#define tfrc_lib_exit() | |
77 | +#endif | |
69 | 78 | #endif /* _TFRC_H_ */ |
net/dccp/ccids/lib/tfrc_equation.c
... | ... | @@ -659,8 +659,6 @@ |
659 | 659 | return scaled_div32(result, f); |
660 | 660 | } |
661 | 661 | |
662 | -EXPORT_SYMBOL_GPL(tfrc_calc_x); | |
663 | - | |
664 | 662 | /** |
665 | 663 | * tfrc_calc_x_reverse_lookup - try to find p given f(p) |
666 | 664 | * |
... | ... | @@ -693,6 +691,4 @@ |
693 | 691 | index = tfrc_binsearch(fvalue, 0); |
694 | 692 | return (index + 1) * 1000000 / TFRC_CALC_X_ARRSIZE; |
695 | 693 | } |
696 | - | |
697 | -EXPORT_SYMBOL_GPL(tfrc_calc_x_reverse_lookup); |
net/dccp/feat.c
... | ... | @@ -1214,8 +1214,6 @@ |
1214 | 1214 | return NULL; |
1215 | 1215 | } |
1216 | 1216 | |
1217 | -EXPORT_SYMBOL_GPL(dccp_feat_typename); | |
1218 | - | |
1219 | 1217 | const char *dccp_feat_name(const u8 feat) |
1220 | 1218 | { |
1221 | 1219 | static const char *feature_names[] = { |
... | ... | @@ -1240,7 +1238,5 @@ |
1240 | 1238 | |
1241 | 1239 | return feature_names[feat]; |
1242 | 1240 | } |
1243 | - | |
1244 | -EXPORT_SYMBOL_GPL(dccp_feat_name); | |
1245 | 1241 | #endif /* CONFIG_IP_DCCP_DEBUG */ |
net/dccp/input.c