1. 23 1月, 2014 6 次提交
    • N
      bonding: convert arp_all_targets to use the new option API · edf36b24
      Nikolay Aleksandrov 提交于
      This patch adds the necessary changes so arp_all_targets would use the
      new bonding option API.
      Signed-off-by: NNikolay Aleksandrov <nikolay@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      edf36b24
    • N
      bonding: convert arp_validate to use the new option API · 16228881
      Nikolay Aleksandrov 提交于
      This patch adds the necessary changes so arp_validate would use the
      new bonding option API. Also fix some trivial/style errors.
      Signed-off-by: NNikolay Aleksandrov <nikolay@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      16228881
    • N
      bonding: convert xmit_hash_policy to use the new option API · a4b32ce7
      Nikolay Aleksandrov 提交于
      This patch adds the necessary changes so xmit_hash_policy would use the
      new bonding option API. Also fix some trivial/style errors.
      Signed-off-by: NNikolay Aleksandrov <nikolay@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a4b32ce7
    • N
      bonding: convert packets_per_slave to use the new option API · aa59d851
      Nikolay Aleksandrov 提交于
      This patch adds the necessary changes so packets_per_slave would use the
      new bonding option API.
      Signed-off-by: NNikolay Aleksandrov <nikolay@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      aa59d851
    • N
      bonding: convert mode setting to use the new option API · 2b3798d5
      Nikolay Aleksandrov 提交于
      This patch makes the bond's mode setting use the new option API and
      adds support for dependency printing which relies on having an entry for
      the mode option in the bond_opts[] array.
      Also add the ability to print the mode name when mode dependency fails
      and fix some trivial/style errors.
      Signed-off-by: NNikolay Aleksandrov <nikolay@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2b3798d5
    • N
      bonding: add infrastructure for an option API · 09117362
      Nikolay Aleksandrov 提交于
      This patch adds the necessary basic infrastructure to support
      centralized and unified option manipulation API for the bonding. The new
      structure bond_option will be used to describe each option with its
      dependencies on modes which will be checked automatically thus removing a
      lot of duplicated code. Also automatic range checking is added for
      some options. Currently the option setting function requires RTNL to
      be acquired prior to calling it, since many options already rely on RTNL
      it seemed like the best choice to protect all against common race
      conditions.
      In order to add an option the following steps need to be done:
      1. Add an entry BOND_OPT_<option> to bond_options.h so it gets a unique id
         and a bit corresponding to the id
      2. Add a bond_option entry to the bond_opts[] array in bond_options.c which
         describes the option, its dependencies and its manipulation function
      3. Add code to export the option through sysfs and/or as a module parameter
         (the sysfs export will be made automatically in the future)
      
      The options can have different flags set, currently the following are
      supported:
      BOND_OPTFLAG_NOSLAVES - require that the bond device has no slaves prior
                              to setting the option
      BOND_OPTFLAG_IFDOWN - require that the bond device is down prior to
                            setting the option
      BOND_OPTFLAG_RAWVAL - don't parse the value but return it raw for the
                            option to parse
      
      There's a new value structure to describe different types of values
      which can have the following flags:
      BOND_VALFLAG_DEFAULT - marks the default option (permanent string alias
                             to this option is "default")
      BOND_VALFLAG_MIN - the minimum value that this option can have
      BOND_VALFLAG_MAX - the maximum value that this option can have
      
      An example would be nice here, so if we have an option which can have
      the values "off"(2), "special"(4, default) and supports a range, say
      16 - 32, it should be defined as follows:
      "off", 2,
      "special", 4, BOND_VALFLAG_DEFAULT,
      "rangemin", 16, BOND_VALFLAG_MIN,
      "rangemax", 32, BOND_VALFLAG_MAX
      So we have the valid intervals: [2, 2], [4, 4], [16, 32]
      Also the valid strings: "off" = 2, "special" and "default" = 4
                              "rangemin" = 16, "rangemax" = 32
      
      BOND_VALFLAG_(MIN|MAX) can be used to specify a valid range for an
      option, if MIN is omitted then 0 is considered as a minimum. If an
      exact match is found in the values[] table it will be returned,
      otherwise the range is tried (if available).
      
      The option parameter passing is done by using a special structure called
      bond_opt_value which can take either a string or a value to parse. One
      of the bond_opt_init(val|str) macros should be used depending on which
      one does the user want to parse (string or value). Then a call to
      __bond_opt_set should be done under RTNL.
      Signed-off-by: NNikolay Aleksandrov <nikolay@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      09117362
  2. 22 1月, 2014 1 次提交
    • H
      reciprocal_divide: update/correction of the algorithm · 809fa972
      Hannes Frederic Sowa 提交于
      Jakub Zawadzki noticed that some divisions by reciprocal_divide()
      were not correct [1][2], which he could also show with BPF code
      after divisions are transformed into reciprocal_value() for runtime
      invariance which can be passed to reciprocal_divide() later on;
      reverse in BPF dump ended up with a different, off-by-one K in
      some situations.
      
      This has been fixed by Eric Dumazet in commit aee636c4
      ("bpf: do not use reciprocal divide"). This follow-up patch
      improves reciprocal_value() and reciprocal_divide() to work in
      all cases by using Granlund and Montgomery method, so that also
      future use is safe and without any non-obvious side-effects.
      Known problems with the old implementation were that division by 1
      always returned 0 and some off-by-ones when the dividend and divisor
      where very large. This seemed to not be problematic with its
      current users, as far as we can tell. Eric Dumazet checked for
      the slab usage, we cannot surely say so in the case of flex_array.
      Still, in order to fix that, we propose an extension from the
      original implementation from commit 6a2d7a95 resp. [3][4],
      by using the algorithm proposed in "Division by Invariant Integers
      Using Multiplication" [5], Torbjörn Granlund and Peter L.
      Montgomery, that is, pseudocode for q = n/d where q, n, d is in
      u32 universe:
      
      1) Initialization:
      
        int l = ceil(log_2 d)
        uword m' = floor((1<<32)*((1<<l)-d)/d)+1
        int sh_1 = min(l,1)
        int sh_2 = max(l-1,0)
      
      2) For q = n/d, all uword:
      
        uword t = (n*m')>>32
        q = (t+((n-t)>>sh_1))>>sh_2
      
      The assembler implementation from Agner Fog [6] also helped a lot
      while implementing. We have tested the implementation on x86_64,
      ppc64, i686, s390x; on x86_64/haswell we're still half the latency
      compared to normal divide.
      
      Joint work with Daniel Borkmann.
      
        [1] http://www.wireshark.org/~darkjames/reciprocal-buggy.c
        [2] http://www.wireshark.org/~darkjames/set-and-dump-filter-k-bug.c
        [3] https://gmplib.org/~tege/division-paper.pdf
        [4] http://homepage.cs.uiowa.edu/~jones/bcd/divide.html
        [5] http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.1.2556
        [6] http://www.agner.org/optimize/asmlib.zipReported-by: NJakub Zawadzki <darkjames-ws@darkjames.pl>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Austin S Hemmelgarn <ahferroin7@gmail.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: Jesse Gross <jesse@nicira.com>
      Cc: Jamal Hadi Salim <jhs@mojatatu.com>
      Cc: Stephen Hemminger <stephen@networkplumber.org>
      Cc: Matt Mackall <mpm@selenic.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: Christoph Lameter <cl@linux-foundation.org>
      Cc: Andy Gospodarek <andy@greyhouse.net>
      Cc: Veaceslav Falico <vfalico@redhat.com>
      Cc: Jay Vosburgh <fubar@us.ibm.com>
      Cc: Jakub Zawadzki <darkjames-ws@darkjames.pl>
      Signed-off-by: NDaniel Borkmann <dborkman@redhat.com>
      Signed-off-by: NHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      809fa972
  3. 04 1月, 2014 3 次提交
  4. 20 12月, 2013 5 次提交
  5. 18 12月, 2013 5 次提交
  6. 14 12月, 2013 9 次提交
  7. 29 11月, 2013 1 次提交
  8. 20 10月, 2013 3 次提交