Commit 1e2f0e5e8376f2a0ada8760fc9d3104e1a81382b

Authored by Gerrit Renker
1 parent 3294f202dc

dccp: Fix sparse warnings

This patch fixes the following sparse warnings:
 * nested min(max()) expression:
   net/dccp/ccids/ccid3.c:91:21: warning: symbol '__x' shadows an earlier one
   net/dccp/ccids/ccid3.c:91:21: warning: symbol '__y' shadows an earlier one

 * Declaration of function prototypes in .c instead of .h file, resulting in
   "should it be static?" warnings.

 * Declared "struct dccpw" static (local to dccp_probe).

 * Disabled dccp_delayed_ack() - not fully removed due to RFC 4340, 11.3
   ("Receivers SHOULD implement delayed acknowledgement timers ...").

 * Used a different local variable name to avoid
   net/dccp/ackvec.c:293:13: warning: symbol 'state' shadows an earlier one
   net/dccp/ackvec.c:238:33: originally declared here

 * Removed unused functions `dccp_ackvector_print' and `dccp_ackvec_print'.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>

Showing 6 changed files with 16 additions and 40 deletions Side-by-side Diff

... ... @@ -290,12 +290,12 @@
290 290  
291 291 while (1) {
292 292 const u8 len = dccp_ackvec_len(av, index);
293   - const u8 state = dccp_ackvec_state(av, index);
  293 + const u8 av_state = dccp_ackvec_state(av, index);
294 294 /*
295 295 * valid packets not yet in av_buf have a reserved
296 296 * entry, with a len equal to 0.
297 297 */
298   - if (state == DCCP_ACKVEC_STATE_NOT_RECEIVED &&
  298 + if (av_state == DCCP_ACKVEC_STATE_NOT_RECEIVED &&
299 299 len == 0 && delta == 0) { /* Found our
300 300 reserved seat! */
301 301 dccp_pr_debug("Found %llu reserved seat!\n",
... ... @@ -324,31 +324,6 @@
324 324 "packet: %llu\n", (unsigned long long)ackno);
325 325 return -EILSEQ;
326 326 }
327   -
328   -#ifdef CONFIG_IP_DCCP_DEBUG
329   -void dccp_ackvector_print(const u64 ackno, const unsigned char *vector, int len)
330   -{
331   - dccp_pr_debug_cat("ACK vector len=%d, ackno=%llu |", len,
332   - (unsigned long long)ackno);
333   -
334   - while (len--) {
335   - const u8 state = (*vector & DCCP_ACKVEC_STATE_MASK) >> 6;
336   - const u8 rl = *vector & DCCP_ACKVEC_LEN_MASK;
337   -
338   - dccp_pr_debug_cat("%d,%d|", state, rl);
339   - ++vector;
340   - }
341   -
342   - dccp_pr_debug_cat("\n");
343   -}
344   -
345   -void dccp_ackvec_print(const struct dccp_ackvec *av)
346   -{
347   - dccp_ackvector_print(av->av_buf_ackno,
348   - av->av_buf + av->av_buf_head,
349   - av->av_vec_len);
350   -}
351   -#endif
352 327  
353 328 static void dccp_ackvec_throw_record(struct dccp_ackvec *av,
354 329 struct dccp_ackvec_record *avr)
net/dccp/ccids/ccid3.c
... ... @@ -159,8 +159,8 @@
159 159 } else if (ktime_us_delta(now, hctx->ccid3hctx_t_ld)
160 160 - (s64)hctx->ccid3hctx_rtt >= 0) {
161 161  
162   - hctx->ccid3hctx_x =
163   - max(min(2 * hctx->ccid3hctx_x, min_rate),
  162 + hctx->ccid3hctx_x = min(2 * hctx->ccid3hctx_x, min_rate);
  163 + hctx->ccid3hctx_x = max(hctx->ccid3hctx_x,
164 164 scaled_div(((__u64)hctx->ccid3hctx_s) << 6,
165 165 hctx->ccid3hctx_rtt));
166 166 hctx->ccid3hctx_t_ld = now;
net/dccp/ccids/lib/tfrc.c
... ... @@ -14,14 +14,6 @@
14 14 MODULE_PARM_DESC(tfrc_debug, "Enable debug messages");
15 15 #endif
16 16  
17   -extern int tfrc_tx_packet_history_init(void);
18   -extern void tfrc_tx_packet_history_exit(void);
19   -extern int tfrc_rx_packet_history_init(void);
20   -extern void tfrc_rx_packet_history_exit(void);
21   -
22   -extern int tfrc_li_init(void);
23   -extern void tfrc_li_exit(void);
24   -
25 17 static int __init tfrc_module_init(void)
26 18 {
27 19 int rc = tfrc_li_init();
net/dccp/ccids/lib/tfrc.h
... ... @@ -58,8 +58,15 @@
58 58 return avg ? (weight * avg + (10 - weight) * newval) / 10 : newval;
59 59 }
60 60  
61   -extern u32 tfrc_calc_x(u16 s, u32 R, u32 p);
62   -extern u32 tfrc_calc_x_reverse_lookup(u32 fvalue);
  61 +extern u32 tfrc_calc_x(u16 s, u32 R, u32 p);
  62 +extern u32 tfrc_calc_x_reverse_lookup(u32 fvalue);
63 63  
  64 +extern int tfrc_tx_packet_history_init(void);
  65 +extern void tfrc_tx_packet_history_exit(void);
  66 +extern int tfrc_rx_packet_history_init(void);
  67 +extern void tfrc_rx_packet_history_exit(void);
  68 +
  69 +extern int tfrc_li_init(void);
  70 +extern void tfrc_li_exit(void);
64 71 #endif /* _TFRC_H_ */
... ... @@ -508,6 +508,7 @@
508 508  
509 509 EXPORT_SYMBOL_GPL(dccp_send_ack);
510 510  
  511 +#if 0
511 512 /* FIXME: Is this still necessary (11.3) - currently nowhere used by DCCP. */
512 513 void dccp_send_delayed_ack(struct sock *sk)
513 514 {
... ... @@ -538,6 +539,7 @@
538 539 icsk->icsk_ack.timeout = timeout;
539 540 sk_reset_timer(sk, &icsk->icsk_delack_timer, timeout);
540 541 }
  542 +#endif
541 543  
542 544 void dccp_send_sync(struct sock *sk, const u64 ackno,
543 545 const enum dccp_pkt_type pkt_type)
... ... @@ -42,7 +42,7 @@
42 42  
43 43 static const char procname[] = "dccpprobe";
44 44  
45   -struct {
  45 +static struct {
46 46 struct kfifo *fifo;
47 47 spinlock_t lock;
48 48 wait_queue_head_t wait;