1. 04 9月, 2008 7 次提交
    • G
      dccp: Add packet type information to CCID-specific option parsing · 3306c781
      Gerrit Renker 提交于
      This patch ...
       1. adds packet type information to ccid_hc_{rx,tx}_parse_options(). This is 
          necessary, since table 3 in RFC 4340, 5.8 leaves it to the CCIDs to state
          which options may (not) appear on what packet type.
       
       2. adds such a check for CCID-3's {Loss Event, Receive} Rate as specified in
          RFC 4340 8.3 ("Receive Rate options MUST NOT be sent on DCCP-Data packets")
          and 8.5 ("Loss Event Rate options MUST NOT be sent on DCCP-Data packets").
      
       3. removes an unused argument `idx' from ccid_hc_{rx,tx}_parse_options(). This
          is also no longer necessary, since the CCID-specific option-parsing routines
          are passed every single parameter of the type-length-value option encoding.
      
      Also added documentation and made argument naming scheme consistent.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      3306c781
    • G
      dccp ccid-3: Simplify and consolidate tx_parse_options · 47a61e7b
      Gerrit Renker 提交于
      This simplifies and consolidates the TX option-parsing code:
      
       1. The Loss Intervals option is not currently used, so dead code related to
          this option is removed. I am aware of no plans to support the option, but
          if someone wants to implement it (e.g. for inter-op tests), it is better
          to start afresh than having to also update currently unused code.
      
       2. The Loss Event and Receive Rate options have a lot of code in common (both
          are 32 bit, both have same length etc.), so this is consolidated.
      
       3. The test against GSR is not necessary, because
          - on first loading CCID3, ccid_new() zeroes out all fields in the socket; 
          - ccid3_hc_tx_packet_recv() treats 0 and ~0U equivalently, due to
      
      	pinv = opt_recv->ccid3or_loss_event_rate;
      	if (pinv == ~0U || pinv == 0)
      		hctx->p = 0;
      
          - as a result, the sequence number field is removed from opt_recv.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      47a61e7b
    • G
      dccp ccid-3: Remove ugly RTT-sampling history lookup · 63b3a73b
      Gerrit Renker 提交于
      This removes the RTT-sampling function tfrc_tx_hist_rtt(), since
      
       1. it suffered from complex passing of return values (the return value both
          indicated successful lookup while the value doubled as RTT sample);
      
       2. when for some odd reason the sample value equalled 0, this triggered a bug
          warning about "bogus Ack", due to the ambiguity of the return value;
      
       3. on a passive host which has not sent anything the TX history is empty and
          thus will lead to unwanted "bogus Ack" warnings such as
          ccid3_hc_tx_packet_recv: server(e7b7d518): DATAACK with bogus ACK-28197148
          ccid3_hc_tx_packet_recv: server(e7b7d518): DATAACK with bogus ACK-26641606.
      
      The fix is to replace the implicit encoding by performing the steps manually.					       
      
      Furthermore, the "bogus Ack" warning has been removed, since it can actually be
      triggered due to several reasons (network reordering, old packet, (3) above),
      hence it is not very useful.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      63b3a73b
    • G
      dccp ccid-3: Bug fix for the inter-packet scheduling algorithm · de6f2b59
      Gerrit Renker 提交于
      This fixes a subtle bug in the calculation of the inter-packet gap and shows
      that t_delta, as it is currently used, is not needed. And hence replaced.
      
      The algorithm from RFC 3448, 4.6 below continually computes a send time t_nom,
      which is initialised with the current time t_now; t_gran = 1E6 / HZ specifies
      the scheduling granularity, s the packet size, and X the sending rate:
      
        t_distance = t_nom - t_now;		// in microseconds
        t_delta    = min(t_ipi, t_gran) / 2;	// `delta' parameter in microseconds
      
        if (t_distance >= t_delta) {
      	reschedule after (t_distance / 1000) milliseconds;
        } else {
        	t_ipi  = s / X;			// inter-packet interval in usec
      	t_nom += t_ipi;			// compute the next send time
      	send packet now;
        }
      
      
      1) Description of the bug
      -------------------------
      Rescheduling requires a conversion into milliseconds, due to this call chain:
      
       * ccid3_hc_tx_send_packet() returns a timeout in milliseconds,
       * this value is converted by msecs_to_jiffies() in dccp_write_xmit(),
       * and finally used as jiffy-expires-value for sk_reset_timer().
      
      The highest jiffy resolution with HZ=1000 is 1 millisecond, so using a higher
      granularity does not make much sense here.
      
      As a consequence, values of t_distance < 1000 are truncated to 0. This issue 
      has so far been resolved by using instead
      
        if (t_distance >= t_delta + 1000)
      	reschedule after (t_distance / 1000) milliseconds;
      
      The bug is in artificially inflating t_delta to t_delta' = t_delta + 1000. This
      is unnecessarily large, a more adequate value is t_delta' = max(t_delta, 1000).
      
      
      2) Consequences of using the corrected t_delta'
      -----------------------------------------------
      Since t_delta <= t_gran/2 = 10^6/(2*HZ), we have t_delta <= 1000 as long as
      HZ >= 500. This means that t_delta' = max(1000, t_delta) is constant at 1000.
      
      On the other hand, when using a coarse HZ value of HZ < 500, we have three
      sub-cases that can all be reduced to using another constant of t_gran/2.
      
       (a) The first case arises when t_ipi > t_gran. Here t_delta' is the constant
           t_delta' = max(1000, t_gran/2) = t_gran/2.
      
       (b) If t_ipi <= 2000 < t_gran = 10^6/HZ usec, then t_delta = t_ipi/2 <= 1000,
           so that t_delta' = max(1000, t_delta) = 1000 < t_gran/2. 
      
       (c) If 2000 < t_ipi <= t_gran, we have t_delta' = max(t_delta, 1000) = t_ipi/2.
      
      In the second and third cases we have delay values less than t_gran/2, which is
      in the order of less than or equal to half a jiffy. 
      
      How these are treated depends on how fractions of a jiffy are handled: they
      are either always rounded down to 0, or always rounded up to 1 jiffy (assuming
      non-zero values). In both cases the error is on average in the order of 50%.
      
      Thus we are not increasing the error when in the second/third case we replace
      a value less than t_gran/2 with 0, by setting t_delta' to the constant t_gran/2.
      
      
      3) Summary
      ----------
      Fixing (1) and considering (2), the patch replaces t_delta with a constant,
      whose value depends on CONFIG_HZ, changing the above algorithm to:
       
        if (t_distance >= t_delta')
      	reschedule after (t_distance / 1000) milliseconds;
      
      where t_delta' = 10^6/(2*HZ) if HZ < 500, and t_delta' = 1000 otherwise.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      de6f2b59
    • G
      dccp ccid-3: No more CCID control blocks in LISTEN state · b2e317f4
      Gerrit Renker 提交于
      The CCIDs are activated as last of the features, at the end of the handshake,
      were the LISTEN state of the master socket is inherited into the server
      state of the child socket. Thus, the only states visible to CCIDs now are
      OPEN/PARTOPEN, and the closing states.
      
      This allows to remove tests which were previously necessary to protect
      against referencing a socket in the listening state (in CCID3), but which
      now have become redundant.
      
      As a further byproduct of enabling the CCIDs only after the connection has been
      fully established, several typecast-initialisations of ccid3_hc_{rx,tx}_sock
      can now be eliminated:
       * the CCID is loaded, so it is not necessary to test if it is NULL,
       * if it is possible to load a CCID and leave the private area NULL, then this
          is a bug, which should crash loudly - and earlier,
       * the test for state==OPEN || state==PARTOPEN now reduces only to the closing
         phase (e.g. when the node has received an unexpected Reset).		  
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Acked-by: NIan McDonald <ian.mcdonald@jandi.co.nz>
      b2e317f4
    • G
      dccp ccid-3: Remove ccid3hc{tx,rx}_ prefixes · 842d1ef1
      Gerrit Renker 提交于
      This patch does the same for CCID-3 as the previous patch for CCID-2:
      
              s#ccid3hctx_##g;
              s#ccid3hcrx_##g;
      
      plus manual editing to retain consistency.
      
      Please note: expanded the fields of the `struct tfrc_tx_info' in the hc_tx_sock,
      since using short #define identifiers is not a good idea. The only place where
      this embedded struct was used is ccid3_hc_tx_getsockopt().
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      842d1ef1
    • G
      dccp: Toggle debug output without module unloading · 43264991
      Gerrit Renker 提交于
      This sets the sysfs permissions so that root can toggle the `debug'
      parameter available for nearly every DCCP module. This is useful 
      since there are various module inter-dependencies. The debug flag
      can now be toggled at runtime using
      
        echo 1 > /sys/module/dccp/parameters/dccp_debug
        echo 1 > /sys/module/dccp_ccid2/parameters/ccid2_debug
        echo 1 > /sys/module/dccp_ccid3/parameters/ccid3_debug
        echo 1 > /sys/module/dccp_tfrc_lib/parameters/tfrc_debug
      
      The last is not very useful yet, since no code at the moment calls
      the tfrc_debug() macro.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      43264991
  2. 13 7月, 2008 2 次提交
    • G
      dccp ccid-3: Fix a loss detection bug · b552c623
      Gerrit Renker 提交于
      This fixes a bug in the logic of the TFRC loss detection:
       * new_loss_indicated() should not be called while a loss is pending;
       * but the code allows this;
       * thus, for two subsequent gaps in the sequence space, when loss_count
         has not yet reached NDUPACK=3, the loss_count is falsely reduced to 1.
      
      To avoid further and similar problems, all loss handling and loss detection is
      now done inside tfrc_rx_hist_handle_loss(), using an appropriate routine to
      track new losses.
      
      Further changes:
      ----------------
       * added a reminder that no RX history operations should be performed when
         rx_handle_loss() has identified a (new) loss, since the function takes
         care of packet reordering during loss detection;
       * made tfrc_rx_hist_loss_pending() bool (thanks to an earlier suggestion
         by Arnaldo);		 
       * removed unused functions.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      b552c623
    • G
      dccp: Upgrade NDP count from 3 to 6 bytes · 5b5d0e70
      Gerrit Renker 提交于
      RFC 4340, 7.7 specifies up to 6 bytes for the NDP Count option, whereas the code
      is currently limited to up to 3 bytes. This seems to be a relict of an earlier 
      draft version and is brought up to date by the patch.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      5b5d0e70
  3. 11 6月, 2008 2 次提交
    • G
      dccp: Fix sparse warnings · 1e2f0e5e
      Gerrit Renker 提交于
      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: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      1e2f0e5e
    • G
      dccp ccid-3: Bug-Fix - Zero RTT is possible · 3294f202
      Gerrit Renker 提交于
      In commit $(825de27d) (from 27th May, commit
      message `dccp ccid-3: Fix "t_ipi explosion" bug'), the CCID-3 window counter
      computation was fixed to cope with RTTs < 4 microseconds.
      
      Such RTTs can be found e.g. when running CCID-3 over loopback. The fix removed
      a check against RTT < 4, but introduced a divide-by-zero bug.
      
      All steady-state RTTs in DCCP are filtered using dccp_sample_rtt(), which
      ensures non-zero samples. However, a zero RTT is possible on initialisation,
      when there is no RTT sample from the Request/Response exchange.
      
      The fix is to use the fallback-RTT from RFC 4340, 3.4.
      
      This is also better than just fixing update_win_count() since it allows other
      parts of the code to always assume that the RTT is non-zero during the time
      that the CCID is used.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      3294f202
  4. 27 5月, 2008 1 次提交
    • G
      dccp ccid-3: Fix "t_ipi explosion" bug · 825de27d
      Gerrit Renker 提交于
      The identification of this bug is thanks to Cheng Wei and Tomasz
      Grobelny.
      
      To avoid divide-by-zero, the implementation previously ignored RTTs
      smaller than 4 microseconds when performing integer division RTT/4.
      
      When the RTT reached a value less than 4 microseconds (as observed on
      loopback), this prevented the Window Counter CCVal value from
      advancing. As a result, the receiver stopped sending feedback. This in
      turn caused non-ending expiries of the nofeedback timer at the sender,
      so that the sending rate was progressively reduced until reaching the
      minimum of one packet per 64 seconds.
      
      The patch fixes this bug by handling integer division more
      intelligently. Due to consistent use of dccp_sample_rtt(),
      divide-by-zero-RTT is avoided.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      825de27d
  5. 03 5月, 2008 1 次提交
  6. 29 1月, 2008 20 次提交
  7. 21 12月, 2007 1 次提交
  8. 24 10月, 2007 2 次提交
  9. 11 10月, 2007 4 次提交