1. 13 3月, 2011 2 次提交
  2. 10 3月, 2011 1 次提交
    • D
      ipv6: Don't create clones of host routes. · 7343ff31
      David S. Miller 提交于
      Addresses https://bugzilla.kernel.org/show_bug.cgi?id=29252
      Addresses https://bugzilla.kernel.org/show_bug.cgi?id=30462
      
      In commit d80bc0fd ("ipv6: Always
      clone offlink routes.") we forced the kernel to always clone offlink
      routes.
      
      The reason we do that is to make sure we never bind an inetpeer to a
      prefixed route.
      
      The logic turned on here has existed in the tree for many years,
      but was always off due to a protecting CPP define.  So perhaps
      it's no surprise that there is a logic bug here.
      
      The problem is that we canot clone a route that is already a
      host route (ie. has DST_HOST set).  Because if we do, an identical
      entry already exists in the routing tree and therefore the
      ip6_rt_ins() call is going to fail.
      
      This sets off a series of failures and high cpu usage, because when
      ip6_rt_ins() fails we loop retrying this operation a few times in
      order to handle a race between two threads trying to clone and insert
      the same host route at the same time.
      
      Fix this by simply using the route as-is when DST_HOST is set.
      
      Reported-by: slash@ac.auone-net.jp
      Reported-by: NErnst Sjöstrand <ernstp@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7343ff31
  3. 04 3月, 2011 1 次提交
  4. 02 3月, 2011 2 次提交
  5. 26 2月, 2011 2 次提交
  6. 19 2月, 2011 1 次提交
  7. 18 2月, 2011 1 次提交
  8. 11 2月, 2011 1 次提交
    • D
      inet: Create a mechanism for upward inetpeer propagation into routes. · 6431cbc2
      David S. Miller 提交于
      If we didn't have a routing cache, we would not be able to properly
      propagate certain kinds of dynamic path attributes, for example
      PMTU information and redirects.
      
      The reason is that if we didn't have a routing cache, then there would
      be no way to lookup all of the active cached routes hanging off of
      sockets, tunnels, IPSEC bundles, etc.
      
      Consider the case where we created a cached route, but no inetpeer
      entry existed and also we were not asked to pre-COW the route metrics
      and therefore did not force the creation a new inetpeer entry.
      
      If we later get a PMTU message, or a redirect, and store this
      information in a new inetpeer entry, there is no way to teach that
      cached route about the newly existing inetpeer entry.
      
      The facilities implemented here handle this problem.
      
      First we create a generation ID.  When we create a cached route of any
      kind, we remember the generation ID at the time of attachment.  Any
      time we force-create an inetpeer entry in response to new path
      information, we bump that generation ID.
      
      The dst_ops->check() callback is where the knowledge of this event
      is propagated.  If the global generation ID does not equal the one
      stored in the cached route, and the cached route has not attached
      to an inetpeer yet, we look it up and attach if one is found.  Now
      that we've updated the cached route's information, we update the
      route's generation ID too.
      
      This clears the way for implementing PMTU and redirects directly in
      the inetpeer cache.  There is absolutely no need to consult cached
      route information in order to maintain this information.
      
      At this point nothing bumps the inetpeer genids, that comes in the
      later changes which handle PMTUs and redirects using inetpeers.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6431cbc2
  9. 09 2月, 2011 1 次提交
  10. 01 2月, 2011 1 次提交
    • R
      net: Add default_mtu() methods to blackhole dst_ops · ec831ea7
      Roland Dreier 提交于
      When an IPSEC SA is still being set up, __xfrm_lookup() will return
      -EREMOTE and so ip_route_output_flow() will return a blackhole route.
      This can happen in a sndmsg call, and after d33e4553 ("net: Abstract
      default MTU metric calculation behind an accessor.") this leads to a
      crash in ip_append_data() because the blackhole dst_ops have no
      default_mtu() method and so dst_mtu() calls a NULL pointer.
      
      Fix this by adding default_mtu() methods (that simply return 0, matching
      the old behavior) to the blackhole dst_ops.
      
      The IPv4 part of this patch fixes a crash that I saw when using an IPSEC
      VPN; the IPv6 part is untested because I don't have an IPv6 VPN, but it
      looks to be needed as well.
      Signed-off-by: NRoland Dreier <roland@purestorage.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ec831ea7
  11. 28 1月, 2011 2 次提交
    • D
      net: Store ipv4/ipv6 COW'd metrics in inetpeer cache. · 06582540
      David S. Miller 提交于
      Please note that the IPSEC dst entry metrics keep using
      the generic metrics COW'ing mechanism using kmalloc/kfree.
      
      This gives the IPSEC routes an opportunity to use metrics
      which are unique to their encapsulated paths.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      06582540
    • D
      ipv6: Remove route peer binding assertions. · 8f2771f2
      David S. Miller 提交于
      They are bogus.  The basic idea is that I wanted to make sure
      that prefixed routes never bind to peers.
      
      The test I used was whether RTF_CACHE was set.
      
      But first of all, the RTF_CACHE flag is set at different spots
      depending upon which ip6_rt_copy() caller you're talking about.
      
      I've validated all of the code paths, and even in the future
      where we bind peers more aggressively (for route metric COW'ing)
      we never bind to prefix'd routes, only fully specified ones.
      This even applies when addrconf or icmp6 routes are allocated.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8f2771f2
  12. 27 1月, 2011 1 次提交
    • D
      net: Implement read-only protection and COW'ing of metrics. · 62fa8a84
      David S. Miller 提交于
      Routing metrics are now copy-on-write.
      
      Initially a route entry points it's metrics at a read-only location.
      If a routing table entry exists, it will point there.  Else it will
      point at the all zero metric place-holder called 'dst_default_metrics'.
      
      The writeability state of the metrics is stored in the low bits of the
      metrics pointer, we have two bits left to spare if we want to store
      more states.
      
      For the initial implementation, COW is implemented simply via kmalloc.
      However future enhancements will change this to place the writable
      metrics somewhere else, in order to increase sharing.  Very likely
      this "somewhere else" will be the inetpeer cache.
      
      Note also that this means that metrics updates may transiently fail
      if we cannot COW the metrics successfully.
      
      But even by itself, this patch should decrease memory usage and
      increase cache locality especially for routing workloads.  In those
      cases the read-only metric copies stay in place and never get written
      to.
      
      TCP workloads where metrics get updated, and those rare cases where
      PMTU triggers occur, will take a very slight performance hit.  But
      that hit will be alleviated when the long-term writable metrics
      move to a more sharable location.
      
      Since the metrics storage went from a u32 array of RTAX_MAX entries to
      what is essentially a pointer, some retooling of the dst_entry layout
      was necessary.
      
      Most importantly, we need to preserve the alignment of the reference
      count so that it doesn't share cache lines with the read-mostly state,
      as per Eric Dumazet's alignment assertion checks.
      
      The only non-trivial bit here is the move of the 'flags' member into
      the writeable cacheline.  This is OK since we are always accessing the
      flags around the same moment when we made a modification to the
      reference count.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      62fa8a84
  13. 25 1月, 2011 1 次提交
  14. 19 12月, 2010 1 次提交
  15. 17 12月, 2010 1 次提交
    • A
      ipv6: delete expired route in ip6_pmtu_deliver · d3052b55
      Andrey Vagin 提交于
      The first big packets sent to a "low-MTU" client correctly
      triggers the creation of a temporary route containing the reduced MTU.
      
      But after the temporary route has expired, new ICMP6 "packet too big"
      will be sent, rt6_pmtu_discovery will find the previous EXPIRED route
      check that its mtu isn't bigger then in icmp packet and do nothing
      before the temporary route will not deleted by gc.
      
      I make the simple experiment:
      while :; do
          time ( dd if=/dev/zero bs=10K count=1 | ssh hostname dd of=/dev/null ) || break;
      done
      
      The "time" reports real 0m0.197s if a temporary route isn't expired, but
      it reports real 0m52.837s (!!!!) immediately after a temporare route has
      expired.
      Signed-off-by: NAndrey Vagin <avagin@openvz.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d3052b55
  16. 15 12月, 2010 1 次提交
  17. 14 12月, 2010 1 次提交
    • D
      net: Abstract default ADVMSS behind an accessor. · 0dbaee3b
      David S. Miller 提交于
      Make all RTAX_ADVMSS metric accesses go through a new helper function,
      dst_metric_advmss().
      
      Leave the actual default metric as "zero" in the real metric slot,
      and compute the actual default value dynamically via a new dst_ops
      AF specific callback.
      
      For stacked IPSEC routes, we use the advmss of the path which
      preserves existing behavior.
      
      Unlike ipv4/ipv6, DecNET ties the advmss to the mtu and thus updates
      advmss on pmtu updates.  This inconsistency in advmss handling
      results in more raw metric accesses than I wish we ended up with.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0dbaee3b
  18. 13 12月, 2010 3 次提交
  19. 10 12月, 2010 1 次提交
    • D
      net: Abstract away all dst_entry metrics accesses. · defb3519
      David S. Miller 提交于
      Use helper functions to hide all direct accesses, especially writes,
      to dst_entry metrics values.
      
      This will allow us to:
      
      1) More easily change how the metrics are stored.
      
      2) Implement COW for metrics.
      
      In particular this will help us put metrics into the inetpeer
      cache if that is what we end up doing.  We can make the _metrics
      member a pointer instead of an array, initially have it point
      at the read-only metrics in the FIB, and then on the first set
      grab an inetpeer entry and point the _metrics member there.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Acked-by: NEric Dumazet <eric.dumazet@gmail.com>
      defb3519
  20. 01 12月, 2010 1 次提交
  21. 29 11月, 2010 1 次提交
  22. 18 11月, 2010 1 次提交
  23. 13 11月, 2010 1 次提交
  24. 04 11月, 2010 1 次提交
    • X
      net dst: fix percpu_counter list corruption and poison overwritten · 41bb78b4
      Xiaotian Feng 提交于
      There're some percpu_counter list corruption and poison overwritten warnings
      in recent kernel, which is resulted by fc66f95c.
      
      commit fc66f95c switches to use percpu_counter, in ip6_route_net_init, kernel
      init the percpu_counter for dst entries, but, the percpu_counter is never destroyed
      in ip6_route_net_exit. So if the related data is freed by kernel, the freed percpu_counter
      is still on the list, then if we insert/remove other percpu_counter, list corruption
      resulted. Also, if the insert/remove option modifies the ->prev,->next pointer of
      the freed value, the poison overwritten is resulted then.
      
      With the following patch, the percpu_counter list corruption and poison overwritten
      warnings disappeared.
      Signed-off-by: NXiaotian Feng <dfeng@redhat.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
      Cc: "Pekka Savola (ipv6)" <pekkas@netcore.fi>
      Cc: James Morris <jmorris@namei.org>
      Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
      Cc: Patrick McHardy <kaber@trash.net>
      Acked-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      41bb78b4
  25. 12 10月, 2010 1 次提交
    • E
      net dst: use a percpu_counter to track entries · fc66f95c
      Eric Dumazet 提交于
      struct dst_ops tracks number of allocated dst in an atomic_t field,
      subject to high cache line contention in stress workload.
      
      Switch to a percpu_counter, to reduce number of time we need to dirty a
      central location. Place it on a separate cache line to avoid dirtying
      read only fields.
      
      Stress test :
      
      (Sending 160.000.000 UDP frames,
      IP route cache disabled, dual E5540 @2.53GHz,
      32bit kernel, FIB_TRIE, SLUB/NUMA)
      
      Before:
      
      real    0m51.179s
      user    0m15.329s
      sys     10m15.942s
      
      After:
      
      real	0m45.570s
      user	0m15.525s
      sys	9m56.669s
      
      With a small reordering of struct neighbour fields, subject of a
      following patch, (to separate refcnt from other read mostly fields)
      
      real	0m41.841s
      user	0m15.261s
      sys	8m45.949s
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fc66f95c
  26. 04 10月, 2010 1 次提交
  27. 29 9月, 2010 1 次提交
    • M
      ipv6: Implement Any-IP support for IPv6. · ab79ad14
      Maciej Żenczykowski 提交于
      AnyIP is the capability to receive packets and establish incoming
      connections on IPs we have not explicitly configured on the machine.
      
      An example use case is to configure a machine to accept all incoming
      traffic on eth0, and leave the policy of whether traffic for a given IP
      should be delivered to the machine up to the load balancer.
      
      Can be setup as follows:
        ip -6 rule from all iif eth0 lookup 200
        ip -6 route add local default dev lo table 200
      (in this case for all IPv6 addresses)
      Signed-off-by: NMaciej Żenczykowski <maze@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ab79ad14
  28. 28 9月, 2010 1 次提交
  29. 24 9月, 2010 1 次提交
  30. 15 8月, 2010 1 次提交
  31. 15 6月, 2010 1 次提交
  32. 11 6月, 2010 1 次提交
  33. 29 5月, 2010 1 次提交
  34. 18 5月, 2010 1 次提交