1. 09 9月, 2008 10 次提交
    • G
      This reverts "Merge branch 'dccp' of git://eden-feed.erg.abdn.ac.uk/dccp_exp" · 410e27a4
      Gerrit Renker 提交于
      as it accentally contained the wrong set of patches. These will be
      submitted separately.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      410e27a4
    • A
    • A
      netns bridge: allow bridges in netns! · 4aa678ba
      Alexey Dobriyan 提交于
      Bridge as netdevice doesn't cross netns boundaries.
      
      Bridge ports and bridge itself live in same netns.
      
      Notifiers are fixed.
      
      netns propagated from userspace socket for setup and teardown.
      Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Acked-by: NStephen Hemminger <shemming@vyatta.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4aa678ba
    • A
      warn: Turn the netdev timeout WARN_ON() into a WARN() · 5337407c
      Arjan van de Ven 提交于
      this patch turns the netdev timeout WARN_ON_ONCE() into a WARN_ONCE(),
      so that the device and driver names are inside the warning message.
      This helps automated tools like kerneloops.org to collect the data
      and do statistics, as well as making it more likely that humans
      cut-n-paste the important message as part of a bugreport.
      Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5337407c
    • H
      net: Enable TSO if supported by at least one device · e2a6b852
      Herbert Xu 提交于
      As it stands users of netdev_compute_features (e.g., bridges/bonding)
      will only enable TSO if all consituent devices support it.  This
      is unnecessarily pessimistic since even on devices that do not
      support hardware TSO and SG, emulated TSO still performs to a par
      with TSO off.
      
      This patch enables TSO if at least on constituent device supports
      it in hardware.
      
      The direct beneficiaries will be virtualisation that uses bridging
      since this means that TSO will always be enabled for communication
      from the host to the guests.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e2a6b852
    • S
      bridge: don't allow setting hello time to zero · 8d4698f7
      Stephen Hemminger 提交于
      Dushan Tcholich reports that on his system ksoftirqd can consume
      between %6 to %10 of cpu time, and cause ~200 context switches per
      second.
      
      He then correlated this with a report by bdupree@techfinesse.com:
      
      	http://marc.info/?l=linux-kernel&m=119613299024398&w=2
      
      and the culprit cause seems to be starting the bridge interface.
      In particular, when starting the bridge interface, his scripts
      are specifying a hello timer interval of "0".
      
      The bridge hello time can't be safely set to values less than 1
      second, otherwise it is possible to end up with a runaway timer.
      Signed-off-by: NStephen Hemminger <shemminger@vyatta.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8d4698f7
    • D
      netns : fix kernel panic in timewait socket destruction · d315492b
      Daniel Lezcano 提交于
      How to reproduce ?
       - create a network namespace
       - use tcp protocol and get timewait socket
       - exit the network namespace
       - after a moment (when the timewait socket is destroyed), the kernel
         panics.
      
      # BUG: unable to handle kernel NULL pointer dereference at
      0000000000000007
      IP: [<ffffffff821e394d>] inet_twdr_do_twkill_work+0x6e/0xb8
      PGD 119985067 PUD 11c5c0067 PMD 0
      Oops: 0000 [1] SMP
      CPU 1
      Modules linked in: ipv6 button battery ac loop dm_mod tg3 libphy ext3 jbd
      edd fan thermal processor thermal_sys sg sata_svw libata dock serverworks
      sd_mod scsi_mod ide_disk ide_core [last unloaded: freq_table]
      Pid: 0, comm: swapper Not tainted 2.6.27-rc2 #3
      RIP: 0010:[<ffffffff821e394d>] [<ffffffff821e394d>]
      inet_twdr_do_twkill_work+0x6e/0xb8
      RSP: 0018:ffff88011ff7fed0 EFLAGS: 00010246
      RAX: ffffffffffffffff RBX: ffffffff82339420 RCX: ffff88011ff7ff30
      RDX: 0000000000000001 RSI: ffff88011a4d03c0 RDI: ffff88011ac2fc00
      RBP: ffffffff823392e0 R08: 0000000000000000 R09: ffff88002802a200
      R10: ffff8800a5c4b000 R11: ffffffff823e4080 R12: ffff88011ac2fc00
      R13: 0000000000000001 R14: 0000000000000001 R15: 0000000000000000
      FS: 0000000041cbd940(0000) GS:ffff8800bff839c0(0000)
      knlGS:0000000000000000
      CS: 0010 DS: 0018 ES: 0018 CR0: 000000008005003b
      CR2: 0000000000000007 CR3: 00000000bd87c000 CR4: 00000000000006e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      Process swapper (pid: 0, threadinfo ffff8800bff9e000, task
      ffff88011ff76690)
      Stack: ffffffff823392e0 0000000000000100 ffffffff821e3a3a
      0000000000000008
      0000000000000000 ffffffff821e3a61 ffff8800bff7c000 ffffffff8203c7e7
      ffff88011ff7ff10 ffff88011ff7ff10 0000000000000021 ffffffff82351108
      Call Trace:
      <IRQ> [<ffffffff821e3a3a>] ? inet_twdr_hangman+0x0/0x9e
      [<ffffffff821e3a61>] ? inet_twdr_hangman+0x27/0x9e
      [<ffffffff8203c7e7>] ? run_timer_softirq+0x12c/0x193
      [<ffffffff820390d1>] ? __do_softirq+0x5e/0xcd
      [<ffffffff8200d08c>] ? call_softirq+0x1c/0x28
      [<ffffffff8200e611>] ? do_softirq+0x2c/0x68
      [<ffffffff8201a055>] ? smp_apic_timer_interrupt+0x8e/0xa9
      [<ffffffff8200cad6>] ? apic_timer_interrupt+0x66/0x70
      <EOI> [<ffffffff82011f4c>] ? default_idle+0x27/0x3b
      [<ffffffff8200abbd>] ? cpu_idle+0x5f/0x7d
      
      
      Code: e8 01 00 00 4c 89 e7 41 ff c5 e8 8d fd ff ff 49 8b 44 24 38 4c 89 e7
      65 8b 14 25 24 00 00 00 89 d2 48 8b 80 e8 00 00 00 48 f7 d0 <48> 8b 04 d0
      48 ff 40 58 e8 fc fc ff ff 48 89 df e8 c0 5f 04 00
      RIP [<ffffffff821e394d>] inet_twdr_do_twkill_work+0x6e/0xb8
      RSP <ffff88011ff7fed0>
      CR2: 0000000000000007
      
      This patch provides a function to purge all timewait sockets related
      to a network namespace. The timewait sockets life cycle is not tied with
      the network namespace, that means the timewait sockets stay alive while
      the network namespace dies. The timewait sockets are for avoiding to
      receive a duplicate packet from the network, if the network namespace is
      freed, the network stack is removed, so no chance to receive any packets
      from the outside world. Furthermore, having a pending destruction timer
      on these sockets with a network namespace freed is not safe and will lead
      to an oops if the timer callback which try to access data belonging to 
      the namespace like for example in:
      	inet_twdr_do_twkill_work
      		-> NET_INC_STATS_BH(twsk_net(tw), LINUX_MIB_TIMEWAITED);
      
      Purging the timewait sockets at the network namespace destruction will:
       1) speed up memory freeing for the namespace
       2) fix kernel panic on asynchronous timewait destruction
      Signed-off-by: NDaniel Lezcano <dlezcano@fr.ibm.com>
      Acked-by: NDenis V. Lunev <den@openvz.org>
      Acked-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d315492b
    • R
      mac80211: add missing kernel-doc · 701b9cb3
      Randy Dunlap 提交于
      Fix mac80211 kernel-doc missing struct field:
      
      Warning(linux-2.6.27-rc1-git2//net/mac80211/sta_info.h:329): No description found for parameter 'tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1]'
      Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      701b9cb3
    • E
      mac80211: Fix rate scale initialization in IBSS · 8e1535d5
      Emmanuel Grumbach 提交于
      This patch address some IBSS rate issues introduced or not covered
      by "mac80211: eliminate IBSS warning in rate_lowest_index()" and
      "cfg80211 API for channels/bitrates, mac80211 and driver conversion".
      
      This patch:
      1. Moves addition of IBSS station from
      prepare_for_handlers to ieee80211_rx_bss_info when triggered from beacon
      eliminating bogus supported rates.
      2. Initialize properly supported rates also in IBSS merging
      3. Ensure that mandatory rates are always added into supported
      rates. This is needed in case when station addition is triggered from
      non beacon/probe packet. Some management frames need to be sent
      4. Remove initialization of supported rates from self rates. This path
      was dead code after 6bc37c06bc4 and in general incorrect.
      Signed-off-by: NEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: NTomas Winkler <tomas.winkler@intel.com>
      Cc: Vladimir Koutny <vlado@work.ksp.sk>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      8e1535d5
    • T
      mac80211: Fix low bit rate in IBSS · 9818babc
      Tomas Winkler 提交于
      This patch fixes regression in iwlwifi IBSS rate scaling caused by patch:
      
          commit 6bc37c06bc424bcf3f944e6a79e2d5bb537e02ed
          Author: Vladimir Koutny <vlado@work.ksp.sk>
          Date:   Fri Jun 13 16:50:44 2008 +0200
      
              mac80211: eliminate IBSS warning in rate_lowest_index()
      
      An IBSS station is added in prepare_for_handlers where the rate scaling was
      initialized only with single rate matching the received packet.
      The correct rate scale information should be updated only in
      ieee80211_rx_bss_info function where beacon is parsed. Because
      of coding error the rate info was left untouched.
      If a beacon has triggered the connection the rate remined 1Mbps.
      This patch fixes this coding error
      Signed-off-by: NTomas Winkler <tomas.winkler@intel.com>
      Cc: Vladimir Koutny <vlado@work.ksp.sk>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      9818babc
  2. 08 9月, 2008 5 次提交
  3. 06 9月, 2008 2 次提交
  4. 04 9月, 2008 23 次提交
    • G
      dccp ccid-3: Preventing Oscillations · a3cbdde8
      Gerrit Renker 提交于
      This implements [RFC 3448, 4.5], which performs congestion avoidance behaviour
      by reducing the transmit rate as the queueing delay (measured in terms of
      long-term RTT) increases.
      
      Oscillation can be turned on/off via a module option (do_osc_prev) and via sysfs
      (using mode 0644), the default is off.
      
      Overflow analysis:
      ------------------
       * oscillation prevention is done after update_x(), so that t_ipi <= 64000;
       * hence the multiplication "t_ipi * sqrt(R_sample)" needs 64 bits;
       * done using u64 for sqrt_sample and explicit typecast of t_ipi;
       * the divisor, R_sqmean, is non-zero because oscillation prevention is first
         called when receiving the second feedback packet, and tfrc_scaled_rtt() > 0.
      
      A detailed discussion of the algorithm (with plots) is on
      http://www.erg.abdn.ac.uk/users/gerrit/dccp/notes/ccid3/sender_notes/oscillation_prevention/
      
      The algorithm has negative side effects:
        * when allowing to decrease t_ipi (leads to a large RTT) and
        * when using it during slow-start;
      both uses are therefore disabled.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      a3cbdde8
    • G
      dccp ccid-3: Simplify computing and range-checking of t_ipi · 53ac9570
      Gerrit Renker 提交于
      This patch simplifies the computation of t_ipi, avoiding expensive computations
      to enforce the minimum sending rate.
      
      Both RFC 3448 and rfc3448bis (revision #06), as well as RFC 4342 sec 5., require
      at various stages that at least one packet must be sent per t_mbi = 64 seconds.
      This requires frequent divisions of the type X_min = s/t_mbi, which are later
      converted back into an inter-packet-interval t_ipi_max = s/X_min = t_mbi.
      
      The patch removes the expensive indirection; in the unlikely case of having
      a sending rate less than one packet per 64 seconds, it also re-adjusts X.
      
      The following cases document conformance with RFC 3448  / rfc3448bis-06:
       1) Time until receiving the first feedback packet:
         * if the sender has no initial RTT sample then X = s/1 Bps > s/t_mbi;
         * if the sender has an initial RTT sample or when the first feedback
           packet is received, X = W_init/R > s/t_mbi.
      
       2) Slow-start (p == 0 and feedback packets come in):
         * RFC 3448  (current code) enforces a minimum of s/R > s/t_mbi;
         * rfc3448bis (future code) enforces an even higher minimum of W_init/R.
      
       3) Congestion avoidance with no absence of feedback (p > 0):
         * when X_calc or X_recv/2 are too low, the minimum of X_min = s/t_mbi
           is enforced in update_x() when calling update_send_interval();
         * update_send_interval() is, as before, only called when X changes
           (i.e. either when increasing or decreasing, not when in equilibrium).
      
       4) Reduction of X without prior feedback or during slow-start (p==0):
         * both RFC 3448 and rfc3448bis here halve X directly;
         * the associated constraint X >= s/t_mbi is nforced here by send_interval().
      
       5) Reduction of X when p > 0:
         * X is modified indirectly via X_recv (RFC 3448) or X_recv_set (rfc3448bis);
         * in both cases, control goes back to section 4.3 (in both documents);
         * since p > 0, both documents use X = max(min(...), s/t_mbi), which is
           enforced in this patch by calling send_interval() from update_x().
      
      I think that this analysis is exhaustive. Should I have forgotten a case,
      the worst-case consideration arises when X sinks below s/t_mbi, and is then
      increased back up to this minimum value. Even under this assumption, the
      behaviour is correct, since all lower limits of X in RFC 3448 / rfc3448bis
      are either equal to or greater than s/t_mbi.
      
      Note on the condition X >= s/t_mbi  <==> t_ipi = s/X <= t_mbi: since X is
      scaled by 64, and all time units are in microseconds, the coded condition is:
      
          t_ipi = s * 64 * 10^6 usec / X <= 64 * 10^6 usec
      
      This simplifies to s / X <= 1 second <==> X * 1 second >= s > 0.
      (A zero `s' is not allowed by the CCID-3 code).	
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      53ac9570
    • G
      dccp ccid-3: Measuring the packet size s with regard to rfc3448bis-06 · c8f41d50
      Gerrit Renker 提交于
      rfc3448bis allows three different ways of tracking the packet size `s': 
      
       1. using the MSS/MPS (at initialisation, 4.2, and in 4.1 (1));
       2. using the average of `s' (in 4.1);
       3. using the maximum of `s' (in 4.2).
      
      Instead of hard-coding a single interpretation of rfc3448bis, this implements
      a choice of all three alternatives and suggests the first as default, since it
      is the option which is most consistent with other parts of the specification.
      
      The patch further deprecates the update of t_ipi whenever `s' changes. The
      gains of doing this are only small since a change of s takes effect at the
      next instant X is updated:
       * when the next feedback comes in (within one RTT or less);
       * when the nofeedback timer expires (within at most 4 RTTs).
       
      Further, there are complications caused by updating t_ipi whenever s changes:
       * if t_ipi had previously been updated to effect oscillation prevention (4.5),
         then it is impossible to make the same adjustment to t_ipi again, thus
         counter-acting the algorithm;
       * s may be updated any time and a modification of t_ipi depends on the current
         state (e.g. no oscillation prevention is done in the absence of feedback);
       * in rev-06 of rfc3448bis, there are more possible cases, depending on whether
         the sender is in slow-start (t_ipi <= R/W_init), or in congestion-avoidance,
         limited by X_recv or the throughput equation (t_ipi <= t_mbi).
      
      Thus there are side effects of always updating t_ipi as s changes. These may not
      be desirable. The only case I can think of where such an update makes sense is
      to recompute X_calc when p > 0 and when s changes (not done by this patch).
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      c8f41d50
    • G
      dccp ccid-3: Tidy up CCID-Kconfig dependencies · 891e4d8a
      Gerrit Renker 提交于
      The per-CCID menu has several dependencies on EXPERIMENTAL. These are redundant,
      since net/dccp/ccids/Kconfig is sourced by net/dccp/Kconfig and since the
      latter menu in turn asserts a dependency on EXPERIMENTAL.
      
      The patch removes the redundant dependencies as well as the repeated reference
      within the sub-menu.
      
      Further changes:
      ----------------
      Two single dependencies on CCID-3 are replaced with a single enclosing `if'.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      891e4d8a
    • G
      dccp ccid-3: Implement rfc3448bis change to initial-rate computation · 9d497a2c
      Gerrit Renker 提交于
      The patch updates CCID-3 with regard to the latest rfc3448bis-06: 
       * in the first revisions of the draft, MSS was used for the RFC 3390 window; 
       * then (from revision #1 to revision #2), it used the packet size `s';
       * now, in this revision (and apparently final), the value is back to MSS.
      
      This change has an implication for the case when no RTT sample is available,
      at the time of sending the first packet:
      
       * with RTT sample, 2*MSS/RTT <= initial_rate <= 4*MSS/RTT;
       * without RTT sample, the initial rate is one packet (s bytes) per second
         (sec. 4.2), but using s instead of MSS here creates an imbalance, since
         this would further reduce the initial sending rate.
      
      Hence the patch uses MSS (called MPS in RFC 4340) in all places.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      9d497a2c
    • G
      dccp ccid-3: Update the RX history records in one place · 88e97a93
      Gerrit Renker 提交于
      This patch is a requirement for enabling ECN support later on. With that change
      in mind, the following preparations are done:
       * renamed handle_loss() into congestion_event() since it returns true when a
         congestion event happens (it will eventually also take care of ECN packets);
       * lets tfrc_rx_congestion_event() always update the RX history records, since
         this routine needs to be called for each non-duplicate packet anyway;
       * made all involved boolean-type functions to have return type `bool';
      
      Updating the RX history records is now only necessary for the packets received
      up to sending the first feedback. The receiver code becomes again simpler.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      88e97a93
    • G
      dccp ccid-3: Update the computation of X_recv · 68c89ee5
      Gerrit Renker 提交于
      This updates the computation of X_recv with regard to Errata 610/611 for
      RFC 4342 and draft rfc3448bis-06, ensuring that at least an interval of 1
      RTT is used to compute X_recv.  The change is wrapped into a new function
      ccid3_hc_rx_x_recv().
      
      Further changes:
      ----------------
       * feedback is not sent when no data packets arrived (bytes_recv == 0), as per
         rfc3448bis-06, 6.2;
       * take the timestamp for the feedback /after/ dccp_send_ack() returns, to avoid
         taking the transmission time into account (in case layer-2 is busy);
       * clearer handling of failure in ccid3_first_li().
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      68c89ee5
    • G
      dccp tfrc: Increase number of RTT samples · 22338f09
      Gerrit Renker 提交于
      This improves the receiver RTT sampling algorithm so that it tries harder to get
      as many RTT samples as possible. 
      
      The algorithm is based the concepts presented in RFC 4340, 8.1, using timestamps
      and the CCVal window counter. There exist 4 cases for the CCVal difference:
       * == 0: less than RTT/4 passed since last packet -- unusable;
       *  > 4: (much) more than 1 RTT has passed since last packet -- also unusable;
       * == 4: perfect sample (exactly one RTT has passed since last packet);
       * 1..3: sub-optimal sample (between RTT/4 and 3*RTT/4 has passed).
      
      In the last case the algorithm tried to optimise by storing away the candidate
      and then re-trying next time. The problem is that
       * a large number of samples is needed to smooth out the inaccuracies of the
         algorithm;
       * the sender may not be sending enough packets to warrant a "next time";
       * hence it is better to use suboptimal samples whenever possible.
      The algorithm now stores away the current sample only if the difference is 0.
      
      Applicability and background
      ----------------------------
      A realistic example is MP3 streaming where packets are sent at a rate of less
      than one packet per RTT, which means that suitable samples are absent for a
      very long time.
      
      The effectiveness of using suboptimal samples (with a delta between 1 and 4) was
      confirmed by instrumenting the algorithm with counters. The results of two 20
      second test runs were:
       * With the old algorithm and a total of 38442 function calls, only 394 of these
         calls resulted in usable RTT samples (about 1%), and 378 out of these were
         "perfect" samples and 28013 (unused) samples had a delta of 1..3.
       * With the new algorithm and a total of 37057 function calls, 1702 usable RTT
         samples were retrieved (about 4.6%), 5 out of these were "perfect" samples.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      22338f09
    • G
      dccp: Clamping RTT values · 49ffc29a
      Gerrit Renker 提交于
      This extracts the clamping part of dccp_sample_rtt() and makes it available
      to other parts of the code (as e.g. used in the next patch).
      
      Note: The function dccp_sample_rtt() now reduces to subtracting the elapsed
      time. This could be eliminated but would require shorter prefixes and thus
      is not done by this patch - maybe an idea for later.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      49ffc29a
    • G
      dccp ccid-3: Always perform receiver RTT sampling · 2b81143a
      Gerrit Renker 提交于
      This updates the CCID-3 receiver in part with regard to errata 610 and 611
      (http://www.rfc-editor.org/errata_list.php), which change RFC 4342 to use the
      Receive Rate as specified in rfc3448bis, requiring to constantly sample the
      RTT (or use a sender RTT).
      
      Doing this requires reusing the RX history structure after dealing with a loss.
      
      The patch does not resolve how to compute X_recv if the interval is less
      than 1 RTT. A FIXME has been added (and is resolved in subsequent patch).
      
      Furthermore, since this is all TFRC-based functionality, the RTT estimation
      is now also performed by the dccp_tfrc_lib module. This further simplifies
      the CCID-3 code.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      2b81143a
    • G
      dccp ccid-3: Remove duplicate RX states · 2f3e3bba
      Gerrit Renker 提交于
      The only state information that the CCID-3 receiver keeps is whether initial 
      feedback has been sent or not. Further, this overlaps with use of feedback:
      
       * state == TFRC_RSTATE_NO_DATA as long as no feedback has been sent;
       * state == TFRC_RSTATE_DATA    as soon as the first feedback has been sent.
      
      This patch reduces the duplication, by memorising the type of the last feedback.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      2f3e3bba
    • G
      dccp tfrc: Let dccp_tfrc_lib do the sampling work · 34a081be
      Gerrit Renker 提交于
      This migrates more TFRC-related code into the dccp_tfrc_lib:
       * sampling of the packet size `s' (which is only needed until the first
         loss interval is computed (ccid3_first_li));
       * updating the byte-counter `bytes_recvd' in between sending feedbacks.
      The result is a better separation of CCID-3 specific and TFRC specific
      code, which aids future integration with ECN and e.g. CCID-4.
      
      Further changes:
      ----------------
       * replaced magic number of 536 with equivalent constant TCP_MIN_RCVMSS;
         (this constant is also used when no estimate for `s' is available).
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      34a081be
    • G
      dccp tfrc: Return type of update_i_mean is void · 3ca7aea0
      Gerrit Renker 提交于
      This changes the return type of tfrc_lh_update_i_mean() to void, since that 
      function returns always `false'. This is due to 
      
       	len = dccp_delta_seqno(cur->li_seqno, DCCP_SKB_CB(skb)->dccpd_seq) + 1;
       
       	if (len - (s64)cur->li_length <= 0)	/* duplicate or reordered */
      		return 0;
      
      which means that update_i_mean can only increase the length of the open loss
      interval I_0, and hence the value of I_tot0 (RFC 3448, 5.4). Consequently the
      test `i_mean < old_i_mean' at the end of the function always evaluates to false.
      
      There is no known way by which a loss interval can suddenly become shorter,
      therefore the return type of the function is changed to void. (That is, under
      the given circumstances step (3) in RFC 3448, 6.1 will not occur.)
      
      Further changes:
      ----------------
       * the function is now called from tfrc_rx_handle_loss, which is equivalent
         to the previous way of calling from rx_packet_recv (it was called whenever
         there was no new or pending loss, now  it is also updated when there is
         a pending loss - this increases the accuracy a bit);
       * added a FIXME to possibly consider NDP counting as per RFC 4342 (this is
         not implemented yet).
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      3ca7aea0
    • G
      dccp tfrc: Perform early loss detection · d20ed95f
      Gerrit Renker 提交于
      This enables the TFRC code to begin loss detection (as soon as the module
      is loaded), using the latest updates from rfc3448bis-06, 6.3.1:
      
       * when the first data packet(s) are lost or marked, set
       * X_target = s/(2*R) => f(p) = s/(R * X_target) = 2,
       * corresponding to a loss rate of ~ 20.64%.
      
      The handle_loss() function is now called right at the begin of rx_packet_recv()
      and thus no longer protected against duplicates: hence a call to rx_duplicate()
      has been added.  Such a call makes sense now, as the previous patch initialises
      the first entry with a sequence number of GSR.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      d20ed95f
    • G
      dccp tfrc: Receiver history initialisation routine · 24b8d343
      Gerrit Renker 提交于
      This patch 
       1) separates history allocation and initialisation, to facilitate early
          loss detection (implemented by a subsequent patch);
      
       2) removes duplication by using the existing tfrc_rx_hist_purge() if the
          allocation fails. This is now possible, since the initialisation routine
       3) zeroes out the entire history before using it. 
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      24b8d343
    • G
      dccp tfrc: Suppress unavoidable "below resolution" warning · 8b67ad12
      Gerrit Renker 提交于
      In the congestion-avoidance phase a decay of p towards 0 is natural once fewer
      losses are encountered. Hence the warning message "p is below resolution" is
      not necessary, and thus turned into a debug message by this patch.
      
      The TFRC_SMALLEST_P is needed since in theory p never actually reaches 0. When
      no further losses are encountered, the loss interval I_0 grows in length, 
      causing p to decrease towards 0, causing X_calc = s/(RTT * f(p)) to increase.
      
      With the given minimum-resolution this congestion avoidance phase stops at some
      fixed value, an approximation formula has been added to the documentation.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      8b67ad12
    • G
      dccp ccid-3: Simplified handling of TX states · d0c05fe4
      Gerrit Renker 提交于
      Since CCIDs are only used during the established phase of a connection,
      they have very little internal state; this specifically reduces to:
      
       * "no packet sent" if and only if s == 0, for the TX packet size s;
      
       * when the first packet has been sent (i.e. `s' > 0), the question is whether
         or not feedback has been received:
         - if a feedback packet is received, "feedback = yes" is set,
         - if the nofeedback timer expires,  "feedback = no"  is set.
      
      Thus the CCID only needs to remember state about whether or not feedback
      has been received. This is now implemented using a boolean flag, which is
      toggled when a feedback packet arrives or the nofeedback timer expires.
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      d0c05fe4
    • G
      dccp ccid-3: Runtime verification of timer resolution · f76fd327
      Gerrit Renker 提交于
      The DCCP base time resolution is 10 microseconds (RFC 4340, 13.1 ... 13.3).
      
      Using a timer with a lower resolution was found to trigger the following
      bug warnings/problems on high-speed networks (e.g. local loopback):
       * RTT samples are rounded down to 0 if below resolution;
       * in some cases, negative RTT samples were observed;
       * the CCID-3 feedback timer complains that the feedback interval is 0,
         since the feedback interval is in the order of 1 RTT or less and RTT
         measurement rounded this down to 0;
      On an Intel computer this will for instance happen when using a
      boot-time parameter of "clocksource=jiffies".
      
      The following system log messages were observed:
        11:24:00 kernel: BUG: delta (0) <= 0 at ccid3_hc_rx_send_feedback()
        11:26:12 kernel: BUG: delta (0) <= 0 at ccid3_hc_rx_send_feedback()
        11:26:30 kernel: dccp_sample_rtt: unusable RTT sample 0, using min
        11:26:30 last message repeated 5 times
      
      This patch defines a global constant for the time resolution, adds this in
      timer.c, and checks the available clock resolution at CCID-3 module load time.
      
      When the resolution is worse than 10 microseconds, module loading exits with
      a message "socket type not supported".
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      f76fd327
    • T
      dccp qpolicy: Parameter checking of cmsg qpolicy parameters · 7d1af6a8
      Tomasz Grobelny 提交于
      Ensure that cmsg->cmsg_type value is valid for qpolicy 
      that is currently in use.
      Signed-off-by: NTomasz Grobelny <tomasz@grobelny.oswiecenia.net>
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      7d1af6a8
    • T
      dccp: Policy-based packet dequeueing infrastructure · d6da3511
      Tomasz Grobelny 提交于
      This patch adds a generic infrastructure for policy-based dequeueing of 
      TX packets and provides two policies:
       * a simple FIFO policy (which is the default) and
       * a priority based policy (set via socket options).
      Both policies honour the tx_qlen sysctl for the maximum size of the write
      queue (can be overridden via socket options). 
      
      The priority policy uses skb->priority internally to assign an u32 priority
      identifier, using the same ranking as SO_PRIORITY. The skb->priority field
      is set to 0 when the packet leaves DCCP. The priority is supplied as ancillary
      data using cmsg(3), the patch also provides the requisite parsing routines.
      Signed-off-by: NTomasz Grobelny <tomasz@grobelny.oswiecenia.net>
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      d6da3511
    • G
      dccp: Clean up slow-path input processing · ddab0556
      Gerrit Renker 提交于
      This patch rearranges the order of statements of the slow-path input processing
      (i.e. any other state than OPEN), to resolve the following issues.
      
       1. Dependencies: the order of statements now better matches RFC 4340, 8.5, i.e.
          step 7 is before step 9 (previously 9 was before 7), and parsing options in
          step 8 (which can consume resources) now comes after step 7.
       2. Bug-fix: in state CLOSED, there should not be any sequence number checking
          or option processing. This is why the test for CLOSED has been moved after
          the test for LISTEN.
       3. As before sequence number checks are omitted if in state LISTEN/REQUEST, due
          to the note underneath the table in RFC 4340, 7.5.3.
       4. Packets are now passed on to Ack Vector / CCID processing only after
          - step 7  (receive unexpected packets), 
          - step 9  (receive Reset),
          - step 13 (receive CloseReq),
          - step 14 (receive Close)
          and only if the state is PARTOPEN. This simplifies CCID processing:
          - in LISTEN/CLOSED the CCIDs are non-existent;
          - in RESPOND/REQUEST the CCIDs have not yet been negotiated;
          - in CLOSEREQ and active-CLOSING the node has already closed this socket;
          - in passive-CLOSING the client is waiting for its Reset.
          In the last case, RFC 4340, 8.3 leaves it open to ignore further incoming
          data, which is the approach taken here.
      
      As a result of (3), CCID processing is now indeed confined to OPEN/PARTOPEN
      states, i.e. congestion control is performed only on the flow of data packets. 
      
      This avoids pathological cases of doing congestion control on those messages
      which set up and terminate the connection. 
      
      I have done a few checks to see if this creates a problem in other parts of
      the code. This seems not to be the case; even if there were one, it would be
      better to fix it than to perform congestion control on Close/Request/Response
      messages. Similarly for Ack Vectors (as they depend on the negotiated CCID).
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      ddab0556
    • G
      tcp/dccp: Consolidate common code for RFC 3390 conversion · 6224877b
      Gerrit Renker 提交于
      This patch consolidates the code common to TCP and CCID-2:
       * TCP uses RFC 3390 in a packet-oriented manner (tcp_input.c) and
       * CCID-2 uses RFC 3390 in packet-oriented manner (RFC 4341).
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      6224877b
    • G
      dccp: Combine the functionality of enqeueing and cloning · b25b0c60
      Gerrit Renker 提交于
      Realising the following call pattern,
       * first dccp_entail() is called to enqueue a new skb and
       * then skb_clone() is called to transmit a clone of that skb,
      
      this patch integrates both interrelated steps into dccp_entail().
      
      Note: the return value of skb_clone is not checked. It may be an idea to add a
            warning if this occurs. In both instances, however, a timer is set for
            retransmission, so that cloning is re-tried via dccp_retransmit_skb().
      Signed-off-by: NGerrit Renker <gerrit@erg.abdn.ac.uk>
      b25b0c60