1. 02 Oct, 2013 6 commits
    • baker.zhang's avatar
      fib_trie: avoid a redundant bit judgement in inflate · bbe34cf8
      baker.zhang authored
      Because 'node' is the i'st child of 'oldnode',
      thus, here 'i' equals
      tkey_extract_bits(node->key, oldtnode->pos, oldtnode->bits)
      
      we just get 1 more bit,
      and need not care the detail value of this bits.
      
      I apologize for the mistake.
      
      I generated the patch on a branch version,
      and did not notice the put_child has been changed.
      
      I have redone the test on HEAD version with my patch.
      
      two cases are used.
      case 1. inflate a node which has a leaf child node.
      case 2: inflate a node which has a an child node with skipped bits
      
      test env:
        ip link set eth0 up
        ip a add dev eth0 192.168.11.1/32
      here, we just focus on route table(MAIN),
      so I use a "192.168.11.1/32" address to simplify the test case.
      
      call trace:
      + fib_insert_node
      + + trie_rebalance
      + + + resize
      + + + + inflate
      
      Test case 1:  inflate a node which has a leaf child node.
      
      ===========================================================
      step 1. prepare a fib trie
      ------------------------------------------
        ip r a 192.168.0.0/24 via 192.168.11.1
        ip r a 192.168.1.0/24 via 192.168.11.1
      
      we get a fib trie.
      root@baker:~# cat /proc/net/fib_trie
      Main:
        +-- 192.168.0.0/23 1 0 0
         |-- 192.168.0.0
          /24 universe UNICAST
         |-- 192.168.1.0
          /24 universe UNICAST
      Local:
      .....
      
      step 2. Add the third route
      ------------------------------------------
      root@baker:~# ip r a 192.168.2.0/24 via 192.168.11.1
      
      A fib_trie leaf will be inserted in fib_insert_node before trie_rebalance.
      
      For function 'inflate':
      'inflate' is called with following trie.
        +-- 192.168.0.0/22 1 1 0 <=== tn node
          +-- 192.168.0.0/23 1 0 0    <== node a
              |-- 192.168.0.0
                /24 universe UNICAST
              |-- 192.168.1.0
                /24 universe UNICAST
            |-- 192.168.2.0          <== leaf(node b)
      
      When process node b, which is a leaf. here:
      i is 1,
      node key "192.168.2.0"
      oldnode is (pos:22, bits:1)
      
      unpatch source:
      tkey_extract_bits(node->key, oldtnode->pos + oldtnode->bits, 1)
      it equals:
      tkey_extract_bits("192.168,2,0", 22 + 1, 1)
      
      thus got 0, and call put_child(tn, 2*i, node); <== 2*i=2.
      
      patched source:
      tkey_extract_bits(node->key, oldtnode->pos, oldtnode->bits + 1),
      tkey_extract_bits("192.168,2,0", 22, 1 + 1)  <== get 2.
      
      Test case 2:  inflate a node which has a an child node with skipped bits
      ==========================================================================
      step 1. prepare a fib trie.
        ip link set eth0 up
        ip a add dev eth0 192.168.11.1/32
        ip r a 192.168.128.0/24 via 192.168.11.1
        ip r a 192.168.0.0/24  via 192.168.11.1
        ip r a 192.168.16.0/24   via 192.168.11.1
        ip r a 192.168.32.0/24  via 192.168.11.1
        ip r a 192.168.48.0/24  via 192.168.11.1
        ip r a 192.168.144.0/24   via 192.168.11.1
        ip r a 192.168.160.0/24   via 192.168.11.1
        ip r a 192.168.176.0/24   via 192.168.11.1
      
      check:
      root@baker:~# cat /proc/net/fib_trie
      Main:
        +-- 192.168.0.0/16 1 0 0
           +-- 192.168.0.0/18 2 0 0
              |-- 192.168.0.0
                 /24 universe UNICAST
              |-- 192.168.16.0
                 /24 universe UNICAST
              |-- 192.168.32.0
                 /24 universe UNICAST
              |-- 192.168.48.0
                 /24 universe UNICAST
           +-- 192.168.128.0/18 2 0 0
              |-- 192.168.128.0
                 /24 universe UNICAST
              |-- 192.168.144.0
                 /24 universe UNICAST
              |-- 192.168.160.0
                 /24 universe UNICAST
              |-- 192.168.176.0
                 /24 universe UNICAST
      Local:
        ...
      
      step 2. add a route to trigger inflate.
        ip r a 192.168.96.0/24   via 192.168.11.1
      
      This command will call serveral times inflate.
      In the first time, the fib_trie is:
      ________________________
      +-- 192.168.128.0/(16, 1) <== tn node
       +-- 192.168.0.0/(17, 1)  <== node a
        +-- 192.168.0.0/(18, 2)
         |-- 192.168.0.0
         |-- 192.168.16.0
         |-- 192.168.32.0
         |-- 192.168.48.0
        |-- 192.168.96.0
       +-- 192.168.128.0/(18, 2) <== node b.
        |-- 192.168.128.0
        |-- 192.168.144.0
        |-- 192.168.160.0
        |-- 192.168.176.0
      
      NOTE: node b is a interal node with skipped bits.
      here,
      i:1,
      node->key "192.168.128.0",
      oldnode:(pos:16, bits:1)
      so
      tkey_extract_bits(node->key, oldtnode->pos + oldtnode->bits, 1)
      it equals:
      tkey_extract_bits("192.168,128,0", 16 + 1, 1) <=== 0
      
      tkey_extract_bits(node->key, oldtnode->pos, oldtnode->bits, 1)
      it equals:
      tkey_extract_bits("192.168,128,0", 16, 1+1) <=== 2
      
      2*i + 0 == 2, so the result is same.
      Signed-off-by: default avatarbaker.zhang <baker.kernel@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bbe34cf8
    • Jesper Juhl's avatar
      isdn: eicon: free pointer after using it in log msg in divas_um_idi_delete_entity() · 84557783
      Jesper Juhl authored
      Not really a problem, but nice IMHO; the Coverity static analyzer
      complains that we use the pointer 'e' after it has been freed, so move
      the freeing below the final use, even if that use is just using the
      value of the pointer and not actually dereferencing it.
      Signed-off-by: default avatarJesper Juhl <jj@chaosbits.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      84557783
    • Wei Liu's avatar
      xen-netfront: convert to GRO API · 99d3d587
      Wei Liu authored
      Anirban was seeing netfront received MTU size packets, which downgraded
      throughput. The following patch makes netfront use GRO API which
      improves throughput for that case.
      Signed-off-by: default avatarWei Liu <wei.liu2@citrix.com>
      Cc: Anirban Chakraborty <abchak@juniper.net>
      Cc: Ian Campbell <ian.campbell@citrix.com>
      Acked-by: default avatarKonrad Wilk <konrad.wilk@oracle.com>
      Acked-by: default avatarIan Campbell <ian.campbell@citrix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      99d3d587
    • Hauke Mehrtens's avatar
      tg3: use phylib when robo switch is in use · ee002b64
      Hauke Mehrtens authored
      When a switch is connected as a PHY to the MAC driven by tg3, use
      phylib and provide the phy address to tg3 from the sprom.
      Signed-off-by: default avatarHauke Mehrtens <hauke@hauke-m.de>
      Acked-by: default avatarNithin Nayak Sujir <nsujir@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ee002b64
    • Hauke Mehrtens's avatar
      ssb: provide phy address for Gigabit Ethernet driver · 4bcef89f
      Hauke Mehrtens authored
      Add a function to provide the phy address which should be used to the
      Gigabit Ethernet driver connected to ssb.
      Signed-off-by: default avatarHauke Mehrtens <hauke@hauke-m.de>
      Reviewed-by: default avatarNithin Nayak Sujir <nsujir@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4bcef89f
    • Hauke Mehrtens's avatar
      tg3: add support a phy at an address different than 01 · ead2402c
      Hauke Mehrtens authored
      When phylib was in use tg3 only searched at address 01 on the mdio
      bus and did not work with any other address. On the BCM4705 SoCs the
      switch is connected as a PHY behind the MAC driven by tg3 and it is at
      PHY address 30 in most cases. This is a preparation patch to allow
      support for such switches.
      
      phy_addr is set to TG3_PHY_MII_ADDR for all devices, which are using
      phylib, so this should not change any behavior.
      Signed-off-by: default avatarHauke Mehrtens <hauke@hauke-m.de>
      Acked-by: default avatarNithin Nayak Sujir <nsujir@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ead2402c
  2. 01 Oct, 2013 34 commits