1. 22 10月, 2013 2 次提交
  2. 20 10月, 2013 20 次提交
    • H
      net: switch net_secret key generation to net_get_random_once · e34c9a69
      Hannes Frederic Sowa 提交于
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Signed-off-by: NHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e34c9a69
    • H
      tcp: switch tcp_fastopen key generation to net_get_random_once · 222e83d2
      Hannes Frederic Sowa 提交于
      Changed key initialization of tcp_fastopen cookies to net_get_random_once.
      
      If the user sets a custom key net_get_random_once must be called at
      least once to ensure we don't overwrite the user provided key when the
      first cookie is generated later on.
      
      Cc: Yuchung Cheng <ycheng@google.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Signed-off-by: NHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      222e83d2
    • H
      inet: convert inet_ehash_secret and ipv6_hash_secret to net_get_random_once · 1bbdceef
      Hannes Frederic Sowa 提交于
      Initialize the ehash and ipv6_hash_secrets with net_get_random_once.
      
      Each compilation unit gets its own secret now:
        ipv4/inet_hashtables.o
        ipv4/udp.o
        ipv6/inet6_hashtables.o
        ipv6/udp.o
        rds/connection.o
      
      The functions still get inlined into the hashing functions. In the fast
      path we have at most two (needed in ipv6) if (unlikely(...)).
      
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Signed-off-by: NHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1bbdceef
    • H
      inet: split syncookie keys for ipv4 and ipv6 and initialize with net_get_random_once · b23a002f
      Hannes Frederic Sowa 提交于
      This patch splits the secret key for syncookies for ipv4 and ipv6 and
      initializes them with net_get_random_once. This change was the reason I
      did this series. I think the initialization of the syncookie_secret is
      way to early.
      
      Cc: Florian Westphal <fw@strlen.de>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Signed-off-by: NHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b23a002f
    • H
      net: introduce new macro net_get_random_once · a48e4292
      Hannes Frederic Sowa 提交于
      net_get_random_once is a new macro which handles the initialization
      of secret keys. It is possible to call it in the fast path. Only the
      initialization depends on the spinlock and is rather slow. Otherwise
      it should get used just before the key is used to delay the entropy
      extration as late as possible to get better randomness. It returns true
      if the key got initialized.
      
      The usage of static_keys for net_get_random_once is a bit uncommon so
      it needs some further explanation why this actually works:
      
      === In the simple non-HAVE_JUMP_LABEL case we actually have ===
      no constrains to use static_key_(true|false) on keys initialized with
      STATIC_KEY_INIT_(FALSE|TRUE). So this path just expands in favor of
      the likely case that the initialization is already done. The key is
      initialized like this:
      
      ___done_key = { .enabled = ATOMIC_INIT(0) }
      
      The check
      
                      if (!static_key_true(&___done_key))                     \
      
      expands into (pseudo code)
      
                      if (!likely(___done_key > 0))
      
      , so we take the fast path as soon as ___done_key is increased from the
      helper function.
      
      === If HAVE_JUMP_LABELs are available this depends ===
      on patching of jumps into the prepared NOPs, which is done in
      jump_label_init at boot-up time (from start_kernel). It is forbidden
      and dangerous to use net_get_random_once in functions which are called
      before that!
      
      At compilation time NOPs are generated at the call sites of
      net_get_random_once. E.g. net/ipv6/inet6_hashtable.c:inet6_ehashfn (we
      need to call net_get_random_once two times in inet6_ehashfn, so two NOPs):
      
            71:       0f 1f 44 00 00          nopl   0x0(%rax,%rax,1)
            76:       0f 1f 44 00 00          nopl   0x0(%rax,%rax,1)
      
      Both will be patched to the actual jumps to the end of the function to
      call __net_get_random_once at boot time as explained above.
      
      arch_static_branch is optimized and inlined for false as return value and
      actually also returns false in case the NOP is placed in the instruction
      stream. So in the fast case we get a "return false". But because we
      initialize ___done_key with (enabled != (entries & 1)) this call-site
      will get patched up at boot thus returning true. The final check looks
      like this:
      
                      if (!static_key_true(&___done_key))                     \
                              ___ret = __net_get_random_once(buf,             \
      
      expands to
      
                      if (!!static_key_false(&___done_key))                     \
                              ___ret = __net_get_random_once(buf,             \
      
      So we get true at boot time and as soon as static_key_slow_inc is called
      on the key it will invert the logic and return false for the fast path.
      static_key_slow_inc will change the branch because it got initialized
      with .enabled == 0. After static_key_slow_inc is called on the key the
      branch is replaced with a nop again.
      
      === Misc: ===
      The helper defers the increment into a workqueue so we don't
      have problems calling this code from atomic sections. A seperate boolean
      (___done) guards the case where we enter net_get_random_once again before
      the increment happend.
      
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Signed-off-by: NHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a48e4292
    • H
      ipv6: split inet6_ehashfn to hash functions per compilation unit · b50026b5
      Hannes Frederic Sowa 提交于
      This patch splits the inet6_ehashfn into separate ones in
      ipv6/inet6_hashtables.o and ipv6/udp.o to ease the introduction of
      seperate secrets keys later.
      
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Signed-off-by: NHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b50026b5
    • H
      ipv4: split inet_ehashfn to hash functions per compilation unit · 65cd8033
      Hannes Frederic Sowa 提交于
      This duplicates a bit of code but let's us easily introduce
      separate secret keys later. The separate compilation units are
      ipv4/inet_hashtabbles.o, ipv4/udp.o and rds/connection.o.
      
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Signed-off-by: NHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      65cd8033
    • E
      ipip: add GSO/TSO support · cb32f511
      Eric Dumazet 提交于
      Now inet_gso_segment() is stackable, its relatively easy to
      implement GSO/TSO support for IPIP
      
      Performance results, when segmentation is done after tunnel
      device (as no NIC is yet enabled for TSO IPIP support) :
      
      Before patch :
      
      lpq83:~# ./netperf -H 7.7.9.84 -Cc
      MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 7.7.9.84 () port 0 AF_INET
      Recv   Send    Send                          Utilization       Service Demand
      Socket Socket  Message  Elapsed              Send     Recv     Send    Recv
      Size   Size    Size     Time     Throughput  local    remote   local   remote
      bytes  bytes   bytes    secs.    10^6bits/s  % S      % S      us/KB   us/KB
      
       87380  16384  16384    10.00      3357.88   5.09     3.70     2.983   2.167
      
      After patch :
      
      lpq83:~# ./netperf -H 7.7.9.84 -Cc
      MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 7.7.9.84 () port 0 AF_INET
      Recv   Send    Send                          Utilization       Service Demand
      Socket Socket  Message  Elapsed              Send     Recv     Send    Recv
      Size   Size    Size     Time     Throughput  local    remote   local   remote
      bytes  bytes   bytes    secs.    10^6bits/s  % S      % S      us/KB   us/KB
      
       87380  16384  16384    10.00      7710.19   4.52     6.62     1.152   1.687
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cb32f511
    • E
      ipv4: gso: make inet_gso_segment() stackable · 3347c960
      Eric Dumazet 提交于
      In order to support GSO on IPIP, we need to make
      inet_gso_segment() stackable.
      
      It should not assume network header starts right after mac
      header.
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3347c960
    • E
      ipv4: generalize gre_handle_offloads · 2d26f0a3
      Eric Dumazet 提交于
      This patch makes gre_handle_offloads() more generic
      and rename it to iptunnel_handle_offloads()
      
      This will be used to add GSO/TSO support to IPIP tunnels.
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2d26f0a3
    • E
      net: generalize skb_segment() · 030737bc
      Eric Dumazet 提交于
      While implementing GSO/TSO support for IPIP, I found skb_segment()
      was assuming network header was immediately following mac header.
      
      Its not really true in the case inet_gso_segment() is stacked :
      By the time tcp_gso_segment() is called, network header points
      to the inner IP header.
      
      Let's instead assume nothing and pick the current offsets found in
      original skb, we have skb_headers_offset_update() helper for that.
      
      Also move the csum_start update inside skb_headers_offset_update()
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      030737bc
    • E
      ipv6: gso: remove redundant locking · b917eb15
      Eric Dumazet 提交于
      ipv6_gso_send_check() and ipv6_gso_segment() are called by
      skb_mac_gso_segment() under rcu lock, no need to use
      rcu_read_lock() / rcu_read_unlock()
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b917eb15
    • J
      net: misc: Remove extern from function prototypes · c1b1203d
      Joe Perches 提交于
      There are a mix of function prototypes with and without extern
      in the kernel sources.  Standardize on not using extern for
      function prototypes.
      
      Function prototypes don't need to be written with extern.
      extern is assumed by the compiler.  Its use is as unnecessary as
      using auto to declare automatic/local variables in a block.
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c1b1203d
    • J
      net: ipv4/ipv6: Remove extern from function prototypes · 7e58487b
      Joe Perches 提交于
      There are a mix of function prototypes with and without extern
      in the kernel sources.  Standardize on not using extern for
      function prototypes.
      
      Function prototypes don't need to be written with extern.
      extern is assumed by the compiler.  Its use is as unnecessary as
      using auto to declare automatic/local variables in a block.
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7e58487b
    • J
      net: dccp: Remove extern from function prototypes · a402a5aa
      Joe Perches 提交于
      There are a mix of function prototypes with and without extern
      in the kernel sources.  Standardize on not using extern for
      function prototypes.
      
      Function prototypes don't need to be written with extern.
      extern is assumed by the compiler.  Its use is as unnecessary as
      using auto to declare automatic/local variables in a block.
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a402a5aa
    • J
      net: 8021q/bluetooth/bridge/can/ceph: Remove extern from function prototypes · 348662a1
      Joe Perches 提交于
      There are a mix of function prototypes with and without extern
      in the kernel sources.  Standardize on not using extern for
      function prototypes.
      
      Function prototypes don't need to be written with extern.
      extern is assumed by the compiler.  Its use is as unnecessary as
      using auto to declare automatic/local variables in a block.
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      348662a1
    • E
      ipv4: gso: send_check() & segment() cleanups · 47d27aad
      Eric Dumazet 提交于
      inet_gso_segment() and inet_gso_send_check() are called by
      skb_mac_gso_segment() under rcu lock, no need to use
      rcu_read_lock() / rcu_read_unlock()
      
      Avoid calling ip_hdr() twice per function.
      
      We can use ip_send_check() helper.
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      47d27aad
    • A
      batman-adv: make the backbone gw check VLAN specific · cfd4f757
      Antonio Quartulli 提交于
      The backbone gw check has to be VLAN specific so that code
      using it can specify VID where the check has to be done.
      
      In the TT code, the check has been moved into the
      tt_global_add() function so that it can be performed on a
      per-entry basis instead of ignoring all the TT data received
      from another backbone node. Only TT global entries belonging
      to the VLAN where the backbone node is connected to are
      skipped.
      All the other spots where the TT code was checking whether a
      node is a backbone have been removed.
      
      Moreover, batadv_bla_is_backbone_gw_orig() now returns bool
      since it used to return only 1 or 0.
      
      Cc: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
      Signed-off-by: NAntonio Quartulli <antonio@open-mesh.com>
      Signed-off-by: NMarek Lindner <lindner_marek@yahoo.de>
      cfd4f757
    • A
      batman-adv: make the TT global purge routine VLAN specific · 95fb130d
      Antonio Quartulli 提交于
      Instead of unconditionally removing all the TT entries
      served by a given originator, make tt_global_orig_del()
      remove only entries matching a given VLAN identifier
      provided as argument.
      
      If such argument is negative all the global entries
      served by the originator are removed.
      
      This change is used into the BLA code to purge entries
      served by a newly discovered Backbone node, but limiting
      the operation only to those connected to the VLAN where the
      backbone has been discovered.
      
      Cc: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
      Signed-off-by: NAntonio Quartulli <antonio@open-mesh.com>
      Signed-off-by: NMarek Lindner <lindner_marek@yahoo.de>
      95fb130d
    • A
      batman-adv: make the TT CRC logic VLAN specific · 7ea7b4a1
      Antonio Quartulli 提交于
      This change allows nodes to handle the TT table on a
      per-VLAN basis. This is needed because nodes may have to
      store only some of the global entries advertised by another
      node.
      
      In this scenario such nodes would re-create only a partial
      global table and would not be able to compute a correct CRC
      anymore.
      
      This patch splits the logic and introduces one CRC per VLAN.
      In this way a node fetching only some entries belonging to
      some VLANs is still able to compute the needed CRCs and
      still check the table correctness.
      
      With this patch the shape of the TVLV-TT is changed too
      because now a node needs to advertise all the CRCs of all
      the VLANs that it is wired to.
      
      The debug output of the local Translation Table now shows
      the CRC along with each entry since there is not a common
      value for the entire table anymore.
      Signed-off-by: NAntonio Quartulli <antonio@open-mesh.com>
      Signed-off-by: NMarek Lindner <lindner_marek@yahoo.de>
      7ea7b4a1
  3. 19 10月, 2013 18 次提交